]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: pmap: Add missing ISB in arch_pmap_map()
authorJulien Grall <jgrall@amazon.com>
Tue, 4 Jul 2023 19:05:02 +0000 (20:05 +0100)
committerJulien Grall <jgrall@amazon.com>
Tue, 4 Jul 2023 19:07:47 +0000 (20:07 +0100)
Per the Arm Arm, (Armv7 DDI406C.d A3.8.3 and Armv8 DDI 0487J.a B2.3.12):

"The DMB and DSB memory barriers affect reads and writes to the memory
system generated by load/store instructions and data or unified cache
maintenance operations being executed by the processor. Instruction
fetches or accesses caused by a hardware translation table access are
not explicit accesses."

Note that second sentence is not part of the newer Armv8 spec. But the
interpretation is not much different.

As the entry created by arch_pmap_map() will be used soon after
pmap_map() returns, we want to ensure the DSB in write_pte() has
completed. So add an ISB.

Fixes: 4f17357b52f6 ("xen/arm: add Persistent Map (PMAP) infrastructure")
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Henry Wang <Henry.Wang@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
xen/arch/arm/include/asm/pmap.h

index e094d13dd282142bea6841de253e703206047796..bca3381796f3ce5469890f001b29dc0057300d54 100644 (file)
@@ -15,6 +15,11 @@ static inline void arch_pmap_map(unsigned int slot, mfn_t mfn)
     pte = mfn_to_xen_entry(mfn, PAGE_HYPERVISOR_RW);
     pte.pt.table = 1;
     write_pte(entry, pte);
+    /*
+     * The new entry will be used very soon after arch_pmap_map() returns.
+     * So ensure the DSB in write_pte() has completed before continuing.
+     */
+    isb();
 }
 
 static inline void arch_pmap_unmap(unsigned int slot)