Commit e3b1895f authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915/vgpu: Neuter forcewakes for VGPU more thoroughly

If we avoid initializing forcewake domains when running as
a guest, and also use gen2 mmio accessors in that case, we
can avoid the timer traffic and any looping through the
forcewake code which is currently just so it can end up in
the no-op forcewake implementation.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Weinan Li <weinan.z.li@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Tested-by: default avatarTerrence Xu <terrence.xu@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170310095747.12258-1-tvrtko.ursulin@linux.intel.com
[tursulin: commit spelling fix]
parent fa7e8b55
...@@ -137,13 +137,6 @@ fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma ...@@ -137,13 +137,6 @@ fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma
dev_priv->uncore.fw_domains_active &= ~fw_domains; dev_priv->uncore.fw_domains_active &= ~fw_domains;
} }
static void
vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
enum forcewake_domains fw_domains)
{
/* Guest driver doesn't need to takes care forcewake. */
}
static void static void
fw_domains_posting_read(struct drm_i915_private *dev_priv) fw_domains_posting_read(struct drm_i915_private *dev_priv)
{ {
...@@ -1187,7 +1180,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv, ...@@ -1187,7 +1180,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv) static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
{ {
if (INTEL_INFO(dev_priv)->gen <= 5) if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))
return; return;
if (IS_GEN9(dev_priv)) { if (IS_GEN9(dev_priv)) {
...@@ -1273,11 +1266,6 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv) ...@@ -1273,11 +1266,6 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
FORCEWAKE, FORCEWAKE_ACK); FORCEWAKE, FORCEWAKE_ACK);
} }
if (intel_vgpu_active(dev_priv)) {
dev_priv->uncore.funcs.force_wake_get = vgpu_fw_domains_nop;
dev_priv->uncore.funcs.force_wake_put = vgpu_fw_domains_nop;
}
/* All future platforms are expected to require complex power gating */ /* All future platforms are expected to require complex power gating */
WARN_ON(dev_priv->uncore.fw_domains == 0); WARN_ON(dev_priv->uncore.fw_domains == 0);
} }
...@@ -1327,22 +1315,22 @@ void intel_uncore_init(struct drm_i915_private *dev_priv) ...@@ -1327,22 +1315,22 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
dev_priv->uncore.pmic_bus_access_nb.notifier_call = dev_priv->uncore.pmic_bus_access_nb.notifier_call =
i915_pmic_bus_access_notifier; i915_pmic_bus_access_notifier;
switch (INTEL_INFO(dev_priv)->gen) { if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {
default: ASSIGN_WRITE_MMIO_VFUNCS(gen2);
case 9: ASSIGN_READ_MMIO_VFUNCS(gen2);
ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges); } else if (IS_GEN5(dev_priv)) {
ASSIGN_WRITE_MMIO_VFUNCS(fwtable); ASSIGN_WRITE_MMIO_VFUNCS(gen5);
ASSIGN_READ_MMIO_VFUNCS(gen5);
} else if (IS_GEN(dev_priv, 6, 7)) {
ASSIGN_WRITE_MMIO_VFUNCS(gen6);
if (IS_VALLEYVIEW(dev_priv)) {
ASSIGN_FW_DOMAINS_TABLE(__vlv_fw_ranges);
ASSIGN_READ_MMIO_VFUNCS(fwtable); ASSIGN_READ_MMIO_VFUNCS(fwtable);
if (HAS_DECOUPLED_MMIO(dev_priv)) { } else {
dev_priv->uncore.funcs.mmio_readl = ASSIGN_READ_MMIO_VFUNCS(gen6);
gen9_decoupled_read32;
dev_priv->uncore.funcs.mmio_readq =
gen9_decoupled_read64;
dev_priv->uncore.funcs.mmio_writel =
gen9_decoupled_write32;
} }
break; } else if (IS_GEN8(dev_priv)) {
case 8:
if (IS_CHERRYVIEW(dev_priv)) { if (IS_CHERRYVIEW(dev_priv)) {
ASSIGN_FW_DOMAINS_TABLE(__chv_fw_ranges); ASSIGN_FW_DOMAINS_TABLE(__chv_fw_ranges);
ASSIGN_WRITE_MMIO_VFUNCS(fwtable); ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
...@@ -1352,28 +1340,18 @@ void intel_uncore_init(struct drm_i915_private *dev_priv) ...@@ -1352,28 +1340,18 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
ASSIGN_WRITE_MMIO_VFUNCS(gen8); ASSIGN_WRITE_MMIO_VFUNCS(gen8);
ASSIGN_READ_MMIO_VFUNCS(gen6); ASSIGN_READ_MMIO_VFUNCS(gen6);
} }
break;
case 7:
case 6:
ASSIGN_WRITE_MMIO_VFUNCS(gen6);
if (IS_VALLEYVIEW(dev_priv)) {
ASSIGN_FW_DOMAINS_TABLE(__vlv_fw_ranges);
ASSIGN_READ_MMIO_VFUNCS(fwtable);
} else { } else {
ASSIGN_READ_MMIO_VFUNCS(gen6); ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);
ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
ASSIGN_READ_MMIO_VFUNCS(fwtable);
if (HAS_DECOUPLED_MMIO(dev_priv)) {
dev_priv->uncore.funcs.mmio_readl =
gen9_decoupled_read32;
dev_priv->uncore.funcs.mmio_readq =
gen9_decoupled_read64;
dev_priv->uncore.funcs.mmio_writel =
gen9_decoupled_write32;
} }
break;
case 5:
ASSIGN_WRITE_MMIO_VFUNCS(gen5);
ASSIGN_READ_MMIO_VFUNCS(gen5);
break;
case 4:
case 3:
case 2:
ASSIGN_WRITE_MMIO_VFUNCS(gen2);
ASSIGN_READ_MMIO_VFUNCS(gen2);
break;
} }
iosf_mbi_register_pmic_bus_access_notifier( iosf_mbi_register_pmic_bus_access_notifier(
......
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