blob: 20f01df0871b18eac5e7007ca2db3605847e3d18 [file] [log] [blame]
Sam Ravnborga00736e2008-06-19 20:26:19 +02001#ifndef _SPARC64_BACKOFF_H
2#define _SPARC64_BACKOFF_H
3
4#define BACKOFF_LIMIT (4 * 1024)
5
6#ifdef CONFIG_SMP
7
8#define BACKOFF_SETUP(reg) \
9 mov 1, reg
10
David S. Miller0f581892010-08-18 22:53:26 -070011#define BACKOFF_LABEL(spin_label, continue_label) \
12 spin_label
13
David S. Millere9b9eb52012-10-27 23:00:41 -070014#define BACKOFF_SPIN(reg, tmp, label) \
15 mov reg, tmp; \
1688: rd %ccr, %g0; \
17 rd %ccr, %g0; \
18 rd %ccr, %g0; \
19 .section .pause_patch,"ax"; \
20 .word 88b; \
21 sllx tmp, 7, tmp; \
22 wr tmp, 0, %asr27; \
23 clr tmp; \
24 .previous; \
25 brnz,pt tmp, 88b; \
26 sub tmp, 1, tmp; \
27 set BACKOFF_LIMIT, tmp; \
28 cmp reg, tmp; \
29 bg,pn %xcc, label; \
30 nop; \
31 ba,pt %xcc, label; \
32 sllx reg, 1, reg;
Sam Ravnborga00736e2008-06-19 20:26:19 +020033
34#else
35
36#define BACKOFF_SETUP(reg)
David S. Miller0f581892010-08-18 22:53:26 -070037
38#define BACKOFF_LABEL(spin_label, continue_label) \
39 continue_label
40
41#define BACKOFF_SPIN(reg, tmp, label)
Sam Ravnborga00736e2008-06-19 20:26:19 +020042
43#endif
44
45#endif /* _SPARC64_BACKOFF_H */