backoff.h 821 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef _SPARC64_BACKOFF_H
  2. #define _SPARC64_BACKOFF_H
  3. #define BACKOFF_LIMIT (4 * 1024)
  4. #ifdef CONFIG_SMP
  5. #define BACKOFF_SETUP(reg) \
  6. mov 1, reg
  7. #define BACKOFF_LABEL(spin_label, continue_label) \
  8. spin_label
  9. #define BACKOFF_SPIN(reg, tmp, label) \
  10. mov reg, tmp; \
  11. 88: rd %ccr, %g0; \
  12. rd %ccr, %g0; \
  13. rd %ccr, %g0; \
  14. .section .pause_patch,"ax"; \
  15. .word 88b; \
  16. sllx tmp, 7, tmp; \
  17. wr tmp, 0, %asr27; \
  18. clr tmp; \
  19. .previous; \
  20. brnz,pt tmp, 88b; \
  21. sub tmp, 1, tmp; \
  22. set BACKOFF_LIMIT, tmp; \
  23. cmp reg, tmp; \
  24. bg,pn %xcc, label; \
  25. nop; \
  26. ba,pt %xcc, label; \
  27. sllx reg, 1, reg;
  28. #else
  29. #define BACKOFF_SETUP(reg)
  30. #define BACKOFF_LABEL(spin_label, continue_label) \
  31. continue_label
  32. #define BACKOFF_SPIN(reg, tmp, label)
  33. #endif
  34. #endif /* _SPARC64_BACKOFF_H */