From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.26109.1685607241671398845 for ; Thu, 01 Jun 2023 01:14:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EDyafWDU; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2903C63CD3 for ; Thu, 1 Jun 2023 08:14:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EB20C433D2 for ; Thu, 1 Jun 2023 08:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685607240; bh=uAX+0tbCaJvI/XiIFKNj20NfmzS1OyzJfzvqhvyHBjU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=EDyafWDUReVVEdCLg1XJuGgA6a7er+zkJTAjrniTSX6ycIXGuG0f3fZUoxNSb6o/T HtGTFxNn9sgD7IONE8MoYMuIQh3KJa/yhoWO/OHqKUc5HuaUBAT4KDLptYx7BDif5L iE/XDEQ0VnuShjOFptj5Goo4qsoMKb/rMxhubIa/3x38IN9LV9QzWscaj+3yOEA4ED T5hNcfaOFa4/vGcZ6uDsbaPZl1r9RhR9B2Sd753y6dNEQkJDCnfKRFLBiz18JJVOvz 8ShwHWH1jv0+yj7j1J28jGiWtDQa3vzcDGesDuWrWvQv3ON9CoLzIJkBtGD7ax7njG r6a8y4VV6NOFA== Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2af2b74d258so6901371fa.3 for ; Thu, 01 Jun 2023 01:14:00 -0700 (PDT) X-Gm-Message-State: AC+VfDzd1GQd4DMT+H+CyLmxwI5wlqOb45JOZTSq6jSFZXdkP4DYPYnN stypXHU2KAUuHJAw80JmVrPRszhCKThR9kvWbPU= X-Google-Smtp-Source: ACHHUZ7xw6/edvdywvKwcx55amzZggqGSwKfGjK0OilmLhglhRjey4JO3zRQQn6c0ccci66qVr1rVhnB60hURHVdNJM= X-Received: by 2002:a2e:9c83:0:b0:2a8:eae2:d55c with SMTP id x3-20020a2e9c83000000b002a8eae2d55cmr4101176lji.15.1685607238645; Thu, 01 Jun 2023 01:13:58 -0700 (PDT) MIME-Version: 1.0 References: <20230601075731.531384-1-kraxel@redhat.com> In-Reply-To: <20230601075731.531384-1-kraxel@redhat.com> From: "Ard Biesheuvel" Date: Thu, 1 Jun 2023 10:13:47 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/1] OvmfPkg/PlatformInitLib: limit phys-bits to 46. To: Gerd Hoffmann Cc: devel@edk2.groups.io, Jordan Justen , Oliver Steffen , Pawel Polawski , Ard Biesheuvel , Jiewen Yao , Fiona Ebner Content-Type: text/plain; charset="UTF-8" On Thu, 1 Jun 2023 at 09:57, Gerd Hoffmann 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 > Signed-off-by: Gerd Hoffmann 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 >