All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] drm/i915/uc: prefer intel_gt over i915 in GuC/HuC paths
@ 2019-07-23 15:00 Dan Carpenter
  2019-07-23 15:08 ` Daniele Ceraolo Spurio
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2019-07-23 15:00 UTC (permalink / raw)
  To: daniele.ceraolospurio; +Cc: intel-gfx

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.

   174  }

regards,
dan carpenter
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] drm/i915/uc: prefer intel_gt over i915 in GuC/HuC paths
  2019-07-23 15:00 [bug report] drm/i915/uc: prefer intel_gt over i915 in GuC/HuC paths Dan Carpenter
@ 2019-07-23 15:08 ` Daniele Ceraolo Spurio
  2019-07-23 15:17   ` Chris Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Daniele Ceraolo Spurio @ 2019-07-23 15:08 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: intel-gfx



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.

Daniele

>     174  }
>
> regards,
> dan carpenter

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] drm/i915/uc: prefer intel_gt over i915 in GuC/HuC paths
  2019-07-23 15:08 ` Daniele Ceraolo Spurio
@ 2019-07-23 15:17   ` Chris Wilson
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Wilson @ 2019-07-23 15:17 UTC (permalink / raw)
  To: Dan Carpenter, Daniele Ceraolo Spurio; +Cc: intel-gfx

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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-23 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-23 15:00 [bug report] drm/i915/uc: prefer intel_gt over i915 in GuC/HuC paths Dan Carpenter
2019-07-23 15:08 ` Daniele Ceraolo Spurio
2019-07-23 15:17   ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.