Commit 5b2b3a0f authored by Rodrigo Vivi's avatar Rodrigo Vivi

drm/xe: Runtime PM wake on every debugfs call

Let's ensure our PCI device is awaken on every debugfs call.
Let's increase the runtime_pm protection and start moving
that to the outer bounds.

Also let's remove the mem_access_{get,put} from where they are
not needed anymore.
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240222163937.138342-7-rodrigo.vivi@intel.com
parent 1e941c98
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "xe_bo.h" #include "xe_bo.h"
#include "xe_device.h" #include "xe_device.h"
#include "xe_gt_debugfs.h" #include "xe_gt_debugfs.h"
#include "xe_pm.h"
#include "xe_step.h" #include "xe_step.h"
#ifdef CONFIG_DRM_XE_DEBUG #ifdef CONFIG_DRM_XE_DEBUG
...@@ -37,6 +38,8 @@ static int info(struct seq_file *m, void *data) ...@@ -37,6 +38,8 @@ static int info(struct seq_file *m, void *data)
struct xe_gt *gt; struct xe_gt *gt;
u8 id; u8 id;
xe_pm_runtime_get(xe);
drm_printf(&p, "graphics_verx100 %d\n", xe->info.graphics_verx100); drm_printf(&p, "graphics_verx100 %d\n", xe->info.graphics_verx100);
drm_printf(&p, "media_verx100 %d\n", xe->info.media_verx100); drm_printf(&p, "media_verx100 %d\n", xe->info.media_verx100);
drm_printf(&p, "stepping G:%s M:%s D:%s B:%s\n", drm_printf(&p, "stepping G:%s M:%s D:%s B:%s\n",
...@@ -63,6 +66,7 @@ static int info(struct seq_file *m, void *data) ...@@ -63,6 +66,7 @@ static int info(struct seq_file *m, void *data)
gt->info.engine_mask); gt->info.engine_mask);
} }
xe_pm_runtime_put(xe);
return 0; return 0;
} }
...@@ -76,8 +80,7 @@ static int forcewake_open(struct inode *inode, struct file *file) ...@@ -76,8 +80,7 @@ static int forcewake_open(struct inode *inode, struct file *file)
struct xe_gt *gt; struct xe_gt *gt;
u8 id; u8 id;
xe_device_mem_access_get(xe); xe_pm_runtime_get(xe);
for_each_gt(gt, xe, id) for_each_gt(gt, xe, id)
XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL)); XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL));
...@@ -92,8 +95,7 @@ static int forcewake_release(struct inode *inode, struct file *file) ...@@ -92,8 +95,7 @@ static int forcewake_release(struct inode *inode, struct file *file)
for_each_gt(gt, xe, id) for_each_gt(gt, xe, id)
XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL)); XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
xe_pm_runtime_put(xe);
xe_device_mem_access_put(xe);
return 0; return 0;
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "xe_lrc.h" #include "xe_lrc.h"
#include "xe_macros.h" #include "xe_macros.h"
#include "xe_pat.h" #include "xe_pat.h"
#include "xe_pm.h"
#include "xe_reg_sr.h" #include "xe_reg_sr.h"
#include "xe_reg_whitelist.h" #include "xe_reg_whitelist.h"
#include "xe_uc_debugfs.h" #include "xe_uc_debugfs.h"
...@@ -37,10 +38,10 @@ static int hw_engines(struct seq_file *m, void *data) ...@@ -37,10 +38,10 @@ static int hw_engines(struct seq_file *m, void *data)
enum xe_hw_engine_id id; enum xe_hw_engine_id id;
int err; int err;
xe_device_mem_access_get(xe); xe_pm_runtime_get(xe);
err = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL); err = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
if (err) { if (err) {
xe_device_mem_access_put(xe); xe_pm_runtime_put(xe);
return err; return err;
} }
...@@ -48,7 +49,7 @@ static int hw_engines(struct seq_file *m, void *data) ...@@ -48,7 +49,7 @@ static int hw_engines(struct seq_file *m, void *data)
xe_hw_engine_print(hwe, &p); xe_hw_engine_print(hwe, &p);
err = xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL); err = xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
xe_device_mem_access_put(xe); xe_pm_runtime_put(xe);
if (err) if (err)
return err; return err;
...@@ -59,18 +60,23 @@ static int force_reset(struct seq_file *m, void *data) ...@@ -59,18 +60,23 @@ static int force_reset(struct seq_file *m, void *data)
{ {
struct xe_gt *gt = node_to_gt(m->private); struct xe_gt *gt = node_to_gt(m->private);
xe_pm_runtime_get(gt_to_xe(gt));
xe_gt_reset_async(gt); xe_gt_reset_async(gt);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
static int sa_info(struct seq_file *m, void *data) static int sa_info(struct seq_file *m, void *data)
{ {
struct xe_tile *tile = gt_to_tile(node_to_gt(m->private)); struct xe_gt *gt = node_to_gt(m->private);
struct xe_tile *tile = gt_to_tile(gt);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_pm_runtime_get(gt_to_xe(gt));
drm_suballoc_dump_debug_info(&tile->mem.kernel_bb_pool->base, &p, drm_suballoc_dump_debug_info(&tile->mem.kernel_bb_pool->base, &p,
tile->mem.kernel_bb_pool->gpu_addr); tile->mem.kernel_bb_pool->gpu_addr);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
...@@ -80,7 +86,9 @@ static int topology(struct seq_file *m, void *data) ...@@ -80,7 +86,9 @@ static int topology(struct seq_file *m, void *data)
struct xe_gt *gt = node_to_gt(m->private); struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_pm_runtime_get(gt_to_xe(gt));
xe_gt_topology_dump(gt, &p); xe_gt_topology_dump(gt, &p);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
...@@ -90,7 +98,9 @@ static int steering(struct seq_file *m, void *data) ...@@ -90,7 +98,9 @@ static int steering(struct seq_file *m, void *data)
struct xe_gt *gt = node_to_gt(m->private); struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_pm_runtime_get(gt_to_xe(gt));
xe_gt_mcr_steering_dump(gt, &p); xe_gt_mcr_steering_dump(gt, &p);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
...@@ -99,8 +109,13 @@ static int ggtt(struct seq_file *m, void *data) ...@@ -99,8 +109,13 @@ static int ggtt(struct seq_file *m, void *data)
{ {
struct xe_gt *gt = node_to_gt(m->private); struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
int ret;
xe_pm_runtime_get(gt_to_xe(gt));
ret = xe_ggtt_dump(gt_to_tile(gt)->mem.ggtt, &p);
xe_pm_runtime_put(gt_to_xe(gt));
return xe_ggtt_dump(gt_to_tile(gt)->mem.ggtt, &p); return ret;
} }
static int register_save_restore(struct seq_file *m, void *data) static int register_save_restore(struct seq_file *m, void *data)
...@@ -110,6 +125,8 @@ static int register_save_restore(struct seq_file *m, void *data) ...@@ -110,6 +125,8 @@ static int register_save_restore(struct seq_file *m, void *data)
struct xe_hw_engine *hwe; struct xe_hw_engine *hwe;
enum xe_hw_engine_id id; enum xe_hw_engine_id id;
xe_pm_runtime_get(gt_to_xe(gt));
xe_reg_sr_dump(&gt->reg_sr, &p); xe_reg_sr_dump(&gt->reg_sr, &p);
drm_printf(&p, "\n"); drm_printf(&p, "\n");
...@@ -127,6 +144,8 @@ static int register_save_restore(struct seq_file *m, void *data) ...@@ -127,6 +144,8 @@ static int register_save_restore(struct seq_file *m, void *data)
for_each_hw_engine(hwe, gt, id) for_each_hw_engine(hwe, gt, id)
xe_reg_whitelist_dump(&hwe->reg_whitelist, &p); xe_reg_whitelist_dump(&hwe->reg_whitelist, &p);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
...@@ -135,7 +154,9 @@ static int workarounds(struct seq_file *m, void *data) ...@@ -135,7 +154,9 @@ static int workarounds(struct seq_file *m, void *data)
struct xe_gt *gt = node_to_gt(m->private); struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_pm_runtime_get(gt_to_xe(gt));
xe_wa_dump(gt, &p); xe_wa_dump(gt, &p);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
...@@ -145,48 +166,70 @@ static int pat(struct seq_file *m, void *data) ...@@ -145,48 +166,70 @@ static int pat(struct seq_file *m, void *data)
struct xe_gt *gt = node_to_gt(m->private); struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_pm_runtime_get(gt_to_xe(gt));
xe_pat_dump(gt, &p); xe_pat_dump(gt, &p);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
static int rcs_default_lrc(struct seq_file *m, void *data) static int rcs_default_lrc(struct seq_file *m, void *data)
{ {
struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_pm_runtime_get(gt_to_xe(gt));
xe_lrc_dump_default(&p, node_to_gt(m->private), XE_ENGINE_CLASS_RENDER); xe_lrc_dump_default(&p, node_to_gt(m->private), XE_ENGINE_CLASS_RENDER);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
static int ccs_default_lrc(struct seq_file *m, void *data) static int ccs_default_lrc(struct seq_file *m, void *data)
{ {
struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_pm_runtime_get(gt_to_xe(gt));
xe_lrc_dump_default(&p, node_to_gt(m->private), XE_ENGINE_CLASS_COMPUTE); xe_lrc_dump_default(&p, node_to_gt(m->private), XE_ENGINE_CLASS_COMPUTE);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
static int bcs_default_lrc(struct seq_file *m, void *data) static int bcs_default_lrc(struct seq_file *m, void *data)
{ {
struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_pm_runtime_get(gt_to_xe(gt));
xe_lrc_dump_default(&p, node_to_gt(m->private), XE_ENGINE_CLASS_COPY); xe_lrc_dump_default(&p, node_to_gt(m->private), XE_ENGINE_CLASS_COPY);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
static int vcs_default_lrc(struct seq_file *m, void *data) static int vcs_default_lrc(struct seq_file *m, void *data)
{ {
struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_pm_runtime_get(gt_to_xe(gt));
xe_lrc_dump_default(&p, node_to_gt(m->private), XE_ENGINE_CLASS_VIDEO_DECODE); xe_lrc_dump_default(&p, node_to_gt(m->private), XE_ENGINE_CLASS_VIDEO_DECODE);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
static int vecs_default_lrc(struct seq_file *m, void *data) static int vecs_default_lrc(struct seq_file *m, void *data)
{ {
struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_pm_runtime_get(gt_to_xe(gt));
xe_lrc_dump_default(&p, node_to_gt(m->private), XE_ENGINE_CLASS_VIDEO_ENHANCE); xe_lrc_dump_default(&p, node_to_gt(m->private), XE_ENGINE_CLASS_VIDEO_ENHANCE);
xe_pm_runtime_put(gt_to_xe(gt));
return 0; return 0;
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "xe_guc_ct.h" #include "xe_guc_ct.h"
#include "xe_guc_log.h" #include "xe_guc_log.h"
#include "xe_macros.h" #include "xe_macros.h"
#include "xe_pm.h"
static struct xe_guc *node_to_guc(struct drm_info_node *node) static struct xe_guc *node_to_guc(struct drm_info_node *node)
{ {
...@@ -26,9 +27,9 @@ static int guc_info(struct seq_file *m, void *data) ...@@ -26,9 +27,9 @@ static int guc_info(struct seq_file *m, void *data)
struct xe_device *xe = guc_to_xe(guc); struct xe_device *xe = guc_to_xe(guc);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_device_mem_access_get(xe); xe_pm_runtime_get(xe);
xe_guc_print_info(guc, &p); xe_guc_print_info(guc, &p);
xe_device_mem_access_put(xe); xe_pm_runtime_put(xe);
return 0; return 0;
} }
...@@ -39,9 +40,9 @@ static int guc_log(struct seq_file *m, void *data) ...@@ -39,9 +40,9 @@ static int guc_log(struct seq_file *m, void *data)
struct xe_device *xe = guc_to_xe(guc); struct xe_device *xe = guc_to_xe(guc);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_device_mem_access_get(xe); xe_pm_runtime_get(xe);
xe_guc_log_print(&guc->log, &p); xe_guc_log_print(&guc->log, &p);
xe_device_mem_access_put(xe); xe_pm_runtime_put(xe);
return 0; return 0;
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "xe_gt.h" #include "xe_gt.h"
#include "xe_huc.h" #include "xe_huc.h"
#include "xe_macros.h" #include "xe_macros.h"
#include "xe_pm.h"
static struct xe_gt * static struct xe_gt *
huc_to_gt(struct xe_huc *huc) huc_to_gt(struct xe_huc *huc)
...@@ -36,9 +37,9 @@ static int huc_info(struct seq_file *m, void *data) ...@@ -36,9 +37,9 @@ static int huc_info(struct seq_file *m, void *data)
struct xe_device *xe = huc_to_xe(huc); struct xe_device *xe = huc_to_xe(huc);
struct drm_printer p = drm_seq_file_printer(m); struct drm_printer p = drm_seq_file_printer(m);
xe_device_mem_access_get(xe); xe_pm_runtime_get(xe);
xe_huc_print_info(huc, &p); xe_huc_print_info(huc, &p);
xe_device_mem_access_put(xe); xe_pm_runtime_put(xe);
return 0; return 0;
} }
......
...@@ -73,7 +73,10 @@ static void xe_ttm_sys_mgr_del(struct ttm_resource_manager *man, ...@@ -73,7 +73,10 @@ static void xe_ttm_sys_mgr_del(struct ttm_resource_manager *man,
static void xe_ttm_sys_mgr_debug(struct ttm_resource_manager *man, static void xe_ttm_sys_mgr_debug(struct ttm_resource_manager *man,
struct drm_printer *printer) struct drm_printer *printer)
{ {
/*
* This function is called by debugfs entry and would require
* pm_runtime_{get,put} wrappers around any operation.
*/
} }
static const struct ttm_resource_manager_func xe_ttm_sys_mgr_func = { static const struct ttm_resource_manager_func xe_ttm_sys_mgr_func = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment