mmu.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef __MMU_H
  2. #define __MMU_H
  3. #include <linux/cpumask.h>
  4. #include <linux/errno.h>
  5. typedef struct {
  6. cpumask_t cpu_attach_mask;
  7. atomic_t flush_count;
  8. unsigned int flush_mm;
  9. spinlock_t pgtable_lock;
  10. struct list_head pgtable_list;
  11. spinlock_t gmap_lock;
  12. struct list_head gmap_list;
  13. unsigned long gmap_asce;
  14. unsigned long asce;
  15. unsigned long asce_limit;
  16. unsigned long vdso_base;
  17. /* The mmu context allocates 4K page tables. */
  18. unsigned int alloc_pgste:1;
  19. /* The mmu context uses extended page tables. */
  20. unsigned int has_pgste:1;
  21. /* The mmu context uses storage keys. */
  22. unsigned int use_skey:1;
  23. } mm_context_t;
  24. #define INIT_MM_CONTEXT(name) \
  25. .context.pgtable_lock = \
  26. __SPIN_LOCK_UNLOCKED(name.context.pgtable_lock), \
  27. .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list), \
  28. .context.gmap_lock = __SPIN_LOCK_UNLOCKED(name.context.gmap_lock), \
  29. .context.gmap_list = LIST_HEAD_INIT(name.context.gmap_list),
  30. static inline int tprot(unsigned long addr)
  31. {
  32. int rc = -EFAULT;
  33. asm volatile(
  34. " tprot 0(%1),0\n"
  35. "0: ipm %0\n"
  36. " srl %0,28\n"
  37. "1:\n"
  38. EX_TABLE(0b,1b)
  39. : "+d" (rc) : "a" (addr) : "cc");
  40. return rc;
  41. }
  42. #endif