@@ -45,6 +45,7 @@
#include "hw/arm/virt.h"
#include "sysemu/numa.h"
#include "kvm_arm.h"
+#include "hw/misc/pvpanic.h"
#define ARM_SPI_BASE 32
#define ACPI_POWER_BUTTON_DEVICE "PWRB"
@@ -785,7 +786,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
(irqmap[VIRT_UART] + ARM_SPI_BASE));
acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]);
- acpi_dsdt_add_pvpanic(scope, &memmap[VIRT_PVPANIC]);
+ if (pvpanic_mmio()) {
+ acpi_dsdt_add_pvpanic(scope, &memmap[VIRT_PVPANIC]);
+ }
acpi_dsdt_add_fw_cfg(scope, &memmap[VIRT_FW_CFG]);
acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO],
(irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS);
@@ -198,8 +198,6 @@ static void create_pvpanic_device(const VirtMachineState *vms)
hwaddr base = vms->memmap[VIRT_PVPANIC].base;
hwaddr size = vms->memmap[VIRT_PVPANIC].size;
- sysbus_create_simple(TYPE_PVPANIC_MMIO, base, NULL);
-
nodename = g_strdup_printf("/pvpanic-mmio@%" PRIx64, base);
qemu_fdt_add_subnode(vms->fdt, nodename);
qemu_fdt_setprop_string(vms->fdt, nodename,
@@ -1330,6 +1328,9 @@ void virt_machine_done(Notifier *notifier, void *data)
struct arm_boot_info *info = &vms->bootinfo;
AddressSpace *as = arm_boot_address_space(cpu, info);
+ if (pvpanic_mmio()) {
+ create_pvpanic_device(vms);
+ }
/*
* If the user provided a dtb, we assume the dynamic sysbus nodes
* already are integrated there. This corresponds to a use case where
@@ -1551,8 +1552,6 @@ static void machvirt_init(MachineState *machine)
create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem);
- create_pvpanic_device(vms);
-
create_gic(vms, pic);
fdt_add_pmu_nodes(vms);
@@ -119,6 +119,7 @@ static void pvpanic_mmio_initfn(Object *obj)
memory_region_init_io(&s->mr, OBJECT(s), &pvpanic_ops, s,
TYPE_PVPANIC_MMIO, 2);
sysbus_init_mmio(sbd, &s->mr);
+ sysbus_mmio_map(sbd, 0, s->base);
}
static Property pvpanic_mmio_properties[] = {
Add configure interface for pvpanic-mmio. In qemu command line use -device pvpanic-mmio to enable the device. Signed-off-by: Peng Hao <peng.hao2@zte.com.cn> --- hw/arm/virt-acpi-build.c | 5 ++++- hw/arm/virt.c | 7 +++---- hw/misc/pvpanic.c | 1 + 3 files changed, 8 insertions(+), 5 deletions(-)