From 44d71c217ccbd87e8c42768b4e84b1c899d779e2 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Tue, 14 Nov 2017 10:13:03 +0000 Subject: ArmVirtPkg/ArmVirtQemu: use non-accelerated CopyMem for VariableRuntimeDxe The VariableRuntimeDxe driver may use CopyMem () on NOR flash regions, assuming such regions always have full memory semantics. Given that those regions cannot be mapped as ordinary memory on ARM (due to the fact that the NOR flash requires device semantics while in write mode) this prevents us from using BaseMemoryLibOptDxe in VariableRuntimeDxe, since it may use unaligned accesses and/or DC ZVA instructions, both of which are incompatible with mappings using device semantics. Note that there is no way we can work around this by changing the mapping type between 'memory' and 'device' when switching from read to write mode and back, because the runtime mapping is created by the OS, and cannot be changed at will. So let's just switch to the unaccelerated version of BaseMemoryLib which does not have the same problem. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek Tested-by: Shannon Zhao --- ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ArmVirtPkg/ArmVirtQemuKernel.dsc') diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc index 9a31ec93ca..7c032e1b07 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -252,6 +252,8 @@ MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + # don't use unaligned CopyMem () on the UEFI varstore NOR flash region + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf } !if $(SECURE_BOOT_ENABLE) == TRUE MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { -- cgit v1.2.3