xen-ops.h 3.5 KB

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