1 // SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
2 // SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 // SPDX-License-Identifier: LGPL-2.1-or-later
6 #ifndef _URCU_ARCH_PPC_H
7 #define _URCU_ARCH_PPC_H
10 * arch_ppc.h: trivial definitions for the powerpc architecture.
13 #include <urcu/compiler.h>
14 #include <urcu/config.h>
15 #include <urcu/syscall-compat.h>
22 /* Include size of POWER5+ L3 cache lines: 256 bytes */
23 #define CAA_CACHE_LINE_SIZE 256
26 #define LWSYNC_OPCODE "sync\n"
28 #define LWSYNC_OPCODE "lwsync\n"
32 * Use sync for all cmm_mb/rmb/wmb barriers because lwsync does not
33 * preserve ordering of cacheable vs. non-cacheable accesses, so it
34 * should not be used to order with respect to MMIO operations. An
35 * eieio+lwsync pair is also not enough for cmm_rmb, because it will
36 * order cacheable and non-cacheable memory operations separately---i.e.
37 * not the latter against the former.
39 #define cmm_mb() __asm__ __volatile__ ("sync":::"memory")
42 * lwsync orders loads in cacheable memory with respect to other loads,
43 * and stores in cacheable memory with respect to other stores.
44 * Therefore, use it for barriers ordering accesses to cacheable memory
47 #define cmm_smp_rmb() __asm__ __volatile__ (LWSYNC_OPCODE:::"memory")
48 #define cmm_smp_wmb() __asm__ __volatile__ (LWSYNC_OPCODE:::"memory")
54 __asm__ __volatile__ ("mftbl %0" : "=r" (rval)); \
62 __asm__ __volatile__ ("mftbu %0" : "=r" (rval)); \
69 unsigned long long rval; \
70 __asm__ __volatile__ ("mftb %0" : "=r" (rval)); \
74 #define HAS_CAA_GET_CYCLES
76 typedef uint64_t caa_cycles_t
;
79 static inline caa_cycles_t
caa_get_cycles(void)
81 return (caa_cycles_t
) mftb();
84 static inline caa_cycles_t
caa_get_cycles(void)
94 return (((caa_cycles_t
) h
) << 32) + l
;
100 * On Linux, define the membarrier system call number if not yet available in
101 * the system headers.
103 #if (defined(__linux__) && !defined(__NR_membarrier))
104 #define __NR_membarrier 365
111 #include <urcu/arch/generic.h>
113 #endif /* _URCU_ARCH_PPC_H */
This page took 0.034204 seconds and 5 git commands to generate.