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

[Xen-devel] [PATCH-for-4.11] tools: add quirk for loading PVH RSDP into low memory



Commit 4a5733771e6f33918eba07b584cccce564a67ac1 ("libxl: put RSDP for
PVH guest near 4GB") broke PVH guests with Linux kernels before 4.17
as those kernels are not taking the RSDP address from the PVH
start_info structure, but are searching it as on legacy system by
scanning low memory.

Add a quirk to the domain config to enable loading the RSDP at low
addresses again.

Specifying "pvh_quirk_rsdp=1" will accomplish that.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 docs/man/xl.cfg.pod.5.in     | 8 ++++++++
 tools/libxl/libxl_create.c   | 1 +
 tools/libxl/libxl_types.idl  | 1 +
 tools/libxl/libxl_x86_acpi.c | 8 ++++++--
 tools/xl/xl_parse.c          | 2 ++
 5 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in
index 47d88243b1..4c00bc2d2f 100644
--- a/docs/man/xl.cfg.pod.5.in
+++ b/docs/man/xl.cfg.pod.5.in
@@ -541,6 +541,14 @@ If supplied, appended to the value for pvshim_cmdline.
 Default is empty.
 Ignored if pvhsim is false.
 
+=item B<pvh_quirk_rsdp=BOOLEAN>
+
+Linux kernels older than 4.17 need that set to true in order to enable
+them to find the RSDP table. From Linux 4.17 on this is no longer necessary
+as the kernel will use the RSDP address put by Xen into its boot parameters.
+
+Default is false.
+
 =back
 
 =head3 Other Options
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 692461a5a1..fd9070416a 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -400,6 +400,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
                 b_info->u.pvh.pvshim_cmdline =
                     libxl__strdup(NOGC, PVSHIM_CMDLINE);
         }
+        libxl_defbool_setdefault(&b_info->u.pvh.quirk_rsdp, false);
 
         break;
     default:
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 01ec1d1afa..76eabe31c0 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -596,6 +596,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("pvshim_path", string),
                                        ("pvshim_cmdline", string),
                                        ("pvshim_extra", string), # eg 
"loglvl=all guest_loglvl=all apic_verbosity=debug e820-verbose"
+                                       ("quirk_rsdp", libxl_defbool),
                                        ])),
                  ("invalid", None),
                  ], keyvar_init_val = "LIBXL_DOMAIN_TYPE_INVALID")),
diff --git a/tools/libxl/libxl_x86_acpi.c b/tools/libxl/libxl_x86_acpi.c
index fe87418bc1..a54025ed48 100644
--- a/tools/libxl/libxl_x86_acpi.c
+++ b/tools/libxl/libxl_x86_acpi.c
@@ -23,6 +23,7 @@
  /* Number of pages holding ACPI tables */
 #define NUM_ACPI_PAGES 16
 #define ACPI_INFO_PHYSICAL_ADDRESS 0xfc000000
+#define QUIRK_RSDP_ADDRESS (0x100000 - 64)
 
 struct libxl_acpi_ctxt {
     struct acpi_ctxt c;
@@ -218,8 +219,11 @@ int libxl__dom_load_acpi(libxl__gc *gc,
 
     dom->acpi_modules[0].data = (void *)config.rsdp;
     dom->acpi_modules[0].length = 64;
-    dom->acpi_modules[0].guest_addr_out = ACPI_INFO_PHYSICAL_ADDRESS +
-        (1 + acpi_pages_num) * libxl_ctxt.page_size;
+    if (libxl_defbool_val(b_info->u.pvh.quirk_rsdp))
+        dom->acpi_modules[0].guest_addr_out = QUIRK_RSDP_ADDRESS;
+    else
+        dom->acpi_modules[0].guest_addr_out = ACPI_INFO_PHYSICAL_ADDRESS +
+            (1 + acpi_pages_num) * libxl_ctxt.page_size;
 
     dom->acpi_modules[1].data = (void *)config.infop;
     dom->acpi_modules[1].length = 4096;
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index e6c54483e0..222705121e 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -973,6 +973,8 @@ void parse_config_data(const char *config_source,
         if (!xlu_cfg_get_string(config, "pvshim_extra", &buf, 0))
             xlu_cfg_replace_string(config, "pvshim_extra",
                                    &b_info->u.pvh.pvshim_extra, 0);
+        xlu_cfg_get_defbool(config, "pvh_quirk_rsdp",
+                            &b_info->u.pvh.quirk_rsdp, 0);
     }
 
     if (blkdev_start)
-- 
2.13.6


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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