^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef INCLUDE_XEN_OPS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define INCLUDE_XEN_OPS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/percpu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/notifier.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/efi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <xen/features.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <asm/xen/interface.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <xen/interface/vcpu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) DECLARE_PER_CPU(uint32_t, xen_vcpu_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) static inline uint32_t xen_vcpu_nr(int cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) return per_cpu(xen_vcpu_id, cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define XEN_VCPU_ID_INVALID U32_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) void xen_arch_pre_suspend(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) void xen_arch_post_suspend(int suspend_cancelled);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) void xen_timer_resume(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) void xen_arch_resume(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) void xen_arch_suspend(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) void xen_reboot(int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) void xen_resume_notifier_register(struct notifier_block *nb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) void xen_resume_notifier_unregister(struct notifier_block *nb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) bool xen_vcpu_stolen(int vcpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) void xen_setup_runstate_info(int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void xen_time_setup_guest(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void xen_manage_runstate_time(int action);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) void xen_get_runstate_snapshot(struct vcpu_runstate_info *res);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) u64 xen_steal_clock(int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) int xen_setup_shutdown_event(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) extern unsigned long *xen_contiguous_bitmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) unsigned int address_bits,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) dma_addr_t *dma_handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) static inline int xen_create_contiguous_region(phys_addr_t pstart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) unsigned int order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) unsigned int address_bits,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) dma_addr_t *dma_handle)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static inline void xen_destroy_contiguous_region(phys_addr_t pstart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) unsigned int order) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #if defined(CONFIG_XEN_PV)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) unsigned int domid, bool no_translate, struct page **pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) static inline int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) xen_pfn_t *pfn, int nr, int *err_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) pgprot_t prot, unsigned int domid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) bool no_translate, struct page **pages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) BUG();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct vm_area_struct;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #ifdef CONFIG_XEN_AUTO_XLATE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) int xen_xlate_remap_gfn_array(struct vm_area_struct *vma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) unsigned long addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) xen_pfn_t *gfn, int nr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) int *err_ptr, pgprot_t prot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) unsigned int domid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct page **pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) int nr, struct page **pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * These two functions are called from arch/x86/xen/mmu.c and so stubs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * are needed for a configuration not specifying CONFIG_XEN_AUTO_XLATE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) static inline int xen_xlate_remap_gfn_array(struct vm_area_struct *vma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) unsigned long addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) xen_pfn_t *gfn, int nr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) int *err_ptr, pgprot_t prot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) unsigned int domid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) struct page **pages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static inline int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) int nr, struct page **pages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) int xen_remap_vma_range(struct vm_area_struct *vma, unsigned long addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) unsigned long len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) * xen_remap_domain_gfn_array() - map an array of foreign frames by gfn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * @vma: VMA to map the pages into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * @addr: Address at which to map the pages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * @gfn: Array of GFNs to map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * @nr: Number entries in the GFN array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) * @err_ptr: Returns per-GFN error status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * @prot: page protection mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * @domid: Domain owning the pages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * @pages: Array of pages if this domain has an auto-translated physmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * @gfn and @err_ptr may point to the same buffer, the GFNs will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * overwritten by the error codes after they are mapped.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * Returns the number of successfully mapped frames, or a -ve error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) static inline int xen_remap_domain_gfn_array(struct vm_area_struct *vma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) unsigned long addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) xen_pfn_t *gfn, int nr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) int *err_ptr, pgprot_t prot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) unsigned int domid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct page **pages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) if (xen_feature(XENFEAT_auto_translated_physmap))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) return xen_xlate_remap_gfn_array(vma, addr, gfn, nr, err_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) prot, domid, pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) /* We BUG_ON because it's a programmer error to pass a NULL err_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * and the consequences later is quite hard to detect what the actual
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * cause of "wrong memory was mapped in".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) BUG_ON(err_ptr == NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) return xen_remap_pfn(vma, addr, gfn, nr, err_ptr, prot, domid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) false, pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * xen_remap_domain_mfn_array() - map an array of foreign frames by mfn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * @vma: VMA to map the pages into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * @addr: Address at which to map the pages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) * @mfn: Array of MFNs to map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) * @nr: Number entries in the MFN array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) * @err_ptr: Returns per-MFN error status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * @prot: page protection mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * @domid: Domain owning the pages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * @pages: Array of pages if this domain has an auto-translated physmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * @mfn and @err_ptr may point to the same buffer, the MFNs will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) * overwritten by the error codes after they are mapped.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) * Returns the number of successfully mapped frames, or a -ve error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) static inline int xen_remap_domain_mfn_array(struct vm_area_struct *vma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) unsigned long addr, xen_pfn_t *mfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) int nr, int *err_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) pgprot_t prot, unsigned int domid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) struct page **pages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) if (xen_feature(XENFEAT_auto_translated_physmap))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) return xen_remap_pfn(vma, addr, mfn, nr, err_ptr, prot, domid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) true, pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /* xen_remap_domain_gfn_range() - map a range of foreign frames
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * @vma: VMA to map the pages into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * @addr: Address at which to map the pages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) * @gfn: First GFN to map.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) * @nr: Number frames to map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) * @prot: page protection mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) * @domid: Domain owning the pages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * @pages: Array of pages if this domain has an auto-translated physmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * Returns the number of successfully mapped frames, or a -ve error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static inline int xen_remap_domain_gfn_range(struct vm_area_struct *vma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) unsigned long addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) xen_pfn_t gfn, int nr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) pgprot_t prot, unsigned int domid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) struct page **pages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) if (xen_feature(XENFEAT_auto_translated_physmap))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) return xen_remap_pfn(vma, addr, &gfn, nr, NULL, prot, domid, false,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) int numpgs, struct page **pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) unsigned long nr_grant_frames);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) void xen_efi_runtime_setup(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) #if defined(CONFIG_XEN_PV) && !defined(CONFIG_PREEMPTION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) DECLARE_PER_CPU(bool, xen_in_preemptible_hcall);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static inline void xen_preemptible_hcall_begin(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) __this_cpu_write(xen_in_preemptible_hcall, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) static inline void xen_preemptible_hcall_end(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) __this_cpu_write(xen_in_preemptible_hcall, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static inline void xen_preemptible_hcall_begin(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) static inline void xen_preemptible_hcall_end(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) #endif /* CONFIG_XEN_PV && !CONFIG_PREEMPTION */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) #endif /* INCLUDE_XEN_OPS_H */