Skip to contentSkip to conversation

xen/shim: stash RSDP address for ACPI driver

PATCH Superseded Wei Liu 3 participants 3 messages Jan 22, 2018

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH v2 1/1 xen/shim: stash RSDP address for ACPI driver

It used to the case that we placed RSDP under 1MB and let Xen search for it. We moved the placement to under 4GB in 4a5733771, so the search wouldn't work.

Introduce rsdp_hint to ACPI code and set that variable in convert_pvh_info.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/guest/pvh-boot.c | 2 ++
 xen/drivers/acpi/osl.c        | 5 +++++
 xen/include/xen/acpi.h        | 2 ++
 3 files changed, 9 insertions(+)
xen/arch/x86/guest/pvh-boot.c +2 -0
index be3122b16c..2903b392bc 100644
@@ -69,6 +69,8 @@ static void __init convert_pvh_info(void)
         mod[i].mod_end   = entry[i].paddr + entry[i].size;
         mod[i].string    = entry[i].cmdline_paddr;
     }
+
+    rsdp_hint = pvh_info->rsdp_paddr;
 }
 
 static void __init get_memory_map(void)
xen/drivers/acpi/osl.c +5 -0
index 52c9b4ba9a..5d8af6f290 100644
@@ -62,8 +62,13 @@ void __init acpi_os_vprintf(const char *fmt, va_list args)
 	printk("%s", buffer);
 }
 
+acpi_physical_address rsdp_hint;
+
 acpi_physical_address __init acpi_os_get_root_pointer(void)
 {
+	if (rsdp_hint)
+		return rsdp_hint;
+
 	if (efi_enabled(EFI_BOOT)) {
 		if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
 			return efi.acpi20;
xen/include/xen/acpi.h +2 -0
index 9409350f05..e83182cb14 100644
@@ -33,6 +33,8 @@
 #include <acpi/acpi.h>
 #include <asm/acpi.h>
 
+extern acpi_physical_address rsdp_hint;
+
 #define ACPI_MADT_GET_(fld, x) (((x) & ACPI_MADT_##fld##_MASK) / \
 	(ACPI_MADT_##fld##_MASK & -ACPI_MADT_##fld##_MASK))
 
Signature · 7 lines
2.11.0


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

xen/arch/x86/guest/pvh-boot.c static void __init convert_pvh_info(void) · line 73

Quoted 10 lines · Wei Liu
xen/arch/x86/guest/pvh-boot.c +2 -0
index be3122b16c..2903b392bc 100644
@@ -69,6 +69,8 @@ static void __init convert_pvh_info(void)
         mod[i].mod_end   = entry[i].paddr + entry[i].size;
         mod[i].string    = entry[i].cmdline_paddr;
     }
+
+    rsdp_hint = pvh_info->rsdp_paddr;

BUG_ON(!rsdp_hint);

I know it's not ideal, but given the other BUGs I think this should be here also.

xen/drivers/acpi/osl.c void __init acpi_os_vprintf(const char *fmt, va_list args) · line 65

Quoted 12 lines
xen/arch/x86/guest/pvh-boot.c +0 -0
 }
 
 static void __init get_memory_map(void)
xen/drivers/acpi/osl.c +1 -0
index 52c9b4ba9a..5d8af6f290 100644
@@ -62,8 +62,13 @@ void __init acpi_os_vprintf(const char *fmt, va_list args)
 	printk("%s", buffer);
 }
 
+acpi_physical_address rsdp_hint;

Since this is only used by acpi_os_get_root_pointer it should be __initdata. I also prefer to place global variables at the top of the file after the includes, but that's just a matter of taste I guess.

Quoted 13 lines
xen/drivers/acpi/osl.c +3 -0
 acpi_physical_address __init acpi_os_get_root_pointer(void)
 {
+	if (rsdp_hint)
+		return rsdp_hint;
+
 	if (efi_enabled(EFI_BOOT)) {
 		if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
 			return efi.acpi20;
xen/include/xen/acpi.h +0 -0
index 9409350f05..e83182cb14 100644

xen/include/xen/acpi.h line 39

Quoted 7 lines
xen/include/xen/acpi.h +2 -0
@@ -33,6 +33,8 @@
 #include <acpi/acpi.h>
 #include <asm/acpi.h>
 
+extern acpi_physical_address rsdp_hint;
+
 #define ACPI_MADT_GET_(fld, x) (((x) & ACPI_MADT_##fld##_MASK) / \
 	(ACPI_MADT_##fld##_MASK & -ACPI_MADT_##fld##_MASK))

I think this needs to go after the #ifdef CONFIG_ACPI guard?

Thanks, Roger.

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

#2 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 22.01.18 at 16:34, <[email protected]> wrote:
Quoted 6 lines · Wei Liu
xen/drivers/acpi/osl.c +0 -0
@@ -62,8 +62,13 @@ void __init acpi_os_vprintf(const char *fmt, va_list args)
 	printk("%s", buffer);
 }
 
Quoted 5 lines

xen/drivers/acpi/osl.c void __init acpi_os_vprintf(const char *fmt, va_list args) · line 65

Quoted 1 line
xen/drivers/acpi/osl.c +1 -0
+acpi_physical_address rsdp_hint;

Since this is only used by acpi_os_get_root_pointer it should be __initdata. I also prefer to place global variables at the top of the file after the includes, but that's just a matter of taste I guess.

I think keeping such limited use variable declarations / definitions close to their use site is quite okay, if not preferable.

Jan

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