All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/PVH/libxl: Check whether Linux guest can handle RSDP at 4G boundary
@ 2018-04-07 23:03 Boris Ostrovsky
  2018-04-09  7:06 ` Juergen Gross
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Boris Ostrovsky @ 2018-04-07 23:03 UTC (permalink / raw)
  To: xen-devel
  Cc: jgross, sstabellini, wei.liu2, George.Dunlap, andrew.cooper3,
	ian.jackson, tim, julien.grall, jbeulich, Boris Ostrovsky

Commit 4a5733771e6f ("libxl: put RSDP for PVH guest near 4GB") breaks
pre-4.17 Linux guests since they do not use start_info's rsdp_paddr
pointer and instread scan BIOS memory for RSDP signature.

Introduce XENFEAT_rsdp_unrestricted feature flag that indicates whether
the guest can handle RSDP at locations pointed to by rsdp_paddr.

Since only Linux PVH guests suffer from this problem (BSD has always
relied on rsdp_paddr) we check this flag just for those guests. If the
flag is not set we place RSDP in BIOS, as before.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 tools/libxl/libxl_x86_acpi.c  | 13 +++++++++++--
 xen/include/public/features.h |  8 ++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_x86_acpi.c b/tools/libxl/libxl_x86_acpi.c
index fe87418bc1..046d4866c7 100644
--- a/tools/libxl/libxl_x86_acpi.c
+++ b/tools/libxl/libxl_x86_acpi.c
@@ -218,8 +218,17 @@ 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;
+    /*
+     * Some Linux versions cannot properly process hvm_start_info.rsdp_paddr
+     * and so we need to put RSDP in location that can be discovered by ACPI's
+     * standard search method, in R-O BIOS memory (we chose last 64 bytes)
+     */
+    if (strcmp(dom->parms.guest_os, "linux") ||
+        elf_xen_feature_get(XENFEAT_rsdp_unrestricted, dom->parms.f_supported))
+        dom->acpi_modules[0].guest_addr_out = ACPI_INFO_PHYSICAL_ADDRESS +
+            (1 + acpi_pages_num) * libxl_ctxt.page_size;
+    else
+        dom->acpi_modules[0].guest_addr_out = 0x100000 - 64;
 
     dom->acpi_modules[1].data = (void *)config.infop;
     dom->acpi_modules[1].length = 4096;
diff --git a/xen/include/public/features.h b/xen/include/public/features.h
index 1a989b8bf9..c5319fbfbf 100644
--- a/xen/include/public/features.h
+++ b/xen/include/public/features.h
@@ -105,6 +105,14 @@
 /* arm: Hypervisor supports ARM SMC calling convention. */
 #define XENFEAT_ARM_SMCCC_supported       14
 
+/*
+ * x86/PVH: If set, ACPI RSDP can be placed at any address. Otherwise RSDP
+ * must be located in lower 1MB, as required by ACPI Specification for IA-PC
+ * systems.
+ * This feature flag is only consulted for Linux guests.
+ */
+#define XENFEAT_rsdp_unrestricted         15
+
 #define XENFEAT_NR_SUBMAPS 1
 
 #endif /* __XEN_PUBLIC_FEATURES_H__ */
-- 
2.14.3


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/PVH/libxl: Check whether Linux guest can handle RSDP at 4G boundary
  2018-04-07 23:03 [PATCH] x86/PVH/libxl: Check whether Linux guest can handle RSDP at 4G boundary Boris Ostrovsky
@ 2018-04-09  7:06 ` Juergen Gross
  2018-04-09  9:06 ` Roger Pau Monné
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Juergen Gross @ 2018-04-09  7:06 UTC (permalink / raw)
  To: Boris Ostrovsky, xen-devel
  Cc: sstabellini, wei.liu2, George.Dunlap, andrew.cooper3,
	ian.jackson, tim, julien.grall, jbeulich

On 08/04/18 01:03, Boris Ostrovsky wrote:
> Commit 4a5733771e6f ("libxl: put RSDP for PVH guest near 4GB") breaks
> pre-4.17 Linux guests since they do not use start_info's rsdp_paddr
> pointer and instread scan BIOS memory for RSDP signature.
> 
> Introduce XENFEAT_rsdp_unrestricted feature flag that indicates whether
> the guest can handle RSDP at locations pointed to by rsdp_paddr.
> 
> Since only Linux PVH guests suffer from this problem (BSD has always
> relied on rsdp_paddr) we check this flag just for those guests. If the
> flag is not set we place RSDP in BIOS, as before.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Reviewed-by: Juergen Gross <jgross@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/PVH/libxl: Check whether Linux guest can handle RSDP at 4G boundary
  2018-04-07 23:03 [PATCH] x86/PVH/libxl: Check whether Linux guest can handle RSDP at 4G boundary Boris Ostrovsky
  2018-04-09  7:06 ` Juergen Gross
@ 2018-04-09  9:06 ` Roger Pau Monné
  2018-04-09  9:20 ` Wei Liu
  2018-04-09 10:03 ` George Dunlap
  3 siblings, 0 replies; 5+ messages in thread
From: Roger Pau Monné @ 2018-04-09  9:06 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: jgross, sstabellini, wei.liu2, George.Dunlap, andrew.cooper3,
	ian.jackson, tim, julien.grall, jbeulich, xen-devel

On Sat, Apr 07, 2018 at 07:03:32PM -0400, Boris Ostrovsky wrote:
> Commit 4a5733771e6f ("libxl: put RSDP for PVH guest near 4GB") breaks
> pre-4.17 Linux guests since they do not use start_info's rsdp_paddr
> pointer and instread scan BIOS memory for RSDP signature.
> 
> Introduce XENFEAT_rsdp_unrestricted feature flag that indicates whether
> the guest can handle RSDP at locations pointed to by rsdp_paddr.
> 
> Since only Linux PVH guests suffer from this problem (BSD has always
> relied on rsdp_paddr) we check this flag just for those guests. If the
> flag is not set we place RSDP in BIOS, as before.

LGTM if we agree to do this based on the contents of
XEN_ELFNOTE_GUEST_OS. I think this is the first time we have a feature
flag that depends on the OS type.

> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
>  tools/libxl/libxl_x86_acpi.c  | 13 +++++++++++--
>  xen/include/public/features.h |  8 ++++++++
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/libxl/libxl_x86_acpi.c b/tools/libxl/libxl_x86_acpi.c
> index fe87418bc1..046d4866c7 100644
> --- a/tools/libxl/libxl_x86_acpi.c
> +++ b/tools/libxl/libxl_x86_acpi.c
> @@ -218,8 +218,17 @@ 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;
> +    /*
> +     * Some Linux versions cannot properly process hvm_start_info.rsdp_paddr
> +     * and so we need to put RSDP in location that can be discovered by ACPI's
> +     * standard search method, in R-O BIOS memory (we chose last 64 bytes)
> +     */
> +    if (strcmp(dom->parms.guest_os, "linux") ||
> +        elf_xen_feature_get(XENFEAT_rsdp_unrestricted, dom->parms.f_supported))
> +        dom->acpi_modules[0].guest_addr_out = ACPI_INFO_PHYSICAL_ADDRESS +
> +            (1 + acpi_pages_num) * libxl_ctxt.page_size;
> +    else
> +        dom->acpi_modules[0].guest_addr_out = 0x100000 - 64;
>  
>      dom->acpi_modules[1].data = (void *)config.infop;
>      dom->acpi_modules[1].length = 4096;
> diff --git a/xen/include/public/features.h b/xen/include/public/features.h
> index 1a989b8bf9..c5319fbfbf 100644
> --- a/xen/include/public/features.h
> +++ b/xen/include/public/features.h
> @@ -105,6 +105,14 @@
>  /* arm: Hypervisor supports ARM SMC calling convention. */
>  #define XENFEAT_ARM_SMCCC_supported       14
>  
> +/*
> + * x86/PVH: If set, ACPI RSDP can be placed at any address. Otherwise RSDP
> + * must be located in lower 1MB, as required by ACPI Specification for IA-PC
> + * systems.
> + * This feature flag is only consulted for Linux guests.

I would slightly change the above to be more explicit:

This feature flag is only consulted if XEN_ELFNOTE_GUEST_OS contains
the "linux" string.

Thanks, Roger.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/PVH/libxl: Check whether Linux guest can handle RSDP at 4G boundary
  2018-04-07 23:03 [PATCH] x86/PVH/libxl: Check whether Linux guest can handle RSDP at 4G boundary Boris Ostrovsky
  2018-04-09  7:06 ` Juergen Gross
  2018-04-09  9:06 ` Roger Pau Monné
@ 2018-04-09  9:20 ` Wei Liu
  2018-04-09 10:03 ` George Dunlap
  3 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2018-04-09  9:20 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: jgross, sstabellini, wei.liu2, George.Dunlap, andrew.cooper3,
	ian.jackson, tim, julien.grall, jbeulich, xen-devel

On Sat, Apr 07, 2018 at 07:03:32PM -0400, Boris Ostrovsky wrote:
> Commit 4a5733771e6f ("libxl: put RSDP for PVH guest near 4GB") breaks
> pre-4.17 Linux guests since they do not use start_info's rsdp_paddr
> pointer and instread scan BIOS memory for RSDP signature.
> 
> Introduce XENFEAT_rsdp_unrestricted feature flag that indicates whether
> the guest can handle RSDP at locations pointed to by rsdp_paddr.
> 
> Since only Linux PVH guests suffer from this problem (BSD has always
> relied on rsdp_paddr) we check this flag just for those guests. If the
> flag is not set we place RSDP in BIOS, as before.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
>  tools/libxl/libxl_x86_acpi.c  | 13 +++++++++++--
>  xen/include/public/features.h |  8 ++++++++
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/libxl/libxl_x86_acpi.c b/tools/libxl/libxl_x86_acpi.c
> index fe87418bc1..046d4866c7 100644
> --- a/tools/libxl/libxl_x86_acpi.c
> +++ b/tools/libxl/libxl_x86_acpi.c
> @@ -218,8 +218,17 @@ 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;
> +    /*
> +     * Some Linux versions cannot properly process hvm_start_info.rsdp_paddr
> +     * and so we need to put RSDP in location that can be discovered by ACPI's
> +     * standard search method, in R-O BIOS memory (we chose last 64 bytes)
> +     */
> +    if (strcmp(dom->parms.guest_os, "linux") ||
> +        elf_xen_feature_get(XENFEAT_rsdp_unrestricted, dom->parms.f_supported))
> +        dom->acpi_modules[0].guest_addr_out = ACPI_INFO_PHYSICAL_ADDRESS +
> +            (1 + acpi_pages_num) * libxl_ctxt.page_size;
> +    else
> +        dom->acpi_modules[0].guest_addr_out = 0x100000 - 64;
>  
>      dom->acpi_modules[1].data = (void *)config.infop;
>      dom->acpi_modules[1].length = 4096;
> diff --git a/xen/include/public/features.h b/xen/include/public/features.h
> index 1a989b8bf9..c5319fbfbf 100644
> --- a/xen/include/public/features.h
> +++ b/xen/include/public/features.h
> @@ -105,6 +105,14 @@
>  /* arm: Hypervisor supports ARM SMC calling convention. */
>  #define XENFEAT_ARM_SMCCC_supported       14
>  
> +/*
> + * x86/PVH: If set, ACPI RSDP can be placed at any address. Otherwise RSDP
> + * must be located in lower 1MB, as required by ACPI Specification for IA-PC
> + * systems.
> + * This feature flag is only consulted for Linux guests.
> + */
> +#define XENFEAT_rsdp_unrestricted         15
> +

It seems that this flag will remain linux only forever? If so, why not
add _linux_ to the name to make it clear?

(I don't normally bikeshed names, but this is public interface which
could use a bit of bikeshedding)

Wei.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/PVH/libxl: Check whether Linux guest can handle RSDP at 4G boundary
  2018-04-07 23:03 [PATCH] x86/PVH/libxl: Check whether Linux guest can handle RSDP at 4G boundary Boris Ostrovsky
                   ` (2 preceding siblings ...)
  2018-04-09  9:20 ` Wei Liu
@ 2018-04-09 10:03 ` George Dunlap
  3 siblings, 0 replies; 5+ messages in thread
From: George Dunlap @ 2018-04-09 10:03 UTC (permalink / raw)
  To: Boris Ostrovsky, xen-devel
  Cc: jgross, sstabellini, wei.liu2, George.Dunlap, andrew.cooper3,
	ian.jackson, tim, julien.grall, jbeulich

On 04/08/2018 12:03 AM, Boris Ostrovsky wrote:
> Commit 4a5733771e6f ("libxl: put RSDP for PVH guest near 4GB") breaks
> pre-4.17 Linux guests since they do not use start_info's rsdp_paddr
> pointer and instread scan BIOS memory for RSDP signature.
> 
> Introduce XENFEAT_rsdp_unrestricted feature flag that indicates whether
> the guest can handle RSDP at locations pointed to by rsdp_paddr.
> 
> Since only Linux PVH guests suffer from this problem (BSD has always
> relied on rsdp_paddr) we check this flag just for those guests. If the
> flag is not set we place RSDP in BIOS, as before.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Thanks guys:

Acked-by: George Dunlap <george.dunlap@citrix.com>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-09 10:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-07 23:03 [PATCH] x86/PVH/libxl: Check whether Linux guest can handle RSDP at 4G boundary Boris Ostrovsky
2018-04-09  7:06 ` Juergen Gross
2018-04-09  9:06 ` Roger Pau Monné
2018-04-09  9:20 ` Wei Liu
2018-04-09 10:03 ` George Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.