Remove VirtGuestInfo
cover Remove VirtGuestInfo
This series is based on Peter's qemu-arm gicv3-virt branch. It's main goal (patches 04-10), 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 01-03 do some mach-virt cleanups and patch 11 adds the ACPI equivalent to one of the DT patches in Peter's gicv3-virt branch.
The last patch isn't really tested as the guest kernel versions I used seem to ignore the GTDT irqflags and either just choose edge, 4.5-based kernel, or level, 4.9-based kernel.
Patches available here
https://github.com/rhdrjones/qemu/commits/virt/remove-guest-info
Andrew Jones (11):
hw/arm/virt: parameter passing cleanups
hw/arm/virt: use VirtMachineState.gic_version
hw/arm/virt: use VirtMachineState.smp_cpus
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
MAINTAINERS | 2 - hw/arm/virt-acpi-build.c | 103 +++++++++++++------------- hw/arm/virt.c | 152 ++++++++++++++------------------------- include/hw/arm/virt-acpi-build.h | 47 ------------ include/hw/arm/virt.h | 45 +++++++++++- 5 files changed, 151 insertions(+), 198 deletions(-) delete mode 100644 include/hw/arm/virt-acpi-build.h
Signature · 1 line
2.9.3
PATCH 1/11 hw/arm/virt: parameter passing cleanups
Some simple cleanups made possible by "hw/arm/virt: Merge VirtBoardInfo and VirtMachineState"
--- hw/arm/virt.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
hw/arm/virt.c +9 -10
@@ -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);
Signature · 1 line
2.9.3
Re: [Qemu-arm] [PATCH 01/11] hw/arm/virt: parameter passing cleanups
Quoted 4 lines · On Tue, 13 Dec 2016 22:45:12 +0100 Andrew Jones <[email protected]> wrote:
Some simple cleanups made possible by "hw/arm/virt: Merge VirtBoardInfo and VirtMachineState"
Signed-off-by Andrew Jones <[email protected]>
Quoted 85 lines
--- hw/arm/virt.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)hw/arm/virt.c +9
-10@@ -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);
PATCH 2/11 hw/arm/virt: use VirtMachineState.gic_version
In reply to Andrew Jonesmachvirt_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
--- hw/arm/virt.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
hw/arm/virt.c +17 -18
@@ -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);
Signature · 1 line
2.9.3
Re: [Qemu-arm] [PATCH 02/11] hw/arm/virt: use VirtMachineState.gic_version
Quoted 7 lines · On Tue, 13 Dec 2016 22:45:13 +0100 Andrew Jones <[email protected]> wrote:
machvirt_initmay 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 outsidehw/arm/virt.cSigned-off-by Andrew Jones <[email protected]>
Quoted 153 lines
--- hw/arm/virt.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)hw/arm/virt.c +17
-18@@ -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);
PATCH 3/11 hw/arm/virt: use VirtMachineState.smp_cpus
In reply to Andrew JonesMost places we need smp_cpus we use vms->smp_cpus already. This cleanup makes sure we do everywhere, preparing for the removal of the global smp_cpus someday.
--- hw/arm/virt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
hw/arm/virt.c +7 -7
@@ -583,7 +583,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic) gicdev =qdev_create (NULL , gictype);qdev_prop_set_uint32 (gicdev,"revision" , type); -qdev_prop_set_uint32 (gicdev,"num-cpu" , smp_cpus); +qdev_prop_set_uint32 (gicdev,"num-cpu" , vms->smp_cpus);/* Note that the num-irq property counts both internal and external * interrupts; there are always 32 of the former (mandated by GIC spec). */
@@ -604,7 +604,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic)* maintenance interrupt signal to the appropriate GIC PPI inputs, * and the GIC's IRQ/FIQ/VIRQ/VFIQ interrupt outputs to the CPU's inputs. */ -for (i =0 ; i < smp_cpus; i++) { +for (i =0 ; i < vms->smp_cpus; i++) {DeviceState *cpudev =DEVICE (qemu_get_cpu (i));int ppibase =NUM_IRQS + i *GIC_INTERNAL +GIC_NR_SGIS ;int irq;
@@ -629,7 +629,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic) + ARCH_GICV3_MAINT_IRQ));sysbus_connect_irq (gicbusdev, i,qdev_get_gpio_in (cpudev,ARM_CPU_IRQ )); -sysbus_connect_irq (gicbusdev, i + smp_cpus, +sysbus_connect_irq (gicbusdev, i + vms->smp_cpus,qdev_get_gpio_in (cpudev,ARM_CPU_FIQ ));sysbus_connect_irq (gicbusdev, i +2 * smp_cpus,qdev_get_gpio_in (cpudev,ARM_CPU_VIRQ ));
@@ -958,7 +958,7 @@ static void create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)char *nodename; fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); -fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )smp_cpus); +fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )vms->smp_cpus); nodename =g_strdup_printf ("/fw-cfg@%" PRIx64, base);qemu_fdt_add_subnode (vms->fdt, nodename);
@@ -1362,7 +1362,7 @@ static void machvirt_init(MachineState *machine)exit (1 ); } -for (n =0 ; n < smp_cpus; n++) { +for (n =0 ; n < vms->smp_cpus; n++) {Object *cpuobj =object_new (typename);if (!vmc->disallow_affinity_adjustment) {/* Adjust MPIDR like 64-bit KVM hosts, which incorporate the
@@ -1452,7 +1452,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->smp_cpus = vms->smp_cpus; guest_info->fw_cfg =fw_cfg_find (); guest_info->memmap = vms->memmap; guest_info->irqmap = vms->irqmap;
@@ -1466,7 +1466,7 @@ static void machvirt_init(MachineState *machine) vms->bootinfo.kernel_filename = machine->kernel_filename; vms->bootinfo.kernel_cmdline = machine->kernel_cmdline; vms->bootinfo.initrd_filename = machine->initrd_filename; - vms->bootinfo.nb_cpus = smp_cpus; + vms->bootinfo.nb_cpus = vms->smp_cpus; vms->bootinfo.board_id =-1 ; vms->bootinfo.loader_start = vms->memmap[VIRT_MEM ].base; vms->bootinfo.get_dtb = machvirt_dtb;
Signature · 1 line
2.9.3
Re: [Qemu-arm] [PATCH 03/11] hw/arm/virt: use VirtMachineState.smp_cpus
Quoted 3 lines · On Tue, 13 Dec 2016 22:45:14 +0100 Andrew Jones <[email protected]> wrote:
Most places we need
smp_cpuswe usevms->smp_cpusalready. This cleanup makes sure we do everywhere, preparing for the removal of the globalsmp_cpussomeday.
I'm not sure it's good idea to make/have smp_cpus as ARM specific machine field.
It should be MachineState.smp_cpus since it's applicable to all machines. I also fail to see how this patch helps at all as in the end VirtMachineState.smp_cpus should be converted to MachineState.smp_cpus and we'd end up changing the same places twice with this patch. I'd rather see conversion to MachineState.smp_cpus from the beginning. So suggesting to drop this patch if from this series if it doesn't get in the way of removing VirtGuestInfo.
Quoted 28 lines
Signed-off-by Andrew Jones <[email protected]>--- hw/arm/virt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)hw/arm/virt.c +2
-2@@ -583,7 +583,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic) gicdev =qdev_create (NULL , gictype);qdev_prop_set_uint32 (gicdev,"revision" , type); -qdev_prop_set_uint32 (gicdev,"num-cpu" , smp_cpus); +qdev_prop_set_uint32 (gicdev,"num-cpu" , vms->smp_cpus);/* Note that the num-irq property counts both internal and external * interrupts; there are always 32 of the former (mandated by GIC spec). */ @@ -604,7 +604,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic)* maintenance interrupt signal to the appropriate GIC PPI inputs, * and the GIC's IRQ/FIQ/VIRQ/VFIQ interrupt outputs to the CPU's inputs. */ -for (i =0 ; i < smp_cpus; i++) { +for (i =0 ; i < vms->smp_cpus; i++) {DeviceState *cpudev =DEVICE (qemu_get_cpu (i));int ppibase =NUM_IRQS + i *GIC_INTERNAL +GIC_NR_SGIS ;int irq;
hw/arm/virt.c static void create_gic(VirtMachineState *vms, qemu_irq *pic) · line 634
Quoted 7 lines
hw/arm/virt.c +1
-1@@ -629,7 +629,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic) + ARCH_GICV3_MAINT_IRQ));sysbus_connect_irq (gicbusdev, i,qdev_get_gpio_in (cpudev,ARM_CPU_IRQ )); -sysbus_connect_irq (gicbusdev, i + smp_cpus, +sysbus_connect_irq (gicbusdev, i + vms->smp_cpus,qdev_get_gpio_in (cpudev,ARM_CPU_FIQ )); sysbus_connect_irq(gicbusdev, i + 2 * smp_cpus,
^^^^^^^^
and other places in this file.
Quoted 37 lines
hw/arm/virt.c +4
-4qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ));@@ -958,7 +958,7 @@ static void create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)char *nodename; fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); -fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )smp_cpus); +fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )vms->smp_cpus); nodename =g_strdup_printf ("/fw-cfg@%" PRIx64, base);qemu_fdt_add_subnode (vms->fdt, nodename);@@ -1362,7 +1362,7 @@ static void machvirt_init(MachineState *machine)exit (1 ); } -for (n =0 ; n < smp_cpus; n++) { +for (n =0 ; n < vms->smp_cpus; n++) {Object *cpuobj =object_new (typename);if (!vmc->disallow_affinity_adjustment) {/* Adjust MPIDR like 64-bit KVM hosts, which incorporate the @@ -1452,7 +1452,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->smp_cpus = vms->smp_cpus; guest_info->fw_cfg =fw_cfg_find (); guest_info->memmap = vms->memmap; guest_info->irqmap = vms->irqmap;@@ -1466,7 +1466,7 @@ static void machvirt_init(MachineState *machine) vms->bootinfo.kernel_filename = machine->kernel_filename; vms->bootinfo.kernel_cmdline = machine->kernel_cmdline; vms->bootinfo.initrd_filename = machine->initrd_filename; - vms->bootinfo.nb_cpus = smp_cpus; + vms->bootinfo.nb_cpus = vms->smp_cpus; vms->bootinfo.board_id =-1 ; vms->bootinfo.loader_start = vms->memmap[VIRT_MEM ].base; vms->bootinfo.get_dtb = machvirt_dtb;
Re: [Qemu-arm] [Qemu-devel] [PATCH 03/11] hw/arm/virt: use VirtMachineState.smp_cpus
Quoted 6 lines · Igor Mammedov
Quoted 3 lines · On Tue, 13 Dec 2016 22:45:14 +0100 Andrew Jones <[email protected]> wrote:
Most places we need
smp_cpuswe usevms->smp_cpusalready. This cleanup makes sure we do everywhere, preparing for the removal of the globalsmp_cpussomeday.
Quoted 9 lines
I'm not sure it's good idea to make/have
smp_cpusas ARM specific machine field.
It should be MachineState.smp_cpus since it's applicable to all machines. I also fail to see how this patch helps at all as in the end VirtMachineState.smp_cpus should be converted to MachineState.smp_cpus and we'd end up changing the same places twice with this patch. I'd rather see conversion to MachineState.smp_cpus from the beginning. So suggesting to drop this patch if from this series if it doesn't get in the way of removing VirtGuestInfo.
All good points. Dropping this patch.
Thanks,
drew
Quoted 79 lines
Quoted 30 lines
Signed-off-by Andrew Jones <[email protected]>--- hw/arm/virt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)hw/arm/virt.c +2
-2@@ -583,7 +583,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic) gicdev =qdev_create (NULL , gictype);qdev_prop_set_uint32 (gicdev,"revision" , type); -qdev_prop_set_uint32 (gicdev,"num-cpu" , smp_cpus); +qdev_prop_set_uint32 (gicdev,"num-cpu" , vms->smp_cpus);/* Note that the num-irq property counts both internal and external * interrupts; there are always 32 of the former (mandated by GIC spec). */ @@ -604,7 +604,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic)* maintenance interrupt signal to the appropriate GIC PPI inputs, * and the GIC's IRQ/FIQ/VIRQ/VFIQ interrupt outputs to the CPU's inputs. */ -for (i =0 ; i < smp_cpus; i++) { +for (i =0 ; i < vms->smp_cpus; i++) {DeviceState *cpudev =DEVICE (qemu_get_cpu (i));int ppibase =NUM_IRQS + i *GIC_INTERNAL +GIC_NR_SGIS ;int irq;hw/arm/virt.c static void create_gic(VirtMachineState *vms, qemu_irq *pic) · line 634
Quoted 7 lines
hw/arm/virt.c +1
-1@@ -629,7 +629,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic) + ARCH_GICV3_MAINT_IRQ));sysbus_connect_irq (gicbusdev, i,qdev_get_gpio_in (cpudev,ARM_CPU_IRQ )); -sysbus_connect_irq (gicbusdev, i + smp_cpus, +sysbus_connect_irq (gicbusdev, i + vms->smp_cpus,qdev_get_gpio_in (cpudev,ARM_CPU_FIQ )); sysbus_connect_irq(gicbusdev, i + 2 * smp_cpus,^^^^^^^^and other places in this file.
Quoted 37 lines
hw/arm/virt.c +4
-4qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ));@@ -958,7 +958,7 @@ static void create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)char *nodename; fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); -fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )smp_cpus); +fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )vms->smp_cpus); nodename =g_strdup_printf ("/fw-cfg@%" PRIx64, base);qemu_fdt_add_subnode (vms->fdt, nodename);@@ -1362,7 +1362,7 @@ static void machvirt_init(MachineState *machine)exit (1 ); } -for (n =0 ; n < smp_cpus; n++) { +for (n =0 ; n < vms->smp_cpus; n++) {Object *cpuobj =object_new (typename);if (!vmc->disallow_affinity_adjustment) {/* Adjust MPIDR like 64-bit KVM hosts, which incorporate the @@ -1452,7 +1452,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->smp_cpus = vms->smp_cpus; guest_info->fw_cfg =fw_cfg_find (); guest_info->memmap = vms->memmap; guest_info->irqmap = vms->irqmap;@@ -1466,7 +1466,7 @@ static void machvirt_init(MachineState *machine) vms->bootinfo.kernel_filename = machine->kernel_filename; vms->bootinfo.kernel_cmdline = machine->kernel_cmdline; vms->bootinfo.initrd_filename = machine->initrd_filename; - vms->bootinfo.nb_cpus = smp_cpus; + vms->bootinfo.nb_cpus = vms->smp_cpus; vms->bootinfo.board_id =-1 ; vms->bootinfo.loader_start = vms->memmap[VIRT_MEM ].base; vms->bootinfo.get_dtb = machvirt_dtb;
PATCH 4/11 hw/arm/virt: eliminate struct VirtGuestInfoState
In reply to Andrew JonesInstead 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"
--- hw/arm/virt.c | 20 +++++++++++--------- include/hw/arm/virt-acpi-build.h | 6 ------ 2 files changed, 11 insertions(+), 15 deletions(-)
hw/arm/virt.c +11 -9
@@ -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;
include/hw/arm/virt-acpi-build.h +0 -6
@@ -36,12 +36,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
Signature · 1 line
2.9.3
Re: [Qemu-arm] [PATCH 04/11] hw/arm/virt: eliminate struct VirtGuestInfoState
Quoted 7 lines · On Tue, 13 Dec 2016 22:45:15 +0100 Andrew Jones <[email protected]> wrote:
Instead of allocating a new struct just for VirtGuestInfo and the
machine_doneNotifier, place them inside VirtMachineState. This is the mach-virt equivalent of "pc: Eliminate struct PcGuestInfoState"Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Andrew Jones <[email protected]>
Quoted 75 lines
--- hw/arm/virt.c | 20 +++++++++++--------- include/hw/arm/virt-acpi-build.h | 6 ------ 2 files changed, 11 insertions(+), 15 deletions(-)hw/arm/virt.c +11
-9@@ -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;include/hw/arm/virt-acpi-build.h +0
-6@@ -36,12 +36,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
PATCH 5/11 hw/arm/virt: remove include/hw/arm/virt-acpi-build.h
In reply to Andrew Jonesinclude/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.
--- MAINTAINERS | 2 -- hw/arm/virt-acpi-build.c | 2 +- hw/arm/virt.c | 1 - include/hw/arm/virt-acpi-build.h | 41 ---------------------------------------- include/hw/arm/virt.h | 16 +++++++++++++++- 5 files changed, 16 insertions(+), 46 deletions(-) delete mode 100644 include/hw/arm/virt-acpi-build.h
MAINTAINERS +0 -2
@@ -508,7 +508,6 @@ M: Shannon Zhao <[email protected]> L: [email protected] S: Maintained F: hw/arm/virt-acpi-build.c -F: include/hw/arm/virt-acpi-build.h STM32F205 M: Alistair Francis <[email protected]>
@@ -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 <[email protected]>
hw/arm/virt-acpi-build.c +1 -1
@@ -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"
hw/arm/virt.c +0 -1
@@ -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"
include/hw/arm/virt-acpi-build.h deleted +0 -41
41 lines not on this page · raw message
include/hw/arm/virt.h +15 -1
@@ -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
@@ -47,6 +48,8 @@#define PPI (irq) ((irq) + 16) +#define ACPI_GICC_ENABLED 1 +enum {VIRT_FLASH ,VIRT_MEM ,
@@ -76,5 +79,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 ; + +void virt_acpi_setup (VirtGuestInfo *guest_info); -#endif +#endif /* QEMU_ARM_VIRT_H */
Signature · 1 line
2.9.3
Re: [Qemu-arm] [Qemu-devel] [PATCH 05/11] hw/arm/virt: remove include/hw/arm/virt-acpi-build.h
Quoted 7 lines · On Tue, 13 Dec 2016 22:45:16 +0100 Andrew Jones <[email protected]> wrote:
include/hw/arm/virt-acpi-build.his only used for VirtGuestInfo, which doesn't even necessarily have to be ACPI specific. Move VirtGuestInfo toinclude/hw/arm/virt.h, allowing us to removeinclude/hw/arm/virt-acpi-build.h, and to prepare for even more code motion.Signed-off-by Andrew Jones <[email protected]>
Quoted 147 lines
--- MAINTAINERS | 2 -- hw/arm/virt-acpi-build.c | 2 +- hw/arm/virt.c | 1 - include/hw/arm/virt-acpi-build.h | 41 ---------------------------------------- include/hw/arm/virt.h | 16 +++++++++++++++- 5 files changed, 16 insertions(+), 46 deletions(-) delete mode 100644 include/hw/arm/virt-acpi-build.hMAINTAINERS +0
-2@@ -508,7 +508,6 @@ M: Shannon Zhao <[email protected]> L: [email protected] S: Maintained F: hw/arm/virt-acpi-build.c -F: include/hw/arm/virt-acpi-build.h STM32F205 M: Alistair Francis <[email protected]>@@ -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 <[email protected]>hw/arm/virt-acpi-build.c +1
-1@@ -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" hw/arm/virt.c +0
-1@@ -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" include/hw/arm/virt-acpi-build.h deleted +0
-41@@ -1,41 +0,0 @@ -/* -* -* Copyright (c) 2015 HUAWEI TECHNOLOGIES CO.,LTD. -* -* Author: Shannon Zhao <[email protected]> -* -* 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" - -#define ACPI_GICC_ENABLED 1 - -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 include/hw/arm/virt.h +15
-1@@ -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@@ -47,6 +48,8 @@#define PPI (irq) ((irq) + 16) +#define ACPI_GICC_ENABLED 1 +enum {VIRT_FLASH ,VIRT_MEM ,@@ -76,5 +79,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 ; + +void virt_acpi_setup (VirtGuestInfo *guest_info); -#endif +#endif /* QEMU_ARM_VIRT_H */
PATCH 6/11 hw/arm/virt: move VirtMachineState/Class to virt.h
In reply to Andrew JonesIn 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
--- hw/arm/virt.c | 51 +++++++-------------------------------------------- include/hw/arm/virt.h | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 44 deletions(-)
hw/arm/virt.c +7 -44
@@ -58,50 +58,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 +87,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.
include/hw/arm/virt.h +39 -0
@@ -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
@@ -89,6 +91,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 */
Signature · 1 line
2.9.3
Re: [Qemu-arm] [PATCH 06/11] hw/arm/virt: move VirtMachineState/Class to virt.h
Quoted 5 lines · On Tue, 13 Dec 2016 22:45:17 +0100 Andrew Jones <[email protected]> wrote:
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.hSigned-off-by Andrew Jones <[email protected]>
Quoted 1 line
---
[...]
include/hw/arm/virt.h line 36
Quoted 9 lines
include/hw/arm/virt.h +1
-0@@ -33,6 +33,8 @@#include "qemu-common.h" #include "exec/hwaddr.h" #include "qemu/notify.h" +#include "hw/boards.h"
nit:
one won't need this header be included directly in virt.c anymore
Quoted 48 lines
include/hw/arm/virt.h +38
-0+#include "hw/arm/arm.h" #define NUM_GICV2M_SPIS 64#define NUM_VIRTIO_TRANSPORTS 32@@ -89,6 +91,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 */
PATCH 7/11 hw/arm/virt: pass VirtMachineState instead of VirtGuestInfo
In reply to Andrew JonesOnly two functions take VirtGuestInfo parameters. Now that guest-info is part of VirtMachineState, and VirtMachineState is defined in the virt header, pass that instead.
--- 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(-)
hw/arm/virt-acpi-build.c +2 -1
@@ -822,8 +822,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;
hw/arm/virt.c +4 -4
@@ -1156,9 +1156,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" ;
@@ -1191,8 +1191,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)
include/hw/arm/virt.h +1 -1
@@ -128,6 +128,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 */
Signature · 1 line
2.9.3
Re: [Qemu-arm] [Qemu-devel] [PATCH 07/11] hw/arm/virt: pass VirtMachineState instead of VirtGuestInfo
Quoted 31 lines · On Tue, 13 Dec 2016 22:45:18 +0100 Andrew Jones <[email protected]> wrote:
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 <[email protected]>--- 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(-)hw/arm/virt-acpi-build.c +2
-1@@ -822,8 +822,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;hw/arm/virt.c +0
-0
hw/arm/virt.c static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size) · line 1159
Quoted 5 lines
hw/arm/virt.c +1
-1@@ -1156,9 +1156,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)
Looks like all it needs is 'fw_cfg'
If there aren't plans to use more data from VirtMachineState, just passing fw_cfg should be enough.
Quoted 29 lines
hw/arm/virt.c +3
-3{ -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" ;@@ -1191,8 +1191,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)include/hw/arm/virt.h +1
-1@@ -128,6 +128,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 */
Re: [Qemu-arm] [Qemu-devel] [PATCH 07/11] hw/arm/virt: pass VirtMachineState instead of VirtGuestInfo
Quoted 37 lines · Igor Mammedov
Quoted 34 lines · On Tue, 13 Dec 2016 22:45:18 +0100 Andrew Jones <[email protected]> wrote:
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 <[email protected]>--- 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(-)hw/arm/virt-acpi-build.c +2
-1@@ -822,8 +822,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;hw/arm/virt.c +0
-0@@ -1156,9 +1156,9 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)return board->fdt; }
Quoted 5 lines
hw/arm/virt.c static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size) · line 1159
Quoted 2 lines
hw/arm/virt.c +1
-1-static void virt_build_smbios (VirtGuestInfo *guest_info) +static void virt_build_smbios (VirtMachineState *vms)Looks like all it needs is '
fw_cfg'
If there aren't plans to use more data from VirtMachineState, just passingfw_cfgshould be enough.
I prefer leaving it vms, as that's consistent with pretty much all the other functions in this file, and if we do need more state then it'll already be there. But I won't insist on this, it can always be changed later.
Thanks,
drew
Quoted 32 lines
Quoted 30 lines
hw/arm/virt.c +3
-3{ -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" ;@@ -1191,8 +1191,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)include/hw/arm/virt.h +1
-1@@ -128,6 +128,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 */
Igor Mammedov
Reviewed-byRe: [Qemu-arm] [Qemu-devel] [PATCH 07/11] hw/arm/virt: pass VirtMachineState instead of VirtGuestInfo
Quoted 9 lines · On Thu, 15 Dec 2016 17:24:05 +0100 Andrew Jones <[email protected]> wrote:
Quoted 8 lines · Igor Mammedov
Quoted 5 lines · On Tue, 13 Dec 2016 22:45:18 +0100 Andrew Jones <[email protected]> wrote:
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 <[email protected]>
Quoted 35 lines
Quoted 29 lines
Quoted 29 lines
--- 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(-)hw/arm/virt-acpi-build.c +2
-1@@ -822,8 +822,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;hw/arm/virt.c +0
-0@@ -1156,9 +1156,9 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)return board->fdt; }Quoted 5 lines
hw/arm/virt.c static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size) · line 1159
Quoted 2 lines
hw/arm/virt.c +1
-1-static void virt_build_smbios (VirtGuestInfo *guest_info) +static void virt_build_smbios (VirtMachineState *vms)Looks like all it needs is '
fw_cfg'
If there aren't plans to use more data from VirtMachineState, just passingfw_cfgshould be enough.
Quoted 4 lines
I prefer leaving it vms, as that's consistent with pretty much all the other functions in this file, and if we do need more state then it'll already be there. But I won't insist on this, it can always be changed later.
fw_Cfg seems cleaner but I don't mind it as it's now.
Quoted 37 lines
Thanks,
drewQuoted 32 lines
Quoted 30 lines
hw/arm/virt.c +3
-3{ -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" ;@@ -1191,8 +1191,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)include/hw/arm/virt.h +1
-1@@ -128,6 +128,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 */
PATCH 8/11 hw/arm/virt-acpi-build: remove redundant members from VirtGuestInfo
In reply to Andrew JonesNow 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.
--- 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(-)
hw/arm/virt-acpi-build.c +37 -35
@@ -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);
@@ -561,11 +561,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;
@@ -577,16 +578,16 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info) gicd->type =ACPI_APIC_GENERIC_DISTRIBUTOR ; gicd->length =sizeof (*gicd); gicd->base_address = 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++) {AcpiMadtGenericInterrupt *gicc =acpi_data_push (table_data,sizeof *gicc);ARMCPU *armcpu =ARM_CPU (qemu_get_cpu (i)); gicc->type =ACPI_APIC_GENERIC_INTERRUPT ; gicc->length =sizeof (*gicc); -if (guest_info->gic_version ==2 ) { +if (vms->gic_version ==2 ) { gicc->base_address = memmap[VIRT_GIC_CPU ].base; } gicc->cpu_interface_number = i;
@@ -599,7 +600,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);
@@ -609,7 +610,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);
@@ -658,11 +659,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 */
@@ -674,7 +675,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 ]);
@@ -682,7 +683,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);
@@ -709,8 +710,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;
@@ -724,32 +726,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 */
@@ -788,13 +790,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); }
@@ -842,7 +844,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,
hw/arm/virt.c +0 -6
@@ -1416,13 +1416,7 @@ static void machvirt_init(MachineState *machine)create_fw_cfg (vms, &address_space_memory);rom_set_fw (fw_cfg_find ()); - guest_info->smp_cpus = vms->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);
include/hw/arm/virt.h +0 -6
@@ -82,13 +82,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 {
Signature · 1 line
2.9.3
Re: [Qemu-arm] [PATCH 08/11] hw/arm/virt-acpi-build: remove redundant members from VirtGuestInfo
Quoted 5 lines · On Tue, 13 Dec 2016 22:45:19 +0100 Andrew Jones <[email protected]> wrote:
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 <[email protected]>
Quoted 284 lines
--- 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(-)hw/arm/virt-acpi-build.c +37
-35@@ -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);@@ -561,11 +561,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;@@ -577,16 +578,16 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info) gicd->type =ACPI_APIC_GENERIC_DISTRIBUTOR ; gicd->length =sizeof (*gicd); gicd->base_address = 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++) {AcpiMadtGenericInterrupt *gicc =acpi_data_push (table_data,sizeof *gicc);ARMCPU *armcpu =ARM_CPU (qemu_get_cpu (i)); gicc->type =ACPI_APIC_GENERIC_INTERRUPT ; gicc->length =sizeof (*gicc); -if (guest_info->gic_version ==2 ) { +if (vms->gic_version ==2 ) { gicc->base_address = memmap[VIRT_GIC_CPU ].base; } gicc->cpu_interface_number = i;@@ -599,7 +600,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);@@ -609,7 +610,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);@@ -658,11 +659,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 */ @@ -674,7 +675,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 ]);@@ -682,7 +683,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);@@ -709,8 +710,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;@@ -724,32 +726,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 */ @@ -788,13 +790,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); }@@ -842,7 +844,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,hw/arm/virt.c +0
-6@@ -1416,13 +1416,7 @@ static void machvirt_init(MachineState *machine)create_fw_cfg (vms, &address_space_memory);rom_set_fw (fw_cfg_find ()); - guest_info->smp_cpus = vms->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);include/hw/arm/virt.h +0
-6@@ -82,13 +82,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 {
PATCH 9/11 hw/arm/virt-acpi-build: don't save VirtGuestInfo on AcpiBuildState
In reply to Andrew JonesWe 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"
--- hw/arm/virt-acpi-build.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
hw/arm/virt-acpi-build.c +3 -4
@@ -706,7 +706,6 @@ struct AcpiBuildState {MemoryRegion *linker_mr;/* Is table patched? */ bool patched; -VirtGuestInfo *guest_info; } AcpiBuildState; static
@@ -779,6 +778,8 @@ static void acpi_ram_update(MemoryRegion *mr, GArray *data)static void virt_acpi_build_update (void *build_opaque) { +MachineState *machine =MACHINE (qdev_get_machine ()); +VirtMachineState *vms =VIRT_MACHINE (machine);AcpiBuildState *build_state = build_opaque;AcpiBuildTables tables;
@@ -790,8 +791,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 (vms, &tables);acpi_ram_update (build_state->table_mr, tables.table_data);acpi_ram_update (build_state->rsdp_mr, tables.rsdp);
@@ -841,7 +841,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);
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH 09/11] hw/arm/virt-acpi-build: don't save VirtGuestInfo on AcpiBuildState
Quoted 31 lines · On Tue, 13 Dec 2016 22:45:20 +0100 Andrew Jones <[email protected]> wrote:
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 <[email protected]>--- hw/arm/virt-acpi-build.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)hw/arm/virt-acpi-build.c +2
-1@@ -706,7 +706,6 @@ struct AcpiBuildState {MemoryRegion *linker_mr;/* Is table patched? */ bool patched; -VirtGuestInfo *guest_info; } AcpiBuildState; static@@ -779,6 +778,8 @@ static void acpi_ram_update(MemoryRegion *mr, GArray *data)static void virt_acpi_build_update (void *build_opaque) { +MachineState *machine =MACHINE (qdev_get_machine ()); +VirtMachineState *vms =VIRT_MACHINE (machine);AcpiBuildState *build_state = build_opaque;AcpiBuildTables tables;
hw/arm/virt-acpi-build.c static void virt_acpi_build_update(void *build_opaque) · line 794
Quoted 6 lines
hw/arm/virt-acpi-build.c +1
-2@@ -790,8 +791,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 (vms, &tables);
virt_acpi_build(VIRT_MACHINE(qdev_get_machine()), &tables);
or even better do it inside of virt_acpi_build(&tables);
Quoted 11 lines
hw/arm/virt-acpi-build.c +0
-1acpi_ram_update (build_state->table_mr, tables.table_data);acpi_ram_update (build_state->rsdp_mr, tables.rsdp);@@ -841,7 +841,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);
Re: [Qemu-arm] [PATCH 09/11] hw/arm/virt-acpi-build: don't save VirtGuestInfo on AcpiBuildState
Quoted 37 lines · Igor Mammedov
Quoted 34 lines · On Tue, 13 Dec 2016 22:45:20 +0100 Andrew Jones <[email protected]> wrote:
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 <[email protected]>--- hw/arm/virt-acpi-build.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)hw/arm/virt-acpi-build.c +2
-1@@ -706,7 +706,6 @@ struct AcpiBuildState {MemoryRegion *linker_mr;/* Is table patched? */ bool patched; -VirtGuestInfo *guest_info; } AcpiBuildState; static@@ -779,6 +778,8 @@ static void acpi_ram_update(MemoryRegion *mr, GArray *data)static void virt_acpi_build_update (void *build_opaque) { +MachineState *machine =MACHINE (qdev_get_machine ()); +VirtMachineState *vms =VIRT_MACHINE (machine);AcpiBuildState *build_state = build_opaque;AcpiBuildTables tables;@@ -790,8 +791,7 @@ static void virt_acpi_build_update(void *build_opaque)acpi_build_tables_init (&tables);
Quoted 7 lines
hw/arm/virt-acpi-build.c static void virt_acpi_build_update(void *build_opaque) · line 794
Quoted 3 lines
hw/arm/virt-acpi-build.c +1
-2-virt_acpi_build (container_of (build_state->guest_info, - VirtMachineState, acpi_guest_info), &tables); +virt_acpi_build (vms, &tables);
virt_acpi_build(VIRT_MACHINE(qdev_get_machine()), &tables);or even better do it inside of
virt_acpi_build(&tables);
Sounds good.
Thanks,
drew
Quoted 14 lines
Quoted 13 lines
hw/arm/virt-acpi-build.c +0
-1acpi_ram_update (build_state->table_mr, tables.table_data);acpi_ram_update (build_state->rsdp_mr, tables.rsdp);@@ -841,7 +841,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);
PATCH 10/11 hw/arm/virt: remove VirtGuestInfo
In reply to Andrew Jonesby 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.
--- hw/arm/virt-acpi-build.c | 7 +++---- hw/arm/virt.c | 18 +++++++----------- include/hw/arm/virt.h | 6 +----- 3 files changed, 11 insertions(+), 20 deletions(-)
hw/arm/virt-acpi-build.c +3 -4
@@ -826,11 +826,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 ; }
@@ -855,8 +854,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 );
hw/arm/virt.c +7 -11
@@ -914,15 +914,14 @@ static void create_flash(const VirtMachineState *vms, } } -static void create_fw_cfg (const VirtMachineState *vms,AddressSpace *as) +static void create_fw_cfg (VirtMachineState *vms,AddressSpace *as) {hwaddr base = vms->memmap[VIRT_FW_CFG ].base;hwaddr size = vms->memmap[VIRT_FW_CFG ].size; -FWCfgState *fw_cfg;char *nodename; - fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); -fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )vms->smp_cpus); + vms->fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); +fw_cfg_add_i16 (vms->fw_cfg,FW_CFG_NB_CPUS , (uint16_t )vms->smp_cpus); nodename =g_strdup_printf ("/fw-cfg@%" PRIx64, base);qemu_fdt_add_subnode (vms->fdt, nodename);
@@ -1158,12 +1157,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 ; }
@@ -1178,9 +1176,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); } }
@@ -1205,7 +1203,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;
@@ -1414,9 +1411,8 @@ static void machvirt_init(MachineState *machine)create_virtio_devices (vms, pic);create_fw_cfg (vms, &address_space_memory); -rom_set_fw (fw_cfg_find ()); +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);
include/hw/arm/virt.h +1 -5
@@ -81,10 +81,6 @@ typedef struct MemMapEntry {hwaddr size; } MemMapEntry; -typedef struct VirtGuestInfo { -FWCfgState *fw_cfg; -}VirtGuestInfo ; - typedef struct { MachineClass parent; bool disallow_affinity_adjustment;
@@ -95,8 +91,8 @@ typedef struct { typedef struct { MachineState parent; - VirtGuestInfo acpi_guest_info; Notifier machine_done; + FWCfgState *fw_cfg; bool secure; bool highmem; bool virt;
Signature · 1 line
2.9.3
Re: [Qemu-arm] [PATCH 10/11] hw/arm/virt: remove VirtGuestInfo
Quoted 97 lines · On Tue, 13 Dec 2016 22:45:21 +0100 Andrew Jones <[email protected]> wrote:
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 <[email protected]>--- hw/arm/virt-acpi-build.c | 7 +++---- hw/arm/virt.c | 18 +++++++----------- include/hw/arm/virt.h | 6 +----- 3 files changed, 11 insertions(+), 20 deletions(-)hw/arm/virt-acpi-build.c +3
-4@@ -826,11 +826,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 ; }@@ -855,8 +854,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 );hw/arm/virt.c +6
-9@@ -914,15 +914,14 @@ static void create_flash(const VirtMachineState *vms, } } -static void create_fw_cfg (const VirtMachineState *vms,AddressSpace *as) +static void create_fw_cfg (VirtMachineState *vms,AddressSpace *as) {hwaddr base = vms->memmap[VIRT_FW_CFG ].base;hwaddr size = vms->memmap[VIRT_FW_CFG ].size; -FWCfgState *fw_cfg;char *nodename; - fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); -fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )vms->smp_cpus); + vms->fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); +fw_cfg_add_i16 (vms->fw_cfg,FW_CFG_NB_CPUS , (uint16_t )vms->smp_cpus); nodename =g_strdup_printf ("/fw-cfg@%" PRIx64, base);qemu_fdt_add_subnode (vms->fdt, nodename);@@ -1158,12 +1157,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 ; }@@ -1178,9 +1176,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); } }@@ -1205,7 +1203,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;
hw/arm/virt.c static void machvirt_init(MachineState *machine) · line 1413
Quoted 3 lines
hw/arm/virt.c +0
-0@@ -1414,9 +1411,8 @@ static void machvirt_init(MachineState *machine)create_virtio_devices (vms, pic);create_fw_cfg (vms, &address_space_memory);
above would look clearer as:vms->fw_cfg = create_fw_cfg(vms, &address_space_memory);
Quoted 32 lines
hw/arm/virt.c +1
-2-rom_set_fw (fw_cfg_find ()); +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);include/hw/arm/virt.h +1
-5@@ -81,10 +81,6 @@ typedef struct MemMapEntry {hwaddr size; } MemMapEntry; -typedef struct VirtGuestInfo { -FWCfgState *fw_cfg; -}VirtGuestInfo ; - typedef struct { MachineClass parent; bool disallow_affinity_adjustment;@@ -95,8 +91,8 @@ typedef struct { typedef struct { MachineState parent; - VirtGuestInfo acpi_guest_info; Notifier machine_done; + FWCfgState *fw_cfg; bool secure; bool highmem; bool virt;
Re: [Qemu-arm] [PATCH 10/11] hw/arm/virt: remove VirtGuestInfo
Quoted 102 lines · Igor Mammedov
Quoted 99 lines · On Tue, 13 Dec 2016 22:45:21 +0100 Andrew Jones <[email protected]> wrote:
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 <[email protected]>--- hw/arm/virt-acpi-build.c | 7 +++---- hw/arm/virt.c | 18 +++++++----------- include/hw/arm/virt.h | 6 +----- 3 files changed, 11 insertions(+), 20 deletions(-)hw/arm/virt-acpi-build.c +3
-4@@ -826,11 +826,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 ; }@@ -855,8 +854,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 );hw/arm/virt.c +6
-9@@ -914,15 +914,14 @@ static void create_flash(const VirtMachineState *vms, } } -static void create_fw_cfg (const VirtMachineState *vms,AddressSpace *as) +static void create_fw_cfg (VirtMachineState *vms,AddressSpace *as) {hwaddr base = vms->memmap[VIRT_FW_CFG ].base;hwaddr size = vms->memmap[VIRT_FW_CFG ].size; -FWCfgState *fw_cfg;char *nodename; - fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); -fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , (uint16_t )vms->smp_cpus); + vms->fw_cfg =fw_cfg_init_mem_wide (base +8 , base,8 , base +16 , as); +fw_cfg_add_i16 (vms->fw_cfg,FW_CFG_NB_CPUS , (uint16_t )vms->smp_cpus); nodename =g_strdup_printf ("/fw-cfg@%" PRIx64, base);qemu_fdt_add_subnode (vms->fdt, nodename);@@ -1158,12 +1157,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 ; }@@ -1178,9 +1176,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); } }@@ -1205,7 +1203,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;@@ -1414,9 +1411,8 @@ static void machvirt_init(MachineState *machine)create_virtio_devices (vms, pic);
Quoted 4 lines
hw/arm/virt.c static void machvirt_init(MachineState *machine) · line 1413
Quoted 1 line
hw/arm/virt.c +0
-0create_fw_cfg (vms, &address_space_memory);above would look clearer as:
vms->fw_cfg=create_fw_cfg(vms, &address_space_memory);
Agreed, only none of the other create_* functions in this file have return values... Anyway, I'm fine either way.
Thanks,
drew
Quoted 34 lines
Quoted 33 lines
hw/arm/virt.c +1
-2-rom_set_fw (fw_cfg_find ()); +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);include/hw/arm/virt.h +1
-5@@ -81,10 +81,6 @@ typedef struct MemMapEntry {hwaddr size; } MemMapEntry; -typedef struct VirtGuestInfo { -FWCfgState *fw_cfg; -}VirtGuestInfo ; - typedef struct { MachineClass parent; bool disallow_affinity_adjustment;@@ -95,8 +91,8 @@ typedef struct { typedef struct { MachineState parent; - VirtGuestInfo acpi_guest_info; Notifier machine_done; + FWCfgState *fw_cfg; bool secure; bool highmem; bool virt;
PATCH 11/11 hw/arm/virt-acpi-build: Don't incorrectly claim architectural timer to be edge-triggered
In reply to Andrew JonesThis 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.
--- hw/arm/virt-acpi-build.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
hw/arm/virt-acpi-build.c +12 -6
@@ -535,24 +535,30 @@ 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; +uint8_t irqflags =ACPI_LEVEL_SENSITIVE ; + +if (vmc->claim_edge_triggered_timers) { + irqflags =ACPI_EDGE_SENSITIVE ; + } 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_flags = irqflags; 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_flags = irqflags |ACPI_GTDT_ALWAYS_ON ; gtdt->virtual_timer_interrupt =ARCH_TIMER_VIRT_IRQ +16 ; - gtdt->virtual_timer_flags =ACPI_EDGE_SENSITIVE ; + gtdt->virtual_timer_flags = irqflags; gtdt->non_secure_el2_interrupt =ARCH_TIMER_NS_EL2_IRQ +16 ; - gtdt->non_secure_el2_flags =ACPI_EDGE_SENSITIVE ; + gtdt->non_secure_el2_flags = irqflags; build_header(linker, table_data, (void *)(table_data->data + gtdt_start), "GTDT",
@@ -735,7 +741,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);
Signature · 1 line
2.9.3
Quoted 8 lines · Andrew Jones
This series is based on Peter's qemu-arm gicv3-virt branch. It's main goal (patches 04-10), 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 01-03 do some mach-virt cleanups and patch 11 adds the ACPI equivalent to one of the DT patches in Peter's gicv3-virt branch.
Quoted 6 lines
The last patch isn't really tested as the guest kernel versions I used seem to ignore the GTDT irqflags and either just choose edge, 4.5-based kernel, or level, 4.9-based kernel.
Patches available here
https://github.com/rhdrjones/qemu/commits/virt/remove-guest-info
I like this in general.
Pls merge through the ARM tree.
Quoted 25 lines
Andrew Jones (11):
hw/arm/virt: parameter passing cleanups
hw/arm/virt: use VirtMachineState.gic_version
hw/arm/virt: use VirtMachineState.smp_cpus
hw/arm/virt: eliminate struct VirtGuestInfoState hw/arm/virt: removeinclude/hw/arm/virt-acpi-build.hhw/arm/virt: move VirtMachineState/Class tovirt.hhw/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-triggeredMAINTAINERS | 2 - hw/arm/virt-acpi-build.c | 103 +++++++++++++------------- hw/arm/virt.c | 152 ++++++++++++++------------------------- include/hw/arm/virt-acpi-build.h | 47 ------------ include/hw/arm/virt.h | 45 +++++++++++- 5 files changed, 151 insertions(+), 198 deletions(-) delete mode 100644 include/hw/arm/virt-acpi-build.hSignature · 1 line
2.9.3