1 1.1 riastrad /* $NetBSD: i915_pvinfo.h,v 1.2 2021/12/18 23:45:28 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /* 4 1.1 riastrad * Copyright(c) 2011-2016 Intel Corporation. All rights reserved. 5 1.1 riastrad * 6 1.1 riastrad * Permission is hereby granted, free of charge, to any person obtaining a 7 1.1 riastrad * copy of this software and associated documentation files (the "Software"), 8 1.1 riastrad * to deal in the Software without restriction, including without limitation 9 1.1 riastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 1.1 riastrad * and/or sell copies of the Software, and to permit persons to whom the 11 1.1 riastrad * Software is furnished to do so, subject to the following conditions: 12 1.1 riastrad * 13 1.1 riastrad * The above copyright notice and this permission notice (including the next 14 1.1 riastrad * paragraph) shall be included in all copies or substantial portions of the 15 1.1 riastrad * Software. 16 1.1 riastrad * 17 1.1 riastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 1.1 riastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 1.1 riastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 1.1 riastrad * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 1.1 riastrad * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 1.1 riastrad * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 1.1 riastrad * SOFTWARE. 24 1.1 riastrad */ 25 1.1 riastrad 26 1.1 riastrad #ifndef _I915_PVINFO_H_ 27 1.1 riastrad #define _I915_PVINFO_H_ 28 1.1 riastrad 29 1.1 riastrad #include <linux/types.h> 30 1.1 riastrad 31 1.1 riastrad /* The MMIO offset of the shared info between guest and host emulator */ 32 1.1 riastrad #define VGT_PVINFO_PAGE 0x78000 33 1.1 riastrad #define VGT_PVINFO_SIZE 0x1000 34 1.1 riastrad 35 1.1 riastrad /* 36 1.1 riastrad * The following structure pages are defined in GEN MMIO space 37 1.1 riastrad * for virtualization. (One page for now) 38 1.1 riastrad */ 39 1.1 riastrad #define VGT_MAGIC 0x4776544776544776ULL /* 'vGTvGTvG' */ 40 1.1 riastrad #define VGT_VERSION_MAJOR 1 41 1.1 riastrad #define VGT_VERSION_MINOR 0 42 1.1 riastrad 43 1.1 riastrad /* 44 1.1 riastrad * notifications from guest to vgpu device model 45 1.1 riastrad */ 46 1.1 riastrad enum vgt_g2v_type { 47 1.1 riastrad VGT_G2V_PPGTT_L3_PAGE_TABLE_CREATE = 2, 48 1.1 riastrad VGT_G2V_PPGTT_L3_PAGE_TABLE_DESTROY, 49 1.1 riastrad VGT_G2V_PPGTT_L4_PAGE_TABLE_CREATE, 50 1.1 riastrad VGT_G2V_PPGTT_L4_PAGE_TABLE_DESTROY, 51 1.1 riastrad VGT_G2V_EXECLIST_CONTEXT_CREATE, 52 1.1 riastrad VGT_G2V_EXECLIST_CONTEXT_DESTROY, 53 1.1 riastrad VGT_G2V_MAX, 54 1.1 riastrad }; 55 1.1 riastrad 56 1.1 riastrad /* 57 1.1 riastrad * VGT capabilities type 58 1.1 riastrad */ 59 1.1 riastrad #define VGT_CAPS_FULL_PPGTT BIT(2) 60 1.1 riastrad #define VGT_CAPS_HWSP_EMULATION BIT(3) 61 1.1 riastrad #define VGT_CAPS_HUGE_GTT BIT(4) 62 1.1 riastrad 63 1.1 riastrad struct vgt_if { 64 1.1 riastrad u64 magic; /* VGT_MAGIC */ 65 1.1 riastrad u16 version_major; 66 1.1 riastrad u16 version_minor; 67 1.1 riastrad u32 vgt_id; /* ID of vGT instance */ 68 1.1 riastrad u32 vgt_caps; /* VGT capabilities */ 69 1.1 riastrad u32 rsv1[11]; /* pad to offset 0x40 */ 70 1.1 riastrad /* 71 1.1 riastrad * Data structure to describe the balooning info of resources. 72 1.1 riastrad * Each VM can only have one portion of continuous area for now. 73 1.1 riastrad * (May support scattered resource in future) 74 1.1 riastrad * (starting from offset 0x40) 75 1.1 riastrad */ 76 1.1 riastrad struct { 77 1.1 riastrad /* Aperture register balooning */ 78 1.1 riastrad struct { 79 1.1 riastrad u32 base; 80 1.1 riastrad u32 size; 81 1.1 riastrad } mappable_gmadr; /* aperture */ 82 1.1 riastrad /* GMADR register balooning */ 83 1.1 riastrad struct { 84 1.1 riastrad u32 base; 85 1.1 riastrad u32 size; 86 1.1 riastrad } nonmappable_gmadr; /* non aperture */ 87 1.1 riastrad /* allowed fence registers */ 88 1.1 riastrad u32 fence_num; 89 1.1 riastrad u32 rsv2[3]; 90 1.1 riastrad } avail_rs; /* available/assigned resource */ 91 1.1 riastrad u32 rsv3[0x200 - 24]; /* pad to half page */ 92 1.1 riastrad /* 93 1.1 riastrad * The bottom half page is for response from Gfx driver to hypervisor. 94 1.1 riastrad */ 95 1.1 riastrad u32 rsv4; 96 1.1 riastrad u32 display_ready; /* ready for display owner switch */ 97 1.1 riastrad 98 1.1 riastrad u32 rsv5[4]; 99 1.1 riastrad 100 1.1 riastrad u32 g2v_notify; 101 1.1 riastrad u32 rsv6[5]; 102 1.1 riastrad 103 1.1 riastrad u32 cursor_x_hot; 104 1.1 riastrad u32 cursor_y_hot; 105 1.1 riastrad 106 1.1 riastrad struct { 107 1.1 riastrad u32 lo; 108 1.1 riastrad u32 hi; 109 1.1 riastrad } pdp[4]; 110 1.1 riastrad 111 1.1 riastrad u32 execlist_context_descriptor_lo; 112 1.1 riastrad u32 execlist_context_descriptor_hi; 113 1.1 riastrad 114 1.1 riastrad u32 rsv7[0x200 - 24]; /* pad to one page */ 115 1.1 riastrad } __packed; 116 1.1 riastrad 117 1.1 riastrad #define vgtif_offset(x) (offsetof(struct vgt_if, x)) 118 1.1 riastrad 119 1.1 riastrad #define vgtif_reg(x) _MMIO(VGT_PVINFO_PAGE + vgtif_offset(x)) 120 1.1 riastrad 121 1.1 riastrad /* vGPU display status to be used by the host side */ 122 1.1 riastrad #define VGT_DRV_DISPLAY_NOT_READY 0 123 1.1 riastrad #define VGT_DRV_DISPLAY_READY 1 /* ready for display switch */ 124 1.1 riastrad 125 1.1 riastrad #endif /* _I915_PVINFO_H_ */ 126