]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg/ArmVirtQemu: use non-accelerated CopyMem for VariableRuntimeDxe
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 14 Nov 2017 10:13:03 +0000 (10:13 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 16 Nov 2017 09:38:12 +0000 (09:38 +0000)
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 <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Shannon Zhao <zhaoshenglong@huawei.com>
ArmVirtPkg/ArmVirtQemu.dsc
ArmVirtPkg/ArmVirtQemuKernel.dsc

index 8a60b61f2aa63199c68e36c5a803ac131992ac55..7b220d6e3c31b8f3a415e79e03f159e0ee0598e5 100644 (file)
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {\r
     <LibraryClasses>\r
       NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf\r
+      # don't use unaligned CopyMem () on the UEFI varstore NOR flash region\r
+      BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf\r
   }\r
 !if $(SECURE_BOOT_ENABLE) == TRUE\r
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {\r
index 9a31ec93ca0644b734d4a3135cb67534f7ccfbe1..7c032e1b07e0fc4a188e6b174ef6c45bc3136482 100644 (file)
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {\r
     <LibraryClasses>\r
       NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf\r
+      # don't use unaligned CopyMem () on the UEFI varstore NOR flash region\r
+      BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf\r
   }\r
 !if $(SECURE_BOOT_ENABLE) == TRUE\r
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {\r