All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] accel/ivpu: Limit SSIDs to 128 on all generations
@ 2026-11-04  8:29 Karol Wachowski
  2026-11-04 17:41 ` Jeff Hugo
  0 siblings, 1 reply; 3+ messages in thread
From: Karol Wachowski @ 2026-11-04  8:29 UTC (permalink / raw)
  To: dri-devel
  Cc: oded.gabbay, jeff.hugo, lizhi.hou, andrzej.kacprowski,
	dawid.osuchowski, Karol Wachowski

Some generations support only 128 SSIDs, while the KMD configured 256
CD table entries and allowed user contexts up to SSID 130. Align the
limit across all generations.

Limit the CD table to 128 entries and the user SSID range to 2-127, so
root can create 126 contexts and non-root users 64. Also fix the off by
one SSID bounds checks against the CD table size.

Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_drv.c | 2 +-
 drivers/accel/ivpu/ivpu_drv.h | 3 ++-
 drivers/accel/ivpu/ivpu_mmu.c | 6 +++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index b60430dcf168..045ad6518657 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -127,7 +127,7 @@ static struct ivpu_user_limits *ivpu_user_limits_alloc(struct ivpu_device *vdev,
 		limits->max_ctx_count = ivpu_get_context_count(vdev);
 		limits->max_db_count = ivpu_get_doorbell_count(vdev);
 	} else {
-		limits->max_ctx_count = ivpu_get_context_count(vdev) / 2;
+		limits->max_ctx_count = IVPU_NON_ROOT_USER_MAX_CONTEXTS;
 		limits->max_db_count = ivpu_get_doorbell_count(vdev) / 2;
 	}
 
diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index 7ac7a7f82e67..7860993c7617 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -38,7 +38,8 @@
 /* SSID 1 is used by the VPU to represent reserved context */
 #define IVPU_RESERVED_CONTEXT_MMU_SSID 1
 #define IVPU_USER_CONTEXT_MIN_SSID     2
-#define IVPU_USER_CONTEXT_MAX_SSID     (IVPU_USER_CONTEXT_MIN_SSID + 128)
+#define IVPU_USER_CONTEXT_MAX_SSID     127
+#define IVPU_NON_ROOT_USER_MAX_CONTEXTS 64
 
 #define IVPU_MIN_DB 1
 #define IVPU_MAX_DB 255
diff --git a/drivers/accel/ivpu/ivpu_mmu.c b/drivers/accel/ivpu/ivpu_mmu.c
index 1908375ff128..dc18021261b9 100644
--- a/drivers/accel/ivpu/ivpu_mmu.c
+++ b/drivers/accel/ivpu/ivpu_mmu.c
@@ -65,7 +65,7 @@
 #define IVPU_MMU_IDR5_REF_FPGA		0x00800075
 
 #define IVPU_MMU_CDTAB_ENT_SIZE		64
-#define IVPU_MMU_CDTAB_ENT_COUNT_LOG2	8 /* 256 entries */
+#define IVPU_MMU_CDTAB_ENT_COUNT_LOG2	7 /* 128 entries */
 #define IVPU_MMU_CDTAB_ENT_COUNT	((u32)1 << IVPU_MMU_CDTAB_ENT_COUNT_LOG2)
 
 #define IVPU_MMU_STREAM_ID0		0
@@ -700,7 +700,7 @@ static int ivpu_mmu_cdtab_entry_set(struct ivpu_device *vdev, u32 ssid, u64 cd_d
 	u64 cd[4];
 	int ret = 0;
 
-	if (ssid > IVPU_MMU_CDTAB_ENT_COUNT)
+	if (ssid >= IVPU_MMU_CDTAB_ENT_COUNT)
 		return -EINVAL;
 
 	entry = cdtab->base + (ssid * IVPU_MMU_CDTAB_ENT_SIZE);
@@ -918,7 +918,7 @@ int ivpu_mmu_disable_ssid_events(struct ivpu_device *vdev, u32 ssid)
 	u64 *entry;
 	u64 val;
 
-	if (ssid > IVPU_MMU_CDTAB_ENT_COUNT)
+	if (ssid >= IVPU_MMU_CDTAB_ENT_COUNT)
 		return -EINVAL;
 
 	mutex_lock(&mmu->lock);
-- 
2.43.0


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

* Re: [PATCH] accel/ivpu: Limit SSIDs to 128 on all generations
  2026-11-04  8:29 [PATCH] accel/ivpu: Limit SSIDs to 128 on all generations Karol Wachowski
@ 2026-11-04 17:41 ` Jeff Hugo
  2026-11-04 18:13   ` Wachowski, Karol
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Hugo @ 2026-11-04 17:41 UTC (permalink / raw)
  To: Karol Wachowski, dri-devel
  Cc: oded.gabbay, lizhi.hou, andrzej.kacprowski, dawid.osuchowski

On 11/4/2026 1:29 AM, Karol Wachowski wrote:
> Some generations support only 128 SSIDs, while the KMD configured 256
> CD table entries and allowed user contexts up to SSID 130. Align the
> limit across all generations.

When I read this, I have the question, why limit to 128 for all 
generations when I assume some generations support more than 128. Would 
that not be a handicap for users on the gen(s) which can utilize more? 
It seems like the justification for applying this lowest common 
denominator across everything is not quite clear to an outsider.

> Limit the CD table to 128 entries and the user SSID range to 2-127, so
> root can create 126 contexts and non-root users 64. Also fix the off by
> one SSID bounds checks against the CD table size.
> 
> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>


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

* Re: [PATCH] accel/ivpu: Limit SSIDs to 128 on all generations
  2026-11-04 17:41 ` Jeff Hugo
@ 2026-11-04 18:13   ` Wachowski, Karol
  0 siblings, 0 replies; 3+ messages in thread
From: Wachowski, Karol @ 2026-11-04 18:13 UTC (permalink / raw)
  To: Jeff Hugo, dri-devel
  Cc: oded.gabbay, lizhi.hou, andrzej.kacprowski, dawid.osuchowski

On 04-Nov-26 18:41, Jeff Hugo wrote:
> On 11/4/2026 1:29 AM, Karol Wachowski wrote:
>> Some generations support only 128 SSIDs, while the KMD configured 256
>> CD table entries and allowed user contexts up to SSID 130. Align the
>> limit across all generations.
> 
> When I read this, I have the question, why limit to 128 for all 
> generations when I assume some generations support more than 128. Would 
> that not be a handicap for users on the gen(s) which can utilize more? 
> It seems like the justification for applying this lowest common 
> denominator across everything is not quite clear to an outsider.
> 
>> Limit the CD table to 128 entries and the user SSID range to 2-127, so
>> root can create 126 contexts and non-root users 64. Also fix the off by
>> one SSID bounds checks against the CD table size.

Hi,

The commit message could have been clearer. Before this patch the driver 
allowed 128 user contexts (MIN_SSID + 128). Now the limit is 128 SSIDs 
in total, which leaves 126 user contexts.

So the real cost is 2 contexts for root. Non-root stays at 64.
In return the SSID range, the CD table size and the bounds checks all 
match. Testing gets simpler, because we can check exact limits instead 
of loose minimums. The userspace interface also becomes consistent, with 
the same limits everywhere.

I'll add this to the commit message in v2.

Thanks,
Karol

>>
>> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
> 


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

end of thread, other threads:[~2026-11-04 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  8:29 [PATCH] accel/ivpu: Limit SSIDs to 128 on all generations Karol Wachowski
2026-11-04 17:41 ` Jeff Hugo
2026-11-04 18:13   ` Wachowski, Karol

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.