drm/xe: Add a flag that can disable GuC PM
Subsystems (2)
cover drm/xe: Add a flag that can disable GuC PM
This could be used to enable HW C6 and also debug any GuC related PM issues.
Vinay Belgaumkar (3):
drm/xe: Rename xe_gt_idle_sysfs to xe_gt_idle drm/xe: Add skip_guc_pc flag
drm/xe: Manually setup C6 when skip_guc_pc is set
drivers/gpu/drm/xe/Makefile | 2 +-
drivers/gpu/drm/xe/regs/xe_gt_regs.h | 4 +++
drivers/gpu/drm/xe/xe_device_types.h | 2 ++
drivers/gpu/drm/xe/xe_gt.c | 2 +-
.../xe/{xe_gt_idle_sysfs.c => xe_gt_idle.c} | 28 +++++++++++++--
drivers/gpu/drm/xe/xe_gt_idle.h | 17 +++++++++
drivers/gpu/drm/xe/xe_gt_idle_sysfs.h | 13 -------
..._idle_sysfs_types.h => xe_gt_idle_types.h} | 0
drivers/gpu/drm/xe/xe_gt_types.h | 2 +-
drivers/gpu/drm/xe/xe_guc_pc.c | 35 +++++++++++++++++--
drivers/gpu/drm/xe/xe_pci.c | 2 ++
11 files changed, 86 insertions(+), 21 deletions(-)
rename drivers/gpu/drm/xe/{xe_gt_idle_sysfs.c => xe_gt_idle.c} (85%)
create mode 100644 drivers/gpu/drm/xe/xe_gt_idle.h
delete mode 100644 drivers/gpu/drm/xe/xe_gt_idle_sysfs.h
rename drivers/gpu/drm/xe/{xe_gt_idle_sysfs_types.h => xe_gt_idle_types.h} (100%)Signature · 1 line
2.38.1
PATCH 1/3 drm/xe: Rename xe_gt_idle_sysfs to xe_gt_idle
Prep this file to contain C6 toggling as well instead of just sysfs related stuff.
---
drivers/gpu/drm/xe/Makefile | 2 +-
drivers/gpu/drm/xe/xe_gt.c | 2 +-
drivers/gpu/drm/xe/{xe_gt_idle_sysfs.c => xe_gt_idle.c} | 4 ++--
drivers/gpu/drm/xe/{xe_gt_idle_sysfs.h => xe_gt_idle.h} | 8 ++++----
.../xe/{xe_gt_idle_sysfs_types.h => xe_gt_idle_types.h} | 0
drivers/gpu/drm/xe/xe_gt_types.h | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
rename drivers/gpu/drm/xe/{xe_gt_idle_sysfs.c => xe_gt_idle.c} (98%)
rename drivers/gpu/drm/xe/{xe_gt_idle_sysfs.h => xe_gt_idle.h} (52%)
rename drivers/gpu/drm/xe/{xe_gt_idle_sysfs_types.h => xe_gt_idle_types.h} (100%)drivers/gpu/drm/xe/Makefile +1 -1
@@ -61,7 +61,7 @@ xe-y += xe_bb.o \ xe_gt.o \ xe_gt_clock.o \ xe_gt_debugfs.o \ - xe_gt_idle_sysfs.o \ + xe_gt_idle.o \ xe_gt_mcr.o \ xe_gt_pagefault.o \ xe_gt_sysfs.o \
drivers/gpu/drm/xe/xe_gt.c +1 -1
@@ -22,7 +22,7 @@#include "xe_force_wake.h" #include "xe_ggtt.h" #include "xe_gt_clock.h" -#include "xe_gt_idle_sysfs.h" +#include "xe_gt_idle.h" #include "xe_gt_mcr.h" #include "xe_gt_pagefault.h" #include "xe_gt_printk.h"
drivers/gpu/drm/xe/xe_gt_idle.c renamed from drivers/gpu/drm/xe/xe_gt_idle_sysfs.c +2 -2
@@ -7,14 +7,14 @@#include "xe_device.h" #include "xe_gt.h" -#include "xe_gt_idle_sysfs.h" +#include "xe_gt_idle.h" #include "xe_gt_sysfs.h" #include "xe_guc_pc.h" /** * DOC: Xe GT Idle * -* Provides sysfs entries for idle properties of GT +* Contains functions that init GT idle features like C6 * * device/gt#/gtidle/name - name of the state * device/gt#/gtidle/idle_residency_ms - Provides residency of the idle state in ms
drivers/gpu/drm/xe/xe_gt_idle.h renamed from drivers/gpu/drm/xe/xe_gt_idle_sysfs.h +4 -4
@@ -3,11 +3,11 @@* Copyright © 2023 Intel Corporation */ -#ifndef _XE_GT_IDLE_SYSFS_H_ -#define _XE_GT_IDLE_SYSFS_H_ +#ifndef _XE_GT_IDLE_H_ +#define _XE_GT_IDLE_H_ -#include "xe_gt_idle_sysfs_types.h" +#include "xe_gt_idle_types.h" void xe_gt_idle_sysfs_init (struct xe_gt_idle *gtidle); -#endif /* _XE_GT_IDLE_SYSFS_H_ */ +#endif /* _XE_GT_IDLE_H_ */
drivers/gpu/drm/xe/xe_gt_idle_types.h renamed from drivers/gpu/drm/xe/xe_gt_idle_sysfs_types.h +0 -0
drivers/gpu/drm/xe/xe_gt_types.h +1 -1
@@ -7,7 +7,7 @@#define _XE_GT_TYPES_H_#include "xe_force_wake_types.h" -#include "xe_gt_idle_sysfs_types.h" +#include "xe_gt_idle_types.h" #include "xe_hw_engine_types.h" #include "xe_hw_fence_types.h" #include "xe_reg_sr_types.h"
Signature · 1 line
2.38.1
PATCH 2/3 drm/xe: Add skip_guc_pc flag
In reply to Vinay BelgaumkarThis flag can be used to disable GuC based power management. This could be used for debug or comparison to host based C6.
--- drivers/gpu/drm/xe/xe_device_types.h | 2 ++ drivers/gpu/drm/xe/xe_pci.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/gpu/drm/xe/xe_device_types.h +2 -0
@@ -261,6 +261,8 @@ struct xe_device { u8 supports_mmio_ext:1;/** @has_heci_gscfi: device has heci gscfi */ u8 has_heci_gscfi:1; +/** @skip_guc_pc: Skip GuC based PM feature init */ + u8 skip_guc_pc:1; #if IS_ENABLED(CONFIG_DRM_XE_DISPLAY) struct {
drivers/gpu/drm/xe/xe_pci.c +2 -0
@@ -62,6 +62,7 @@ struct xe_device_desc { u8 has_llc:1; u8 bypass_mtcfg:1; u8 supports_mmio_ext:1; + u8 skip_guc_pc:1; };__diag_push ();
@@ -590,6 +591,7 @@ static int xe_info_init(struct xe_device *xe, xe->info.has_asid = graphics_desc->has_asid; xe->info.has_flat_ccs = graphics_desc->has_flat_ccs; xe->info.has_range_tlb_invalidation = graphics_desc->has_range_tlb_invalidation; + xe->info.skip_guc_pc = desc->skip_guc_pc; xe->info.enable_display =IS_ENABLED (CONFIG_DRM_XE_DISPLAY ) && enable_display &&
Signature · 1 line
2.38.1
PATCH 3/3 drm/xe: Manually setup C6 when skip_guc_pc is set
In reply to Vinay BelgaumkarSkip the init/start/stop GuC PC functions and toggle C6 using register writes instead. Also request max possible frequency as dynamic freq management is disabled.
v2: Fix compile warning
--- drivers/gpu/drm/xe/regs/xe_gt_regs.h | 4 ++++ drivers/gpu/drm/xe/xe_gt_idle.c | 24 +++++++++++++++++++ drivers/gpu/drm/xe/xe_gt_idle.h | 4 ++++ drivers/gpu/drm/xe/xe_guc_pc.c | 35 +++++++++++++++++++++++++--- 4 files changed, 64 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/regs/xe_gt_regs.h +4 -0
@@ -269,7 +269,11 @@#define RPSWCTL_ENABLE REG_FIELD_PREP(RPSWCTL_MASK, 2)#define RPSWCTL_DISABLE REG_FIELD_PREP(RPSWCTL_MASK, 0)#define RC_CONTROL XE_REG(0xa090) +#define RC_CTL_HW_ENABLE REG_BIT(31) +#define RC_CTL_TO_MODE REG_BIT(28) +#define RC_CTL_RC6_ENABLE REG_BIT(18)#define RC_STATE XE_REG(0xa094) +#define RC_IDLE_HYSTERSIS XE_REG(0xa0ac)#define PMINTRMSK XE_REG(0xa168)#define PMINTR_DISABLE_REDIRECT_TO_GUC REG_BIT(31)
drivers/gpu/drm/xe/xe_gt_idle.c +24 -0
@@ -10,6 +10,8 @@#include "xe_gt_idle.h" #include "xe_gt_sysfs.h" #include "xe_guc_pc.h" +#include "regs/xe_gt_regs.h" +#include "xe_mmio.h" /** * DOC: Xe GT Idle
@@ -166,3 +168,25 @@ void xe_gt_idle_sysfs_init(struct xe_gt_idle *gtidle)drm_warn (&xe->drm,"%s: drmm_add_action_or_reset failed, err: %d\n" , __func__, err); } + +void xe_gt_idle_enable_c6 (struct xe_gt *gt) +{ +xe_device_assert_mem_access (gt_to_xe (gt)); +xe_force_wake_assert_held (gt_to_fw (gt),XE_FW_GT ); + +/* Units of 1280 ns for a total of 5s */ +xe_mmio_write32 (gt,RC_IDLE_HYSTERSIS ,0x3B9ACA ); +/* Enable RC6 */ +xe_mmio_write32 (gt,RC_CONTROL , +RC_CTL_HW_ENABLE |RC_CTL_TO_MODE |RC_CTL_RC6_ENABLE ); +} + +void xe_gt_idle_disable_c6 (struct xe_gt *gt) +{ +xe_device_assert_mem_access (gt_to_xe (gt)); +xe_force_wake_assert_held (gt_to_fw (gt),XE_FORCEWAKE_ALL ); + +xe_mmio_write32 (gt,PG_ENABLE ,0 ); +xe_mmio_write32 (gt,RC_CONTROL ,0 ); +xe_mmio_write32 (gt,RC_STATE ,0 ); +}
drivers/gpu/drm/xe/xe_gt_idle.h +4 -0
@@ -8,6 +8,10 @@#include "xe_gt_idle_types.h" +struct xe_gt ; +void xe_gt_idle_sysfs_init (struct xe_gt_idle *gtidle); +void xe_gt_idle_enable_c6 (struct xe_gt *gt); +void xe_gt_idle_disable_c6 (struct xe_gt *gt);#endif /* _XE_GT_IDLE_H_ */
drivers/gpu/drm/xe/xe_guc_pc.c +32 -3
@@ -14,6 +14,7 @@#include "xe_bo.h" #include "xe_device.h" #include "xe_gt.h" +#include "xe_gt_idle.h" #include "xe_gt_sysfs.h" #include "xe_gt_types.h" #include "xe_guc_ct.h"
@@ -867,13 +868,24 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)xe_device_mem_access_get (pc_to_xe (pc)); -memset (pc->bo->vmap.vaddr,0 , size); -slpc_shared_data_write (pc, header.size, size); - ret =xe_force_wake_get (gt_to_fw (gt),XE_FORCEWAKE_ALL );if (ret) goto out_fail_force_wake; +if (xe->info.skip_guc_pc) { +if (xe->info.platform !=XE_PVC ) +xe_gt_idle_enable_c6 (gt); + +/* Request max possible since dynamic freq mgmt is not enabled */ +pc_set_cur_freq (pc,UINT_MAX ); + + ret =0 ; + goto out; + } + +memset (pc->bo->vmap.vaddr,0 , size); +slpc_shared_data_write (pc, header.size, size); + ret =pc_action_reset (pc);if (ret) goto out;
@@ -909,10 +921,17 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)*/ int xe_guc_pc_stop (struct xe_guc_pc *pc) { +struct xe_device *xe =pc_to_xe (pc);int ret;xe_device_mem_access_get (pc_to_xe (pc)); +if (xe->info.skip_guc_pc) { +xe_gt_idle_disable_c6 (pc_to_gt (pc)); + ret =0 ; + goto out; + } +mutex_lock (&pc->freq_lock); pc->freq_ready = false;mutex_unlock (&pc->freq_lock);
@@ -933,6 +952,13 @@ int xe_guc_pc_stop(struct xe_guc_pc *pc)void xe_guc_pc_fini (struct xe_guc_pc *pc) { +struct xe_device *xe =pc_to_xe (pc); + +if (xe->info.skip_guc_pc) { +xe_gt_idle_disable_c6 (pc_to_gt (pc)); +return ; + } +XE_WARN_ON (xe_guc_pc_gucrc_disable (pc));XE_WARN_ON (xe_guc_pc_stop (pc));sysfs_remove_files (pc_to_gt (pc)->sysfs, pc_attrs);
@@ -953,6 +979,9 @@ int xe_guc_pc_init(struct xe_guc_pc *pc)u32 size =PAGE_ALIGN (sizeof (struct slpc_shared_data ));int err; +if (xe->info.skip_guc_pc) +return 0 ; +mutex_init (&pc->freq_lock); bo = xe_bo_create_pin_map(xe, tile, NULL, size,
Signature · 1 line
2.38.1
Patchwork
CI[Intel-xe] ✗ CI.Patch_applied: failure for drm/xe: Add a flag that can disable GuC PM (rev2)
In reply to Vinay Belgaumkar== Series Details ==
== Series Details ==
Series: drm/xe: Add a flag that can disable GuC PM (rev2)
URL : https://patchwork.freedesktop.org/series/126788/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 7cd1cacf1 drm/xe: Sync MTL PCI IDs with i915 === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_pci.c:62
error: drivers/gpu/drm/xe/xe_pci.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe: Rename xe_gt_idle_sysfs to xe_gt_idle
Applying: drm/xe: Add skip_guc_pc flag
Patch failed at 0002 drm/xe: Add skip_guc_pc flag
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".