Skip to content

Commit

Permalink
add pvpanic to standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Jan 10, 2024
1 parent 65580e1 commit d63545f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 17 additions & 1 deletion bin/propolis-standalone/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 3 additions & 1 deletion lib/propolis/src/hw/qemu/pvpanic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -102,6 +104,6 @@ impl QemuPvpanic {

impl Entity for QemuPvpanic {
fn type_name(&self) -> &'static str {
"qemu-pvpanic"
DEVICE_NAME
}
}

0 comments on commit d63545f

Please sign in to comment.