<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 31-05-2024 18:49, Rodrigo Vivi
wrote:<br>
</div>
<blockquote type="cite" cite="mid:ZlnOVvmtsrWS80Ff@intel.com">
<pre class="moz-quote-pre" wrap="">On Fri, May 31, 2024 at 12:18:45PM +0530, Himal Prasad Ghimiray wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Make sure that the assertion condition covers the wakefulness of all
supported domains for XE_FORCEWAKE_ALL.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
The most important part is missing here: why? what issue are we trying to solve?</pre>
</blockquote>
<p>Hi Rodrigo,</p>
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.
<p>For instance, if we assume all domains are in sleep mode,
invoking <code>xe_force_wake_get(fw, XE_FORCEWAKE_GT)</code> will
only awaken the "gt" domain. Subsequently, another function needs
that all domains are awake and utilizes <code>xe_force_wake_assert_held(fw,
XE_FORCEWAKE_ALL)</code>.</p>
<p>In this scenario, the condition will inaccurately return success
because <code>fw->awake_domains</code> (0x1) & <code>XE_FORCEWAKE_ALL</code>
(0xFF) will still be 0x1 and Ideally it should have asserted.<br>
</p>
<blockquote type="cite" cite="mid:ZlnOVvmtsrWS80Ff@intel.com">
<pre class="moz-quote-pre" wrap="">
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">
Cc: Rodrigo Vivi <a class="moz-txt-link-rfc2396E" href="mailto:rodrigo.vivi@intel.com"><rodrigo.vivi@intel.com></a>
Cc: Badal Nilawar <a class="moz-txt-link-rfc2396E" href="mailto:badal.nilawar@intel.com"><badal.nilawar@intel.com></a>
Signed-off-by: Himal Prasad Ghimiray <a class="moz-txt-link-rfc2396E" href="mailto:himal.prasad.ghimiray@intel.com"><himal.prasad.ghimiray@intel.com></a>
---
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
</pre>
</blockquote>
</blockquote>
</body>
</html>