diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc b/ArmVirtPkg/ArmVirtCloudHv.dsc index 5cb2a609b1..d5055a0341 100644 --- a/ArmVirtPkg/ArmVirtCloudHv.dsc +++ b/ArmVirtPkg/ArmVirtCloudHv.dsc @@ -201,6 +201,9 @@ [PcdsDynamicHii] gUefiOvmfPkgTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gOvmfVariableGuid|0x0|FALSE|NV,BS +[PcdsPatchableInModule.common] + gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 4498ca58a8..80dd4fbb14 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -293,6 +293,10 @@ gEfiNetworkPkgTokenSpaceGuid.PcdIPv4PXESupport|0x01 gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01 + # whether to use HVC or SMC to issue monitor calls - this typically depends + # on the exception level at which the UEFI system firmware executes + gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE + # # TPM2 support # diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc index 94f48593c2..2700b97d09 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -203,6 +203,8 @@ gArmTokenSpaceGuid.PcdFdBaseAddress|0x0 gArmTokenSpaceGuid.PcdFvBaseAddress|0x0 + gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE + [PcdsDynamicDefault.common] gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3 diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc index 5809832e66..ceb37f8a2d 100644 --- a/ArmVirtPkg/ArmVirtXen.dsc +++ b/ArmVirtPkg/ArmVirtXen.dsc @@ -120,6 +120,8 @@ gArmTokenSpaceGuid.PcdFdBaseAddress|0x0 gArmTokenSpaceGuid.PcdFvBaseAddress|0x0 + gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE + [PcdsDynamicDefault.common] gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0 diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c index 7ab4aa2d6b..b8e9208301 100644 --- a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c +++ b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c @@ -18,6 +18,8 @@ #include #include +#include + #include #include @@ -224,5 +226,17 @@ PlatformPeim ( BuildFvHob (PcdGet64 (PcdFvBaseAddress), PcdGet32 (PcdFvSize)); + #ifdef MDE_CPU_AARCH64 + // + // Set the SMCCC conduit to SMC if executing at EL2, which is typically the + // exception level that services HVCs rather than the one that invokes them. + // + if (ArmReadCurrentEL () == AARCH64_EL2) { + Status = PcdSetBoolS (PcdMonitorConduitHvc, FALSE); + ASSERT_EFI_ERROR (Status); + } + + #endif + return EFI_SUCCESS; } diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf index e9a34b6e2e..a38b89c103 100644 --- a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf +++ b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf @@ -45,6 +45,7 @@ [Pcd] gArmTokenSpaceGuid.PcdFvBaseAddress + gArmTokenSpaceGuid.PcdMonitorConduitHvc gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress ## SOMETIMES_PRODUCES gUefiOvmfPkgTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress