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

[Xen-changelog] [xen master] Arm/atomic: unify generation of u64 read/write functions



commit 9134c56eb3dc297773fb4a206ed0c3858f7f59a0
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Mar 14 16:39:14 2019 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Mar 14 16:39:14 2019 +0100

    Arm/atomic: unify generation of u64 read/write functions
    
    By adding another suitable abstracting macro the need for explicit
    inline function definitions in the 32-bit case goes away.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Julien Grall <julien.grall@xxxxxxx>
---
 xen/include/asm-arm/atomic.h | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/xen/include/asm-arm/atomic.h b/xen/include/asm-arm/atomic.h
index a1d77c18d9..0a136590fe 100644
--- a/xen/include/asm-arm/atomic.h
+++ b/xen/include/asm-arm/atomic.h
@@ -37,40 +37,27 @@ static inline void name(volatile type *addr, type val)      
            \
 #if defined (CONFIG_ARM_32)
 #define BYTE(n) #n
 #define WORD(n) #n
+#define DWORD(n) "" #n ",%H" #n
+#define PAIR     "d"
 #elif defined (CONFIG_ARM_64)
 #define BYTE(n)  "w" #n
 #define WORD(n)  "w" #n
 #define DWORD(n) "" #n
+#define PAIR     ""
 #endif
 
 build_atomic_read(read_u8_atomic,  "b", BYTE, uint8_t)
 build_atomic_read(read_u16_atomic, "h", WORD, uint16_t)
 build_atomic_read(read_u32_atomic, "",  WORD, uint32_t)
+build_atomic_read(read_u64_atomic, PAIR, DWORD, uint64_t)
 build_atomic_read(read_int_atomic, "",  WORD, int)
 
 build_atomic_write(write_u8_atomic,  "b", BYTE, uint8_t)
 build_atomic_write(write_u16_atomic, "h", WORD, uint16_t)
 build_atomic_write(write_u32_atomic, "",  WORD, uint32_t)
+build_atomic_write(write_u64_atomic, PAIR, DWORD, uint64_t)
 build_atomic_write(write_int_atomic, "",  WORD, int)
 
-#if defined (CONFIG_ARM_64)
-build_atomic_read(read_u64_atomic, "", DWORD, uint64_t)
-build_atomic_write(write_u64_atomic, "", DWORD, uint64_t)
-#elif defined (CONFIG_ARM_32)
-static inline uint64_t read_u64_atomic(const volatile uint64_t *addr)
-{
-    uint64_t val;
-
-    asm volatile ( "ldrd %0,%H0,%1" : "=r" (val) : "m" (*addr) );
-
-    return val;
-}
-static inline void write_u64_atomic(volatile uint64_t *addr, uint64_t val)
-{
-    asm volatile ( "strd %1,%H1,%0" : "=m" (*addr) : "r" (val) );
-}
-#endif
-
 build_add_sized(add_u8_sized, "b", BYTE, uint8_t)
 build_add_sized(add_u16_sized, "h", WORD, uint16_t)
 build_add_sized(add_u32_sized, "", WORD, uint32_t)
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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