1 #ifndef INCLUDE_XEN_OPS_H
2 #define INCLUDE_XEN_OPS_H
4 #include <linux/percpu.h>
5 #include <linux/notifier.h>
7 #include <asm/xen/interface.h>
8 #include <xen/interface/vcpu.h>
10 DECLARE_PER_CPU(struct vcpu_info
*, xen_vcpu
);
12 void xen_arch_pre_suspend(void);
13 void xen_arch_post_suspend(int suspend_cancelled
);
15 void xen_timer_resume(void);
16 void xen_arch_resume(void);
17 void xen_arch_suspend(void);
19 void xen_resume_notifier_register(struct notifier_block
*nb
);
20 void xen_resume_notifier_unregister(struct notifier_block
*nb
);
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
);
26 int xen_setup_shutdown_event(void);
28 extern unsigned long *xen_contiguous_bitmap
;
29 int xen_create_contiguous_region(phys_addr_t pstart
, unsigned int order
,
30 unsigned int address_bits
,
31 dma_addr_t
*dma_handle
);
33 void xen_destroy_contiguous_region(phys_addr_t pstart
, unsigned int order
);
35 struct vm_area_struct
;
38 * xen_remap_domain_gfn_array() - map an array of foreign frames
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
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.
51 * Returns the number of successfully mapped frames, or a -ve error
54 int xen_remap_domain_gfn_array(struct vm_area_struct
*vma
,
56 xen_pfn_t
*gfn
, int nr
,
57 int *err_ptr
, pgprot_t prot
,
61 /* xen_remap_domain_gfn_range() - map a range of foreign frames
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
70 * Returns the number of successfully mapped frames, or a -ve error
73 int xen_remap_domain_gfn_range(struct vm_area_struct
*vma
,
75 xen_pfn_t gfn
, int nr
,
76 pgprot_t prot
, unsigned domid
,
78 int xen_unmap_domain_gfn_range(struct vm_area_struct
*vma
,
79 int numpgs
, struct page
**pages
);
80 int xen_xlate_remap_gfn_array(struct vm_area_struct
*vma
,
82 xen_pfn_t
*gfn
, int nr
,
83 int *err_ptr
, pgprot_t prot
,
86 int xen_xlate_unmap_gfn_range(struct vm_area_struct
*vma
,
87 int nr
, struct page
**pages
);
89 bool xen_running_on_version_or_later(unsigned int major
, unsigned int minor
);
92 extern efi_system_table_t
*xen_efi_probe(void);
94 static inline efi_system_table_t __init
*xen_efi_probe(void)
100 #ifdef CONFIG_PREEMPT
102 static inline void xen_preemptible_hcall_begin(void)
106 static inline void xen_preemptible_hcall_end(void)
112 DECLARE_PER_CPU(bool, xen_in_preemptible_hcall
);
114 static inline void xen_preemptible_hcall_begin(void)
116 __this_cpu_write(xen_in_preemptible_hcall
, true);
119 static inline void xen_preemptible_hcall_end(void)
121 __this_cpu_write(xen_in_preemptible_hcall
, false);
124 #endif /* CONFIG_PREEMPT */
126 #endif /* INCLUDE_XEN_OPS_H */