mmu.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __MMU_H
  3. #define __MMU_H
  4. #include <linux/cpumask.h>
  5. #include <linux/errno.h>
  6. #include <asm/asm-extable.h>
  7. typedef struct {
  8. spinlock_t lock;
  9. cpumask_t cpu_attach_mask;
  10. atomic_t flush_count;
  11. unsigned int flush_mm;
  12. struct list_head pgtable_list;
  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 belongs to a secure guest. */
  19. atomic_t protected_count;
  20. /*
  21. * The following bitfields need a down_write on the mm
  22. * semaphore when they are written to. As they are only
  23. * written once, they can be read without a lock.
  24. *
  25. * The mmu context allocates 4K page tables.
  26. */
  27. unsigned int alloc_pgste:1;
  28. /* The mmu context uses extended page tables. */
  29. unsigned int has_pgste:1;
  30. /* The mmu context uses storage keys. */
  31. unsigned int uses_skeys:1;
  32. /* The mmu context uses CMM. */
  33. unsigned int uses_cmm:1;
  34. /* The gmaps associated with this context are allowed to use huge pages. */
  35. unsigned int allow_gmap_hpage_1m:1;
  36. } mm_context_t;
  37. #define INIT_MM_CONTEXT(name) \
  38. .context.lock = __SPIN_LOCK_UNLOCKED(name.context.lock), \
  39. .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list), \
  40. .context.gmap_list = LIST_HEAD_INIT(name.context.gmap_list),
  41. #endif