All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karol Wachowski <karol.wachowski@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: oded.gabbay@gmail.com, jeff.hugo@oss.qualcomm.com,
	lizhi.hou@amd.com, andrzej.kacprowski@linux.intel.com,
	dawid.osuchowski@linux.intel.com,
	Karol Wachowski <karol.wachowski@linux.intel.com>
Subject: [PATCH] accel/ivpu: Limit SSIDs to 128 on all generations
Date: Wed,  4 Nov 2026 09:29:20 +0100	[thread overview]
Message-ID: <20261104082920.859706-1-karol.wachowski@linux.intel.com> (raw)

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


             reply	other threads:[~2026-11-04  8:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  8:29 Karol Wachowski [this message]
2026-11-04 17:41 ` [PATCH] accel/ivpu: Limit SSIDs to 128 on all generations Jeff Hugo
2026-11-04 18:13   ` Wachowski, Karol

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=20261104082920.859706-1-karol.wachowski@linux.intel.com \
    --to=karol.wachowski@linux.intel.com \
    --cc=andrzej.kacprowski@linux.intel.com \
    --cc=dawid.osuchowski@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jeff.hugo@oss.qualcomm.com \
    --cc=lizhi.hou@amd.com \
    --cc=oded.gabbay@gmail.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 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.