Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe/xe_gt_idle: modify powergate enable condition

Modify powergate enable condition based on the type of GT or presence of
media engines. Also have a copy of the value written to powergate enable
register.

v2: add condition to enable render or media powergating (Badal)

v3: fix commit message (Shekhar)
fix kernel-doc

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Shekhar Chauhan <shekhar.chauhan@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240906071126.28078-2-riana.tauro@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Riana Tauro and committed by
Rodrigo Vivi
c2bf07dd 5ea28f92

+20 -8
+18 -8
drivers/gpu/drm/xe/xe_gt_idle.c
··· 98 98 void xe_gt_idle_enable_pg(struct xe_gt *gt) 99 99 { 100 100 struct xe_device *xe = gt_to_xe(gt); 101 - u32 pg_enable; 101 + struct xe_gt_idle *gtidle = &gt->gtidle; 102 + u32 vcs_mask, vecs_mask; 102 103 int i, j; 103 104 104 105 if (IS_SRIOV_VF(xe)) ··· 111 110 112 111 xe_device_assert_mem_access(gt_to_xe(gt)); 113 112 114 - pg_enable = RENDER_POWERGATE_ENABLE | MEDIA_POWERGATE_ENABLE; 113 + vcs_mask = xe_hw_engine_mask_per_class(gt, XE_ENGINE_CLASS_VIDEO_DECODE); 114 + vecs_mask = xe_hw_engine_mask_per_class(gt, XE_ENGINE_CLASS_VIDEO_ENHANCE); 115 + 116 + if (vcs_mask || vecs_mask) 117 + gtidle->powergate_enable = MEDIA_POWERGATE_ENABLE; 118 + 119 + if (!xe_gt_is_media_type(gt)) 120 + gtidle->powergate_enable |= RENDER_POWERGATE_ENABLE; 115 121 116 122 for (i = XE_HW_ENGINE_VCS0, j = 0; i <= XE_HW_ENGINE_VCS7; ++i, ++j) { 117 123 if ((gt->info.engine_mask & BIT(i))) 118 - pg_enable |= (VDN_HCP_POWERGATE_ENABLE(j) | 119 - VDN_MFXVDENC_POWERGATE_ENABLE(j)); 124 + gtidle->powergate_enable |= (VDN_HCP_POWERGATE_ENABLE(j) | 125 + VDN_MFXVDENC_POWERGATE_ENABLE(j)); 120 126 } 121 127 122 128 XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FW_GT)); ··· 136 128 xe_mmio_write32(gt, RENDER_POWERGATE_IDLE_HYSTERESIS, 25); 137 129 } 138 130 139 - xe_mmio_write32(gt, POWERGATE_ENABLE, pg_enable); 131 + xe_mmio_write32(gt, POWERGATE_ENABLE, gtidle->powergate_enable); 140 132 XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FW_GT)); 141 133 } 142 134 143 135 void xe_gt_idle_disable_pg(struct xe_gt *gt) 144 136 { 137 + struct xe_gt_idle *gtidle = &gt->gtidle; 138 + 145 139 if (IS_SRIOV_VF(gt_to_xe(gt))) 146 140 return; 147 141 148 142 xe_device_assert_mem_access(gt_to_xe(gt)); 143 + gtidle->powergate_enable = 0; 144 + 149 145 XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FW_GT)); 150 - 151 - xe_mmio_write32(gt, POWERGATE_ENABLE, 0); 152 - 146 + xe_mmio_write32(gt, POWERGATE_ENABLE, gtidle->powergate_enable); 153 147 XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FW_GT)); 154 148 } 155 149
+2
drivers/gpu/drm/xe/xe_gt_idle_types.h
··· 23 23 struct xe_gt_idle { 24 24 /** @name: name */ 25 25 char name[16]; 26 + /** @powergate_enable: copy of powergate enable bits */ 27 + u32 powergate_enable; 26 28 /** @residency_multiplier: residency multiplier in ns */ 27 29 u32 residency_multiplier; 28 30 /** @cur_residency: raw driver copy of idle residency */