[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 08/20] acpi/hvmloader: Make providing IOAPIC in MADT optional



Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
---
 tools/firmware/hvmloader/acpi/acpi2_0.h |  1 +
 tools/firmware/hvmloader/acpi/build.c   | 68 ++++++++++++++++++---------------
 tools/firmware/hvmloader/util.c         |  2 +-
 3 files changed, 39 insertions(+), 32 deletions(-)

diff --git a/tools/firmware/hvmloader/acpi/acpi2_0.h 
b/tools/firmware/hvmloader/acpi/acpi2_0.h
index 2628a2f..6c762e0 100644
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h
+++ b/tools/firmware/hvmloader/acpi/acpi2_0.h
@@ -459,6 +459,7 @@ struct acpi_20_slit {
 #define ACPI_BUILD_SSDT_S3        (1<<1)
 #define ACPI_BUILD_SSDT_S4        (1<<2)
 #define ACPI_BUILD_TCPA           (1<<3)
+#define ACPI_BUILD_IOAPIC         (1<<4)
 
 /*
  * Located at ACPI_INFO_PHYSICAL_ADDRESS.
diff --git a/tools/firmware/hvmloader/acpi/build.c 
b/tools/firmware/hvmloader/acpi/build.c
index c56a6a6..08cf78b 100644
--- a/tools/firmware/hvmloader/acpi/build.c
+++ b/tools/firmware/hvmloader/acpi/build.c
@@ -83,43 +83,49 @@ static struct acpi_20_madt *construct_madt(struct 
acpi_config *config)
     madt->lapic_addr = LAPIC_BASE_ADDRESS;
     madt->flags      = ACPI_PCAT_COMPAT;
 
-    intsrcovr = (struct acpi_20_madt_intsrcovr *)(madt + 1);
-    for ( i = 0; i < 16; i++ )
+    if ( config->table_flags & ACPI_BUILD_IOAPIC )
     {
-        memset(intsrcovr, 0, sizeof(*intsrcovr));
-        intsrcovr->type   = ACPI_INTERRUPT_SOURCE_OVERRIDE;
-        intsrcovr->length = sizeof(*intsrcovr);
-        intsrcovr->source = i;
-
-        if ( i == 0 )
-        {
-            /* ISA IRQ0 routed to IOAPIC GSI 2. */
-            intsrcovr->gsi    = 2;
-            intsrcovr->flags  = 0x0;
-        }
-        else if ( PCI_ISA_IRQ_MASK & (1U << i) )
+        intsrcovr = (struct acpi_20_madt_intsrcovr *)(madt + 1);
+        for ( i = 0; i < 16; i++ )
         {
-            /* PCI: active-low level-triggered. */
-            intsrcovr->gsi    = i;
-            intsrcovr->flags  = 0xf;
-        }
-        else
-        {
-            /* No need for a INT source override structure. */
-            continue;
+            memset(intsrcovr, 0, sizeof(*intsrcovr));
+            intsrcovr->type   = ACPI_INTERRUPT_SOURCE_OVERRIDE;
+            intsrcovr->length = sizeof(*intsrcovr);
+            intsrcovr->source = i;
+
+            if ( i == 0 )
+            {
+                /* ISA IRQ0 routed to IOAPIC GSI 2. */
+                intsrcovr->gsi    = 2;
+                intsrcovr->flags  = 0x0;
+            }
+            else if ( PCI_ISA_IRQ_MASK & (1U << i) )
+            {
+                /* PCI: active-low level-triggered. */
+                intsrcovr->gsi    = i;
+                intsrcovr->flags  = 0xf;
+            }
+            else
+            {
+                /* No need for a INT source override structure. */
+                continue;
+            }
+
+            intsrcovr++;
         }
 
-        intsrcovr++;
-    }
+        io_apic = (struct acpi_20_madt_ioapic *)intsrcovr;
+        memset(io_apic, 0, sizeof(*io_apic));
+        io_apic->type        = ACPI_IO_APIC;
+        io_apic->length      = sizeof(*io_apic);
+        io_apic->ioapic_id   = IOAPIC_ID;
+        io_apic->ioapic_addr = IOAPIC_BASE_ADDRESS;
 
-    io_apic = (struct acpi_20_madt_ioapic *)intsrcovr;
-    memset(io_apic, 0, sizeof(*io_apic));
-    io_apic->type        = ACPI_IO_APIC;
-    io_apic->length      = sizeof(*io_apic);
-    io_apic->ioapic_id   = IOAPIC_ID;
-    io_apic->ioapic_addr = IOAPIC_BASE_ADDRESS;
+        lapic = (struct acpi_20_madt_lapic *)(io_apic + 1);
+    }
+    else
+        lapic = (struct acpi_20_madt_lapic *)(madt + 1);
 
-    lapic = (struct acpi_20_madt_lapic *)(io_apic + 1);
     config->acpi_info.madt_lapic0_addr = (uint32_t)lapic;
     for ( i = 0; i < nr_processor_objects; i++ )
     {
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index ce74fe2..982d023 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -911,7 +911,7 @@ void hvmloader_acpi_build_tables(struct acpi_config *config,
     if ( !strncmp(xenstore_read("platform/acpi_s4", "1"), "1", 1)  )
         config->table_flags |= ACPI_BUILD_SSDT_S4;
 
-    config->table_flags |= ACPI_BUILD_TCPA;
+    config->table_flags |= (ACPI_BUILD_TCPA | ACPI_BUILD_IOAPIC);
 
     config->nr_vcpus = hvm_info->nr_vcpus;
     config->vcpu_online = hvm_info->vcpu_online;
-- 
2.4.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.