Skip to contentSkip to conversation

tools: add quirk for loading PVH RSDP into low memory

PATCH-for-4.11 Juergen Gross 2 participants 2 messages Apr 5, 2018 – Apr 6, 2018

lore
Share & tools
lore
#0 lore raw

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.

---
 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(-)
docs/man/xl.cfg.pod.5.in +8 -0
index 47d88243b1..4c00bc2d2f 100644
@@ -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
tools/libxl/libxl_create.c +1 -0
index 692461a5a1..fd9070416a 100644
@@ -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:
tools/libxl/libxl_types.idl +1 -0
index 01ec1d1afa..76eabe31c0 100644
@@ -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")),
tools/libxl/libxl_x86_acpi.c +6 -2
index fe87418bc1..a54025ed48 100644
@@ -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;
tools/xl/xl_parse.c +2 -0
index e6c54483e0..222705121e 100644
@@ -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)
Signature · 7 lines
2.13.6


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 6 lines · Juergen Gross

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.

Quoted 6 lines

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

Specifying "pvh_quirk_rsdp=1" will accomplish that.

I'm ignoring this patch for now because the discussion seems to be still on-going.

I think this issue should be a blocker. We don't need to rush to a solution.

Wei.

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