xen-ops.h 3.4 KB

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