flow: add ability for weight-based flow control on multiple jobs
[fio.git] / arch / arch.h
CommitLineData
ebac4655
JA
1#ifndef ARCH_H
2#define ARCH_H
3
3932f8be
BVA
4#include <stdatomic.h>
5
24575392
JA
6#include "../lib/types.h"
7
ebac4655 8enum {
cca84643 9 arch_x86_64 = 1,
e12f4ede 10 arch_x86,
ebac4655
JA
11 arch_ppc,
12 arch_ia64,
13 arch_s390,
14 arch_alpha,
697a606c
JA
15 arch_sparc,
16 arch_sparc64,
a1ea676e 17 arch_arm,
29721c9c 18 arch_sh,
85a86319 19 arch_hppa,
5499f7ff 20 arch_mips,
78c8831e 21 arch_aarch64,
fa77073a
JA
22
23 arch_generic,
cca84643
JA
24
25 arch_nr,
ebac4655
JA
26};
27
5f739e0e
NI
28enum {
29 ARCH_FLAG_1 = 1 << 0,
30 ARCH_FLAG_2 = 1 << 1,
31 ARCH_FLAG_3 = 1 << 2,
32 ARCH_FLAG_4 = 1 << 3,
33};
34
4247d1a9
JA
35extern unsigned long arch_flags;
36
96170421
CE
37#define ARCH_CPU_CLOCK_WRAPS
38
d4e74fda
DB
39#define atomic_add(p, v) \
40 atomic_fetch_add((_Atomic typeof(*(p)) *)(p), v)
41#define atomic_sub(p, v) \
42 atomic_fetch_sub((_Atomic typeof(*(p)) *)(p), v)
43#define atomic_load_relaxed(p) \
44 atomic_load_explicit((_Atomic typeof(*(p)) *)(p), \
45 memory_order_relaxed)
3932f8be
BVA
46#define atomic_load_acquire(p) \
47 atomic_load_explicit((_Atomic typeof(*(p)) *)(p), \
48 memory_order_acquire)
49#define atomic_store_release(p, v) \
50 atomic_store_explicit((_Atomic typeof(*(p)) *)(p), (v), \
51 memory_order_release)
52
c473a9bd 53/* IWYU pragma: begin_exports */
ebac4655
JA
54#if defined(__i386__)
55#include "arch-x86.h"
56#elif defined(__x86_64__)
57#include "arch-x86_64.h"
2afd826b 58#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__)
ebac4655
JA
59#include "arch-ppc.h"
60#elif defined(__ia64__)
61#include "arch-ia64.h"
62#elif defined(__alpha__)
63#include "arch-alpha.h"
64#elif defined(__s390x__) || defined(__s390__)
65#include "arch-s390.h"
697a606c
JA
66#elif defined(__sparc__)
67#include "arch-sparc.h"
68#elif defined(__sparc64__)
69#include "arch-sparc64.h"
a1ea676e
KS
70#elif defined(__arm__)
71#include "arch-arm.h"
c28b912f
JA
72#elif defined(__mips__) || defined(__mips64__)
73#include "arch-mips.h"
29721c9c
NI
74#elif defined(__sh__)
75#include "arch-sh.h"
85a86319
JA
76#elif defined(__hppa__)
77#include "arch-hppa.h"
78c8831e
DK
78#elif defined(__aarch64__)
79#include "arch-aarch64.h"
ebac4655 80#else
fa77073a
JA
81#warning "Unknown architecture, attempting to use generic model."
82#include "arch-generic.h"
ebac4655
JA
83#endif
84
8f7e39dd 85#include "../lib/ffz.h"
c473a9bd 86/* IWYU pragma: end_exports */
8f7e39dd 87
d3cc4ebf
JA
88#ifndef ARCH_HAVE_INIT
89static inline int arch_init(char *envp[])
90{
91 return 0;
92}
93#endif
94
bfed648c
JA
95#ifdef __alpha__
96/*
97 * alpha is the only exception, all other architectures
98 * have common numbers for new system calls.
99 */
100# ifndef __NR_io_uring_setup
101# define __NR_io_uring_setup 535
102# endif
103# ifndef __NR_io_uring_enter
104# define __NR_io_uring_enter 536
105# endif
106# ifndef __NR_io_uring_register
107# define __NR_io_uring_register 537
108# endif
109#else /* !__alpha__ */
110# ifndef __NR_io_uring_setup
111# define __NR_io_uring_setup 425
112# endif
113# ifndef __NR_io_uring_enter
114# define __NR_io_uring_enter 426
115# endif
116# ifndef __NR_io_uring_register
117# define __NR_io_uring_register 427
118# endif
119#endif
120
121#define ARCH_HAVE_IOURING
122
ebac4655 123#endif