Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH v2 3/4] drm/xe: Add build on bug to assert access counter queue works
Date: Tue,  9 Jan 2024 17:24:38 -0800	[thread overview]
Message-ID: <20240110012439.1400618-4-matthew.brost@intel.com> (raw)
In-Reply-To: <20240110012439.1400618-1-matthew.brost@intel.com>

If ACC_QUEUE_NUM_DW % ACC_MSG_LEN_DW != 0 then the access counter queue
logic does not work when wrapping occurs. Add a build bug on to assert
ACC_QUEUE_NUM_DW % ACC_MSG_LEN_DW == 0 to enforce this restriction and
document the code.

v2:
- s/NUM_ACC_QUEUE/ACC_QUEUE_NUM_DW (Brian)

Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_pagefault.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
index 3ca715e2ec19..13183088401f 100644
--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
@@ -629,6 +629,11 @@ int xe_guc_access_counter_notify_handler(struct xe_guc *guc, u32 *msg, u32 len)
 	u32 asid;
 	bool full;
 
+	/*
+	 * The below logic doesn't work unless ACC_QUEUE_NUM_DW % ACC_MSG_LEN_DW == 0
+	 */
+	BUILD_BUG_ON(ACC_QUEUE_NUM_DW % ACC_MSG_LEN_DW);
+
 	if (unlikely(len != ACC_MSG_LEN_DW))
 		return -EPROTO;
 
-- 
2.34.1


  parent reply	other threads:[~2024-01-10  1:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10  1:24 [PATCH v2 0/4] Page fault logic clean ups Matthew Brost
2024-01-10  1:24 ` [PATCH v2 1/4] drm/xe: Add build on bug to assert page fault queue works Matthew Brost
2024-01-10 20:10   ` Lucas De Marchi
2024-01-10  1:24 ` [PATCH v2 2/4] drm/xe: Invert page fault queue head / tail Matthew Brost
2024-01-10 20:28   ` Lucas De Marchi
2024-01-10  1:24 ` Matthew Brost [this message]
2024-01-10 20:28   ` [PATCH v2 3/4] drm/xe: Add build on bug to assert access counter queue works Lucas De Marchi
2024-01-10  1:24 ` [PATCH v2 4/4] drm/xe: Invert access counter queue head / tail Matthew Brost
2024-01-10 20:34   ` Lucas De Marchi
2024-01-10  3:29 ` ✓ CI.Patch_applied: success for Page fault logic clean ups (rev2) Patchwork
2024-01-10  3:29 ` ✓ CI.checkpatch: " Patchwork
2024-01-10  3:30 ` ✓ CI.KUnit: " Patchwork
2024-01-10  3:38 ` ✓ CI.Build: " Patchwork
2024-01-10  3:38 ` ✓ CI.Hooks: " Patchwork
2024-01-10  3:39 ` ✓ CI.checksparse: " Patchwork
2024-01-10  4:15 ` ✓ CI.BAT: " Patchwork
2024-01-10 17:13 ` [PATCH v2 0/4] Page fault logic clean ups Welty, Brian

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=20240110012439.1400618-4-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@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