Hello all, This series implements explicit cache maintenance for the QEMU/KVM and Xen build targets. This is necessary as, under virtualization, memory regions that are manipulated with the MMU and caches off may be shadowed by clean cachelines in system caches or lower level caches other CPUs.
Patch #1 removes the threshold that 'promotes' a cache maintenance by virtual address to a cache maintenance by set/way operation. The idea was presumably that, above a certain threshold, it is cheaper to just clean or invalidate the whole cache than to loop over a large memory range. However, set/way operations operate on the local caches only, and are not broadcast to other CPUs, nor do they affect system caches that are managed in an implementation specific way. So the only correct way to operate on a VA range is to loop over the VA range, unfortunately. Patch #2 adds invalidation of the PI/UEFI memory range to ArmVirtualizationPkg's implementation of MemoryInitPeiLib, and updates ArmVirtualizationQemu.dsc (the QEMU/KVM target) to switch to it. Also, for both QEMU/KVM and Xen, it reduces the size of this region to 16 MB (from 64 MB), which hopefully alleviates the perfomance hit a bit. Patch #3 adds invalidation of the FD region as well. Unlike under QEMU/KVM, where the FD region resides in emulated NOR flash, and is hence read-only, under Xen the FD region contains global variables, and is relocated at runtime. So here, we need to invalidate the FD region for the same reason we need to invalidate the PI/UEFI memory region. In addition, it moves the initialization of the SerialPortLib to after the MMU is up: this prevents problems with invoking hypercalls and/or accessing memory regions that are shared with the hypervisor, whose accesses to those regions go via the caches. This series supersedes all other patches related to caching and init order reshuffling that I sent over the past week. Ard Biesheuvel (3): ArmPkg: remove cache maintenance by VA operation range size threshold ArmVirtualizationPkg: invalidate PEI memory region by VA ArmVirtualizationPkg: Xen: shuffle init order to deal with incoherency ArmPkg/ArmPkg.dec | 3 +-- .../ArmCacheMaintenanceLib.c | 29 ++++++++-------------- .../ArmCacheMaintenanceLib.inf | 3 --- ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf | 3 --- ArmPkg/Library/ArmLib/AArch64/AArch64LibPrePi.inf | 3 --- ArmPkg/Library/ArmLib/AArch64/AArch64LibSec.inf | 3 --- ArmPkg/Library/ArmLib/Arm11/Arm11Lib.inf | 1 - ArmPkg/Library/ArmLib/Arm11/Arm11LibPrePi.inf | 1 - ArmPkg/Library/ArmLib/Arm11/Arm11LibSec.inf | 1 - ArmPkg/Library/ArmLib/Arm9/Arm9ArmLib.inf | 3 --- ArmPkg/Library/ArmLib/Arm9/Arm9ArmLibPrePi.inf | 3 --- ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf | 3 --- ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf | 3 --- ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf | 3 --- ArmPkg/Library/ArmLib/Null/NullArmLib.inf | 3 --- .../ArmVirtualizationPkg/ArmVirtualizationQemu.dsc | 6 +++-- .../ArmVirtualizationPkg/ArmVirtualizationXen.dsc | 4 +-- .../ArmVirtualizationMemoryInitPeiLib.c | 10 ++++++++ .../ArmVirtualizationMemoryInitPeiLib.inf | 1 + .../PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 1 + ArmPlatformPkg/ArmVirtualizationPkg/PrePi/PrePi.c | 20 ++++++++++----- 21 files changed, 44 insertions(+), 63 deletions(-) -- 1.8.3.2 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel