From d63545f3d6aac66d473ef8ceb1bede8adafd0276 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Wed, 10 Jan 2024 11:50:12 -0800 Subject: [PATCH] add pvpanic to standalone --- bin/propolis-standalone/src/main.rs | 18 +++++++++++++++++- lib/propolis/src/hw/qemu/pvpanic.rs | 4 +++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/bin/propolis-standalone/src/main.rs b/bin/propolis-standalone/src/main.rs index e9ad90975..10f332a92 100644 --- a/bin/propolis-standalone/src/main.rs +++ b/bin/propolis-standalone/src/main.rs @@ -15,15 +15,17 @@ use std::time::{SystemTime, UNIX_EPOCH}; use anyhow::Context; use clap::Parser; use futures::future::BoxFuture; +use propolis::hw::qemu::pvpanic::QemuPvpanic; +use propolis::inventory::Entity; use slog::{o, Drain}; use strum::IntoEnumIterator; use tokio::runtime; use propolis::chardev::{BlockingSource, Sink, Source, UDSock}; use propolis::hw::chipset::{i440fx, Chipset}; -use propolis::hw::ibmpc; use propolis::hw::ps2::ctrl::PS2Ctrl; use propolis::hw::uart::LpcUart; +use propolis::hw::{ibmpc, qemu}; use propolis::intr_pins::FuncPin; use propolis::usdt::register_probes; use propolis::vcpu::Vcpu; @@ -929,6 +931,20 @@ fn setup_instance( chipset.pci_attach(bdf, nvme); } + qemu::pvpanic::DEVICE_NAME => { + let enable_isa = dev + .options + .get("enable_isa") + .and_then(|opt| opt.as_bool()) + .unwrap_or(false); + if enable_isa { + let pvpanic = QemuPvpanic::create( + log.new(slog::o!("dev" => "pvpanic")), + ); + pvpanic.attach_pio(pio); + inv.register(&pvpanic)?; + } + } _ => { slog::error!(log, "unrecognized driver"; "name" => name); return Err(Error::new( diff --git a/lib/propolis/src/hw/qemu/pvpanic.rs b/lib/propolis/src/hw/qemu/pvpanic.rs index cdf2d9423..5aad5d0e2 100644 --- a/lib/propolis/src/hw/qemu/pvpanic.rs +++ b/lib/propolis/src/hw/qemu/pvpanic.rs @@ -30,6 +30,8 @@ struct Counts { guest_handled: usize, } +pub const DEVICE_NAME: &str = "qemu-pvpanic"; + /// Indicates that a guest panic has happened and should be processed by the /// host const HOST_HANDLED: u8 = 0b01; @@ -102,6 +104,6 @@ impl QemuPvpanic { impl Entity for QemuPvpanic { fn type_name(&self) -> &'static str { - "qemu-pvpanic" + DEVICE_NAME } }