mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
drm/xe: Introduce xe_gt_is_main_type helper
Instead of checking for not being a media type GT provide a small helper to explicitly express our intentions. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com> Link: https://lore.kernel.org/r/20250713103625.1964-5-michal.wajdeczko@intel.com
This commit is contained in:
parent
76293a83a9
commit
ffab82b062
|
|
@ -19,7 +19,7 @@ static int bb_prefetch(struct xe_gt *gt)
|
|||
{
|
||||
struct xe_device *xe = gt_to_xe(gt);
|
||||
|
||||
if (GRAPHICS_VERx100(xe) >= 1250 && !xe_gt_is_media_type(gt))
|
||||
if (GRAPHICS_VERx100(xe) >= 1250 && xe_gt_is_main_type(gt))
|
||||
/*
|
||||
* RCS and CCS require 1K, although other engines would be
|
||||
* okay with 512.
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ void xe_force_wake_init_engines(struct xe_gt *gt, struct xe_force_wake *fw)
|
|||
{
|
||||
int i, j;
|
||||
|
||||
if (!xe_gt_is_media_type(gt))
|
||||
if (xe_gt_is_main_type(gt))
|
||||
init_domain(fw, XE_FW_DOMAIN_ID_RENDER,
|
||||
FORCEWAKE_RENDER,
|
||||
FORCEWAKE_ACK_RENDER);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ static void xe_gt_enable_host_l2_vram(struct xe_gt *gt)
|
|||
if (!fw_ref)
|
||||
return;
|
||||
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
reg = xe_gt_mcr_unicast_read_any(gt, XE2_GAMREQSTRM_CTRL);
|
||||
reg |= CG_DIS_CNTLBUS;
|
||||
xe_gt_mcr_multicast_write(gt, XE2_GAMREQSTRM_CTRL, reg);
|
||||
|
|
@ -470,7 +470,7 @@ static int gt_init_with_gt_forcewake(struct xe_gt *gt)
|
|||
xe_gt_mcr_init(gt);
|
||||
xe_gt_enable_host_l2_vram(gt);
|
||||
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
err = xe_ggtt_init(gt_to_tile(gt)->mem.ggtt);
|
||||
if (err)
|
||||
goto err_force_wake;
|
||||
|
|
@ -547,7 +547,7 @@ static int gt_init_with_all_forcewake(struct xe_gt *gt)
|
|||
if (err)
|
||||
goto err_force_wake;
|
||||
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
/*
|
||||
* USM has its only SA pool to non-block behind user operations
|
||||
*/
|
||||
|
|
@ -563,7 +563,7 @@ static int gt_init_with_all_forcewake(struct xe_gt *gt)
|
|||
}
|
||||
}
|
||||
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
struct xe_tile *tile = gt_to_tile(gt);
|
||||
|
||||
tile->migrate = xe_migrate_init(tile);
|
||||
|
|
@ -583,7 +583,7 @@ static int gt_init_with_all_forcewake(struct xe_gt *gt)
|
|||
xe_gt_apply_ccs_mode(gt);
|
||||
}
|
||||
|
||||
if (IS_SRIOV_PF(gt_to_xe(gt)) && !xe_gt_is_media_type(gt))
|
||||
if (IS_SRIOV_PF(gt_to_xe(gt)) && xe_gt_is_main_type(gt))
|
||||
xe_lmtt_init_hw(>_to_tile(gt)->sriov.pf.lmtt);
|
||||
|
||||
if (IS_SRIOV_PF(gt_to_xe(gt))) {
|
||||
|
|
@ -780,7 +780,7 @@ static int do_gt_restart(struct xe_gt *gt)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
if (IS_SRIOV_PF(gt_to_xe(gt)) && !xe_gt_is_media_type(gt))
|
||||
if (IS_SRIOV_PF(gt_to_xe(gt)) && xe_gt_is_main_type(gt))
|
||||
xe_lmtt_init_hw(>_to_tile(gt)->sriov.pf.lmtt);
|
||||
|
||||
if (IS_SRIOV_PF(gt_to_xe(gt)))
|
||||
|
|
|
|||
|
|
@ -106,6 +106,11 @@ static inline bool xe_gt_has_indirect_ring_state(struct xe_gt *gt)
|
|||
xe_device_uc_enabled(gt_to_xe(gt));
|
||||
}
|
||||
|
||||
static inline bool xe_gt_is_main_type(struct xe_gt *gt)
|
||||
{
|
||||
return gt->info.type == XE_GT_TYPE_MAIN;
|
||||
}
|
||||
|
||||
static inline bool xe_gt_is_media_type(struct xe_gt *gt)
|
||||
{
|
||||
return gt->info.type == XE_GT_TYPE_MEDIA;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ void xe_gt_idle_enable_pg(struct xe_gt *gt)
|
|||
if (vcs_mask || vecs_mask)
|
||||
gtidle->powergate_enable = MEDIA_POWERGATE_ENABLE;
|
||||
|
||||
if (!xe_gt_is_media_type(gt))
|
||||
if (xe_gt_is_main_type(gt))
|
||||
gtidle->powergate_enable |= RENDER_POWERGATE_ENABLE;
|
||||
|
||||
if (xe->info.platform != XE_DG1) {
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ static u64 pf_get_spare_ggtt(struct xe_gt *gt)
|
|||
{
|
||||
u64 spare;
|
||||
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
|
||||
lockdep_assert_held(xe_gt_sriov_pf_master_mutex(gt));
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ static u64 pf_get_spare_ggtt(struct xe_gt *gt)
|
|||
|
||||
static int pf_set_spare_ggtt(struct xe_gt *gt, u64 size)
|
||||
{
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
|
||||
lockdep_assert_held(xe_gt_sriov_pf_master_mutex(gt));
|
||||
|
||||
|
|
@ -443,7 +443,7 @@ static int pf_provision_vf_ggtt(struct xe_gt *gt, unsigned int vfid, u64 size)
|
|||
int err;
|
||||
|
||||
xe_gt_assert(gt, vfid);
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
|
||||
|
||||
size = round_up(size, alignment);
|
||||
|
|
@ -492,7 +492,7 @@ static u64 pf_get_vf_config_ggtt(struct xe_gt *gt, unsigned int vfid)
|
|||
struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
|
||||
struct xe_ggtt_node *node = config->ggtt_region;
|
||||
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
return xe_ggtt_node_allocated(node) ? node->base.size : 0;
|
||||
}
|
||||
|
||||
|
|
@ -560,7 +560,7 @@ int xe_gt_sriov_pf_config_set_ggtt(struct xe_gt *gt, unsigned int vfid, u64 size
|
|||
{
|
||||
int err;
|
||||
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
|
||||
mutex_lock(xe_gt_sriov_pf_master_mutex(gt));
|
||||
if (vfid)
|
||||
|
|
@ -622,7 +622,7 @@ int xe_gt_sriov_pf_config_bulk_set_ggtt(struct xe_gt *gt, unsigned int vfid,
|
|||
int err = 0;
|
||||
|
||||
xe_gt_assert(gt, vfid);
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
|
||||
if (!num_vfs)
|
||||
return 0;
|
||||
|
|
@ -693,7 +693,7 @@ int xe_gt_sriov_pf_config_set_fair_ggtt(struct xe_gt *gt, unsigned int vfid,
|
|||
|
||||
xe_gt_assert(gt, vfid);
|
||||
xe_gt_assert(gt, num_vfs);
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
|
||||
mutex_lock(xe_gt_sriov_pf_master_mutex(gt));
|
||||
fair = pf_estimate_fair_ggtt(gt, num_vfs);
|
||||
|
|
@ -1406,7 +1406,7 @@ static int pf_update_vf_lmtt(struct xe_device *xe, unsigned int vfid)
|
|||
static void pf_release_vf_config_lmem(struct xe_gt *gt, struct xe_gt_sriov_config *config)
|
||||
{
|
||||
xe_gt_assert(gt, IS_DGFX(gt_to_xe(gt)));
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
lockdep_assert_held(xe_gt_sriov_pf_master_mutex(gt));
|
||||
|
||||
if (config->lmem_obj) {
|
||||
|
|
@ -1425,7 +1425,7 @@ static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)
|
|||
|
||||
xe_gt_assert(gt, vfid);
|
||||
xe_gt_assert(gt, IS_DGFX(xe));
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
|
||||
size = round_up(size, pf_get_lmem_alignment(gt));
|
||||
|
||||
|
|
@ -1552,7 +1552,7 @@ int xe_gt_sriov_pf_config_bulk_set_lmem(struct xe_gt *gt, unsigned int vfid,
|
|||
int err = 0;
|
||||
|
||||
xe_gt_assert(gt, vfid);
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
|
||||
if (!num_vfs)
|
||||
return 0;
|
||||
|
|
@ -1629,7 +1629,7 @@ int xe_gt_sriov_pf_config_set_fair_lmem(struct xe_gt *gt, unsigned int vfid,
|
|||
|
||||
xe_gt_assert(gt, vfid);
|
||||
xe_gt_assert(gt, num_vfs);
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
|
||||
if (!xe_device_has_lmtt(gt_to_xe(gt)))
|
||||
return 0;
|
||||
|
|
@ -1663,7 +1663,7 @@ int xe_gt_sriov_pf_config_set_fair(struct xe_gt *gt, unsigned int vfid,
|
|||
xe_gt_assert(gt, vfid);
|
||||
xe_gt_assert(gt, num_vfs);
|
||||
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
err = xe_gt_sriov_pf_config_set_fair_ggtt(gt, vfid, num_vfs);
|
||||
result = result ?: err;
|
||||
err = xe_gt_sriov_pf_config_set_fair_lmem(gt, vfid, num_vfs);
|
||||
|
|
@ -1991,7 +1991,7 @@ static void pf_release_vf_config(struct xe_gt *gt, unsigned int vfid)
|
|||
struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
|
||||
struct xe_device *xe = gt_to_xe(gt);
|
||||
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
pf_release_vf_config_ggtt(gt, config);
|
||||
if (IS_DGFX(xe)) {
|
||||
pf_release_vf_config_lmem(gt, config);
|
||||
|
|
@ -2082,7 +2082,7 @@ static int pf_sanitize_vf_resources(struct xe_gt *gt, u32 vfid, long timeout)
|
|||
* Only GGTT and LMEM requires to be cleared by the PF.
|
||||
* GuC doorbell IDs and context IDs do not need any clearing.
|
||||
*/
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
pf_sanitize_ggtt(config->ggtt_region, vfid);
|
||||
if (IS_DGFX(xe))
|
||||
err = pf_sanitize_lmem(tile, config->lmem_obj, timeout);
|
||||
|
|
@ -2149,7 +2149,7 @@ static int pf_validate_vf_config(struct xe_gt *gt, unsigned int vfid)
|
|||
{
|
||||
struct xe_gt *primary_gt = gt_to_tile(gt)->primary_gt;
|
||||
struct xe_device *xe = gt_to_xe(gt);
|
||||
bool is_primary = !xe_gt_is_media_type(gt);
|
||||
bool is_primary = xe_gt_is_main_type(gt);
|
||||
bool valid_ggtt, valid_ctxs, valid_dbs;
|
||||
bool valid_any, valid_all;
|
||||
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ static void pf_add_config_attrs(struct xe_gt *gt, struct dentry *parent, unsigne
|
|||
xe_gt_assert(gt, gt == extract_gt(parent));
|
||||
xe_gt_assert(gt, vfid == extract_vfid(parent));
|
||||
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
debugfs_create_file_unsafe(vfid ? "ggtt_quota" : "ggtt_spare",
|
||||
0644, parent, parent, &ggtt_fops);
|
||||
if (xe_device_has_lmtt(gt_to_xe(gt)))
|
||||
|
|
@ -554,7 +554,7 @@ void xe_gt_sriov_pf_debugfs_register(struct xe_gt *gt, struct dentry *root)
|
|||
pfdentry->d_inode->i_private = gt;
|
||||
|
||||
drm_debugfs_create_files(pf_info, ARRAY_SIZE(pf_info), pfdentry, minor);
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
drm_debugfs_create_files(pf_ggtt_info,
|
||||
ARRAY_SIZE(pf_ggtt_info),
|
||||
pfdentry, minor);
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ int xe_gt_sriov_vf_query_config(struct xe_gt *gt)
|
|||
if (unlikely(err))
|
||||
return err;
|
||||
|
||||
if (IS_DGFX(xe) && !xe_gt_is_media_type(gt)) {
|
||||
if (IS_DGFX(xe) && xe_gt_is_main_type(gt)) {
|
||||
err = vf_get_lmem_info(gt);
|
||||
if (unlikely(err))
|
||||
return err;
|
||||
|
|
@ -649,7 +649,7 @@ s64 xe_gt_sriov_vf_ggtt_shift(struct xe_gt *gt)
|
|||
struct xe_gt_sriov_vf_selfconfig *config = >->sriov.vf.self_config;
|
||||
|
||||
xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
|
||||
xe_gt_assert(gt, !xe_gt_is_media_type(gt));
|
||||
xe_gt_assert(gt, xe_gt_is_main_type(gt));
|
||||
|
||||
return config->ggtt_shift;
|
||||
}
|
||||
|
|
@ -1036,7 +1036,7 @@ void xe_gt_sriov_vf_print_config(struct xe_gt *gt, struct drm_printer *p)
|
|||
|
||||
drm_printf(p, "GGTT shift on last restore:\t%lld\n", config->ggtt_shift);
|
||||
|
||||
if (IS_DGFX(xe) && !xe_gt_is_media_type(gt)) {
|
||||
if (IS_DGFX(xe) && xe_gt_is_main_type(gt)) {
|
||||
string_get_size(config->lmem_size, 1, STRING_UNITS_2, buf, sizeof(buf));
|
||||
drm_printf(p, "LMEM size:\t%llu (%s)\n", config->lmem_size, buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ void xe_irq_enable_hwe(struct xe_gt *gt)
|
|||
dmask = irqs << 16 | irqs;
|
||||
smask = irqs << 16;
|
||||
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
/* Enable interrupts for each engine class */
|
||||
xe_mmio_write32(mmio, RENDER_COPY_INTR_ENABLE, dmask);
|
||||
if (ccs_mask)
|
||||
|
|
@ -262,7 +262,7 @@ gt_engine_identity(struct xe_device *xe,
|
|||
static void
|
||||
gt_other_irq_handler(struct xe_gt *gt, const u8 instance, const u16 iir)
|
||||
{
|
||||
if (instance == OTHER_GUC_INSTANCE && !xe_gt_is_media_type(gt))
|
||||
if (instance == OTHER_GUC_INSTANCE && xe_gt_is_main_type(gt))
|
||||
return xe_guc_irq_handler(>->uc.guc, iir);
|
||||
if (instance == OTHER_MEDIA_GUC_INSTANCE && xe_gt_is_media_type(gt))
|
||||
return xe_guc_irq_handler(>->uc.guc, iir);
|
||||
|
|
|
|||
|
|
@ -2493,7 +2493,7 @@ int xe_oa_register(struct xe_device *xe)
|
|||
|
||||
static u32 num_oa_units_per_gt(struct xe_gt *gt)
|
||||
{
|
||||
if (!xe_gt_is_media_type(gt) || GRAPHICS_VER(gt_to_xe(gt)) < 20)
|
||||
if (xe_gt_is_main_type(gt) || GRAPHICS_VER(gt_to_xe(gt)) < 20)
|
||||
return 1;
|
||||
else if (!IS_DGFX(gt_to_xe(gt)))
|
||||
return XE_OAM_UNIT_SCMI_0 + 1; /* SAG + SCMI_0 */
|
||||
|
|
@ -2506,7 +2506,7 @@ static u32 __hwe_oam_unit(struct xe_hw_engine *hwe)
|
|||
if (GRAPHICS_VERx100(gt_to_xe(hwe->gt)) < 1270)
|
||||
return XE_OA_UNIT_INVALID;
|
||||
|
||||
xe_gt_WARN_ON(hwe->gt, !xe_gt_is_media_type(hwe->gt));
|
||||
xe_gt_WARN_ON(hwe->gt, xe_gt_is_main_type(hwe->gt));
|
||||
|
||||
if (GRAPHICS_VER(gt_to_xe(hwe->gt)) < 20)
|
||||
return 0;
|
||||
|
|
@ -2589,7 +2589,7 @@ static void __xe_oa_init_oa_units(struct xe_gt *gt)
|
|||
for (i = 0; i < num_units; i++) {
|
||||
struct xe_oa_unit *u = >->oa.oa_unit[i];
|
||||
|
||||
if (!xe_gt_is_media_type(gt)) {
|
||||
if (xe_gt_is_main_type(gt)) {
|
||||
u->regs = __oag_regs();
|
||||
u->type = DRM_XE_OA_UNIT_TYPE_OAG;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user