Skip to contentSkip to conversation

x86/pvh: Do not add DSDT and FACS to PVH dom0 XSDT

PATCH Superseded Boris Ostrovsky 3 participants 3 messages Nov 8, 2017 – Nov 9, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pvh: Do not add DSDT and FACS to PVH dom0 XSDT

These tables are pointed to from FADT. Adding them will result in duplicate entries in the guest's tables.

---
 xen/arch/x86/hvm/dom0_build.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/dom0_build.c +15 -2
index a67071c..c878bba 100644
@@ -818,6 +818,19 @@ static bool __init pvh_acpi_table_allowed(const char *sig)
     return true;
 }
 
+static bool __init pvh_acpi_table_in_xsdt(const char *sig)
+{
+    /*
+     * DSDT and FACS are pointed to from FADT and thus don't belong
+     * in XSDT.
+     */
+    if ( !strncmp(sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE) ||
+         !strncmp(sig, ACPI_SIG_FACS, ACPI_NAME_SIZE) )
+        return false;
+
+    return true;
+}
+
 static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
                                       paddr_t *addr)
 {
@@ -841,7 +854,7 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
     {
         const char *sig = acpi_gbl_root_table_list.tables[i].signature.ascii;
 
-        if ( pvh_acpi_table_allowed(sig) )
+        if ( pvh_acpi_table_allowed(sig) && pvh_acpi_table_in_xsdt(sig) )
             num_tables++;
     }
 
@@ -888,7 +901,7 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
     {
         const char *sig = acpi_gbl_root_table_list.tables[i].signature.ascii;
 
-        if ( pvh_acpi_table_allowed(sig) )
+        if ( pvh_acpi_table_allowed(sig) && pvh_acpi_table_in_xsdt(sig) )
             xsdt->table_offset_entry[j++] =
                 acpi_gbl_root_table_list.tables[i].address;
     }
Signature · 7 lines
1.8.3.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 08.11.17 at 21:19, <[email protected]> wrote:

These tables are pointed to from FADT. Adding them will result in duplicate entries in the guest's tables.

Oh, indeed. Just one small adjustment request:

xen/arch/x86/hvm/dom0_build.c static bool __init pvh_acpi_table_allowed(const char *sig) · line 832

Quoted 12 lines
xen/arch/x86/hvm/dom0_build.c +12 -0
+static bool __init pvh_acpi_table_in_xsdt(const char *sig)
+{
+    /*
+     * DSDT and FACS are pointed to from FADT and thus don't belong
+     * in XSDT.
+     */
+    if ( !strncmp(sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE) ||
+         !strncmp(sig, ACPI_SIG_FACS, ACPI_NAME_SIZE) )
+        return false;
+
+    return true;
+}

Please don't use two return statements in cases like this one - all can be had with a single one and no explicit uses of true or false.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
In reply to Boris Ostrovsky
Quoted 18 lines · Boris Ostrovsky

These tables are pointed to from FADT. Adding them will result in duplicate entries in the guest's tables.

---
 xen/arch/x86/hvm/dom0_build.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/dom0_build.c +2 -0
index a67071c..c878bba 100644
@@ -818,6 +818,19 @@ static bool __init pvh_acpi_table_allowed(const char *sig)
     return true;
 }
 
+static bool __init pvh_acpi_table_in_xsdt(const char *sig)
+{

xen/arch/x86/hvm/dom0_build.c static bool __init pvh_acpi_table_allowed(const char *sig) · line 832

Quoted 10 lines
xen/arch/x86/hvm/dom0_build.c +10 -0
+    /*
+     * DSDT and FACS are pointed to from FADT and thus don't belong
+     * in XSDT.
+     */
+    if ( !strncmp(sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE) ||
+         !strncmp(sig, ACPI_SIG_FACS, ACPI_NAME_SIZE) )
+        return false;
+
+    return true;
+}

What about adding something like:

static bool __init pvh_acpi_xsdt_table_allowed(const char *sig)

{
    return pvh_acpi_table_allowed(sig) &&
           strncmp(sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE) &&
           strncmp(sig, ACPI_SIG_FACS, ACPI_NAME_SIZE);
}

And replacing the pvh_acpi_table_allowed calls in pvh_setup_acpi_xsdt with that?

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel