I Copied the wrong commit message when I pushed the change (yes, I commit the patch manually...). I updated the commit message in subversion. People should I get the expected commit message:
ArmVirtualizationPkg: Xen: shuffle init order to deal with incoherency In order to prevent memory corruption issues caused by the fact that, under virtualization, the guest is incoherent with the hypervisor's view of memory until it enables its caches and MMU, this patch reshuffles the init sequence so that the Xen shared memory regions are not touched before the caches and MMU are enabled. In addition, the loaded image itself is invalidated by virtual address, to ensure that any runtime changes (such as the applied relocations) will not suddenly become invisible once we turn the caches on. Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-By: Olivier Martin <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: 14 April 2015 12:57 To: [email protected] Subject: edk2[17178] ArmPkg: remove cache maintenance by VA operation range size threshold Revision: 17178 http://sourceforge.net/p/edk2/code/17178 Author: oliviermartin Date: 2015-04-14 11:56:56 +0000 (Tue, 14 Apr 2015) Log Message: ----------- ArmPkg: remove cache maintenance by VA operation range size threshold This removes the range size threshold for virtual address based cache maintenance instructions that operate on VA ranges to be 'promoted' to use set/way instructions. Doing so is unsafe: set/way operations are fundamentally different from VA operations, and really only suitable for cleaning or invalidating a cache when turning it on or off. To quote the ARM ARM (DDI0487A_d G3.4): """ Since the set/way instructions are performed only locally, there is no guarantee of the atomicity of cache maintenance between different PEs, even if those different PEs are each performing the same cache maintenance instructions at the same time. Since any cacheable line can be allocated into the cache at any time, it is possible for [a] cache line to migrate from an entry in the cache of one PE to the cache of a different PE in a manner that the cache line avoids being affected by set/way based cache maintenance. Therefore, ARM strongly discourages the use of set/way instructions to manage coherency in coherent systems. """ Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Olivier Martin <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Modified Paths: -------------- trunk/edk2/ArmPlatformPkg/ArmVirtualizationPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf trunk/edk2/ArmPlatformPkg/ArmVirtualizationPkg/PrePi/PrePi.c Modified: trunk/edk2/ArmPlatformPkg/ArmVirtualizationPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf =================================================================== --- trunk/edk2/ArmPlatformPkg/ArmVirtualizationPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf 2015-04-14 11:55:42 UTC (rev 17177) +++ trunk/edk2/ArmPlatformPkg/ArmVirtualizationPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf 2015-04-14 11:56:56 UTC (rev 17178) @@ -55,6 +55,7 @@ PrePiHobListPointerLib PlatformPeiLib MemoryInitPeiLib + CacheMaintenanceLib [Ppis] gArmMpCoreInfoPpiGuid Modified: trunk/edk2/ArmPlatformPkg/ArmVirtualizationPkg/PrePi/PrePi.c =================================================================== --- trunk/edk2/ArmPlatformPkg/ArmVirtualizationPkg/PrePi/PrePi.c 2015-04-14 11:55:42 UTC (rev 17177) +++ trunk/edk2/ArmPlatformPkg/ArmVirtualizationPkg/PrePi/PrePi.c 2015-04-14 11:56:56 UTC (rev 17178) @@ -20,6 +20,7 @@ #include <Library/PrePiHobListPointerLib.h> #include <Library/TimerLib.h> #include <Library/PerformanceLib.h> +#include <Library/CacheMaintenanceLib.h> #include <Ppi/GuidedSectionExtraction.h> #include <Ppi/ArmMpCoreInfo.h> @@ -102,12 +103,6 @@ // Initialize the architecture specific bits ArchInitialize (); - // Initialize the Serial Port - SerialPortInitialize (); - CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (version %s built at %a on %a)\n\r", - (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__); - SerialPortWrite ((UINT8 *) Buffer, CharCount); - // Declare the PI/UEFI memory region HobList = HobConstructor ( (VOID*)UefiMemoryBase, @@ -117,10 +112,23 @@ ); PrePeiSetHobList (HobList); + // + // Ensure that the loaded image is invalidated in the caches, so that + any // modifications we made with the caches and MMU off (such as the + applied // relocations) don't become invisible once we turn them on. + // + InvalidateDataCacheRange((VOID *)(UINTN)PcdGet64 (PcdFdBaseAddress), + PcdGet32 (PcdFdSize)); + // Initialize MMU and Memory HOBs (Resource Descriptor HOBs) Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize)); ASSERT_EFI_ERROR (Status); + // Initialize the Serial Port + SerialPortInitialize (); + CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (version %s built at %a on %a)\n\r", + (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + // Create the Stacks HOB (reserve the memory for all stacks) StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize); BuildStackHob (StacksBase, StacksSize); ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ edk2-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-commits -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590 ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782 ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ edk2-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-commits
