linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Skeggs <skeggsb@gmail.com>
To: Karol Herbst <kherbst@redhat.com>
Cc: lyude@redhat.com, Dave Airlie <airlied@linux.ie>,
	nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Ben Skeggs <bskeggs@redhat.com>
Subject: Re: [Nouveau] [PATCH 4/5] drm/nouveau: Grab RPM ref when i2c bus is in use
Date: Tue, 17 Jul 2018 21:54:37 +1000	[thread overview]
Message-ID: <CACAvsv4Rg32Fhq-4yOBWhUooWE+WzG5fQzvN+jYn4Uruc5kDLw@mail.gmail.com> (raw)
In-Reply-To: <CACO55tv9B+GNM=nhpH1UfeWd9F1x5nTp+vHSuJ-TsuzRFK_AEA@mail.gmail.com>

On Tue, 17 Jul 2018 at 20:18, Karol Herbst <kherbst@redhat.com> wrote:
>
> mhh, we shouldn't call to Linux APIs from within of nvkm. Rather gaurd
> the Linux glue code to the i2c stuff instead, but this is all done
> from inside of nvkm. I think we should move it out into
> drm/nouveau/nouveau_i2c.c and do the handling there.
Huh?  No, this is completely fine.

>
> On Tue, Jul 17, 2018 at 1:59 AM, Lyude Paul <lyude@redhat.com> wrote:
> > The i2c bus can be both accessed by DRM itself, along with any of it's
> > devnodes (/sys/class/i2c). So, we need to make sure that all codepaths
> > using the i2c bus keep the GPU resumed.
> >
> > Signed-off-by: Lyude Paul <lyude@redhat.com>
> > Cc: Karol Herbst <karolherbst@gmail.com>
> > Cc: stable@vger.kernel.org
> > ---
> >  drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c
> > index 807a2b67bd64..1de48c990b80 100644
> > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c
> > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c
> > @@ -119,18 +119,28 @@ nvkm_i2c_bus_release(struct nvkm_i2c_bus *bus)
> >         BUS_TRACE(bus, "release");
> >         nvkm_i2c_pad_release(pad);
> >         mutex_unlock(&bus->mutex);
> > +       pm_runtime_put_autosuspend(pad->i2c->subdev.device->dev);
> >  }
> >
> >  int
> >  nvkm_i2c_bus_acquire(struct nvkm_i2c_bus *bus)
> >  {
> >         struct nvkm_i2c_pad *pad = bus->pad;
> > +       struct device *dev = pad->i2c->subdev.device->dev;
> >         int ret;
> > +
> >         BUS_TRACE(bus, "acquire");
> > +
> > +       ret = pm_runtime_get_sync(dev);
> > +       if (ret < 0 && ret != -EACCES)
> > +               return ret;
> > +
> >         mutex_lock(&bus->mutex);
> >         ret = nvkm_i2c_pad_acquire(pad, NVKM_I2C_PAD_I2C);
> > -       if (ret)
> > +       if (ret) {
> >                 mutex_unlock(&bus->mutex);
> > +               pm_runtime_put_autosuspend(dev);
> > +       }
> >         return ret;
> >  }
> >
> > --
> > 2.17.1
> >
> > _______________________________________________
> > Nouveau mailing list
> > Nouveau@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/nouveau
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau

  reply	other threads:[~2018-07-17 11:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 23:59 [PATCH 0/5] drm/nouveau: Fix a lot of nasty RPM bugs and deadlocks Lyude Paul
2018-07-16 23:59 ` [PATCH 1/5] drm/nouveau: Prevent RPM callback recursion in suspend/resume paths Lyude Paul
2018-07-17  7:16   ` [Nouveau] " Lukas Wunner
2018-07-17  7:39     ` Rafael J. Wysocki
2018-07-17 16:53     ` Lyude Paul
2018-07-17 18:20       ` Lukas Wunner
2018-07-17 18:24         ` Lyude Paul
2018-07-17 18:32           ` Lukas Wunner
2018-07-17 18:34             ` Lyude Paul
2018-07-18  7:40               ` Rafael J. Wysocki
2018-07-18  7:47               ` Lukas Wunner
2018-07-18  7:38         ` Rafael J. Wysocki
2018-07-18  8:25           ` Lukas Wunner
2018-07-18  8:35             ` Rafael J. Wysocki
2018-07-18  8:36             ` Lukas Wunner
2018-07-18 20:11               ` Lyude Paul
2018-07-18 21:49                 ` Rafael J. Wysocki
2018-07-16 23:59 ` [PATCH 2/5] drm/nouveau: Grab RPM ref while probing outputs Lyude Paul
2018-07-17  7:21   ` [Nouveau] " Lukas Wunner
2018-07-17 10:12     ` Karol Herbst
2018-07-16 23:59 ` [PATCH 3/5] drm/nouveau: Add missing RPM get/put() when probing connectors Lyude Paul
2018-07-17 10:11   ` [Nouveau] " Karol Herbst
2018-07-16 23:59 ` [PATCH 4/5] drm/nouveau: Grab RPM ref when i2c bus is in use Lyude Paul
2018-07-17 10:17   ` [Nouveau] " Karol Herbst
2018-07-17 11:54     ` Ben Skeggs [this message]
2018-07-17 12:10       ` Karol Herbst
2018-07-16 23:59 ` [PATCH 5/5] drm/nouveau: Grab RPM ref when aux " Lyude Paul

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=CACAvsv4Rg32Fhq-4yOBWhUooWE+WzG5fQzvN+jYn4Uruc5kDLw@mail.gmail.com \
    --to=skeggsb@gmail.com \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kherbst@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).