From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
<intel-xe@lists.freedesktop.org>
Cc: Tejas Upadhyay <tejas.upadhyay@intel.com>
Subject: Re: [PATCH v2] drm/xe: Add assert for XE_WA() usage
Date: Tue, 23 Jul 2024 14:58:51 +0530 [thread overview]
Message-ID: <f815e741-3578-404d-8eb9-099bcb3f22b0@intel.com> (raw)
In-Reply-To: <20240722160815.4085605-1-lucas.demarchi@intel.com>
On 22-07-2024 21:36, Lucas De Marchi wrote:
> It's not always safe to call XE_WA() in the driver initialization. Add a
> xe_gt_assert() so this doesn't go unnoticed.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>
> v2:
> - Fix kernel-doc (Tejas)
> - Remove needless initialization (Tejas)
>
> drivers/gpu/drm/xe/xe_gt_types.h | 6 ++++++
> drivers/gpu/drm/xe/xe_wa.c | 1 +
> drivers/gpu/drm/xe/xe_wa.h | 7 ++++++-
> 3 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_types.h b/drivers/gpu/drm/xe/xe_gt_types.h
> index ef68c4a92972..4dd01adf63c6 100644
> --- a/drivers/gpu/drm/xe/xe_gt_types.h
> +++ b/drivers/gpu/drm/xe/xe_gt_types.h
> @@ -389,6 +389,12 @@ struct xe_gt {
> unsigned long *lrc;
> /** @wa_active.oob: bitmap with active OOB workaroudns */
Since you're here, please attend the existing typo in kernel-doc.
s/workaroudns/workarounds
> unsigned long *oob;
> + /**
> + * @wa_active.oob_initialized: mark oob as initialized to help
> + * detecting misuse of XE_WA() - it can only be called on
> + * initialization after OOB WAs have being processed
> + */
> + bool oob_initialized;
> } wa_active;
>
> /** @user_engines: engines present in GT and available to userspace */
> diff --git a/drivers/gpu/drm/xe/xe_wa.c b/drivers/gpu/drm/xe/xe_wa.c
> index fd009b2c68fa..564e32e44e3b 100644
> --- a/drivers/gpu/drm/xe/xe_wa.c
> +++ b/drivers/gpu/drm/xe/xe_wa.c
> @@ -755,6 +755,7 @@ void xe_wa_process_oob(struct xe_gt *gt)
>
> xe_rtp_process_ctx_enable_active_tracking(&ctx, gt->wa_active.oob,
> ARRAY_SIZE(oob_was));
> + gt->wa_active.oob_initialized = true;
> xe_rtp_process(&ctx, oob_was);
> }
>
> diff --git a/drivers/gpu/drm/xe/xe_wa.h b/drivers/gpu/drm/xe/xe_wa.h
> index db9ddeaf69bf..52337405b5bc 100644
> --- a/drivers/gpu/drm/xe/xe_wa.h
> +++ b/drivers/gpu/drm/xe/xe_wa.h
> @@ -6,6 +6,8 @@
> #ifndef _XE_WA_
> #define _XE_WA_
>
> +#include "xe_assert.h"
> +
> struct drm_printer;
> struct xe_gt;
> struct xe_hw_engine;
> @@ -25,6 +27,9 @@ void xe_wa_dump(struct xe_gt *gt, struct drm_printer *p);
> * @gt__: gt instance
> * @id__: XE_OOB_<id__>, as generated by build system in generated/xe_wa_oob.h
> */
> -#define XE_WA(gt__, id__) test_bit(XE_WA_OOB_ ## id__, (gt__)->wa_active.oob)
> +#define XE_WA(gt__, id__) ({ \
> + xe_gt_assert(gt__, (gt__)->wa_active.oob_initialized); \
> + test_bit(XE_WA_OOB_ ## id__, (gt__)->wa_active.oob); \
> +})
>
> #endif
next prev parent reply other threads:[~2024-07-23 9:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-22 16:06 [PATCH v2] drm/xe: Add assert for XE_WA() usage Lucas De Marchi
2024-07-22 16:30 ` ✓ CI.Patch_applied: success for drm/xe: Add assert for XE_WA() usage (rev2) Patchwork
2024-07-22 16:30 ` ✗ CI.checkpatch: warning " Patchwork
2024-07-22 16:32 ` ✓ CI.KUnit: success " Patchwork
2024-07-22 16:43 ` ✓ CI.Build: " Patchwork
2024-07-22 16:46 ` ✓ CI.Hooks: " Patchwork
2024-07-22 16:47 ` ✓ CI.checksparse: " Patchwork
2024-07-22 17:07 ` ✓ CI.BAT: " Patchwork
2024-07-22 18:51 ` ✗ CI.FULL: failure " Patchwork
2024-07-23 9:28 ` Ghimiray, Himal Prasad [this message]
2024-07-24 16:17 ` [PATCH v2] drm/xe: Add assert for XE_WA() usage Lucas De Marchi
2024-07-24 12:26 ` Upadhyay, Tejas
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=f815e741-3578-404d-8eb9-099bcb3f22b0@intel.com \
--to=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@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