Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-xe] [PATCH] drm/xe/rtp: Fix displayed whitelisted register range
@ 2023-11-09 17:07 Ashutosh Dixit
  2023-11-09 18:05 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Ashutosh Dixit @ 2023-11-09 17:07 UTC (permalink / raw)
  To: intel-xe; +Cc: Matt Roper, Lucas De Marchi

Fix displayed whitelisted register range. For example, with:

	XE_RTP_ACTIONS(WHITELIST(0xdafc, RING_FORCE_TO_NONPRIV_RANGE_4))

Before we would show:
	xe REG[0xdaf0-0xdaff]: allow read access

With this patch we show:
	xe REG[0xdafc-0xdb0b]: allow read access

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 drivers/gpu/drm/xe/xe_reg_whitelist.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_reg_whitelist.c b/drivers/gpu/drm/xe/xe_reg_whitelist.c
index e66ae1bdaf9c0..4bc07bbdd7e8e 100644
--- a/drivers/gpu/drm/xe/xe_reg_whitelist.c
+++ b/drivers/gpu/drm/xe/xe_reg_whitelist.c
@@ -88,26 +88,16 @@ void xe_reg_whitelist_print_entry(struct drm_printer *p, unsigned int indent,
 {
 	u32 val = entry->set_bits;
 	const char *access_str = "(invalid)";
-	unsigned int range_bit = 2;
-	u32 range_start, range_end;
+	u32 range_start, range_end, range_bits;
+	u32 range[] = { 1, 4, 16, 64 };
 	bool deny;
 
 	deny = val & RING_FORCE_TO_NONPRIV_DENY;
+	BUILD_BUG_ON(ARRAY_SIZE(range) - 1 != RING_FORCE_TO_NONPRIV_RANGE_MASK);
+	range_bits = val & RING_FORCE_TO_NONPRIV_RANGE_MASK;
 
-	switch (val & RING_FORCE_TO_NONPRIV_RANGE_MASK) {
-	case RING_FORCE_TO_NONPRIV_RANGE_4:
-		range_bit = 4;
-		break;
-	case RING_FORCE_TO_NONPRIV_RANGE_16:
-		range_bit = 6;
-		break;
-	case RING_FORCE_TO_NONPRIV_RANGE_64:
-		range_bit = 8;
-		break;
-	}
-
-	range_start = reg & REG_GENMASK(25, range_bit);
-	range_end = range_start | REG_GENMASK(range_bit, 0);
+	range_start = reg & RING_FORCE_TO_NONPRIV_ADDRESS_MASK;
+	range_end = range_start + range[range_bits] * 4 - 1;
 
 	switch (val & RING_FORCE_TO_NONPRIV_ACCESS_MASK) {
 	case RING_FORCE_TO_NONPRIV_ACCESS_RW:
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-11-13 21:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 17:07 [Intel-xe] [PATCH] drm/xe/rtp: Fix displayed whitelisted register range Ashutosh Dixit
2023-11-09 18:05 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-11-09 18:06 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-11-09 18:07 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-11-09 18:16 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-11-09 18:16 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-11-09 18:18 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-11-09 21:19 ` [Intel-xe] [PATCH] " Dixit, Ashutosh
2023-11-13 21:15   ` Dixit, Ashutosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox