Commit | Line | Data |
---|---|---|
e04d0d07 IY |
1 | #ifndef INCLUDE_XEN_OPS_H |
2 | #define INCLUDE_XEN_OPS_H | |
3 | ||
4 | #include <linux/percpu.h> | |
cd979883 | 5 | #include <linux/notifier.h> |
be81c8a1 | 6 | #include <linux/efi.h> |
7892f692 | 7 | #include <asm/xen/interface.h> |
4ccefbe5 | 8 | #include <xen/interface/vcpu.h> |
e04d0d07 IY |
9 | |
10 | DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); | |
11 | ||
03c8142b IC |
12 | void xen_arch_pre_suspend(void); |
13 | void xen_arch_post_suspend(int suspend_cancelled); | |
0e91398f | 14 | |
ad55db9f IY |
15 | void xen_timer_resume(void); |
16 | void xen_arch_resume(void); | |
2b953a5e | 17 | void xen_arch_suspend(void); |
ad55db9f | 18 | |
cd979883 SG |
19 | void xen_resume_notifier_register(struct notifier_block *nb); |
20 | void xen_resume_notifier_unregister(struct notifier_block *nb); | |
21 | ||
4ccefbe5 SS |
22 | bool xen_vcpu_stolen(int vcpu); |
23 | void xen_setup_runstate_info(int cpu); | |
24 | void xen_get_runstate_snapshot(struct vcpu_runstate_info *res); | |
25 | ||
016b6f5f SS |
26 | int xen_setup_shutdown_event(void); |
27 | ||
08bbc9da | 28 | extern unsigned long *xen_contiguous_bitmap; |
1b65c4e5 | 29 | int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, |
69908907 SS |
30 | unsigned int address_bits, |
31 | dma_addr_t *dma_handle); | |
08bbc9da | 32 | |
1b65c4e5 | 33 | void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order); |
08bbc9da | 34 | |
c140d879 | 35 | struct vm_area_struct; |
4e8c0c8c DV |
36 | |
37 | /* | |
a13d7201 | 38 | * xen_remap_domain_gfn_array() - map an array of foreign frames |
4e8c0c8c DV |
39 | * @vma: VMA to map the pages into |
40 | * @addr: Address at which to map the pages | |
41 | * @gfn: Array of GFNs to map | |
42 | * @nr: Number entries in the GFN array | |
43 | * @err_ptr: Returns per-GFN error status. | |
44 | * @prot: page protection mask | |
45 | * @domid: Domain owning the pages | |
46 | * @pages: Array of pages if this domain has an auto-translated physmap | |
47 | * | |
48 | * @gfn and @err_ptr may point to the same buffer, the GFNs will be | |
49 | * overwritten by the error codes after they are mapped. | |
50 | * | |
51 | * Returns the number of successfully mapped frames, or a -ve error | |
52 | * code. | |
53 | */ | |
a13d7201 | 54 | int xen_remap_domain_gfn_array(struct vm_area_struct *vma, |
4e8c0c8c DV |
55 | unsigned long addr, |
56 | xen_pfn_t *gfn, int nr, | |
57 | int *err_ptr, pgprot_t prot, | |
58 | unsigned domid, | |
59 | struct page **pages); | |
60 | ||
a13d7201 | 61 | /* xen_remap_domain_gfn_range() - map a range of foreign frames |
4e8c0c8c DV |
62 | * @vma: VMA to map the pages into |
63 | * @addr: Address at which to map the pages | |
64 | * @gfn: First GFN to map. | |
65 | * @nr: Number frames to map | |
66 | * @prot: page protection mask | |
67 | * @domid: Domain owning the pages | |
68 | * @pages: Array of pages if this domain has an auto-translated physmap | |
69 | * | |
70 | * Returns the number of successfully mapped frames, or a -ve error | |
71 | * code. | |
72 | */ | |
a13d7201 | 73 | int xen_remap_domain_gfn_range(struct vm_area_struct *vma, |
de1ef206 | 74 | unsigned long addr, |
4e8c0c8c | 75 | xen_pfn_t gfn, int nr, |
9a032e39 IC |
76 | pgprot_t prot, unsigned domid, |
77 | struct page **pages); | |
a13d7201 | 78 | int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, |
9a032e39 | 79 | int numpgs, struct page **pages); |
4e8c0c8c | 80 | int xen_xlate_remap_gfn_array(struct vm_area_struct *vma, |
628c28ee | 81 | unsigned long addr, |
4e8c0c8c DV |
82 | xen_pfn_t *gfn, int nr, |
83 | int *err_ptr, pgprot_t prot, | |
628c28ee DV |
84 | unsigned domid, |
85 | struct page **pages); | |
86 | int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma, | |
87 | int nr, struct page **pages); | |
de1ef206 | 88 | |
394b40f6 | 89 | bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); |
be81c8a1 DK |
90 | |
91 | #ifdef CONFIG_XEN_EFI | |
92 | extern efi_system_table_t *xen_efi_probe(void); | |
93 | #else | |
57f7138d | 94 | static inline efi_system_table_t __init *xen_efi_probe(void) |
be81c8a1 DK |
95 | { |
96 | return NULL; | |
97 | } | |
98 | #endif | |
99 | ||
fdfd811d DV |
100 | #ifdef CONFIG_PREEMPT |
101 | ||
102 | static inline void xen_preemptible_hcall_begin(void) | |
103 | { | |
104 | } | |
105 | ||
106 | static inline void xen_preemptible_hcall_end(void) | |
107 | { | |
108 | } | |
109 | ||
110 | #else | |
111 | ||
112 | DECLARE_PER_CPU(bool, xen_in_preemptible_hcall); | |
113 | ||
114 | static inline void xen_preemptible_hcall_begin(void) | |
115 | { | |
116 | __this_cpu_write(xen_in_preemptible_hcall, true); | |
117 | } | |
118 | ||
119 | static inline void xen_preemptible_hcall_end(void) | |
120 | { | |
121 | __this_cpu_write(xen_in_preemptible_hcall, false); | |
122 | } | |
123 | ||
124 | #endif /* CONFIG_PREEMPT */ | |
125 | ||
e04d0d07 | 126 | #endif /* INCLUDE_XEN_OPS_H */ |