Skip to content

Commit

Permalink
drm/xe/guc: Reuse code while debugging GuC params
Browse files Browse the repository at this point in the history
There is no need to duplicate code to print GuC parameters.

Reviewed-by: Lucas De Marchi <[email protected]>
Signed-off-by: Michal Wajdeczko <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
mwajdecz committed Apr 5, 2024
1 parent 12f95f9 commit f731556
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions drivers/gpu/drm/xe/xe_guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static u32 guc_ctl_devid(struct xe_guc *guc)
return (((u32)xe->info.devid) << 16) | xe->info.revid;
}

static void guc_init_params(struct xe_guc *guc)
static void guc_print_params(struct xe_guc *guc)
{
struct xe_gt *gt = guc_to_gt(guc);
u32 *params = guc->params;
Expand All @@ -189,25 +189,27 @@ static void guc_init_params(struct xe_guc *guc)
BUILD_BUG_ON(sizeof(guc->params) != GUC_CTL_MAX_DWORDS * sizeof(u32));
BUILD_BUG_ON(GUC_CTL_MAX_DWORDS + 2 != SOFT_SCRATCH_COUNT);

for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
xe_gt_dbg(gt, "GuC param[%2d] = 0x%08x\n", i, params[i]);
}

static void guc_init_params(struct xe_guc *guc)
{
u32 *params = guc->params;

params[GUC_CTL_LOG_PARAMS] = guc_ctl_log_params_flags(guc);
params[GUC_CTL_FEATURE] = 0;
params[GUC_CTL_DEBUG] = guc_ctl_debug_flags(guc);
params[GUC_CTL_ADS] = guc_ctl_ads_flags(guc);
params[GUC_CTL_WA] = 0;
params[GUC_CTL_DEVID] = guc_ctl_devid(guc);

for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
xe_gt_dbg(gt, "GuC param[%2d] = 0x%08x\n", i, params[i]);
guc_print_params(guc);
}

static void guc_init_params_post_hwconfig(struct xe_guc *guc)
{
struct xe_gt *gt = guc_to_gt(guc);
u32 *params = guc->params;
int i;

BUILD_BUG_ON(sizeof(guc->params) != GUC_CTL_MAX_DWORDS * sizeof(u32));
BUILD_BUG_ON(GUC_CTL_MAX_DWORDS + 2 != SOFT_SCRATCH_COUNT);

params[GUC_CTL_LOG_PARAMS] = guc_ctl_log_params_flags(guc);
params[GUC_CTL_FEATURE] = guc_ctl_feature_flags(guc);
Expand All @@ -216,8 +218,7 @@ static void guc_init_params_post_hwconfig(struct xe_guc *guc)
params[GUC_CTL_WA] = guc_ctl_wa_flags(guc);
params[GUC_CTL_DEVID] = guc_ctl_devid(guc);

for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
xe_gt_dbg(gt, "GuC param[%2d] = 0x%08x\n", i, params[i]);
guc_print_params(guc);
}

/*
Expand Down

0 comments on commit f731556

Please sign in to comment.