xen-ops.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef INCLUDE_XEN_OPS_H
  2. #define INCLUDE_XEN_OPS_H
  3. #include <linux/percpu.h>
  4. #include <linux/notifier.h>
  5. #include <linux/efi.h>
  6. #include <asm/xen/interface.h>
  7. DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
  8. void xen_arch_pre_suspend(void);
  9. void xen_arch_post_suspend(int suspend_cancelled);
  10. void xen_timer_resume(void);
  11. void xen_arch_resume(void);
  12. void xen_resume_notifier_register(struct notifier_block *nb);
  13. void xen_resume_notifier_unregister(struct notifier_block *nb);
  14. int xen_setup_shutdown_event(void);
  15. extern unsigned long *xen_contiguous_bitmap;
  16. int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
  17. unsigned int address_bits,
  18. dma_addr_t *dma_handle);
  19. void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order);
  20. struct vm_area_struct;
  21. /*
  22. * xen_remap_domain_mfn_array() - map an array of foreign frames
  23. * @vma: VMA to map the pages into
  24. * @addr: Address at which to map the pages
  25. * @gfn: Array of GFNs to map
  26. * @nr: Number entries in the GFN array
  27. * @err_ptr: Returns per-GFN error status.
  28. * @prot: page protection mask
  29. * @domid: Domain owning the pages
  30. * @pages: Array of pages if this domain has an auto-translated physmap
  31. *
  32. * @gfn and @err_ptr may point to the same buffer, the GFNs will be
  33. * overwritten by the error codes after they are mapped.
  34. *
  35. * Returns the number of successfully mapped frames, or a -ve error
  36. * code.
  37. */
  38. int xen_remap_domain_mfn_array(struct vm_area_struct *vma,
  39. unsigned long addr,
  40. xen_pfn_t *gfn, int nr,
  41. int *err_ptr, pgprot_t prot,
  42. unsigned domid,
  43. struct page **pages);
  44. /* xen_remap_domain_mfn_range() - map a range of foreign frames
  45. * @vma: VMA to map the pages into
  46. * @addr: Address at which to map the pages
  47. * @gfn: First GFN to map.
  48. * @nr: Number frames to map
  49. * @prot: page protection mask
  50. * @domid: Domain owning the pages
  51. * @pages: Array of pages if this domain has an auto-translated physmap
  52. *
  53. * Returns the number of successfully mapped frames, or a -ve error
  54. * code.
  55. */
  56. int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
  57. unsigned long addr,
  58. xen_pfn_t gfn, int nr,
  59. pgprot_t prot, unsigned domid,
  60. struct page **pages);
  61. int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
  62. int numpgs, struct page **pages);
  63. int xen_xlate_remap_gfn_array(struct vm_area_struct *vma,
  64. unsigned long addr,
  65. xen_pfn_t *gfn, int nr,
  66. int *err_ptr, pgprot_t prot,
  67. unsigned domid,
  68. struct page **pages);
  69. int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma,
  70. int nr, struct page **pages);
  71. bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
  72. #ifdef CONFIG_XEN_EFI
  73. extern efi_system_table_t *xen_efi_probe(void);
  74. #else
  75. static inline efi_system_table_t __init *xen_efi_probe(void)
  76. {
  77. return NULL;
  78. }
  79. #endif
  80. #ifdef CONFIG_PREEMPT
  81. static inline void xen_preemptible_hcall_begin(void)
  82. {
  83. }
  84. static inline void xen_preemptible_hcall_end(void)
  85. {
  86. }
  87. #else
  88. DECLARE_PER_CPU(bool, xen_in_preemptible_hcall);
  89. static inline void xen_preemptible_hcall_begin(void)
  90. {
  91. __this_cpu_write(xen_in_preemptible_hcall, true);
  92. }
  93. static inline void xen_preemptible_hcall_end(void)
  94. {
  95. __this_cpu_write(xen_in_preemptible_hcall, false);
  96. }
  97. #endif /* CONFIG_PREEMPT */
  98. #endif /* INCLUDE_XEN_OPS_H */