xen/shim: stash RSDP address for ACPI driver
PATCH 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.
Stash the RSDP address to solve this problem.
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Roger Pau Monné <[email protected]>
What about PVH + EFI?
--- xen/arch/x86/guest/pvh-boot.c | 4 ++++ xen/drivers/acpi/osl.c | 9 +++++++++ xen/include/asm-x86/guest/pvh-boot.h | 1 + 3 files changed, 14 insertions(+)
xen/arch/x86/guest/pvh-boot.c +4 -0
@@ -30,6 +30,7 @@/* Initialised in head.S, before .bss is zeroed. */ bool __initdata pvh_boot;uint32_t __initdata pvh_start_info_pa; +unsigned long __initdata pvh_rsdp_pa;static multiboot_info_t __initdata pvh_mbi;static module_t __initdata pvh_mbi_mods[8 ];
@@ -69,6 +70,9 @@ static void __init convert_pvh_info(void) mod[i].mod_end = entry[i].paddr + entry[i].size; mod[i].string = entry[i].cmdline_paddr; } + +/* Stash RSDP pointer so ACPI driver can get it */ + pvh_rsdp_pa = pvh_info->rsdp_paddr;; }static void __init get_memory_map (void )
xen/drivers/acpi/osl.c +9 -0
@@ -38,6 +38,10 @@#include <xen/efi.h> #include <xen/vmap.h> +#ifdef CONFIG_PVH_GUEST +#include <asm/guest/pvh-boot.h> +#endif +#define _COMPONENT ACPI_OS_SERVICESACPI_MODULE_NAME ("osl" )
@@ -74,6 +78,11 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) "System description tables not found\n");return 0 ; } +#ifdef CONFIG_PVH_GUEST + }else if (pvh_boot) { +ASSERT (pvh_rsdp_pa); +return pvh_rsdp_pa; +#endif }else if (IS_ENABLED (CONFIG_ACPI_LEGACY_TABLES_LOOKUP )) {acpi_physical_address pa =0 ;
xen/include/asm-x86/guest/pvh-boot.h +1 -0
@@ -24,6 +24,7 @@#ifdef CONFIG_PVH_GUEST extern bool pvh_boot; +extern unsigned long pvh_rsdp_pa;multiboot_info_t *pvh_init (void );void pvh_print_info (void );
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Wei Liu
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.Stash the RSDP address to solve this problem.
Quoted 8 lines
Suggested-by Roger Pau Monné <[email protected]>Signed-off-by Wei Liu <[email protected]>---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Roger Pau Monné <[email protected]>What about PVH + EFI?
PVH guests using EFI firmware will get the RSDP address from the EFI tables. Ie: EFI firmware will use the PVH entry point, thus fetching the RSDP from start_info, but the kernel loaded from EFI should be using the EFI entry point, and thus fetching the RSDP pointer from the EFI tables. Or at least that was my thinking.
Quoted 11 lines
--- xen/arch/x86/guest/pvh-boot.c | 4 ++++ xen/drivers/acpi/osl.c | 9 +++++++++ xen/include/asm-x86/guest/pvh-boot.h | 1 + 3 files changed, 14 insertions(+)xen/arch/x86/guest/pvh-boot.c +0
-0
xen/arch/x86/guest/pvh-boot.c line 33
Quoted 4 lines
xen/arch/x86/guest/pvh-boot.c +1
-0@@ -30,6 +30,7 @@/* Initialised in head.S, before .bss is zeroed. */ bool __initdata pvh_boot;uint32_t __initdata pvh_start_info_pa; +unsigned long __initdata pvh_rsdp_pa;
uint64_t maybe to use the same type as start_info.h.
xen/arch/x86/guest/pvh-boot.c static void __init convert_pvh_info(void) · line 75
Quoted 10 lines
xen/arch/x86/guest/pvh-boot.c +3
-0static multiboot_info_t __initdata pvh_mbi;static module_t __initdata pvh_mbi_mods[8 ];@@ -69,6 +70,9 @@ static void __init convert_pvh_info(void) mod[i].mod_end = entry[i].paddr + entry[i].size; mod[i].string = entry[i].cmdline_paddr; } + +/* Stash RSDP pointer so ACPI driver can get it */ + pvh_rsdp_pa = pvh_info->rsdp_paddr;;
Double ';'.
Is this too early to panic? IMHO we should add:
if ( !pvh_info->rsdp_paddr )
panic("Unable to boot in PVH mode without ACPI tables");Preferably here or at acpi_os_get_root_pointer.
Quoted 19 lines
xen/arch/x86/guest/pvh-boot.c +0
-0}static void __init get_memory_map (void )xen/drivers/acpi/osl.c +4
-0@@ -38,6 +38,10 @@#include <xen/efi.h> #include <xen/vmap.h> +#ifdef CONFIG_PVH_GUEST +#include <asm/guest/pvh-boot.h> +#endif +#define _COMPONENT ACPI_OS_SERVICESACPI_MODULE_NAME ("osl" )
xen/drivers/acpi/osl.c acpi_physical_address __init acpi_os_get_root_pointer(void) · line 87
Quoted 10 lines
xen/drivers/acpi/osl.c +5
-0@@ -74,6 +78,11 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) "System description tables not found\n");return 0 ; } +#ifdef CONFIG_PVH_GUEST + }else if (pvh_boot) { +ASSERT (pvh_rsdp_pa); +return pvh_rsdp_pa; +#endif }else if (IS_ENABLED (CONFIG_ACPI_LEGACY_TABLES_LOOKUP )) {acpi_physical_address pa =0 ;
Can this be done in a non-PVH specific way?
Can we have a global rsdp_hint variable or similar that would be used here if set?
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines · Roger Pau Monné
Quoted 13 lines · Wei Liu
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.Stash the RSDP address to solve this problem.
Suggested-by Roger Pau Monné <[email protected]>Signed-off-by Wei Liu <[email protected]>---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Roger Pau Monné <[email protected]>
Quoted 7 lines
Quoted 1 line
What about PVH + EFI?
PVH guests using EFI firmware will get the RSDP address from the EFI tables. Ie: EFI firmware will use the PVH entry point, thus fetching the RSDP from
start_info, but the kernel loaded from EFI should be using the EFI entry point, and thus fetching the RSDP pointer from the EFI tables. Or at least that was my thinking.
Good. That means no addition is needed to the EFI path in acpi_os_get_root_pointer.
Quoted 32 lines
Quoted 12 lines
--- xen/arch/x86/guest/pvh-boot.c | 4 ++++ xen/drivers/acpi/osl.c | 9 +++++++++ xen/include/asm-x86/guest/pvh-boot.h | 1 + 3 files changed, 14 insertions(+)xen/arch/x86/guest/pvh-boot.c +0
-0xen/arch/x86/guest/pvh-boot.c line 33
Quoted 4 lines
xen/arch/x86/guest/pvh-boot.c +1
-0@@ -30,6 +30,7 @@/* Initialised in head.S, before .bss is zeroed. */ bool __initdata pvh_boot;uint32_t __initdata pvh_start_info_pa; +unsigned long __initdata pvh_rsdp_pa;
uint64_tmaybe to use the same type asstart_info.h.xen/arch/x86/guest/pvh-boot.c static void __init convert_pvh_info(void) · line 75
Quoted 10 lines
xen/arch/x86/guest/pvh-boot.c +3
-0static multiboot_info_t __initdata pvh_mbi;static module_t __initdata pvh_mbi_mods[8 ];@@ -69,6 +70,9 @@ static void __init convert_pvh_info(void) mod[i].mod_end = entry[i].paddr + entry[i].size; mod[i].string = entry[i].cmdline_paddr; } + +/* Stash RSDP pointer so ACPI driver can get it */ + pvh_rsdp_pa = pvh_info->rsdp_paddr;;Double ';'.
Quoted 6 lines
Is this too early to panic? IMHO we should add:
if ( !pvh_info->rsdp_paddr )
panic("Unable to boot in PVH mode without ACPI tables");Preferably here or at
acpi_os_get_root_pointer.
It is too early to panic here. Even those BUG_ONs are problematic (yes they do stop booting but no useful message is printed). But I couldn't come up with a better way when I wrote the patch.
It is better to do that later in acpi_os_get_root_pointer.
Quoted 33 lines
Quoted 20 lines
xen/arch/x86/guest/pvh-boot.c +0
-0}static void __init get_memory_map (void )xen/drivers/acpi/osl.c +4
-0@@ -38,6 +38,10 @@#include <xen/efi.h> #include <xen/vmap.h> +#ifdef CONFIG_PVH_GUEST +#include <asm/guest/pvh-boot.h> +#endif +#define _COMPONENT ACPI_OS_SERVICESACPI_MODULE_NAME ("osl" )xen/drivers/acpi/osl.c acpi_physical_address __init acpi_os_get_root_pointer(void) · line 87
Quoted 10 lines
xen/drivers/acpi/osl.c +5
-0@@ -74,6 +78,11 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) "System description tables not found\n");return 0 ; } +#ifdef CONFIG_PVH_GUEST + }else if (pvh_boot) { +ASSERT (pvh_rsdp_pa); +return pvh_rsdp_pa; +#endif }else if (IS_ENABLED (CONFIG_ACPI_LEGACY_TABLES_LOOKUP )) {acpi_physical_address pa =0 ;Can this be done in a non-PVH specific way?
Quoted 2 lines
Can we have a global
rsdp_hintvariable or similar that would be used here if set?
Who will be the anticipated user(s) other than PVH?
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 30 lines
Quoted 1 line
Quoted 1 line · On 22.01.18 at 14:21, <[email protected]> wrote:
Quoted 28 lines · Roger Pau Monné
Quoted 14 lines · Wei Liu
xen/drivers/acpi/osl.c +4
-0@@ -38,6 +38,10 @@#include <xen/efi.h> #include <xen/vmap.h> +#ifdef CONFIG_PVH_GUEST +#include <asm/guest/pvh-boot.h> +#endif +#define _COMPONENT ACPI_OS_SERVICESACPI_MODULE_NAME ("osl" )xen/drivers/acpi/osl.c acpi_physical_address __init acpi_os_get_root_pointer(void) · line 87
Quoted 10 lines
xen/drivers/acpi/osl.c +5
-0@@ -74,6 +78,11 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) "System description tables not found\n");return 0 ; } +#ifdef CONFIG_PVH_GUEST + }else if (pvh_boot) { +ASSERT (pvh_rsdp_pa); +return pvh_rsdp_pa; +#endif }else if (IS_ENABLED (CONFIG_ACPI_LEGACY_TABLES_LOOKUP )) {acpi_physical_address pa =0 ;Can this be done in a non-PVH specific way?
Quoted 4 lines
Quoted 2 lines
Can we have a global
rsdp_hintvariable or similar that would be used here if set?Who will be the anticipated user(s) other than PVH?
That's not so much the question here imo. Instead the issue I see is that the way you code it it's really a layering violation. Similar hackery was also rejected in Linux recently, iirc.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 30 lines · Jan Beulich
Quoted 30 lines
Quoted 1 line
Quoted 1 line · On 22.01.18 at 14:21, <[email protected]> wrote:
Quoted 28 lines · Roger Pau Monné
Quoted 14 lines · Wei Liu
xen/drivers/acpi/osl.c +4
-0@@ -38,6 +38,10 @@#include <xen/efi.h> #include <xen/vmap.h> +#ifdef CONFIG_PVH_GUEST +#include <asm/guest/pvh-boot.h> +#endif +#define _COMPONENT ACPI_OS_SERVICESACPI_MODULE_NAME ("osl" )xen/drivers/acpi/osl.c acpi_physical_address __init acpi_os_get_root_pointer(void) · line 87
Quoted 10 lines
xen/drivers/acpi/osl.c +5
-0@@ -74,6 +78,11 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) "System description tables not found\n");return 0 ; } +#ifdef CONFIG_PVH_GUEST + }else if (pvh_boot) { +ASSERT (pvh_rsdp_pa); +return pvh_rsdp_pa; +#endif }else if (IS_ENABLED (CONFIG_ACPI_LEGACY_TABLES_LOOKUP )) {acpi_physical_address pa =0 ;Can this be done in a non-PVH specific way?
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Can we have a global
rsdp_hintvariable or similar that would be used here if set?Who will be the anticipated user(s) other than PVH?
That's not so much the question here imo. Instead the issue I see is that the way you code it it's really a layering violation. Similar hackery was also rejected in Linux recently, iirc.
OK. I buy this argument.
Let me invent a rsdp_hint instead.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel