Commit 26f837e8 authored by Zhenyu Wang's avatar Zhenyu Wang

drm/i915: make intel_gvt_init() later instead of too early

Previously intel_gvt_init() was called very early even before
MMIO initialization which had several drawbacks:
- Have to handle MMIO access for initial MMIO state dump if golden
  state firmware is not available
- Hypervisor detection should depend on pvinfo only instead of detecting
  hypervisor status.
- Don't know hw resource size e.g aperture, ggtt size to determine
  for vGPU type, etc.

This trys to move intel_gvt_init() call late after required info
has already been initialized for GVT host.
Acked-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
parent 2c883136
...@@ -824,10 +824,6 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv, ...@@ -824,10 +824,6 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = intel_gvt_init(dev_priv);
if (ret < 0)
goto err_workqueues;
/* This must be called before any calls to HAS_PCH_* */ /* This must be called before any calls to HAS_PCH_* */
intel_detect_pch(dev_priv); intel_detect_pch(dev_priv);
...@@ -841,7 +837,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv, ...@@ -841,7 +837,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
intel_init_audio_hooks(dev_priv); intel_init_audio_hooks(dev_priv);
ret = i915_gem_load_init(dev_priv); ret = i915_gem_load_init(dev_priv);
if (ret < 0) if (ret < 0)
goto err_gvt; goto err_workqueues;
intel_display_crc_init(dev_priv); intel_display_crc_init(dev_priv);
...@@ -853,8 +849,6 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv, ...@@ -853,8 +849,6 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
return 0; return 0;
err_gvt:
intel_gvt_cleanup(dev_priv);
err_workqueues: err_workqueues:
i915_workqueues_cleanup(dev_priv); i915_workqueues_cleanup(dev_priv);
return ret; return ret;
...@@ -1077,6 +1071,10 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) ...@@ -1077,6 +1071,10 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
DRM_DEBUG_DRIVER("can't enable MSI"); DRM_DEBUG_DRIVER("can't enable MSI");
} }
ret = intel_gvt_init(dev_priv);
if (ret)
goto out_ggtt;
return 0; return 0;
out_ggtt: out_ggtt:
...@@ -1290,6 +1288,8 @@ void i915_driver_unload(struct drm_device *dev) ...@@ -1290,6 +1288,8 @@ void i915_driver_unload(struct drm_device *dev)
intel_display_power_get(dev_priv, POWER_DOMAIN_INIT); intel_display_power_get(dev_priv, POWER_DOMAIN_INIT);
intel_gvt_cleanup(dev_priv);
i915_driver_unregister(dev_priv); i915_driver_unregister(dev_priv);
drm_vblank_cleanup(dev); drm_vblank_cleanup(dev);
......
...@@ -67,6 +67,11 @@ int intel_gvt_init(struct drm_i915_private *dev_priv) ...@@ -67,6 +67,11 @@ int intel_gvt_init(struct drm_i915_private *dev_priv)
return 0; return 0;
} }
if (intel_vgpu_active(dev_priv)) {
DRM_DEBUG_DRIVER("GVT-g is disabled for guest\n");
goto bail;
}
if (!is_supported_device(dev_priv)) { if (!is_supported_device(dev_priv)) {
DRM_DEBUG_DRIVER("Unsupported device. GVT-g is disabled\n"); DRM_DEBUG_DRIVER("Unsupported device. GVT-g is disabled\n");
goto bail; goto bail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment