[Intel-gfx] [bug report] drm/i915/uc: prefer intel_gt over i915 in GuC/HuC paths

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 23 15:17:23 UTC 2019


Quoting Daniele Ceraolo Spurio (2019-07-23 16:08:49)
> 
> 
> On 7/23/2019 8:00 AM, Dan Carpenter wrote:
> > Hello Daniele Ceraolo Spurio,
> >
> > The patch 84b1ca2f0e68: "drm/i915/uc: prefer intel_gt over i915 in
> > GuC/HuC paths" from Jul 13, 2019, leads to the following static
> > checker warning:
> >
> >       drivers/gpu/drm/i915/gt/uc/intel_huc.c:173 intel_huc_check_status()
> >       warn: masking a bool
> >
> > drivers/gpu/drm/i915/gt/uc/intel_huc.c
> >     161  int intel_huc_check_status(struct intel_huc *huc)
> >     162  {
> >     163          struct intel_gt *gt = huc_to_gt(huc);
> >     164          intel_wakeref_t wakeref;
> >     165          bool status = false;
> >                  ^^^^^^^^^^^^^^^^^^^
> >     166
> >     167          if (!intel_uc_is_using_huc(&gt->uc))
> >     168                  return -ENODEV;
> >     169
> >     170          with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
> >     171                  status = intel_uncore_read(gt->uncore, huc->status.reg);
> >     172
> >     173          return (status & huc->status.mask) == huc->status.value;
> >                          ^^^^^^
> >
> > It definitely looks like status should be a u32 or something.
> 
> Yes, definitely wrong. Will send a fix soon.
> This highlights even more the lack of testing we have around HuC.

On gen11, this works out as return (status & true) == true;

So while definitely incorrect code, it just happens to work so long as
we don't look at gen9...
-Chris


More information about the Intel-gfx mailing list