1 /* 2 * KVM guest address space mapping code 3 * 4 * Copyright IBM Corp. 2007, 2016 5 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> 6 */ 7 8 #ifndef _ASM_S390_GMAP_H 9 #define _ASM_S390_GMAP_H 10 11 /** 12 * struct gmap_struct - guest address space 13 * @crst_list: list of all crst tables used in the guest address space 14 * @mm: pointer to the parent mm_struct 15 * @guest_to_host: radix tree with guest to host address translation 16 * @host_to_guest: radix tree with pointer to segment table entries 17 * @guest_table_lock: spinlock to protect all entries in the guest page table 18 * @table: pointer to the page directory 19 * @asce: address space control element for gmap page table 20 * @pfault_enabled: defines if pfaults are applicable for the guest 21 */ 22 struct gmap { 23 struct list_head list; 24 struct list_head crst_list; 25 struct mm_struct *mm; 26 struct radix_tree_root guest_to_host; 27 struct radix_tree_root host_to_guest; 28 spinlock_t guest_table_lock; 29 unsigned long *table; 30 unsigned long asce; 31 unsigned long asce_end; 32 void *private; 33 bool pfault_enabled; 34 }; 35 36 /** 37 * struct gmap_notifier - notify function block for page invalidation 38 * @notifier_call: address of callback function 39 */ 40 struct gmap_notifier { 41 struct list_head list; 42 void (*notifier_call)(struct gmap *gmap, unsigned long gaddr); 43 }; 44 45 struct gmap *gmap_alloc(struct mm_struct *mm, unsigned long limit); 46 void gmap_free(struct gmap *gmap); 47 void gmap_enable(struct gmap *gmap); 48 void gmap_disable(struct gmap *gmap); 49 int gmap_map_segment(struct gmap *gmap, unsigned long from, 50 unsigned long to, unsigned long len); 51 int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len); 52 unsigned long __gmap_translate(struct gmap *, unsigned long gaddr); 53 unsigned long gmap_translate(struct gmap *, unsigned long gaddr); 54 int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr); 55 int gmap_fault(struct gmap *, unsigned long gaddr, unsigned int fault_flags); 56 void gmap_discard(struct gmap *, unsigned long from, unsigned long to); 57 void __gmap_zap(struct gmap *, unsigned long gaddr); 58 void gmap_unlink(struct mm_struct *, unsigned long *table, unsigned long vmaddr); 59 60 void gmap_register_ipte_notifier(struct gmap_notifier *); 61 void gmap_unregister_ipte_notifier(struct gmap_notifier *); 62 int gmap_ipte_notify(struct gmap *, unsigned long start, unsigned long len); 63 64 #endif /* _ASM_S390_GMAP_H */ 65