summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
diff options
context:
space:
mode:
authorMaxime Ripard <mripard@kernel.org>2024-04-23 08:48:56 +0200
committerMaxime Ripard <mripard@kernel.org>2024-04-23 08:48:56 +0200
commitc058e7a8f8af355e4a441c89400a6e95a16320e5 (patch)
treeed96dcd06e69f508a3f8a112a29fd228289429a6 /drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
parent6221deb716b9d5397c09ba6567f7ae61d8cbeb98 (diff)
parent0208ca55aa9c9b997da1f5bc45c4e98916323f08 (diff)
Merge drm/drm-next into drm-misc-next
Maíra needs a backmerge to apply v3d patches, and Danilo for some nouveau patches. Signed-off-by: Maxime Ripard <mripard@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c')
-rw-r--r--drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c39
1 files changed, 39 insertions, 0 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
new file mode 100644
index 000000000000..044219c5960a
--- /dev/null
+++ b/drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2024 Intel Corporation
+ */
+
+#include "i915_drv.h"
+#include "intel_gt.h"
+#include "intel_gt_ccs_mode.h"
+#include "intel_gt_regs.h"
+
+void intel_gt_apply_ccs_mode(struct intel_gt *gt)
+{
+ int cslice;
+ u32 mode = 0;
+ int first_ccs = __ffs(CCS_MASK(gt));
+
+ if (!IS_DG2(gt->i915))
+ return;
+
+ /* Build the value for the fixed CCS load balancing */
+ for (cslice = 0; cslice < I915_MAX_CCS; cslice++) {
+ if (CCS_MASK(gt) & BIT(cslice))
+ /*
+ * If available, assign the cslice
+ * to the first available engine...
+ */
+ mode |= XEHP_CCS_MODE_CSLICE(cslice, first_ccs);
+
+ else
+ /*
+ * ... otherwise, mark the cslice as
+ * unavailable if no CCS dispatches here
+ */
+ mode |= XEHP_CCS_MODE_CSLICE(cslice,
+ XEHP_CCS_MODE_CSLICE_MASK);
+ }
+
+ intel_uncore_write(gt->uncore, XEHP_CCS_MODE, mode);
+}