mmu.h 1.2 KB

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