-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drm/xe: Enable Fixed CCS mode setting
Disable dynamic HW load balancing of compute resource assignment to engines and instead enabled fixed mode of mapping compute resources to engines on all platforms with more than one compute engine. By default enable only one CCS engine with all compute slices assigned to it. This is the desired configuration for common workloads. PVC platform supports only the fixed CCS mode (workaround 16016805146). v2: Rebase, make it platform agnostic v3: Minor code refactoring Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
- Loading branch information
Niranjana Vishwanathapura
authored and
Rodrigo Vivi
committed
Dec 21, 2023
1 parent
b279b53
commit 0d97ecc
Showing
9 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// SPDX-License-Identifier: MIT | ||
/* | ||
* Copyright © 2023 Intel Corporation | ||
*/ | ||
|
||
#include "regs/xe_gt_regs.h" | ||
#include "xe_assert.h" | ||
#include "xe_gt.h" | ||
#include "xe_gt_ccs_mode.h" | ||
#include "xe_mmio.h" | ||
|
||
static void __xe_gt_apply_ccs_mode(struct xe_gt *gt, u32 num_engines) | ||
{ | ||
u32 mode = CCS_MODE_CSLICE_0_3_MASK; /* disable all by default */ | ||
int num_slices = hweight32(CCS_MASK(gt)); | ||
struct xe_device *xe = gt_to_xe(gt); | ||
int width, cslice = 0; | ||
u32 config = 0; | ||
|
||
xe_assert(xe, xe_gt_ccs_mode_enabled(gt)); | ||
|
||
xe_assert(xe, num_engines && num_engines <= num_slices); | ||
xe_assert(xe, !(num_slices % num_engines)); | ||
|
||
/* | ||
* Loop over all available slices and assign each a user engine. | ||
* For example, if there are four compute slices available, the | ||
* assignment of compute slices to compute engines would be, | ||
* | ||
* With 1 engine (ccs0): | ||
* slice 0, 1, 2, 3: ccs0 | ||
* | ||
* With 2 engines (ccs0, ccs1): | ||
* slice 0, 2: ccs0 | ||
* slice 1, 3: ccs1 | ||
* | ||
* With 4 engines (ccs0, ccs1, ccs2, ccs3): | ||
* slice 0: ccs0 | ||
* slice 1: ccs1 | ||
* slice 2: ccs2 | ||
* slice 3: ccs3 | ||
*/ | ||
for (width = num_slices / num_engines; width; width--) { | ||
struct xe_hw_engine *hwe; | ||
enum xe_hw_engine_id id; | ||
|
||
for_each_hw_engine(hwe, gt, id) { | ||
if (hwe->class != XE_ENGINE_CLASS_COMPUTE) | ||
continue; | ||
|
||
if (hwe->logical_instance >= num_engines) | ||
break; | ||
|
||
config |= BIT(hwe->instance) << XE_HW_ENGINE_CCS0; | ||
|
||
/* If a slice is fused off, leave disabled */ | ||
while ((CCS_MASK(gt) & BIT(cslice)) == 0) | ||
cslice++; | ||
|
||
mode &= ~CCS_MODE_CSLICE(cslice, CCS_MODE_CSLICE_MASK); | ||
mode |= CCS_MODE_CSLICE(cslice, hwe->instance); | ||
cslice++; | ||
} | ||
} | ||
|
||
xe_mmio_write32(gt, CCS_MODE, mode); | ||
|
||
xe_gt_info(gt, "CCS_MODE=%x config:%08x, num_engines:%d, num_slices:%d\n", | ||
mode, config, num_engines, num_slices); | ||
} | ||
|
||
void xe_gt_apply_ccs_mode(struct xe_gt *gt) | ||
{ | ||
if (!gt->ccs_mode) | ||
return; | ||
|
||
__xe_gt_apply_ccs_mode(gt, gt->ccs_mode); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* SPDX-License-Identifier: MIT */ | ||
/* | ||
* Copyright © 2023 Intel Corporation | ||
*/ | ||
|
||
#ifndef _XE_GT_CCS_MODE_H_ | ||
#define _XE_GT_CCS_MODE_H_ | ||
|
||
#include "xe_device_types.h" | ||
#include "xe_gt.h" | ||
#include "xe_gt_types.h" | ||
#include "xe_platform_types.h" | ||
|
||
void xe_gt_apply_ccs_mode(struct xe_gt *gt); | ||
|
||
static inline bool xe_gt_ccs_mode_enabled(const struct xe_gt *gt) | ||
{ | ||
/* Check if there are more than one compute engines available */ | ||
return hweight32(CCS_MASK(gt)) > 1; | ||
} | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters