[PATCH V2] drm/xe/tests/mocs: Hold XE_FORCEWAKE_ALL for LNCF regs

Upadhyay, Tejas tejas.upadhyay at intel.com
Wed Apr 30 03:34:42 UTC 2025





> -----Original Message-----

> From: Roper, Matthew D <matthew.d.roper at intel.com>

> Sent: 29 April 2025 22:41

> To: Upadhyay, Tejas <tejas.upadhyay at intel.com>

> Cc: intel-xe at lists.freedesktop.org; Ghimiray, Himal Prasad

> <himal.prasad.ghimiray at intel.com>

> Subject: Re: [PATCH V2] drm/xe/tests/mocs: Hold XE_FORCEWAKE_ALL for

> LNCF regs

>

> On Mon, Apr 28, 2025 at 01:53:57PM +0530, Tejas Upadhyay wrote:

> > LNCF registers report wrong values when XE_FORCEWAKE_GT only is held.

> > Holding XE_FORCEWAKE_ALL ensures correct operations on LNCF regs.

> >

> > V2(Himal):

> >  - Use xe_force_wake_ref_has_domain

> >

> > Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1999

>

> LNCF registers are part of the RENDER forcewake domain on Xe_LP platforms,

> so using ALL is a brute force way to fix the problem on those.  However the

> LNCF registers are documented as being part of the GT domain from Xe_HPG

> onward, so the existing code should have already been working correctly for

> those platforms.  However the original bug report was for both ADL-P (Xe_LP)

> and DG2 (Xe_HPG) so it doesn't seem like forcewake should have been the

> cause of the DG2 errors.

>

> Have you confirmed that the issue has vanished on DG2 (not just ADL)?



Pre-merge results confirmed that,

[cid:image001.png at 01DBB9AE.C309F7A0]



https://patchwork.freedesktop.org/series/147446/#rev1



There are other instances in xe driver where we use FORCEWAKE_ALL for LNCF, for example see below,

void xe_mocs_dump(struct xe_gt *gt, struct drm_printer *p)

{

        struct xe_device *xe = gt_to_xe(gt);

        struct xe_mocs_info table;

        unsigned int fw_ref, flags;



        flags = get_mocs_settings(xe, &table);



        xe_pm_runtime_get_noresume(xe);

        fw_ref = xe_force_wake_get(gt_to_fw(gt),

                                   flags & HAS_LNCF_MOCS ?

                                   XE_FORCEWAKE_ALL : XE_FW_GT);



Tejas



> If so, you should feed your findings back to the hardware team in case the

> documentation for this register range is incorrect.  There are a number of

> other LNCF and LBCF registers that the driver accesses so we should make

> sure we figure out what's actually happening here.  Also,

> i915 (the official driver for DG2) is still using GT forcewake for the LNCF

> registers on DG2 and isn't seeing problems like this, which makes it

> questionable as to whether this is truly the root cause.

>

>

> Matt

>

> > Fixes: a6a4ea6d7d37 ("drm/xe: Add mocs kunit")

> > Signed-off-by: Tejas Upadhyay <tejas.upadhyay at intel.com<mailto:tejas.upadhyay at intel.com>>

> > ---

> >  drivers/gpu/drm/xe/tests/xe_mocs.c | 7 +++++--

> >  1 file changed, 5 insertions(+), 2 deletions(-)

> >

> > diff --git a/drivers/gpu/drm/xe/tests/xe_mocs.c

> > b/drivers/gpu/drm/xe/tests/xe_mocs.c

> > index ef1e5256c56a..0e502feaca81 100644

> > --- a/drivers/gpu/drm/xe/tests/xe_mocs.c

> > +++ b/drivers/gpu/drm/xe/tests/xe_mocs.c

> > @@ -46,8 +46,11 @@ static void read_l3cc_table(struct xe_gt *gt,

> >         unsigned int fw_ref, i;

> >         u32 reg_val;

> >

> > -       fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);

> > -       KUNIT_ASSERT_NE_MSG(test, fw_ref, 0, "Forcewake Failed.\n");

> > +      fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);

> > +      if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {

> > +                    xe_force_wake_put(gt_to_fw(gt), fw_ref);

> > +                    KUNIT_ASSERT_TRUE_MSG(test, true, "Forcewake Failed.\n");

> > +      }

> >

> >         for (i = 0; i < info->num_mocs_regs; i++) {

> >                       if (!(i & 1)) {

> > --

> > 2.34.1

> >

>

> --

> Matt Roper

> Graphics Software Engineer

> Linux GPU Platform Enablement

> Intel Corporation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-xe/attachments/20250430/a835f4d6/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 27630 bytes
Desc: image001.png
URL: <https://lists.freedesktop.org/archives/intel-xe/attachments/20250430/a835f4d6/attachment-0001.png>


More information about the Intel-xe mailing list