i915_vgpu.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright(c) 2011-2015 Intel Corporation. All rights reserved.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. */
  23. #ifndef _I915_VGPU_H_
  24. #define _I915_VGPU_H_
  25. /* The MMIO offset of the shared info between guest and host emulator */
  26. #define VGT_PVINFO_PAGE 0x78000
  27. #define VGT_PVINFO_SIZE 0x1000
  28. /*
  29. * The following structure pages are defined in GEN MMIO space
  30. * for virtualization. (One page for now)
  31. */
  32. #define VGT_MAGIC 0x4776544776544776ULL /* 'vGTvGTvG' */
  33. #define VGT_VERSION_MAJOR 1
  34. #define VGT_VERSION_MINOR 0
  35. #define INTEL_VGT_IF_VERSION_ENCODE(major, minor) ((major) << 16 | (minor))
  36. #define INTEL_VGT_IF_VERSION \
  37. INTEL_VGT_IF_VERSION_ENCODE(VGT_VERSION_MAJOR, VGT_VERSION_MINOR)
  38. struct vgt_if {
  39. uint64_t magic; /* VGT_MAGIC */
  40. uint16_t version_major;
  41. uint16_t version_minor;
  42. uint32_t vgt_id; /* ID of vGT instance */
  43. uint32_t rsv1[12]; /* pad to offset 0x40 */
  44. /*
  45. * Data structure to describe the balooning info of resources.
  46. * Each VM can only have one portion of continuous area for now.
  47. * (May support scattered resource in future)
  48. * (starting from offset 0x40)
  49. */
  50. struct {
  51. /* Aperture register balooning */
  52. struct {
  53. uint32_t base;
  54. uint32_t size;
  55. } mappable_gmadr; /* aperture */
  56. /* GMADR register balooning */
  57. struct {
  58. uint32_t base;
  59. uint32_t size;
  60. } nonmappable_gmadr; /* non aperture */
  61. /* allowed fence registers */
  62. uint32_t fence_num;
  63. uint32_t rsv2[3];
  64. } avail_rs; /* available/assigned resource */
  65. uint32_t rsv3[0x200 - 24]; /* pad to half page */
  66. /*
  67. * The bottom half page is for response from Gfx driver to hypervisor.
  68. * Set to reserved fields temporarily by now.
  69. */
  70. uint32_t rsv4;
  71. uint32_t display_ready; /* ready for display owner switch */
  72. uint32_t rsv5[0x200 - 2]; /* pad to one page */
  73. } __packed;
  74. #define vgtif_reg(x) \
  75. (VGT_PVINFO_PAGE + (long)&((struct vgt_if *)NULL)->x)
  76. /* vGPU display status to be used by the host side */
  77. #define VGT_DRV_DISPLAY_NOT_READY 0
  78. #define VGT_DRV_DISPLAY_READY 1 /* ready for display switch */
  79. extern void i915_check_vgpu(struct drm_device *dev);
  80. extern int intel_vgt_balloon(struct drm_device *dev);
  81. extern void intel_vgt_deballoon(void);
  82. #endif /* _I915_VGPU_H_ */