public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Oscar Mateo <oscar.mateo@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/cnl: Fix SSEU Device Status.
Date: Fri, 22 Sep 2017 09:44:38 -0700	[thread overview]
Message-ID: <73eeca87-e110-4d78-0d06-711b06cd7f85@intel.com> (raw)
In-Reply-To: <20170922131519.2480-1-rodrigo.vivi@intel.com>



On 09/22/2017 06:15 AM, Rodrigo Vivi wrote:
> CNL adds an extra register for slice/subslice information.
> Although no SKU is planed with an extra slice let's already
> handle this extra piece of information so we don't have the
> risk in future of getting a part that might have chosen this
> part of the die instead of other slices or anything like that.
>
> Also if subslice is disabled the information of eu ack for that
> is garbage, so let's skip checks for eu if subslice is disabled
> as we skip the subslice if slice is disabled.
>
> The rest is pretty much like gen9.
>
> v2: Remove IS_CANNONLAKE from gen9 status function.
>
> v3: Consider s_max = 6 and ss_max=4 to run over all possible
>      slices and subslices possible by spec. Although no real
>      hardware will have that many slices/subslices.
>      To match with sseu info init.
> v4: Fix offset calculation for slices 4 and 5.
>      Removed Oscar's rv-b since this change also needs review.
>
> Cc: Oscar Mateo <oscar.mateo@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_debugfs.c | 54 +++++++++++++++++++++++++++++++++++--
>   drivers/gpu/drm/i915/i915_reg.h     |  6 +++++
>   2 files changed, 58 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index ca6fa6d122c6..e197e5d99277 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -4575,6 +4575,54 @@ static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv,
>   	}
>   }
>   
> +static void gen10_sseu_device_status(struct drm_i915_private *dev_priv,
> +				     struct sseu_dev_info *sseu)
> +{
> +	const struct intel_device_info *info = INTEL_INFO(dev_priv);
> +	int s_max = 6, ss_max = 4;
> +	int s, ss;
> +	u32 s_reg[s_max], eu_reg[2 * s_max], eu_mask[2];
> +
> +	for (s = 0; s < s_max; s++) {
> +		s_reg[s] = I915_READ(GEN10_SLICE_PGCTL_ACK(s));
> +		eu_reg[2 * s] = I915_READ(GEN10_SS01_EU_PGCTL_ACK(s));
> +		eu_reg[2 * s + 1] = I915_READ(GEN10_SS23_EU_PGCTL_ACK(s));
> +	}
> +
> +	eu_mask[0] = GEN9_PGCTL_SSA_EU08_ACK |
> +		     GEN9_PGCTL_SSA_EU19_ACK |
> +		     GEN9_PGCTL_SSA_EU210_ACK |
> +		     GEN9_PGCTL_SSA_EU311_ACK;
> +	eu_mask[1] = GEN9_PGCTL_SSB_EU08_ACK |
> +		     GEN9_PGCTL_SSB_EU19_ACK |
> +		     GEN9_PGCTL_SSB_EU210_ACK |
> +		     GEN9_PGCTL_SSB_EU311_ACK;
> +
> +	for (s = 0; s < s_max; s++) {
> +		if ((s_reg[s] & GEN9_PGCTL_SLICE_ACK) == 0)
> +			/* skip disabled slice */
> +			continue;
> +
> +		sseu->slice_mask |= BIT(s);
> +		sseu->subslice_mask = info->sseu.subslice_mask;
> +
> +		for (ss = 0; ss < ss_max; ss++) {
> +			unsigned int eu_cnt;
> +
> +			if (!(s_reg[s] & (GEN9_PGCTL_SS_ACK(ss))))
> +				/* skip disabled subslice */
> +				continue;

You are going to hate me, but I found something else:

SLICE0_PGCTL_ACK has powergate acknowledge bits for subslices 0, 1 & 2, 
but not for subslice 3
SLICEn_PGCTL_ACK (where n = 1-5) has powergate acknowledge bits for 
subslices 0 & 1, but not for subslices 2 & 3

I have no idea where the missing bits went (maybe the BSpec is wrong?).

> +
> +			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);
> +		}
> +	}
> +}
> +
>   static void gen9_sseu_device_status(struct drm_i915_private *dev_priv,
>   				    struct sseu_dev_info *sseu)
>   {
> @@ -4610,7 +4658,7 @@ static void gen9_sseu_device_status(struct drm_i915_private *dev_priv,
>   
>   		sseu->slice_mask |= BIT(s);
>   
> -		if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv))
> +		if (IS_GEN9_BC(dev_priv))
>   			sseu->subslice_mask =
>   				INTEL_INFO(dev_priv)->sseu.subslice_mask;
>   
> @@ -4716,8 +4764,10 @@ static int i915_sseu_status(struct seq_file *m, void *unused)
>   		cherryview_sseu_device_status(dev_priv, &sseu);
>   	} else if (IS_BROADWELL(dev_priv)) {
>   		broadwell_sseu_device_status(dev_priv, &sseu);
> -	} else if (INTEL_GEN(dev_priv) >= 9) {
> +	} else if (IS_GEN9(dev_priv)) {
>   		gen9_sseu_device_status(dev_priv, &sseu);
> +	} else if (INTEL_GEN(dev_priv) >= 10) {
> +		gen10_sseu_device_status(dev_priv, &sseu);
>   	}
>   
>   	intel_runtime_pm_put(dev_priv);
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 1c257797c583..9729145e6c03 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -8020,11 +8020,17 @@ enum {
>   #define   CHV_EU311_PG_ENABLE		(1<<1)
>   
>   #define GEN9_SLICE_PGCTL_ACK(slice)	_MMIO(0x804c + (slice)*0x4)
> +#define GEN10_SLICE_PGCTL_ACK(slice)	_MMIO(0x804c + ((slice) / 3) * 0x34 + \
> +					      ((slice) % 3) * 0x4)
>   #define   GEN9_PGCTL_SLICE_ACK		(1 << 0)
>   #define   GEN9_PGCTL_SS_ACK(subslice)	(1 << (2 + (subslice)*2))
>   
>   #define GEN9_SS01_EU_PGCTL_ACK(slice)	_MMIO(0x805c + (slice)*0x8)
> +#define GEN10_SS01_EU_PGCTL_ACK(slice)	_MMIO(0x805c + ((slice) / 3) * 0x30 + \
> +					      ((slice) % 3) * 0x8)
>   #define GEN9_SS23_EU_PGCTL_ACK(slice)	_MMIO(0x8060 + (slice)*0x8)
> +#define GEN10_SS23_EU_PGCTL_ACK(slice)	_MMIO(0x8060 + ((slice) / 3) * 0x30 + \
> +					      ((slice) % 3) * 0x8)
>   #define   GEN9_PGCTL_SSA_EU08_ACK	(1 << 0)
>   #define   GEN9_PGCTL_SSA_EU19_ACK	(1 << 2)
>   #define   GEN9_PGCTL_SSA_EU210_ACK	(1 << 4)

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-09-22 16:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20 18:35 [PATCH 1/2] drm/i915/cnl: Add support slice/subslice/eu configs Rodrigo Vivi
2017-09-20 18:35 ` [PATCH 2/2] drm/i915/cnl: Fix SSEU Device Status Rodrigo Vivi
2017-09-20 19:49   ` Oscar Mateo
2017-09-22 13:15     ` [PATCH] " Rodrigo Vivi
2017-09-22 16:44       ` Oscar Mateo [this message]
2017-09-22 18:32         ` Rodrigo Vivi
2017-09-26 20:06           ` Rodrigo Vivi
2017-09-27 12:16             ` Daniel Vetter
2017-09-27 14:28               ` Rodrigo Vivi
2017-09-20 19:08 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/cnl: Add support slice/subslice/eu configs Patchwork
2017-09-20 21:44 ` ✗ Fi.CI.IGT: failure " Patchwork
2017-09-22 14:47 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/cnl: Add support slice/subslice/eu configs (rev2) Patchwork
2017-09-22 18:53 ` ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2017-10-26  0:15 [PATCH] drm/i915/cnl: Fix SSEU Device Status Rodrigo Vivi
2017-10-26 14:31 ` Lionel Landwerlin
2017-10-26 18:36   ` Rodrigo Vivi
2017-10-27 14:47     ` Lionel Landwerlin
2017-10-27 17:10       ` Rodrigo Vivi
2017-10-27 18:22         ` Lionel Landwerlin
2017-10-27 22:05 ` Oscar Mateo
2017-10-30 13:11   ` David Weinehall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73eeca87-e110-4d78-0d06-711b06cd7f85@intel.com \
    --to=oscar.mateo@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox