[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] xen/arm: pmap: Add missing ISB in arch_pmap_map()



commit feaa9aca87fd84226a023c02bf29a40081f24c4c
Author:     Julien Grall <jgrall@xxxxxxxxxx>
AuthorDate: Tue Jul 4 20:05:02 2023 +0100
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Tue Jul 4 20:07:47 2023 +0100

    xen/arm: pmap: Add missing ISB in arch_pmap_map()
    
    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@xxxxxxxxxx>
    Reviewed-by: Henry Wang <Henry.Wang@xxxxxxx>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
 xen/arch/arm/include/asm/pmap.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/arm/include/asm/pmap.h b/xen/arch/arm/include/asm/pmap.h
index e094d13dd2..bca3381796 100644
--- a/xen/arch/arm/include/asm/pmap.h
+++ b/xen/arch/arm/include/asm/pmap.h
@@ -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)
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.