Martin Schwidefsky | 1e133ab | 2016-03-08 11:49:57 +0100 | [diff] [blame] | 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; |
Martin Schwidefsky | 8ecb1a5 | 2016-03-08 11:54:14 +0100 | [diff] [blame^] | 42 | struct rcu_head rcu; |
Martin Schwidefsky | 414d3b0 | 2016-03-08 11:52:54 +0100 | [diff] [blame] | 43 | void (*notifier_call)(struct gmap *gmap, unsigned long start, |
| 44 | unsigned long end); |
Martin Schwidefsky | 1e133ab | 2016-03-08 11:49:57 +0100 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | struct gmap *gmap_alloc(struct mm_struct *mm, unsigned long limit); |
| 48 | void gmap_free(struct gmap *gmap); |
| 49 | void gmap_enable(struct gmap *gmap); |
| 50 | void gmap_disable(struct gmap *gmap); |
| 51 | int gmap_map_segment(struct gmap *gmap, unsigned long from, |
| 52 | unsigned long to, unsigned long len); |
| 53 | int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len); |
| 54 | unsigned long __gmap_translate(struct gmap *, unsigned long gaddr); |
| 55 | unsigned long gmap_translate(struct gmap *, unsigned long gaddr); |
| 56 | int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr); |
| 57 | int gmap_fault(struct gmap *, unsigned long gaddr, unsigned int fault_flags); |
| 58 | void gmap_discard(struct gmap *, unsigned long from, unsigned long to); |
| 59 | void __gmap_zap(struct gmap *, unsigned long gaddr); |
| 60 | void gmap_unlink(struct mm_struct *, unsigned long *table, unsigned long vmaddr); |
| 61 | |
| 62 | void gmap_register_ipte_notifier(struct gmap_notifier *); |
| 63 | void gmap_unregister_ipte_notifier(struct gmap_notifier *); |
| 64 | int gmap_ipte_notify(struct gmap *, unsigned long start, unsigned long len); |
| 65 | |
| 66 | #endif /* _ASM_S390_GMAP_H */ |