cxl-base.h 1000 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2014 IBM Corp.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #ifndef _MISC_CXL_BASE_H
  10. #define _MISC_CXL_BASE_H
  11. #ifdef CONFIG_CXL_BASE
  12. #define CXL_IRQ_RANGES 4
  13. struct cxl_irq_ranges {
  14. irq_hw_number_t offset[CXL_IRQ_RANGES];
  15. irq_hw_number_t range[CXL_IRQ_RANGES];
  16. };
  17. extern atomic_t cxl_use_count;
  18. static inline bool cxl_ctx_in_use(void)
  19. {
  20. return (atomic_read(&cxl_use_count) != 0);
  21. }
  22. static inline void cxl_ctx_get(void)
  23. {
  24. atomic_inc(&cxl_use_count);
  25. }
  26. static inline void cxl_ctx_put(void)
  27. {
  28. atomic_dec(&cxl_use_count);
  29. }
  30. void cxl_slbia(struct mm_struct *mm);
  31. #else /* CONFIG_CXL_BASE */
  32. static inline bool cxl_ctx_in_use(void) { return false; }
  33. static inline void cxl_slbia(struct mm_struct *mm) {}
  34. #endif /* CONFIG_CXL_BASE */
  35. #endif