* [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo
@ 2017-01-02 20:01 Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 01/16] hw/arm/virt-acpi-build: add all missing cpu_to_le's Andrew Jones
` (16 more replies)
0 siblings, 17 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
v2:
- all Igor's suggestions
- added four mach-virt acpi cleanup patches
- added the remaining two acpi patches needed to bring equivalence
to Peter's DT changes
This series is based on Peter's qemu-arm gicv3-virt branch. It's
main goal (patches 07-13), which was suggested by Eduardo, is to
remove an unnecessary structure, VirtGuestInfo, which is a
maintenance burden, as it requires duplicating Virt machine state.
Additionally patches 05-06 do some mach-virt cleanups and patches
14-16 add the ACPI equivalents of the DT patches in Peter's
gicv3-virt branch. The first four patches are cleanups to mach-virt's
acpi code.
Patches available here
https://github.com/rhdrjones/qemu/commits/virt/remove-guest-info-v2
Andrew Jones (16):
hw/arm/virt-acpi-build: add all missing cpu_to_le's
hw/arm/virt-acpi-build: name GIC CPU Interface Structure appropriately
hw/arm/virt-acpi-build: gtdt: improve flag naming
hw/arm/virt-acpi-build: fadt: improve flag naming
hw/arm/virt: parameter passing cleanups
hw/arm/virt: use VirtMachineState.gic_version
hw/arm/virt: eliminate struct VirtGuestInfoState
hw/arm/virt: remove include/hw/arm/virt-acpi-build.h
hw/arm/virt: move VirtMachineState/Class to virt.h
hw/arm/virt: pass VirtMachineState instead of VirtGuestInfo
hw/arm/virt-acpi-build: remove redundant members from VirtGuestInfo
hw/arm/virt-acpi-build: don't save VirtGuestInfo on AcpiBuildState
hw/arm/virt: remove VirtGuestInfo
hw/arm/virt-acpi-build: Don't incorrectly claim architectural timer to
be edge-triggered
hw/arm/virt-acpi-build: use SMC if booting in EL2
hw/arm/virt-acpi-build: madt: add vgic maint irq
MAINTAINERS | 2 -
hw/arm/virt-acpi-build.c | 145 +++++++++++++++++++++------------------
hw/arm/virt.c | 141 +++++++++++++------------------------
include/hw/acpi/acpi-defs.h | 33 +++------
include/hw/arm/virt-acpi-build.h | 47 -------------
include/hw/arm/virt.h | 43 +++++++++++-
6 files changed, 178 insertions(+), 233 deletions(-)
delete mode 100644 include/hw/arm/virt-acpi-build.h
--
2.9.3
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 01/16] hw/arm/virt-acpi-build: add all missing cpu_to_le's
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 02/16] hw/arm/virt-acpi-build: name GIC CPU Interface Structure appropriately Andrew Jones
` (15 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
hw/arm/virt-acpi-build.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index d4160dfa7d34..f4b43562287a 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -542,17 +542,18 @@ build_gtdt(GArray *table_data, BIOSLinker *linker)
gtdt = acpi_data_push(table_data, sizeof *gtdt);
/* The interrupt values are the same with the device tree when adding 16 */
- gtdt->secure_el1_interrupt = ARCH_TIMER_S_EL1_IRQ + 16;
- gtdt->secure_el1_flags = ACPI_EDGE_SENSITIVE;
+ gtdt->secure_el1_interrupt = cpu_to_le32(ARCH_TIMER_S_EL1_IRQ + 16);
+ gtdt->secure_el1_flags = cpu_to_le32(ACPI_EDGE_SENSITIVE);
- gtdt->non_secure_el1_interrupt = ARCH_TIMER_NS_EL1_IRQ + 16;
- gtdt->non_secure_el1_flags = ACPI_EDGE_SENSITIVE | ACPI_GTDT_ALWAYS_ON;
+ gtdt->non_secure_el1_interrupt = cpu_to_le32(ARCH_TIMER_NS_EL1_IRQ + 16);
+ gtdt->non_secure_el1_flags = cpu_to_le32(ACPI_EDGE_SENSITIVE |
+ ACPI_GTDT_ALWAYS_ON);
- gtdt->virtual_timer_interrupt = ARCH_TIMER_VIRT_IRQ + 16;
- gtdt->virtual_timer_flags = ACPI_EDGE_SENSITIVE;
+ gtdt->virtual_timer_interrupt = cpu_to_le32(ARCH_TIMER_VIRT_IRQ + 16);
+ gtdt->virtual_timer_flags = cpu_to_le32(ACPI_EDGE_SENSITIVE);
- gtdt->non_secure_el2_interrupt = ARCH_TIMER_NS_EL2_IRQ + 16;
- gtdt->non_secure_el2_flags = ACPI_EDGE_SENSITIVE;
+ gtdt->non_secure_el2_interrupt = cpu_to_le32(ARCH_TIMER_NS_EL2_IRQ + 16);
+ gtdt->non_secure_el2_flags = cpu_to_le32(ACPI_EDGE_SENSITIVE);
build_header(linker, table_data,
(void *)(table_data->data + gtdt_start), "GTDT",
@@ -576,7 +577,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
gicd = acpi_data_push(table_data, sizeof *gicd);
gicd->type = ACPI_APIC_GENERIC_DISTRIBUTOR;
gicd->length = sizeof(*gicd);
- gicd->base_address = memmap[VIRT_GIC_DIST].base;
+ gicd->base_address = cpu_to_le64(memmap[VIRT_GIC_DIST].base);
gicd->version = guest_info->gic_version;
for (i = 0; i < guest_info->smp_cpus; i++) {
@@ -587,11 +588,11 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
gicc->type = ACPI_APIC_GENERIC_INTERRUPT;
gicc->length = sizeof(*gicc);
if (guest_info->gic_version == 2) {
- gicc->base_address = memmap[VIRT_GIC_CPU].base;
+ gicc->base_address = cpu_to_le64(memmap[VIRT_GIC_CPU].base);
}
- gicc->cpu_interface_number = i;
- gicc->arm_mpidr = armcpu->mp_affinity;
- gicc->uid = i;
+ gicc->cpu_interface_number = cpu_to_le32(i);
+ gicc->arm_mpidr = cpu_to_le64(armcpu->mp_affinity);
+ gicc->uid = cpu_to_le32(i);
gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED);
if (arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 02/16] hw/arm/virt-acpi-build: name GIC CPU Interface Structure appropriately
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 01/16] hw/arm/virt-acpi-build: add all missing cpu_to_le's Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 03/16] hw/arm/virt-acpi-build: gtdt: improve flag naming Andrew Jones
` (14 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
Also move the enabled flag definition from mach-virt code to
acpi common.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
hw/arm/virt-acpi-build.c | 8 ++++----
include/hw/acpi/acpi-defs.h | 9 ++++++---
include/hw/arm/virt-acpi-build.h | 2 --
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index f4b43562287a..0ed406cdd89c 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -581,11 +581,11 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
gicd->version = guest_info->gic_version;
for (i = 0; i < guest_info->smp_cpus; i++) {
- AcpiMadtGenericInterrupt *gicc = acpi_data_push(table_data,
- sizeof *gicc);
+ AcpiMadtGenericCpuInterface *gicc = acpi_data_push(table_data,
+ sizeof(*gicc));
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
- gicc->type = ACPI_APIC_GENERIC_INTERRUPT;
+ gicc->type = ACPI_APIC_GENERIC_CPU_INTERFACE;
gicc->length = sizeof(*gicc);
if (guest_info->gic_version == 2) {
gicc->base_address = cpu_to_le64(memmap[VIRT_GIC_CPU].base);
@@ -593,7 +593,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
gicc->cpu_interface_number = cpu_to_le32(i);
gicc->arm_mpidr = cpu_to_le64(armcpu->mp_affinity);
gicc->uid = cpu_to_le32(i);
- gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED);
+ gicc->flags = cpu_to_le32(ACPI_MADT_GICC_ENABLED);
if (arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
gicc->performance_interrupt = cpu_to_le32(PPI(VIRTUAL_PMU_IRQ));
diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
index 154f3b82f6dc..510f23c93183 100644
--- a/include/hw/acpi/acpi-defs.h
+++ b/include/hw/acpi/acpi-defs.h
@@ -290,7 +290,7 @@ typedef struct AcpiMultipleApicTable AcpiMultipleApicTable;
#define ACPI_APIC_XRUPT_SOURCE 8
#define ACPI_APIC_LOCAL_X2APIC 9
#define ACPI_APIC_LOCAL_X2APIC_NMI 10
-#define ACPI_APIC_GENERIC_INTERRUPT 11
+#define ACPI_APIC_GENERIC_CPU_INTERFACE 11
#define ACPI_APIC_GENERIC_DISTRIBUTOR 12
#define ACPI_APIC_GENERIC_MSI_FRAME 13
#define ACPI_APIC_GENERIC_REDISTRIBUTOR 14
@@ -361,7 +361,7 @@ struct AcpiMadtLocalX2ApicNmi {
} QEMU_PACKED;
typedef struct AcpiMadtLocalX2ApicNmi AcpiMadtLocalX2ApicNmi;
-struct AcpiMadtGenericInterrupt {
+struct AcpiMadtGenericCpuInterface {
ACPI_SUB_HEADER_DEF
uint16_t reserved;
uint32_t cpu_interface_number;
@@ -378,7 +378,10 @@ struct AcpiMadtGenericInterrupt {
uint64_t arm_mpidr;
} QEMU_PACKED;
-typedef struct AcpiMadtGenericInterrupt AcpiMadtGenericInterrupt;
+typedef struct AcpiMadtGenericCpuInterface AcpiMadtGenericCpuInterface;
+
+/* GICC CPU Interface Flags */
+#define ACPI_MADT_GICC_ENABLED 1
struct AcpiMadtGenericDistributor {
ACPI_SUB_HEADER_DEF
diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h
index f5ec749b8fea..2bcd22265cfa 100644
--- a/include/hw/arm/virt-acpi-build.h
+++ b/include/hw/arm/virt-acpi-build.h
@@ -24,8 +24,6 @@
#include "hw/arm/virt.h"
#include "qemu/notify.h"
-#define ACPI_GICC_ENABLED 1
-
typedef struct VirtGuestInfo {
int smp_cpus;
FWCfgState *fw_cfg;
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 03/16] hw/arm/virt-acpi-build: gtdt: improve flag naming
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 01/16] hw/arm/virt-acpi-build: add all missing cpu_to_le's Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 02/16] hw/arm/virt-acpi-build: name GIC CPU Interface Structure appropriately Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 04/16] hw/arm/virt-acpi-build: fadt: " Andrew Jones
` (13 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
Also remove all unused flags.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
hw/arm/virt-acpi-build.c | 10 +++++-----
include/hw/acpi/acpi-defs.h | 17 ++---------------
2 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 0ed406cdd89c..b6b64296f119 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -543,17 +543,17 @@ build_gtdt(GArray *table_data, BIOSLinker *linker)
gtdt = acpi_data_push(table_data, sizeof *gtdt);
/* The interrupt values are the same with the device tree when adding 16 */
gtdt->secure_el1_interrupt = cpu_to_le32(ARCH_TIMER_S_EL1_IRQ + 16);
- gtdt->secure_el1_flags = cpu_to_le32(ACPI_EDGE_SENSITIVE);
+ gtdt->secure_el1_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE);
gtdt->non_secure_el1_interrupt = cpu_to_le32(ARCH_TIMER_NS_EL1_IRQ + 16);
- gtdt->non_secure_el1_flags = cpu_to_le32(ACPI_EDGE_SENSITIVE |
- ACPI_GTDT_ALWAYS_ON);
+ gtdt->non_secure_el1_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE |
+ ACPI_GTDT_CAP_ALWAYS_ON);
gtdt->virtual_timer_interrupt = cpu_to_le32(ARCH_TIMER_VIRT_IRQ + 16);
- gtdt->virtual_timer_flags = cpu_to_le32(ACPI_EDGE_SENSITIVE);
+ gtdt->virtual_timer_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE);
gtdt->non_secure_el2_interrupt = cpu_to_le32(ARCH_TIMER_NS_EL2_IRQ + 16);
- gtdt->non_secure_el2_flags = cpu_to_le32(ACPI_EDGE_SENSITIVE);
+ gtdt->non_secure_el2_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE);
build_header(linker, table_data,
(void *)(table_data->data + gtdt_start), "GTDT",
diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
index 510f23c93183..8fe0996e15fb 100644
--- a/include/hw/acpi/acpi-defs.h
+++ b/include/hw/acpi/acpi-defs.h
@@ -430,21 +430,8 @@ typedef struct AcpiMadtGenericTranslator AcpiMadtGenericTranslator;
/*
* Generic Timer Description Table (GTDT)
*/
-
-#define ACPI_GTDT_INTERRUPT_MODE (1 << 0)
-#define ACPI_GTDT_INTERRUPT_POLARITY (1 << 1)
-#define ACPI_GTDT_ALWAYS_ON (1 << 2)
-
-/* Triggering */
-
-#define ACPI_LEVEL_SENSITIVE ((uint8_t) 0x00)
-#define ACPI_EDGE_SENSITIVE ((uint8_t) 0x01)
-
-/* Polarity */
-
-#define ACPI_ACTIVE_HIGH ((uint8_t) 0x00)
-#define ACPI_ACTIVE_LOW ((uint8_t) 0x01)
-#define ACPI_ACTIVE_BOTH ((uint8_t) 0x02)
+#define ACPI_GTDT_INTERRUPT_MODE_EDGE (1 << 0)
+#define ACPI_GTDT_CAP_ALWAYS_ON (1 << 2)
struct AcpiGenericTimerTable {
ACPI_TABLE_HEADER_DEF
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 04/16] hw/arm/virt-acpi-build: fadt: improve flag naming
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (2 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 03/16] hw/arm/virt-acpi-build: gtdt: improve flag naming Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 05/16] hw/arm/virt: parameter passing cleanups Andrew Jones
` (12 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
hw/arm/virt-acpi-build.c | 4 ++--
include/hw/acpi/acpi-defs.h | 6 ++----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index b6b64296f119..a6c6180f4bce 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -642,8 +642,8 @@ build_fadt(GArray *table_data, BIOSLinker *linker, unsigned dsdt_tbl_offset)
/* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */
fadt->flags = cpu_to_le32(1 << ACPI_FADT_F_HW_REDUCED_ACPI);
- fadt->arm_boot_flags = cpu_to_le16((1 << ACPI_FADT_ARM_USE_PSCI_G_0_2) |
- (1 << ACPI_FADT_ARM_PSCI_USE_HVC));
+ fadt->arm_boot_flags = cpu_to_le16(ACPI_FADT_ARM_PSCI_COMPLIANT |
+ ACPI_FADT_ARM_PSCI_USE_HVC);
/* ACPI v5.1 (fadt->revision.fadt->minor_revision) */
fadt->minor_revision = 0x1;
diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
index 8fe0996e15fb..d15b7e5cd39a 100644
--- a/include/hw/acpi/acpi-defs.h
+++ b/include/hw/acpi/acpi-defs.h
@@ -191,10 +191,8 @@ struct AcpiFadtDescriptorRev5_1 {
typedef struct AcpiFadtDescriptorRev5_1 AcpiFadtDescriptorRev5_1;
-enum {
- ACPI_FADT_ARM_USE_PSCI_G_0_2 = 0,
- ACPI_FADT_ARM_PSCI_USE_HVC = 1,
-};
+#define ACPI_FADT_ARM_PSCI_COMPLIANT (1 << 0)
+#define ACPI_FADT_ARM_PSCI_USE_HVC (1 << 1)
/*
* Serial Port Console Redirection Table (SPCR), Rev. 1.02
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 05/16] hw/arm/virt: parameter passing cleanups
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (3 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 04/16] hw/arm/virt-acpi-build: fadt: " Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 06/16] hw/arm/virt: use VirtMachineState.gic_version Andrew Jones
` (11 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
Some simple cleanups made possible by "hw/arm/virt: Merge
VirtBoardInfo and VirtMachineState"
Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/arm/virt.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 7eec50a82494..d451bc4f6b9b 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -570,10 +570,10 @@ static void create_v2m(VirtMachineState *vms, qemu_irq *pic)
fdt_add_v2m_gic_node(vms);
}
-static void create_gic(VirtMachineState *vms, qemu_irq *pic, int type,
- bool secure, bool no_its)
+static void create_gic(VirtMachineState *vms, qemu_irq *pic, int type)
{
/* We create a standalone GIC */
+ VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
DeviceState *gicdev;
SysBusDevice *gicbusdev;
const char *gictype;
@@ -589,7 +589,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic, int type,
*/
qdev_prop_set_uint32(gicdev, "num-irq", NUM_IRQS + 32);
if (!kvm_irqchip_in_kernel()) {
- qdev_prop_set_bit(gicdev, "has-security-extensions", secure);
+ qdev_prop_set_bit(gicdev, "has-security-extensions", vms->secure);
}
qdev_init_nofail(gicdev);
gicbusdev = SYS_BUS_DEVICE(gicdev);
@@ -643,7 +643,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic, int type,
fdt_add_gic_node(vms, type);
- if (type == 3 && !no_its) {
+ if (type == 3 && !vmc->no_its) {
create_its(vms, gicdev);
} else if (type == 2) {
create_v2m(vms, pic);
@@ -1005,8 +1005,7 @@ static void create_pcie_irq_map(const VirtMachineState *vms,
0x7 /* PCI irq */);
}
-static void create_pcie(const VirtMachineState *vms, qemu_irq *pic,
- bool use_highmem)
+static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
{
hwaddr base_mmio = vms->memmap[VIRT_PCIE_MMIO].base;
hwaddr size_mmio = vms->memmap[VIRT_PCIE_MMIO].size;
@@ -1049,7 +1048,7 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic,
mmio_reg, base_mmio, size_mmio);
memory_region_add_subregion(get_system_memory(), base_mmio, mmio_alias);
- if (use_highmem) {
+ if (vms->highmem) {
/* Map high MMIO space */
MemoryRegion *high_mmio_alias = g_new0(MemoryRegion, 1);
@@ -1098,7 +1097,7 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic,
qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
2, base_ecam, 2, size_ecam);
- if (use_highmem) {
+ if (vms->highmem) {
qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "ranges",
1, FDT_PCI_RANGE_IOPORT, 2, 0,
2, base_pio, 2, size_pio,
@@ -1428,7 +1427,7 @@ static void machvirt_init(MachineState *machine)
create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem);
- create_gic(vms, pic, gic_version, vms->secure, vmc->no_its);
+ create_gic(vms, pic, gic_version);
fdt_add_pmu_nodes(vms, gic_version);
@@ -1441,7 +1440,7 @@ static void machvirt_init(MachineState *machine)
create_rtc(vms, pic);
- create_pcie(vms, pic, vms->highmem);
+ create_pcie(vms, pic);
create_gpio(vms, pic);
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 06/16] hw/arm/virt: use VirtMachineState.gic_version
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (4 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 05/16] hw/arm/virt: parameter passing cleanups Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 07/16] hw/arm/virt: eliminate struct VirtGuestInfoState Andrew Jones
` (10 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
machvirt_init may need to probe for the gic version. If so, then
make sure the result is written to VirtMachineState. With the
state up to date, use it instead of a local variable. This is a
cleanup that prepares for VirtMachineState to be passed to functions
even outside hw/arm/virt.c
Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/arm/virt.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index d451bc4f6b9b..67c0abb30b5b 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -319,7 +319,7 @@ static void fdt_add_psci_node(const VirtMachineState *vms)
qemu_fdt_setprop_cell(fdt, "/psci", "migrate", migrate_fn);
}
-static void fdt_add_timer_nodes(const VirtMachineState *vms, int gictype)
+static void fdt_add_timer_nodes(const VirtMachineState *vms)
{
/* On real hardware these interrupts are level-triggered.
* On KVM they were edge-triggered before host kernel version 4.4,
@@ -347,7 +347,7 @@ static void fdt_add_timer_nodes(const VirtMachineState *vms, int gictype)
irqflags = GIC_FDT_IRQ_FLAGS_EDGE_LO_HI;
}
- if (gictype == 2) {
+ if (vms->gic_version == 2) {
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
GIC_FDT_IRQ_PPI_CPU_WIDTH,
(1 << vms->smp_cpus) - 1);
@@ -462,7 +462,7 @@ static void fdt_add_v2m_gic_node(VirtMachineState *vms)
qemu_fdt_setprop_cell(vms->fdt, "/intc/v2m", "phandle", vms->msi_phandle);
}
-static void fdt_add_gic_node(VirtMachineState *vms, int type)
+static void fdt_add_gic_node(VirtMachineState *vms)
{
vms->gic_phandle = qemu_fdt_alloc_phandle(vms->fdt);
qemu_fdt_setprop_cell(vms->fdt, "/", "interrupt-parent", vms->gic_phandle);
@@ -473,7 +473,7 @@ static void fdt_add_gic_node(VirtMachineState *vms, int type)
qemu_fdt_setprop_cell(vms->fdt, "/intc", "#address-cells", 0x2);
qemu_fdt_setprop_cell(vms->fdt, "/intc", "#size-cells", 0x2);
qemu_fdt_setprop(vms->fdt, "/intc", "ranges", NULL, 0);
- if (type == 3) {
+ if (vms->gic_version == 3) {
qemu_fdt_setprop_string(vms->fdt, "/intc", "compatible",
"arm,gic-v3");
qemu_fdt_setprop_sized_cells(vms->fdt, "/intc", "reg",
@@ -500,7 +500,7 @@ static void fdt_add_gic_node(VirtMachineState *vms, int type)
qemu_fdt_setprop_cell(vms->fdt, "/intc", "phandle", vms->gic_phandle);
}
-static void fdt_add_pmu_nodes(const VirtMachineState *vms, int gictype)
+static void fdt_add_pmu_nodes(const VirtMachineState *vms)
{
CPUState *cpu;
ARMCPU *armcpu;
@@ -514,7 +514,7 @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms, int gictype)
}
}
- if (gictype == 2) {
+ if (vms->gic_version == 2) {
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
GIC_FDT_IRQ_PPI_CPU_WIDTH,
(1 << vms->smp_cpus) - 1);
@@ -570,14 +570,14 @@ static void create_v2m(VirtMachineState *vms, qemu_irq *pic)
fdt_add_v2m_gic_node(vms);
}
-static void create_gic(VirtMachineState *vms, qemu_irq *pic, int type)
+static void create_gic(VirtMachineState *vms, qemu_irq *pic)
{
/* We create a standalone GIC */
VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
DeviceState *gicdev;
SysBusDevice *gicbusdev;
const char *gictype;
- int i;
+ int type = vms->gic_version, i;
gictype = (type == 3) ? gicv3_class_name() : gic_class_name();
@@ -641,7 +641,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic, int type)
pic[i] = qdev_get_gpio_in(gicdev, i);
}
- fdt_add_gic_node(vms, type);
+ fdt_add_gic_node(vms);
if (type == 3 && !vmc->no_its) {
create_its(vms, gicdev);
@@ -1237,7 +1237,6 @@ static void machvirt_init(MachineState *machine)
qemu_irq pic[NUM_IRQS];
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *secure_sysmem = NULL;
- int gic_version = vms->gic_version;
int n, virt_max_cpus;
MemoryRegion *ram = g_new(MemoryRegion, 1);
const char *cpu_model = machine->cpu_model;
@@ -1258,14 +1257,14 @@ static void machvirt_init(MachineState *machine)
/* We can probe only here because during property set
* KVM is not available yet
*/
- if (!gic_version) {
+ if (!vms->gic_version) {
if (!kvm_enabled()) {
error_report("gic-version=host requires KVM");
exit(1);
}
- gic_version = kvm_arm_vgic_probe();
- if (!gic_version) {
+ vms->gic_version = kvm_arm_vgic_probe();
+ if (!vms->gic_version) {
error_report("Unable to determine GIC version supported by host");
exit(1);
}
@@ -1300,7 +1299,7 @@ static void machvirt_init(MachineState *machine)
/* The maximum number of CPUs depends on the GIC version, or on how
* many redistributors we can fit into the memory map.
*/
- if (gic_version == 3) {
+ if (vms->gic_version == 3) {
virt_max_cpus = vms->memmap[VIRT_GIC_REDIST].size / 0x20000;
clustersz = GICV3_TARGETLIST_BITS;
} else {
@@ -1417,7 +1416,7 @@ static void machvirt_init(MachineState *machine)
object_property_set_bool(cpuobj, true, "realized", NULL);
}
- fdt_add_timer_nodes(vms, gic_version);
+ fdt_add_timer_nodes(vms);
fdt_add_cpu_nodes(vms);
fdt_add_psci_node(vms);
@@ -1427,9 +1426,9 @@ static void machvirt_init(MachineState *machine)
create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem);
- create_gic(vms, pic, gic_version);
+ create_gic(vms, pic);
- fdt_add_pmu_nodes(vms, gic_version);
+ fdt_add_pmu_nodes(vms);
create_uart(vms, pic, VIRT_UART, sysmem, serial_hds[0]);
@@ -1458,7 +1457,7 @@ static void machvirt_init(MachineState *machine)
guest_info->memmap = vms->memmap;
guest_info->irqmap = vms->irqmap;
guest_info->use_highmem = vms->highmem;
- guest_info->gic_version = gic_version;
+ guest_info->gic_version = vms->gic_version;
guest_info->no_its = vmc->no_its;
guest_info_state->machine_done.notify = virt_guest_info_machine_done;
qemu_add_machine_init_done_notifier(&guest_info_state->machine_done);
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 07/16] hw/arm/virt: eliminate struct VirtGuestInfoState
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (5 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 06/16] hw/arm/virt: use VirtMachineState.gic_version Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 08/16] hw/arm/virt: remove include/hw/arm/virt-acpi-build.h Andrew Jones
` (9 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
Instead of allocating a new struct just for VirtGuestInfo and the
machine_done Notifier, place them inside VirtMachineState. This
is the mach-virt equivalent of "pc: Eliminate struct
PcGuestInfoState"
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/arm/virt.c | 20 +++++++++++---------
include/hw/arm/virt-acpi-build.h | 6 ------
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 67c0abb30b5b..d242980869bc 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -76,6 +76,8 @@ typedef struct {
typedef struct {
MachineState parent;
+ VirtGuestInfo acpi_guest_info;
+ Notifier machine_done;
bool secure;
bool highmem;
bool virt;
@@ -1222,12 +1224,13 @@ static void virt_build_smbios(VirtGuestInfo *guest_info)
}
static
-void virt_guest_info_machine_done(Notifier *notifier, void *data)
+void virt_machine_done(Notifier *notifier, void *data)
{
- VirtGuestInfoState *guest_info_state = container_of(notifier,
- VirtGuestInfoState, machine_done);
- virt_acpi_setup(&guest_info_state->info);
- virt_build_smbios(&guest_info_state->info);
+ VirtMachineState *vms = container_of(notifier, VirtMachineState,
+ machine_done);
+
+ virt_acpi_setup(&vms->acpi_guest_info);
+ virt_build_smbios(&vms->acpi_guest_info);
}
static void machvirt_init(MachineState *machine)
@@ -1240,8 +1243,7 @@ static void machvirt_init(MachineState *machine)
int n, virt_max_cpus;
MemoryRegion *ram = g_new(MemoryRegion, 1);
const char *cpu_model = machine->cpu_model;
- VirtGuestInfoState *guest_info_state = g_malloc0(sizeof *guest_info_state);
- VirtGuestInfo *guest_info = &guest_info_state->info;
+ VirtGuestInfo *guest_info = &vms->acpi_guest_info;
char **cpustr;
ObjectClass *oc;
const char *typename;
@@ -1459,8 +1461,8 @@ static void machvirt_init(MachineState *machine)
guest_info->use_highmem = vms->highmem;
guest_info->gic_version = vms->gic_version;
guest_info->no_its = vmc->no_its;
- guest_info_state->machine_done.notify = virt_guest_info_machine_done;
- qemu_add_machine_init_done_notifier(&guest_info_state->machine_done);
+ vms->machine_done.notify = virt_machine_done;
+ qemu_add_machine_init_done_notifier(&vms->machine_done);
vms->bootinfo.ram_size = machine->ram_size;
vms->bootinfo.kernel_filename = machine->kernel_filename;
diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h
index 2bcd22265cfa..925c4347381c 100644
--- a/include/hw/arm/virt-acpi-build.h
+++ b/include/hw/arm/virt-acpi-build.h
@@ -34,12 +34,6 @@ typedef struct VirtGuestInfo {
bool no_its;
} VirtGuestInfo;
-
-typedef struct VirtGuestInfoState {
- VirtGuestInfo info;
- Notifier machine_done;
-} VirtGuestInfoState;
-
void virt_acpi_setup(VirtGuestInfo *guest_info);
#endif
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 08/16] hw/arm/virt: remove include/hw/arm/virt-acpi-build.h
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (6 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 07/16] hw/arm/virt: eliminate struct VirtGuestInfoState Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 09/16] hw/arm/virt: move VirtMachineState/Class to virt.h Andrew Jones
` (8 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
include/hw/arm/virt-acpi-build.h is only used for VirtGuestInfo,
which doesn't even necessarily have to be ACPI specific. Move
VirtGuestInfo to include/hw/arm/virt.h, allowing us to remove
include/hw/arm/virt-acpi-build.h, and to prepare for even more
code motion.
Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
MAINTAINERS | 2 --
hw/arm/virt-acpi-build.c | 2 +-
hw/arm/virt.c | 1 -
include/hw/arm/virt-acpi-build.h | 39 ---------------------------------------
include/hw/arm/virt.h | 14 +++++++++++++-
5 files changed, 14 insertions(+), 44 deletions(-)
delete mode 100644 include/hw/arm/virt-acpi-build.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 4a605791fc98..465b9f0f8440 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -508,7 +508,6 @@ M: Shannon Zhao <shannon.zhao@linaro.org>
L: qemu-arm@nongnu.org
S: Maintained
F: hw/arm/virt-acpi-build.c
-F: include/hw/arm/virt-acpi-build.h
STM32F205
M: Alistair Francis <alistair@alistair23.me>
@@ -885,7 +884,6 @@ F: hw/acpi/*
F: hw/smbios/*
F: hw/i386/acpi-build.[hc]
F: hw/arm/virt-acpi-build.c
-F: include/hw/arm/virt-acpi-build.h
ppc4xx
M: Alexander Graf <agraf@suse.de>
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index a6c6180f4bce..dbd359063781 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -29,7 +29,6 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
-#include "hw/arm/virt-acpi-build.h"
#include "qemu/bitmap.h"
#include "trace.h"
#include "qom/cpu.h"
@@ -43,6 +42,7 @@
#include "hw/acpi/aml-build.h"
#include "hw/pci/pcie_host.h"
#include "hw/pci/pci.h"
+#include "hw/arm/virt.h"
#include "sysemu/numa.h"
#include "kvm_arm.h"
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index d242980869bc..e51c1668e16e 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -48,7 +48,6 @@
#include "qemu/bitops.h"
#include "qemu/error-report.h"
#include "hw/pci-host/gpex.h"
-#include "hw/arm/virt-acpi-build.h"
#include "hw/arm/sysbus-fdt.h"
#include "hw/platform-bus.h"
#include "hw/arm/fdt.h"
diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h
deleted file mode 100644
index 925c4347381c..000000000000
--- a/include/hw/arm/virt-acpi-build.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Copyright (c) 2015 HUAWEI TECHNOLOGIES CO.,LTD.
- *
- * Author: Shannon Zhao <zhaoshenglong@huawei.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2 or later, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef QEMU_VIRT_ACPI_BUILD_H
-#define QEMU_VIRT_ACPI_BUILD_H
-
-#include "qemu-common.h"
-#include "hw/arm/virt.h"
-#include "qemu/notify.h"
-
-typedef struct VirtGuestInfo {
- int smp_cpus;
- FWCfgState *fw_cfg;
- const MemMapEntry *memmap;
- const int *irqmap;
- bool use_highmem;
- int gic_version;
- bool no_its;
-} VirtGuestInfo;
-
-void virt_acpi_setup(VirtGuestInfo *guest_info);
-
-#endif
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index b805b7622834..248ba6f755a3 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -32,6 +32,7 @@
#include "qemu-common.h"
#include "exec/hwaddr.h"
+#include "qemu/notify.h"
#define NUM_GICV2M_SPIS 64
#define NUM_VIRTIO_TRANSPORTS 32
@@ -76,5 +77,16 @@ typedef struct MemMapEntry {
hwaddr size;
} MemMapEntry;
+typedef struct VirtGuestInfo {
+ int smp_cpus;
+ FWCfgState *fw_cfg;
+ const MemMapEntry *memmap;
+ const int *irqmap;
+ bool use_highmem;
+ int gic_version;
+ bool no_its;
+} VirtGuestInfo;
-#endif
+void virt_acpi_setup(VirtGuestInfo *guest_info);
+
+#endif /* QEMU_ARM_VIRT_H */
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 09/16] hw/arm/virt: move VirtMachineState/Class to virt.h
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (7 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 08/16] hw/arm/virt: remove include/hw/arm/virt-acpi-build.h Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 10/16] hw/arm/virt: pass VirtMachineState instead of VirtGuestInfo Andrew Jones
` (7 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
In preparation to share more Virt machine state than just guest-info
with other mach-virt source files, move the State and Class structures
to virt.h
Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/arm/virt.c | 52 +++++++--------------------------------------------
include/hw/arm/virt.h | 39 ++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 45 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index e51c1668e16e..51cb094d80f7 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -41,7 +41,6 @@
#include "sysemu/numa.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
-#include "hw/boards.h"
#include "hw/compat.h"
#include "hw/loader.h"
#include "exec/address-spaces.h"
@@ -58,50 +57,6 @@
#include "qapi/visitor.h"
#include "standard-headers/linux/input.h"
-/* Number of external interrupt lines to configure the GIC with */
-#define NUM_IRQS 256
-
-#define PLATFORM_BUS_NUM_IRQS 64
-
-static ARMPlatformBusSystemParams platform_bus_params;
-
-typedef struct {
- MachineClass parent;
- bool disallow_affinity_adjustment;
- bool no_its;
- bool no_pmu;
- bool claim_edge_triggered_timers;
-} VirtMachineClass;
-
-typedef struct {
- MachineState parent;
- VirtGuestInfo acpi_guest_info;
- Notifier machine_done;
- bool secure;
- bool highmem;
- bool virt;
- int32_t gic_version;
- struct arm_boot_info bootinfo;
- const MemMapEntry *memmap;
- const int *irqmap;
- int smp_cpus;
- void *fdt;
- int fdt_size;
- uint32_t clock_phandle;
- uint32_t gic_phandle;
- uint32_t msi_phandle;
- int psci_conduit;
-} VirtMachineState;
-
-#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
-#define VIRT_MACHINE(obj) \
- OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE)
-#define VIRT_MACHINE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtMachineClass, obj, TYPE_VIRT_MACHINE)
-#define VIRT_MACHINE_CLASS(klass) \
- OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE)
-
-
#define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
void *data) \
@@ -131,6 +86,13 @@ typedef struct {
DEFINE_VIRT_MACHINE_LATEST(major, minor, false)
+/* Number of external interrupt lines to configure the GIC with */
+#define NUM_IRQS 256
+
+#define PLATFORM_BUS_NUM_IRQS 64
+
+static ARMPlatformBusSystemParams platform_bus_params;
+
/* RAM limit in GB. Since VIRT_MEM starts at the 1GB mark, this means
* RAM can go up to the 256GB mark, leaving 256GB of the physical
* address space unallocated and free for future use between 256G and 512G.
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 248ba6f755a3..59ce353f5e71 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -33,6 +33,8 @@
#include "qemu-common.h"
#include "exec/hwaddr.h"
#include "qemu/notify.h"
+#include "hw/boards.h"
+#include "hw/arm/arm.h"
#define NUM_GICV2M_SPIS 64
#define NUM_VIRTIO_TRANSPORTS 32
@@ -87,6 +89,43 @@ typedef struct VirtGuestInfo {
bool no_its;
} VirtGuestInfo;
+typedef struct {
+ MachineClass parent;
+ bool disallow_affinity_adjustment;
+ bool no_its;
+ bool no_pmu;
+ bool claim_edge_triggered_timers;
+} VirtMachineClass;
+
+typedef struct {
+ MachineState parent;
+ VirtGuestInfo acpi_guest_info;
+ Notifier machine_done;
+ bool secure;
+ bool highmem;
+ bool virt;
+ int32_t gic_version;
+ struct arm_boot_info bootinfo;
+ const MemMapEntry *memmap;
+ const int *irqmap;
+ int smp_cpus;
+ void *fdt;
+ int fdt_size;
+ uint32_t clock_phandle;
+ uint32_t gic_phandle;
+ uint32_t msi_phandle;
+ int psci_conduit;
+} VirtMachineState;
+
+#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
+#define VIRT_MACHINE(obj) \
+ OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE)
+#define VIRT_MACHINE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(VirtMachineClass, obj, TYPE_VIRT_MACHINE)
+#define VIRT_MACHINE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE)
+
+
void virt_acpi_setup(VirtGuestInfo *guest_info);
#endif /* QEMU_ARM_VIRT_H */
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 10/16] hw/arm/virt: pass VirtMachineState instead of VirtGuestInfo
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (8 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 09/16] hw/arm/virt: move VirtMachineState/Class to virt.h Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 11/16] hw/arm/virt-acpi-build: remove redundant members from VirtGuestInfo Andrew Jones
` (6 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
Only two functions take VirtGuestInfo parameters. Now that guest-info
is part of VirtMachineState, and VirtMachineState is defined in the
virt header, pass that instead.
Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/arm/virt-acpi-build.c | 3 ++-
hw/arm/virt.c | 8 ++++----
include/hw/arm/virt.h | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index dbd359063781..0c36ee83d065 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -823,8 +823,9 @@ static const VMStateDescription vmstate_virt_acpi_build = {
},
};
-void virt_acpi_setup(VirtGuestInfo *guest_info)
+void virt_acpi_setup(VirtMachineState *vms)
{
+ VirtGuestInfo *guest_info = &vms->acpi_guest_info;
AcpiBuildTables tables;
AcpiBuildState *build_state;
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 51cb094d80f7..51f4d8c78c19 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1155,9 +1155,9 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
return board->fdt;
}
-static void virt_build_smbios(VirtGuestInfo *guest_info)
+static void virt_build_smbios(VirtMachineState *vms)
{
- FWCfgState *fw_cfg = guest_info->fw_cfg;
+ FWCfgState *fw_cfg = vms->acpi_guest_info.fw_cfg;
uint8_t *smbios_tables, *smbios_anchor;
size_t smbios_tables_len, smbios_anchor_len;
const char *product = "QEMU Virtual Machine";
@@ -1190,8 +1190,8 @@ void virt_machine_done(Notifier *notifier, void *data)
VirtMachineState *vms = container_of(notifier, VirtMachineState,
machine_done);
- virt_acpi_setup(&vms->acpi_guest_info);
- virt_build_smbios(&vms->acpi_guest_info);
+ virt_acpi_setup(vms);
+ virt_build_smbios(vms);
}
static void machvirt_init(MachineState *machine)
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 59ce353f5e71..8ac2d8585e0d 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -126,6 +126,6 @@ typedef struct {
OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE)
-void virt_acpi_setup(VirtGuestInfo *guest_info);
+void virt_acpi_setup(VirtMachineState *vms);
#endif /* QEMU_ARM_VIRT_H */
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 11/16] hw/arm/virt-acpi-build: remove redundant members from VirtGuestInfo
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (9 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 10/16] hw/arm/virt: pass VirtMachineState instead of VirtGuestInfo Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 12/16] hw/arm/virt-acpi-build: don't save VirtGuestInfo on AcpiBuildState Andrew Jones
` (5 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
Now that we pass VirtMachineState, and guest-info is just part of
that state, we can remove all the redundant members and access
the VirtMachineState directly.
Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/arm/virt-acpi-build.c | 72 +++++++++++++++++++++++++-----------------------
hw/arm/virt.c | 6 ----
include/hw/arm/virt.h | 6 ----
3 files changed, 37 insertions(+), 47 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 0c36ee83d065..e34167030dd1 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -384,7 +384,7 @@ build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned rsdt_tbl_offset)
}
static void
-build_iort(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
+build_iort(GArray *table_data, BIOSLinker *linker)
{
int iort_start = table_data->len;
AcpiIortIdMapping *idmap;
@@ -439,11 +439,11 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
}
static void
-build_spcr(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
+build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
{
AcpiSerialPortConsoleRedirection *spcr;
- const MemMapEntry *uart_memmap = &guest_info->memmap[VIRT_UART];
- int irq = guest_info->irqmap[VIRT_UART] + ARM_SPI_BASE;
+ const MemMapEntry *uart_memmap = &vms->memmap[VIRT_UART];
+ int irq = vms->irqmap[VIRT_UART] + ARM_SPI_BASE;
spcr = acpi_data_push(table_data, sizeof(*spcr));
@@ -472,16 +472,16 @@ build_spcr(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
}
static void
-build_srat(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
+build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
{
AcpiSystemResourceAffinityTable *srat;
AcpiSratProcessorGiccAffinity *core;
AcpiSratMemoryAffinity *numamem;
int i, j, srat_start;
uint64_t mem_base;
- uint32_t *cpu_node = g_malloc0(guest_info->smp_cpus * sizeof(uint32_t));
+ uint32_t *cpu_node = g_malloc0(vms->smp_cpus * sizeof(uint32_t));
- for (i = 0; i < guest_info->smp_cpus; i++) {
+ for (i = 0; i < vms->smp_cpus; i++) {
j = numa_get_node_for_cpu(i);
if (j < nb_numa_nodes) {
cpu_node[i] = j;
@@ -492,7 +492,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
srat = acpi_data_push(table_data, sizeof(*srat));
srat->reserved1 = cpu_to_le32(1);
- for (i = 0; i < guest_info->smp_cpus; ++i) {
+ for (i = 0; i < vms->smp_cpus; ++i) {
core = acpi_data_push(table_data, sizeof(*core));
core->type = ACPI_SRAT_PROCESSOR_GICC;
core->length = sizeof(*core);
@@ -502,7 +502,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
}
g_free(cpu_node);
- mem_base = guest_info->memmap[VIRT_MEM].base;
+ mem_base = vms->memmap[VIRT_MEM].base;
for (i = 0; i < nb_numa_nodes; ++i) {
numamem = acpi_data_push(table_data, sizeof(*numamem));
build_srat_memory(numamem, mem_base, numa_info[i].node_mem, i,
@@ -515,10 +515,10 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
}
static void
-build_mcfg(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
+build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
{
AcpiTableMcfg *mcfg;
- const MemMapEntry *memmap = guest_info->memmap;
+ const MemMapEntry *memmap = vms->memmap;
int len = sizeof(*mcfg) + sizeof(mcfg->allocation[0]);
mcfg = acpi_data_push(table_data, len);
@@ -562,11 +562,12 @@ build_gtdt(GArray *table_data, BIOSLinker *linker)
/* MADT */
static void
-build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
+build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
{
+ VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
int madt_start = table_data->len;
- const MemMapEntry *memmap = guest_info->memmap;
- const int *irqmap = guest_info->irqmap;
+ const MemMapEntry *memmap = vms->memmap;
+ const int *irqmap = vms->irqmap;
AcpiMultipleApicTable *madt;
AcpiMadtGenericDistributor *gicd;
AcpiMadtGenericMsiFrame *gic_msi;
@@ -578,16 +579,16 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
gicd->type = ACPI_APIC_GENERIC_DISTRIBUTOR;
gicd->length = sizeof(*gicd);
gicd->base_address = cpu_to_le64(memmap[VIRT_GIC_DIST].base);
- gicd->version = guest_info->gic_version;
+ gicd->version = vms->gic_version;
- for (i = 0; i < guest_info->smp_cpus; i++) {
+ for (i = 0; i < vms->smp_cpus; i++) {
AcpiMadtGenericCpuInterface *gicc = acpi_data_push(table_data,
sizeof(*gicc));
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
gicc->type = ACPI_APIC_GENERIC_CPU_INTERFACE;
gicc->length = sizeof(*gicc);
- if (guest_info->gic_version == 2) {
+ if (vms->gic_version == 2) {
gicc->base_address = cpu_to_le64(memmap[VIRT_GIC_CPU].base);
}
gicc->cpu_interface_number = cpu_to_le32(i);
@@ -600,7 +601,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
}
}
- if (guest_info->gic_version == 3) {
+ if (vms->gic_version == 3) {
AcpiMadtGenericTranslator *gic_its;
AcpiMadtGenericRedistributor *gicr = acpi_data_push(table_data,
sizeof *gicr);
@@ -610,7 +611,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
gicr->base_address = cpu_to_le64(memmap[VIRT_GIC_REDIST].base);
gicr->range_length = cpu_to_le32(memmap[VIRT_GIC_REDIST].size);
- if (its_class_name() && !guest_info->no_its) {
+ if (its_class_name() && !vmc->no_its) {
gic_its = acpi_data_push(table_data, sizeof *gic_its);
gic_its->type = ACPI_APIC_GENERIC_TRANSLATOR;
gic_its->length = sizeof(*gic_its);
@@ -659,11 +660,11 @@ build_fadt(GArray *table_data, BIOSLinker *linker, unsigned dsdt_tbl_offset)
/* DSDT */
static void
-build_dsdt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
+build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
{
Aml *scope, *dsdt;
- const MemMapEntry *memmap = guest_info->memmap;
- const int *irqmap = guest_info->irqmap;
+ const MemMapEntry *memmap = vms->memmap;
+ const int *irqmap = vms->irqmap;
dsdt = init_aml_allocator();
/* Reserve space for header */
@@ -675,7 +676,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
* the RTC ACPI device at all when using UEFI.
*/
scope = aml_scope("\\_SB");
- acpi_dsdt_add_cpus(scope, guest_info->smp_cpus);
+ acpi_dsdt_add_cpus(scope, vms->smp_cpus);
acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
(irqmap[VIRT_UART] + ARM_SPI_BASE));
acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]);
@@ -683,7 +684,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO],
(irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS);
acpi_dsdt_add_pci(scope, memmap, (irqmap[VIRT_PCIE] + ARM_SPI_BASE),
- guest_info->use_highmem);
+ vms->highmem);
acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO],
(irqmap[VIRT_GPIO] + ARM_SPI_BASE));
acpi_dsdt_add_power_button(scope);
@@ -710,8 +711,9 @@ struct AcpiBuildState {
} AcpiBuildState;
static
-void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
+void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
{
+ VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
GArray *table_offsets;
unsigned dsdt, rsdt;
GArray *tables_blob = tables->table_data;
@@ -725,32 +727,32 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
/* DSDT is pointed to by FADT */
dsdt = tables_blob->len;
- build_dsdt(tables_blob, tables->linker, guest_info);
+ build_dsdt(tables_blob, tables->linker, vms);
/* FADT MADT GTDT MCFG SPCR pointed to by RSDT */
acpi_add_table(table_offsets, tables_blob);
build_fadt(tables_blob, tables->linker, dsdt);
acpi_add_table(table_offsets, tables_blob);
- build_madt(tables_blob, tables->linker, guest_info);
+ build_madt(tables_blob, tables->linker, vms);
acpi_add_table(table_offsets, tables_blob);
build_gtdt(tables_blob, tables->linker);
acpi_add_table(table_offsets, tables_blob);
- build_mcfg(tables_blob, tables->linker, guest_info);
+ build_mcfg(tables_blob, tables->linker, vms);
acpi_add_table(table_offsets, tables_blob);
- build_spcr(tables_blob, tables->linker, guest_info);
+ build_spcr(tables_blob, tables->linker, vms);
if (nb_numa_nodes > 0) {
acpi_add_table(table_offsets, tables_blob);
- build_srat(tables_blob, tables->linker, guest_info);
+ build_srat(tables_blob, tables->linker, vms);
}
- if (its_class_name() && !guest_info->no_its) {
+ if (its_class_name() && !vmc->no_its) {
acpi_add_table(table_offsets, tables_blob);
- build_iort(tables_blob, tables->linker, guest_info);
+ build_iort(tables_blob, tables->linker);
}
/* RSDT is pointed to by RSDP */
@@ -789,13 +791,13 @@ static void virt_acpi_build_update(void *build_opaque)
acpi_build_tables_init(&tables);
- virt_acpi_build(build_state->guest_info, &tables);
+ virt_acpi_build(container_of(build_state->guest_info,
+ VirtMachineState, acpi_guest_info), &tables);
acpi_ram_update(build_state->table_mr, tables.table_data);
acpi_ram_update(build_state->rsdp_mr, tables.rsdp);
acpi_ram_update(build_state->linker_mr, tables.linker->cmd_blob);
-
acpi_build_tables_cleanup(&tables, true);
}
@@ -843,7 +845,7 @@ void virt_acpi_setup(VirtMachineState *vms)
build_state->guest_info = guest_info;
acpi_build_tables_init(&tables);
- virt_acpi_build(build_state->guest_info, &tables);
+ virt_acpi_build(vms, &tables);
/* Now expose it all to Guest */
build_state->table_mr = acpi_add_rom_blob(build_state, tables.table_data,
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 51f4d8c78c19..909d87fbff57 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1415,13 +1415,7 @@ static void machvirt_init(MachineState *machine)
create_fw_cfg(vms, &address_space_memory);
rom_set_fw(fw_cfg_find());
- guest_info->smp_cpus = smp_cpus;
guest_info->fw_cfg = fw_cfg_find();
- guest_info->memmap = vms->memmap;
- guest_info->irqmap = vms->irqmap;
- guest_info->use_highmem = vms->highmem;
- guest_info->gic_version = vms->gic_version;
- guest_info->no_its = vmc->no_its;
vms->machine_done.notify = virt_machine_done;
qemu_add_machine_init_done_notifier(&vms->machine_done);
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 8ac2d8585e0d..23f11776a557 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -80,13 +80,7 @@ typedef struct MemMapEntry {
} MemMapEntry;
typedef struct VirtGuestInfo {
- int smp_cpus;
FWCfgState *fw_cfg;
- const MemMapEntry *memmap;
- const int *irqmap;
- bool use_highmem;
- int gic_version;
- bool no_its;
} VirtGuestInfo;
typedef struct {
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 12/16] hw/arm/virt-acpi-build: don't save VirtGuestInfo on AcpiBuildState
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (10 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 11/16] hw/arm/virt-acpi-build: remove redundant members from VirtGuestInfo Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 13/16] hw/arm/virt: remove VirtGuestInfo Andrew Jones
` (4 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
We can get to VirtMachineState without the need for saving a pointer
on AcpiBuildState. This is the mach-virt equivalent to "acpi: Don't save
PcGuestInfo on AcpiBuildState"
Signed-off-by: Andrew Jones <drjones@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/arm/virt-acpi-build.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index e34167030dd1..0b9c2c0d0a3b 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -707,7 +707,6 @@ struct AcpiBuildState {
MemoryRegion *linker_mr;
/* Is table patched? */
bool patched;
- VirtGuestInfo *guest_info;
} AcpiBuildState;
static
@@ -791,8 +790,7 @@ static void virt_acpi_build_update(void *build_opaque)
acpi_build_tables_init(&tables);
- virt_acpi_build(container_of(build_state->guest_info,
- VirtMachineState, acpi_guest_info), &tables);
+ virt_acpi_build(VIRT_MACHINE(qdev_get_machine()), &tables);
acpi_ram_update(build_state->table_mr, tables.table_data);
acpi_ram_update(build_state->rsdp_mr, tables.rsdp);
@@ -842,7 +840,6 @@ void virt_acpi_setup(VirtMachineState *vms)
}
build_state = g_malloc0(sizeof *build_state);
- build_state->guest_info = guest_info;
acpi_build_tables_init(&tables);
virt_acpi_build(vms, &tables);
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 13/16] hw/arm/virt: remove VirtGuestInfo
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (11 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 12/16] hw/arm/virt-acpi-build: don't save VirtGuestInfo on AcpiBuildState Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 14/16] hw/arm/virt-acpi-build: Don't incorrectly claim architectural timer to be edge-triggered Andrew Jones
` (3 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
by moving VirtGuestInfo.fw_cfg to VirtMachineState. This is the
mach-virt equivalent of "pc: Move PcGuestInfo.fw_cfg to
PCMachineState" and "pc: Eliminate PcGuestInfo struct" combined.
Signed-off-by: Andrew Jones <drjones@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/arm/virt-acpi-build.c | 7 +++----
hw/arm/virt.c | 16 +++++++---------
include/hw/arm/virt.h | 6 +-----
3 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 0b9c2c0d0a3b..aa800d2a9657 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -825,11 +825,10 @@ static const VMStateDescription vmstate_virt_acpi_build = {
void virt_acpi_setup(VirtMachineState *vms)
{
- VirtGuestInfo *guest_info = &vms->acpi_guest_info;
AcpiBuildTables tables;
AcpiBuildState *build_state;
- if (!guest_info->fw_cfg) {
+ if (!vms->fw_cfg) {
trace_virt_acpi_setup();
return;
}
@@ -854,8 +853,8 @@ void virt_acpi_setup(VirtMachineState *vms)
acpi_add_rom_blob(build_state, tables.linker->cmd_blob,
"etc/table-loader", 0);
- fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
- tables.tcpalog->data, acpi_data_len(tables.tcpalog));
+ fw_cfg_add_file(vms->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data,
+ acpi_data_len(tables.tcpalog));
build_state->rsdp_mr = acpi_add_rom_blob(build_state, tables.rsdp,
ACPI_BUILD_RSDP_FILE, 0);
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 909d87fbff57..709da403a6fc 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -913,7 +913,7 @@ static void create_flash(const VirtMachineState *vms,
}
}
-static void create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)
+static FWCfgState *create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)
{
hwaddr base = vms->memmap[VIRT_FW_CFG].base;
hwaddr size = vms->memmap[VIRT_FW_CFG].size;
@@ -930,6 +930,7 @@ static void create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)
qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
2, base, 2, size);
g_free(nodename);
+ return fw_cfg;
}
static void create_pcie_irq_map(const VirtMachineState *vms,
@@ -1157,12 +1158,11 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
static void virt_build_smbios(VirtMachineState *vms)
{
- FWCfgState *fw_cfg = vms->acpi_guest_info.fw_cfg;
uint8_t *smbios_tables, *smbios_anchor;
size_t smbios_tables_len, smbios_anchor_len;
const char *product = "QEMU Virtual Machine";
- if (!fw_cfg) {
+ if (!vms->fw_cfg) {
return;
}
@@ -1177,9 +1177,9 @@ static void virt_build_smbios(VirtMachineState *vms)
&smbios_anchor, &smbios_anchor_len);
if (smbios_anchor) {
- fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables",
+ fw_cfg_add_file(vms->fw_cfg, "etc/smbios/smbios-tables",
smbios_tables, smbios_tables_len);
- fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor",
+ fw_cfg_add_file(vms->fw_cfg, "etc/smbios/smbios-anchor",
smbios_anchor, smbios_anchor_len);
}
}
@@ -1204,7 +1204,6 @@ static void machvirt_init(MachineState *machine)
int n, virt_max_cpus;
MemoryRegion *ram = g_new(MemoryRegion, 1);
const char *cpu_model = machine->cpu_model;
- VirtGuestInfo *guest_info = &vms->acpi_guest_info;
char **cpustr;
ObjectClass *oc;
const char *typename;
@@ -1412,10 +1411,9 @@ static void machvirt_init(MachineState *machine)
*/
create_virtio_devices(vms, pic);
- create_fw_cfg(vms, &address_space_memory);
- rom_set_fw(fw_cfg_find());
+ vms->fw_cfg = create_fw_cfg(vms, &address_space_memory);
+ rom_set_fw(vms->fw_cfg);
- guest_info->fw_cfg = fw_cfg_find();
vms->machine_done.notify = virt_machine_done;
qemu_add_machine_init_done_notifier(&vms->machine_done);
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 23f11776a557..8f67794d4e65 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -79,10 +79,6 @@ typedef struct MemMapEntry {
hwaddr size;
} MemMapEntry;
-typedef struct VirtGuestInfo {
- FWCfgState *fw_cfg;
-} VirtGuestInfo;
-
typedef struct {
MachineClass parent;
bool disallow_affinity_adjustment;
@@ -93,8 +89,8 @@ typedef struct {
typedef struct {
MachineState parent;
- VirtGuestInfo acpi_guest_info;
Notifier machine_done;
+ FWCfgState *fw_cfg;
bool secure;
bool highmem;
bool virt;
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 14/16] hw/arm/virt-acpi-build: Don't incorrectly claim architectural timer to be edge-triggered
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (12 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 13/16] hw/arm/virt: remove VirtGuestInfo Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 15/16] hw/arm/virt-acpi-build: use SMC if booting in EL2 Andrew Jones
` (2 subsequent siblings)
16 siblings, 0 replies; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
This is the ACPI equivalent to "hw/arm/virt: Don't incorrectly claim
architectural timer to be edge-triggered" which fixes the DT for
machine types 2.9 and later.
Signed-off-by: Andrew Jones <drjones@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/arm/virt-acpi-build.c | 20 ++++++++++++++------
include/hw/acpi/acpi-defs.h | 1 +
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index aa800d2a9657..b5e17a680d51 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -535,25 +535,33 @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
/* GTDT */
static void
-build_gtdt(GArray *table_data, BIOSLinker *linker)
+build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
{
+ VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
int gtdt_start = table_data->len;
AcpiGenericTimerTable *gtdt;
+ uint32_t irqflags;
+
+ if (vmc->claim_edge_triggered_timers) {
+ irqflags = ACPI_GTDT_INTERRUPT_MODE_EDGE;
+ } else {
+ irqflags = ACPI_GTDT_INTERRUPT_MODE_LEVEL;
+ }
gtdt = acpi_data_push(table_data, sizeof *gtdt);
/* The interrupt values are the same with the device tree when adding 16 */
gtdt->secure_el1_interrupt = cpu_to_le32(ARCH_TIMER_S_EL1_IRQ + 16);
- gtdt->secure_el1_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE);
+ gtdt->secure_el1_flags = cpu_to_le32(irqflags);
gtdt->non_secure_el1_interrupt = cpu_to_le32(ARCH_TIMER_NS_EL1_IRQ + 16);
- gtdt->non_secure_el1_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE |
+ gtdt->non_secure_el1_flags = cpu_to_le32(irqflags |
ACPI_GTDT_CAP_ALWAYS_ON);
gtdt->virtual_timer_interrupt = cpu_to_le32(ARCH_TIMER_VIRT_IRQ + 16);
- gtdt->virtual_timer_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE);
+ gtdt->virtual_timer_flags = cpu_to_le32(irqflags);
gtdt->non_secure_el2_interrupt = cpu_to_le32(ARCH_TIMER_NS_EL2_IRQ + 16);
- gtdt->non_secure_el2_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE);
+ gtdt->non_secure_el2_flags = cpu_to_le32(irqflags);
build_header(linker, table_data,
(void *)(table_data->data + gtdt_start), "GTDT",
@@ -736,7 +744,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
build_madt(tables_blob, tables->linker, vms);
acpi_add_table(table_offsets, tables_blob);
- build_gtdt(tables_blob, tables->linker);
+ build_gtdt(tables_blob, tables->linker, vms);
acpi_add_table(table_offsets, tables_blob);
build_mcfg(tables_blob, tables->linker, vms);
diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
index d15b7e5cd39a..d43ec005cbb7 100644
--- a/include/hw/acpi/acpi-defs.h
+++ b/include/hw/acpi/acpi-defs.h
@@ -428,6 +428,7 @@ typedef struct AcpiMadtGenericTranslator AcpiMadtGenericTranslator;
/*
* Generic Timer Description Table (GTDT)
*/
+#define ACPI_GTDT_INTERRUPT_MODE_LEVEL (0 << 0)
#define ACPI_GTDT_INTERRUPT_MODE_EDGE (1 << 0)
#define ACPI_GTDT_CAP_ALWAYS_ON (1 << 2)
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 15/16] hw/arm/virt-acpi-build: use SMC if booting in EL2
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (13 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 14/16] hw/arm/virt-acpi-build: Don't incorrectly claim architectural timer to be edge-triggered Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-06 17:12 ` Peter Maydell
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 16/16] hw/arm/virt-acpi-build: madt: add vgic maint irq Andrew Jones
2017-01-06 16:45 ` [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Peter Maydell
16 siblings, 1 reply; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
hw/arm/virt-acpi-build.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index b5e17a680d51..7c00ee683f44 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -643,16 +643,16 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
}
/* FADT */
-static void
-build_fadt(GArray *table_data, BIOSLinker *linker, unsigned dsdt_tbl_offset)
+static void build_fadt(GArray *table_data, BIOSLinker *linker,
+ VirtMachineState *vms, unsigned dsdt_tbl_offset)
{
AcpiFadtDescriptorRev5_1 *fadt = acpi_data_push(table_data, sizeof(*fadt));
unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;
+ uint16_t use_hvc = vms->virt ? 0 : ACPI_FADT_ARM_PSCI_USE_HVC;
- /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */
+ /* Hardware Reduced = 1 and use PSCI 0.2+ */
fadt->flags = cpu_to_le32(1 << ACPI_FADT_F_HW_REDUCED_ACPI);
- fadt->arm_boot_flags = cpu_to_le16(ACPI_FADT_ARM_PSCI_COMPLIANT |
- ACPI_FADT_ARM_PSCI_USE_HVC);
+ fadt->arm_boot_flags = cpu_to_le16(ACPI_FADT_ARM_PSCI_COMPLIANT | use_hvc);
/* ACPI v5.1 (fadt->revision.fadt->minor_revision) */
fadt->minor_revision = 0x1;
@@ -738,7 +738,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
/* FADT MADT GTDT MCFG SPCR pointed to by RSDT */
acpi_add_table(table_offsets, tables_blob);
- build_fadt(tables_blob, tables->linker, dsdt);
+ build_fadt(tables_blob, tables->linker, vms, dsdt);
acpi_add_table(table_offsets, tables_blob);
build_madt(tables_blob, tables->linker, vms);
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v2 16/16] hw/arm/virt-acpi-build: madt: add vgic maint irq
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (14 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 15/16] hw/arm/virt-acpi-build: use SMC if booting in EL2 Andrew Jones
@ 2017-01-02 20:01 ` Andrew Jones
2017-01-06 17:13 ` Peter Maydell
2017-01-06 16:45 ` [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Peter Maydell
16 siblings, 1 reply; 20+ messages in thread
From: Andrew Jones @ 2017-01-02 20:01 UTC (permalink / raw)
To: qemu-devel, qemu-arm
Cc: imammedo, peter.maydell, zhaoshenglong, shannon.zhao, mst,
ehabkost
When virtualization is enabled and we have a v3 gic, then we add
the vgic maintenance interrupt to the DT. This patch is the ACPI
equivalent.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
hw/arm/virt-acpi-build.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 7c00ee683f44..971ee4885c43 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -607,6 +607,9 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
if (arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
gicc->performance_interrupt = cpu_to_le32(PPI(VIRTUAL_PMU_IRQ));
}
+ if (vms->virt && vms->gic_version == 3) {
+ gicc->vgic_interrupt = cpu_to_le32(PPI(ARCH_GICV3_MAINT_IRQ));
+ }
}
if (vms->gic_version == 3) {
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
` (15 preceding siblings ...)
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 16/16] hw/arm/virt-acpi-build: madt: add vgic maint irq Andrew Jones
@ 2017-01-06 16:45 ` Peter Maydell
16 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2017-01-06 16:45 UTC (permalink / raw)
To: Andrew Jones
Cc: QEMU Developers, qemu-arm, Igor Mammedov, Shannon Zhao,
Shannon Zhao, Michael S. Tsirkin, Eduardo Habkost
On 2 January 2017 at 20:01, Andrew Jones <drjones@redhat.com> wrote:
> v2:
> - all Igor's suggestions
> - added four mach-virt acpi cleanup patches
> - added the remaining two acpi patches needed to bring equivalence
> to Peter's DT changes
>
> This series is based on Peter's qemu-arm gicv3-virt branch. It's
> main goal (patches 07-13), which was suggested by Eduardo, is to
> remove an unnecessary structure, VirtGuestInfo, which is a
> maintenance burden, as it requires duplicating Virt machine state.
> Additionally patches 05-06 do some mach-virt cleanups and patches
> 14-16 add the ACPI equivalents of the DT patches in Peter's
> gicv3-virt branch. The first four patches are cleanups to mach-virt's
> acpi code.
>
> Patches available here
> https://github.com/rhdrjones/qemu/commits/virt/remove-guest-info-v2
Thanks. Apart from the last 2 patches which depend on the gicv3-virt
changes, I think this is all OK to go in now.
Since the gicv3-virt code still needs a respin (I haven't looked at
the failure to boot smp secondaries into EL2 yet), I have taken the
first 3 patches from gicv3-virt and put them into target-arm.next:
hw/arm/virt: Merge VirtBoardInfo and VirtMachineState
hw/arm/virt: Rename 'vbi' variables to 'vms'
hw/arm/virt: Don't incorrectly claim architectural timer to be edge-triggered
and then rebased patches 1-14 from this series on top of that, and
applied all that to target-arm.next.
I'll put patches 15 and 16 into my gicv3-virt branch for when I
send out v2 of that.
thanks
-- PMM
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v2 15/16] hw/arm/virt-acpi-build: use SMC if booting in EL2
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 15/16] hw/arm/virt-acpi-build: use SMC if booting in EL2 Andrew Jones
@ 2017-01-06 17:12 ` Peter Maydell
0 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2017-01-06 17:12 UTC (permalink / raw)
To: Andrew Jones
Cc: QEMU Developers, qemu-arm, Igor Mammedov, Shannon Zhao,
Shannon Zhao, Michael S. Tsirkin, Eduardo Habkost
On 2 January 2017 at 20:01, Andrew Jones <drjones@redhat.com> wrote:
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> hw/arm/virt-acpi-build.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index b5e17a680d51..7c00ee683f44 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -643,16 +643,16 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> }
>
> /* FADT */
> -static void
> -build_fadt(GArray *table_data, BIOSLinker *linker, unsigned dsdt_tbl_offset)
> +static void build_fadt(GArray *table_data, BIOSLinker *linker,
> + VirtMachineState *vms, unsigned dsdt_tbl_offset)
> {
> AcpiFadtDescriptorRev5_1 *fadt = acpi_data_push(table_data, sizeof(*fadt));
> unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;
> + uint16_t use_hvc = vms->virt ? 0 : ACPI_FADT_ARM_PSCI_USE_HVC;
This is the wrong condition -- you should just check whether
vms->psci_conduit is QEMU_PSCI_CONDUIT_HVC (vs _SMC or _DISABLED), something
like:
switch (vms->psci_conduit) {
case QEMU_PSCI_CONDUIT_DISABLED:
/* XXX should we fail, or boot without the PSCI_COMPLIANT flag? */
use_hvc = 0;
break;
case QEMU_PSCI_CONDUIT_HVC:
use_hvc = ACPI_FADT_ARM_PSCI_USE_HVC;
break;
case QEMU_PSCI_CONDUIT_SMC:
use_hvc = 0;
break;
default:
g_assert_not_reached();
}
What should we do in the DISABLED case ?
> - /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */
> + /* Hardware Reduced = 1 and use PSCI 0.2+ */
> fadt->flags = cpu_to_le32(1 << ACPI_FADT_F_HW_REDUCED_ACPI);
> - fadt->arm_boot_flags = cpu_to_le16(ACPI_FADT_ARM_PSCI_COMPLIANT |
> - ACPI_FADT_ARM_PSCI_USE_HVC);
> + fadt->arm_boot_flags = cpu_to_le16(ACPI_FADT_ARM_PSCI_COMPLIANT | use_hvc);
>
> /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */
> fadt->minor_revision = 0x1;
> @@ -738,7 +738,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
>
> /* FADT MADT GTDT MCFG SPCR pointed to by RSDT */
> acpi_add_table(table_offsets, tables_blob);
> - build_fadt(tables_blob, tables->linker, dsdt);
> + build_fadt(tables_blob, tables->linker, vms, dsdt);
>
> acpi_add_table(table_offsets, tables_blob);
> build_madt(tables_blob, tables->linker, vms);
thanks
-- PMM
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v2 16/16] hw/arm/virt-acpi-build: madt: add vgic maint irq
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 16/16] hw/arm/virt-acpi-build: madt: add vgic maint irq Andrew Jones
@ 2017-01-06 17:13 ` Peter Maydell
0 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2017-01-06 17:13 UTC (permalink / raw)
To: Andrew Jones
Cc: QEMU Developers, qemu-arm, Igor Mammedov, Shannon Zhao,
Shannon Zhao, Michael S. Tsirkin, Eduardo Habkost
On 2 January 2017 at 20:01, Andrew Jones <drjones@redhat.com> wrote:
> When virtualization is enabled and we have a v3 gic, then we add
> the vgic maintenance interrupt to the DT. This patch is the ACPI
> equivalent.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> hw/arm/virt-acpi-build.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 7c00ee683f44..971ee4885c43 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -607,6 +607,9 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> if (arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
> gicc->performance_interrupt = cpu_to_le32(PPI(VIRTUAL_PMU_IRQ));
> }
> + if (vms->virt && vms->gic_version == 3) {
> + gicc->vgic_interrupt = cpu_to_le32(PPI(ARCH_GICV3_MAINT_IRQ));
> + }
> }
>
> if (vms->gic_version == 3) {
I'm going to squash this change into my "target-arm: Enable EL2 feature bit
on A53 and A57" patch, since it's a trivial diff and that's the patch
which has the "put this into the DTB" change in it.
thanks
-- PMM
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2017-01-06 17:13 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-02 20:01 [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 01/16] hw/arm/virt-acpi-build: add all missing cpu_to_le's Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 02/16] hw/arm/virt-acpi-build: name GIC CPU Interface Structure appropriately Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 03/16] hw/arm/virt-acpi-build: gtdt: improve flag naming Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 04/16] hw/arm/virt-acpi-build: fadt: " Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 05/16] hw/arm/virt: parameter passing cleanups Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 06/16] hw/arm/virt: use VirtMachineState.gic_version Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 07/16] hw/arm/virt: eliminate struct VirtGuestInfoState Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 08/16] hw/arm/virt: remove include/hw/arm/virt-acpi-build.h Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 09/16] hw/arm/virt: move VirtMachineState/Class to virt.h Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 10/16] hw/arm/virt: pass VirtMachineState instead of VirtGuestInfo Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 11/16] hw/arm/virt-acpi-build: remove redundant members from VirtGuestInfo Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 12/16] hw/arm/virt-acpi-build: don't save VirtGuestInfo on AcpiBuildState Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 13/16] hw/arm/virt: remove VirtGuestInfo Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 14/16] hw/arm/virt-acpi-build: Don't incorrectly claim architectural timer to be edge-triggered Andrew Jones
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 15/16] hw/arm/virt-acpi-build: use SMC if booting in EL2 Andrew Jones
2017-01-06 17:12 ` Peter Maydell
2017-01-02 20:01 ` [Qemu-devel] [PATCH v2 16/16] hw/arm/virt-acpi-build: madt: add vgic maint irq Andrew Jones
2017-01-06 17:13 ` Peter Maydell
2017-01-06 16:45 ` [Qemu-devel] [PATCH v2 00/16] Remove VirtGuestInfo Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).