| .. | .. |
|---|
| 22 | 22 | */ |
|---|
| 23 | 23 | |
|---|
| 24 | 24 | #include "i915_drv.h" |
|---|
| 25 | +#include "i915_vgpu.h" |
|---|
| 25 | 26 | #include "intel_gvt.h" |
|---|
| 26 | 27 | |
|---|
| 27 | 28 | /** |
|---|
| .. | .. |
|---|
| 49 | 50 | return true; |
|---|
| 50 | 51 | if (IS_BROXTON(dev_priv)) |
|---|
| 51 | 52 | return true; |
|---|
| 53 | + if (IS_COFFEELAKE(dev_priv)) |
|---|
| 54 | + return true; |
|---|
| 55 | + if (IS_COMETLAKE(dev_priv)) |
|---|
| 56 | + return true; |
|---|
| 57 | + |
|---|
| 52 | 58 | return false; |
|---|
| 53 | 59 | } |
|---|
| 54 | 60 | |
|---|
| .. | .. |
|---|
| 60 | 66 | */ |
|---|
| 61 | 67 | void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) |
|---|
| 62 | 68 | { |
|---|
| 63 | | - if (!i915_modparams.enable_gvt) |
|---|
| 69 | + if (!dev_priv->params.enable_gvt) |
|---|
| 64 | 70 | return; |
|---|
| 65 | 71 | |
|---|
| 66 | 72 | if (intel_vgpu_active(dev_priv)) { |
|---|
| 67 | | - DRM_INFO("GVT-g is disabled for guest\n"); |
|---|
| 73 | + drm_info(&dev_priv->drm, "GVT-g is disabled for guest\n"); |
|---|
| 68 | 74 | goto bail; |
|---|
| 69 | 75 | } |
|---|
| 70 | 76 | |
|---|
| 71 | 77 | if (!is_supported_device(dev_priv)) { |
|---|
| 72 | | - DRM_INFO("Unsupported device. GVT-g is disabled\n"); |
|---|
| 78 | + drm_info(&dev_priv->drm, |
|---|
| 79 | + "Unsupported device. GVT-g is disabled\n"); |
|---|
| 73 | 80 | goto bail; |
|---|
| 74 | 81 | } |
|---|
| 75 | 82 | |
|---|
| 76 | 83 | return; |
|---|
| 77 | 84 | bail: |
|---|
| 78 | | - i915_modparams.enable_gvt = 0; |
|---|
| 85 | + dev_priv->params.enable_gvt = 0; |
|---|
| 79 | 86 | } |
|---|
| 80 | 87 | |
|---|
| 81 | 88 | /** |
|---|
| .. | .. |
|---|
| 92 | 99 | { |
|---|
| 93 | 100 | int ret; |
|---|
| 94 | 101 | |
|---|
| 95 | | - if (i915_inject_load_failure()) |
|---|
| 102 | + if (i915_inject_probe_failure(dev_priv)) |
|---|
| 96 | 103 | return -ENODEV; |
|---|
| 97 | 104 | |
|---|
| 98 | | - if (!i915_modparams.enable_gvt) { |
|---|
| 99 | | - DRM_DEBUG_DRIVER("GVT-g is disabled by kernel params\n"); |
|---|
| 105 | + if (!dev_priv->params.enable_gvt) { |
|---|
| 106 | + drm_dbg(&dev_priv->drm, |
|---|
| 107 | + "GVT-g is disabled by kernel params\n"); |
|---|
| 100 | 108 | return 0; |
|---|
| 101 | 109 | } |
|---|
| 102 | 110 | |
|---|
| 103 | | - if (USES_GUC_SUBMISSION(dev_priv)) { |
|---|
| 104 | | - DRM_ERROR("i915 GVT-g loading failed due to Graphics virtualization is not yet supported with GuC submission\n"); |
|---|
| 111 | + if (intel_uc_wants_guc_submission(&dev_priv->gt.uc)) { |
|---|
| 112 | + drm_err(&dev_priv->drm, |
|---|
| 113 | + "i915 GVT-g loading failed due to Graphics virtualization is not yet supported with GuC submission\n"); |
|---|
| 105 | 114 | return -EIO; |
|---|
| 106 | | - } |
|---|
| 107 | | - |
|---|
| 108 | | - /* |
|---|
| 109 | | - * We're not in host or fail to find a MPT module, disable GVT-g |
|---|
| 110 | | - */ |
|---|
| 111 | | - ret = intel_gvt_init_host(); |
|---|
| 112 | | - if (ret) { |
|---|
| 113 | | - DRM_DEBUG_DRIVER("Not in host or MPT modules not found\n"); |
|---|
| 114 | | - goto bail; |
|---|
| 115 | 115 | } |
|---|
| 116 | 116 | |
|---|
| 117 | 117 | ret = intel_gvt_init_device(dev_priv); |
|---|
| 118 | 118 | if (ret) { |
|---|
| 119 | | - DRM_DEBUG_DRIVER("Fail to init GVT device\n"); |
|---|
| 119 | + drm_dbg(&dev_priv->drm, "Fail to init GVT device\n"); |
|---|
| 120 | 120 | goto bail; |
|---|
| 121 | 121 | } |
|---|
| 122 | 122 | |
|---|
| 123 | 123 | return 0; |
|---|
| 124 | 124 | |
|---|
| 125 | 125 | bail: |
|---|
| 126 | | - i915_modparams.enable_gvt = 0; |
|---|
| 126 | + dev_priv->params.enable_gvt = 0; |
|---|
| 127 | 127 | return 0; |
|---|
| 128 | 128 | } |
|---|
| 129 | 129 | |
|---|
| 130 | +static inline bool intel_gvt_active(struct drm_i915_private *dev_priv) |
|---|
| 131 | +{ |
|---|
| 132 | + return dev_priv->gvt; |
|---|
| 133 | +} |
|---|
| 134 | + |
|---|
| 130 | 135 | /** |
|---|
| 131 | | - * intel_gvt_cleanup - cleanup GVT components when i915 driver is unloading |
|---|
| 136 | + * intel_gvt_driver_remove - cleanup GVT components when i915 driver is |
|---|
| 137 | + * unbinding |
|---|
| 132 | 138 | * @dev_priv: drm i915 private * |
|---|
| 133 | 139 | * |
|---|
| 134 | 140 | * This function is called at the i915 driver unloading stage, to shutdown |
|---|
| 135 | 141 | * GVT components and release the related resources. |
|---|
| 136 | 142 | */ |
|---|
| 137 | | -void intel_gvt_cleanup(struct drm_i915_private *dev_priv) |
|---|
| 143 | +void intel_gvt_driver_remove(struct drm_i915_private *dev_priv) |
|---|
| 138 | 144 | { |
|---|
| 139 | 145 | if (!intel_gvt_active(dev_priv)) |
|---|
| 140 | 146 | return; |
|---|