backport two arm fixes
This commit is contained in:
parent
abc39863de
commit
1f297e7eca
@ -0,0 +1,61 @@
|
||||
From c5c9385ffa28b9989a53c3a51ce3f8b4ef40aa41 Mon Sep 17 00:00:00 2001
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Wed, 11 Jan 2023 19:00:23 +0100
|
||||
Subject: [PATCH 32/34] OvmfPkg/VirtNorFlashDxe: map flash memory as
|
||||
uncacheable
|
||||
|
||||
Switching from the ArmPlatformPkg/NorFlashDxe driver to the
|
||||
OvmfPkg/VirtNorFlashDxe driver had the side effect that flash address
|
||||
space got registered as EFI_MEMORY_WC instead of EFI_MEMORY_UC.
|
||||
|
||||
That confuses the linux kernel's numa code, seems this makes kernel
|
||||
consider the flash being node memory. "lsmem" changes from ...
|
||||
|
||||
RANGE SIZE STATE REMOVABLE BLOCK
|
||||
0x0000000040000000-0x000000013fffffff 4G online yes 8-39
|
||||
|
||||
... to ...
|
||||
|
||||
RANGE SIZE STATE REMOVABLE BLOCK
|
||||
0x0000000000000000-0x0000000007ffffff 128M online yes 0
|
||||
0x0000000040000000-0x000000013fffffff 4G online yes 8-39
|
||||
|
||||
... and in the kernel log got new error lines:
|
||||
|
||||
NUMA: Warning: invalid memblk node 512 [mem 0x0000000004000000-0x0000000007ffffff]
|
||||
NUMA: Faking a node at [mem 0x0000000004000000-0x000000013fffffff]
|
||||
|
||||
Changing the attributes back to EFI_MEMORY_UC fixes this.
|
||||
|
||||
Fixes: b92298af8218 ("ArmVirtPkg/ArmVirtQemu: migrate to OVMF's VirtNorFlashDxe")
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
|
||||
(cherry picked from commit e5ec3ba409b5baa9cf429cc25fdf3c8d1b8dcef0)
|
||||
---
|
||||
OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
|
||||
index ff3121af2a40..f9a41f6aab0f 100644
|
||||
--- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
|
||||
+++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
|
||||
@@ -394,14 +394,14 @@ NorFlashFvbInitialize (
|
||||
EfiGcdMemoryTypeMemoryMappedIo,
|
||||
Instance->DeviceBaseAddress,
|
||||
RuntimeMmioRegionSize,
|
||||
- EFI_MEMORY_WC | EFI_MEMORY_RUNTIME
|
||||
+ EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = gDS->SetMemorySpaceAttributes (
|
||||
Instance->DeviceBaseAddress,
|
||||
RuntimeMmioRegionSize,
|
||||
- EFI_MEMORY_WC | EFI_MEMORY_RUNTIME
|
||||
+ EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
--
|
||||
2.39.0
|
||||
|
@ -0,0 +1,82 @@
|
||||
From 4cab22343b32fec515813584a2620d6dafe0b1c2 Mon Sep 17 00:00:00 2001
|
||||
From: Ard Biesheuvel <ardb@kernel.org>
|
||||
Date: Wed, 4 Jan 2023 16:51:35 +0100
|
||||
Subject: [PATCH 33/34] ArmVirtPkg/ArmVirtQemu: Avoid early ID map on ThunderX
|
||||
|
||||
The early ID map used by ArmVirtQemu uses ASID scoped non-global
|
||||
mappings, as this allows us to switch to the permanent ID map seamlessly
|
||||
without the need for explicit TLB maintenance.
|
||||
|
||||
However, this triggers a known erratum on ThunderX, which does not
|
||||
tolerate non-global mappings that are executable at EL1, as this appears
|
||||
to result in I-cache corruption. (Linux disables the KPTI based Meltdown
|
||||
mitigation on ThunderX for the same reason)
|
||||
|
||||
So work around this, by detecting the CPU implementor and part number,
|
||||
and proceeding without the early ID map if a ThunderX CPU is detected.
|
||||
|
||||
Note that this requires the C code to be built with strict alignment
|
||||
again, as we may end up executing it with the MMU and caches off.
|
||||
|
||||
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
|
||||
Acked-by: Laszlo Ersek <lersek@redhat.com>
|
||||
Tested-by: dann frazier <dann.frazier@canonical.com>
|
||||
(cherry picked from commit ec54ce1f1ab41b92782b37ae59e752fff0ef9c41)
|
||||
---
|
||||
ArmVirtPkg/ArmVirtQemu.dsc | 5 +++++
|
||||
.../AArch64/ArmPlatformHelper.S | 15 +++++++++++++++
|
||||
2 files changed, 20 insertions(+)
|
||||
|
||||
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
|
||||
index a3d744931a15..6b4dc213a7f7 100644
|
||||
--- a/ArmVirtPkg/ArmVirtQemu.dsc
|
||||
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
|
||||
@@ -31,6 +31,7 @@ [Defines]
|
||||
DEFINE SECURE_BOOT_ENABLE = FALSE
|
||||
DEFINE TPM2_ENABLE = FALSE
|
||||
DEFINE TPM2_CONFIG_ENABLE = FALSE
|
||||
+ DEFINE CAVIUM_ERRATUM_27456 = FALSE
|
||||
|
||||
#
|
||||
# Network definition
|
||||
@@ -117,7 +118,11 @@ [LibraryClasses.common.UEFI_DRIVER]
|
||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||
|
||||
[BuildOptions]
|
||||
+!if $(CAVIUM_ERRATUM_27456) == TRUE
|
||||
+ GCC:*_*_AARCH64_PP_FLAGS = -DCAVIUM_ERRATUM_27456
|
||||
+!else
|
||||
GCC:*_*_AARCH64_CC_XIPFLAGS ==
|
||||
+!endif
|
||||
|
||||
!include NetworkPkg/NetworkBuildOptions.dsc.inc
|
||||
|
||||
diff --git a/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S b/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S
|
||||
index 05ccc7f9f043..1c0022c1efd9 100644
|
||||
--- a/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S
|
||||
+++ b/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S
|
||||
@@ -44,6 +44,21 @@
|
||||
|
||||
|
||||
ASM_FUNC(ArmPlatformPeiBootAction)
|
||||
+#ifdef CAVIUM_ERRATUM_27456
|
||||
+ /*
|
||||
+ * On Cavium ThunderX, using non-global mappings that are executable at EL1
|
||||
+ * results in I-cache corruption. So just avoid the early ID mapping there.
|
||||
+ *
|
||||
+ * MIDR implementor 0x43
|
||||
+ * MIDR part numbers 0xA1 0xA2 (but not 0xAF)
|
||||
+ */
|
||||
+ mrs x0, midr_el1 // read the MIDR into X0
|
||||
+ ubfx x1, x0, #24, #8 // grab implementor id
|
||||
+ ubfx x0, x0, #7, #9 // grab part number bits [11:3]
|
||||
+ cmp x1, #0x43 // compare implementor id
|
||||
+ ccmp x0, #0xA0 >> 3, #0, eq // compare part# bits [11:3]
|
||||
+ b.eq 0f
|
||||
+#endif
|
||||
mrs x0, CurrentEL // check current exception level
|
||||
tbz x0, #3, 0f // bail if above EL1
|
||||
ret
|
||||
--
|
||||
2.39.0
|
||||
|
@ -104,6 +104,8 @@ Patch0028: 0028-OvmfPkg-PlatformPei-remove-mFeatureControlValue.patch
|
||||
Patch0029: 0029-OvmfPkg-DebugLibIoPort-use-Rom-version-for-PEI.patch
|
||||
Patch0030: 0030-OvmfPkg-QemuFwCfgLib-rewrite-fw_cfg-probe.patch
|
||||
Patch0031: 0031-OvmfPkg-QemuFwCfgLib-remove-mQemuFwCfgSupported-mQem.patch
|
||||
Patch0032: 0032-OvmfPkg-VirtNorFlashDxe-map-flash-memory-as-uncachea.patch
|
||||
Patch0033: 0033-ArmVirtPkg-ArmVirtQemu-Avoid-early-ID-map-on-Thunder.patch
|
||||
|
||||
|
||||
# python3-devel and libuuid-devel are required for building tools.
|
||||
|
Loading…
Reference in New Issue
Block a user