Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Add new vGPU cap info bit VGT_CAPS_HUGE_GTT

This adds a new vGPU cap info bit VGT_CAPS_HUGE_GTT, which is to detect
whether the host supports shadowing of huge gtt pages. If host does
support it, remove the page sizes restriction for vGPU.

Signed-off-by: Changbin Du <changbin.du@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1525770425-5373-1-git-send-email-changbin.du@intel.com

authored by

Changbin Du and committed by
Joonas Lahtinen
52b2416c 6ceb7277

+9 -6
+2 -6
drivers/gpu/drm/i915/i915_gem.c
··· 5409 5409 { 5410 5410 int ret; 5411 5411 5412 - /* 5413 - * We need to fallback to 4K pages since gvt gtt handling doesn't 5414 - * support huge page entries - we will need to check either hypervisor 5415 - * mm can support huge guest page or just do emulation in gvt. 5416 - */ 5417 - if (intel_vgpu_active(dev_priv)) 5412 + /* We need to fallback to 4K pages if host doesn't support huge gtt. */ 5413 + if (intel_vgpu_active(dev_priv) && !intel_vgpu_has_huge_gtt(dev_priv)) 5418 5414 mkwrite_device_info(dev_priv)->page_sizes = 5419 5415 I915_GTT_PAGE_SIZE_4K; 5420 5416
+1
drivers/gpu/drm/i915/i915_pvinfo.h
··· 54 54 */ 55 55 #define VGT_CAPS_FULL_48BIT_PPGTT BIT(2) 56 56 #define VGT_CAPS_HWSP_EMULATION BIT(3) 57 + #define VGT_CAPS_HUGE_GTT BIT(4) 57 58 58 59 struct vgt_if { 59 60 u64 magic; /* VGT_MAGIC */
+6
drivers/gpu/drm/i915/i915_vgpu.h
··· 36 36 return dev_priv->vgpu.caps & VGT_CAPS_HWSP_EMULATION; 37 37 } 38 38 39 + static inline bool 40 + intel_vgpu_has_huge_gtt(struct drm_i915_private *dev_priv) 41 + { 42 + return dev_priv->vgpu.caps & VGT_CAPS_HUGE_GTT; 43 + } 44 + 39 45 int intel_vgt_balloon(struct drm_i915_private *dev_priv); 40 46 void intel_vgt_deballoon(struct drm_i915_private *dev_priv); 41 47