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

[Xen-devel] [PATCH] acpi: set correct address of the control/event blocks in the FADT



Commit 149c6b unmasked an issue long present in Xen: the control/event
block addresses provided in the ACPI FADT table where hardcoded to the
V1 version. This was papered over because hvmloader would also always
set HVM_PARAM_ACPI_IOPORTS_LOCATION to 1 regardless of the BIOS
version.

Fix this by passing the address of the control/event blocks to
acpi_build_tables, so the values can be properly set in the FADT
table provided to the guest.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
---
This commit should fix the qumu-trad Windows errors seen by osstest.
---
 tools/firmware/hvmloader/ovmf.c    |  7 ++++++-
 tools/firmware/hvmloader/rombios.c |  6 ++++++
 tools/firmware/hvmloader/seabios.c |  5 +++++
 tools/firmware/hvmloader/util.c    | 10 ++++++++++
 tools/libacpi/build.c              |  9 +++++++++
 tools/libacpi/libacpi.h            |  7 +++++++
 6 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/tools/firmware/hvmloader/ovmf.c b/tools/firmware/hvmloader/ovmf.c
index 17bd0fe95f..64806b6764 100644
--- a/tools/firmware/hvmloader/ovmf.c
+++ b/tools/firmware/hvmloader/ovmf.c
@@ -121,7 +121,12 @@ static void ovmf_acpi_build_tables(void)
         .dsdt_anycpu = dsdt_anycpu_qemu_xen,
         .dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len,
         .dsdt_15cpu = NULL, 
-        .dsdt_15cpu_len = 0
+        .dsdt_15cpu_len = 0,
+        .pm1a_evt = ACPI_PM1A_EVT_BLK_ADDRESS_V1,
+        .pm1a_cnt = ACPI_PM1A_CNT_BLK_ADDRESS_V1,
+        .pm_tmr = ACPI_PM_TMR_BLK_ADDRESS_V1,
+        .gpe0 = ACPI_GPE0_BLK_ADDRESS_V1,
+        .gpe0_len = ACPI_GPE0_BLK_LEN_V1,
     };
 
     hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 1);
diff --git a/tools/firmware/hvmloader/rombios.c 
b/tools/firmware/hvmloader/rombios.c
index b14d1f2af3..9591bbb0aa 100644
--- a/tools/firmware/hvmloader/rombios.c
+++ b/tools/firmware/hvmloader/rombios.c
@@ -31,6 +31,7 @@
 
 #include <libacpi.h>
 #include <xen/hvm/params.h>
+#include <xen/hvm/ioreq.h>
 
 #define ROM_INCLUDE_ROMBIOS
 #define ROM_INCLUDE_VGABIOS
@@ -176,6 +177,11 @@ static void rombios_acpi_build_tables(void)
         .dsdt_anycpu_len = dsdt_anycpu_len,
         .dsdt_15cpu = dsdt_15cpu,
         .dsdt_15cpu_len = dsdt_15cpu_len,
+        .pm1a_evt = ACPI_PM1A_EVT_BLK_ADDRESS_V0,
+        .pm1a_cnt = ACPI_PM1A_CNT_BLK_ADDRESS_V0,
+        .pm_tmr = ACPI_PM_TMR_BLK_ADDRESS_V0,
+        .gpe0 = ACPI_GPE0_BLK_ADDRESS_V0,
+        .gpe0_len = ACPI_GPE0_BLK_LEN_V0,
     };
 
     hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 0);
diff --git a/tools/firmware/hvmloader/seabios.c 
b/tools/firmware/hvmloader/seabios.c
index c8792cd42b..0375407ca7 100644
--- a/tools/firmware/hvmloader/seabios.c
+++ b/tools/firmware/hvmloader/seabios.c
@@ -95,6 +95,11 @@ static void seabios_acpi_build_tables(void)
         .dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len,
         .dsdt_15cpu = NULL,
         .dsdt_15cpu_len = 0,
+        .pm1a_evt = ACPI_PM1A_EVT_BLK_ADDRESS_V1,
+        .pm1a_cnt = ACPI_PM1A_CNT_BLK_ADDRESS_V1,
+        .pm_tmr = ACPI_PM_TMR_BLK_ADDRESS_V1,
+        .gpe0 = ACPI_GPE0_BLK_ADDRESS_V1,
+        .gpe0_len = ACPI_GPE0_BLK_LEN_V1,
     };
 
     hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 1);
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index 934b566a5d..82171252a1 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -905,6 +905,11 @@ void hvmloader_acpi_build_tables(struct acpi_config 
*config,
         config->dsdt_anycpu_len = dsdt_anycpu_len;
         config->dsdt_15cpu = dsdt_15cpu;
         config->dsdt_15cpu_len = dsdt_15cpu_len;
+        config->pm1a_evt = ACPI_PM1A_EVT_BLK_ADDRESS_V0;
+        config->pm1a_cnt = ACPI_PM1A_CNT_BLK_ADDRESS_V0;
+        config->pm_tmr = ACPI_PM_TMR_BLK_ADDRESS_V0;
+        config->gpe0 = ACPI_GPE0_BLK_ADDRESS_V0;
+        config->gpe0_len = ACPI_GPE0_BLK_LEN_V0;
 
         hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 0);
     }
@@ -914,6 +919,11 @@ void hvmloader_acpi_build_tables(struct acpi_config 
*config,
         config->dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len;
         config->dsdt_15cpu = NULL;
         config->dsdt_15cpu_len = 0;
+        config->pm1a_evt = ACPI_PM1A_EVT_BLK_ADDRESS_V1;
+        config->pm1a_cnt = ACPI_PM1A_CNT_BLK_ADDRESS_V1;
+        config->pm_tmr = ACPI_PM_TMR_BLK_ADDRESS_V1;
+        config->gpe0 = ACPI_GPE0_BLK_ADDRESS_V1;
+        config->gpe0_len = ACPI_GPE0_BLK_LEN_V1;
 
         hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 1);
     }
diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index f9881c9604..50242f34c5 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -537,6 +537,15 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct 
acpi_config *config)
     }
 
     /*
+     * Set location of the control/event registers.
+     */
+    Fadt.pm1a_evt_blk = config->pm1a_evt;
+    Fadt.pm1a_cnt_blk = config->pm1a_cnt;
+    Fadt.pm_tmr_blk = config->pm_tmr;
+    Fadt.gpe0_blk = config->gpe0;
+    Fadt.gpe0_blk_len = config->gpe0_len;
+
+    /*
      * Fill in high-memory data structures, starting at @buf.
      */
 
diff --git a/tools/libacpi/libacpi.h b/tools/libacpi/libacpi.h
index 2ed1ecfc8e..2c56fb7646 100644
--- a/tools/libacpi/libacpi.h
+++ b/tools/libacpi/libacpi.h
@@ -96,6 +96,13 @@ struct acpi_config {
     uint32_t ioapic_base_address;
     uint16_t pci_isa_irq_mask;
     uint8_t ioapic_id;
+
+    /* Location of the control/event registers */
+    uint32_t pm1a_evt;
+    uint32_t pm1a_cnt;
+    uint32_t pm_tmr;
+    uint32_t gpe0;
+    uint8_t gpe0_len;
 };
 
 int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config);
-- 
2.11.0 (Apple Git-81)


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

 


Rackspace

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