Add workaround for fixing runpm

Submitted by Karol Herbst on Sept. 17, 2019, 9 p.m.

Details

Reviewer None
Submitted Sept. 17, 2019, 9 p.m.
Last Updated Sept. 23, 2019, 8:40 p.m.
Revision 2

Cover Letter(s)

Revision 1
      I merged the both series I sent out recently into one bigger one so that
it's more obvious on why all of that is needed.

Biggest changes since last sent:
* reworked the ASPM patch
* removed "pci: add nvkm_pcie_get_speed" patch

Please test this on Laptops and report back if it either breaks something
or doesn't fix runpm.

Thanks

Karol Herbst (6):
  pci: disable ASPM before changing the link speed
  pci/gk104: enable dl_mgr safe mode
  pci/gk104: wait for ltssm idle before changing the link
  pci: enable pcie link changes for pascal
  pci: set the pcie link speed to 8.0 when suspending
  drm: abort runtime suspend if we hit an error

 drm/nouveau/include/nvkm/core/device.h |  2 ++
 drm/nouveau/include/nvkm/subdev/pci.h  |  3 +-
 drm/nouveau/nouveau_drm.c              |  6 ++++
 drm/nouveau/nvkm/subdev/clk/base.c     |  2 +-
 drm/nouveau/nvkm/subdev/pci/base.c     |  2 ++
 drm/nouveau/nvkm/subdev/pci/g84.c      |  8 +++++
 drm/nouveau/nvkm/subdev/pci/g92.c      |  1 +
 drm/nouveau/nvkm/subdev/pci/g94.c      |  1 +
 drm/nouveau/nvkm/subdev/pci/gf100.c    |  1 +
 drm/nouveau/nvkm/subdev/pci/gf106.c    |  1 +
 drm/nouveau/nvkm/subdev/pci/gk104.c    | 29 +++++++++++++-----
 drm/nouveau/nvkm/subdev/pci/gp100.c    | 11 +++++++
 drm/nouveau/nvkm/subdev/pci/pcie.c     | 42 +++++++++++++++++++++++---
 drm/nouveau/nvkm/subdev/pci/priv.h     | 16 ++++++++++
 14 files changed, 112 insertions(+), 13 deletions(-)
    
Revision 2
      Changes since last sent:
* add a patch to set the device into DRM_SWITCH_POWER_CHANGING state
  (can be dropped actually, I thought I was needing it, came up with a
   different approach and forgot to delete it, doesn't hurt though)
* expose information about runtime suspending to nvkm so that we can run
  the pcie workaround only on runtime suspend

Karol Herbst (8):
  pci: disable ASPM before changing the link speed
  pci/gk104: enable dl_mgr safe mode
  pci/gk104: wait for ltssm idle before changing the link
  pci: enable pcie link changes for pascal
  drm: set power_state to DRM_SWITCH_POWER_CHANGING before changing
  drm: be explicit about runtime suspend in fini
  pci: set the pcie link speed to 8.0 when suspending
  drm: abort runtime suspend if we hit an error

 bin/nv_init.c                           |  2 +-
 drm/nouveau/include/nvif/client.h       |  2 +-
 drm/nouveau/include/nvif/driver.h       |  2 +-
 drm/nouveau/include/nvkm/core/device.h  |  5 ++-
 drm/nouveau/include/nvkm/core/engine.h  |  2 +-
 drm/nouveau/include/nvkm/core/object.h  | 13 ++++++--
 drm/nouveau/include/nvkm/core/oproxy.h  |  2 +-
 drm/nouveau/include/nvkm/core/subdev.h  |  5 +--
 drm/nouveau/include/nvkm/subdev/pci.h   |  3 +-
 drm/nouveau/nouveau_drm.c               | 10 +++++-
 drm/nouveau/nouveau_nvif.c              |  6 ++--
 drm/nouveau/nvif/client.c               |  4 +--
 drm/nouveau/nvkm/core/client.c          |  5 ++-
 drm/nouveau/nvkm/core/engine.c          |  4 +--
 drm/nouveau/nvkm/core/ioctl.c           |  4 +--
 drm/nouveau/nvkm/core/object.c          | 22 ++++++++++---
 drm/nouveau/nvkm/core/oproxy.c          |  2 +-
 drm/nouveau/nvkm/core/subdev.c          |  4 +--
 drm/nouveau/nvkm/engine/device/base.c   | 11 ++++---
 drm/nouveau/nvkm/engine/device/pci.c    |  2 +-
 drm/nouveau/nvkm/engine/device/priv.h   |  2 +-
 drm/nouveau/nvkm/engine/device/tegra.c  |  3 +-
 drm/nouveau/nvkm/engine/device/user.c   |  2 +-
 drm/nouveau/nvkm/engine/disp/base.c     |  2 +-
 drm/nouveau/nvkm/engine/disp/channv50.c |  2 +-
 drm/nouveau/nvkm/engine/falcon.c        |  2 +-
 drm/nouveau/nvkm/engine/fifo/base.c     |  2 +-
 drm/nouveau/nvkm/engine/fifo/chan.c     |  5 +--
 drm/nouveau/nvkm/engine/fifo/gf100.c    |  2 +-
 drm/nouveau/nvkm/engine/fifo/gk104.c    |  2 +-
 drm/nouveau/nvkm/engine/gr/base.c       |  2 +-
 drm/nouveau/nvkm/engine/gr/nv04.c       |  2 +-
 drm/nouveau/nvkm/engine/gr/nv10.c       |  2 +-
 drm/nouveau/nvkm/engine/gr/nv20.c       |  2 +-
 drm/nouveau/nvkm/engine/gr/nv20.h       |  2 +-
 drm/nouveau/nvkm/engine/gr/nv40.c       |  2 +-
 drm/nouveau/nvkm/engine/mpeg/nv44.c     |  2 +-
 drm/nouveau/nvkm/engine/pm/base.c       |  2 +-
 drm/nouveau/nvkm/engine/sec2/base.c     |  2 +-
 drm/nouveau/nvkm/engine/xtensa.c        |  2 +-
 drm/nouveau/nvkm/subdev/bar/base.c      |  2 +-
 drm/nouveau/nvkm/subdev/clk/base.c      |  4 +--
 drm/nouveau/nvkm/subdev/devinit/base.c  |  2 +-
 drm/nouveau/nvkm/subdev/fault/base.c    |  2 +-
 drm/nouveau/nvkm/subdev/fault/user.c    |  2 +-
 drm/nouveau/nvkm/subdev/gpio/base.c     |  2 +-
 drm/nouveau/nvkm/subdev/i2c/base.c      |  2 +-
 drm/nouveau/nvkm/subdev/instmem/base.c  |  2 +-
 drm/nouveau/nvkm/subdev/mc/base.c       |  2 +-
 drm/nouveau/nvkm/subdev/pci/base.c      |  4 ++-
 drm/nouveau/nvkm/subdev/pci/g84.c       |  9 ++++++
 drm/nouveau/nvkm/subdev/pci/g92.c       |  1 +
 drm/nouveau/nvkm/subdev/pci/g94.c       |  1 +
 drm/nouveau/nvkm/subdev/pci/gf100.c     |  1 +
 drm/nouveau/nvkm/subdev/pci/gf106.c     |  1 +
 drm/nouveau/nvkm/subdev/pci/gk104.c     | 29 +++++++++++++----
 drm/nouveau/nvkm/subdev/pci/gp100.c     | 11 +++++++
 drm/nouveau/nvkm/subdev/pci/pcie.c      | 43 ++++++++++++++++++++++---
 drm/nouveau/nvkm/subdev/pci/priv.h      | 16 +++++++++
 drm/nouveau/nvkm/subdev/pmu/base.c      |  2 +-
 drm/nouveau/nvkm/subdev/secboot/base.c  |  2 +-
 drm/nouveau/nvkm/subdev/therm/base.c    |  2 +-
 drm/nouveau/nvkm/subdev/timer/base.c    |  2 +-
 lib/drm.c                               |  2 +-
 lib/main.c                              |  6 ++--
 lib/null.c                              |  6 ++--
 66 files changed, 224 insertions(+), 88 deletions(-)
    

Revisions