]> git.proxmox.com Git - pve-edk2-firmware.git/blob - debian/patches/0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
93f46adee387e8177ccbffbcbbaf55f43deb0602
[pve-edk2-firmware.git] / debian / patches / 0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
1 From 89a12f2a42b989e7925b4a71e503209971eaa271 Mon Sep 17 00:00:00 2001
2 From: Gerd Hoffmann <kraxel@redhat.com>
3 Date: Thu, 1 Jun 2023 09:57:31 +0200
4 Subject: [PATCH] OvmfPkg/PlatformInitLib: limit phys-bits to 46.
5
6 Older linux kernels have problems with phys-bits larger than 46,
7 ubuntu 18.04 (kernel 4.15) has been reported to be affected.
8
9 Reduce phys-bits limit from 47 to 46.
10
11 Reported-by: Fiona Ebner <f.ebner@proxmox.com>
12 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 ---
14 OvmfPkg/Library/PlatformInitLib/MemDetect.c | 9 ++++++---
15 1 file changed, 6 insertions(+), 3 deletions(-)
16
17 diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
18 index 38cece9173..4d0522ce22 100644
19 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
20 +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
21 @@ -657,16 +657,19 @@ PlatformAddressWidthFromCpuid (
22 ));
23
24 if (Valid) {
25 - if (PhysBits > 47) {
26 + if (PhysBits > 46) {
27 /*
28 * Avoid 5-level paging altogether for now, which limits
29 * PhysBits to 48. Also avoid using address bit 48, due to sign
30 * extension we can't identity-map these addresses (and lots of
31 * places in edk2 assume we have everything identity-mapped).
32 * So the actual limit is 47.
33 + *
34 + * Also some older linux kernels apparently have problems handling
35 + * phys-bits > 46 correctly, so use that as limit.
36 */
37 - DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 47 (avoid 5-level paging)\n", __func__));
38 - PhysBits = 47;
39 + DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 46 (avoid 5-level paging)\n", __func__));
40 + PhysBits = 46;
41 }
42
43 if (!Page1GSupport && (PhysBits > 40)) {
44 --
45 2.39.2
46