microvm: fix PCIe IRQs in APIC table.
cover microvm: fix PCIe IRQs in APIC table.
Gerd Hoffmann (7):
tests/acpi: allow changes for microvm/APIC.pcie tests/acpi: add empty microvm/APIC.pcie
x86: make pci irqs runtime configurable
microvm: set pci_irq_mask
apci: drop has_pci arg for acpi_build_madt tests/acpi: update expected data files tests/acpi: disallow changes for microvm/APIC.pcie
hw/i386/acpi-common.h | 3 +-- include/hw/i386/x86.h | 2 ++ hw/i386/acpi-build.c | 2 +- hw/i386/acpi-common.c | 26 +++++++++++--------------- hw/i386/acpi-microvm.c | 2 +- hw/i386/microvm.c | 6 ++++++ hw/i386/x86.c | 1 + tests/data/acpi/microvm/APIC.pcie | Bin 0 -> 110 bytes 8 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 tests/data/acpi/microvm/APIC.pcie
Signature · 1 line
2.27.0
PATCH 1/7 tests/acpi: allow changes for microvm/APIC.pcie
--- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+)
tests/qtest/bios-tables-test-allowed-diff.h +1 -0
@@ -1 +1,2 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/microvm/APIC.pcie",
Signature · 1 line
2.27.0
PATCH 2/7 tests/acpi: add empty microvm/APIC.pcie
In reply to Gerd Hoffmann--- tests/data/acpi/microvm/APIC.pcie | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/data/acpi/microvm/APIC.pcie
tests/data/acpi/microvm/APIC.pcie new file +0 -0
Signature · 1 line
2.27.0
PATCH 3/7 x86: make pci irqs runtime configurable
In reply to Gerd HoffmannAdd a variable to x86 machine state instead of
hard-coding the PCI interrupts.
--- include/hw/i386/x86.h | 2 ++ hw/i386/acpi-common.c | 3 +-- hw/i386/x86.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
include/hw/i386/x86.h +2 -0
@@ -58,6 +58,7 @@ struct X86MachineState {/* CPU and apic information: */ bool apic_xrupt_override; +unsigned pci_irq_mask;unsigned apic_id_limit;uint16_t boot_cpus;unsigned smp_dies;
@@ -114,6 +115,7 @@ bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms);/* Global System Interrupts */ #define GSI_NUM_PINS IOAPIC_NUM_PINS +#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11)) typedef struct GSIState { qemu_irq i8259_irq[ISA_NUM_IRQS];
hw/i386/acpi-common.c +1 -2
@@ -115,8 +115,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,if (has_pci) {for (i =1 ; i <16 ; i++) { -#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11)) -if (!(ACPI_BUILD_PCI_IRQS & (1 << i))) { +if (!(x86ms->pci_irq_mask & (1 << i))) {/* No need for a INT source override structure. */ continue ; }
hw/i386/x86.c +1 -0
@@ -1178,6 +1178,7 @@ static void x86_machine_initfn(Object *obj) x86ms->smm =ON_OFF_AUTO_AUTO ; x86ms->acpi =ON_OFF_AUTO_AUTO ; x86ms->smp_dies =1 ; + x86ms->pci_irq_mask =ACPI_BUILD_PCI_IRQS ; }static void x86_machine_class_init (ObjectClass *oc,void *data)
Signature · 1 line
2.27.0
PATCH 4/7 microvm: set pci_irq_mask
In reply to Gerd HoffmannMakes sure the PCI interrupt overrides are added to the APIC table in case PCIe is enabled.
--- hw/i386/acpi-microvm.c | 2 +- hw/i386/microvm.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
hw/i386/acpi-microvm.c +1 -1
@@ -196,7 +196,7 @@ static void acpi_build_microvm(AcpiBuildTables *tables,acpi_add_table (table_offsets, tables_blob);acpi_build_madt (tables_blob, tables->linker,X86_MACHINE (machine), -ACPI_DEVICE_IF (x86ms->acpi_dev), false); +ACPI_DEVICE_IF (x86ms->acpi_dev), x86ms->pci_irq_mask !=0 ); xsdt = tables_blob->len;build_xsdt (tables_blob, tables->linker, table_offsets,NULL ,NULL );
hw/i386/microvm.c +6 -0
@@ -210,6 +210,12 @@ static void microvm_devices_init(MicrovmMachineState *mms) mms->gpex.ecam.size =PCIE_ECAM_SIZE ; mms->gpex.irq =PCIE_IRQ_BASE ;create_gpex (mms); + x86ms->pci_irq_mask = ((1 << (PCIE_IRQ_BASE +0 )) | + (1 << (PCIE_IRQ_BASE +1 )) | + (1 << (PCIE_IRQ_BASE +2 )) | + (1 << (PCIE_IRQ_BASE +3 ))); + }else { + x86ms->pci_irq_mask =0 ; }if (mms->pic ==ON_OFF_AUTO_ON || mms->pic ==ON_OFF_AUTO_AUTO ) {
Signature · 1 line
2.27.0
PATCH 5/7 apci: drop has_pci arg for acpi_build_madt
In reply to Gerd HoffmannSetting x86ms->pci_irq_mask to zero has the same effect, so we don't need the has_pci argument any more.
--- hw/i386/acpi-common.h | 3 +-- hw/i386/acpi-build.c | 2 +- hw/i386/acpi-common.c | 25 +++++++++++-------------- hw/i386/acpi-microvm.c | 2 +- 4 files changed, 14 insertions(+), 18 deletions(-)
hw/i386/acpi-common.h +1 -2
@@ -9,7 +9,6 @@#define ACPI_BUILD_IOAPIC_ID 0x0void acpi_build_madt (GArray *table_data,BIOSLinker *linker, -X86MachineState *x86ms,AcpiDeviceIf *adev, -bool has_pci); +X86MachineState *x86ms,AcpiDeviceIf *adev);#endif
hw/i386/acpi-build.c +1 -1
@@ -2477,7 +2477,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)acpi_add_table (table_offsets, tables_blob);acpi_build_madt (tables_blob, tables->linker, x86ms, -ACPI_DEVICE_IF (x86ms->acpi_dev), true); +ACPI_DEVICE_IF (x86ms->acpi_dev)); vmgenid_dev =find_vmgenid_dev ();if (vmgenid_dev) {
hw/i386/acpi-common.c +11 -14
@@ -72,8 +72,7 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, }void acpi_build_madt (GArray *table_data,BIOSLinker *linker, -X86MachineState *x86ms,AcpiDeviceIf *adev, -bool has_pci) +X86MachineState *x86ms,AcpiDeviceIf *adev) {MachineClass *mc =MACHINE_GET_CLASS (x86ms);const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids (MACHINE (x86ms));
@@ -113,19 +112,17 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker, intsrcovr->flags =cpu_to_le16 (0 );/* conforms to bus specifications */ } -if (has_pci) { -for (i =1 ; i <16 ; i++) { -if (!(x86ms->pci_irq_mask & (1 << i))) { -/* No need for a INT source override structure. */ -continue ; - } - intsrcovr =acpi_data_push (table_data,sizeof *intsrcovr); - intsrcovr->type =ACPI_APIC_XRUPT_OVERRIDE ; - intsrcovr->length =sizeof (*intsrcovr); - intsrcovr->source = i; - intsrcovr->gsi =cpu_to_le32 (i); - intsrcovr->flags =cpu_to_le16 (0xd );/* active high, level triggered */ +for (i =1 ; i <16 ; i++) { +if (!(x86ms->pci_irq_mask & (1 << i))) { +/* No need for a INT source override structure. */ +continue ; } + intsrcovr =acpi_data_push (table_data,sizeof *intsrcovr); + intsrcovr->type =ACPI_APIC_XRUPT_OVERRIDE ; + intsrcovr->length =sizeof (*intsrcovr); + intsrcovr->source = i; + intsrcovr->gsi =cpu_to_le32 (i); + intsrcovr->flags =cpu_to_le16 (0xd );/* active high, level triggered */ }if (x2apic_mode) {
hw/i386/acpi-microvm.c +1 -1
@@ -196,7 +196,7 @@ static void acpi_build_microvm(AcpiBuildTables *tables,acpi_add_table (table_offsets, tables_blob);acpi_build_madt (tables_blob, tables->linker,X86_MACHINE (machine), -ACPI_DEVICE_IF (x86ms->acpi_dev), x86ms->pci_irq_mask !=0 ); +ACPI_DEVICE_IF (x86ms->acpi_dev)); xsdt = tables_blob->len;build_xsdt (tables_blob, tables->linker, table_offsets,NULL ,NULL );
Signature · 1 line
2.27.0
PATCH 6/7 tests/acpi: update expected data files
In reply to Gerd Hoffmann--- tests/data/acpi/microvm/APIC.pcie | Bin 0 -> 110 bytes 1 file changed, 0 insertions(+), 0 deletions(-)
tests/data/acpi/microvm/APIC.pcie binary +0 -0
Signature · 1 line
2.27.0
PATCH 7/7 tests/acpi: disallow changes for microvm/APIC.pcie
In reply to Gerd Hoffmann--- tests/qtest/bios-tables-test-allowed-diff.h | 1 - 1 file changed, 1 deletion(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
@@ -1,2 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/microvm/APIC.pcie",
Signature · 1 line
2.27.0
Quoted 9 lines · On Fri, 16 Oct 2020 13:38:28 +0200 Gerd Hoffmann <[email protected]> wrote:
Gerd Hoffmann (7):
tests/acpi: allow changes for microvm/APIC.pcie tests/acpi: add empty microvm/APIC.pcie
x86: make pci irqs runtime configurable
microvm: setpci_irq_mask
apci: drophas_pciarg foracpi_build_madttests/acpi: update expected data files tests/acpi: disallow changes for microvm/APIC.pcie
Quoted 11 lines
hw/i386/acpi-common.h | 3 +-- include/hw/i386/x86.h | 2 ++ hw/i386/acpi-build.c | 2 +- hw/i386/acpi-common.c | 26 +++++++++++--------------- hw/i386/acpi-microvm.c | 2 +- hw/i386/microvm.c | 6 ++++++ hw/i386/x86.c | 1 + tests/data/acpi/microvm/APIC.pcie | Bin 0 -> 110 bytes 8 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 tests/data/acpi/microvm/APIC.pcie
for series: