1 #ifndef _URCU_ARCH_GENERIC_H
2 #define _URCU_ARCH_GENERIC_H
5 * arch_generic.h: common definitions for multiple architectures.
7 * Copyright (c) 2010 Paolo Bonzini <pbonzini@redhat.com>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <urcu/compiler.h>
25 #include <urcu/config.h>
31 #ifndef CACHE_LINE_SIZE
32 #define CACHE_LINE_SIZE 64
35 #if !defined(mc) && !defined(rmc) && !defined(wmc)
36 #define CONFIG_HAVE_MEM_COHERENCY
38 * Architectures with cache coherency must _not_ define mc/rmc/wmc.
40 * For them, mc/rmc/wmc are implemented with a * simple compiler barrier;
41 * in addition, we provide defaults for mb (using GCC builtins) as well as
42 * rmb and wmb (defaulting to mb).
46 #define mb() __sync_synchronize()
57 #define mc() barrier()
58 #define rmc() barrier()
59 #define wmc() barrier()
62 * Architectures without cache coherency need something like the following:
64 * #define mc() arch_cache_flush()
65 * #define rmc() arch_cache_flush_read()
66 * #define wmc() arch_cache_flush_write()
68 * Of these, only mc is mandatory. rmc and wmc default to mc. mb/rmb/wmb
69 * use these definitions by default:
97 /* Nop everywhere except on alpha. */
98 #ifndef read_barrier_depends
99 #define read_barrier_depends()
102 #ifdef CONFIG_RCU_SMP
103 #define smp_mb() mb()
104 #define smp_rmb() rmb()
105 #define smp_wmb() wmb()
106 #define smp_mc() mc()
107 #define smp_rmc() rmc()
108 #define smp_wmc() wmc()
109 #define smp_read_barrier_depends() read_barrier_depends()
111 #define smp_mb() barrier()
112 #define smp_rmb() barrier()
113 #define smp_wmb() barrier()
114 #define smp_mc() barrier()
115 #define smp_rmc() barrier()
116 #define smp_wmc() barrier()
117 #define smp_read_barrier_depends()
121 #define cpu_relax() barrier()
128 #endif /* _URCU_ARCH_GENERIC_H */
This page took 0.039529 seconds and 4 git commands to generate.