All of lore.kernel.org
 help / color / mirror / Atom feed
From: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>,
	<intel-gfx@lists.freedesktop.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 05/12] drm/i915/xehp: Check for faults on primary GAM
Date: Mon, 26 Sep 2022 17:58:36 +0530	[thread overview]
Message-ID: <YzGa9OyMKfHJ1S71@bala-ubuntu> (raw)
In-Reply-To: <20220919223259.263525-6-matthew.d.roper@intel.com>

On 19.09.2022 15:32, Matt Roper wrote:
> On Xe_HP the fault registers are now in a multicast register range.
> However as part of the GAM these registers follow special rules and we
> need only read from the "primary" GAM's instance to get the information
> we need.  So a single intel_gt_mcr_read_any() (which will automatically
> steer to the primary GAM) is sufficient; we don't need to loop over each
> instance of the MCR register.
> 
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_gt.c      | 40 ++++++++++++++++++++++++-
>  drivers/gpu/drm/i915/gt/intel_gt_regs.h |  3 ++
>  2 files changed, 42 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> index 5ddae95d4886..1cb7dd40ec47 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -304,6 +304,42 @@ static void gen6_check_faults(struct intel_gt *gt)
>  	}
>  }
>  
> +static void xehp_check_faults(struct intel_gt *gt)
> +{
> +	u32 fault;
> +
> +	/*
> +	 * Although the fault register now lives in an MCR register range,
> +	 * the GAM registers are special and we only truly need to read
> +	 * the "primary" GAM instance rather than handling each instance
> +	 * individually.  intel_gt_mcr_read_any() will automatically steer
> +	 * toward the primary instance.
> +	 */
> +	fault = intel_gt_mcr_read_any(gt, XEHP_RING_FAULT_REG);
> +	if (fault & RING_FAULT_VALID) {
> +		u32 fault_data0, fault_data1;
> +		u64 fault_addr;
> +
> +		fault_data0 = intel_gt_mcr_read_any(gt, XEHP_FAULT_TLB_DATA0);
> +		fault_data1 = intel_gt_mcr_read_any(gt, XEHP_FAULT_TLB_DATA1);
> +
> +		fault_addr = ((u64)(fault_data1 & FAULT_VA_HIGH_BITS) << 44) |
> +			     ((u64)fault_data0 << 12);
> +
> +		drm_dbg(&gt->i915->drm, "Unexpected fault\n"
> +			"\tAddr: 0x%08x_%08x\n"
> +			"\tAddress space: %s\n"
> +			"\tEngine ID: %d\n"
> +			"\tSource ID: %d\n"
> +			"\tType: %d\n",
> +			upper_32_bits(fault_addr), lower_32_bits(fault_addr),
> +			fault_data1 & FAULT_GTT_SEL ? "GGTT" : "PPGTT",
> +			GEN8_RING_FAULT_ENGINE_ID(fault),
> +			RING_FAULT_SRCID(fault),
> +			RING_FAULT_FAULT_TYPE(fault));
> +	}
> +}
> +
>  static void gen8_check_faults(struct intel_gt *gt)
>  {
>  	struct intel_uncore *uncore = gt->uncore;
> @@ -350,7 +386,9 @@ void intel_gt_check_and_clear_faults(struct intel_gt *gt)
>  	struct drm_i915_private *i915 = gt->i915;
>  
>  	/* From GEN8 onwards we only have one 'All Engine Fault Register' */
> -	if (GRAPHICS_VER(i915) >= 8)
> +	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50))
> +		xehp_check_faults(gt);
> +	else if (GRAPHICS_VER(i915) >= 8)
>  		gen8_check_faults(gt);
>  	else if (GRAPHICS_VER(i915) >= 6)
>  		gen6_check_faults(gt);
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> index cf87a1b36a21..dff38b0c4430 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> @@ -1024,11 +1024,14 @@
>  #define GEN9_BLT_MOCS(i)			_MMIO(__GEN9_BCS0_MOCS0 + (i) * 4)
>  
>  #define GEN12_FAULT_TLB_DATA0			_MMIO(0xceb8)
> +#define XEHP_FAULT_TLB_DATA0			_MMIO(0xceb8)
>  #define GEN12_FAULT_TLB_DATA1			_MMIO(0xcebc)
> +#define XEHP_FAULT_TLB_DATA1			_MMIO(0xcebc)
>  #define   FAULT_VA_HIGH_BITS			(0xf << 0)
>  #define   FAULT_GTT_SEL				(1 << 4)
>  
>  #define GEN12_RING_FAULT_REG			_MMIO(0xcec4)
> +#define XEHP_RING_FAULT_REG			_MMIO(0xcec4)

The fault registers GEN12_FAULT_TLB_DATA0, GEN12_FAULT_TLB_DATA1,
GEN12_RING_FAULT_REG are used in few other places in the driver for
platforms including Xe_HP. Don't we need to take care of them?

Regards,
Bala

>  #define   GEN8_RING_FAULT_ENGINE_ID(x)		(((x) >> 12) & 0x7)
>  #define   RING_FAULT_GTTSEL_MASK		(1 << 11)
>  #define   RING_FAULT_SRCID(x)			(((x) >> 3) & 0xff)
> -- 
> 2.37.3
> 

  reply	other threads:[~2022-09-26 12:29 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19 22:32 [Intel-gfx] [PATCH 00/12] Explicit MCR handling and MTL steering Matt Roper
2022-09-19 22:32 ` Matt Roper
2022-09-19 22:32 ` [Intel-gfx] [PATCH 01/12] drm/i915/gen8: Create separate reg definitions for new MCR registers Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-26  6:15   ` [Intel-gfx] " Balasubramani Vivekanandan
2022-09-26  6:15     ` Balasubramani Vivekanandan
2022-09-28  8:25   ` [Intel-gfx] " Balasubramani Vivekanandan
2022-09-28  8:25     ` Balasubramani Vivekanandan
2022-09-19 22:32 ` [Intel-gfx] [PATCH 02/12] drm/i915/xehp: " Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-28  9:50   ` [Intel-gfx] " Balasubramani Vivekanandan
2022-09-28  9:50     ` Balasubramani Vivekanandan
2022-09-30 21:54     ` [Intel-gfx] " Matt Roper
2022-09-30 21:54       ` Matt Roper
2022-09-19 22:32 ` [Intel-gfx] [PATCH 03/12] drm/i915/gt: Drop a few unused register definitions Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-19 22:32 ` [Intel-gfx] [PATCH 04/12] drm/i915/gt: Correct prefix on a few registers Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-19 22:32 ` [Intel-gfx] [PATCH 05/12] drm/i915/xehp: Check for faults on primary GAM Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-26 12:28   ` Balasubramani Vivekanandan [this message]
2022-09-19 22:32 ` [Intel-gfx] [PATCH 06/12] drm/i915: Define MCR registers explicitly Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-19 22:32 ` [Intel-gfx] [PATCH 07/12] drm/i915/gt: Always use MCR functions on multicast registers Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-19 22:32 ` [Intel-gfx] [PATCH 08/12] drm/i915/guc: Handle save/restore of MCR registers explicitly Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-19 22:32 ` [Intel-gfx] [PATCH 09/12] drm/i915/gt: Add MCR-specific workaround initializers Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-19 22:32 ` [Intel-gfx] [PATCH 10/12] drm/i915: Define multicast registers as a new type Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-19 22:32 ` [Intel-gfx] [PATCH 11/12] drm/i915/mtl: Add multicast steering for render GT Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-19 22:32 ` [Intel-gfx] [PATCH 12/12] drm/i915/mtl: Add multicast steering for media GT Matt Roper
2022-09-19 22:32   ` Matt Roper
2022-09-20  0:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Explicit MCR handling and MTL steering Patchwork
2022-09-20  0:46 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-09-20  1:10 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-09-20 10:18 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-09-20 22:37   ` Matt Roper

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=YzGa9OyMKfHJ1S71@bala-ubuntu \
    --to=balasubramani.vivekanandan@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.