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