[Nouveau] [PATCH v2 0/15] Falcon library

Alexandre Courbot acourbot at nvidia.com
Tue Dec 13 08:11:16 UTC 2016


This was the first step of the secure boot refactoring - as Ben asked for some
fixes, I now submit it as its own series to make it easier to review (and also
because rebasing secure boot on top of this takes time and I don't want to do
it until this is validated!).

This series attempts to factorize the duplicate falcon-related code into a
single library, using the existing nvkm_falcon structure as a basis. Note that
this currently makes struct nvkm_falcon used for two different purposes: this
fact is acknowledged, and temporary. It just makes it easier to review this
first step.

Using the library, falcons are now acquired by a given subdev using
nvkm_falcon_get(), and released with nvkm_falcon_put(). This allows different
engines to share a falcon (as devinit, secboot and pmu will need to do), but
forces us to think about falcon ownership and handling them to the next engine
properly.

Right now the most obvious ownership issue is between secboot and pmu. I have
code coming after the secboot refactor that takes care of this ; but in the
meantime I hope we can go with the empty gm20b PMU driver in this series.

This series also updates gr, secboot and gk20a's PMU implementation to use the
falcon library as an example. Converting other engines is trivial and should make
our use of falcons generally safer.

Changes since v1:
* renamed falcon/falcon_v1.c to shorter falcon/v1.c
* add and use nvkm_gr_fini() to reserve GR falcons accurately
* pad IMEM to 0x40 words otherwise some FW will not work properly
* make IMEM/DMEM writing functions more robust
* move falcons instances into their owning subdev
* rework gk20a's PMU implementation and add dummy gm20b PMU driver

Alexandre Courbot (15):
  core: constify nv*_printk macros
  mc: add nvkm_mc_enabled() function
  core: add falcon library functions
  pmu: instanciate the falcon in PMU device
  pmu: add nvkm_pmu_ctor() function
  pmu/gk20a: use nvkm_pmu_ctor()
  pmu/gk20a: simplify code a bit
  pmu/gk20a: use falcon library functions
  gm20b: add dummy PMU device
  secboot: fix functions definitions
  secboot: use falcon library
  gr: add fini() hook
  gr/gf100: split gf100_gr_init_ctxctl()
  gr/gf100: instantiate and reserve GR falcons
  secboot: remove nvkm_secboot_start()

 drm/nouveau/include/nvkm/core/client.h    |   4 +-
 drm/nouveau/include/nvkm/core/device.h    |   3 +-
 drm/nouveau/include/nvkm/core/subdev.h    |   2 +-
 drm/nouveau/include/nvkm/engine/falcon.h  |  65 +++++-
 drm/nouveau/include/nvkm/subdev/mc.h      |   1 +-
 drm/nouveau/include/nvkm/subdev/pmu.h     |   3 +-
 drm/nouveau/include/nvkm/subdev/secboot.h |   9 +-
 drm/nouveau/nvkm/Kbuild                   |   1 +-
 drm/nouveau/nvkm/engine/device/base.c     |   2 +-
 drm/nouveau/nvkm/engine/gr/base.c         |  10 +-
 drm/nouveau/nvkm/engine/gr/gf100.c        | 300 ++++++++++++-----------
 drm/nouveau/nvkm/engine/gr/gf100.h        |   3 +-
 drm/nouveau/nvkm/engine/gr/priv.h         |   1 +-
 drm/nouveau/nvkm/falcon/Kbuild            |   2 +-
 drm/nouveau/nvkm/falcon/base.c            | 194 +++++++++++++++-
 drm/nouveau/nvkm/falcon/v1.c              | 235 ++++++++++++++++++-
 drm/nouveau/nvkm/subdev/mc/base.c         |  10 +-
 drm/nouveau/nvkm/subdev/pmu/Kbuild        |   1 +-
 drm/nouveau/nvkm/subdev/pmu/base.c        |  21 +-
 drm/nouveau/nvkm/subdev/pmu/gk20a.c       |  96 +++----
 drm/nouveau/nvkm/subdev/pmu/gm20b.c       |  34 +++-
 drm/nouveau/nvkm/subdev/pmu/priv.h        |   2 +-
 drm/nouveau/nvkm/subdev/secboot/base.c    | 163 +------------
 drm/nouveau/nvkm/subdev/secboot/gm200.c   | 152 +++---------
 drm/nouveau/nvkm/subdev/secboot/gm20b.c   |   1 +-
 drm/nouveau/nvkm/subdev/secboot/priv.h    |   7 +-
 26 files changed, 851 insertions(+), 471 deletions(-)
 create mode 100644 drm/nouveau/nvkm/falcon/Kbuild
 create mode 100644 drm/nouveau/nvkm/falcon/base.c
 create mode 100644 drm/nouveau/nvkm/falcon/v1.c
 create mode 100644 drm/nouveau/nvkm/subdev/pmu/gm20b.c

-- 
git-series 0.8.10


More information about the Nouveau mailing list