All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karol Herbst <kherbst@redhat.com>
To: Ben Skeggs <skeggsb@gmail.com>
Cc: nouveau <nouveau@lists.freedesktop.org>,
	Ben Skeggs <bskeggs@redhat.com>,
	stable@vger.kernel.org
Subject: Re: [Nouveau] [PATCH] ce/gf100: fix incorrect CE0 address calculation on some GPUs
Date: Thu, 4 Nov 2021 00:33:25 +0100	[thread overview]
Message-ID: <CACO55tvOAvFVhUhtttfBU9wB_2eOQL6rt8f2sKrndHgCLhHEkA@mail.gmail.com> (raw)
In-Reply-To: <CACO55tvy5atSW9SJw1E_wmfgn1cZpDiZ2T7VuS35UGXRVdpEaw@mail.gmail.com>

On Wed, Nov 3, 2021 at 8:51 AM Karol Herbst <kherbst@redhat.com> wrote:
>
> On Wed, Nov 3, 2021 at 2:11 AM Ben Skeggs <skeggsb@gmail.com> wrote:
> >
> > From: Ben Skeggs <bskeggs@redhat.com>
> >
> > The code which constructs the modules for each engine present on the GPU
> > passes -1 for 'instance' on non-instanced engines, which affects how the
> > name for a sub-device is generated.  This is then stored as 'instance 0'
> > in nvkm_subdev.inst, so code can potentially be shared with earlier GPUs
> > that only had a single instance of an engine.
> >
> > However, GF100's CE constructor uses this value to calculate the address
> > of its falcon before it's translated, resulting in CE0 getting the wrong
> > address.
> >
> > This slightly modifies the approach, always passing a valid instance for
> > engines that *can* have multiple copies, and having the code for earlier
> > GPUs explicitly ask for non-instanced name generation.
> >
> > Bug: https://gitlab.freedesktop.org/drm/nouveau/-/issues/91
> >
> > Fixes: 50551b15c760 ("drm/nouveau/ce: switch to instanced constructor")
> > Cc: <stable@vger.kernel.org> # v5.12+
> > Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
> > ---
> >  drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c    | 2 +-
> >  drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 3 +--
> >  2 files changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c
> > index 704df0f2d1f1..09a112af2f89 100644
> > --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c
> > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c
> > @@ -78,6 +78,6 @@ int
> >  gt215_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
> >              struct nvkm_engine **pengine)
> >  {
> > -       return nvkm_falcon_new_(&gt215_ce, device, type, inst,
> > +       return nvkm_falcon_new_(&gt215_ce, device, type, -1,
> >                                 (device->chipset != 0xaf), 0x104000, pengine);
> >  }
> > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
> > index ca75c5f6ecaf..b51d690f375f 100644
> > --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
> > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
> > @@ -3147,8 +3147,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
> >         WARN_ON(device->chip->ptr.inst & ~((1 << ARRAY_SIZE(device->ptr)) - 1));             \
> >         for (j = 0; device->chip->ptr.inst && j < ARRAY_SIZE(device->ptr); j++) {            \
> >                 if ((device->chip->ptr.inst & BIT(j)) && (subdev_mask & BIT_ULL(type))) {    \
> > -                       int inst = (device->chip->ptr.inst == 1) ? -1 : (j);                 \
> > -                       ret = device->chip->ptr.ctor(device, (type), inst, &device->ptr[j]); \
> > +                       ret = device->chip->ptr.ctor(device, (type), (j), &device->ptr[j]);  \
> >                         subdev = nvkm_device_subdev(device, (type), (j));                    \
> >                         if (ret) {                                                           \
> >                                 nvkm_subdev_del(&subdev);                                    \
> > --
> > 2.31.1
> >
>
> Reviewed-by: Karol Herbst <kherbst@redhat.com>

Tested that on a GF108, so

Tested-by: Karol Herbst <kherbst@redhat.com>


      reply	other threads:[~2021-11-03 23:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03  1:10 [PATCH] ce/gf100: fix incorrect CE0 address calculation on some GPUs Ben Skeggs
2021-11-03  1:10 ` [Nouveau] " Ben Skeggs
2021-11-03  7:51 ` Karol Herbst
2021-11-03 23:33   ` Karol Herbst [this message]

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=CACO55tvOAvFVhUhtttfBU9wB_2eOQL6rt8f2sKrndHgCLhHEkA@mail.gmail.com \
    --to=kherbst@redhat.com \
    --cc=bskeggs@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=skeggsb@gmail.com \
    --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 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.