Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Shekhar Chauhan <shekhar.chauhan@intel.com>,
	Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>,
	Tejas Upadhyay <tejas.upadhyay@intel.com>
Subject: Re: [PATCH v2 18/22] drm/xe/irq: Split irq mask per engine class
Date: Wed, 15 Oct 2025 16:52:00 -0700	[thread overview]
Message-ID: <20251015235200.GL5409@mdroper-desk1.amr.corp.intel.com> (raw)
In-Reply-To: <20251015-xe3p-v2-18-b9189b3056a2@intel.com>

On Wed, Oct 15, 2025 at 03:06:33PM -0700, Lucas De Marchi wrote:
> Each engine class has a different bitfield structure in the hw. We've
> been just using a common mask for all of them, but this means that we
> could inadvertently set a wrong bit in one class while enabling
> something in another. Split them to make it more future proof.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_irq.c | 73 +++++++++++++++++++++++++++++----------------
>  1 file changed, 47 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
> index 9c3a85c4585ed..103804546b280 100644
> --- a/drivers/gpu/drm/xe/xe_irq.c
> +++ b/drivers/gpu/drm/xe/xe_irq.c
> @@ -139,25 +139,28 @@ void xe_irq_enable_hwe(struct xe_gt *gt)
>  {
>  	struct xe_device *xe = gt_to_xe(gt);
>  	struct xe_mmio *mmio = &gt->mmio;
> -	u32 irqs, dmask, smask;
> -	u32 gsc_mask = 0;
> -	u32 heci_mask = 0;
> +	u32 common_mask, val, gsc_mask = 0, heci_mask = 0,
> +	    rcs_mask = 0, bcs_mask = 0, vcs_mask = 0, vecs_mask = 0,
> +	    ccs_mask = 0;
>  
>  	if (xe_device_uses_memirq(xe))
>  		return;
>  
>  	if (xe_device_uc_enabled(xe)) {
> -		irqs = GT_RENDER_USER_INTERRUPT |
> -			GT_RENDER_PIPECTL_NOTIFY_INTERRUPT;
> +		common_mask = GT_RENDER_USER_INTERRUPT |

As a follow-up patch, this should probably be renamed to
GT_MI_USER_INTERRUPT since it doesn't have anything to do with render
these days (I think once upon a time this interrupts was only supported
on the RCS, but it's supported everywhere on all the platforms Xe
supports).

> +			      GT_RENDER_PIPECTL_NOTIFY_INTERRUPT;

This one will probably need a rename too.  The purpose is the same on
all engines (indicate that a flush command has finished), but the actual
flush command differs between engines...PIPECTL is only on rcs/ccs, and
MI_FLUSH_DW is used on the other engines.  So maybe
GT_FLUSH_COMPLETE_INTERRUPT or similar would be more accurate.

>  	} else {
> -		irqs = GT_RENDER_USER_INTERRUPT |
> -		       GT_CS_MASTER_ERROR_INTERRUPT |
> -		       GT_CONTEXT_SWITCH_INTERRUPT |
> -		       GT_WAIT_SEMAPHORE_INTERRUPT;
> +		common_mask = GT_RENDER_USER_INTERRUPT |
> +			      GT_CS_MASTER_ERROR_INTERRUPT |
> +			      GT_CONTEXT_SWITCH_INTERRUPT |
> +			      GT_WAIT_SEMAPHORE_INTERRUPT;
>  	}
>  
> -	dmask = irqs << 16 | irqs;
> -	smask = irqs << 16;
> +	rcs_mask |= common_mask;
> +	bcs_mask |= common_mask;
> +	vcs_mask |= common_mask;
> +	vecs_mask |= common_mask;
> +	ccs_mask |= common_mask;
>  
>  	if (xe_gt_is_main_type(gt)) {
>  		/*
> @@ -169,44 +172,62 @@ void xe_irq_enable_hwe(struct xe_gt *gt)
>  		u32 bcs_fuse_mask = xe_hw_engine_mask_per_class(gt, XE_ENGINE_CLASS_COPY);
>  
>  		/* Enable interrupts for each engine class */
> -		xe_mmio_write32(mmio, RENDER_COPY_INTR_ENABLE, dmask);
> +		xe_mmio_write32(mmio, RENDER_COPY_INTR_ENABLE,
> +				REG_FIELD_PREP(ENGINE1_MASK, rcs_mask) |
> +				REG_FIELD_PREP(ENGINE0_MASK, bcs_mask));
>  		if (ccs_fuse_mask)
> -			xe_mmio_write32(mmio, CCS_RSVD_INTR_ENABLE, smask);
> +			xe_mmio_write32(mmio, CCS_RSVD_INTR_ENABLE,
> +					REG_FIELD_PREP(ENGINE1_MASK, ccs_mask));
>  
>  		/* Unmask interrupts for each engine instance */
> -		xe_mmio_write32(mmio, RCS0_RSVD_INTR_MASK, ~smask);
> -		xe_mmio_write32(mmio, BCS_RSVD_INTR_MASK, ~smask);
> +		val = ~REG_FIELD_PREP(ENGINE1_MASK, rcs_mask);
> +		xe_mmio_write32(mmio, RCS0_RSVD_INTR_MASK, val);
> +		val = ~REG_FIELD_PREP(ENGINE1_MASK, bcs_mask);
> +		xe_mmio_write32(mmio, BCS_RSVD_INTR_MASK, val);
> +
> +		val = ~(REG_FIELD_PREP(ENGINE1_MASK, bcs_mask) |
> +			REG_FIELD_PREP(ENGINE0_MASK, bcs_mask));
>  		if (bcs_fuse_mask & (BIT(1)|BIT(2)))
> -			xe_mmio_write32(mmio, XEHPC_BCS1_BCS2_INTR_MASK, ~dmask);
> +			xe_mmio_write32(mmio, XEHPC_BCS1_BCS2_INTR_MASK, val);
>  		if (bcs_fuse_mask & (BIT(3)|BIT(4)))
> -			xe_mmio_write32(mmio, XEHPC_BCS3_BCS4_INTR_MASK, ~dmask);
> +			xe_mmio_write32(mmio, XEHPC_BCS3_BCS4_INTR_MASK, val);
>  		if (bcs_fuse_mask & (BIT(5)|BIT(6)))
> -			xe_mmio_write32(mmio, XEHPC_BCS5_BCS6_INTR_MASK, ~dmask);
> +			xe_mmio_write32(mmio, XEHPC_BCS5_BCS6_INTR_MASK, val);
>  		if (bcs_fuse_mask & (BIT(7)|BIT(8)))
> -			xe_mmio_write32(mmio, XEHPC_BCS7_BCS8_INTR_MASK, ~dmask);
> +			xe_mmio_write32(mmio, XEHPC_BCS7_BCS8_INTR_MASK, val);
> +
> +		val = ~(REG_FIELD_PREP(ENGINE1_MASK, ccs_mask) |
> +			REG_FIELD_PREP(ENGINE0_MASK, ccs_mask));
>  		if (ccs_fuse_mask & (BIT(0)|BIT(1)))
> -			xe_mmio_write32(mmio, CCS0_CCS1_INTR_MASK, ~dmask);
> +			xe_mmio_write32(mmio, CCS0_CCS1_INTR_MASK, val);
>  		if (ccs_fuse_mask & (BIT(2)|BIT(3)))
> -			xe_mmio_write32(mmio, CCS2_CCS3_INTR_MASK, ~dmask);
> +			xe_mmio_write32(mmio, CCS2_CCS3_INTR_MASK, val);
>  	}
>  
>  	if (xe_gt_is_media_type(gt) || MEDIA_VER(xe) < 13) {
>  		u32 other_fuse_mask = xe_hw_engine_mask_per_class(gt, XE_ENGINE_CLASS_OTHER);
>  
>  		/* Enable interrupts for each engine class */
> -		xe_mmio_write32(mmio, VCS_VECS_INTR_ENABLE, dmask);
> +		xe_mmio_write32(mmio, VCS_VECS_INTR_ENABLE,
> +				REG_FIELD_PREP(ENGINE1_MASK, vcs_mask) |
> +				REG_FIELD_PREP(ENGINE1_MASK, vecs_mask));
>  
>  		/* Unmask interrupts for each engine instance */

As a follow-up, we should probably add vcs_fuse_mask / vecs_fuse_mask
checks for these, and also handle the rest of the engines up to VCS7 and
VECS3 (since we have all of those in media_xelpmp's descriptor).

> -		xe_mmio_write32(mmio, VCS0_VCS1_INTR_MASK, ~dmask);
> -		xe_mmio_write32(mmio, VCS2_VCS3_INTR_MASK, ~dmask);
> -		xe_mmio_write32(mmio, VECS0_VECS1_INTR_MASK, ~dmask);
> +		val = ~(REG_FIELD_PREP(ENGINE1_MASK, vcs_mask) |
> +			REG_FIELD_PREP(ENGINE0_MASK, vcs_mask));
> +		xe_mmio_write32(mmio, VCS0_VCS1_INTR_MASK, val);
> +		xe_mmio_write32(mmio, VCS2_VCS3_INTR_MASK, val);
> +
> +		val = ~(REG_FIELD_PREP(ENGINE1_MASK, vcs_mask) |
> +			REG_FIELD_PREP(ENGINE0_MASK, vcs_mask));

Was this one supposed to be using vecs_mask?


Matt

> +		xe_mmio_write32(mmio, VECS0_VECS1_INTR_MASK, val);
>  
>  		/*
>  		 * the heci2 interrupt is enabled via the same register as the
>  		 * GSCCS interrupts, but it has its own mask register.
>  		 */
>  		if (other_fuse_mask) {
> -			gsc_mask = irqs | GSC_ER_COMPLETE;
> +			gsc_mask = common_mask | GSC_ER_COMPLETE;
>  			heci_mask = GSC_IRQ_INTF(1);
>  		} else if (xe->info.has_heci_gscfi) {
>  			gsc_mask = GSC_IRQ_INTF(1);
> 
> -- 
> 2.51.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation

  reply	other threads:[~2025-10-15 23:52 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 22:06 [PATCH v2 00/22] drm/xe: Add Xe3p support Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 01/22] drm/xe/xe3: Add support for graphics IP versions 30.04 & 30.05 Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 02/22] drm/xe/xe3p_lpm: Add support for media IP versions 35.00 & 35.03 Lucas De Marchi
2025-10-16 16:12   ` Gustavo Sousa
2025-10-16 16:46     ` Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 03/22] drm/xe: Drop CTC_MODE register read Lucas De Marchi
2025-10-15 23:26   ` Matt Roper
2025-10-15 22:06 ` [PATCH v2 04/22] drm/xe: Add GT_VER() to check version specific to gt type Lucas De Marchi
2025-10-15 23:34   ` Matt Roper
2025-10-15 22:06 ` [PATCH v2 05/22] drm/xe/xe3p_lpm: Skip disabling NOA on unsupported IPs Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 06/22] drm/xe/xe3p_lpm: Handle MCR steering Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 07/22] drm/xe/xe3p: Stop programming RCU_MODE's fixed slice mode setting Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 08/22] drm/xe/xe3p: Determine service copy availability from fuse Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 09/22] drm/xe: Dump CURRENT_LRCA register Lucas De Marchi
2025-10-15 23:28   ` Matt Roper
2025-10-15 22:06 ` [PATCH v2 10/22] drm/xe/xe3p: Dump CSMQDEBUG register Lucas De Marchi
2025-10-15 23:33   ` Matt Roper
2025-10-15 22:06 ` [PATCH v2 11/22] drm/xe/nvl: Define NVL-S platform Lucas De Marchi
2025-10-16 16:41   ` Gustavo Sousa
2025-10-15 22:06 ` [PATCH v2 12/22] drm/xe/nvls: Define GuC firmware for NVL-S Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 13/22] drm/xe/nvls: Attach MOCS table " Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 14/22] drm/xe/xe3p_xpc: Add Xe3p_XPC IP definition Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 15/22] drm/xe/xe3p_xpc: Add L3 bank mask Lucas De Marchi
2025-10-15 23:29   ` Matt Roper
2025-10-15 22:06 ` [PATCH v2 16/22] drm/xe/xe3p_xpc: Add MCR steering Lucas De Marchi
2025-10-16 11:44   ` Gustavo Sousa
2025-10-16 19:48     ` Lucas De Marchi
2025-10-16 20:16       ` Gustavo Sousa
2025-10-15 22:06 ` [PATCH v2 17/22] drm/xe/irq: Rename fuse mask variables Lucas De Marchi
2025-10-15 23:39   ` Matt Roper
2025-10-15 22:06 ` [PATCH v2 18/22] drm/xe/irq: Split irq mask per engine class Lucas De Marchi
2025-10-15 23:52   ` Matt Roper [this message]
2025-10-16  4:38     ` Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 19/22] drm/xe/xe3p_xpc: Add support for compute walker for non-MSIx Lucas De Marchi
2025-10-16  0:07   ` Matt Roper
2025-10-16  5:33     ` Lucas De Marchi
2025-10-16  6:52       ` Muqthyar Ahmed, Syed Abdul
2025-10-16 13:59         ` Lucas De Marchi
2025-10-17  6:52           ` Joonas Lahtinen
2025-10-15 22:06 ` [PATCH v2 20/22] drm/xe/xe3p_xpc: Skip compression tuning on platforms without flatccs Lucas De Marchi
2025-10-16 12:30   ` Gustavo Sousa
2025-10-16 16:54     ` Matt Roper
2025-10-15 22:06 ` [PATCH v2 21/22] drm/xe/xe3p_xpc: Setup PAT table Lucas De Marchi
2025-10-16 14:30   ` Vivekanandan, Balasubramani
2025-10-16 20:22     ` Lucas De Marchi
2025-10-15 22:06 ` [PATCH v2 22/22] drm/xe/xe3p: Add xe3p EU stall data format Lucas De Marchi
2025-10-15 23:58   ` Dixit, Ashutosh
2025-10-16  3:25     ` Lucas De Marchi
2025-10-16  5:11 ` ✗ CI.checkpatch: warning for drm/xe: Add Xe3p support (rev2) Patchwork
2025-10-16  5:13 ` ✓ CI.KUnit: success " Patchwork
2025-10-16  5:55 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-10-16 23:29 ` ✗ Xe.CI.Full: " Patchwork

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=20251015235200.GL5409@mdroper-desk1.amr.corp.intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=balasubramani.vivekanandan@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=shekhar.chauhan@intel.com \
    --cc=tejas.upadhyay@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