i915_pvinfo.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * Copyright(c) 2011-2016 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_PVINFO_H_
  24. #define _I915_PVINFO_H_
  25. #include <linux/types.h>
  26. /* The MMIO offset of the shared info between guest and host emulator */
  27. #define VGT_PVINFO_PAGE 0x78000
  28. #define VGT_PVINFO_SIZE 0x1000
  29. /*
  30. * The following structure pages are defined in GEN MMIO space
  31. * for virtualization. (One page for now)
  32. */
  33. #define VGT_MAGIC 0x4776544776544776ULL /* 'vGTvGTvG' */
  34. #define VGT_VERSION_MAJOR 1
  35. #define VGT_VERSION_MINOR 0
  36. /*
  37. * notifications from guest to vgpu device model
  38. */
  39. enum vgt_g2v_type {
  40. VGT_G2V_PPGTT_L3_PAGE_TABLE_CREATE = 2,
  41. VGT_G2V_PPGTT_L3_PAGE_TABLE_DESTROY,
  42. VGT_G2V_PPGTT_L4_PAGE_TABLE_CREATE,
  43. VGT_G2V_PPGTT_L4_PAGE_TABLE_DESTROY,
  44. VGT_G2V_EXECLIST_CONTEXT_CREATE,
  45. VGT_G2V_EXECLIST_CONTEXT_DESTROY,
  46. VGT_G2V_MAX,
  47. };
  48. /*
  49. * VGT capabilities type
  50. */
  51. #define VGT_CAPS_FULL_PPGTT BIT(2)
  52. #define VGT_CAPS_HWSP_EMULATION BIT(3)
  53. #define VGT_CAPS_HUGE_GTT BIT(4)
  54. struct vgt_if {
  55. u64 magic; /* VGT_MAGIC */
  56. u16 version_major;
  57. u16 version_minor;
  58. u32 vgt_id; /* ID of vGT instance */
  59. u32 vgt_caps; /* VGT capabilities */
  60. u32 rsv1[11]; /* pad to offset 0x40 */
  61. /*
  62. * Data structure to describe the balooning info of resources.
  63. * Each VM can only have one portion of continuous area for now.
  64. * (May support scattered resource in future)
  65. * (starting from offset 0x40)
  66. */
  67. struct {
  68. /* Aperture register balooning */
  69. struct {
  70. u32 base;
  71. u32 size;
  72. } mappable_gmadr; /* aperture */
  73. /* GMADR register balooning */
  74. struct {
  75. u32 base;
  76. u32 size;
  77. } nonmappable_gmadr; /* non aperture */
  78. /* allowed fence registers */
  79. u32 fence_num;
  80. u32 rsv2[3];
  81. } avail_rs; /* available/assigned resource */
  82. u32 rsv3[0x200 - 24]; /* pad to half page */
  83. /*
  84. * The bottom half page is for response from Gfx driver to hypervisor.
  85. */
  86. u32 rsv4;
  87. u32 display_ready; /* ready for display owner switch */
  88. u32 rsv5[4];
  89. u32 g2v_notify;
  90. u32 rsv6[5];
  91. u32 cursor_x_hot;
  92. u32 cursor_y_hot;
  93. struct {
  94. u32 lo;
  95. u32 hi;
  96. } pdp[4];
  97. u32 execlist_context_descriptor_lo;
  98. u32 execlist_context_descriptor_hi;
  99. u32 rsv7[0x200 - 24]; /* pad to one page */
  100. } __packed;
  101. #define vgtif_offset(x) (offsetof(struct vgt_if, x))
  102. #define vgtif_reg(x) _MMIO(VGT_PVINFO_PAGE + vgtif_offset(x))
  103. /* vGPU display status to be used by the host side */
  104. #define VGT_DRV_DISPLAY_NOT_READY 0
  105. #define VGT_DRV_DISPLAY_READY 1 /* ready for display switch */
  106. #endif /* _I915_PVINFO_H_ */