From: Andi Shyti <andi.shyti@linux.intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
dri-devel <dri-devel@lists.freedesktop.org>
Cc: Tvrtko Ursulin <tursulin@ursulin.net>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Chris Wilson <chris.p.wilson@linux.intel.com>,
Simona Vetter <simona.vetter@ffwll.ch>,
Arshad Mehmood <arshad.mehmood@intel.com>,
Michal Mrozek <michal.mrozek@intel.com>,
Andi Shyti <andi.shyti@linux.intel.com>,
Andi Shyti <andi.shyti@kernel.org>
Subject: [PATCH v4 11/15] drm/i915/gt: Store active CCS mask
Date: Mon, 24 Mar 2025 14:29:47 +0100 [thread overview]
Message-ID: <20250324132952.1075209-12-andi.shyti@linux.intel.com> (raw)
In-Reply-To: <20250324132952.1075209-1-andi.shyti@linux.intel.com>
To support upcoming patches, we need to store the current mask
for active CCS engines.
Active engines refer to those exposed to userspace via the UABI
engine list.
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
---
drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c | 41 +++++++++++++++++++--
drivers/gpu/drm/i915/gt/intel_gt_types.h | 7 ++++
2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c b/drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
index edb6a4b63826..5eead7b18f57 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
@@ -12,6 +12,7 @@
static void intel_gt_apply_ccs_mode(struct intel_gt *gt)
{
unsigned long cslices_mask = CCS_MASK(gt);
+ unsigned long ccs_mask = gt->ccs.id_mask;
u32 mode_val = 0;
/* CCS engine id, i.e. the engines position in the engine's bitmask */
int engine;
@@ -55,7 +56,7 @@ static void intel_gt_apply_ccs_mode(struct intel_gt *gt)
* slice 2: ccs2
* slice 3: ccs3
*/
- engine = __ffs(cslices_mask);
+ engine = __ffs(ccs_mask);
for (cslice = 0; cslice < I915_MAX_CCS; cslice++) {
if (!(cslices_mask & BIT(cslice))) {
@@ -86,7 +87,7 @@ static void intel_gt_apply_ccs_mode(struct intel_gt *gt)
* CCS mode, will be used later to
* reset to a flexible value
*/
- engine = __ffs(cslices_mask);
+ engine = __ffs(ccs_mask);
continue;
}
}
@@ -94,13 +95,45 @@ static void intel_gt_apply_ccs_mode(struct intel_gt *gt)
gt->ccs.mode_reg_val = mode_val;
}
+static void __update_ccs_mask(struct intel_gt *gt, u32 ccs_mode)
+{
+ unsigned long cslices_mask = CCS_MASK(gt);
+ int i;
+
+ /* Mask off all the CCS engines */
+ gt->ccs.id_mask = 0;
+
+ for_each_set_bit(i, &cslices_mask, I915_MAX_CCS) {
+ gt->ccs.id_mask |= BIT(i);
+
+ ccs_mode--;
+ if (!ccs_mode)
+ break;
+ }
+
+ /*
+ * It's impossible for 'ccs_mode' to be zero at this point.
+ * This scenario would only occur if the 'ccs_mode' provided by
+ * the caller exceeded the total number of CCS engines, a condition
+ * we check before calling the 'update_ccs_mask()' function.
+ */
+ GEM_BUG_ON(ccs_mode);
+
+ /* Initialize the CCS mode setting */
+ intel_gt_apply_ccs_mode(gt);
+}
+
void intel_gt_ccs_mode_init(struct intel_gt *gt)
{
if (!IS_DG2(gt->i915))
return;
- /* Initialize the CCS mode setting */
- intel_gt_apply_ccs_mode(gt);
+ /*
+ * Set CCS balance mode 1 in the ccs_mask.
+ *
+ * During init the workaround are not set up yet.
+ */
+ __update_ccs_mask(gt, 1);
}
static ssize_t num_cslices_show(struct device *dev,
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h b/drivers/gpu/drm/i915/gt/intel_gt_types.h
index 71e43071da0b..641be69016e1 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
@@ -219,6 +219,13 @@ struct intel_gt {
*/
struct {
u32 mode_reg_val;
+
+ /*
+ * CCS id_mask is the command streamer instance
+ * exposed to the user. While the CCS_MASK(gt)
+ * is the available unfused compute slices.
+ */
+ intel_engine_mask_t id_mask;
} ccs;
/*
--
2.47.2
next prev parent reply other threads:[~2025-03-24 13:31 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 13:29 [PATCH v4 00/15] CCS static load balance Andi Shyti
2025-03-24 13:29 ` [PATCH v4 01/15] drm/i915/gt: Avoid using masked workaround for CCS_MODE setting Andi Shyti
2025-04-23 14:28 ` Lucas De Marchi
2025-03-24 13:29 ` [PATCH v4 02/15] drm/i915/gt: Move the CCS mode variable to a global position Andi Shyti
2025-03-24 13:29 ` [PATCH v4 03/15] drm/i915/gt: Allow the creation of multi-mode CCS masks Andi Shyti
2025-03-24 13:29 ` [PATCH v4 04/15] drm/i915/gt: Refactor uabi engine class/instance list creation Andi Shyti
2025-03-24 13:29 ` [PATCH v4 05/15] drm/i915/gem: Mark and verify UABI engine validity Andi Shyti
2025-03-24 13:29 ` [PATCH v4 06/15] drm/i915/gt: Introduce for_each_enabled_engine() and apply it in selftests Andi Shyti
2025-03-24 13:29 ` [PATCH v4 07/15] drm/i915/gt: Manage CCS engine creation within UABI exposure Andi Shyti
2025-03-24 13:29 ` [PATCH v4 08/15] drm/i915/gt: Remove cslices mask value from the CCS structure Andi Shyti
2025-03-24 13:29 ` [PATCH v4 09/15] drm/i915/gt: Expose the number of total CCS slices Andi Shyti
2025-03-24 13:29 ` [PATCH v4 10/15] drm/i915/gt: Store engine-related sysfs kobjects Andi Shyti
2025-03-24 13:29 ` Andi Shyti [this message]
2025-03-24 13:29 ` [PATCH v4 12/15] drm/i915: Protect access to the UABI engines list with a mutex Andi Shyti
2025-03-24 13:29 ` [PATCH v4 13/15] drm/i915/gt: Isolate single sysfs engine file creation Andi Shyti
2025-03-24 13:29 ` [PATCH v4 14/15] drm/i915/gt: Implement creation and removal routines for CCS engines Andi Shyti
2025-03-24 13:29 ` [PATCH v4 15/15] drm/i915/gt: Allow the user to change the CCS mode through sysfs Andi Shyti
2025-03-24 13:59 ` [PATCH v4 00/15] CCS static load balance Mrozek, Michal
2025-03-25 8:24 ` Joonas Lahtinen
2025-03-25 10:52 ` Andi Shyti
2025-03-27 6:49 ` Joonas Lahtinen
2025-03-27 15:10 ` Mehmood, Arshad
2025-03-25 10:36 ` Mehmood, Arshad
2025-03-27 13:44 ` Ayyalasomayajula, Usharani
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=20250324132952.1075209-12-andi.shyti@linux.intel.com \
--to=andi.shyti@linux.intel.com \
--cc=andi.shyti@kernel.org \
--cc=arshad.mehmood@intel.com \
--cc=chris.p.wilson@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=michal.mrozek@intel.com \
--cc=simona.vetter@ffwll.ch \
--cc=tursulin@ursulin.net \
/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;
as well as URLs for NNTP newsgroup(s).