public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Levi, Ilia" <ilia.levi@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 12/13] drm/xe/memirq: Dump additional source pages if MSI-X
Date: Tue, 5 May 2026 16:12:50 +0300	[thread overview]
Message-ID: <a86cc7d6-179d-4a53-b380-edd41d88c082@intel.com> (raw)
In-Reply-To: <20260428142722.582-13-michal.wajdeczko@intel.com>

On 4/28/2026 5:27 PM, Michal Wajdeczko wrote:
> In MSI-X setup engines report their source/status as instance 0
> and we should dump additional source pages, not just the first one.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_memirq.c       | 35 +++++++++++++++++++++++++---
>  drivers/gpu/drm/xe/xe_memirq_types.h |  2 ++
>  2 files changed, 34 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_memirq.c b/drivers/gpu/drm/xe/xe_memirq.c
> index 30266b258087..b6fdefaf9463 100644
> --- a/drivers/gpu/drm/xe/xe_memirq.c
> +++ b/drivers/gpu/drm/xe/xe_memirq.c
> @@ -169,6 +169,21 @@ static inline bool hw_reports_to_instance_zero(struct xe_memirq *memirq)
>  	return xe_device_has_msix(memirq_to_xe(memirq));
>  }
>  
> +static unsigned int max_instance(struct xe_tile *tile)
> +{
> +	enum xe_engine_class ec;
> +	struct xe_gt *gt;
> +	unsigned int id;
> +	u32 emask = 0;
> +
> +	for_each_gt_on_tile(gt, tile, id) {
> +		for (ec = XE_ENGINE_CLASS_RENDER; ec < XE_ENGINE_CLASS_MAX; ec++)
> +			emask |= xe_hw_engine_mask_per_class(gt, ec);
> +	}
> +
> +	return fls(emask);


Wouldn't it be more readable to do something like:

    for_each_gt_on_tile(gt, tile, gtid)
        for_each_hw_engine(hwe, gt, id)
            max_inst = max(max_inst, hwe->instance);
    return max_inst + 1;

- Ilia

> +}
> +
>  static int memirq_alloc_pages(struct xe_memirq *memirq)
>  {
>  	struct xe_device *xe = memirq_to_xe(memirq);
> @@ -210,6 +225,9 @@ static int memirq_alloc_pages(struct xe_memirq *memirq)
>  		     xe_bo_ggtt_addr(bo), bo_size, XE_MEMIRQ_SOURCE_OFFSET(0),
>  		     XE_MEMIRQ_STATUS_OFFSET(0));
>  
> +	memirq->num_pages = hw_reports_to_instance_zero(memirq) ? max_instance(tile) : 1;


Don't you want to use max_instance in the calculation of BO size instead of XE_HW_ENGINE_MAX_INSTANCE?
- Ilia


> +	memirq_debug(memirq, "page instances: %u\n", memirq->num_pages);
> +
>  	return 0;
>  
>  out:
> @@ -525,6 +543,18 @@ bool xe_memirq_guc_sw_int_0_irq_pending(struct xe_memirq *memirq, struct xe_guc
>  				       guc_name(guc));
>  }
>  
> +static void memirq_dump_source_pages(struct xe_memirq *memirq)
> +{
> +	memirq_assert(memirq, !memirq->source.is_iomem);
> +
> +	for (int n = 0; n < memirq->num_pages; n++) {
> +		memirq_debug(memirq, "SOURCE %*ph\n", 32,
> +			     memirq->bo->vmap.vaddr + memirq_source_page_offset(memirq, n));
> +		memirq_debug(memirq, "SOURCE %*ph\n", 32,
> +			     memirq->bo->vmap.vaddr + memirq_source_page_offset(memirq, n) + 32);
> +	}
> +}
> +
>  /**
>   * xe_memirq_handler - The `Memory Based Interrupts`_ Handler.
>   * @memirq: the &xe_memirq
> @@ -544,9 +574,8 @@ void xe_memirq_handler(struct xe_memirq *memirq)
>  	if (!memirq->bo)
>  		return;
>  
> -	memirq_assert(memirq, !memirq->source.is_iomem);
> -	memirq_debug(memirq, "SOURCE %*ph\n", 32, memirq->source.vaddr);
> -	memirq_debug(memirq, "SOURCE %*ph\n", 32, memirq->source.vaddr + 32);
> +	if (IS_ENABLED(CONFIG_DRM_XE_DEBUG_MEMIRQ))
> +		memirq_dump_source_pages(memirq);
>  
>  	for_each_gt(gt, xe, gtid) {
>  		if (gt->tile != tile)
> diff --git a/drivers/gpu/drm/xe/xe_memirq_types.h b/drivers/gpu/drm/xe/xe_memirq_types.h
> index 02ac938cadb4..eab384342878 100644
> --- a/drivers/gpu/drm/xe/xe_memirq_types.h
> +++ b/drivers/gpu/drm/xe/xe_memirq_types.h
> @@ -14,6 +14,7 @@ struct xe_bo;
>   * struct xe_memirq - Data used by the `Memory Based Interrupts`_.
>   *
>   * @bo: buffer object with `Memory Based Interrupts Page Layout`_.
> + * @num_pages: number of per-instance source/status pages.
>   * @source: iosys pointer to `Interrupt Source Report Page`_.
>   * @status: iosys pointer to `Interrupt Status Report Page`_.
>   * @mask: iosys pointer to Interrupt Enable Mask.
> @@ -21,6 +22,7 @@ struct xe_bo;
>   */
>  struct xe_memirq {
>  	struct xe_bo *bo;
> +	unsigned int num_pages;
>  	struct iosys_map source;
>  	struct iosys_map status;
>  	struct iosys_map mask;



  reply	other threads:[~2026-05-05 13:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 14:27 [PATCH 00/13] drm/xe/tests: Add kunit tests for memory based interrupts Michal Wajdeczko
2026-04-28 14:27 ` [PATCH 01/13] drm/xe/ggtt: Rename parameter name in xe_ggtt_init_kunit() Michal Wajdeczko
2026-04-29 20:29   ` Summers, Stuart
2026-04-30  8:32     ` Jani Nikula
2026-04-30 21:50       ` Summers, Stuart
2026-04-28 14:27 ` [PATCH 02/13] drm/xe/guc: Allow to replace xe_guc_irq_handler() with stub Michal Wajdeczko
2026-04-30  5:44   ` K V P, Satyanarayana
2026-04-28 14:27 ` [PATCH 03/13] drm/xe/hwe: Allow to replace xe_hw_engine_handle_irq() " Michal Wajdeczko
2026-04-30  5:47   ` K V P, Satyanarayana
2026-04-28 14:27 ` [PATCH 04/13] drm/xe/mmio: Allow to replace xe_mmio_read32|write32() " Michal Wajdeczko
2026-04-30  5:48   ` K V P, Satyanarayana
2026-04-28 14:27 ` [PATCH 05/13] drm/xe/kunit: Promote GGTT initialization to test_init() helper Michal Wajdeczko
2026-04-28 14:27 ` [PATCH 06/13] drm/xe/kunit: Promote fake BO activation " Michal Wajdeczko
2026-04-28 14:27 ` [PATCH 07/13] drm/xe/kunit: Activate empty MMIO stubs in test_init() Michal Wajdeczko
2026-04-28 14:27 ` [PATCH 08/13] drm/xe/memirq: Make page layout macros private Michal Wajdeczko
2026-05-05  7:54   ` Levi, Ilia
2026-04-28 14:27 ` [PATCH 09/13] drm/xe/memirq: Introduce helper to calculate source page offset Michal Wajdeczko
2026-05-05  8:27   ` Levi, Ilia
2026-04-28 14:27 ` [PATCH 10/13] drm/xe/memirq: Introduce helper to calculate status vector offset Michal Wajdeczko
2026-05-05 12:40   ` Levi, Ilia
2026-04-28 14:27 ` [PATCH 11/13] drm/xe/memirq: Refactor xe_memirq_hwe_handler Michal Wajdeczko
2026-05-05 12:46   ` Levi, Ilia
2026-04-28 14:27 ` [PATCH 12/13] drm/xe/memirq: Dump additional source pages if MSI-X Michal Wajdeczko
2026-05-05 13:12   ` Levi, Ilia [this message]
2026-04-28 14:27 ` [PATCH 13/13] drm/xe/tests: Add kunit tests for memory based interrupts Michal Wajdeczko
2026-04-28 16:33 ` ✗ CI.checkpatch: warning for " Patchwork
2026-04-28 16:35 ` ✓ CI.KUnit: success " Patchwork
2026-04-28 17:43 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-29  5:04 ` ✗ Xe.CI.FULL: failure " 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=a86cc7d6-179d-4a53-b380-edd41d88c082@intel.com \
    --to=ilia.levi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@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