Sam Ravnborg | a00736e | 2008-06-19 20:26:19 +0200 | [diff] [blame] | 1 | #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. Miller | 0f58189 | 2010-08-18 22:53:26 -0700 | [diff] [blame] | 11 | #define BACKOFF_LABEL(spin_label, continue_label) \ |
| 12 | spin_label |
| 13 | |
Sam Ravnborg | a00736e | 2008-06-19 20:26:19 +0200 | [diff] [blame] | 14 | #define BACKOFF_SPIN(reg, tmp, label) \ |
| 15 | mov reg, tmp; \ |
| 16 | 88: brnz,pt tmp, 88b; \ |
| 17 | sub tmp, 1, tmp; \ |
| 18 | set BACKOFF_LIMIT, tmp; \ |
| 19 | cmp reg, tmp; \ |
| 20 | bg,pn %xcc, label; \ |
| 21 | nop; \ |
| 22 | ba,pt %xcc, label; \ |
| 23 | sllx reg, 1, reg; |
| 24 | |
| 25 | #else |
| 26 | |
| 27 | #define BACKOFF_SETUP(reg) |
David S. Miller | 0f58189 | 2010-08-18 22:53:26 -0700 | [diff] [blame] | 28 | |
| 29 | #define BACKOFF_LABEL(spin_label, continue_label) \ |
| 30 | continue_label |
| 31 | |
| 32 | #define BACKOFF_SPIN(reg, tmp, label) |
Sam Ravnborg | a00736e | 2008-06-19 20:26:19 +0200 | [diff] [blame] | 33 | |
| 34 | #endif |
| 35 | |
| 36 | #endif /* _SPARC64_BACKOFF_H */ |