ArmPkg: Disabled UserSpace by default to fix CI,

as WinPE and Linux EFI stub can not boot in
EL2&0 translation regime.
This commit is contained in:
Mikhail Krichanov 2024-10-22 13:18:11 +03:00
parent a071d15784
commit 5fee574a51
4 changed files with 22 additions and 3 deletions

View File

@ -20,6 +20,8 @@
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
#include <Library/PcdLib.h>
#include "ArmMmuLibInternal.h"
STATIC ARM_REPLACE_LIVE_TRANSLATION_ENTRY mReplaceLiveEntryFunc = ArmReplaceLiveTranslationEntry;
@ -489,7 +491,9 @@ GcdAttributeToPageAttribute (
PageAttributes |= TT_AP_RW_RW;
}
} else {
PageAttributes |= TT_UXN_MASK;
if (PcdGetBool (PcdEnableUserSpace) || (ArmReadCurrentEL () == AARCH64_EL1)) {
PageAttributes |= TT_UXN_MASK;
}
if ((GcdAttributes & EFI_MEMORY_RO) != 0) {
PageAttributes |= TT_AP_NO_RO;
@ -624,7 +628,12 @@ ArmConfigureMmu (
T0SZ = 64 - MaxAddressBits;
RootTableEntryCount = GetRootTableEntryCount (T0SZ);
if (ArmReadCurrentEL () == AARCH64_EL2) {
//
// Set TCR that allows us to retrieve T0SZ in the subsequent functions
//
// Ideally we will be running at EL2, but should support EL1 as well.
// UEFI should not run at EL3.
if (PcdGetBool (PcdEnableUserSpace) && (ArmReadCurrentEL () == AARCH64_EL2)) {
//
// Switch to EL2&0 translation regime.
//

View File

@ -34,15 +34,20 @@
ArmPkg/ArmPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
ArmLib
CacheMaintenanceLib
HobLib
MemoryAllocationLib
PcdLib
[Guids]
gArmMmuReplaceLiveTranslationEntryFuncGuid
[Pcd.ARM]
gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableUserSpace ## CONSUMES

View File

@ -26,12 +26,17 @@
ArmPkg/ArmPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
ArmLib
CacheMaintenanceLib
HobLib
MemoryAllocationLib
PcdLib
[Guids]
gArmMmuReplaceLiveTranslationEntryFuncGuid
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableUserSpace ## CONSUMES

View File

@ -382,7 +382,7 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xC000000000007FD5
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|TRUE
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableUserSpace|TRUE
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableUserSpace|FALSE
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
[Components.common]