[PATCH v2 03/13] acpi: madt: skip pci override on pci-less systems (microvm)

Gerd Hoffmann posted 13 patches 5 years, 7 months ago
Maintainers: Eduardo Habkost <ehabkost@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Richard Henderson <rth@twiddle.net>, Paolo Bonzini <pbonzini@redhat.com>, Sergio Lopez <slp@redhat.com>
There is a newer version of this series
[PATCH v2 03/13] acpi: madt: skip pci override on pci-less systems (microvm)
Posted by Gerd Hoffmann 5 years, 7 months ago
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 | 26 +++++++++++++++-----------
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/hw/i386/acpi-common.h b/hw/i386/acpi-common.h
index c30e461f1854..9cac18dddf5b 100644
--- a/hw/i386/acpi-common.h
+++ b/hw/i386/acpi-common.h
@@ -9,6 +9,7 @@
 #define ACPI_BUILD_IOAPIC_ID 0x0
 
 void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
-                     X86MachineState *x86ms, AcpiDeviceIf *adev);
+                     X86MachineState *x86ms, AcpiDeviceIf *adev,
+                     bool has_pci);
 
 #endif
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index eb530e5cd56d..4cce2192eeb0 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2441,7 +2441,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(pcms->acpi_dev));
+                    ACPI_DEVICE_IF(pcms->acpi_dev), true);
 
     vmgenid_dev = find_vmgenid_dev();
     if (vmgenid_dev) {
diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c
index 5caca16a0b59..ab9b00581a15 100644
--- a/hw/i386/acpi-common.c
+++ b/hw/i386/acpi-common.c
@@ -72,7 +72,8 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
 }
 
 void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
-                     X86MachineState *x86ms, AcpiDeviceIf *adev)
+                     X86MachineState *x86ms, AcpiDeviceIf *adev,
+                     bool has_pci)
 {
     MachineClass *mc = MACHINE_GET_CLASS(x86ms);
     const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(x86ms));
@@ -111,18 +112,21 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
         intsrcovr->gsi    = cpu_to_le32(2);
         intsrcovr->flags  = cpu_to_le16(0); /* conforms to bus specifications */
     }
-    for (i = 1; i < 16; i++) {
+
+    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))) {
-            /* No need for a INT source override structure. */
-            continue;
+            if (!(ACPI_BUILD_PCI_IRQS & (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 */
         }
-        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) {
-- 
2.18.4


Re: [PATCH v2 03/13] acpi: madt: skip pci override on pci-less systems (microvm)
Posted by Igor Mammedov 5 years, 7 months ago
On Tue,  5 May 2020 15:42:55 +0200
Gerd Hoffmann <kraxel@redhat.com> wrote:

> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/i386/acpi-common.h |  3 ++-
>  hw/i386/acpi-build.c  |  2 +-
>  hw/i386/acpi-common.c | 26 +++++++++++++++-----------
>  3 files changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/i386/acpi-common.h b/hw/i386/acpi-common.h
> index c30e461f1854..9cac18dddf5b 100644
> --- a/hw/i386/acpi-common.h
> +++ b/hw/i386/acpi-common.h
> @@ -9,6 +9,7 @@
>  #define ACPI_BUILD_IOAPIC_ID 0x0
>  
>  void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
> -                     X86MachineState *x86ms, AcpiDeviceIf *adev);
> +                     X86MachineState *x86ms, AcpiDeviceIf *adev,
> +                     bool has_pci);
>  
>  #endif
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index eb530e5cd56d..4cce2192eeb0 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2441,7 +2441,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(pcms->acpi_dev));
> +                    ACPI_DEVICE_IF(pcms->acpi_dev), true);
>  
>      vmgenid_dev = find_vmgenid_dev();
>      if (vmgenid_dev) {
> diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c
> index 5caca16a0b59..ab9b00581a15 100644
> --- a/hw/i386/acpi-common.c
> +++ b/hw/i386/acpi-common.c
> @@ -72,7 +72,8 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
>  }
>  
>  void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
> -                     X86MachineState *x86ms, AcpiDeviceIf *adev)
> +                     X86MachineState *x86ms, AcpiDeviceIf *adev,
> +                     bool has_pci)
>  {
>      MachineClass *mc = MACHINE_GET_CLASS(x86ms);
>      const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(x86ms));
> @@ -111,18 +112,21 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
>          intsrcovr->gsi    = cpu_to_le32(2);
>          intsrcovr->flags  = cpu_to_le16(0); /* conforms to bus specifications */
>      }
> -    for (i = 1; i < 16; i++) {
> +
> +    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))) {
> -            /* No need for a INT source override structure. */
> -            continue;
> +            if (!(ACPI_BUILD_PCI_IRQS & (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 */
>          }
> -        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) {


Re: [PATCH v2 03/13] acpi: madt: skip pci override on pci-less systems (microvm)
Posted by Philippe Mathieu-Daudé 5 years, 7 months ago
On 5/5/20 3:42 PM, Gerd Hoffmann wrote:
> 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 | 26 +++++++++++++++-----------
>   3 files changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/i386/acpi-common.h b/hw/i386/acpi-common.h
> index c30e461f1854..9cac18dddf5b 100644
> --- a/hw/i386/acpi-common.h
> +++ b/hw/i386/acpi-common.h
> @@ -9,6 +9,7 @@
>   #define ACPI_BUILD_IOAPIC_ID 0x0
>   
>   void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
> -                     X86MachineState *x86ms, AcpiDeviceIf *adev);
> +                     X86MachineState *x86ms, AcpiDeviceIf *adev,
> +                     bool has_pci);
>   
>   #endif
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index eb530e5cd56d..4cce2192eeb0 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2441,7 +2441,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(pcms->acpi_dev));
> +                    ACPI_DEVICE_IF(pcms->acpi_dev), true);
>   
>       vmgenid_dev = find_vmgenid_dev();
>       if (vmgenid_dev) {
> diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c
> index 5caca16a0b59..ab9b00581a15 100644
> --- a/hw/i386/acpi-common.c
> +++ b/hw/i386/acpi-common.c
> @@ -72,7 +72,8 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
>   }
>   
>   void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
> -                     X86MachineState *x86ms, AcpiDeviceIf *adev)
> +                     X86MachineState *x86ms, AcpiDeviceIf *adev,
> +                     bool has_pci)
>   {
>       MachineClass *mc = MACHINE_GET_CLASS(x86ms);
>       const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(x86ms));
> @@ -111,18 +112,21 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
>           intsrcovr->gsi    = cpu_to_le32(2);
>           intsrcovr->flags  = cpu_to_le16(0); /* conforms to bus specifications */
>       }
> -    for (i = 1; i < 16; i++) {
> +
> +    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))) {
> -            /* No need for a INT source override structure. */
> -            continue;
> +            if (!(ACPI_BUILD_PCI_IRQS & (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 */
>           }
> -        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) {
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>