From 57d8f2d21104dceb298aec48651c65fccc18afa0 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 22 Jun 2023 09:49:28 +0200 Subject: [PATCH] disable EFI_MEMORY_ATTRIBUTE_PROTO (workaround shim bug) --- ...o-disable-EFI_MEMORY_ATTRIBUTE_PROTO.patch | 77 +++++++++++++++++++ edk2.spec | 2 +- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 0028-ArmPkg-Add-Pcd-to-disable-EFI_MEMORY_ATTRIBUTE_PROTO.patch diff --git a/0028-ArmPkg-Add-Pcd-to-disable-EFI_MEMORY_ATTRIBUTE_PROTO.patch b/0028-ArmPkg-Add-Pcd-to-disable-EFI_MEMORY_ATTRIBUTE_PROTO.patch new file mode 100644 index 0000000..38c46eb --- /dev/null +++ b/0028-ArmPkg-Add-Pcd-to-disable-EFI_MEMORY_ATTRIBUTE_PROTO.patch @@ -0,0 +1,77 @@ +From 40efdacf7f4f378c0acf95a73d1dcc5e200d42d8 Mon Sep 17 00:00:00 2001 +From: Oliver Steffen +Date: Mon, 19 Jun 2023 22:32:25 +0200 +Subject: [PATCH 28/28] ArmPkg: Add Pcd to disable + EFI_MEMORY_ATTRIBUTE_PROTOCOL + +Recent versions of shim (15.6 and 15.7) crash when the newly added +EFI_MEMORY_ATTRIBUTE_PROTOCOL is provided by the firmware. To allow +existing installations to boot, provide a workaround in form of a Pcd +that allows tuning it off at build time (defaults to 'enabled'). + +Additionally, check the return code of the protocol installation calls. + +Signed-off-by: Oliver Steffen +Message-ID: <20230619203244.228933-1-osteffen@redhat.com> +Signed-off-by: Gerd Hoffmann +--- + ArmPkg/ArmPkg.dec | 3 +++ + ArmPkg/Drivers/CpuDxe/CpuDxe.inf | 1 + + ArmPkg/Drivers/CpuDxe/CpuDxe.c | 13 +++++++++++-- + 3 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec +index 2444457ae58a..625e45c3e0c0 100644 +--- a/ArmPkg/ArmPkg.dec ++++ b/ArmPkg/ArmPkg.dec +@@ -167,6 +167,9 @@ [PcdsFixedAtBuild.common] + gArmTokenSpaceGuid.PcdCpuVectorBaseAddress|0xffff0000|UINT64|0x00000004 + gArmTokenSpaceGuid.PcdCpuResetAddress|0x00000000|UINT32|0x00000005 + ++ # Enable/Disable EFI_MEMORY_ATTRIBUTE_PROTOCOL ++ gArmTokenSpaceGuid.PcdEnableEfiMemoryAttributeProtocol|FALSE|BOOLEAN|0x000000EE ++ + # + # ARM Secure Firmware PCDs + # +diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.inf b/ArmPkg/Drivers/CpuDxe/CpuDxe.inf +index e732e21cb94a..1bad4ae160af 100644 +--- a/ArmPkg/Drivers/CpuDxe/CpuDxe.inf ++++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.inf +@@ -64,6 +64,7 @@ [Guids] + + [Pcd.common] + gArmTokenSpaceGuid.PcdVFPEnabled ++ gArmTokenSpaceGuid.PcdEnableEfiMemoryAttributeProtocol + + [FeaturePcd.common] + gArmTokenSpaceGuid.PcdDebuggerExceptionSupport +diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.c b/ArmPkg/Drivers/CpuDxe/CpuDxe.c +index d04958e79e52..ff7d735b2bde 100644 +--- a/ArmPkg/Drivers/CpuDxe/CpuDxe.c ++++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.c +@@ -244,10 +244,19 @@ CpuDxeInitialize ( + &mCpuHandle, + &gEfiCpuArchProtocolGuid, + &mCpu, +- &gEfiMemoryAttributeProtocolGuid, +- &mMemoryAttribute, + NULL + ); ++ ASSERT_EFI_ERROR (Status); ++ ++ if (PcdGetBool (PcdEnableEfiMemoryAttributeProtocol)) { ++ Status = gBS->InstallMultipleProtocolInterfaces ( ++ &mCpuHandle, ++ &gEfiMemoryAttributeProtocolGuid, ++ &mMemoryAttribute, ++ NULL ++ ); ++ ASSERT_EFI_ERROR (Status); ++ } + + // + // Make sure GCD and MMU settings match. This API calls gDS->SetMemorySpaceAttributes () +-- +2.41.0 + diff --git a/edk2.spec b/edk2.spec index 04694cc..fca100a 100644 --- a/edk2.spec +++ b/edk2.spec @@ -99,7 +99,6 @@ Patch0010: 0010-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch Patch0011: 0011-CryptoPkg-OpensslLib-list-RHEL8-specific-OpenSSL-fil.patch Patch0012: 0012-OvmfPkg-QemuKernelLoaderFsDxe-suppress-error-on-no-k.patch Patch0013: 0013-SecurityPkg-Tcg2Dxe-suppress-error-on-no-swtpm-in-si.patch - Patch0015: 0015-OvmfPkg-PlatformPei-drop-S3Verification.patch Patch0016: 0016-OvmfPkg-PciHotPlugInitDxe-Do-not-reserve-IO-ports-by.patch Patch0017: 0017-OvmfPkg-PlatformInitLib-check-PcdUse1GPageTable.patch @@ -113,6 +112,7 @@ Patch0024: 0024-ArmVirt-PlatformBootManagerLib-factor-out-IsVirtio.patch Patch0025: 0025-ArmVirt-PlatformBootManagerLib-factor-out-IsVirtioPc.patch Patch0026: 0026-ArmVirt-PlatformBootManagerLib-set-up-virtio-serial-.patch Patch0027: 0027-UefiCpuPkg-MpInitLib-fix-apic-mode-for-cpu-hotplug.patch +Patch0028: 0028-ArmPkg-Add-Pcd-to-disable-EFI_MEMORY_ATTRIBUTE_PROTO.patch # python3-devel and libuuid-devel are required for building tools.