From: Matthew Brost <matthew.brost@intel.com>
To: Raag Jadav <raag.jadav@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
<daniele.ceraolospurio@intel.com>, <michal.wajdeczko@intel.com>
Subject: Re: [PATCH v1] drm/xe/guc_ct: Assert on credits mismatch during runtime suspend
Date: Tue, 2 Dec 2025 08:01:43 -0800 [thread overview]
Message-ID: <aS8NZz36I8vOpWHn@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20251202083334.554045-1-raag.jadav@intel.com>
On Tue, Dec 02, 2025 at 02:03:34PM +0530, Raag Jadav wrote:
> G2H credits should be in fully idle state when runtime suspending GuC CT.
> Assert on mismatch.
>
> Suggested-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Raag Jadav <raag.jadav@intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_ct.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index 2a24d3fb6881..648f0f523abb 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -253,8 +253,11 @@ static bool g2h_fence_needs_alloc(struct g2h_fence *g2h_fence)
> #define CTB_DESC_SIZE ALIGN(sizeof(struct guc_ct_buffer_desc), SZ_2K)
> #define CTB_H2G_BUFFER_OFFSET (CTB_DESC_SIZE * 2)
> #define CTB_H2G_BUFFER_SIZE (SZ_4K)
> +#define CTB_H2G_BUFFER_DWORDS (CTB_H2G_BUFFER_SIZE / sizeof(u32))
> #define CTB_G2H_BUFFER_SIZE (SZ_128K)
> +#define CTB_G2H_BUFFER_DWORDS (CTB_G2H_BUFFER_SIZE / sizeof(u32))
> #define G2H_ROOM_BUFFER_SIZE (CTB_G2H_BUFFER_SIZE / 2)
> +#define G2H_ROOM_BUFFER_DWORDS (CTB_G2H_BUFFER_DWORDS / 2)
>
> /**
> * xe_guc_ct_queue_proc_time_jiffies - Return maximum time to process a full
> @@ -403,7 +406,7 @@ int xe_guc_ct_init_post_hwconfig(struct xe_guc_ct *ct)
> static void guc_ct_ctb_h2g_init(struct xe_device *xe, struct guc_ctb *h2g,
> struct iosys_map *map)
> {
> - h2g->info.size = CTB_H2G_BUFFER_SIZE / sizeof(u32);
> + h2g->info.size = CTB_H2G_BUFFER_DWORDS;
> h2g->info.resv_space = 0;
> h2g->info.tail = 0;
> h2g->info.head = 0;
> @@ -421,8 +424,8 @@ static void guc_ct_ctb_h2g_init(struct xe_device *xe, struct guc_ctb *h2g,
> static void guc_ct_ctb_g2h_init(struct xe_device *xe, struct guc_ctb *g2h,
> struct iosys_map *map)
> {
> - g2h->info.size = CTB_G2H_BUFFER_SIZE / sizeof(u32);
> - g2h->info.resv_space = G2H_ROOM_BUFFER_SIZE / sizeof(u32);
> + g2h->info.size = CTB_G2H_BUFFER_DWORDS;
> + g2h->info.resv_space = G2H_ROOM_BUFFER_DWORDS;
> g2h->info.head = 0;
> g2h->info.tail = 0;
> g2h->info.space = CIRC_SPACE(g2h->info.tail, g2h->info.head,
> @@ -725,6 +728,12 @@ void xe_guc_ct_stop(struct xe_guc_ct *ct)
> */
> void xe_guc_ct_runtime_suspend(struct xe_guc_ct *ct)
> {
> + struct guc_ctb *g2h = &ct->ctbs.g2h;
> + u32 credits = CIRC_SPACE(0, 0, CTB_G2H_BUFFER_DWORDS) - G2H_ROOM_BUFFER_DWORDS;
> +
> + /* We should be back to guc_ct_ctb_g2h_init() values */
> + xe_gt_assert(ct_to_gt(ct), g2h->info.space == credits);
> +
> /*
> * Since we're already in runtime suspend path, we shouldn't have pending
> * messages. But if there happen to be any, we'd probably want them to be
> --
> 2.43.0
>
prev parent reply other threads:[~2025-12-02 16:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 8:33 [PATCH v1] drm/xe/guc_ct: Assert on credits mismatch during runtime suspend Raag Jadav
2025-12-02 10:33 ` ✓ CI.KUnit: success for " Patchwork
2025-12-02 11:34 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-02 12:44 ` ✗ Xe.CI.Full: failure " Patchwork
2025-12-05 3:26 ` Raag Jadav
2025-12-02 16:01 ` Matthew Brost [this message]
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=aS8NZz36I8vOpWHn@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
--cc=raag.jadav@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