[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH] hw/misc/pvpanic: realize the configure interface
From: |
Peng Hao |
Subject: |
[Qemu-arm] [PATCH] hw/misc/pvpanic: realize the configure interface |
Date: |
Sun, 25 Nov 2018 00:34:32 +0800 |
Add configure interface for pvpanic-mmio. In qemu command line
use -device pvpanic-mmio to enable the device.
Signed-off-by: Peng Hao <address@hidden>
---
hw/arm/virt-acpi-build.c | 5 ++++-
hw/arm/virt.c | 7 +++----
hw/misc/pvpanic.c | 1 +
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 4208e46..cbc415e 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -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);
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 921220a..aeedc43 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -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("/address@hidden" 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);
diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index 6fea162..ce6f5cb 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -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[] = {
--
1.8.3.1
- [Qemu-arm] [PATCH 01/10] hw/misc/pvpanic: Build the pvpanic device in $(common-obj), Peng Hao, 2018/11/24
- [Qemu-arm] [PATCH] hw/misc/pvpanic: realize the configure interface,
Peng Hao <=
- [Qemu-arm] [PATCH 03/10] hw/misc/pvpanic: Add the MMIO interface, Peng Hao, 2018/11/24
- [Qemu-arm] [PATCH 02/10] hw/misc/pvpanic: Cosmetic renaming, Peng Hao, 2018/11/24
- [Qemu-arm] [PATCH 04/10] hw/misc/pvpanic: moving structure definition to header file, Peng Hao, 2018/11/24
- [Qemu-arm] [PATCH 07/10] hw/misc/pvpanic: add configure query interface, Peng Hao, 2018/11/24
- [Qemu-arm] [PATCH 05/10] hw/arm/virt: Use the pvpanic device, Peng Hao, 2018/11/24
- [Qemu-arm] [PATCH 06/10] hw/arm/virt: add pvpanic device in virt acpi table, Peng Hao, 2018/11/24
- [Qemu-arm] [PATCH 08/10] hw/misc/pvpanic: preparing for adding configure interface, Peng Hao, 2018/11/24
- [Qemu-arm] [PATCH 10/10] pvpanic : update pvpanic document, Peng Hao, 2018/11/24