2 * KVM guest address space mapping code
4 * Copyright IBM Corp. 2007, 2016
5 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
8 #ifndef _ASM_S390_GMAP_H
9 #define _ASM_S390_GMAP_H
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 * @ref_count: reference counter for the gmap structure
19 * @table: pointer to the page directory
20 * @asce: address space control element for gmap page table
21 * @pfault_enabled: defines if pfaults are applicable for the guest
24 struct list_head list
;
25 struct list_head crst_list
;
27 struct radix_tree_root guest_to_host
;
28 struct radix_tree_root host_to_guest
;
29 spinlock_t guest_table_lock
;
33 unsigned long asce_end
;
39 * struct gmap_notifier - notify function block for page invalidation
40 * @notifier_call: address of callback function
42 struct gmap_notifier
{
43 struct list_head list
;
45 void (*notifier_call
)(struct gmap
*gmap
, unsigned long start
,
49 struct gmap
*gmap_create(struct mm_struct
*mm
, unsigned long limit
);
50 void gmap_remove(struct gmap
*gmap
);
51 struct gmap
*gmap_get(struct gmap
*gmap
);
52 void gmap_put(struct gmap
*gmap
);
54 void gmap_enable(struct gmap
*gmap
);
55 void gmap_disable(struct gmap
*gmap
);
56 int gmap_map_segment(struct gmap
*gmap
, unsigned long from
,
57 unsigned long to
, unsigned long len
);
58 int gmap_unmap_segment(struct gmap
*gmap
, unsigned long to
, unsigned long len
);
59 unsigned long __gmap_translate(struct gmap
*, unsigned long gaddr
);
60 unsigned long gmap_translate(struct gmap
*, unsigned long gaddr
);
61 int __gmap_link(struct gmap
*gmap
, unsigned long gaddr
, unsigned long vmaddr
);
62 int gmap_fault(struct gmap
*, unsigned long gaddr
, unsigned int fault_flags
);
63 void gmap_discard(struct gmap
*, unsigned long from
, unsigned long to
);
64 void __gmap_zap(struct gmap
*, unsigned long gaddr
);
65 void gmap_unlink(struct mm_struct
*, unsigned long *table
, unsigned long vmaddr
);
67 void gmap_register_pte_notifier(struct gmap_notifier
*);
68 void gmap_unregister_pte_notifier(struct gmap_notifier
*);
69 void gmap_pte_notify(struct mm_struct
*, unsigned long addr
, pte_t
*);
71 int gmap_mprotect_notify(struct gmap
*, unsigned long start
,
72 unsigned long len
, int prot
);
74 #endif /* _ASM_S390_GMAP_H */