mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-09-01 13:17:05 +00:00
drm/xe: Introduce GuC PC debugfs
Allows the visualization of the current GuC power conservation status and policies. v2: Fix DCC msg (Vinay) v3: Simplify pc_get_state_string (Jonathan) Reviewed-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250115145053.1142023-1-rodrigo.vivi@intel.com Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
0af944f0e3
commit
aaab5404b1
@ -13,6 +13,7 @@
|
||||
#include "xe_guc.h"
|
||||
#include "xe_guc_ct.h"
|
||||
#include "xe_guc_log.h"
|
||||
#include "xe_guc_pc.h"
|
||||
#include "xe_macros.h"
|
||||
#include "xe_pm.h"
|
||||
|
||||
@ -60,10 +61,24 @@ static int guc_ctb(struct seq_file *m, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int guc_pc(struct seq_file *m, void *data)
|
||||
{
|
||||
struct xe_guc *guc = node_to_guc(m->private);
|
||||
struct xe_device *xe = guc_to_xe(guc);
|
||||
struct drm_printer p = drm_seq_file_printer(m);
|
||||
|
||||
xe_pm_runtime_get(xe);
|
||||
xe_guc_pc_print(&guc->pc, &p);
|
||||
xe_pm_runtime_put(xe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct drm_info_list debugfs_list[] = {
|
||||
{"guc_info", guc_info, 0},
|
||||
{"guc_log", guc_log, 0},
|
||||
{"guc_ctb", guc_ctb, 0},
|
||||
{"guc_pc", guc_pc, 0},
|
||||
};
|
||||
|
||||
void xe_guc_debugfs_register(struct xe_guc *guc, struct dentry *parent)
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <drm/drm_managed.h>
|
||||
#include <drm/drm_print.h>
|
||||
#include <generated/xe_wa_oob.h>
|
||||
|
||||
#include "abi/guc_actions_slpc_abi.h"
|
||||
@ -1131,3 +1132,61 @@ int xe_guc_pc_init(struct xe_guc_pc *pc)
|
||||
|
||||
return devm_add_action_or_reset(xe->drm.dev, xe_guc_pc_fini_hw, pc);
|
||||
}
|
||||
|
||||
static const char *pc_get_state_string(struct xe_guc_pc *pc)
|
||||
{
|
||||
switch (slpc_shared_data_read(pc, header.global_state)) {
|
||||
case SLPC_GLOBAL_STATE_NOT_RUNNING:
|
||||
return "not running";
|
||||
case SLPC_GLOBAL_STATE_INITIALIZING:
|
||||
return "initializing";
|
||||
case SLPC_GLOBAL_STATE_RESETTING:
|
||||
return "resetting";
|
||||
case SLPC_GLOBAL_STATE_RUNNING:
|
||||
return "running";
|
||||
case SLPC_GLOBAL_STATE_SHUTTING_DOWN:
|
||||
return "shutting down";
|
||||
case SLPC_GLOBAL_STATE_ERROR:
|
||||
return "error";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xe_guc_pc_print - Print GuC's Power Conservation information for debug
|
||||
* @pc: Xe_GuC_PC instance
|
||||
* @p: drm_printer
|
||||
*/
|
||||
void xe_guc_pc_print(struct xe_guc_pc *pc, struct drm_printer *p)
|
||||
{
|
||||
drm_printf(p, "SLPC Shared Data Header:\n");
|
||||
drm_printf(p, "\tSize: %x\n", slpc_shared_data_read(pc, header.size));
|
||||
drm_printf(p, "\tGlobal State: %s\n", pc_get_state_string(pc));
|
||||
|
||||
if (pc_action_query_task_state(pc))
|
||||
return;
|
||||
|
||||
drm_printf(p, "\nSLPC Tasks Status:\n");
|
||||
drm_printf(p, "\tGTPERF enabled: %s\n",
|
||||
str_yes_no(slpc_shared_data_read(pc, task_state_data.status) &
|
||||
SLPC_GTPERF_TASK_ENABLED));
|
||||
drm_printf(p, "\tDCC enabled: %s\n",
|
||||
str_yes_no(slpc_shared_data_read(pc, task_state_data.status) &
|
||||
SLPC_DCC_TASK_ENABLED));
|
||||
drm_printf(p, "\tDCC in use: %s\n",
|
||||
str_yes_no(slpc_shared_data_read(pc, task_state_data.status) &
|
||||
SLPC_IN_DCC));
|
||||
drm_printf(p, "\tBalancer enabled: %s\n",
|
||||
str_yes_no(slpc_shared_data_read(pc, task_state_data.status) &
|
||||
SLPC_BALANCER_ENABLED));
|
||||
drm_printf(p, "\tIBC enabled: %s\n",
|
||||
str_yes_no(slpc_shared_data_read(pc, task_state_data.status) &
|
||||
SLPC_IBC_TASK_ENABLED));
|
||||
drm_printf(p, "\tBalancer IA LMT enabled: %s\n",
|
||||
str_yes_no(slpc_shared_data_read(pc, task_state_data.status) &
|
||||
SLPC_BALANCER_IA_LMT_ENABLED));
|
||||
drm_printf(p, "\tBalancer IA LMT active: %s\n",
|
||||
str_yes_no(slpc_shared_data_read(pc, task_state_data.status) &
|
||||
SLPC_BALANCER_IA_LMT_ACTIVE));
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
struct xe_guc_pc;
|
||||
enum slpc_gucrc_mode;
|
||||
struct drm_printer;
|
||||
|
||||
int xe_guc_pc_init(struct xe_guc_pc *pc);
|
||||
int xe_guc_pc_start(struct xe_guc_pc *pc);
|
||||
@ -17,6 +18,7 @@ int xe_guc_pc_stop(struct xe_guc_pc *pc);
|
||||
int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc);
|
||||
int xe_guc_pc_override_gucrc_mode(struct xe_guc_pc *pc, enum slpc_gucrc_mode mode);
|
||||
int xe_guc_pc_unset_gucrc_mode(struct xe_guc_pc *pc);
|
||||
void xe_guc_pc_print(struct xe_guc_pc *pc, struct drm_printer *p);
|
||||
|
||||
u32 xe_guc_pc_get_act_freq(struct xe_guc_pc *pc);
|
||||
int xe_guc_pc_get_cur_freq(struct xe_guc_pc *pc, u32 *freq);
|
||||
|
Loading…
Reference in New Issue
Block a user