[PATCH 2/2] drm/xe: Fix xe_force_wake_assert_held for enum XE_FORCEWAKE_ALL
Ghimiray, Himal Prasad
himal.prasad.ghimiray at intel.com
Fri May 31 13:56:33 UTC 2024
On 31-05-2024 18:49, Rodrigo Vivi wrote:
> On Fri, May 31, 2024 at 12:18:45PM +0530, Himal Prasad Ghimiray wrote:
>> Make sure that the assertion condition covers the wakefulness of all
>> supported domains for XE_FORCEWAKE_ALL.
> The most important part is missing here: why? what issue are we trying to solve?
Hi Rodrigo,
AFAIU, xe_force_wake_assert_held is designed to trigger an assertion if
the provided domain is not awake, which works correctly for individual
domains. However, the assertion condition becomes incorrect for
XE_FORCEWAKE_ALL.
For instance, if we assume all domains are in sleep mode, invoking
|xe_force_wake_get(fw, XE_FORCEWAKE_GT)| will only awaken the "gt"
domain. Subsequently, another function needs that all domains are awake
and utilizes |xe_force_wake_assert_held(fw, XE_FORCEWAKE_ALL)|.
In this scenario, the condition will inaccurately return success because
|fw->awake_domains| (0x1) & |XE_FORCEWAKE_ALL| (0xFF) will still be 0x1
and Ideally it should have asserted.
>
>> Cc: Rodrigo Vivi<rodrigo.vivi at intel.com>
>> Cc: Badal Nilawar<badal.nilawar at intel.com>
>> Signed-off-by: Himal Prasad Ghimiray<himal.prasad.ghimiray at intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_force_wake.h | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_force_wake.h b/drivers/gpu/drm/xe/xe_force_wake.h
>> index 83cb157da7cc..4c986d72cba7 100644
>> --- a/drivers/gpu/drm/xe/xe_force_wake.h
>> +++ b/drivers/gpu/drm/xe/xe_force_wake.h
>> @@ -32,7 +32,12 @@ static inline void
>> xe_force_wake_assert_held(struct xe_force_wake *fw,
>> enum xe_force_wake_domains domain)
>> {
>> - xe_gt_assert(fw->gt, fw->awake_domains & domain);
>> + enum xe_force_wake_domains is_awake;
>> +
>> + is_awake = (domain == XE_FORCEWAKE_ALL) ?
>> + fw->supported_domains : domain;
>> +
>> + xe_gt_assert(fw->gt, (fw->awake_domains & is_awake) == is_awake);
>> }
>>
>> #endif
>> --
>> 2.25.1
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-xe/attachments/20240531/2c9d4a22/attachment-0001.htm>
More information about the Intel-xe
mailing list