All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>,
	Michal Wajdeczko <michal.wajdeczko@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH 2/9] drm/i915: add HAS_FORCEWAKE flag to uncore
Date: Tue, 26 Mar 2019 21:48:51 +0000	[thread overview]
Message-ID: <155363692641.7042.14235605903868115478@skylake-alporthouse-com> (raw)
In-Reply-To: <op.zy9e4mjuxaggs7@mwajdecz-mobl1.ger.corp.intel.com>

Quoting Michal Wajdeczko (2019-03-26 12:47:00)
> On Mon, 25 Mar 2019 22:49:33 +0100, Daniele Ceraolo Spurio  
> <daniele.ceraolospurio@intel.com> wrote:
> 
> > We have several cases where we don't have forcewake (older gens, GVT and
> > planned display-only uncore), so, instead of checking every time against
> > the various condition, save the info in a flag and use that.
> >
> > Note that this patch also change the behavior for gen5 with vpgu
> > enabled, but this is not an issue since we don't support vgpu on gen5.
> >
> > v2: split out from previous path, fix check for missing case (Paulo)
> >
> > Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/intel_uncore.c | 31 +++++++++++++++++++----------
> >  drivers/gpu/drm/i915/intel_uncore.h |  3 +++
> >  2 files changed, 24 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_uncore.c  
> > b/drivers/gpu/drm/i915/intel_uncore.c
> > index 3f74889c4212..0259a61a745f 100644
> > --- a/drivers/gpu/drm/i915/intel_uncore.c
> > +++ b/drivers/gpu/drm/i915/intel_uncore.c
> > @@ -1391,7 +1391,7 @@ static void intel_uncore_fw_domains_init(struct  
> > intel_uncore *uncore)
> >  {
> >       struct drm_i915_private *i915 = uncore_to_i915(uncore);
> > -     if (INTEL_GEN(i915) <= 5 || intel_vgpu_active(i915))
> > +     if (!(uncore->flags & UNCORE_HAS_FORCEWAKE))
> >               return;
> >       if (INTEL_GEN(i915) >= 11) {
> > @@ -1590,6 +1590,9 @@ int intel_uncore_init(struct intel_uncore *uncore)
> >       i915_check_vgpu(i915);
> > +     if (INTEL_GEN(i915) > 5 && !intel_vgpu_active(i915))
> > +             uncore->flags |= UNCORE_HAS_FORCEWAKE;
> > +
> >       intel_uncore_edram_detect(i915);
> >       intel_uncore_fw_domains_init(uncore);
> >       __intel_uncore_early_sanitize(uncore, 0);
> > @@ -1598,12 +1601,14 @@ int intel_uncore_init(struct intel_uncore  
> > *uncore)
> >       uncore->pmic_bus_access_nb.notifier_call =
> >               i915_pmic_bus_access_notifier;
> > -     if (IS_GEN_RANGE(i915, 2, 4) || intel_vgpu_active(i915)) {
> > -             ASSIGN_WRITE_MMIO_VFUNCS(uncore, gen2);
> > -             ASSIGN_READ_MMIO_VFUNCS(uncore, gen2);
> > -     } else if (IS_GEN(i915, 5)) {
> > -             ASSIGN_WRITE_MMIO_VFUNCS(uncore, gen5);
> > -             ASSIGN_READ_MMIO_VFUNCS(uncore, gen5);
> > +     if (!(uncore->flags & UNCORE_HAS_FORCEWAKE)) {
> > +             if (IS_GEN(i915, 5)) {
> > +                     ASSIGN_WRITE_MMIO_VFUNCS(uncore, gen5);
> > +                     ASSIGN_READ_MMIO_VFUNCS(uncore, gen5);
> > +             } else {
> > +                     ASSIGN_WRITE_MMIO_VFUNCS(uncore, gen2);
> > +                     ASSIGN_READ_MMIO_VFUNCS(uncore, gen2);
> > +             }
> >       } else if (IS_GEN_RANGE(i915, 6, 7)) {
> >               ASSIGN_WRITE_MMIO_VFUNCS(uncore, gen6);
> > @@ -1912,7 +1917,10 @@ intel_uncore_forcewake_for_read(struct  
> > drm_i915_private *dev_priv,
> >       } else if (INTEL_GEN(dev_priv) >= 6) {
> >               fw_domains = __gen6_reg_read_fw_domains(uncore, offset);
> >       } else {
> > -             WARN_ON(!IS_GEN_RANGE(dev_priv, 2, 5));
> > +             /* on devices with FW we expect to hit one of the above cases */
> > +             if (unlikely(uncore->flags & UNCORE_HAS_FORCEWAKE))
> > +                     MISSING_CASE(INTEL_GEN(dev_priv));
> > +
> >               fw_domains = 0;
> >       }
> > @@ -1938,7 +1946,10 @@ intel_uncore_forcewake_for_write(struct  
> > drm_i915_private *dev_priv,
> >       } else if (IS_GEN_RANGE(dev_priv, 6, 7)) {
> >               fw_domains = FORCEWAKE_RENDER;
> >       } else {
> > -             WARN_ON(!IS_GEN_RANGE(dev_priv, 2, 5));
> > +             /* on devices with FW we expect to hit one of the above cases */
> > +             if (unlikely(uncore->flags & UNCORE_HAS_FORCEWAKE))
> > +                     MISSING_CASE(INTEL_GEN(dev_priv));
> > +
> >               fw_domains = 0;
> >       }
> > @@ -1969,7 +1980,7 @@ intel_uncore_forcewake_for_reg(struct  
> > drm_i915_private *dev_priv,
> >       WARN_ON(!op);
> > -     if (intel_vgpu_active(dev_priv))
> > +     if (!(dev_priv->uncore.flags & UNCORE_HAS_FORCEWAKE))
> 
> nit: as this condition is used in few places, maybe we can add nice helper:
> 
> static inline bool intel_uncore_has_forcewake(struct intel_uncore *uncore)
> {
>         return uncore->flags & UNCORE_HAS_FORCEWAKE;
> }

Did a quick pass to apply the nit and quieten checkpatch and pushed.

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

  reply	other threads:[~2019-03-26 21:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25 21:49 [PATCH 0/9] more uncore rework Daniele Ceraolo Spurio
2019-03-25 21:49 ` [PATCH 1/9] drm/i915: rename raw reg access functions Daniele Ceraolo Spurio
2019-03-25 22:41   ` Paulo Zanoni
2019-03-25 22:57     ` Chris Wilson
2019-03-26  4:18   ` kbuild test robot
2019-03-26  4:37   ` kbuild test robot
2019-03-25 21:49 ` [PATCH 2/9] drm/i915: add HAS_FORCEWAKE flag to uncore Daniele Ceraolo Spurio
2019-03-26  0:13   ` Paulo Zanoni
2019-03-26 12:47   ` Michal Wajdeczko
2019-03-26 21:48     ` Chris Wilson [this message]
2019-03-25 21:49 ` [PATCH 3/9] drm/i915: add uncore flags for unclaimed mmio Daniele Ceraolo Spurio
2019-03-26  0:19   ` Paulo Zanoni
2019-03-25 21:49 ` [PATCH 4/9] drm/i915: take a ref to the rpm in the uncore structure Daniele Ceraolo Spurio
2019-03-25 21:49 ` [PATCH 5/9] drm/i915: switch uncore mmio funcs to use intel_uncore Daniele Ceraolo Spurio
2019-03-25 21:49 ` [PATCH 6/9] drm/i915: switch intel_uncore_forcewake_for_reg to intel_uncore Daniele Ceraolo Spurio
2019-03-26  9:20   ` kbuild test robot
2019-03-25 21:49 ` [PATCH 7/9] drm/i915: intel_wait_for_register_fw to uncore Daniele Ceraolo Spurio
2019-03-25 22:09   ` Chris Wilson
2019-03-26 15:12   ` kbuild test robot
2019-03-25 21:49 ` [PATCH 8/9] drm/i915: switch intel_wait_for_register " Daniele Ceraolo Spurio
2019-03-26 19:17   ` kbuild test robot
2019-03-25 21:49 ` [PATCH 9/9] drm/i915: take a reference to uncore in the engine and use it Daniele Ceraolo Spurio
2019-03-25 22:21   ` Chris Wilson
2019-03-26 12:01 ` ✗ Fi.CI.CHECKPATCH: warning for more uncore rework Patchwork
2019-03-26 12:06 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-03-26 12:29 ` ✓ Fi.CI.BAT: success " Patchwork
2019-03-26 16:46 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=155363692641.7042.14235605903868115478@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.com \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.