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

Matt Roper matthew.d.roper at intel.com
Tue Apr 29 17:11:21 UTC 2025


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)?
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>
> ---
>  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


More information about the Intel-xe mailing list