public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] OvmfPkg/PlatformInitLib: limit phys-bits to 46.
@ 2023-06-01  7:57 Gerd Hoffmann
  2023-06-01  8:13 ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2023-06-01  7:57 UTC (permalink / raw)
  To: devel
  Cc: Gerd Hoffmann, Jordan Justen, Oliver Steffen, Pawel Polawski,
	Ard Biesheuvel, Jiewen Yao, Fiona Ebner

Older linux kernels have problems with phys-bits larger than 46,
ubuntu 18.04 (kernel 4.15) has been reported to be affected.

Reduce phys-bits limit from 47 to 46.

Reported-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/Library/PlatformInitLib/MemDetect.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index 1102b00ecbf0..662e7e85bbc5 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -646,16 +646,19 @@ PlatformAddressWidthFromCpuid (
     ));
 
   if (Valid) {
-    if (PhysBits > 47) {
+    if (PhysBits > 46) {
       /*
        * Avoid 5-level paging altogether for now, which limits
        * PhysBits to 48.  Also avoid using address bit 48, due to sign
        * extension we can't identity-map these addresses (and lots of
        * places in edk2 assume we have everything identity-mapped).
        * So the actual limit is 47.
+       *
+       * Also some older linux kernels apparently have problems handling
+       * phys-bits > 46 correctly, so use that as limit.
        */
-      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 47 (avoid 5-level paging)\n", __func__));
-      PhysBits = 47;
+      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 46 (avoid 5-level paging)\n", __func__));
+      PhysBits = 46;
     }
 
     if (!Page1GSupport && (PhysBits > 40)) {
-- 
2.40.1


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

* Re: [PATCH 1/1] OvmfPkg/PlatformInitLib: limit phys-bits to 46.
  2023-06-01  7:57 [PATCH 1/1] OvmfPkg/PlatformInitLib: limit phys-bits to 46 Gerd Hoffmann
@ 2023-06-01  8:13 ` Ard Biesheuvel
  2023-06-01  9:07   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2023-06-01  8:13 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: devel, Jordan Justen, Oliver Steffen, Pawel Polawski,
	Ard Biesheuvel, Jiewen Yao, Fiona Ebner

On Thu, 1 Jun 2023 at 09:57, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> Older linux kernels have problems with phys-bits larger than 46,
> ubuntu 18.04 (kernel 4.15) has been reported to be affected.
>
> Reduce phys-bits limit from 47 to 46.
>
> Reported-by: Fiona Ebner <f.ebner@proxmox.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Thanks I'll queue this up

> ---
>  OvmfPkg/Library/PlatformInitLib/MemDetect.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> index 1102b00ecbf0..662e7e85bbc5 100644
> --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> @@ -646,16 +646,19 @@ PlatformAddressWidthFromCpuid (
>      ));
>
>    if (Valid) {
> -    if (PhysBits > 47) {
> +    if (PhysBits > 46) {
>        /*
>         * Avoid 5-level paging altogether for now, which limits
>         * PhysBits to 48.  Also avoid using address bit 48, due to sign
>         * extension we can't identity-map these addresses (and lots of
>         * places in edk2 assume we have everything identity-mapped).
>         * So the actual limit is 47.
> +       *
> +       * Also some older linux kernels apparently have problems handling
> +       * phys-bits > 46 correctly, so use that as limit.
>         */
> -      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 47 (avoid 5-level paging)\n", __func__));
> -      PhysBits = 47;
> +      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 46 (avoid 5-level paging)\n", __func__));
> +      PhysBits = 46;
>      }
>
>      if (!Page1GSupport && (PhysBits > 40)) {
> --
> 2.40.1
>

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

* Re: [PATCH 1/1] OvmfPkg/PlatformInitLib: limit phys-bits to 46.
  2023-06-01  8:13 ` Ard Biesheuvel
@ 2023-06-01  9:07   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2023-06-01  9:07 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: devel, Jordan Justen, Oliver Steffen, Pawel Polawski,
	Ard Biesheuvel, Jiewen Yao, Fiona Ebner

On Thu, 1 Jun 2023 at 10:13, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Thu, 1 Jun 2023 at 09:57, Gerd Hoffmann <kraxel@redhat.com> wrote:
> >
> > Older linux kernels have problems with phys-bits larger than 46,
> > ubuntu 18.04 (kernel 4.15) has been reported to be affected.
> >
> > Reduce phys-bits limit from 47 to 46.
> >
> > Reported-by: Fiona Ebner <f.ebner@proxmox.com>
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>
> Thanks I'll queue this up
>

Merged as #4461

> > ---
> >  OvmfPkg/Library/PlatformInitLib/MemDetect.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> > index 1102b00ecbf0..662e7e85bbc5 100644
> > --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> > +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> > @@ -646,16 +646,19 @@ PlatformAddressWidthFromCpuid (
> >      ));
> >
> >    if (Valid) {
> > -    if (PhysBits > 47) {
> > +    if (PhysBits > 46) {
> >        /*
> >         * Avoid 5-level paging altogether for now, which limits
> >         * PhysBits to 48.  Also avoid using address bit 48, due to sign
> >         * extension we can't identity-map these addresses (and lots of
> >         * places in edk2 assume we have everything identity-mapped).
> >         * So the actual limit is 47.
> > +       *
> > +       * Also some older linux kernels apparently have problems handling
> > +       * phys-bits > 46 correctly, so use that as limit.
> >         */
> > -      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 47 (avoid 5-level paging)\n", __func__));
> > -      PhysBits = 47;
> > +      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 46 (avoid 5-level paging)\n", __func__));
> > +      PhysBits = 46;
> >      }
> >
> >      if (!Page1GSupport && (PhysBits > 40)) {
> > --
> > 2.40.1
> >

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

end of thread, other threads:[~2023-06-01  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-01  7:57 [PATCH 1/1] OvmfPkg/PlatformInitLib: limit phys-bits to 46 Gerd Hoffmann
2023-06-01  8:13 ` Ard Biesheuvel
2023-06-01  9:07   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox