Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add QEMU pvpanic ISA device #596

Merged
merged 24 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/propolis-server/src/lib/initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl<'a> MachineInitializer<'a> {
uuid: uuid::Uuid,
) -> Result<(), anyhow::Error> {
if let Some(ref spec) = self.spec.devices.qemu_pvpanic {
hawkw marked this conversation as resolved.
Show resolved Hide resolved
if spec.enable_isa {
if spec.enable_mmio {
hawkw marked this conversation as resolved.
Show resolved Hide resolved
let pvpanic = QemuPvpanic::create(
self.log.new(slog::o!("dev" => "qemu-pvpanic")),
);
Expand Down
1 change: 1 addition & 0 deletions bin/propolis-server/src/lib/stats/pvpanic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ impl Producer for PvpanicProducer {

self.host_handled_panics.datum_mut().set(host_handled as i64);
self.guest_handled_panics.datum_mut().set(guest_handled as i64);

let data = vec![
Sample::new(&self.stat_name, &self.guest_handled_panics)?,
Sample::new(&self.stat_name, &self.host_handled_panics)?,
Expand Down
6 changes: 3 additions & 3 deletions bin/propolis-standalone/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,12 +931,12 @@ fn setup_instance(
chipset.pci_attach(bdf, nvme);
}
qemu::pvpanic::DEVICE_NAME => {
let enable_isa = dev
let enable_mmio = dev
.options
.get("enable_isa")
.get("enable_mmio")
.and_then(|opt| opt.as_bool())
.unwrap_or(false);
if enable_isa {
if enable_mmio {
let pvpanic = QemuPvpanic::create(
log.new(slog::o!("dev" => "pvpanic")),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ pub enum MigrationCompatibilityError {
#[serde(deny_unknown_fields)]
pub struct QemuPvpanic {
/// Enable the QEMU PVPANIC ISA bus device (I/O port 0x505).
pub enable_isa: bool,
pub enable_mmio: bool,
// TODO(eliza): add support for the PCI PVPANIC device...
}

Expand Down Expand Up @@ -428,20 +428,20 @@ mod test {

#[test]
fn incompatible_qemu_pvpanic() {
let d1 = Some(QemuPvpanic { enable_isa: true });
let d2 = Some(QemuPvpanic { enable_isa: false });
let d1 = Some(QemuPvpanic { enable_mmio: true });
let d2 = Some(QemuPvpanic { enable_mmio: false });
assert!(d1.can_migrate_from_element(&d2).is_err());
assert!(d1.can_migrate_from_element(&None).is_err());
}

#[test]
fn compatible_qemu_pvpanic() {
let d1 = Some(QemuPvpanic { enable_isa: true });
let d2 = Some(QemuPvpanic { enable_isa: true });
let d1 = Some(QemuPvpanic { enable_mmio: true });
let d2 = Some(QemuPvpanic { enable_mmio: true });
assert!(d1.can_migrate_from_element(&d2).is_ok());

let d1 = Some(QemuPvpanic { enable_isa: false });
let d2 = Some(QemuPvpanic { enable_isa: false });
let d1 = Some(QemuPvpanic { enable_mmio: false });
let d2 = Some(QemuPvpanic { enable_mmio: false });
assert!(d1.can_migrate_from_element(&d2).is_ok());
}
}
4 changes: 2 additions & 2 deletions openapi/propolis-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -1351,13 +1351,13 @@
"QemuPvpanic": {
"type": "object",
"properties": {
"enable_isa": {
"enable_mmio": {
"description": "Enable the QEMU PVPANIC ISA bus device (I/O port 0x505).",
"type": "boolean"
}
},
"required": [
"enable_isa"
"enable_mmio"
],
"additionalProperties": false
},
Expand Down
Loading