[Nouveau] [PATCH v2 2/4] gpio: fail if gpu external power is missing

Ben Skeggs skeggsb at gmail.com
Tue Jul 16 03:47:12 UTC 2019


On Mon, 15 Jul 2019 at 22:26, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>
> Please add a config override to skip this, since we'll invariably get
> it wrong for some setup, and should be able to provide users with
> workarounds while the issue is being worked out.
Yeah, this makes me nervous as well.  In the very least, I'd like a
config option, but I'm still wondering if perhaps we shouldn't limit
this to a warning (which people tend to report) for a while first too.

Also, what's NV's behaviour here?  Do they refuse to load, or do they
do something like force the GPU into its lowest pstate?

Ben.

>
> On Mon, Jul 15, 2019 at 5:43 AM Mark Menzynski <mmenzyns at redhat.com> wrote:
> >
> > Currently, nouveau doesn't check if GPU is missing power. This
> > patch makes nouveau fail when this happens on latest GPUs.
> >
> > It checks GPIO function 121 (External Power Emergency), which
> > should detect power problems on GPU initialization.
> >
> > Tested on TU104, GP106 and GF100.
> >
> > Signed-off-by: Mark Menzynski <mmenzyns at redhat.com>
> > ---
> >  drm/nouveau/include/nvkm/subdev/bios/gpio.h |  1 +
> >  drm/nouveau/nvkm/subdev/gpio/base.c         | 23 +++++++++++++++++++++
> >  2 files changed, 24 insertions(+)
> >
> > diff --git a/drm/nouveau/include/nvkm/subdev/bios/gpio.h b/drm/nouveau/include/nvkm/subdev/bios/gpio.h
> > index 2f40935f..a70ec9e8 100644
> > --- a/drm/nouveau/include/nvkm/subdev/bios/gpio.h
> > +++ b/drm/nouveau/include/nvkm/subdev/bios/gpio.h
> > @@ -7,6 +7,7 @@ enum dcb_gpio_func_name {
> >         DCB_GPIO_TVDAC0 = 0x0c,
> >         DCB_GPIO_TVDAC1 = 0x2d,
> >         DCB_GPIO_FAN_SENSE = 0x3d,
> > +       DCB_GPIO_EXT_POWER_LOW = 0x79,
> >         DCB_GPIO_LOGO_LED_PWM = 0x84,
> >         DCB_GPIO_UNUSED = 0xff,
> >         DCB_GPIO_VID0 = 0x04,
> > diff --git a/drm/nouveau/nvkm/subdev/gpio/base.c b/drm/nouveau/nvkm/subdev/gpio/base.c
> > index 1399d923..c4685807 100644
> > --- a/drm/nouveau/nvkm/subdev/gpio/base.c
> > +++ b/drm/nouveau/nvkm/subdev/gpio/base.c
> > @@ -182,12 +182,35 @@ static const struct dmi_system_id gpio_reset_ids[] = {
> >         { }
> >  };
> >
> > +static enum dcb_gpio_func_name power_checks[] = {
> > +       DCB_GPIO_EXT_POWER_LOW,
> > +};
> > +
> >  static int
> >  nvkm_gpio_init(struct nvkm_subdev *subdev)
> >  {
> >         struct nvkm_gpio *gpio = nvkm_gpio(subdev);
> > +       struct dcb_gpio_func func;
> > +       int ret;
> > +       int i;
> > +
> >         if (dmi_check_system(gpio_reset_ids))
> >                 nvkm_gpio_reset(gpio, DCB_GPIO_UNUSED);
> > +
> > +       for (i = 0; i < ARRAY_SIZE(power_checks); ++i) {
> > +               ret = nvkm_gpio_find(gpio, 0, power_checks[i], DCB_GPIO_UNUSED,
> > +                                    &func);
> > +               if (ret)
> > +                       continue;
> > +
> > +               ret = nvkm_gpio_get(gpio, 0, func.func, func.line);
> > +               if (ret) {
> > +                       nvkm_error(&gpio->subdev,
> > +                                  "not enough power, check GPU power cable\n");
> > +                       return -EINVAL;
> > +               }
> > +       }
> > +
> >         return 0;
> >  }
> >
> > --
> > 2.21.0
> >
> > _______________________________________________
> > Nouveau mailing list
> > Nouveau at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/nouveau
> _______________________________________________
> Nouveau mailing list
> Nouveau at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau


More information about the Nouveau mailing list