]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/xen/xen-ops.h
Merge tag 'renesas-dt-bindings2-for-v4.13' of https://git.kernel.org/pub/scm/linux...
[mirror_ubuntu-bionic-kernel.git] / include / xen / xen-ops.h
CommitLineData
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
10DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
11
55467dea
VK
12DECLARE_PER_CPU(uint32_t, xen_vcpu_id);
13static inline uint32_t xen_vcpu_nr(int cpu)
88e957d6
VK
14{
15 return per_cpu(xen_vcpu_id, cpu);
16}
17
03c8142b
IC
18void xen_arch_pre_suspend(void);
19void xen_arch_post_suspend(int suspend_cancelled);
0e91398f 20
ad55db9f
IY
21void xen_timer_resume(void);
22void xen_arch_resume(void);
2b953a5e 23void xen_arch_suspend(void);
ad55db9f 24
5d9404e1
JG
25void xen_reboot(int reason);
26
cd979883
SG
27void xen_resume_notifier_register(struct notifier_block *nb);
28void xen_resume_notifier_unregister(struct notifier_block *nb);
29
4ccefbe5
SS
30bool xen_vcpu_stolen(int vcpu);
31void xen_setup_runstate_info(int cpu);
ecb23dc6 32void xen_time_setup_guest(void);
4ccefbe5 33void xen_get_runstate_snapshot(struct vcpu_runstate_info *res);
d34c30cc 34u64 xen_steal_clock(int cpu);
4ccefbe5 35
016b6f5f
SS
36int xen_setup_shutdown_event(void);
37
08bbc9da 38extern unsigned long *xen_contiguous_bitmap;
16624390
VK
39
40#ifdef CONFIG_XEN_PV
1b65c4e5 41int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
69908907
SS
42 unsigned int address_bits,
43 dma_addr_t *dma_handle);
08bbc9da 44
1b65c4e5 45void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order);
16624390
VK
46#else
47static inline int xen_create_contiguous_region(phys_addr_t pstart,
48 unsigned int order,
49 unsigned int address_bits,
50 dma_addr_t *dma_handle)
51{
52 return 0;
53}
54
55static inline void xen_destroy_contiguous_region(phys_addr_t pstart,
56 unsigned int order) { }
57#endif
08bbc9da 58
c140d879 59struct vm_area_struct;
4e8c0c8c
DV
60
61/*
a13d7201 62 * xen_remap_domain_gfn_array() - map an array of foreign frames
4e8c0c8c
DV
63 * @vma: VMA to map the pages into
64 * @addr: Address at which to map the pages
65 * @gfn: Array of GFNs to map
66 * @nr: Number entries in the GFN array
67 * @err_ptr: Returns per-GFN error status.
68 * @prot: page protection mask
69 * @domid: Domain owning the pages
70 * @pages: Array of pages if this domain has an auto-translated physmap
71 *
72 * @gfn and @err_ptr may point to the same buffer, the GFNs will be
73 * overwritten by the error codes after they are mapped.
74 *
75 * Returns the number of successfully mapped frames, or a -ve error
76 * code.
77 */
a13d7201 78int xen_remap_domain_gfn_array(struct vm_area_struct *vma,
4e8c0c8c
DV
79 unsigned long addr,
80 xen_pfn_t *gfn, int nr,
81 int *err_ptr, pgprot_t prot,
82 unsigned domid,
83 struct page **pages);
84
a13d7201 85/* xen_remap_domain_gfn_range() - map a range of foreign frames
4e8c0c8c
DV
86 * @vma: VMA to map the pages into
87 * @addr: Address at which to map the pages
88 * @gfn: First GFN to map.
89 * @nr: Number frames to map
90 * @prot: page protection mask
91 * @domid: Domain owning the pages
92 * @pages: Array of pages if this domain has an auto-translated physmap
93 *
94 * Returns the number of successfully mapped frames, or a -ve error
95 * code.
96 */
a13d7201 97int xen_remap_domain_gfn_range(struct vm_area_struct *vma,
de1ef206 98 unsigned long addr,
4e8c0c8c 99 xen_pfn_t gfn, int nr,
9a032e39
IC
100 pgprot_t prot, unsigned domid,
101 struct page **pages);
a13d7201 102int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
9a032e39 103 int numpgs, struct page **pages);
4e8c0c8c 104int xen_xlate_remap_gfn_array(struct vm_area_struct *vma,
628c28ee 105 unsigned long addr,
4e8c0c8c
DV
106 xen_pfn_t *gfn, int nr,
107 int *err_ptr, pgprot_t prot,
628c28ee
DV
108 unsigned domid,
109 struct page **pages);
110int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma,
111 int nr, struct page **pages);
243848fc
SZ
112int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr,
113 unsigned long nr_grant_frames);
de1ef206 114
394b40f6 115bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
be81c8a1 116
a62ed500
SZ
117efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc);
118efi_status_t xen_efi_set_time(efi_time_t *tm);
119efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
120 efi_time_t *tm);
121efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm);
122efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
123 u32 *attr, unsigned long *data_size,
124 void *data);
125efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
126 efi_char16_t *name, efi_guid_t *vendor);
127efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
128 u32 attr, unsigned long data_size,
129 void *data);
130efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
131 u64 *remaining_space,
132 u64 *max_variable_size);
133efi_status_t xen_efi_get_next_high_mono_count(u32 *count);
134efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
135 unsigned long count, unsigned long sg_list);
136efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
137 unsigned long count, u64 *max_size,
138 int *reset_type);
e371fd76
JG
139void xen_efi_reset_system(int reset_type, efi_status_t status,
140 unsigned long data_size, efi_char16_t *data);
141
be81c8a1 142
fdfd811d
DV
143#ifdef CONFIG_PREEMPT
144
145static inline void xen_preemptible_hcall_begin(void)
146{
147}
148
149static inline void xen_preemptible_hcall_end(void)
150{
151}
152
153#else
154
155DECLARE_PER_CPU(bool, xen_in_preemptible_hcall);
156
157static inline void xen_preemptible_hcall_begin(void)
158{
159 __this_cpu_write(xen_in_preemptible_hcall, true);
160}
161
162static inline void xen_preemptible_hcall_end(void)
163{
164 __this_cpu_write(xen_in_preemptible_hcall, false);
165}
166
167#endif /* CONFIG_PREEMPT */
168
e04d0d07 169#endif /* INCLUDE_XEN_OPS_H */