Volting/Clocking improvements for Fermi and newer

Submitted by Karol Herbst on March 17, 2016, 10:41 p.m.

Details

Reviewer None
Submitted March 17, 2016, 10:41 p.m.
Last Updated April 18, 2016, 7:15 p.m.
Revision 4

Cover Letter(s)

Revision 1
      This series fixes most of the issues regarding volting on GPUs with any form
of GPU Boost inside their vbios, which is mainly Kepler and newer, but we find
some boosting related tables in Fermi vbios' already

In the end reclocking should work on most Kepler cards without any issues

Karol Herbst (19):
  bios/volt: handle voltage table version 0x50 with 0ed header
  volt: properly detect entry based voltage tables
  bios: add parsing of BASE CLOCK table
  clk: print the base clocks
  clk: allow boosting only when NvBoost is set
  volt: save the voltage range we are able to set
  volt: add nvkm_volt_map_min function
  clk: don't create cstates which voltage is higher than what the gpu
    can do
  volt: parse the both max voltage entries
  volt: add min_id parameter to nvkm_volt_set_id
  clk: export nvkm_volt_map
  clk: add index field to nvkm_cstate
  add daemon to compare nouveau with blob voltage
  volt: add temperature parameter to nvkm_volt_map
  nouveau/subdev/clk: fixup cstate selection
  clk: respect voltage limits in nvkm_cstate_prog with cstate = -1
  volt: don't require perfect fit
  bios/vmap: unk0 field is the mode
  volt: add coefficients I found on my gpu

 bin/nv_cmp_volt.c                                | 130 +++++++++++++++++++++
 drm/nouveau/include/nvkm/subdev/bios/baseclock.h |  24 ++++
 drm/nouveau/include/nvkm/subdev/bios/vmap.h      |   4 +-
 drm/nouveau/include/nvkm/subdev/bios/volt.h      |   5 +-
 drm/nouveau/include/nvkm/subdev/clk.h            |  10 +-
 drm/nouveau/include/nvkm/subdev/volt.h           |   9 +-
 drm/nouveau/nvkm/subdev/bios/Kbuild              |   1 +
 drm/nouveau/nvkm/subdev/bios/baseclock.c         |  82 +++++++++++++
 drm/nouveau/nvkm/subdev/bios/vmap.c              |   7 +-
 drm/nouveau/nvkm/subdev/bios/volt.c              |  45 +++++---
 drm/nouveau/nvkm/subdev/clk/base.c               | 112 +++++++++++++++++-
 drm/nouveau/nvkm/subdev/clk/gf100.c              |   2 +-
 drm/nouveau/nvkm/subdev/clk/gk104.c              |   2 +-
 drm/nouveau/nvkm/subdev/volt/base.c              | 141 +++++++++++++++++++++--
 14 files changed, 532 insertions(+), 42 deletions(-)
 create mode 100644 bin/nv_cmp_volt.c
 create mode 100644 drm/nouveau/include/nvkm/subdev/bios/baseclock.h
 create mode 100644 drm/nouveau/nvkm/subdev/bios/baseclock.c
    
Revision 2
      This series fixes most of the issues regarding volting on GPUs with any form
of GPU Boost inside their vbios, which is mainly Kepler and newer, but we find
some boosting related tables in Fermi vbios' already

In the end reclocking should work on most Kepler cards without any issues

v2: boost_mode can now be changed at runtime
    minor fixups

Karol Herbst (22):
  bios/volt: handle voltage table version 0x50 with 0ed header
  volt: properly detect entry based voltage tables
  volt: save the voltage range we are able to set
  volt: add nvkm_volt_map_min function
  clk: don't create cstates which voltage is higher than what the gpu
    can do
  volt: parse the both max voltage entries
  volt: add min_id parameter to nvkm_volt_set_id
  clk: export nvkm_volt_map
  clk: add index field to nvkm_cstate
  add daemon to compare nouveau with blob voltage
  volt: add temperature parameter to nvkm_volt_map
  clk: fixup cstate selection
  clk: respect voltage limits in nvkm_cstate_prog with cstate = -1
  bios: add parsing of BASE CLOCK table
  clk: allow boosting only when NvBoost is set
  volt: don't require perfect fit
  bios/vmap: unk0 field is the mode
  volt: add coefficients I found on my gpu
  clk: save the max clock we can set
  clk: add nvkm_clk_reclock function
  nvif: add boost info and set operations
  debugfs: add boost interface to change the boost_mode

 bin/nv_cmp_volt.c                                | 130 +++++++++++++++++++++
 drm/nouveau/include/nvif/if0001.h                |  15 +++
 drm/nouveau/include/nvkm/subdev/bios/baseclock.h |  24 ++++
 drm/nouveau/include/nvkm/subdev/bios/vmap.h      |   4 +-
 drm/nouveau/include/nvkm/subdev/bios/volt.h      |   5 +-
 drm/nouveau/include/nvkm/subdev/clk.h            |  12 +-
 drm/nouveau/include/nvkm/subdev/volt.h           |   9 +-
 drm/nouveau/nouveau_debugfs.c                    |  76 ++++++++++++
 drm/nouveau/nvkm/engine/device/ctrl.c            |  59 ++++++++++
 drm/nouveau/nvkm/subdev/bios/Kbuild              |   1 +
 drm/nouveau/nvkm/subdev/bios/baseclock.c         |  82 +++++++++++++
 drm/nouveau/nvkm/subdev/bios/vmap.c              |   7 +-
 drm/nouveau/nvkm/subdev/bios/volt.c              |  45 +++++---
 drm/nouveau/nvkm/subdev/clk/base.c               | 131 +++++++++++++++++++--
 drm/nouveau/nvkm/subdev/clk/gf100.c              |   2 +-
 drm/nouveau/nvkm/subdev/clk/gk104.c              |   2 +-
 drm/nouveau/nvkm/subdev/volt/base.c              | 141 +++++++++++++++++++++--
 17 files changed, 696 insertions(+), 49 deletions(-)
 create mode 100644 bin/nv_cmp_volt.c
 create mode 100644 drm/nouveau/include/nvkm/subdev/bios/baseclock.h
 create mode 100644 drm/nouveau/nvkm/subdev/bios/baseclock.c
    
Revision 3
      This is an updated series for the old clocking improvement one.

I think I got everything needed in place and also a simple update mechanism for
updating the cstates/voltage on temperature changes.

If anything is unclear how I REed or got the information, please leave a note
so that I can provide additional information in the commits.

Besides that I think we are pretty close now and only some minor improvements
are needed:
 * see if the factors differe on different GPUs (I only saw minor differences,
   which can be due to an inaccuracy retrieving the factors)
 * RE the factors on Voltage Map Tables with the Version 0x10 (usually Fermi)
 * add support for power budgets and watch over the power consumption, but for
   this we have to find out how to parse the budgets and map them to the rails
   or total power consumption.

I don't think those issues are critical, because by default this series doesn't
enable full boosting and we could also land the changes with capping the clocks
to the base clock to make sure we don't exceed any power budgets.

v3: adjust to temperature and minor fixes in the commits

Karol Herbst (29):
  bios/volt: handle voltage table version 0x50 with 0ed header
  volt: properly detect entry based voltage tables
  volt: save the voltage range we are able to set
  volt: add nvkm_volt_map_min function
  clk: don't create cstates whit voltages higher than what the gpu can
    do
  volt: parse the max voltage map entries
  volt: add min_id parameter to nvkm_volt_set_id
  clk: export nvkm_volt_map
  clk: add index field to nvkm_cstate
  add daemon to compare nouveau with blob voltage
  volt: add temperature parameter to nvkm_volt_map
  clk: fixup cstate selection
  clk: respect voltage limits in nvkm_cstate_prog
  bios: add parsing of BASE CLOCK table
  clk: allow boosting only when NvBoost is set
  volt: don't require perfect fit
  bios/vmap: unk0 field is the mode
  volt: add coefficients I found on my gpu
  clk: save the max clock we can set
  clk: rename nvkm_pstate_calc to nvkm_clk_update
  nvif: add boost info and set operations
  debugfs: add boost interface to change the boost_mode
  clk: remove dstate and tstate
  therm: don't cancel the timer
  clk: make pstate a pointer to nvkm_pstate
  clk: hold information about the current cstate status
  clk: we should pass the pstate id around not the index in the list
  clk: only do partial reclocks as required
  therm: trigger reclock in temperature daemon

 bin/nv_cmp_volt.c                                | 130 +++++++++
 drm/nouveau/include/nvif/if0001.h                |  15 ++
 drm/nouveau/include/nvkm/subdev/bios/baseclock.h |  24 ++
 drm/nouveau/include/nvkm/subdev/bios/vmap.h      |   5 +-
 drm/nouveau/include/nvkm/subdev/bios/volt.h      |   5 +-
 drm/nouveau/include/nvkm/subdev/clk.h            |  23 +-
 drm/nouveau/include/nvkm/subdev/volt.h           |  12 +-
 drm/nouveau/nouveau_debugfs.c                    |  76 ++++++
 drm/nouveau/nvkm/engine/device/ctrl.c            |  60 ++++-
 drm/nouveau/nvkm/subdev/bios/Kbuild              |   1 +
 drm/nouveau/nvkm/subdev/bios/baseclock.c         |  82 ++++++
 drm/nouveau/nvkm/subdev/bios/vmap.c              |  12 +-
 drm/nouveau/nvkm/subdev/bios/volt.c              |  45 ++--
 drm/nouveau/nvkm/subdev/clk/base.c               | 321 +++++++++++++++++------
 drm/nouveau/nvkm/subdev/clk/gf100.c              |   2 +-
 drm/nouveau/nvkm/subdev/clk/gk104.c              |   2 +-
 drm/nouveau/nvkm/subdev/pmu/gk20a.c              |  23 +-
 drm/nouveau/nvkm/subdev/therm/base.c             |  14 +-
 drm/nouveau/nvkm/subdev/volt/base.c              | 139 +++++++++-
 19 files changed, 838 insertions(+), 153 deletions(-)
 create mode 100644 bin/nv_cmp_volt.c
 create mode 100644 drm/nouveau/include/nvkm/subdev/bios/baseclock.h
 create mode 100644 drm/nouveau/nvkm/subdev/bios/baseclock.c
    
Revision 4
      We are slowly getting there!

v4 of the series with some realy good improvements, so I am sure this is like
95% done and only needs some proper polishing and proper Reviews!

I also added the NvVoltOffsetmV module parameter, so that a user is able to
over and !under!-volt the GPU. Overvolting makes sense, when there are still
some reclocking issues left, which might be solved by a higher voltage.

Undervolting makes sense to decrease the used voltage for each Cstate and to
make more C-States available on a handfull cards. This is some sort of really
basic Overclocking support, which comes at the cost of stability, but has
nearly no impact on the power consumption or heat production.

But because this doesn't add new stuff and only directly modifies the voltage
calculation, it is all still according to the vbios and doesn't add new clocks
or something like that.

If anything is unclear how I REed or got the information, please leave a note
so that I can provide additional information in the commits.

This series can be found on my "stable_reclocking_kepler_v4" branch on github

Happy testing and happy reviewing!

v3: adjust to temperature and minor fixes in the commits
v4: add speedo values
    add proper coefficients based on speedo
    refactor some code in clk to not affect pre-fermi chips
    add NvVoltOffsetmV option

Karol Herbst (37):
  bios/volt: handle voltage table version 0x50 with 0ed header
  volt: properly detect entry based voltage tables
  volt: save the voltage range we are able to set
  volt: add nvkm_volt_map_min function
  clk: don't create cstates whit voltages higher than what the gpu can
    do
  volt: parse the max voltage map entries
  volt: add min_id parameter to nvkm_volt_set_id
  clk: export nvkm_volt_map
  clk: add index field to nvkm_cstate
  add daemon to compare nouveau with blob voltage
  volt: add temperature parameter to nvkm_volt_map
  clk: fixup cstate selection
  clk: respect voltage limits in nvkm_cstate_prog
  bios: add parsing of BASE CLOCK table
  clk: allow boosting only when NvBoost is set
  volt: don't require perfect fit
  bios/vmap: unk0 field is the mode
  volt: add speedo
  volt: add gf100 subdev with speedo
  volt: add coefficients
  clk: save the max clock we can set
  clk: rename nvkm_pstate_calc to nvkm_clk_update
  nvif: add boost info and set operations
  debugfs: add boost interface to change the boost_mode
  clk: remove dstate and tstate
  therm: don't cancel the timer
  clk: make pstate a pointer to nvkm_pstate
  clk: hold information about the current cstate status
  clk: we should pass the pstate id around not the index in the list
  clk: seperate the locking from the implementation in nvkm_clk_update
  clk: split out update code to nv40
  clk: only do partial reclocks as required
  therm: trigger reclock in temperature daemon
  mc: fix NULL pointer access in libnouveau
  clk: set clocks to pre suspend state after suspend
  WIP volt/gk104: readout speedo
  volt: add NvVoltOffsetmV option

 bin/nv_cmp_volt.c                                | 139 +++++++++++
 drm/nouveau/include/nvif/if0001.h                |  15 ++
 drm/nouveau/include/nvkm/subdev/bios/baseclock.h |  24 ++
 drm/nouveau/include/nvkm/subdev/bios/vmap.h      |   5 +-
 drm/nouveau/include/nvkm/subdev/bios/volt.h      |   5 +-
 drm/nouveau/include/nvkm/subdev/clk.h            |  23 +-
 drm/nouveau/include/nvkm/subdev/volt.h           |  17 +-
 drm/nouveau/nouveau_debugfs.c                    |  82 ++++++-
 drm/nouveau/nvkm/engine/device/base.c            |  17 +-
 drm/nouveau/nvkm/engine/device/ctrl.c            |  60 ++++-
 drm/nouveau/nvkm/subdev/bios/Kbuild              |   1 +
 drm/nouveau/nvkm/subdev/bios/baseclock.c         |  82 +++++++
 drm/nouveau/nvkm/subdev/bios/vmap.c              |  12 +-
 drm/nouveau/nvkm/subdev/bios/volt.c              |  45 ++--
 drm/nouveau/nvkm/subdev/clk/base.c               | 298 ++++++++++++++++-------
 drm/nouveau/nvkm/subdev/clk/g84.c                |   1 +
 drm/nouveau/nvkm/subdev/clk/gf100.c              |  63 ++++-
 drm/nouveau/nvkm/subdev/clk/gk104.c              |   3 +-
 drm/nouveau/nvkm/subdev/clk/gk20a.c              |   1 +
 drm/nouveau/nvkm/subdev/clk/gm20b.c              |   1 +
 drm/nouveau/nvkm/subdev/clk/gt215.c              |   1 +
 drm/nouveau/nvkm/subdev/clk/mcp77.c              |   1 +
 drm/nouveau/nvkm/subdev/clk/nv40.c               |  18 ++
 drm/nouveau/nvkm/subdev/clk/nv50.c               |   1 +
 drm/nouveau/nvkm/subdev/clk/priv.h               |   9 +
 drm/nouveau/nvkm/subdev/mc/base.c                |   7 +-
 drm/nouveau/nvkm/subdev/pmu/gk20a.c              |  23 +-
 drm/nouveau/nvkm/subdev/therm/base.c             |  14 +-
 drm/nouveau/nvkm/subdev/volt/Kbuild              |   1 +
 drm/nouveau/nvkm/subdev/volt/base.c              | 159 +++++++++++-
 drm/nouveau/nvkm/subdev/volt/gf100.c             |  59 +++++
 drm/nouveau/nvkm/subdev/volt/gk104.c             |  19 ++
 drm/nouveau/nvkm/subdev/volt/priv.h              |   1 +
 33 files changed, 1034 insertions(+), 173 deletions(-)
 create mode 100644 bin/nv_cmp_volt.c
 create mode 100644 drm/nouveau/include/nvkm/subdev/bios/baseclock.h
 create mode 100644 drm/nouveau/nvkm/subdev/bios/baseclock.c
 create mode 100644 drm/nouveau/nvkm/subdev/volt/gf100.c
    

Revisions

Patches download mbox

# Name Submitter State A F R T
[v2,01/22] bios/volt: handle voltage table version 0x50 with 0ed header Karol Herbst New 1 1
[v2,02/22] volt: properly detect entry based voltage tables Karol Herbst New 1 1
[v2,03/22] volt: save the voltage range we are able to set Karol Herbst New 1
[v2,04/22] volt: add nvkm_volt_map_min function Karol Herbst New 1
[v2,05/22] clk: don't create cstates which voltage is higher than what the gpu can do Karol Herbst New 1
[v2,06/22] volt: parse the both max voltage entries Karol Herbst New
[v2,07/22] volt: add min_id parameter to nvkm_volt_set_id Karol Herbst New 1
[v2,08/22] clk: export nvkm_volt_map Karol Herbst New
[v2,09/22] clk: add index field to nvkm_cstate Karol Herbst New
[v2,10/22] add daemon to compare nouveau with blob voltage Karol Herbst New
[v2,11/22] volt: add temperature parameter to nvkm_volt_map Karol Herbst New
[v2,12/22] clk: fixup cstate selection Karol Herbst New
[v2,13/22] clk: respect voltage limits in nvkm_cstate_prog with cstate = -1 Karol Herbst New
[v2,14/22] bios: add parsing of BASE CLOCK table Karol Herbst New 1
[v2,15/22] clk: allow boosting only when NvBoost is set Karol Herbst New 1
[v2,16/22] volt: don't require perfect fit Karol Herbst New
[v2,17/22] bios/vmap: unk0 field is the mode Karol Herbst New
[v2,18/22] volt: add coefficients I found on my gpu Karol Herbst New
[v2,19/22] clk: save the max clock we can set Karol Herbst New
[v2,20/22] clk: add nvkm_clk_reclock function Karol Herbst New
[v2,21/22] nvif: add boost info and set operations Karol Herbst New
[v2,22/22] debugfs: add boost interface to change the boost_mode Karol Herbst New 1

Patches download mbox

# Name Submitter State A F R T
[v3,01/29] bios/volt: handle voltage table version 0x50 with 0ed header Karol Herbst New 1 1
[v3,02/29] volt: properly detect entry based voltage tables Karol Herbst New 1 1
[v3,03/29] volt: save the voltage range we are able to set Karol Herbst New 1 1
[v3,04/29] volt: add nvkm_volt_map_min function Karol Herbst New 1 1
[v3,05/29] clk: don't create cstates whit voltages higher than what the gpu can do Karol Herbst New 1 1
[v3,06/29] volt: parse the max voltage map entries Karol Herbst New
[v3,07/29] volt: add min_id parameter to nvkm_volt_set_id Karol Herbst New 1
[v3,08/29] clk: export nvkm_volt_map Karol Herbst New
[v3,09/29] clk: add index field to nvkm_cstate Karol Herbst New
[v3,10/29] add daemon to compare nouveau with blob voltage Karol Herbst New
[v3,11/29] volt: add temperature parameter to nvkm_volt_map Karol Herbst New
[v3,12/29] clk: fixup cstate selection Karol Herbst New
[v3,13/29] clk: respect voltage limits in nvkm_cstate_prog Karol Herbst New
[v3,14/29] bios: add parsing of BASE CLOCK table Karol Herbst New 1
[v3,15/29] clk: allow boosting only when NvBoost is set Karol Herbst New 1
[v3,16/29] volt: don't require perfect fit Karol Herbst New
[v3,17/29] bios/vmap: unk0 field is the mode Karol Herbst New
[v3,18/29] volt: add coefficients I found on my gpu Karol Herbst New
[v3,19/29] clk: save the max clock we can set Karol Herbst New
[v3,20/29] clk: rename nvkm_pstate_calc to nvkm_clk_update Karol Herbst New
[v3,21/29] nvif: add boost info and set operations Karol Herbst New 1
[v3,22/29] debugfs: add boost interface to change the boost_mode Karol Herbst New 1
[v3,23/29] clk: remove dstate and tstate Karol Herbst New
[v3,24/29] therm: don't cancel the timer Karol Herbst New
[v3,25/29] clk: make pstate a pointer to nvkm_pstate Karol Herbst New
[v3,26/29] clk: hold information about the current cstate status Karol Herbst New
[v3,27/29] clk: we should pass the pstate id around not the index in the list Karol Herbst New
[v3,28/29] clk: only do partial reclocks as required Karol Herbst New
[v3,29/29] therm: trigger reclock in temperature daemon Karol Herbst New

Patches download mbox

# Name Submitter State A F R T
[v4,01/37] bios/volt: handle voltage table version 0x50 with 0ed header Karol Herbst New 1 1
[v4,02/37] volt: properly detect entry based voltage tables Karol Herbst New 1 1
[v4,03/37] volt: save the voltage range we are able to set Karol Herbst New 1 1
[v4,04/37] volt: add nvkm_volt_map_min function Karol Herbst New 1 1
[v4,05/37] clk: don't create cstates whit voltages higher than what the gpu can do Karol Herbst New 1 1
[v4,06/37] volt: parse the max voltage map entries Karol Herbst New 1
[v4,07/37] volt: add min_id parameter to nvkm_volt_set_id Karol Herbst New 1
[v4,08/37] clk: export nvkm_volt_map Karol Herbst New 1
[v4,09/37] clk: add index field to nvkm_cstate Karol Herbst New
[v4,10/37] add daemon to compare nouveau with blob voltage Karol Herbst New 1
[v4,11/37] volt: add temperature parameter to nvkm_volt_map Karol Herbst New 1
[v4,12/37] clk: fixup cstate selection Karol Herbst New
[v4,13/37] clk: respect voltage limits in nvkm_cstate_prog Karol Herbst New 1
[v4,14/37] bios: add parsing of BASE CLOCK table Karol Herbst New 1
[v4,15/37] clk: allow boosting only when NvBoost is set Karol Herbst New 1
[v4,16/37] volt: don't require perfect fit Karol Herbst New 1
[v4,17/37] bios/vmap: unk0 field is the mode Karol Herbst New 1
[v4,18/37] volt: add speedo Karol Herbst New 1
[v4,19/37] volt: add gf100 subdev with speedo Karol Herbst New 1
[v4,20/37] volt: add coefficients Karol Herbst New 1
[v4,21/37] clk: save the max clock we can set Karol Herbst New 1
[v4,22/37] clk: rename nvkm_pstate_calc to nvkm_clk_update Karol Herbst New
[v4,23/37] nvif: add boost info and set operations Karol Herbst New 1
[v4,24/37] debugfs: add boost interface to change the boost_mode Karol Herbst New 1
[v4,25/37] clk: remove dstate and tstate Karol Herbst New 1
[v4,26/37] therm: don't cancel the timer Karol Herbst New 1
[v4,27/37] clk: make pstate a pointer to nvkm_pstate Karol Herbst New 1
[v4,28/37] clk: hold information about the current cstate status Karol Herbst New 1
[v4,29/37] clk: we should pass the pstate id around not the index in the list Karol Herbst New 1
[v4,30/37] clk: seperate the locking from the implementation in nvkm_clk_update Karol Herbst New 1
[v4,31/37] clk: split out update code to nv40 Karol Herbst New 1
[v4,32/37] clk: only do partial reclocks as required Karol Herbst New 1
[v4,33/37] therm: trigger reclock in temperature daemon Karol Herbst New 1
[v4,34/37] mc: fix NULL pointer access in libnouveau Karol Herbst New
[v4,35/37] clk: set clocks to pre suspend state after suspend Karol Herbst New 1
[v4,36/37] WIP volt/gk104: readout speedo Karol Herbst New 1
[v4,37/37] volt: add NvVoltOffsetmV option Karol Herbst New