1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2c6557e7fSMartin Schwidefsky #ifndef __MMU_H 3c6557e7fSMartin Schwidefsky #define __MMU_H 4c6557e7fSMartin Schwidefsky 51b948d6cSMartin Schwidefsky #include <linux/cpumask.h> 61e3cab2fSHeiko Carstens #include <linux/errno.h> 7d09a307fSHeiko Carstens #include <asm/asm-extable.h> 81e3cab2fSHeiko Carstens 9c6557e7fSMartin Schwidefsky typedef struct { 1060f07c8eSMartin Schwidefsky spinlock_t lock; 111b948d6cSMartin Schwidefsky cpumask_t cpu_attach_mask; 1264f31d58SMartin Schwidefsky atomic_t flush_count; 13050eef36SMartin Schwidefsky unsigned int flush_mm; 14c6557e7fSMartin Schwidefsky struct list_head pgtable_list; 15e5992f2eSMartin Schwidefsky struct list_head gmap_list; 1644b6cc81SMartin Schwidefsky unsigned long gmap_asce; 17723cacbdSGerald Schaefer unsigned long asce; 18c6557e7fSMartin Schwidefsky unsigned long asce_limit; 19b020632eSMartin Schwidefsky unsigned long vdso_base; 20214d9bbcSClaudio Imbrenda /* The mmu context belongs to a secure guest. */ 2107fbdf7fSClaudio Imbrenda atomic_t protected_count; 22df88f318SJanosch Frank /* 23df88f318SJanosch Frank * The following bitfields need a down_write on the mm 24df88f318SJanosch Frank * semaphore when they are written to. As they are only 25df88f318SJanosch Frank * written once, they can be read without a lock. 26df88f318SJanosch Frank * 27df88f318SJanosch Frank * The mmu context allocates 4K page tables. 28df88f318SJanosch Frank */ 290b46e0a3SMartin Schwidefsky unsigned int alloc_pgste:1; 300b46e0a3SMartin Schwidefsky /* The mmu context uses extended page tables. */ 31b2fa47e6SMartin Schwidefsky unsigned int has_pgste:1; 3265eef335SDominik Dingel /* The mmu context uses storage keys. */ 3355531b74SJanosch Frank unsigned int uses_skeys:1; 34c9f0a2b8SJanosch Frank /* The mmu context uses CMM. */ 35c9f0a2b8SJanosch Frank unsigned int uses_cmm:1; 36*840565b1SDavid Hildenbrand /* 37*840565b1SDavid Hildenbrand * The mmu context allows COW-sharing of memory pages (KSM, zeropage). 38*840565b1SDavid Hildenbrand * Note that COW-sharing during fork() is currently always allowed. 39*840565b1SDavid Hildenbrand */ 40*840565b1SDavid Hildenbrand unsigned int allow_cow_sharing:1; 41a9e00d83SJanosch Frank /* The gmaps associated with this context are allowed to use huge pages. */ 42a9e00d83SJanosch Frank unsigned int allow_gmap_hpage_1m:1; 43c6557e7fSMartin Schwidefsky } mm_context_t; 44c6557e7fSMartin Schwidefsky 45a1b200e2SHeiko Carstens #define INIT_MM_CONTEXT(name) \ 4660f07c8eSMartin Schwidefsky .context.lock = __SPIN_LOCK_UNLOCKED(name.context.lock), \ 47e5992f2eSMartin Schwidefsky .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list), \ 48e5992f2eSMartin Schwidefsky .context.gmap_list = LIST_HEAD_INIT(name.context.gmap_list), 49a1b200e2SHeiko Carstens 50c6557e7fSMartin Schwidefsky #endif 51