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

drm/xe/mocs: Update handling of xe_force_wake_get return

xe_force_wake_get() now returns the reference count-incremented domain
mask. If it fails for individual domains, the return value will always
be 0. However, for XE_FORCEWAKE_ALL, it may return a non-zero value even
in the event of failure. Update the return handling of xe_force_wake_get()
to reflect this behavior, and ensure that the return value is passed as
input to xe_force_wake_put().

v3
- return xe_wakeref_t instead of int in xe_force_wake_get()
- don't use xe_assert() to report HW errors (Michal)

v5
- return unsigned int from xe_force_wake_get()
- Remove redundant warn

v7
- Fix commit message

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Nirmoy Das <Nirmoy.das@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241014075601.2324382-14-himal.prasad.ghimiray@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Himal Prasad Ghimiray and committed by
Rodrigo Vivi
a4c48a3f 6a966d67

+5 -9
+5 -9
drivers/gpu/drm/xe/xe_mocs.c
··· 774 774 775 775 void xe_mocs_dump(struct xe_gt *gt, struct drm_printer *p) 776 776 { 777 - struct xe_mocs_info table; 778 - unsigned int flags; 779 - u32 ret; 780 777 struct xe_device *xe = gt_to_xe(gt); 778 + struct xe_mocs_info table; 779 + unsigned int fw_ref, flags; 781 780 782 781 flags = get_mocs_settings(xe, &table); 783 782 784 783 xe_pm_runtime_get_noresume(xe); 785 - ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT); 786 - 787 - if (ret) 784 + fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT); 785 + if (!fw_ref) 788 786 goto err_fw; 789 787 790 788 table.ops->dump(&table, flags, gt, p); 791 789 792 - xe_force_wake_put(gt_to_fw(gt), XE_FW_GT); 793 - 790 + xe_force_wake_put(gt_to_fw(gt), fw_ref); 794 791 err_fw: 795 - xe_assert(xe, !ret); 796 792 xe_pm_runtime_put(xe); 797 793 } 798 794