Skip to content

Commit 2bebae0

Browse files
author
Andi Shyti
committed
drm/i915/gt: Enable only one CCS for compute workload
Enable only one CCS engine by default with all the compute sices allocated to it. While generating the list of UABI engines to be exposed to the user, exclude any additional CCS engines beyond the first instance. This change can be tested with igt i915_query. Fixes: d2eae8e ("drm/i915/dg2: Drop force_probe requirement") Signed-off-by: Andi Shyti <[email protected]> Cc: Chris Wilson <[email protected]> Cc: Joonas Lahtinen <[email protected]> Cc: Matt Roper <[email protected]> Cc: <[email protected]> # v6.2+ Reviewed-by: Matt Roper <[email protected]> Acked-by: Michal Mrozek <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c7a5aa4 commit 2bebae0

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

drivers/gpu/drm/i915/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ gt-y += \
118118
gt/intel_ggtt_fencing.o \
119119
gt/intel_gt.o \
120120
gt/intel_gt_buffer_pool.o \
121+
gt/intel_gt_ccs_mode.o \
121122
gt/intel_gt_clock_utils.o \
122123
gt/intel_gt_debugfs.o \
123124
gt/intel_gt_engines_debugfs.o \
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// SPDX-License-Identifier: MIT
2+
/*
3+
* Copyright © 2024 Intel Corporation
4+
*/
5+
6+
#include "i915_drv.h"
7+
#include "intel_gt.h"
8+
#include "intel_gt_ccs_mode.h"
9+
#include "intel_gt_regs.h"
10+
11+
void intel_gt_apply_ccs_mode(struct intel_gt *gt)
12+
{
13+
int cslice;
14+
u32 mode = 0;
15+
int first_ccs = __ffs(CCS_MASK(gt));
16+
17+
if (!IS_DG2(gt->i915))
18+
return;
19+
20+
/* Build the value for the fixed CCS load balancing */
21+
for (cslice = 0; cslice < I915_MAX_CCS; cslice++) {
22+
if (CCS_MASK(gt) & BIT(cslice))
23+
/*
24+
* If available, assign the cslice
25+
* to the first available engine...
26+
*/
27+
mode |= XEHP_CCS_MODE_CSLICE(cslice, first_ccs);
28+
29+
else
30+
/*
31+
* ... otherwise, mark the cslice as
32+
* unavailable if no CCS dispatches here
33+
*/
34+
mode |= XEHP_CCS_MODE_CSLICE(cslice,
35+
XEHP_CCS_MODE_CSLICE_MASK);
36+
}
37+
38+
intel_uncore_write(gt->uncore, XEHP_CCS_MODE, mode);
39+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2024 Intel Corporation
4+
*/
5+
6+
#ifndef __INTEL_GT_CCS_MODE_H__
7+
#define __INTEL_GT_CCS_MODE_H__
8+
9+
struct intel_gt;
10+
11+
void intel_gt_apply_ccs_mode(struct intel_gt *gt);
12+
13+
#endif /* __INTEL_GT_CCS_MODE_H__ */

drivers/gpu/drm/i915/gt/intel_gt_regs.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,11 @@
14811481
#define XEHP_RCU_MODE_FIXED_SLICE_CCS_MODE REG_BIT(1)
14821482
#define GEN12_RCU_MODE_CCS_ENABLE REG_BIT(0)
14831483

1484+
#define XEHP_CCS_MODE _MMIO(0x14804)
1485+
#define XEHP_CCS_MODE_CSLICE_MASK REG_GENMASK(2, 0) /* CCS0-3 + rsvd */
1486+
#define XEHP_CCS_MODE_CSLICE_WIDTH ilog2(XEHP_CCS_MODE_CSLICE_MASK + 1)
1487+
#define XEHP_CCS_MODE_CSLICE(cslice, ccs) (ccs << (cslice * XEHP_CCS_MODE_CSLICE_WIDTH))
1488+
14841489
#define CHV_FUSE_GT _MMIO(VLV_GUNIT_BASE + 0x2168)
14851490
#define CHV_FGT_DISABLE_SS0 (1 << 10)
14861491
#define CHV_FGT_DISABLE_SS1 (1 << 11)

drivers/gpu/drm/i915/gt/intel_workarounds.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "intel_engine_regs.h"
1111
#include "intel_gpu_commands.h"
1212
#include "intel_gt.h"
13+
#include "intel_gt_ccs_mode.h"
1314
#include "intel_gt_mcr.h"
1415
#include "intel_gt_print.h"
1516
#include "intel_gt_regs.h"
@@ -2868,6 +2869,12 @@ static void ccs_engine_wa_mode(struct intel_engine_cs *engine, struct i915_wa_li
28682869
* made to completely disable automatic CCS load balancing.
28692870
*/
28702871
wa_masked_en(wal, GEN12_RCU_MODE, XEHP_RCU_MODE_FIXED_SLICE_CCS_MODE);
2872+
2873+
/*
2874+
* After having disabled automatic load balancing we need to
2875+
* assign all slices to a single CCS. We will call it CCS mode 1
2876+
*/
2877+
intel_gt_apply_ccs_mode(gt);
28712878
}
28722879

28732880
/*

0 commit comments

Comments
 (0)