* [PATCH 1/7] tests/acpi: allow changes for microvm/APIC.pcie
2020-10-16 11:38 [PATCH 0/7] microvm: fix PCIe IRQs in APIC table Gerd Hoffmann
@ 2020-10-16 11:38 ` Gerd Hoffmann
2020-10-16 11:38 ` [PATCH 2/7] tests/acpi: add empty microvm/APIC.pcie Gerd Hoffmann
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-10-16 11:38 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Sergio Lopez, Michael S. Tsirkin, Gerd Hoffmann,
Igor Mammedov, Paolo Bonzini, Richard Henderson
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
tests/qtest/bios-tables-test-allowed-diff.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8bf4..0c37ccebc5ba 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,2 @@
/* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/microvm/APIC.pcie",
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/7] tests/acpi: add empty microvm/APIC.pcie
2020-10-16 11:38 [PATCH 0/7] microvm: fix PCIe IRQs in APIC table Gerd Hoffmann
2020-10-16 11:38 ` [PATCH 1/7] tests/acpi: allow changes for microvm/APIC.pcie Gerd Hoffmann
@ 2020-10-16 11:38 ` Gerd Hoffmann
2020-10-16 11:38 ` [PATCH 3/7] x86: make pci irqs runtime configurable Gerd Hoffmann
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-10-16 11:38 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Sergio Lopez, Michael S. Tsirkin, Gerd Hoffmann,
Igor Mammedov, Paolo Bonzini, Richard Henderson
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
tests/data/acpi/microvm/APIC.pcie | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 tests/data/acpi/microvm/APIC.pcie
diff --git a/tests/data/acpi/microvm/APIC.pcie b/tests/data/acpi/microvm/APIC.pcie
new file mode 100644
index 000000000000..e69de29bb2d1
--
2.27.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/7] x86: make pci irqs runtime configurable
2020-10-16 11:38 [PATCH 0/7] microvm: fix PCIe IRQs in APIC table Gerd Hoffmann
2020-10-16 11:38 ` [PATCH 1/7] tests/acpi: allow changes for microvm/APIC.pcie Gerd Hoffmann
2020-10-16 11:38 ` [PATCH 2/7] tests/acpi: add empty microvm/APIC.pcie Gerd Hoffmann
@ 2020-10-16 11:38 ` Gerd Hoffmann
2020-10-16 11:38 ` [PATCH 4/7] microvm: set pci_irq_mask Gerd Hoffmann
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-10-16 11:38 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Sergio Lopez, Michael S. Tsirkin, Gerd Hoffmann,
Igor Mammedov, Paolo Bonzini, Richard Henderson
Add a variable to x86 machine state instead of
hard-coding the PCI interrupts.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
include/hw/i386/x86.h | 2 ++
hw/i386/acpi-common.c | 3 +--
hw/i386/x86.c | 1 +
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index d5dcf7a07fdc..bfa9cb2a258b 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -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];
diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c
index ab9b00581a15..1584abb3e6b0 100644
--- a/hw/i386/acpi-common.c
+++ b/hw/i386/acpi-common.c
@@ -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;
}
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 3137a2008588..5944fc44edca 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -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)
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/7] microvm: set pci_irq_mask
2020-10-16 11:38 [PATCH 0/7] microvm: fix PCIe IRQs in APIC table Gerd Hoffmann
` (2 preceding siblings ...)
2020-10-16 11:38 ` [PATCH 3/7] x86: make pci irqs runtime configurable Gerd Hoffmann
@ 2020-10-16 11:38 ` Gerd Hoffmann
2020-10-16 11:38 ` [PATCH 5/7] apci: drop has_pci arg for acpi_build_madt Gerd Hoffmann
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-10-16 11:38 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Sergio Lopez, Michael S. Tsirkin, Gerd Hoffmann,
Igor Mammedov, Paolo Bonzini, Richard Henderson
Makes sure the PCI interrupt overrides are added to the
APIC table in case PCIe is enabled.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/i386/acpi-microvm.c | 2 +-
hw/i386/microvm.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c
index f16f2311955c..8e2d2b7cff83 100644
--- a/hw/i386/acpi-microvm.c
+++ b/hw/i386/acpi-microvm.c
@@ -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);
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 73a7a142b44a..9dd74458aca4 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -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) {
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/7] apci: drop has_pci arg for acpi_build_madt
2020-10-16 11:38 [PATCH 0/7] microvm: fix PCIe IRQs in APIC table Gerd Hoffmann
` (3 preceding siblings ...)
2020-10-16 11:38 ` [PATCH 4/7] microvm: set pci_irq_mask Gerd Hoffmann
@ 2020-10-16 11:38 ` Gerd Hoffmann
2020-10-16 11:38 ` [PATCH 6/7] tests/acpi: update expected data files Gerd Hoffmann
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-10-16 11:38 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Sergio Lopez, Michael S. Tsirkin, Gerd Hoffmann,
Igor Mammedov, Paolo Bonzini, Richard Henderson
Setting x86ms->pci_irq_mask to zero has the same effect,
so we don't need the has_pci argument any more.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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(-)
diff --git a/hw/i386/acpi-common.h b/hw/i386/acpi-common.h
index 9cac18dddf5b..c30e461f1854 100644
--- a/hw/i386/acpi-common.h
+++ b/hw/i386/acpi-common.h
@@ -9,7 +9,6 @@
#define ACPI_BUILD_IOAPIC_ID 0x0
void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
- X86MachineState *x86ms, AcpiDeviceIf *adev,
- bool has_pci);
+ X86MachineState *x86ms, AcpiDeviceIf *adev);
#endif
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 45ad2f953341..e3a4bc206c4e 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -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) {
diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c
index 1584abb3e6b0..8a769654060e 100644
--- a/hw/i386/acpi-common.c
+++ b/hw/i386/acpi-common.c
@@ -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) {
diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c
index 8e2d2b7cff83..5efa89c32709 100644
--- a/hw/i386/acpi-microvm.c
+++ b/hw/i386/acpi-microvm.c
@@ -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);
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/7] tests/acpi: update expected data files
2020-10-16 11:38 [PATCH 0/7] microvm: fix PCIe IRQs in APIC table Gerd Hoffmann
` (4 preceding siblings ...)
2020-10-16 11:38 ` [PATCH 5/7] apci: drop has_pci arg for acpi_build_madt Gerd Hoffmann
@ 2020-10-16 11:38 ` Gerd Hoffmann
2020-10-16 11:38 ` [PATCH 7/7] tests/acpi: disallow changes for microvm/APIC.pcie Gerd Hoffmann
2020-10-23 18:42 ` [PATCH 0/7] microvm: fix PCIe IRQs in APIC table Igor Mammedov
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-10-16 11:38 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Sergio Lopez, Michael S. Tsirkin, Gerd Hoffmann,
Igor Mammedov, Paolo Bonzini, Richard Henderson
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
tests/data/acpi/microvm/APIC.pcie | Bin 0 -> 110 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/tests/data/acpi/microvm/APIC.pcie b/tests/data/acpi/microvm/APIC.pcie
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..6c51081b50beb061c5f4e5baa134585d82db4c39 100644
GIT binary patch
literal 110
zcmZ<^@N~{&U|?Xp@8s|75v<@85#a0y6k`O6f!H9Lf#JbFFwFr}2jnsGfW!{`1CdNz
b3_Kt%FNnp<3uE!|!C3tKU=|D8f1pMH#A*!z
literal 0
HcmV?d00001
--
2.27.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 7/7] tests/acpi: disallow changes for microvm/APIC.pcie
2020-10-16 11:38 [PATCH 0/7] microvm: fix PCIe IRQs in APIC table Gerd Hoffmann
` (5 preceding siblings ...)
2020-10-16 11:38 ` [PATCH 6/7] tests/acpi: update expected data files Gerd Hoffmann
@ 2020-10-16 11:38 ` Gerd Hoffmann
2020-10-23 18:42 ` [PATCH 0/7] microvm: fix PCIe IRQs in APIC table Igor Mammedov
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-10-16 11:38 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Sergio Lopez, Michael S. Tsirkin, Gerd Hoffmann,
Igor Mammedov, Paolo Bonzini, Richard Henderson
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
tests/qtest/bios-tables-test-allowed-diff.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 0c37ccebc5ba..dfb8523c8bf4 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,2 +1 @@
/* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/microvm/APIC.pcie",
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/7] microvm: fix PCIe IRQs in APIC table.
2020-10-16 11:38 [PATCH 0/7] microvm: fix PCIe IRQs in APIC table Gerd Hoffmann
` (6 preceding siblings ...)
2020-10-16 11:38 ` [PATCH 7/7] tests/acpi: disallow changes for microvm/APIC.pcie Gerd Hoffmann
@ 2020-10-23 18:42 ` Igor Mammedov
7 siblings, 0 replies; 9+ messages in thread
From: Igor Mammedov @ 2020-10-23 18:42 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: Eduardo Habkost, Sergio Lopez, Michael S. Tsirkin, qemu-devel,
Paolo Bonzini, Richard Henderson
On Fri, 16 Oct 2020 13:38:28 +0200
Gerd Hoffmann <kraxel@redhat.com> 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: 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
>
for series:
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread