From: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> When we query the available eu on each subslice, we currently only report the max. It would also be useful to report the minimum found as well. When we set RPCS (power gating over the EU), we can also specify both the min and max number of eu to configure on each slice; currently we just set it to a single value, but the flexibility may be beneficial in future. Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@xxxxxxxxx> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/i915_debugfs.c | 36 +++++++++++++++++++++++--------- drivers/gpu/drm/i915/i915_drv.h | 3 ++- drivers/gpu/drm/i915/intel_device_info.c | 32 +++++++++++++++++----------- drivers/gpu/drm/i915/intel_lrc.c | 4 ++-- 4 files changed, 50 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 13fc25997d65..fb77ad49d327 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -4547,6 +4547,7 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_cache_sharing_fops, static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv, struct sseu_dev_info *sseu) { + unsigned int min_eu_per_subslice, max_eu_per_subslice; int ss_max = 2; int ss; u32 sig1[ss_max], sig2[ss_max]; @@ -4556,6 +4557,9 @@ static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv, sig2[0] = I915_READ(CHV_POWER_SS0_SIG2); sig2[1] = I915_READ(CHV_POWER_SS1_SIG2); + min_eu_per_subslice = ~0u; + max_eu_per_subslice = 0; + for (ss = 0; ss < ss_max; ss++) { unsigned int eu_cnt; @@ -4570,14 +4574,18 @@ static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv, ((sig1[ss] & CHV_EU210_PG_ENABLE) ? 0 : 2) + ((sig2[ss] & CHV_EU311_PG_ENABLE) ? 0 : 2); sseu->eu_total += eu_cnt; - sseu->eu_per_subslice = max_t(unsigned int, - sseu->eu_per_subslice, eu_cnt); + min_eu_per_subslice = min(min_eu_per_subslice, eu_cnt); + max_eu_per_subslice = max(max_eu_per_subslice, eu_cnt); } + + sseu->min_eu_per_subslice = min_eu_per_subslice; + sseu->max_eu_per_subslice = max_eu_per_subslice; } static void gen9_sseu_device_status(struct drm_i915_private *dev_priv, struct sseu_dev_info *sseu) { + unsigned int min_eu_per_subslice, max_eu_per_subslice; int s_max = 3, ss_max = 4; int s, ss; u32 s_reg[s_max], eu_reg[2*s_max], eu_mask[2]; @@ -4603,6 +4611,9 @@ static void gen9_sseu_device_status(struct drm_i915_private *dev_priv, GEN9_PGCTL_SSB_EU210_ACK | GEN9_PGCTL_SSB_EU311_ACK; + min_eu_per_subslice = ~0u; + max_eu_per_subslice = 0; + for (s = 0; s < s_max; s++) { if ((s_reg[s] & GEN9_PGCTL_SLICE_ACK) == 0) /* skip disabled slice */ @@ -4628,11 +4639,14 @@ static void gen9_sseu_device_status(struct drm_i915_private *dev_priv, eu_cnt = 2 * hweight32(eu_reg[2*s + ss/2] & eu_mask[ss%2]); sseu->eu_total += eu_cnt; - sseu->eu_per_subslice = max_t(unsigned int, - sseu->eu_per_subslice, - eu_cnt); + + min_eu_per_subslice = min(min_eu_per_subslice, eu_cnt); + max_eu_per_subslice = max(max_eu_per_subslice, eu_cnt); } } + + sseu->min_eu_per_subslice = min_eu_per_subslice; + sseu->max_eu_per_subslice = max_eu_per_subslice; } static void broadwell_sseu_device_status(struct drm_i915_private *dev_priv, @@ -4645,9 +4659,11 @@ static void broadwell_sseu_device_status(struct drm_i915_private *dev_priv, if (sseu->slice_mask) { sseu->subslice_mask = INTEL_INFO(dev_priv)->sseu.subslice_mask; - sseu->eu_per_subslice = - INTEL_INFO(dev_priv)->sseu.eu_per_subslice; - sseu->eu_total = sseu->eu_per_subslice * + sseu->min_eu_per_subslice = + INTEL_INFO(dev_priv)->sseu.min_eu_per_subslice; + sseu->max_eu_per_subslice = + INTEL_INFO(dev_priv)->sseu.max_eu_per_subslice; + sseu->eu_total = sseu->max_eu_per_subslice * sseu_subslice_total(sseu); /* subtract fused off EU(s) from enabled slice(s) */ @@ -4678,8 +4694,8 @@ static void i915_print_sseu_info(struct seq_file *m, bool is_available_info, hweight8(sseu->subslice_mask)); seq_printf(m, " %s EU Total: %u\n", type, sseu->eu_total); - seq_printf(m, " %s EU Per Subslice: %u\n", type, - sseu->eu_per_subslice); + seq_printf(m, " %s EU Per Subslice: [%u, %u]\n", type, + sseu->min_eu_per_subslice, sseu->max_eu_per_subslice); if (!is_available_info) return; diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 60c63f141a47..2902a0251484 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -803,7 +803,8 @@ struct sseu_dev_info { u8 slice_mask; u8 subslice_mask; u8 eu_total; - u8 eu_per_subslice; + u8 min_eu_per_subslice; + u8 max_eu_per_subslice; u8 min_eu_in_pool; /* For each slice, which subslice(s) has(have) 7 EUs (bitfield)? */ u8 subslice_7eu[3]; diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c index fdf9b54b71e9..306512688367 100644 --- a/drivers/gpu/drm/i915/intel_device_info.c +++ b/drivers/gpu/drm/i915/intel_device_info.c @@ -85,6 +85,7 @@ void intel_device_info_dump(struct drm_i915_private *dev_priv) static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv) { struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu; + unsigned int eu_per_subslice; u32 fuse, eu_dis; fuse = I915_READ(CHV_FUSE_GT); @@ -109,9 +110,10 @@ static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv) * CHV expected to always have a uniform distribution of EU * across subslices. */ - sseu->eu_per_subslice = sseu_subslice_total(sseu) ? - sseu->eu_total / sseu_subslice_total(sseu) : - 0; + eu_per_subslice = sseu_subslice_total(sseu) ? + sseu->eu_total / sseu_subslice_total(sseu) : 0; + sseu->min_eu_per_subslice = eu_per_subslice; + sseu->max_eu_per_subslice = eu_per_subslice; /* * CHV supports subslice power gating on devices with more than * one subslice, and supports EU power gating on devices with @@ -119,13 +121,14 @@ static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv) */ sseu->has_slice_pg = 0; sseu->has_subslice_pg = sseu_subslice_total(sseu) > 1; - sseu->has_eu_pg = (sseu->eu_per_subslice > 2); + sseu->has_eu_pg = eu_per_subslice > 2; } static void gen9_sseu_info_init(struct drm_i915_private *dev_priv) { struct intel_device_info *info = mkwrite_device_info(dev_priv); struct sseu_dev_info *sseu = &info->sseu; + unsigned int eu_per_subslice; int s_max = 3, ss_max = 4, eu_max = 8; int s, ss; u32 fuse2, eu_disable; @@ -181,9 +184,10 @@ static void gen9_sseu_info_init(struct drm_i915_private *dev_priv) * recovery. BXT is expected to be perfectly uniform in EU * distribution. */ - sseu->eu_per_subslice = sseu_subslice_total(sseu) ? - DIV_ROUND_UP(sseu->eu_total, - sseu_subslice_total(sseu)) : 0; + eu_per_subslice = sseu_subslice_total(sseu) ? + DIV_ROUND_UP(sseu->eu_total, sseu_subslice_total(sseu)) : 0; + sseu->min_eu_per_subslice = eu_per_subslice; + sseu->max_eu_per_subslice = eu_per_subslice; /* * SKL+ supports slice power gating on devices with more than * one slice, and supports EU power gating on devices with @@ -196,7 +200,7 @@ static void gen9_sseu_info_init(struct drm_i915_private *dev_priv) !IS_GEN9_LP(dev_priv) && hweight8(sseu->slice_mask) > 1; sseu->has_subslice_pg = IS_GEN9_LP(dev_priv) && sseu_subslice_total(sseu) > 1; - sseu->has_eu_pg = sseu->eu_per_subslice > 2; + sseu->has_eu_pg = eu_per_subslice > 2; if (IS_GEN9_LP(dev_priv)) { #define IS_SS_DISABLED(ss) (!(sseu->subslice_mask & BIT(ss))) @@ -229,6 +233,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv) { struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu; const int s_max = 3, ss_max = 3, eu_max = 8; + unsigned int eu_per_subslice; int s, ss; u32 fuse2, eu_disable[3]; /* s_max */ @@ -283,9 +288,10 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv) * subslices with the exception that any one EU in any one subslice may * be fused off for die recovery. */ - sseu->eu_per_subslice = sseu_subslice_total(sseu) ? - DIV_ROUND_UP(sseu->eu_total, - sseu_subslice_total(sseu)) : 0; + eu_per_subslice = sseu_subslice_total(sseu) ? + DIV_ROUND_UP(sseu->eu_total, sseu_subslice_total(sseu)) : 0; + sseu->min_eu_per_subslice = eu_per_subslice; + sseu->max_eu_per_subslice = eu_per_subslice; /* * BDW supports slice power gating on devices with more than @@ -420,7 +426,9 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv) DRM_DEBUG_DRIVER("subslice per slice: %u\n", hweight8(info->sseu.subslice_mask)); DRM_DEBUG_DRIVER("EU total: %u\n", info->sseu.eu_total); - DRM_DEBUG_DRIVER("EU per subslice: %u\n", info->sseu.eu_per_subslice); + DRM_DEBUG_DRIVER("EU per subslice: [%u, %u]\n", + info->sseu.min_eu_per_subslice, + info->sseu.max_eu_per_subslice); DRM_DEBUG_DRIVER("has slice power gating: %s\n", info->sseu.has_slice_pg ? "y" : "n"); DRM_DEBUG_DRIVER("has subslice power gating: %s\n", diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 955c87999280..341a4205f480 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -1922,9 +1922,9 @@ make_rpcs(struct drm_i915_private *dev_priv) } if (INTEL_INFO(dev_priv)->sseu.has_eu_pg) { - rpcs |= INTEL_INFO(dev_priv)->sseu.eu_per_subslice << + rpcs |= INTEL_INFO(dev_priv)->sseu.min_eu_per_subslice << GEN8_RPCS_EU_MIN_SHIFT; - rpcs |= INTEL_INFO(dev_priv)->sseu.eu_per_subslice << + rpcs |= INTEL_INFO(dev_priv)->sseu.max_eu_per_subslice << GEN8_RPCS_EU_MAX_SHIFT; rpcs |= GEN8_RPCS_ENABLE; } -- 2.14.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx