Skip to contentSkip to conversation

Add amdgpu powerplay support

PATCH In review Alex Deucher 2 participants 53 messages Nov 12, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Add amdgpu powerplay support

This patch set adds preliminary powerplay support for amdgpu. The aim of this patch set is to eventually replace the existing dpm support for VI parts. Support for Tonga, Fiji, and VI APUs is included. The same sysfs and debugfs interfaces are supported so it's configured the same way as previous asics.

You can force it on or off via the powerplay module parameter. It is enabled by default for Tonga and Fiji.

The patches are also available here:
http://cgit.freedesktop.org/~agd5f/linux/log/?h=amdgpu-powerplay

Alex Deucher (3):
drm/amd/powerplay/tonga: enable pcie and mclk forcing for low drm/amd/powerplay/fiji: enable pcie and mclk forcing for low drm/amdgpu: extract pcie helpers to common header

Eric Huang (5):
drm/amd/powerplay: add/update headers for Fiji SMU and DPM drm/amd/powerplay: update atomctrl for fiji drm/amd/powerplay: add Fiji SMU support. drm/amd/powerplay: add Fiji DPM support.
drm/amd/amdgpu: enable powerplay and smc firmware loading for Fiji.

Jammy Zhou (7):
drm/amd/powerplay: add SMU manager sub-component drm/amd/powerplay: add hardware manager sub-component drm/amd/powerplay: add Carrizo smu support drm/amd/powerplay: add Carrizo dpm support drm/amd/powerplay: Add Tonga SMU support drm/amdgpu: add amdgpu.powerplay module option drm/amdgpu: support per device powerplay enablement (v2)

Rex Zhu (32):
drm/amdgpu: share struct amdgpu_pm_state_type with powerplay module drm/amdgpu: mv some definition from amdgpu_acpi.c to amdgpu_acpi.h drm/amdgpu: mv amdgpu_acpi.h to amd/include/amd_acpi.h drm/amdgpu: implement new cgs interface for acpi function drm/amdgpu: implement cgs interface to query system info drm/amdgpu: add new cgs interface to get display info (v2) drm/amd/powerplay: add basic powerplay framework drm/amdgpu: disable legacy path of firmware check if powerplay is
enabled
drm/amdgpu: export amd_powerplay_func to amdgpu and other ip block drm/amd/powerplay: add CG and PG support for carrizo drm/amd/powerplay: add event manager sub-component drm/amd/powerplay: implement functions of amd_powerplay_func drm/amdgpu/powerplay: add function point in hwmgr_funcs for program
display gap
drm/amdgpu/poweprlay: export program display gap function to eventmgr drm/amdgpu/powerplay: implement pem_task for
display_configuration_change
drm/amdgpu/powerplay: program display gap for tonga. drm/amdgpu: enable powerplay module by default for tonga. drm/amdgpu: enable powerplay module by default for fiji. drm/amdgpu/powerplay: add some definition for other ip block to update
cg pg.
drm/amd/powerplay: add new function point in hwmgr_func for CG/PG. drm/amd/powerplay: Add CG and PG support for tonga drm/amdgpu/powerplay: add new function point in hwmgr_funcs for
thermal control
drm/amdgpu/powerplay: mv ppinterrupt.h to inc folder to share with
other submodule.
drm/amdgpu/powerplay: add thermal control interface in hwmgr. drm/amdgpu/powerplay: enable thermal interrupt task in eventmgr. drm/amdgpu/powerplay: implement thermal control for tonga. drm/amdgpu/powerplay: implement fan control interface in
amd_powerplay_funcs
drm/amdgpu: export fan control functions to amdgpu drm/amdgpu: enable sysfs interface for powerplay drm/amd/powerplay: add and export hwmgr interface to eventmgr to check
hw states.
drm/amd/powerplay: implement new funcs to check current states for
tonga.
drm/amd/powerplay: refine the logic of whether need to update power
state.

yanyang1 (4):
drm/amd/powerplay: Add ixSWRST_COMMAND_1 in bif_5_0_d.h drm/amd/powerplay: Move smu7*.h from amdgpu to powerplay. drm/amd/powerplay: add header file for tonga smu and dpm drm/amd/powerplay: add Tonga dpm support (v3)

 drivers/gpu/drm/Kconfig                            |     1 +
 drivers/gpu/drm/amd/amdgpu/Makefile                |    12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h                |   110 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c           |    58 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.h           |   445 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c   |     2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c            |   286 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c            |     6 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |   233 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c      |   297 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h      |    33 +
 drivers/gpu/drm/amd/amdgpu/cik.c                   |    11 +-
 drivers/gpu/drm/amd/amdgpu/cz_ppsmc.h              |   185 -
 drivers/gpu/drm/amd/amdgpu/fiji_ppsmc.h            |   182 -
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c              |    80 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c             |    24 +-
 drivers/gpu/drm/amd/amdgpu/smu7.h                  |   170 -
 drivers/gpu/drm/amd/amdgpu/smu7_discrete.h         |   514 -
 drivers/gpu/drm/amd/amdgpu/smu7_fusion.h           |   300 -
 drivers/gpu/drm/amd/amdgpu/smu8.h                  |    72 -
 drivers/gpu/drm/amd/amdgpu/smu8_fusion.h           |   127 -
 drivers/gpu/drm/amd/amdgpu/smu_ucode_xfer_cz.h     |   147 -
 drivers/gpu/drm/amd/amdgpu/tonga_ppsmc.h           |   198 -
 drivers/gpu/drm/amd/amdgpu/vi.c                    |     9 +-
 drivers/gpu/drm/amd/include/amd_acpi.h             |   494 +
 drivers/gpu/drm/amd/include/amd_pcie.h             |    50 +
 drivers/gpu/drm/amd/include/amd_pcie_helpers.h     |   141 +
 drivers/gpu/drm/amd/include/amd_shared.h           |    21 +
 .../gpu/drm/amd/include/asic_reg/bif/bif_5_0_d.h   |     1 +
 drivers/gpu/drm/amd/include/atombios.h             |    79 +
 drivers/gpu/drm/amd/include/cgs_common.h           |    88 +-
 drivers/gpu/drm/amd/powerplay/Kconfig              |     6 +
 drivers/gpu/drm/amd/powerplay/Makefile             |    22 +
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      |   605 ++
 drivers/gpu/drm/amd/powerplay/eventmgr/Makefile    |    11 +
 .../drm/amd/powerplay/eventmgr/eventactionchains.c |   288 +
 .../drm/amd/powerplay/eventmgr/eventactionchains.h |    62 +
 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c |   195 +
 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.h |    34 +
 .../drm/amd/powerplay/eventmgr/eventmanagement.c   |   215 +
 .../drm/amd/powerplay/eventmgr/eventmanagement.h   |    59 +
 drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c  |   114 +
 .../drm/amd/powerplay/eventmgr/eventsubchains.c    |   405 +
 .../drm/amd/powerplay/eventmgr/eventsubchains.h    |    99 +
 .../gpu/drm/amd/powerplay/eventmgr/eventtasks.c    |   431 +
 .../gpu/drm/amd/powerplay/eventmgr/eventtasks.h    |    88 +
 drivers/gpu/drm/amd/powerplay/eventmgr/psm.c       |   118 +
 drivers/gpu/drm/amd/powerplay/eventmgr/psm.h       |    38 +
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |    14 +
 .../drm/amd/powerplay/hwmgr/cz_clockpowergating.c  |   252 +
 .../drm/amd/powerplay/hwmgr/cz_clockpowergating.h  |    37 +
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  1417 +++
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.h     |   317 +
 .../drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h    |   105 +
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c   |  4749 +++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h   |   354 +
 .../gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c   |   553 +
 .../gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h   |    66 +
 .../gpu/drm/amd/powerplay/hwmgr/functiontables.c   |   154 +
 .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c  |   246 +
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |   228 +
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h    |   105 +
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c      |    76 +
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   |  1185 +++
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h   |   243 +
 drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h    |   617 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.c  |    64 +
 drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.h  |    31 +
 .../gpu/drm/amd/powerplay/hwmgr/processpptables.c  |  1661 +++
 .../gpu/drm/amd/powerplay/hwmgr/processpptables.h  |    47 +
 .../amd/powerplay/hwmgr/tonga_clockpowergating.c   |   350 +
 .../amd/powerplay/hwmgr/tonga_clockpowergating.h   |    36 +
 .../drm/amd/powerplay/hwmgr/tonga_dyn_defaults.h   |   107 +
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c  |  5966 +++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h  |   408 +
 .../gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h  |    66 +
 .../gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h    |   406 +
 .../amd/powerplay/hwmgr/tonga_processpptables.c    |  1129 ++
 .../amd/powerplay/hwmgr/tonga_processpptables.h    |    35 +
 .../gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c    |   587 ++
 .../gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h    |    60 +
 drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h  |   206 +
 drivers/gpu/drm/amd/powerplay/inc/cz_ppsmc.h       |   185 +
 drivers/gpu/drm/amd/powerplay/inc/eventmanager.h   |   109 +
 drivers/gpu/drm/amd/powerplay/inc/eventmgr.h       |   125 +
 drivers/gpu/drm/amd/powerplay/inc/fiji_ppsmc.h     |   412 +
 drivers/gpu/drm/amd/powerplay/inc/fiji_pwrvirus.h  | 10299 +++++++++++++++++++
 .../gpu/drm/amd/powerplay/inc/hardwaremanager.h    |   357 +
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |   765 ++
 drivers/gpu/drm/amd/powerplay/inc/power_state.h    |   200 +
 drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h        |    28 +
 drivers/gpu/drm/amd/powerplay/inc/pp_asicblocks.h  |    47 +
 drivers/gpu/drm/amd/powerplay/inc/pp_debug.h       |    40 +
 drivers/gpu/drm/amd/powerplay/inc/pp_feature.h     |    67 +
 drivers/gpu/drm/amd/powerplay/inc/pp_instance.h    |    36 +
 .../gpu/drm/amd/powerplay/inc/pp_power_source.h    |    36 +
 drivers/gpu/drm/amd/powerplay/inc/ppinterrupt.h    |    46 +
 drivers/gpu/drm/amd/powerplay/inc/smu7.h           |   170 +
 drivers/gpu/drm/amd/powerplay/inc/smu72.h          |   664 ++
 drivers/gpu/drm/amd/powerplay/inc/smu72_discrete.h |   760 ++
 drivers/gpu/drm/amd/powerplay/inc/smu73.h          |   720 ++
 drivers/gpu/drm/amd/powerplay/inc/smu73_discrete.h |   799 ++
 drivers/gpu/drm/amd/powerplay/inc/smu7_discrete.h  |   514 +
 drivers/gpu/drm/amd/powerplay/inc/smu7_fusion.h    |   300 +
 drivers/gpu/drm/amd/powerplay/inc/smu8.h           |    72 +
 drivers/gpu/drm/amd/powerplay/inc/smu8_fusion.h    |   127 +
 .../gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h  |   147 +
 .../gpu/drm/amd/powerplay/inc/smu_ucode_xfer_vi.h  |   100 +
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h         |   182 +
 drivers/gpu/drm/amd/powerplay/inc/tonga_ppsmc.h    |   420 +
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |     9 +
 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c   |   858 ++
 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.h   |   102 +
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |  1035 ++
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h |    77 +
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c      |   263 +
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |   819 ++
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h    |    53 +
 118 files changed, 47406 insertions(+), 2580 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.h
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/cz_ppsmc.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/fiji_ppsmc.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu7.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu7_discrete.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu7_fusion.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu8.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu8_fusion.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu_ucode_xfer_cz.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/tonga_ppsmc.h
 create mode 100644 drivers/gpu/drm/amd/include/amd_acpi.h
 create mode 100644 drivers/gpu/drm/amd/include/amd_pcie.h
 create mode 100644 drivers/gpu/drm/amd/include/amd_pcie_helpers.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/Kconfig
 create mode 100644 drivers/gpu/drm/amd/powerplay/Makefile
 create mode 100644 drivers/gpu/drm/amd/powerplay/amd_powerplay.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/Makefile
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventactionchains.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventactionchains.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventmanagement.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventmanagement.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/psm.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/psm.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_dyn_defaults.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/cz_ppsmc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/eventmanager.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/eventmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/fiji_ppsmc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/fiji_pwrvirus.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/power_state.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_asicblocks.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_debug.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_feature.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_instance.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_power_source.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/ppinterrupt.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu72.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu72_discrete.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu73.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu73_discrete.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7_discrete.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7_fusion.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu8.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu8_fusion.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_vi.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smumgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/tonga_ppsmc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/Makefile
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 1/51 drm/amdgpu: share struct amdgpu_pm_state_type with powerplay module

From: Rex Zhu <[email protected]>

rename amdgpu_pm_state_type to amd_pm_state_type

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h      | 28 ++--------------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c   |  8 ++++----
 drivers/gpu/drm/amd/include/amd_shared.h | 21 +++++++++++++++++++++
 3 files changed, 27 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -26
index 7b02e34..cdaf8e2 100644
@@ -1253,31 +1253,7 @@ struct amdgpu_wb {
 int amdgpu_wb_get(struct amdgpu_device *adev, u32 *wb);
 void amdgpu_wb_free(struct amdgpu_device *adev, u32 wb);
 
-/**
- * struct amdgpu_pm - power management datas
- * It keeps track of various data needed to take powermanagement decision.
- */
 
-enum amdgpu_pm_state_type {
-	/* not used for dpm */
-	POWER_STATE_TYPE_DEFAULT,
-	POWER_STATE_TYPE_POWERSAVE,
-	/* user selectable states */
-	POWER_STATE_TYPE_BATTERY,
-	POWER_STATE_TYPE_BALANCED,
-	POWER_STATE_TYPE_PERFORMANCE,
-	/* internal states */
-	POWER_STATE_TYPE_INTERNAL_UVD,
-	POWER_STATE_TYPE_INTERNAL_UVD_SD,
-	POWER_STATE_TYPE_INTERNAL_UVD_HD,
-	POWER_STATE_TYPE_INTERNAL_UVD_HD2,
-	POWER_STATE_TYPE_INTERNAL_UVD_MVC,
-	POWER_STATE_TYPE_INTERNAL_BOOT,
-	POWER_STATE_TYPE_INTERNAL_THERMAL,
-	POWER_STATE_TYPE_INTERNAL_ACPI,
-	POWER_STATE_TYPE_INTERNAL_ULV,
-	POWER_STATE_TYPE_INTERNAL_3DPERF,
-};
 
 enum amdgpu_int_thermal_type {
 	THERMAL_TYPE_NONE,
@@ -1559,8 +1535,8 @@ struct amdgpu_dpm {
 	/* vce requirements */
 	struct amdgpu_vce_state vce_states[AMDGPU_MAX_VCE_LEVELS];
 	enum amdgpu_vce_level vce_level;
-	enum amdgpu_pm_state_type state;
-	enum amdgpu_pm_state_type user_state;
+	enum amd_pm_state_type state;
+	enum amd_pm_state_type user_state;
 	u32                     platform_caps;
 	u32                     voltage_response_time;
 	u32                     backbias_response_time;
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +4 -4
index 22a8c7d..eea1933 100644
@@ -52,7 +52,7 @@ static ssize_t amdgpu_get_dpm_state(struct device *dev,
 {
 	struct drm_device *ddev = dev_get_drvdata(dev);
 	struct amdgpu_device *adev = ddev->dev_private;
-	enum amdgpu_pm_state_type pm = adev->pm.dpm.user_state;
+	enum amd_pm_state_type pm = adev->pm.dpm.user_state;
 
 	return snprintf(buf, PAGE_SIZE, "%s\n",
 			(pm == POWER_STATE_TYPE_BATTERY) ? "battery" :
@@ -351,7 +351,7 @@ void amdgpu_dpm_thermal_work_handler(struct work_struct *work)
 		container_of(work, struct amdgpu_device,
 			     pm.dpm.thermal.work);
 	/* switch to the thermal state */
-	enum amdgpu_pm_state_type dpm_state = POWER_STATE_TYPE_INTERNAL_THERMAL;
+	enum amd_pm_state_type dpm_state = POWER_STATE_TYPE_INTERNAL_THERMAL;
 
 	if (!adev->pm.dpm_enabled)
 		return;
@@ -379,7 +379,7 @@ void amdgpu_dpm_thermal_work_handler(struct work_struct *work)
 }
 
 static struct amdgpu_ps *amdgpu_dpm_pick_power_state(struct amdgpu_device *adev,
-						     enum amdgpu_pm_state_type dpm_state)
+						     enum amd_pm_state_type dpm_state)
 {
 	int i;
 	struct amdgpu_ps *ps;
@@ -516,7 +516,7 @@ static void amdgpu_dpm_change_power_state_locked(struct amdgpu_device *adev)
 {
 	int i;
 	struct amdgpu_ps *ps;
-	enum amdgpu_pm_state_type dpm_state;
+	enum amd_pm_state_type dpm_state;
 	int ret;
 
 	/* if dpm init failed */
drivers/gpu/drm/amd/include/amd_shared.h +21 -0
index fe28fb3..1195d06f 100644
@@ -85,6 +85,27 @@ enum amd_powergating_state {
 	AMD_PG_STATE_UNGATE,
 };
 
+enum amd_pm_state_type {
+	/* not used for dpm */
+	POWER_STATE_TYPE_DEFAULT,
+	POWER_STATE_TYPE_POWERSAVE,
+	/* user selectable states */
+	POWER_STATE_TYPE_BATTERY,
+	POWER_STATE_TYPE_BALANCED,
+	POWER_STATE_TYPE_PERFORMANCE,
+	/* internal states */
+	POWER_STATE_TYPE_INTERNAL_UVD,
+	POWER_STATE_TYPE_INTERNAL_UVD_SD,
+	POWER_STATE_TYPE_INTERNAL_UVD_HD,
+	POWER_STATE_TYPE_INTERNAL_UVD_HD2,
+	POWER_STATE_TYPE_INTERNAL_UVD_MVC,
+	POWER_STATE_TYPE_INTERNAL_BOOT,
+	POWER_STATE_TYPE_INTERNAL_THERMAL,
+	POWER_STATE_TYPE_INTERNAL_ACPI,
+	POWER_STATE_TYPE_INTERNAL_ULV,
+	POWER_STATE_TYPE_INTERNAL_3DPERF,
+};
+
 struct amd_ip_funcs {
 	/* sets up early driver state (pre sw_init), does not configure hw - Optional */
 	int (*early_init)(void *handle);
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 2/51 drm/amdgpu: mv some definition from amdgpu_acpi.c to amdgpu_acpi.h

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

These will be shared with the new powerplay module.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 56 -------------------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.h | 57 +++++++++++++++++++++++++++++---
 2 files changed, 53 insertions(+), 60 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -56
index a142d5a..5df5b83 100644
@@ -32,63 +32,7 @@
 #include "amdgpu_acpi.h"
 #include "atom.h"
 
-#define ACPI_AC_CLASS           "ac_adapter"
-
 extern void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
-
-struct atif_verify_interface {
-	u16 size;		/* structure size in bytes (includes size field) */
-	u16 version;		/* version */
-	u32 notification_mask;	/* supported notifications mask */
-	u32 function_bits;	/* supported functions bit vector */
-} __packed;
-
-struct atif_system_params {
-	u16 size;		/* structure size in bytes (includes size field) */
-	u32 valid_mask;		/* valid flags mask */
-	u32 flags;		/* flags */
-	u8 command_code;	/* notify command code */
-} __packed;
-
-struct atif_sbios_requests {
-	u16 size;		/* structure size in bytes (includes size field) */
-	u32 pending;		/* pending sbios requests */
-	u8 panel_exp_mode;	/* panel expansion mode */
-	u8 thermal_gfx;		/* thermal state: target gfx controller */
-	u8 thermal_state;	/* thermal state: state id (0: exit state, non-0: state) */
-	u8 forced_power_gfx;	/* forced power state: target gfx controller */
-	u8 forced_power_state;	/* forced power state: state id */
-	u8 system_power_src;	/* system power source */
-	u8 backlight_level;	/* panel backlight level (0-255) */
-} __packed;
-
-#define ATIF_NOTIFY_MASK	0x3
-#define ATIF_NOTIFY_NONE	0
-#define ATIF_NOTIFY_81		1
-#define ATIF_NOTIFY_N		2
-
-struct atcs_verify_interface {
-	u16 size;		/* structure size in bytes (includes size field) */
-	u16 version;		/* version */
-	u32 function_bits;	/* supported functions bit vector */
-} __packed;
-
-#define ATCS_VALID_FLAGS_MASK	0x3
-
-struct atcs_pref_req_input {
-	u16 size;		/* structure size in bytes (includes size field) */
-	u16 client_id;		/* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */
-	u16 valid_flags_mask;	/* valid flags mask */
-	u16 flags;		/* flags */
-	u8 req_type;		/* request type */
-	u8 perf_req;		/* performance request */
-} __packed;
-
-struct atcs_pref_req_output {
-	u16 size;		/* structure size in bytes (includes size field) */
-	u8 ret_val;		/* return value */
-} __packed;
-
 /* Call the ATIF method
  */
 /**
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.h +53 -4

64 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH 3/51 drm/amdgpu: mv amdgpu_acpi.h to amd/include/amd_acpi.h

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

This will be shared with the new powerplay module.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c         |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.h         | 494 -----------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c |   2 +-
 drivers/gpu/drm/amd/include/amd_acpi.h           | 494 +++++++++++++++++++++++
 4 files changed, 496 insertions(+), 496 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.h
 create mode 100644 drivers/gpu/drm/amd/include/amd_acpi.h
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
index 5df5b83..5cd7b73 100644
@@ -29,7 +29,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
 #include "amdgpu.h"
-#include "amdgpu_acpi.h"
+#include "amd_acpi.h"
 #include "atom.h"
 
 extern void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.h deleted +0 -494

494 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -1
index 5a8fbad..3c89586 100644
@@ -11,7 +11,7 @@
 #include <linux/acpi.h>
 #include <linux/pci.h>
 
-#include "amdgpu_acpi.h"
+#include "amd_acpi.h"
 
 struct amdgpu_atpx_functions {
 	bool px_params;
drivers/gpu/drm/amd/include/amd_acpi.h new file +494 -0

494 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

PATCH 4/51 drm/amdgpu: implement new cgs interface for acpi function

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Add a new driver internal interface for accessing ACPI methods. These will be used by various new components including powerplay.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c  | 220 ++++++++++++++++++++++++++++++-
 drivers/gpu/drm/amd/include/cgs_common.h |  45 ++++++-
 2 files changed, 262 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +218 -2
index 8e99514..f901cdc 100644
@@ -24,6 +24,7 @@
 #include <linux/list.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
+#include <linux/acpi.h>
 #include <drm/drmP.h>
 #include <linux/firmware.h>
 #include <drm/amdgpu_drm.h>
@@ -32,7 +33,6 @@
 #include "atom.h"
 #include "amdgpu_ucode.h"
 
-
 struct amdgpu_cgs_device {
 	struct cgs_device base;
 	struct amdgpu_device *adev;
@@ -736,6 +736,221 @@ static int amdgpu_cgs_get_firmware_info(void *cgs_device,
 	return 0;
 }
 
+/** \brief evaluate acpi namespace object, handle or pathname must be valid
+ *  \param cgs_device
+ *  \param info input/output arguments for the control method
+ *  \return status
+ */
+
+#if defined(CONFIG_ACPI)
+static int amdgpu_cgs_acpi_eval_object(void *cgs_device,
+				    struct cgs_acpi_method_info *info)
+{
+	CGS_FUNC_ADEV;
+	acpi_handle handle;
+	struct acpi_object_list input;
+	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
+	union acpi_object *params = NULL;
+	union acpi_object *obj = NULL;
+	uint8_t name[5] = {'\0'};
+	struct cgs_acpi_method_argument *argument = NULL;
+	uint32_t i, count;
+	acpi_status status;
+	int result;
+	uint32_t func_no = 0xFFFFFFFF;
+
+	handle = ACPI_HANDLE(&adev->pdev->dev);
+	if (!handle)
+		return -ENODEV;
+
+	memset(&input, 0, sizeof(struct acpi_object_list));
+
+	/* validate input info */
+	if (info->size != sizeof(struct cgs_acpi_method_info))
+		return -EINVAL;
+
+	input.count = info->input_count;
+	if (info->input_count > 0) {
+		if (info->pinput_argument == NULL)
+			return -EINVAL;
+			argument = info->pinput_argument;
+			func_no = argument->value;
+			for (i = 0; i < info->input_count; i++) {
+				if (((argument->type == ACPI_TYPE_STRING) ||
+					(argument->type == ACPI_TYPE_BUFFER))
+					&& (argument->pointer == NULL))
+					return -EINVAL;
+				argument++;
+			}
+	}
+
+	if (info->output_count > 0) {
+		if (info->poutput_argument == NULL)
+			return -EINVAL;
+		argument = info->poutput_argument;
+		for (i = 0; i < info->output_count; i++) {
+			if (((argument->type == ACPI_TYPE_STRING) ||
+				(argument->type == ACPI_TYPE_BUFFER))
+				&& (argument->pointer == NULL))
+				return -EINVAL;
+			argument++;
+		}
+	}
+
+	/* The path name passed to acpi_evaluate_object should be null terminated */
+	if ((info->field & CGS_ACPI_FIELD_METHOD_NAME) != 0) {
+		strncpy(name, (char *)&(info->name), sizeof(uint32_t));
+		name[4] = '\0';
+	}
+
+	/* parse input parameters */
+	if (input.count > 0) {
+		input.pointer = params =
+				kzalloc(sizeof(union acpi_object) * input.count, GFP_KERNEL);
+		if (params == NULL)
+			return -EINVAL;
+
+		argument = info->pinput_argument;
+
+		for (i = 0; i < input.count; i++) {
+			params->type = argument->type;
+			switch (params->type) {
+			case ACPI_TYPE_INTEGER:
+				params->integer.value = argument->value;
+				break;
+			case ACPI_TYPE_STRING:
+				params->string.length = argument->method_length;
+				params->string.pointer = argument->pointer;
+				break;
+			case ACPI_TYPE_BUFFER:
+				params->buffer.length = argument->method_length;
+				params->buffer.pointer = argument->pointer;
+				break;
+			default:
+				break;
+			}
+			params++;
+			argument++;
+		}
+	}
+
+	/* parse output info */
+	count = info->output_count;
+	argument = info->poutput_argument;
+
+	/* evaluate the acpi method */
+	status = acpi_evaluate_object(handle, name, &input, &output);
+
+	if (ACPI_FAILURE(status)) {
+		result = -EIO;
+		goto error;
+	}
+
+	/* return the output info */
+	obj = output.pointer;
+
+	if (count > 1) {
+		if ((obj->type != ACPI_TYPE_PACKAGE) ||
+			(obj->package.count != count)) {
+			result = -EIO;
+			goto error;
+		}
+		params = obj->package.elements;
+	} else
+		params = obj;
+
+	if (params == NULL) {
+		result = -EIO;
+		goto error;
+	}
+
+	for (i = 0; i < count; i++) {
+		if (argument->type != params->type) {
+			result = -EIO;
+			goto error;
+		}
+		switch (params->type) {
+		case ACPI_TYPE_INTEGER:
+			argument->value = params->integer.value;
+			break;
+		case ACPI_TYPE_STRING:
+			if ((params->string.length != argument->data_length) ||
+				(params->string.pointer == NULL)) {
+				result = -EIO;
+				goto error;
+			}
+			strncpy(argument->pointer,
+				params->string.pointer,
+				params->string.length);
+			break;
+		case ACPI_TYPE_BUFFER:
+			if (params->buffer.pointer == NULL) {
+				result = -EIO;
+				goto error;
+			}
+			memcpy(argument->pointer,
+				params->buffer.pointer,
+				argument->data_length);
+			break;
+		default:
+			break;
+		}
+		argument++;
+		params++;
+	}
+
+error:
+	if (obj != NULL)
+		kfree(obj);
+	kfree((void *)input.pointer);
+	return result;
+}
+#else
+static int amdgpu_cgs_acpi_eval_object(void *cgs_device,
+				struct cgs_acpi_method_info *info)
+{
+	return -EIO;
+}
+#endif
+
+int amdgpu_cgs_call_acpi_method(void *cgs_device,
+					uint32_t acpi_method,
+					uint32_t acpi_function,
+					void *pinput, void *poutput,
+					uint32_t output_count,
+					uint32_t input_size,
+					uint32_t output_size)
+{
+	struct cgs_acpi_method_argument acpi_input[2] = { {0}, {0} };
+	struct cgs_acpi_method_argument acpi_output = {0};
+	struct cgs_acpi_method_info info = {0};
+
+	acpi_input[0].type = CGS_ACPI_TYPE_INTEGER;
+	acpi_input[0].method_length = sizeof(uint32_t);
+	acpi_input[0].data_length = sizeof(uint32_t);
+	acpi_input[0].value = acpi_function;
+
+	acpi_input[1].type = CGS_ACPI_TYPE_BUFFER;
+	acpi_input[1].method_length = CGS_ACPI_MAX_BUFFER_SIZE;
+	acpi_input[1].data_length = input_size;
+	acpi_input[1].pointer = pinput;
+
+	acpi_output.type = CGS_ACPI_TYPE_BUFFER;
+	acpi_output.method_length = CGS_ACPI_MAX_BUFFER_SIZE;
+	acpi_output.data_length = output_size;
+	acpi_output.pointer = poutput;
+
+	info.size = sizeof(struct cgs_acpi_method_info);
+	info.field = CGS_ACPI_FIELD_METHOD_NAME | CGS_ACPI_FIELD_INPUT_ARGUMENT_COUNT;
+	info.input_count = 2;
+	info.name = acpi_method;
+	info.pinput_argument = acpi_input;
+	info.output_count = output_count;
+	info.poutput_argument = &acpi_output;
+
+	return amdgpu_cgs_acpi_eval_object(cgs_device, &info);
+}
+
 static const struct cgs_ops amdgpu_cgs_ops = {
 	amdgpu_cgs_gpu_mem_info,
 	amdgpu_cgs_gmap_kmem,
@@ -768,7 +983,8 @@ static const struct cgs_ops amdgpu_cgs_ops = {
 	amdgpu_cgs_set_camera_voltages,
 	amdgpu_cgs_get_firmware_info,
 	amdgpu_cgs_set_powergating_state,
-	amdgpu_cgs_set_clockgating_state
+	amdgpu_cgs_set_clockgating_state,
+	amdgpu_cgs_call_acpi_method,
 };
 
 static const struct cgs_os_ops amdgpu_cgs_os_ops = {
drivers/gpu/drm/amd/include/cgs_common.h +44 -1

68 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

PATCH 5/51 drm/amdgpu: implement cgs interface to query system info

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Add a query to get the bus number and function of the device.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c  | 23 +++++++++++++++++++++++
 drivers/gpu/drm/amd/include/cgs_common.h | 23 +++++++++++++++++++++++
 2 files changed, 46 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +23 -0
index f901cdc..19f46d0 100644
@@ -736,6 +736,28 @@ static int amdgpu_cgs_get_firmware_info(void *cgs_device,
 	return 0;
 }
 
+static int amdgpu_cgs_query_system_info(void *cgs_device,
+				struct cgs_system_info *sys_info)
+{
+	CGS_FUNC_ADEV;
+
+	if (NULL == sys_info)
+		return -ENODEV;
+
+	if (sizeof(struct cgs_system_info) != sys_info->size)
+		return -ENODEV;
+
+	switch (sys_info->info_id) {
+	case CGS_SYSTEM_INFO_ADAPTER_BDF_ID:
+		sys_info->value = adev->pdev->devfn | (adev->pdev->bus->number << 8);
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 /** \brief evaluate acpi namespace object, handle or pathname must be valid
  *  \param cgs_device
  *  \param info input/output arguments for the control method
@@ -985,6 +1007,7 @@ static const struct cgs_ops amdgpu_cgs_ops = {
 	amdgpu_cgs_set_powergating_state,
 	amdgpu_cgs_set_clockgating_state,
 	amdgpu_cgs_call_acpi_method,
+	amdgpu_cgs_query_system_info,
 };
 
 static const struct cgs_os_ops amdgpu_cgs_os_ops = {
drivers/gpu/drm/amd/include/cgs_common.h +23 -0
index 8bf6ee5..5ea8db0 100644
@@ -105,6 +105,21 @@ enum cgs_ucode_id {
 	CGS_UCODE_ID_MAXIMUM,
 };
 
+enum cgs_system_info_id {
+	CGS_SYSTEM_INFO_ADAPTER_BDF_ID = 1,
+	CGS_SYSTEM_INFO_ID_MAXIMUM,
+};
+
+struct cgs_system_info {
+	uint64_t       size;
+	uint64_t       info_id;
+	union {
+		void           *ptr;
+		uint64_t        value;
+	};
+	uint64_t               padding[13];
+};
+
 /**
  * struct cgs_clock_limits - Clock limits
  *
@@ -533,6 +548,10 @@ typedef int (*cgs_call_acpi_method)(void *cgs_device,
 					uint32_t output_count,
 					uint32_t input_size,
 					uint32_t output_size);
+
+typedef int (*cgs_query_system_info)(void *cgs_device,
+				struct cgs_system_info *sys_info);
+
 struct cgs_ops {
 	/* memory management calls (similar to KFD interface) */
 	cgs_gpu_mem_info_t gpu_mem_info;
@@ -575,6 +594,8 @@ struct cgs_ops {
 	cgs_set_clockgating_state set_clockgating_state;
 	/* ACPI */
 	cgs_call_acpi_method call_acpi_method;
+	/* get system info */
+	cgs_query_system_info query_system_info;
 };
 
 struct cgs_os_ops; /* To be define in OS-specific CGS header */
@@ -663,5 +684,7 @@ struct cgs_device
 	CGS_CALL(set_clockgating_state, dev, block_type, state)
 #define cgs_call_acpi_method(dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size)	\
 	CGS_CALL(call_acpi_method, dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size)
+#define cgs_query_system_info(dev, sys_info)	\
+	CGS_CALL(query_system_info, dev, sys_info)
 
 #endif /* _CGS_COMMON_H */
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

PATCH 6/51 drm/amdgpu: add new cgs interface to get display info (v2)

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Add new CGS interfaces to query display info across modules. This is nedded by the powerplay module for synchronizing with the display module.

v2: (agd): fold in refresh rate fix, rebase

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c  | 40 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/include/cgs_common.h | 20 ++++++++++++++++
 2 files changed, 60 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +40 -0
index 19f46d0..8f758ea 100644
@@ -758,6 +758,45 @@ static int amdgpu_cgs_query_system_info(void *cgs_device,
 	return 0;
 }
 
+static int amdgpu_cgs_get_active_displays_info(void *cgs_device,
+					  struct cgs_display_info *info)
+{
+	CGS_FUNC_ADEV;
+	struct amdgpu_crtc *amdgpu_crtc;
+	struct drm_device *ddev = adev->ddev;
+	struct drm_crtc *crtc;
+	uint32_t line_time_us, vblank_lines;
+
+	if (info == NULL)
+		return -EINVAL;
+
+	if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) {
+		list_for_each_entry(crtc,
+				&ddev->mode_config.crtc_list, head) {
+			amdgpu_crtc = to_amdgpu_crtc(crtc);
+			if (crtc->enabled) {
+				info->active_display_mask |= (1 << amdgpu_crtc->crtc_id);
+				info->display_count++;
+			}
+			if (info->mode_info != NULL &&
+				crtc->enabled && amdgpu_crtc->enabled &&
+				amdgpu_crtc->hw_mode.clock) {
+				line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal * 1000) /
+							amdgpu_crtc->hw_mode.clock;
+				vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end -
+							amdgpu_crtc->hw_mode.crtc_vdisplay +
+							(amdgpu_crtc->v_border * 2);
+				info->mode_info->vblank_time_us = vblank_lines * line_time_us;
+				info->mode_info->refresh_rate = drm_mode_vrefresh(&amdgpu_crtc->hw_mode);
+				info->mode_info->ref_clock = adev->clock.spll.reference_freq;
+				info->mode_info++;
+			}
+		}
+	}
+
+	return 0;
+}
+
 /** \brief evaluate acpi namespace object, handle or pathname must be valid
  *  \param cgs_device
  *  \param info input/output arguments for the control method
@@ -1006,6 +1045,7 @@ static const struct cgs_ops amdgpu_cgs_ops = {
 	amdgpu_cgs_get_firmware_info,
 	amdgpu_cgs_set_powergating_state,
 	amdgpu_cgs_set_clockgating_state,
+	amdgpu_cgs_get_active_displays_info,
 	amdgpu_cgs_call_acpi_method,
 	amdgpu_cgs_query_system_info,
 };
drivers/gpu/drm/amd/include/cgs_common.h +20 -0
index 5ea8db0..2bbffd1 100644
@@ -142,6 +142,18 @@ struct cgs_firmware_info {
 	void			*kptr;
 };
 
+struct cgs_mode_info {
+	uint32_t		refresh_rate;
+	uint32_t		ref_clock;
+	uint32_t		vblank_time_us;
+};
+
+struct cgs_display_info {
+	uint32_t		display_count;
+	uint32_t		active_display_mask;
+	struct cgs_mode_info *mode_info;
+};
+
 typedef unsigned long cgs_handle_t;
 
 #define CGS_ACPI_METHOD_ATCS          0x53435441
@@ -541,6 +553,10 @@ typedef int(*cgs_set_clockgating_state)(void *cgs_device,
 				  enum amd_ip_block_type block_type,
 				  enum amd_clockgating_state state);
 
+typedef int(*cgs_get_active_displays_info)(
+					void *cgs_device,
+					struct cgs_display_info *info);
+
 typedef int (*cgs_call_acpi_method)(void *cgs_device,
 					uint32_t acpi_method,
 					uint32_t acpi_function,
@@ -592,6 +608,8 @@ struct cgs_ops {
 	/* cg pg interface*/
 	cgs_set_powergating_state set_powergating_state;
 	cgs_set_clockgating_state set_clockgating_state;
+	/* display manager */
+	cgs_get_active_displays_info get_active_displays_info;
 	/* ACPI */
 	cgs_call_acpi_method call_acpi_method;
 	/* get system info */
@@ -682,6 +700,8 @@ struct cgs_device
 	CGS_CALL(set_powergating_state, dev, block_type, state)
 #define cgs_set_clockgating_state(dev, block_type, state)	\
 	CGS_CALL(set_clockgating_state, dev, block_type, state)
+#define cgs_get_active_displays_info(dev, info)	\
+	CGS_CALL(get_active_displays_info, dev, info)
 #define cgs_call_acpi_method(dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size)	\
 	CGS_CALL(call_acpi_method, dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size)
 #define cgs_query_system_info(dev, sys_info)	\
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

PATCH 7/51 drm/amd/powerplay: add basic powerplay framework

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

amdgpu_pp_ip_funcs is introduced to handle the two code paths, the legacy one and the new powerplay implementation.

CONFIG_DRM_AMD_POWERPLAY kernel configuration option is introduced for the powerplay component.

v4: squash in fixes
v3: register debugfs file when powerplay module enable
v2: add amdgpu_ucode_init_bo in hw init when amdgpu_powerplay enable.

---
 drivers/gpu/drm/Kconfig                           |   1 +
 drivers/gpu/drm/amd/amdgpu/Makefile               |  12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h               |   5 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c     | 280 ++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h     |  33 +++
 drivers/gpu/drm/amd/amdgpu/cik.c                  |  11 +-
 drivers/gpu/drm/amd/amdgpu/vi.c                   |   7 +-
 drivers/gpu/drm/amd/powerplay/Kconfig             |   6 +
 drivers/gpu/drm/amd/powerplay/Makefile            |  15 ++
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c     | 194 +++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h | 162 +++++++++++++
 12 files changed, 718 insertions(+), 9 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/Kconfig
 create mode 100644 drivers/gpu/drm/amd/powerplay/Makefile
 create mode 100644 drivers/gpu/drm/amd/powerplay/amd_powerplay.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h
drivers/gpu/drm/Kconfig +1 -0
index c4bf9a1..b42c1ba 100644
@@ -160,6 +160,7 @@ config DRM_AMDGPU
 	  If M is selected, the module will be called amdgpu.
 
 source "drivers/gpu/drm/amd/amdgpu/Kconfig"
+source "drivers/gpu/drm/amd/powerplay/Kconfig"
 
 source "drivers/gpu/drm/nouveau/Kconfig"
 
drivers/gpu/drm/amd/amdgpu/Makefile +11 -1
index 04c2707..2b6ac15 100644
@@ -5,7 +5,8 @@
 ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/asic_reg \
 	-Idrivers/gpu/drm/amd/include \
 	-Idrivers/gpu/drm/amd/amdgpu \
-	-Idrivers/gpu/drm/amd/scheduler
+	-Idrivers/gpu/drm/amd/scheduler \
+	-Idrivers/gpu/drm/amd/powerplay/inc
 
 amdgpu-y := amdgpu_drv.o
 
@@ -44,6 +45,7 @@ amdgpu-y += \
 # add SMC block
 amdgpu-y += \
 	amdgpu_dpm.o \
+	amdgpu_powerplay.o \
 	cz_smc.o cz_dpm.o \
 	tonga_smc.o tonga_dpm.o \
 	fiji_smc.o fiji_dpm.o \
@@ -94,6 +96,14 @@ amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o
 amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o
 amdgpu-$(CONFIG_MMU_NOTIFIER) += amdgpu_mn.o
 
+ifneq ($(CONFIG_DRM_AMD_POWERPLAY),)
+
+include drivers/gpu/drm/amd/powerplay/Makefile
+
+amdgpu-y += $(AMD_POWERPLAY_FILES)
+
+endif
+
 obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o
 
 CFLAGS_amdgpu_trace_points.o := -I$(src)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -0
index cdaf8e2..f3223c5 100644
@@ -52,6 +52,7 @@
 #include "amdgpu_irq.h"
 #include "amdgpu_ucode.h"
 #include "amdgpu_gds.h"
+#include "amd_powerplay.h"
 
 #include "gpu_scheduler.h"
 
@@ -85,6 +86,7 @@ extern int amdgpu_enable_scheduler;
 extern int amdgpu_sched_jobs;
 extern int amdgpu_sched_hw_submission;
 extern int amdgpu_enable_semaphores;
+extern int amdgpu_powerplay;
 
 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS	        3000
 #define AMDGPU_MAX_USEC_TIMEOUT			100000	/* 100 ms */
@@ -1988,6 +1990,9 @@ struct amdgpu_device {
 	/* interrupts */
 	struct amdgpu_irq		irq;
 
+	/* powerplay */
+	struct amd_powerplay		powerplay;
+
 	/* dpm */
 	struct amdgpu_pm		pm;
 	u32				cg_flags;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
index 0508c5c..885da0b 100644
@@ -82,6 +82,7 @@ int amdgpu_enable_scheduler = 1;
 int amdgpu_sched_jobs = 16;
 int amdgpu_sched_hw_submission = 2;
 int amdgpu_enable_semaphores = 0;
+int amdgpu_powerplay = 0;
 
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
 module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c new file +280 -0

280 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h new file +33 -0
new file mode 100644
index 0000000..da5cf47
@@ -0,0 +1,33 @@
+/*
+ *  Copyright 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: AMD
+ *
+ */
+
+#ifndef __AMDGPU_POPWERPLAY_H__
+#define __AMDGPU_POPWERPLAY_H__
+
+#include "amd_shared.h"
+
+extern const struct amd_ip_funcs amdgpu_pp_ip_funcs;
+
+#endif /* __AMDSOC_DM_H__ */
drivers/gpu/drm/amd/amdgpu/cik.c +6 -5
index 484710c..c8b7bef 100644
@@ -65,6 +65,7 @@
 #include "oss/oss_2_0_sh_mask.h"
 
 #include "amdgpu_amdkfd.h"
+#include "amdgpu_powerplay.h"
 
 /*
  * Indirect registers accessor
@@ -1922,7 +1923,7 @@ static const struct amdgpu_ip_block_version bonaire_ip_blocks[] =
 		.major = 7,
 		.minor = 0,
 		.rev = 0,
-		.funcs = &ci_dpm_ip_funcs,
+		.funcs = &amdgpu_pp_ip_funcs,
 	},
 	{
 		.type = AMD_IP_BLOCK_TYPE_DCE,
@@ -1990,7 +1991,7 @@ static const struct amdgpu_ip_block_version hawaii_ip_blocks[] =
 		.major = 7,
 		.minor = 0,
 		.rev = 0,
-		.funcs = &ci_dpm_ip_funcs,
+		.funcs = &amdgpu_pp_ip_funcs,
 	},
 	{
 		.type = AMD_IP_BLOCK_TYPE_DCE,
@@ -2058,7 +2059,7 @@ static const struct amdgpu_ip_block_version kabini_ip_blocks[] =
 		.major = 7,
 		.minor = 0,
 		.rev = 0,
-		.funcs = &kv_dpm_ip_funcs,
+		.funcs = &amdgpu_pp_ip_funcs,
 	},
 	{
 		.type = AMD_IP_BLOCK_TYPE_DCE,
@@ -2126,7 +2127,7 @@ static const struct amdgpu_ip_block_version mullins_ip_blocks[] =
 		.major = 7,
 		.minor = 0,
 		.rev = 0,
-		.funcs = &kv_dpm_ip_funcs,
+		.funcs = &amdgpu_pp_ip_funcs,
 	},
 	{
 		.type = AMD_IP_BLOCK_TYPE_DCE,
@@ -2194,7 +2195,7 @@ static const struct amdgpu_ip_block_version kaveri_ip_blocks[] =
 		.major = 7,
 		.minor = 0,
 		.rev = 0,
-		.funcs = &kv_dpm_ip_funcs,
+		.funcs = &amdgpu_pp_ip_funcs,
 	},
 	{
 		.type = AMD_IP_BLOCK_TYPE_DCE,
drivers/gpu/drm/amd/amdgpu/vi.c +4 -3
index 2adc1c8..ca3590f 100644
@@ -71,6 +71,7 @@
 #include "uvd_v5_0.h"
 #include "uvd_v6_0.h"
 #include "vce_v3_0.h"
+#include "amdgpu_powerplay.h"
 
 /*
  * Indirect registers accessor
@@ -1098,7 +1099,7 @@ static const struct amdgpu_ip_block_version topaz_ip_blocks[] =
 		.major = 7,
 		.minor = 1,
 		.rev = 0,
-		.funcs = &iceland_dpm_ip_funcs,
+		.funcs = &amdgpu_pp_ip_funcs,
 	},
 	{
 		.type = AMD_IP_BLOCK_TYPE_GFX,
@@ -1145,7 +1146,7 @@ static const struct amdgpu_ip_block_version tonga_ip_blocks[] =
 		.major = 7,
 		.minor = 1,
 		.rev = 0,
-		.funcs = &tonga_dpm_ip_funcs,
+		.funcs = &amdgpu_pp_ip_funcs,
 	},
 	{
 		.type = AMD_IP_BLOCK_TYPE_DCE,
@@ -1281,7 +1282,7 @@ static const struct amdgpu_ip_block_version cz_ip_blocks[] =
 		.major = 8,
 		.minor = 0,
 		.rev = 0,
-		.funcs = &cz_dpm_ip_funcs,
+		.funcs = &amdgpu_pp_ip_funcs
 	},
 	{
 		.type = AMD_IP_BLOCK_TYPE_DCE,
drivers/gpu/drm/amd/powerplay/Kconfig new file +6 -0
new file mode 100644
index 0000000..af38033
@@ -0,0 +1,6 @@
+config DRM_AMD_POWERPLAY
+	bool  "Enable AMD powerplay component"
+	depends on DRM_AMDGPU
+	default n
+	help
+	  select this option will enable AMD powerplay component.
drivers/gpu/drm/amd/powerplay/Makefile new file +15 -0
new file mode 100644
index 0000000..e7428a1
@@ -0,0 +1,15 @@
+
+subdir-ccflags-y += -Iinclude/drm  \
+		-Idrivers/gpu/drm/amd/powerplay/inc/  \
+		-Idrivers/gpu/drm/amd/include/asic_reg  \
+		-Idrivers/gpu/drm/amd/include
+
+AMD_PP_PATH = ../powerplay
+
+include $(AMD_POWERPLAY)
+
+POWER_MGR = amd_powerplay.o
+
+AMD_PP_POWER = $(addprefix $(AMD_PP_PATH)/,$(POWER_MGR))
+
+AMD_POWERPLAY_FILES += $(AMD_PP_POWER)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c new file +194 -0

194 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h new file +162 -0

162 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

PATCH 8/51 drm/amdgpu: disable legacy path of firmware check if powerplay is enabled

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Powerplay will use a different interface once it's integrated. These legacy pathes will be removed once powerplay is enabled by default.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 80 ++++++++++++++++++----------------
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 24 +++++-----
 2 files changed, 55 insertions(+), 49 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +42 -38
index 3de6a88..1528987 100644
@@ -2797,16 +2797,18 @@ static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev)
 
 	gfx_v8_0_rlc_reset(adev);
 
-	if (!adev->firmware.smu_load) {
-		/* legacy rlc firmware loading */
-		r = gfx_v8_0_rlc_load_microcode(adev);
-		if (r)
-			return r;
-	} else {
-		r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
-						AMDGPU_UCODE_ID_RLC_G);
-		if (r)
-			return -EINVAL;
+	if (!amdgpu_powerplay) {
+		if (!adev->firmware.smu_load) {
+			/* legacy rlc firmware loading */
+			r = gfx_v8_0_rlc_load_microcode(adev);
+			if (r)
+				return r;
+		} else {
+			r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
+							AMDGPU_UCODE_ID_RLC_G);
+			if (r)
+				return -EINVAL;
+		}
 	}
 
 	gfx_v8_0_rlc_start(adev);
@@ -3692,35 +3694,37 @@ static int gfx_v8_0_cp_resume(struct amdgpu_device *adev)
 	if (!(adev->flags & AMD_IS_APU))
 		gfx_v8_0_enable_gui_idle_interrupt(adev, false);
 
-	if (!adev->firmware.smu_load) {
-		/* legacy firmware loading */
-		r = gfx_v8_0_cp_gfx_load_microcode(adev);
-		if (r)
-			return r;
-
-		r = gfx_v8_0_cp_compute_load_microcode(adev);
-		if (r)
-			return r;
-	} else {
-		r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
-						AMDGPU_UCODE_ID_CP_CE);
-		if (r)
-			return -EINVAL;
-
-		r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
-						AMDGPU_UCODE_ID_CP_PFP);
-		if (r)
-			return -EINVAL;
-
-		r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
-						AMDGPU_UCODE_ID_CP_ME);
-		if (r)
-			return -EINVAL;
+	if (!amdgpu_powerplay) {
+		if (!adev->firmware.smu_load) {
+			/* legacy firmware loading */
+			r = gfx_v8_0_cp_gfx_load_microcode(adev);
+			if (r)
+				return r;
 
-		r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
-						AMDGPU_UCODE_ID_CP_MEC1);
-		if (r)
-			return -EINVAL;
+			r = gfx_v8_0_cp_compute_load_microcode(adev);
+			if (r)
+				return r;
+		} else {
+			r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
+							AMDGPU_UCODE_ID_CP_CE);
+			if (r)
+				return -EINVAL;
+
+			r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
+							AMDGPU_UCODE_ID_CP_PFP);
+			if (r)
+				return -EINVAL;
+
+			r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
+							AMDGPU_UCODE_ID_CP_ME);
+			if (r)
+				return -EINVAL;
+
+			r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
+							AMDGPU_UCODE_ID_CP_MEC1);
+			if (r)
+				return -EINVAL;
+		}
 	}
 
 	r = gfx_v8_0_cp_gfx_resume(adev);
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +13 -11
index 7253132..8091c1c 100644
@@ -727,18 +727,20 @@ static int sdma_v3_0_start(struct amdgpu_device *adev)
 {
 	int r, i;
 
-	if (!adev->firmware.smu_load) {
-		r = sdma_v3_0_load_microcode(adev);
-		if (r)
-			return r;
-	} else {
-		for (i = 0; i < adev->sdma.num_instances; i++) {
-			r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
-									 (i == 0) ?
-									 AMDGPU_UCODE_ID_SDMA0 :
-									 AMDGPU_UCODE_ID_SDMA1);
+	if (!amdgpu_powerplay) {
+		if (!adev->firmware.smu_load) {
+			r = sdma_v3_0_load_microcode(adev);
 			if (r)
-				return -EINVAL;
+				return r;
+		} else {
+			for (i = 0; i < adev->sdma.num_instances; i++) {
+				r = adev->smu.smumgr_funcs->check_fw_load_finish(adev,
+										 (i == 0) ?
+										 AMDGPU_UCODE_ID_SDMA0 :
+										 AMDGPU_UCODE_ID_SDMA1);
+				if (r)
+					return -EINVAL;
+			}
 		}
 	}
 
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

PATCH 9/51 drm/amdgpu: export amd_powerplay_func to amdgpu and other ip block

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Update amdgpu to deal with the new powerplay module properly.

v2: squash in fixes
v3: squash in Rex's power state reporting fix

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h    |  46 ++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 215 +++++++++++++++++++++------------
 2 files changed, 180 insertions(+), 81 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +40 -6
index f3223c5..7e381c2 100644
@@ -2215,20 +2215,54 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 #define amdgpu_dpm_set_power_state(adev) (adev)->pm.funcs->set_power_state((adev))
 #define amdgpu_dpm_post_set_power_state(adev) (adev)->pm.funcs->post_set_power_state((adev))
 #define amdgpu_dpm_display_configuration_changed(adev) (adev)->pm.funcs->display_configuration_changed((adev))
-#define amdgpu_dpm_get_sclk(adev, l) (adev)->pm.funcs->get_sclk((adev), (l))
-#define amdgpu_dpm_get_mclk(adev, l) (adev)->pm.funcs->get_mclk((adev), (l))
 #define amdgpu_dpm_print_power_state(adev, ps) (adev)->pm.funcs->print_power_state((adev), (ps))
-#define amdgpu_dpm_debugfs_print_current_performance_level(adev, m) (adev)->pm.funcs->debugfs_print_current_performance_level((adev), (m))
-#define amdgpu_dpm_force_performance_level(adev, l) (adev)->pm.funcs->force_performance_level((adev), (l))
 #define amdgpu_dpm_vblank_too_short(adev) (adev)->pm.funcs->vblank_too_short((adev))
-#define amdgpu_dpm_powergate_uvd(adev, g) (adev)->pm.funcs->powergate_uvd((adev), (g))
-#define amdgpu_dpm_powergate_vce(adev, g) (adev)->pm.funcs->powergate_vce((adev), (g))
 #define amdgpu_dpm_enable_bapm(adev, e) (adev)->pm.funcs->enable_bapm((adev), (e))
 #define amdgpu_dpm_set_fan_control_mode(adev, m) (adev)->pm.funcs->set_fan_control_mode((adev), (m))
 #define amdgpu_dpm_get_fan_control_mode(adev) (adev)->pm.funcs->get_fan_control_mode((adev))
 #define amdgpu_dpm_set_fan_speed_percent(adev, s) (adev)->pm.funcs->set_fan_speed_percent((adev), (s))
 #define amdgpu_dpm_get_fan_speed_percent(adev, s) (adev)->pm.funcs->get_fan_speed_percent((adev), (s))
 
+#define amdgpu_dpm_get_sclk(adev, l) \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->get_sclk((adev)->powerplay.pp_handle, (l)) : \
+		(adev)->pm.funcs->get_sclk((adev), (l))
+
+#define amdgpu_dpm_get_mclk(adev, l)  \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->get_mclk((adev)->powerplay.pp_handle, (l)) : \
+		(adev)->pm.funcs->get_mclk((adev), (l))
+
+
+#define amdgpu_dpm_force_performance_level(adev, l) \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->force_performance_level((adev)->powerplay.pp_handle, (l)) : \
+		(adev)->pm.funcs->force_performance_level((adev), (l))
+
+#define amdgpu_dpm_powergate_uvd(adev, g) \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->powergate_uvd((adev)->powerplay.pp_handle, (g)) : \
+		(adev)->pm.funcs->powergate_uvd((adev), (g))
+
+#define amdgpu_dpm_powergate_vce(adev, g) \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->powergate_vce((adev)->powerplay.pp_handle, (g)) : \
+		(adev)->pm.funcs->powergate_vce((adev), (g))
+
+#define amdgpu_dpm_debugfs_print_current_performance_level(adev, m) \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->print_current_performance_level((adev)->powerplay.pp_handle, (m)) : \
+		(adev)->pm.funcs->debugfs_print_current_performance_level((adev), (m))
+
+#define amdgpu_dpm_get_current_power_state(adev) \
+		(adev)->powerplay.pp_funcs->get_current_power_state((adev)->powerplay.pp_handle)
+
+#define amdgpu_dpm_get_performance_level(adev) \
+		(adev)->powerplay.pp_funcs->get_performance_level((adev)->powerplay.pp_handle)
+
+#define amdgpu_dpm_dispatch_task(adev, event_id, input, output) \
+	(adev)->powerplay.pp_funcs->dispatch_tasks((adev)->powerplay.pp_handle, (event_id), (input), (output))
+
 #define amdgpu_gds_switch(adev, r, v, d, w, a) (adev)->gds.funcs->patch_gds_switch((r), (v), (d), (w), (a))
 
 /* Common functions */
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +140 -75

337 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

PATCH 10/51 drm/amd/powerplay: add SMU manager sub-component

In reply to Alex Deucher

From: Jammy Zhou <[email protected]>

The SMUMGR is one sub-component of powerplay for SMU firmware support. The SMU handles firmware loading for other IP blocks (GFX, SDMA, etc.) on VI parts. The adds the core powerplay infrastructure to handle that.

v3: direct use printk in powerplay module.
v2: direct use cgs_read/write_register functions in smu-modules

---
 drivers/gpu/drm/amd/powerplay/Makefile          |   4 +
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c   |  81 ++++++++
 drivers/gpu/drm/amd/powerplay/inc/pp_instance.h |  33 ++++
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h      | 182 +++++++++++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile   |   9 +
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c   | 251 ++++++++++++++++++++++++
 6 files changed, 560 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_instance.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smumgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/Makefile
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
drivers/gpu/drm/amd/powerplay/Makefile +4 -0
index e7428a1..60c6654 100644
@@ -6,6 +6,10 @@ subdir-ccflags-y += -Iinclude/drm  \
 
 AMD_PP_PATH = ../powerplay
 
+PP_LIBS = smumgr
+
+AMD_POWERPLAY = $(addsuffix /Makefile,$(addprefix drivers/gpu/drm/amd/powerplay/,$(PP_LIBS)))
+
 include $(AMD_POWERPLAY)
 
 POWER_MGR = amd_powerplay.o
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +81 -0

117 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/pp_instance.h new file +33 -0
new file mode 100644
index 0000000..318f827
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#ifndef _PP_INSTANCE_H_
+#define _PP_INSTANCE_H_
+
+#include "smumgr.h"
+
+
+struct pp_instance {
+	struct pp_smumgr *smu_mgr;
+};
+
+#endif
drivers/gpu/drm/amd/powerplay/inc/smumgr.h new file +182 -0

182 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/Makefile new file +9 -0
new file mode 100644
index 0000000..61bfb2a
@@ -0,0 +1,9 @@
+#
+# Makefile for the 'smu manager' sub-component of powerplay.
+# It provides the smu management services for the driver.
+
+SMU_MGR = smumgr.o
+
+AMD_PP_SMUMGR = $(addprefix $(AMD_PP_PATH)/smumgr/,$(SMU_MGR))
+
+AMD_POWERPLAY_FILES += $(AMD_PP_SMUMGR)
drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c new file +251 -0

251 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw

PATCH 11/51 drm/amd/powerplay: add hardware manager sub-component

In reply to Alex Deucher

From: Jammy Zhou <[email protected]>

The hwmgr handles all hardware related calls, including clock/power gating control, DPM, read and parse PPTable, etc.

v5: squash in fixes
v4: implement acpi's atcs function use cgs interface
v3: fix code style error and add big-endian mode support.
v2: use cgs interface directly in hwmgr sub-module

---
 drivers/gpu/drm/amd/powerplay/Makefile             |    2 +-
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      |   55 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |   10 +
 .../gpu/drm/amd/powerplay/hwmgr/functiontables.c   |  154 ++
 .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c  |   84 +
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |  201 +++
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c      |   76 +
 .../gpu/drm/amd/powerplay/hwmgr/processpptables.c  | 1661 ++++++++++++++++++++
 .../gpu/drm/amd/powerplay/hwmgr/processpptables.h  |   47 +
 drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h  |    1 -
 .../gpu/drm/amd/powerplay/inc/hardwaremanager.h    |  280 ++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |  607 +++++++
 drivers/gpu/drm/amd/powerplay/inc/power_state.h    |  200 +++
 drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h        |   28 +
 drivers/gpu/drm/amd/powerplay/inc/pp_instance.h    |    3 +-
 .../gpu/drm/amd/powerplay/inc/pp_power_source.h    |   36 +
 16 files changed, 3439 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/power_state.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_power_source.h
drivers/gpu/drm/amd/powerplay/Makefile +1 -1
index 60c6654..6359c67 100644
@@ -6,7 +6,7 @@ subdir-ccflags-y += -Iinclude/drm  \
 
 AMD_PP_PATH = ../powerplay
 
-PP_LIBS = smumgr
+PP_LIBS = smumgr hwmgr
 
 AMD_POWERPLAY = $(addsuffix /Makefile,$(addprefix drivers/gpu/drm/amd/powerplay/,$(PP_LIBS)))
 
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +52 -3

92 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/Makefile new file +10 -0
new file mode 100644
index 0000000..ef529e0
@@ -0,0 +1,10 @@
+#
+# Makefile for the 'hw manager' sub-component of powerplay.
+# It provides the hardware management services for the driver.
+
+HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
+	       hardwaremanager.o pp_acpi.o
+
+AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
+
+AMD_POWERPLAY_FILES += $(AMD_PP_HWMGR)
drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c new file +154 -0

154 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c new file +84 -0

84 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c new file +201 -0

201 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c new file +76 -0

76 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c new file +1661 -0

1,661 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.h new file +47 -0

47 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h +0 -1
index 09d9d5a..2281d88 100644
@@ -28,7 +28,6 @@
 #include "amd_shared.h"
 #include "cgs_common.h"
 
-
 enum amd_pp_event {
 	AMD_PP_EVENT_INITIALIZE = 0,
 	AMD_PP_EVENT_UNINITIALIZE,
drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h new file +280 -0

280 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/hwmgr.h new file +607 -0

380 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/power_state.h new file +200 -0

200 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h new file +28 -0
new file mode 100644
index 0000000..3bd5e69

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/powerplay/inc/pp_instance.h +2 -1
index 318f827..35dfcd9 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/powerplay/inc/pp_power_source.h new file +36 -0
new file mode 100644
index 0000000..b43315c

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Part of the diff is not shown here. View the raw message.

#12 lore raw

PATCH 12/51 drm/amd/powerplay: add Carrizo smu support

In reply to Alex Deucher

From: Jammy Zhou <[email protected]>

This implements the SMU firmware manager interface for CZ. Some header files are moved from amdgpu folder to powerplay as well.

v3: delete peci sub-module.
v2: use cgs interface directly
add load_mec_firmware function

---
 drivers/gpu/drm/amd/amdgpu/cz_ppsmc.h              | 185 -----
 drivers/gpu/drm/amd/amdgpu/smu8.h                  |  72 --
 drivers/gpu/drm/amd/amdgpu/smu8_fusion.h           | 127 ---
 drivers/gpu/drm/amd/amdgpu/smu_ucode_xfer_cz.h     | 147 ----
 drivers/gpu/drm/amd/powerplay/inc/cz_ppsmc.h       | 185 +++++
 drivers/gpu/drm/amd/powerplay/inc/smu8.h           |  72 ++
 drivers/gpu/drm/amd/powerplay/inc/smu8_fusion.h    | 127 +++
 .../gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h  | 147 ++++
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |   2 +-
 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c   | 858 +++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.h   | 102 +++
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c      |   3 +-
 12 files changed, 1494 insertions(+), 533 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/cz_ppsmc.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu8.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu8_fusion.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu_ucode_xfer_cz.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/cz_ppsmc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu8.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu8_fusion.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.h
drivers/gpu/drm/amd/amdgpu/cz_ppsmc.h deleted +0 -185
deleted file mode 100644
index 273616a..0000000
@@ -1,185 +0,0 @@
-/*
- * Copyright 2014 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef CZ_PP_SMC_H
-#define CZ_PP_SMC_H
-
-#pragma pack(push, 1)
-
-/* Fan control algorithm:*/
-#define FDO_MODE_HARDWARE 0
-#define FDO_MODE_PIECE_WISE_LINEAR 1
-
-enum FAN_CONTROL {
-    FAN_CONTROL_FUZZY,
-    FAN_CONTROL_TABLE
-};
-
-enum DPM_ARRAY {
-    DPM_ARRAY_HARD_MAX,
-    DPM_ARRAY_HARD_MIN,
-    DPM_ARRAY_SOFT_MAX,
-    DPM_ARRAY_SOFT_MIN
-};
-
-/*
- * Return codes for driver to SMC communication.
- * Leave these #define-s, enums might not be exactly 8-bits on the microcontroller.
- */
-#define PPSMC_Result_OK             ((uint16_t)0x01)
-#define PPSMC_Result_NoMore         ((uint16_t)0x02)
-#define PPSMC_Result_NotNow         ((uint16_t)0x03)
-#define PPSMC_Result_Failed         ((uint16_t)0xFF)
-#define PPSMC_Result_UnknownCmd     ((uint16_t)0xFE)
-#define PPSMC_Result_UnknownVT      ((uint16_t)0xFD)
-
-#define PPSMC_isERROR(x)            ((uint16_t)0x80 & (x))
-
-/*
- * Supported driver messages
- */
-#define PPSMC_MSG_Test                        ((uint16_t) 0x1)
-#define PPSMC_MSG_GetFeatureStatus            ((uint16_t) 0x2)
-#define PPSMC_MSG_EnableAllSmuFeatures        ((uint16_t) 0x3)
-#define PPSMC_MSG_DisableAllSmuFeatures       ((uint16_t) 0x4)
-#define PPSMC_MSG_OptimizeBattery             ((uint16_t) 0x5)
-#define PPSMC_MSG_MaximizePerf                ((uint16_t) 0x6)
-#define PPSMC_MSG_UVDPowerOFF                 ((uint16_t) 0x7)
-#define PPSMC_MSG_UVDPowerON                  ((uint16_t) 0x8)
-#define PPSMC_MSG_VCEPowerOFF                 ((uint16_t) 0x9)
-#define PPSMC_MSG_VCEPowerON                  ((uint16_t) 0xA)
-#define PPSMC_MSG_ACPPowerOFF                 ((uint16_t) 0xB)
-#define PPSMC_MSG_ACPPowerON                  ((uint16_t) 0xC)
-#define PPSMC_MSG_SDMAPowerOFF                ((uint16_t) 0xD)
-#define PPSMC_MSG_SDMAPowerON                 ((uint16_t) 0xE)
-#define PPSMC_MSG_XDMAPowerOFF                ((uint16_t) 0xF)
-#define PPSMC_MSG_XDMAPowerON                 ((uint16_t) 0x10)
-#define PPSMC_MSG_SetMinDeepSleepSclk         ((uint16_t) 0x11)
-#define PPSMC_MSG_SetSclkSoftMin              ((uint16_t) 0x12)
-#define PPSMC_MSG_SetSclkSoftMax              ((uint16_t) 0x13)
-#define PPSMC_MSG_SetSclkHardMin              ((uint16_t) 0x14)
-#define PPSMC_MSG_SetSclkHardMax              ((uint16_t) 0x15)
-#define PPSMC_MSG_SetLclkSoftMin              ((uint16_t) 0x16)
-#define PPSMC_MSG_SetLclkSoftMax              ((uint16_t) 0x17)
-#define PPSMC_MSG_SetLclkHardMin              ((uint16_t) 0x18)
-#define PPSMC_MSG_SetLclkHardMax              ((uint16_t) 0x19)
-#define PPSMC_MSG_SetUvdSoftMin               ((uint16_t) 0x1A)
-#define PPSMC_MSG_SetUvdSoftMax               ((uint16_t) 0x1B)
-#define PPSMC_MSG_SetUvdHardMin               ((uint16_t) 0x1C)
-#define PPSMC_MSG_SetUvdHardMax               ((uint16_t) 0x1D)
-#define PPSMC_MSG_SetEclkSoftMin              ((uint16_t) 0x1E)
-#define PPSMC_MSG_SetEclkSoftMax              ((uint16_t) 0x1F)
-#define PPSMC_MSG_SetEclkHardMin              ((uint16_t) 0x20)
-#define PPSMC_MSG_SetEclkHardMax              ((uint16_t) 0x21)
-#define PPSMC_MSG_SetAclkSoftMin              ((uint16_t) 0x22)
-#define PPSMC_MSG_SetAclkSoftMax              ((uint16_t) 0x23)
-#define PPSMC_MSG_SetAclkHardMin              ((uint16_t) 0x24)
-#define PPSMC_MSG_SetAclkHardMax              ((uint16_t) 0x25)
-#define PPSMC_MSG_SetNclkSoftMin              ((uint16_t) 0x26)
-#define PPSMC_MSG_SetNclkSoftMax              ((uint16_t) 0x27)
-#define PPSMC_MSG_SetNclkHardMin              ((uint16_t) 0x28)
-#define PPSMC_MSG_SetNclkHardMax              ((uint16_t) 0x29)
-#define PPSMC_MSG_SetPstateSoftMin            ((uint16_t) 0x2A)
-#define PPSMC_MSG_SetPstateSoftMax            ((uint16_t) 0x2B)
-#define PPSMC_MSG_SetPstateHardMin            ((uint16_t) 0x2C)
-#define PPSMC_MSG_SetPstateHardMax            ((uint16_t) 0x2D)
-#define PPSMC_MSG_DisableLowMemoryPstate      ((uint16_t) 0x2E)
-#define PPSMC_MSG_EnableLowMemoryPstate       ((uint16_t) 0x2F)
-#define PPSMC_MSG_UcodeAddressLow             ((uint16_t) 0x30)
-#define PPSMC_MSG_UcodeAddressHigh            ((uint16_t) 0x31)
-#define PPSMC_MSG_UcodeLoadStatus             ((uint16_t) 0x32)
-#define PPSMC_MSG_DriverDramAddrHi            ((uint16_t) 0x33)
-#define PPSMC_MSG_DriverDramAddrLo            ((uint16_t) 0x34)
-#define PPSMC_MSG_CondExecDramAddrHi          ((uint16_t) 0x35)
-#define PPSMC_MSG_CondExecDramAddrLo          ((uint16_t) 0x36)
-#define PPSMC_MSG_LoadUcodes                  ((uint16_t) 0x37)
-#define PPSMC_MSG_DriverResetMode             ((uint16_t) 0x38)
-#define PPSMC_MSG_PowerStateNotify            ((uint16_t) 0x39)
-#define PPSMC_MSG_SetDisplayPhyConfig         ((uint16_t) 0x3A)
-#define PPSMC_MSG_GetMaxSclkLevel             ((uint16_t) 0x3B)
-#define PPSMC_MSG_GetMaxLclkLevel             ((uint16_t) 0x3C)
-#define PPSMC_MSG_GetMaxUvdLevel              ((uint16_t) 0x3D)
-#define PPSMC_MSG_GetMaxEclkLevel             ((uint16_t) 0x3E)
-#define PPSMC_MSG_GetMaxAclkLevel             ((uint16_t) 0x3F)
-#define PPSMC_MSG_GetMaxNclkLevel             ((uint16_t) 0x40)
-#define PPSMC_MSG_GetMaxPstate                ((uint16_t) 0x41)
-#define PPSMC_MSG_DramAddrHiVirtual           ((uint16_t) 0x42)
-#define PPSMC_MSG_DramAddrLoVirtual           ((uint16_t) 0x43)
-#define PPSMC_MSG_DramAddrHiPhysical          ((uint16_t) 0x44)
-#define PPSMC_MSG_DramAddrLoPhysical          ((uint16_t) 0x45)
-#define PPSMC_MSG_DramBufferSize              ((uint16_t) 0x46)
-#define PPSMC_MSG_SetMmPwrLogDramAddrHi       ((uint16_t) 0x47)
-#define PPSMC_MSG_SetMmPwrLogDramAddrLo       ((uint16_t) 0x48)
-#define PPSMC_MSG_SetClkTableAddrHi           ((uint16_t) 0x49)
-#define PPSMC_MSG_SetClkTableAddrLo           ((uint16_t) 0x4A)
-#define PPSMC_MSG_GetConservativePowerLimit   ((uint16_t) 0x4B)
-
-#define PPSMC_MSG_InitJobs                    ((uint16_t) 0x252)
-#define PPSMC_MSG_ExecuteJob                  ((uint16_t) 0x254)
-
-#define PPSMC_MSG_NBDPM_Enable                ((uint16_t) 0x140)
-#define PPSMC_MSG_NBDPM_Disable               ((uint16_t) 0x141)
-
-#define PPSMC_MSG_DPM_FPS_Mode                ((uint16_t) 0x15d)
-#define PPSMC_MSG_DPM_Activity_Mode           ((uint16_t) 0x15e)
-
-#define PPSMC_MSG_PmStatusLogStart            ((uint16_t) 0x170)
-#define PPSMC_MSG_PmStatusLogSample           ((uint16_t) 0x171)
-
-#define PPSMC_MSG_AllowLowSclkInterrupt       ((uint16_t) 0x184)
-#define PPSMC_MSG_MmPowerMonitorStart         ((uint16_t) 0x18F)
-#define PPSMC_MSG_MmPowerMonitorStop          ((uint16_t) 0x190)
-#define PPSMC_MSG_MmPowerMonitorRestart       ((uint16_t) 0x191)
-
-#define PPSMC_MSG_SetClockGateMask            ((uint16_t) 0x260)
-#define PPSMC_MSG_SetFpsThresholdLo           ((uint16_t) 0x264)
-#define PPSMC_MSG_SetFpsThresholdHi           ((uint16_t) 0x265)
-#define PPSMC_MSG_SetLowSclkIntrThreshold     ((uint16_t) 0x266)
-
-#define PPSMC_MSG_ClkTableXferToDram          ((uint16_t) 0x267)
-#define PPSMC_MSG_ClkTableXferToSmu           ((uint16_t) 0x268)
-#define PPSMC_MSG_GetAverageGraphicsActivity  ((uint16_t) 0x269)
-#define PPSMC_MSG_GetAverageGioActivity       ((uint16_t) 0x26A)
-#define PPSMC_MSG_SetLoggerBufferSize         ((uint16_t) 0x26B)
-#define PPSMC_MSG_SetLoggerAddressHigh        ((uint16_t) 0x26C)
-#define PPSMC_MSG_SetLoggerAddressLow         ((uint16_t) 0x26D)
-#define PPSMC_MSG_SetWatermarkFrequency       ((uint16_t) 0x26E)
-
-/* REMOVE LATER*/
-#define PPSMC_MSG_DPM_ForceState              ((uint16_t) 0x104)
-
-/* Feature Enable Masks*/
-#define NB_DPM_MASK             0x00000800
-#define VDDGFX_MASK             0x00800000
-#define VCE_DPM_MASK            0x00400000
-#define ACP_DPM_MASK            0x00040000
-#define UVD_DPM_MASK            0x00010000
-#define GFX_CU_PG_MASK          0x00004000
-#define SCLK_DPM_MASK           0x00080000
-
-#if !defined(SMC_MICROCODE)
-#pragma pack(pop)
-
-#endif
-
-#endif
drivers/gpu/drm/amd/amdgpu/smu8.h deleted +0 -72

72 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/smu8_fusion.h deleted +0 -127

127 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/smu_ucode_xfer_cz.h deleted +0 -147

147 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/cz_ppsmc.h new file +185 -0

185 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smu8.h new file +72 -0

72 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smu8_fusion.h new file +127 -0

127 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h new file +147 -0

147 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/Makefile +1 -1
index 61bfb2a..9219940 100644
@@ -2,7 +2,7 @@
 # Makefile for the 'smu manager' sub-component of powerplay.
 # It provides the smu management services for the driver.
 
-SMU_MGR = smumgr.o
+SMU_MGR = smumgr.o cz_smumgr.o
 
 AMD_PP_SMUMGR = $(addprefix $(AMD_PP_PATH)/smumgr/,$(SMU_MGR))
 
drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c new file +858 -0

858 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.h new file +102 -0

102 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +2 -1
index 1a11714..9ff5d33 100644
@@ -27,6 +27,7 @@
 #include "smumgr.h"
 #include "cgs_common.h"
 #include "linux/delay.h"
+#include "cz_smumgr.h"
 
 int smum_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 {
@@ -49,7 +50,7 @@ int smum_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 
 	switch (smumgr->chip_family) {
 	case AMD_FAMILY_CZ:
-		/* TODO */
+		cz_smum_init(smumgr);
 		break;
 	case AMD_FAMILY_VI:
 		/* TODO */
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

PATCH 13/51 drm/amd/powerplay: add Carrizo dpm support

In reply to Alex Deucher

From: Jammy Zhou <[email protected]>

This patch enables basic DPM support for Carrizo.
DPM handles dynamic clock and voltage scaling.

v3: delete peci sub-module
v2: use cgs interface directly
correct define SMU_EnabledFeatureScoreboard_SclkDpmOn

---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile   |   2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 898 +++++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.h | 309 +++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c    |   6 +-
 4 files changed, 1212 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +1 -1
index ef529e0..22d383e 100644
@@ -3,7 +3,7 @@
 # It provides the hardware management services for the driver.
 
 HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
-	       hardwaremanager.o pp_acpi.o
+	       hardwaremanager.o pp_acpi.o cz_hwmgr.o
 
 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
 
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c new file +898 -0

898 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.h new file +309 -0

309 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +4 -2
index f6b1153..e26df90 100644
@@ -27,8 +27,7 @@
 #include "cgs_common.h"
 #include "power_state.h"
 #include "hwmgr.h"
-
-
+#include "cz_hwmgr.h"
 
 int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 {
@@ -51,6 +50,9 @@ int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 	hwmgr->power_source = PP_PowerSource_AC;
 
 	switch (hwmgr->chip_family) {
+	case AMD_FAMILY_CZ:
+		cz_hwmgr_init(hwmgr);
+		break;
 	default:
 		return -EINVAL;
 	}
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#14 lore raw

PATCH 14/51 drm/amd/powerplay: add CG and PG support for carrizo

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

This adds clock and powergating support for CZ.

v2: squash in fixes

---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |   3 +-
 .../drm/amd/powerplay/hwmgr/cz_clockpowergating.c  | 252 ++++++++++
 .../drm/amd/powerplay/hwmgr/cz_clockpowergating.h  |  37 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 521 ++++++++++++++++++++-
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.h     |  12 +-
 .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c  |  89 +++-
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |  10 +
 .../gpu/drm/amd/powerplay/inc/hardwaremanager.h    |  53 ++-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |  46 +-
 drivers/gpu/drm/amd/powerplay/inc/pp_asicblocks.h  |  47 ++
 10 files changed, 1058 insertions(+), 12 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_asicblocks.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +2 -1
index 22d383e..46cc494 100644
@@ -3,7 +3,8 @@
 # It provides the hardware management services for the driver.
 
 HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
-	       hardwaremanager.o pp_acpi.o cz_hwmgr.o
+	       hardwaremanager.o pp_acpi.o cz_hwmgr.o \
+               cz_clockpowergating.o
 
 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
 
drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c new file +252 -0

252 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.h new file +37 -0
new file mode 100644
index 0000000..bbbc057
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef _CZ_CLOCK_POWER_GATING_H_
+#define _CZ_CLOCK_POWER_GATING_H_
+
+#include "cz_hwmgr.h"
+#include "pp_asicblocks.h"
+
+extern int cz_phm_set_asic_block_gating(struct pp_hwmgr *hwmgr, enum PHM_AsicBlock block, enum PHM_ClockGateSetting gating);
+extern struct phm_master_table_header cz_phm_enable_clock_power_gatings_master;
+extern struct phm_master_table_header cz_phm_disable_clock_power_gatings_master;
+extern int cz_dpm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate);
+extern int cz_dpm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate);
+extern int cz_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable);
+extern int cz_enable_disable_uvd_dpm(struct pp_hwmgr *hwmgr, bool enable);
+#endif /* _CZ_CLOCK_POWER_GATING_H_ */
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +520 -1

587 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.h +10 -2
index 05849fd..70b0e51 100644
@@ -32,6 +32,7 @@
 #define CZ_AT_DFLT                     30
 #define CZ_MAX_HARDWARE_POWERLEVELS    8
 #define PPCZ_VOTINGRIGHTSCLIENTS_DFLT0   0x3FFFC102
+#define CZ_MIN_DEEP_SLEEP_SCLK         800
 
 /* Carrizo device IDs */
 #define DEVICE_ID_CZ_9870             0x9870
@@ -198,6 +199,9 @@ struct cz_hwmgr {
 	struct cz_sys_info sys_info;
 
 	struct cz_power_level boot_power_level;
+	struct cz_power_state *cz_current_ps;
+	struct cz_power_state *cz_requested_ps;
+
 	uint32_t mgcg_cgtt_local0;
 	uint32_t mgcg_cgtt_local1;
 
@@ -299,11 +303,15 @@ struct cz_hwmgr {
 
 	uint32_t max_sclk_level;
 	uint32_t num_of_clk_entries;
-	struct cz_power_state *cz_ps;
 };
 
 struct pp_hwmgr;
 
 int cz_hwmgr_init(struct pp_hwmgr *hwmgr);
-
+int cz_dpm_powerdown_uvd(struct pp_hwmgr *hwmgr);
+int cz_dpm_powerup_uvd(struct pp_hwmgr *hwmgr);
+int cz_dpm_powerdown_vce(struct pp_hwmgr *hwmgr);
+int cz_dpm_powerup_vce(struct pp_hwmgr *hwmgr);
+int cz_dpm_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate);
+int  cz_dpm_update_vce_dpm(struct pp_hwmgr *hwmgr);
 #endif /* _CZ_HWMGR_H_ */
drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +87 -2

121 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +10 -0
index e26df90..5d1ba90 100644
@@ -201,3 +201,13 @@ void phm_wait_for_indirect_register_unequal(struct pp_hwmgr *hwmgr,
 	phm_wait_for_register_unequal(hwmgr, indirect_port + 1,
 				      value, mask);
 }
+
+bool phm_cf_want_uvd_power_gating(struct pp_hwmgr *hwmgr)
+{
+	return phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_UVDPowerGating);
+}
+
+bool phm_cf_want_vce_power_gating(struct pp_hwmgr *hwmgr)
+{
+	return phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_VCEPowerGating);
+}
drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h +52 -1

79 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +41 -5

83 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/pp_asicblocks.h new file +47 -0

47 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#15 lore raw

PATCH 15/51 drm/amd/powerplay: add event manager sub-component

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

The event manager handles power related driver events.

---
 drivers/gpu/drm/amd/powerplay/Makefile             |   2 +-
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      |  23 ++
 drivers/gpu/drm/amd/powerplay/eventmgr/Makefile    |  11 +
 .../drm/amd/powerplay/eventmgr/eventactionchains.c | 287 +++++++++++++++
 .../drm/amd/powerplay/eventmgr/eventactionchains.h |  62 ++++
 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c | 180 +++++++++
 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.h |  34 ++
 .../drm/amd/powerplay/eventmgr/eventmanagement.c   | 215 +++++++++++
 .../drm/amd/powerplay/eventmgr/eventmanagement.h   |  59 +++
 drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c  | 114 ++++++
 .../drm/amd/powerplay/eventmgr/eventsubchains.c    | 395 ++++++++++++++++++++
 .../drm/amd/powerplay/eventmgr/eventsubchains.h    |  98 +++++
 .../gpu/drm/amd/powerplay/eventmgr/eventtasks.c    | 408 +++++++++++++++++++++
 .../gpu/drm/amd/powerplay/eventmgr/eventtasks.h    |  85 +++++
 drivers/gpu/drm/amd/powerplay/eventmgr/psm.c       | 111 ++++++
 drivers/gpu/drm/amd/powerplay/eventmgr/psm.h       |  37 ++
 drivers/gpu/drm/amd/powerplay/inc/eventmanager.h   | 109 ++++++
 drivers/gpu/drm/amd/powerplay/inc/eventmgr.h       | 125 +++++++
 drivers/gpu/drm/amd/powerplay/inc/pp_feature.h     |  67 ++++
 drivers/gpu/drm/amd/powerplay/inc/pp_instance.h    |   2 +
 20 files changed, 2423 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/Makefile
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventactionchains.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventactionchains.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventmanagement.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventmanagement.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/psm.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/psm.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/eventmanager.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/eventmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_feature.h
drivers/gpu/drm/amd/powerplay/Makefile +1 -1
index 6359c67..0231021 100644
@@ -6,7 +6,7 @@ subdir-ccflags-y += -Iinclude/drm  \
 
 AMD_PP_PATH = ../powerplay
 
-PP_LIBS = smumgr hwmgr
+PP_LIBS = smumgr hwmgr eventmgr
 
 AMD_POWERPLAY = $(addsuffix /Makefile,$(addprefix drivers/gpu/drm/amd/powerplay/,$(PP_LIBS)))
 
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +23 -0
index 88fdb04..1964a2a 100644
@@ -52,6 +52,7 @@ static int pp_sw_init(void *handle)
 		return -EINVAL;
 
 	ret = hwmgr->pptable_func->pptable_init(hwmgr);
+
 	if (ret == 0)
 		ret = hwmgr->hwmgr_func->backend_init(hwmgr);
 
@@ -81,6 +82,7 @@ static int pp_hw_init(void *handle)
 {
 	struct pp_instance *pp_handle;
 	struct pp_smumgr *smumgr;
+	struct pp_eventmgr *eventmgr;
 	int ret = 0;
 
 	if (handle == NULL)
@@ -106,8 +108,14 @@ static int pp_hw_init(void *handle)
 		smumgr->smumgr_funcs->smu_fini(smumgr);
 		return ret;
 	}
+
 	hw_init_power_state_table(pp_handle->hwmgr);
+	eventmgr = pp_handle->eventmgr;
 
+	if (eventmgr == NULL || eventmgr->pp_eventmgr_init == NULL)
+		return -EINVAL;
+
+	ret = eventmgr->pp_eventmgr_init(eventmgr);
 	return 0;
 }
 
@@ -115,11 +123,17 @@ static int pp_hw_fini(void *handle)
 {
 	struct pp_instance *pp_handle;
 	struct pp_smumgr *smumgr;
+	struct pp_eventmgr *eventmgr;
 
 	if (handle == NULL)
 		return -EINVAL;
 
 	pp_handle = (struct pp_instance *)handle;
+	eventmgr = pp_handle->eventmgr;
+
+	if (eventmgr != NULL || eventmgr->pp_eventmgr_fini != NULL)
+		eventmgr->pp_eventmgr_fini(eventmgr);
+
 	smumgr = pp_handle->smu_mgr;
 
 	if (smumgr != NULL || smumgr->smumgr_funcs != NULL ||
@@ -273,9 +287,15 @@ static int amd_pp_instance_init(struct amd_pp_init *pp_init,
 	if (ret)
 		goto fail_hwmgr;
 
+	ret = eventmgr_init(handle);
+	if (ret)
+		goto fail_eventmgr;
+
 	amd_pp->pp_handle = handle;
 	return 0;
 
+fail_eventmgr:
+	hwmgr_fini(handle->hwmgr);
 fail_hwmgr:
 	smum_fini(handle->smu_mgr);
 fail_smum:
@@ -286,9 +306,12 @@ fail_smum:
 static int amd_pp_instance_fini(void *handle)
 {
 	struct pp_instance *instance = (struct pp_instance *)handle;
+
 	if (instance == NULL)
 		return -EINVAL;
 
+	eventmgr_fini(instance->eventmgr);
+
 	hwmgr_fini(instance->hwmgr);
 
 	smum_fini(instance->smu_mgr);
drivers/gpu/drm/amd/powerplay/eventmgr/Makefile new file +11 -0
new file mode 100644
index 0000000..7509e38
@@ -0,0 +1,11 @@
+#
+# Makefile for the 'event manager' sub-component of powerplay.
+# It provides the event management services for the driver.
+
+EVENT_MGR = eventmgr.o eventinit.o eventmanagement.o  \
+		eventactionchains.o eventsubchains.o eventtasks.o psm.o
+
+AMD_PP_EVENT = $(addprefix $(AMD_PP_PATH)/eventmgr/,$(EVENT_MGR))
+
+AMD_POWERPLAY_FILES += $(AMD_PP_EVENT)
+
drivers/gpu/drm/amd/powerplay/eventmgr/eventactionchains.c new file +287 -0

287 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/eventactionchains.h new file +62 -0

62 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c new file +180 -0

180 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.h new file +34 -0
new file mode 100644
index 0000000..9ef96aa
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef _EVENTINIT_H_
+#define _EVENTINIT_H_
+
+#define PEM_CURRENT_POWERPLAY_FEATURE_VERSION 4
+
+void pem_init_feature_info(struct pp_eventmgr *eventmgr);
+void pem_uninit_featureInfo(struct pp_eventmgr *eventmgr);
+int pem_register_interrupts(struct pp_eventmgr *eventmgr);
+int pem_unregister_interrupts(struct pp_eventmgr *eventmgr);
+
+#endif /* _EVENTINIT_H_ */
drivers/gpu/drm/amd/powerplay/eventmgr/eventmanagement.c new file +215 -0

215 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/eventmanagement.h new file +59 -0

59 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c new file +114 -0

114 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c new file +395 -0

395 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.h new file +98 -0

98 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c new file +408 -0

408 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h new file +85 -0

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/psm.c new file +111 -0

111 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/eventmgr/psm.h new file +37 -0
new file mode 100644
index 0000000..15abfac
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#include "eventmgr.h"
+#include "eventinit.h"
+#include "eventmanagement.h"
+#include "eventmanager.h"
+#include "power_state.h"
+
+int psm_get_ui_state(struct pp_eventmgr *eventmgr, enum PP_StateUILabel ui_label, unsigned long *state_id);
+
+int psm_get_state_by_classification(struct pp_eventmgr *eventmgr, enum PP_StateClassificationFlag flag, unsigned long *state_id);
+
+int psm_set_performance_states(struct pp_eventmgr *eventmgr, unsigned long *state_id);
+
+int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip);
+
+int psm_adjust_power_state_static(struct pp_eventmgr *eventmgr, bool skip);
drivers/gpu/drm/amd/powerplay/inc/eventmanager.h new file +109 -0

109 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/eventmgr.h new file +125 -0

125 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/pp_feature.h new file +67 -0

67 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/pp_instance.h +2 -0
index 35dfcd9..7b60b61 100644
@@ -25,10 +25,12 @@
 
 #include "smumgr.h"
 #include "hwmgr.h"
+#include "eventmgr.h"
 
 struct pp_instance {
 	struct pp_smumgr *smu_mgr;
 	struct pp_hwmgr *hwmgr;
+	struct pp_eventmgr *eventmgr;
 };
 
 #endif
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#16 lore raw

PATCH 16/51 drm/amd/powerplay: implement functions of amd_powerplay_func

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

This is the common interface for interacting with the powerplay module.

v2: squash in fixes

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 191 ++++++++++++++++++++++++--
 1 file changed, 183 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +183 -8
index 1964a2a..66ccfc0 100644
@@ -27,6 +27,8 @@
 #include "amd_shared.h"
 #include "amd_powerplay.h"
 #include "pp_instance.h"
+#include "power_state.h"
+#include "eventmanager.h"
 
 static int pp_early_init(void *handle)
 {
@@ -177,11 +179,31 @@ static int pp_set_powergating_state(void *handle,
 
 static int pp_suspend(void *handle)
 {
+	struct pp_instance *pp_handle;
+	struct pp_eventmgr *eventmgr;
+	struct pem_event_data event_data = { {0} };
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	pp_handle = (struct pp_instance *)handle;
+	eventmgr = pp_handle->eventmgr;
+	pem_handle_event(eventmgr, AMD_PP_EVENT_SUSPEND, &event_data);
 	return 0;
 }
 
 static int pp_resume(void *handle)
 {
+	struct pp_instance *pp_handle;
+	struct pp_eventmgr *eventmgr;
+	struct pem_event_data event_data = { {0} };
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	pp_handle = (struct pp_instance *)handle;
+	eventmgr = pp_handle->eventmgr;
+	pem_handle_event(eventmgr, AMD_PP_EVENT_RESUME, &event_data);
 	return 0;
 }
 
@@ -215,45 +237,198 @@ static int pp_dpm_fw_loading_complete(void *handle)
 static int pp_dpm_force_performance_level(void *handle,
 					enum amd_dpm_forced_level level)
 {
+	struct pp_instance *pp_handle;
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	pp_handle = (struct pp_instance *)handle;
+
+	hwmgr = pp_handle->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	    hwmgr->hwmgr_func->force_dpm_level == NULL)
+		return -EINVAL;
+
+	hwmgr->hwmgr_func->force_dpm_level(hwmgr, level);
+
 	return 0;
 }
+
 static enum amd_dpm_forced_level pp_dpm_get_performance_level(
 								void *handle)
 {
-	return 0;
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL)
+		return -EINVAL;
+
+	return (((struct pp_instance *)handle)->hwmgr->dpm_level);
 }
+
 static int pp_dpm_get_sclk(void *handle, bool low)
 {
-	return 0;
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	    hwmgr->hwmgr_func->get_sclk == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->get_sclk(hwmgr, low);
 }
+
 static int pp_dpm_get_mclk(void *handle, bool low)
 {
-	return 0;
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	    hwmgr->hwmgr_func->get_mclk == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->get_mclk(hwmgr, low);
 }
+
 static int pp_dpm_powergate_vce(void *handle, bool gate)
 {
-	return 0;
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	    hwmgr->hwmgr_func->powergate_vce == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->powergate_vce(hwmgr, gate);
 }
+
 static int pp_dpm_powergate_uvd(void *handle, bool gate)
 {
-	return 0;
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	    hwmgr->hwmgr_func->powergate_uvd == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->powergate_uvd(hwmgr, gate);
+}
+
+static enum PP_StateUILabel power_state_convert(enum amd_pm_state_type  state)
+{
+	switch (state) {
+	case POWER_STATE_TYPE_BATTERY:
+		return PP_StateUILabel_Battery;
+	case POWER_STATE_TYPE_BALANCED:
+		return PP_StateUILabel_Balanced;
+	case POWER_STATE_TYPE_PERFORMANCE:
+		return PP_StateUILabel_Performance;
+	default:
+		return PP_StateUILabel_None;
+	}
 }
 
 int pp_dpm_dispatch_tasks(void *handle, enum amd_pp_event event_id, void *input, void *output)
 {
-	return 0;
+	int ret = 0;
+	struct pp_instance *pp_handle;
+	struct pem_event_data data = { {0} };
+
+	pp_handle = (struct pp_instance *)handle;
+
+	if (pp_handle == NULL)
+		return -EINVAL;
+
+	switch (event_id) {
+	case AMD_PP_EVENT_DISPLAY_CONFIG_CHANGE:
+		ret = pem_handle_event(pp_handle->eventmgr, event_id, &data);
+		break;
+	case AMD_PP_EVENT_ENABLE_USER_STATE:
+	{
+		enum amd_pm_state_type  ps;
+
+		if (input == NULL)
+			return -EINVAL;
+		ps = *(unsigned long *)input;
+
+		data.requested_ui_label = power_state_convert(ps);
+		ret = pem_handle_event(pp_handle->eventmgr, event_id, &data);
+	}
+	break;
+	default:
+		break;
+	}
+	return ret;
 }
+
 enum amd_pm_state_type pp_dpm_get_current_power_state(void *handle)
 {
-	return 0;
+	struct pp_hwmgr *hwmgr;
+	struct pp_power_state *state;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->current_ps == NULL)
+		return -EINVAL;
+
+	state = hwmgr->current_ps;
+
+	switch (state->classification.ui_label) {
+	case PP_StateUILabel_Battery:
+		return POWER_STATE_TYPE_BATTERY;
+	case PP_StateUILabel_Balanced:
+		return POWER_STATE_TYPE_BALANCED;
+	case PP_StateUILabel_Performance:
+		return POWER_STATE_TYPE_PERFORMANCE;
+	default:
+		return POWER_STATE_TYPE_DEFAULT;
+	}
 }
+
 static void
 pp_debugfs_print_current_performance_level(void *handle,
 					       struct seq_file *m)
 {
-	return;
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	  hwmgr->hwmgr_func->print_current_perforce_level == NULL)
+		return;
+
+	hwmgr->hwmgr_func->print_current_perforce_level(hwmgr, m);
 }
 
+
 const struct amd_powerplay_funcs pp_dpm_funcs = {
 	.get_temperature = NULL,
 	.load_firmware = pp_dpm_load_fw,
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#17 lore raw

PATCH 17/51 drm/amd/powerplay: Add ixSWRST_COMMAND_1 in bif_5_0_d.h

In reply to Alex Deucher

From: yanyang1 <[email protected]>

Add ixSWRST_COMMAND_1 in bif_5_0_d.h. Required by new powerplay code for tonga and fiji.

---
 drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_d.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_d.h +1 -0
index 92b6ba0..2933297 100644
@@ -596,6 +596,7 @@
 #define mmSWRST_EP_CONTROL_0                                                    0x14ac
 #define mmCPM_CONTROL                                                           0x14b8
 #define mmGSKT_CONTROL                                                          0x14bf
+#define ixSWRST_COMMAND_1                                                       0x1400103
 #define ixLM_CONTROL                                                            0x1400120
 #define ixLM_PCIETXMUX0                                                         0x1400121
 #define ixLM_PCIETXMUX1                                                         0x1400122
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#18 lore raw

PATCH 18/51 drm/amd/powerplay: Move smu7*.h from amdgpu to powerplay.

In reply to Alex Deucher

From: yanyang1 <[email protected]>

Move smu7.h, smu7_discrete.h and smu7_fusion.h from amdgpu to powerplay.

---
 drivers/gpu/drm/amd/amdgpu/smu7.h                 | 170 -------
 drivers/gpu/drm/amd/amdgpu/smu7_discrete.h        | 514 ----------------------
 drivers/gpu/drm/amd/amdgpu/smu7_fusion.h          | 300 -------------
 drivers/gpu/drm/amd/powerplay/inc/smu7.h          | 170 +++++++
 drivers/gpu/drm/amd/powerplay/inc/smu7_discrete.h | 514 ++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/smu7_fusion.h   | 300 +++++++++++++
 6 files changed, 984 insertions(+), 984 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu7.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu7_discrete.h
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu7_fusion.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7_discrete.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7_fusion.h
drivers/gpu/drm/amd/amdgpu/smu7.h deleted +0 -170
deleted file mode 100644
index 75a380a..0000000
@@ -1,170 +0,0 @@
-/*
- * Copyright 2013 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef SMU7_H
-#define SMU7_H
-
-#pragma pack(push, 1)
-
-#define SMU7_CONTEXT_ID_SMC        1
-#define SMU7_CONTEXT_ID_VBIOS      2
-
-
-#define SMU7_CONTEXT_ID_SMC        1
-#define SMU7_CONTEXT_ID_VBIOS      2
-
-#define SMU7_MAX_LEVELS_VDDC            8
-#define SMU7_MAX_LEVELS_VDDCI           4
-#define SMU7_MAX_LEVELS_MVDD            4
-#define SMU7_MAX_LEVELS_VDDNB           8
-
-#define SMU7_MAX_LEVELS_GRAPHICS        SMU__NUM_SCLK_DPM_STATE   // SCLK + SQ DPM + ULV
-#define SMU7_MAX_LEVELS_MEMORY          SMU__NUM_MCLK_DPM_LEVELS   // MCLK Levels DPM
-#define SMU7_MAX_LEVELS_GIO             SMU__NUM_LCLK_DPM_LEVELS  // LCLK Levels
-#define SMU7_MAX_LEVELS_LINK            SMU__NUM_PCIE_DPM_LEVELS  // PCIe speed and number of lanes.
-#define SMU7_MAX_LEVELS_UVD             8   // VCLK/DCLK levels for UVD.
-#define SMU7_MAX_LEVELS_VCE             8   // ECLK levels for VCE.
-#define SMU7_MAX_LEVELS_ACP             8   // ACLK levels for ACP.
-#define SMU7_MAX_LEVELS_SAMU            8   // SAMCLK levels for SAMU.
-#define SMU7_MAX_ENTRIES_SMIO           32  // Number of entries in SMIO table.
-
-#define DPM_NO_LIMIT 0
-#define DPM_NO_UP 1
-#define DPM_GO_DOWN 2
-#define DPM_GO_UP 3
-
-#define SMU7_FIRST_DPM_GRAPHICS_LEVEL    0
-#define SMU7_FIRST_DPM_MEMORY_LEVEL      0
-
-#define GPIO_CLAMP_MODE_VRHOT      1
-#define GPIO_CLAMP_MODE_THERM      2
-#define GPIO_CLAMP_MODE_DC         4
-
-#define SCRATCH_B_TARG_PCIE_INDEX_SHIFT 0
-#define SCRATCH_B_TARG_PCIE_INDEX_MASK  (0x7<<SCRATCH_B_TARG_PCIE_INDEX_SHIFT)
-#define SCRATCH_B_CURR_PCIE_INDEX_SHIFT 3
-#define SCRATCH_B_CURR_PCIE_INDEX_MASK  (0x7<<SCRATCH_B_CURR_PCIE_INDEX_SHIFT)
-#define SCRATCH_B_TARG_UVD_INDEX_SHIFT  6
-#define SCRATCH_B_TARG_UVD_INDEX_MASK   (0x7<<SCRATCH_B_TARG_UVD_INDEX_SHIFT)
-#define SCRATCH_B_CURR_UVD_INDEX_SHIFT  9
-#define SCRATCH_B_CURR_UVD_INDEX_MASK   (0x7<<SCRATCH_B_CURR_UVD_INDEX_SHIFT)
-#define SCRATCH_B_TARG_VCE_INDEX_SHIFT  12
-#define SCRATCH_B_TARG_VCE_INDEX_MASK   (0x7<<SCRATCH_B_TARG_VCE_INDEX_SHIFT)
-#define SCRATCH_B_CURR_VCE_INDEX_SHIFT  15
-#define SCRATCH_B_CURR_VCE_INDEX_MASK   (0x7<<SCRATCH_B_CURR_VCE_INDEX_SHIFT)
-#define SCRATCH_B_TARG_ACP_INDEX_SHIFT  18
-#define SCRATCH_B_TARG_ACP_INDEX_MASK   (0x7<<SCRATCH_B_TARG_ACP_INDEX_SHIFT)
-#define SCRATCH_B_CURR_ACP_INDEX_SHIFT  21
-#define SCRATCH_B_CURR_ACP_INDEX_MASK   (0x7<<SCRATCH_B_CURR_ACP_INDEX_SHIFT)
-#define SCRATCH_B_TARG_SAMU_INDEX_SHIFT 24
-#define SCRATCH_B_TARG_SAMU_INDEX_MASK  (0x7<<SCRATCH_B_TARG_SAMU_INDEX_SHIFT)
-#define SCRATCH_B_CURR_SAMU_INDEX_SHIFT 27
-#define SCRATCH_B_CURR_SAMU_INDEX_MASK  (0x7<<SCRATCH_B_CURR_SAMU_INDEX_SHIFT)
-
-
-struct SMU7_PIDController
-{
-    uint32_t Ki;
-    int32_t LFWindupUL;
-    int32_t LFWindupLL;
-    uint32_t StatePrecision;
-    uint32_t LfPrecision;
-    uint32_t LfOffset;
-    uint32_t MaxState;
-    uint32_t MaxLfFraction;
-    uint32_t StateShift;
-};
-
-typedef struct SMU7_PIDController SMU7_PIDController;
-
-// -------------------------------------------------------------------------------------------------------------------------
-#define SMU7_MAX_PCIE_LINK_SPEEDS 3 /* 0:Gen1 1:Gen2 2:Gen3 */
-
-#define SMU7_SCLK_DPM_CONFIG_MASK                        0x01
-#define SMU7_VOLTAGE_CONTROLLER_CONFIG_MASK              0x02
-#define SMU7_THERMAL_CONTROLLER_CONFIG_MASK              0x04
-#define SMU7_MCLK_DPM_CONFIG_MASK                        0x08
-#define SMU7_UVD_DPM_CONFIG_MASK                         0x10
-#define SMU7_VCE_DPM_CONFIG_MASK                         0x20
-#define SMU7_ACP_DPM_CONFIG_MASK                         0x40
-#define SMU7_SAMU_DPM_CONFIG_MASK                        0x80
-#define SMU7_PCIEGEN_DPM_CONFIG_MASK                    0x100
-
-#define SMU7_ACP_MCLK_HANDSHAKE_DISABLE                  0x00000001
-#define SMU7_ACP_SCLK_HANDSHAKE_DISABLE                  0x00000002
-#define SMU7_UVD_MCLK_HANDSHAKE_DISABLE                  0x00000100
-#define SMU7_UVD_SCLK_HANDSHAKE_DISABLE                  0x00000200
-#define SMU7_VCE_MCLK_HANDSHAKE_DISABLE                  0x00010000
-#define SMU7_VCE_SCLK_HANDSHAKE_DISABLE                  0x00020000
-
-struct SMU7_Firmware_Header
-{
-    uint32_t Digest[5];
-    uint32_t Version;
-    uint32_t HeaderSize;
-    uint32_t Flags;
-    uint32_t EntryPoint;
-    uint32_t CodeSize;
-    uint32_t ImageSize;
-
-    uint32_t Rtos;
-    uint32_t SoftRegisters;
-    uint32_t DpmTable;
-    uint32_t FanTable;
-    uint32_t CacConfigTable;
-    uint32_t CacStatusTable;
-
-    uint32_t mcRegisterTable;
-
-    uint32_t mcArbDramTimingTable;
-
-    uint32_t PmFuseTable;
-    uint32_t Globals;
-    uint32_t Reserved[42];
-    uint32_t Signature;
-};
-
-typedef struct SMU7_Firmware_Header SMU7_Firmware_Header;
-
-#define SMU7_FIRMWARE_HEADER_LOCATION 0x20000
-
-enum  DisplayConfig {
-    PowerDown = 1,
-    DP54x4,
-    DP54x2,
-    DP54x1,
-    DP27x4,
-    DP27x2,
-    DP27x1,
-    HDMI297,
-    HDMI162,
-    LVDS,
-    DP324x4,
-    DP324x2,
-    DP324x1
-};
-
-#pragma pack(pop)
-
-#endif
-
drivers/gpu/drm/amd/amdgpu/smu7_discrete.h deleted +0 -514

514 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/smu7_fusion.h deleted +0 -300

300 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smu7.h new file +170 -0

170 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smu7_discrete.h new file +514 -0

514 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smu7_fusion.h new file +300 -0

300 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#19 lore raw

PATCH 19/51 drm/amd/powerplay: add header file for tonga smu and dpm

In reply to Alex Deucher

From: yanyang1 <[email protected]>

These headers provide the SMU interface used by the driver.

---
 drivers/gpu/drm/amd/amdgpu/tonga_ppsmc.h           | 198 ------
 drivers/gpu/drm/amd/powerplay/inc/smu72.h          | 664 ++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/smu72_discrete.h | 760 +++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/tonga_ppsmc.h    | 420 ++++++++++++
 4 files changed, 1844 insertions(+), 198 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/tonga_ppsmc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu72.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu72_discrete.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/tonga_ppsmc.h
drivers/gpu/drm/amd/amdgpu/tonga_ppsmc.h deleted +0 -198
deleted file mode 100644
index 811781f..0000000
@@ -1,198 +0,0 @@
-/*
- * Copyright 2014 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef TONGA_PP_SMC_H
-#define TONGA_PP_SMC_H
-
-#pragma pack(push, 1)
-
-#define PPSMC_SWSTATE_FLAG_DC                           0x01
-#define PPSMC_SWSTATE_FLAG_UVD                          0x02
-#define PPSMC_SWSTATE_FLAG_VCE                          0x04
-#define PPSMC_SWSTATE_FLAG_PCIE_X1                      0x08
-
-#define PPSMC_THERMAL_PROTECT_TYPE_INTERNAL             0x00
-#define PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL             0x01
-#define PPSMC_THERMAL_PROTECT_TYPE_NONE                 0xff 
-
-#define PPSMC_SYSTEMFLAG_GPIO_DC                        0x01 
-#define PPSMC_SYSTEMFLAG_STEPVDDC                       0x02 
-#define PPSMC_SYSTEMFLAG_GDDR5                          0x04 
-
-#define PPSMC_SYSTEMFLAG_DISABLE_BABYSTEP               0x08 
-
-#define PPSMC_SYSTEMFLAG_REGULATOR_HOT                  0x10 
-#define PPSMC_SYSTEMFLAG_REGULATOR_HOT_ANALOG           0x20 
-#define PPSMC_SYSTEMFLAG_12CHANNEL                      0x40
-
-#define PPSMC_EXTRAFLAGS_AC2DC_ACTION_MASK              0x07
-#define PPSMC_EXTRAFLAGS_AC2DC_DONT_WAIT_FOR_VBLANK     0x08
-
-#define PPSMC_EXTRAFLAGS_AC2DC_ACTION_GOTODPMLOWSTATE   0x00
-#define PPSMC_EXTRAFLAGS_AC2DC_ACTION_GOTOINITIALSTATE  0x01
-
-#define PPSMC_EXTRAFLAGS_AC2DC_GPIO5_POLARITY_HIGH      0x10
-#define PPSMC_EXTRAFLAGS_DRIVER_TO_GPIO17               0x20
-#define PPSMC_EXTRAFLAGS_PCC_TO_GPIO17                  0x40
-
-#define PPSMC_DPM2FLAGS_TDPCLMP                         0x01 
-#define PPSMC_DPM2FLAGS_PWRSHFT                         0x02 
-#define PPSMC_DPM2FLAGS_OCP                             0x04 
-
-#define PPSMC_DISPLAY_WATERMARK_LOW                     0
-#define PPSMC_DISPLAY_WATERMARK_HIGH                    1
-
-#define PPSMC_STATEFLAG_AUTO_PULSE_SKIP    		0x01
-#define PPSMC_STATEFLAG_POWERBOOST         		0x02
-#define PPSMC_STATEFLAG_PSKIP_ON_TDP_FAULT 		0x04
-#define PPSMC_STATEFLAG_POWERSHIFT         		0x08
-#define PPSMC_STATEFLAG_SLOW_READ_MARGIN   		0x10
-#define PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE 		0x20
-#define PPSMC_STATEFLAG_DEEPSLEEP_BYPASS   		0x40
-
-#define FDO_MODE_HARDWARE 0
-#define FDO_MODE_PIECE_WISE_LINEAR 1
-
-enum FAN_CONTROL {
-	FAN_CONTROL_FUZZY,
-	FAN_CONTROL_TABLE
-};
-
-#define PPSMC_Result_OK             			((uint16_t)0x01)
-#define PPSMC_Result_NoMore         			((uint16_t)0x02)
-#define PPSMC_Result_NotNow         			((uint16_t)0x03)
-#define PPSMC_Result_Failed         			((uint16_t)0xFF) 
-#define PPSMC_Result_UnknownCmd     			((uint16_t)0xFE) 
-#define PPSMC_Result_UnknownVT      			((uint16_t)0xFD) 
-
-typedef uint16_t PPSMC_Result;
-
-#define PPSMC_isERROR(x) ((uint16_t)0x80 & (x))
-
-#define PPSMC_MSG_Halt                      		((uint16_t)0x10)
-#define PPSMC_MSG_Resume                    		((uint16_t)0x11)
-#define PPSMC_MSG_EnableDPMLevel            		((uint16_t)0x12)
-#define PPSMC_MSG_ZeroLevelsDisabled        		((uint16_t)0x13)
-#define PPSMC_MSG_OneLevelsDisabled         		((uint16_t)0x14)
-#define PPSMC_MSG_TwoLevelsDisabled         		((uint16_t)0x15)
-#define PPSMC_MSG_EnableThermalInterrupt    		((uint16_t)0x16)
-#define PPSMC_MSG_RunningOnAC               		((uint16_t)0x17)
-#define PPSMC_MSG_LevelUp                   		((uint16_t)0x18)
-#define PPSMC_MSG_LevelDown                 		((uint16_t)0x19)
-#define PPSMC_MSG_ResetDPMCounters          		((uint16_t)0x1a)
-#define PPSMC_MSG_SwitchToSwState           		((uint16_t)0x20)
-#define PPSMC_MSG_SwitchToSwStateLast       		((uint16_t)0x3f)
-#define PPSMC_MSG_SwitchToInitialState      		((uint16_t)0x40)
-#define PPSMC_MSG_NoForcedLevel             		((uint16_t)0x41)
-#define PPSMC_MSG_ForceHigh                 		((uint16_t)0x42)
-#define PPSMC_MSG_ForceMediumOrHigh         		((uint16_t)0x43)
-#define PPSMC_MSG_SwitchToMinimumPower      		((uint16_t)0x51)
-#define PPSMC_MSG_ResumeFromMinimumPower    		((uint16_t)0x52)
-#define PPSMC_MSG_EnableCac                 		((uint16_t)0x53)
-#define PPSMC_MSG_DisableCac                		((uint16_t)0x54)
-#define PPSMC_DPMStateHistoryStart          		((uint16_t)0x55)
-#define PPSMC_DPMStateHistoryStop           		((uint16_t)0x56)
-#define PPSMC_CACHistoryStart               		((uint16_t)0x57)
-#define PPSMC_CACHistoryStop                		((uint16_t)0x58)
-#define PPSMC_TDPClampingActive             		((uint16_t)0x59)
-#define PPSMC_TDPClampingInactive           		((uint16_t)0x5A)
-#define PPSMC_StartFanControl               		((uint16_t)0x5B)
-#define PPSMC_StopFanControl                		((uint16_t)0x5C)
-#define PPSMC_NoDisplay                     		((uint16_t)0x5D)
-#define PPSMC_HasDisplay                    		((uint16_t)0x5E)
-#define PPSMC_MSG_UVDPowerOFF               		((uint16_t)0x60)
-#define PPSMC_MSG_UVDPowerON                		((uint16_t)0x61)
-#define PPSMC_MSG_EnableULV                 		((uint16_t)0x62)
-#define PPSMC_MSG_DisableULV                		((uint16_t)0x63)
-#define PPSMC_MSG_EnterULV                  		((uint16_t)0x64)
-#define PPSMC_MSG_ExitULV                   		((uint16_t)0x65)
-#define PPSMC_PowerShiftActive              		((uint16_t)0x6A)
-#define PPSMC_PowerShiftInactive            		((uint16_t)0x6B)
-#define PPSMC_OCPActive                     		((uint16_t)0x6C)
-#define PPSMC_OCPInactive                   		((uint16_t)0x6D)
-#define PPSMC_CACLongTermAvgEnable          		((uint16_t)0x6E)
-#define PPSMC_CACLongTermAvgDisable         		((uint16_t)0x6F)
-#define PPSMC_MSG_InferredStateSweep_Start  		((uint16_t)0x70)
-#define PPSMC_MSG_InferredStateSweep_Stop   		((uint16_t)0x71)
-#define PPSMC_MSG_SwitchToLowestInfState    		((uint16_t)0x72)
-#define PPSMC_MSG_SwitchToNonInfState       		((uint16_t)0x73)
-#define PPSMC_MSG_AllStateSweep_Start       		((uint16_t)0x74)
-#define PPSMC_MSG_AllStateSweep_Stop        		((uint16_t)0x75)
-#define PPSMC_MSG_SwitchNextLowerInfState   		((uint16_t)0x76)
-#define PPSMC_MSG_SwitchNextHigherInfState  		((uint16_t)0x77)
-#define PPSMC_MSG_MclkRetrainingTest        		((uint16_t)0x78)
-#define PPSMC_MSG_ForceTDPClamping          		((uint16_t)0x79)
-#define PPSMC_MSG_CollectCAC_PowerCorreln   		((uint16_t)0x7A)
-#define PPSMC_MSG_CollectCAC_WeightCalib    		((uint16_t)0x7B)
-#define PPSMC_MSG_CollectCAC_SQonly         		((uint16_t)0x7C)
-#define PPSMC_MSG_CollectCAC_TemperaturePwr 		((uint16_t)0x7D)
-#define PPSMC_MSG_ExtremitiesTest_Start     		((uint16_t)0x7E)
-#define PPSMC_MSG_ExtremitiesTest_Stop      		((uint16_t)0x7F)
-#define PPSMC_FlushDataCache                		((uint16_t)0x80)
-#define PPSMC_FlushInstrCache               		((uint16_t)0x81)
-#define PPSMC_MSG_SetEnabledLevels          		((uint16_t)0x82)
-#define PPSMC_MSG_SetForcedLevels           		((uint16_t)0x83)
-#define PPSMC_MSG_ResetToDefaults           		((uint16_t)0x84)
-#define PPSMC_MSG_SetForcedLevelsAndJump    		((uint16_t)0x85)
-#define PPSMC_MSG_SetCACHistoryMode         		((uint16_t)0x86)
-#define PPSMC_MSG_EnableDTE                 		((uint16_t)0x87)
-#define PPSMC_MSG_DisableDTE                		((uint16_t)0x88)
-#define PPSMC_MSG_SmcSpaceSetAddress        		((uint16_t)0x89)
-#define PPSMC_MSG_SmcSpaceWriteDWordInc     		((uint16_t)0x8A)
-#define PPSMC_MSG_SmcSpaceWriteWordInc      		((uint16_t)0x8B)
-#define PPSMC_MSG_SmcSpaceWriteByteInc      		((uint16_t)0x8C)
-#define PPSMC_MSG_ChangeNearTDPLimit        		((uint16_t)0x90)
-#define PPSMC_MSG_ChangeSafePowerLimit      		((uint16_t)0x91)
-#define PPSMC_MSG_DPMStateSweepStart        		((uint16_t)0x92)
-#define PPSMC_MSG_DPMStateSweepStop         		((uint16_t)0x93)
-#define PPSMC_MSG_OVRDDisableSCLKDS         		((uint16_t)0x94)
-#define PPSMC_MSG_CancelDisableOVRDSCLKDS   		((uint16_t)0x95)
-#define PPSMC_MSG_ThrottleOVRDSCLKDS        		((uint16_t)0x96)
-#define PPSMC_MSG_CancelThrottleOVRDSCLKDS  		((uint16_t)0x97)
-#define PPSMC_MSG_GPIO17                    		((uint16_t)0x98)
-#define PPSMC_MSG_API_SetSvi2Volt_Vddc      		((uint16_t)0x99)
-#define PPSMC_MSG_API_SetSvi2Volt_Vddci     		((uint16_t)0x9A)
-#define PPSMC_MSG_API_SetSvi2Volt_Mvdd      		((uint16_t)0x9B)
-#define PPSMC_MSG_API_GetSvi2Volt_Vddc      		((uint16_t)0x9C)
-#define PPSMC_MSG_API_GetSvi2Volt_Vddci     		((uint16_t)0x9D)
-#define PPSMC_MSG_API_GetSvi2Volt_Mvdd      		((uint16_t)0x9E)
-
-#define PPSMC_MSG_BREAK                     		((uint16_t)0xF8)
-
-#define PPSMC_MSG_Test                      		((uint16_t)0x100)
-#define PPSMC_MSG_DRV_DRAM_ADDR_HI            		((uint16_t)0x250)
-#define PPSMC_MSG_DRV_DRAM_ADDR_LO            		((uint16_t)0x251)
-#define PPSMC_MSG_SMU_DRAM_ADDR_HI            		((uint16_t)0x252)
-#define PPSMC_MSG_SMU_DRAM_ADDR_LO            		((uint16_t)0x253)
-#define PPSMC_MSG_LoadUcodes                  		((uint16_t)0x254)
-
-typedef uint16_t PPSMC_Msg;
-
-#define PPSMC_EVENT_STATUS_THERMAL          		0x00000001
-#define PPSMC_EVENT_STATUS_REGULATORHOT     		0x00000002
-#define PPSMC_EVENT_STATUS_DC               		0x00000004
-#define PPSMC_EVENT_STATUS_GPIO17           		0x00000008
-
-#pragma pack(pop)
-
-#endif
drivers/gpu/drm/amd/powerplay/inc/smu72.h new file +664 -0

664 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smu72_discrete.h new file +760 -0

760 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/tonga_ppsmc.h new file +420 -0

420 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#20 lore raw

PATCH 20/51 drm/amd/powerplay: Add Tonga SMU support

In reply to Alex Deucher

From: Jammy Zhou <[email protected]>

The SMU manager handles firmware loading for other IP blocks (GFX, SDMA, etc.). This implements it for Tonga.

v3: delete peci sub-module
v2: use cgs interface directly

---
 drivers/gpu/drm/amd/powerplay/inc/pp_debug.h       |  40 +
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |   2 +-
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c      |   9 +-
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    | 819 +++++++++++++++++++++
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h    |  53 ++
 5 files changed, 921 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_debug.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h
drivers/gpu/drm/amd/powerplay/inc/pp_debug.h new file +40 -0
new file mode 100644
index 0000000..65ef547
@@ -0,0 +1,40 @@
+
+/*
+ * Copyright 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#ifndef PP_DEBUG_H
+#define PP_DEBUG_H
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+
+#define PP_ASSERT_WITH_CODE(cond, msg, code)	\
+	do {					\
+		if (!(cond)) {			\
+			printk(msg);	\
+			code;			\
+		}				\
+	} while (0)
+
+#endif
+
drivers/gpu/drm/amd/powerplay/smumgr/Makefile +1 -1
index 9219940..0e3348d 100644
@@ -2,7 +2,7 @@
 # Makefile for the 'smu manager' sub-component of powerplay.
 # It provides the smu management services for the driver.
 
-SMU_MGR = smumgr.o cz_smumgr.o
+SMU_MGR = smumgr.o cz_smumgr.o tonga_smumgr.o
 
 AMD_PP_SMUMGR = $(addprefix $(AMD_PP_PATH)/smumgr/,$(SMU_MGR))
 
drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +8 -1
index 9ff5d33..a386ca8 100644
@@ -28,6 +28,7 @@
 #include "cgs_common.h"
 #include "linux/delay.h"
 #include "cz_smumgr.h"
+#include "tonga_smumgr.h"
 
 int smum_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 {
@@ -53,7 +54,13 @@ int smum_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 		cz_smum_init(smumgr);
 		break;
 	case AMD_FAMILY_VI:
-		/* TODO */
+		switch (smumgr->chip_id) {
+		case CHIP_TONGA:
+			tonga_smum_init(smumgr);
+			break;
+		default:
+			return -EINVAL;
+		}
 		break;
 	default:
 		kfree(smumgr);
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c new file +819 -0

819 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h new file +53 -0

53 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#21 lore raw

PATCH 21/51 drm/amd/powerplay: add Tonga dpm support (v3)

In reply to Alex Deucher

From: yanyang1 <[email protected]>

This implements DPM for tonga. DPM handles dynamic clock and voltage scaling.

v2: merge all the patches related with tonga dpm
v3: merge dpm force level fix, cgs display fix, spelling fix

---
 drivers/gpu/drm/amd/powerplay/Makefile             |    5 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |    4 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |   10 +
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h    |  105 +
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   |  704 +++
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h   |  237 +
 drivers/gpu/drm/amd/powerplay/hwmgr/ppinterrupt.h  |   42 +
 drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.c  |   64 +
 drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.h  |   31 +
 .../drm/amd/powerplay/hwmgr/tonga_dyn_defaults.h   |  107 +
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c  | 5714 ++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h  |  427 ++
 .../gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h  |   66 +
 .../gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h    |  406 ++
 .../amd/powerplay/hwmgr/tonga_processpptables.c    | 1129 ++++
 .../amd/powerplay/hwmgr/tonga_processpptables.h    |   35 +
 .../gpu/drm/amd/powerplay/inc/hardwaremanager.h    |   18 +-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |   90 +
 drivers/gpu/drm/amd/powerplay/inc/pp_debug.h       |    2 +-
 .../gpu/drm/amd/powerplay/inc/smu_ucode_xfer_vi.h  |  100 +
 20 files changed, 9284 insertions(+), 12 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppinterrupt.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_dyn_defaults.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_vi.h
drivers/gpu/drm/amd/powerplay/Makefile +4 -1
index 0231021..e195bf5 100644
@@ -2,7 +2,10 @@
 subdir-ccflags-y += -Iinclude/drm  \
 		-Idrivers/gpu/drm/amd/powerplay/inc/  \
 		-Idrivers/gpu/drm/amd/include/asic_reg  \
-		-Idrivers/gpu/drm/amd/include
+		-Idrivers/gpu/drm/amd/include  \
+		-Idrivers/gpu/drm/amd/powerplay/smumgr\
+		-Idrivers/gpu/drm/amd/powerplay/hwmgr \
+		-Idrivers/gpu/drm/amd/powerplay/eventmgr
 
 AMD_PP_PATH = ../powerplay
 
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +3 -1
index 46cc494..fd73d3c 100644
@@ -4,7 +4,9 @@
 
 HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
 	       hardwaremanager.o pp_acpi.o cz_hwmgr.o \
-               cz_clockpowergating.o
+               cz_clockpowergating.o \
+	       tonga_processpptables.o ppatomctrl.o \
+               tonga_hwmgr.o 	pppcielanes.o
 
 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
 
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +10 -0
index 5d1ba90..407b2e3 100644
@@ -28,6 +28,7 @@
 #include "power_state.h"
 #include "hwmgr.h"
 #include "cz_hwmgr.h"
+#include "tonga_hwmgr.h"
 
 int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 {
@@ -53,6 +54,15 @@ int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 	case AMD_FAMILY_CZ:
 		cz_hwmgr_init(hwmgr);
 		break;
+	case AMD_FAMILY_VI:
+		switch (hwmgr->chip_id) {
+		case CHIP_TONGA:
+			tonga_hwmgr_init(hwmgr);
+			break;
+		default:
+			return -EINVAL;
+		}
+		break;
 	default:
 		return -EINVAL;
 	}
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h new file +105 -0

105 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c new file +704 -0

704 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h new file +237 -0

237 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/ppinterrupt.h new file +42 -0

42 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.c new file +64 -0

64 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.h new file +31 -0
new file mode 100644
index 0000000..70b163b
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef PP_PCIELANES_H
+#define PP_PCIELANES_H
+
+extern uint8_t encode_pcie_lane_width(uint32_t num_lanes);
+extern uint8_t decode_pcie_lane_width(uint32_t num_lanes);
+
+#endif
+
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_dyn_defaults.h new file +107 -0

107 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c new file +5714 -0

1,667 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h new file +427 -0

427 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h new file +66 -0

66 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h new file +406 -0

406 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c new file +1129 -0

1,129 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.h new file +35 -0
new file mode 100644
index 0000000..d24b888

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h +9 -9
index a69b379..9795b9a 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +90 -0

90 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/pp_debug.h +1 -1
index 65ef547..3df3ded 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_vi.h new file +100 -0

100 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Part of the diff is not shown here. View the raw message.

#22 lore raw

PATCH 22/51 drm/amd/powerplay: add/update headers for Fiji SMU and DPM

In reply to Alex Deucher

From: Eric Huang <[email protected]>

New headers for Fiji.

---
 drivers/gpu/drm/amd/amdgpu/fiji_ppsmc.h            |   182 -
 drivers/gpu/drm/amd/include/atombios.h             |    79 +
 drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h    |   617 ++
 drivers/gpu/drm/amd/powerplay/inc/fiji_ppsmc.h     |   412 +
 drivers/gpu/drm/amd/powerplay/inc/fiji_pwrvirus.h  | 10299 +++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/smu73.h          |   720 ++
 drivers/gpu/drm/amd/powerplay/inc/smu73_discrete.h |   799 ++
 7 files changed, 12926 insertions(+), 182 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/fiji_ppsmc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/fiji_ppsmc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/fiji_pwrvirus.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu73.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu73_discrete.h
drivers/gpu/drm/amd/amdgpu/fiji_ppsmc.h deleted +0 -182
deleted file mode 100644
index 3c48240..0000000
@@ -1,182 +0,0 @@
-/*
- * Copyright 2014 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef FIJI_PP_SMC_H
-#define FIJI_PP_SMC_H
-
-#pragma pack(push, 1)
-
-#define PPSMC_SWSTATE_FLAG_DC                           0x01
-#define PPSMC_SWSTATE_FLAG_UVD                          0x02
-#define PPSMC_SWSTATE_FLAG_VCE                          0x04
-
-#define PPSMC_THERMAL_PROTECT_TYPE_INTERNAL             0x00
-#define PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL             0x01
-#define PPSMC_THERMAL_PROTECT_TYPE_NONE                 0xff
-
-#define PPSMC_SYSTEMFLAG_GPIO_DC                        0x01
-#define PPSMC_SYSTEMFLAG_STEPVDDC                       0x02
-#define PPSMC_SYSTEMFLAG_GDDR5                          0x04
-
-#define PPSMC_SYSTEMFLAG_DISABLE_BABYSTEP               0x08
-
-#define PPSMC_SYSTEMFLAG_REGULATOR_HOT                  0x10
-#define PPSMC_SYSTEMFLAG_REGULATOR_HOT_ANALOG           0x20
-
-#define PPSMC_EXTRAFLAGS_AC2DC_ACTION_MASK              0x07
-#define PPSMC_EXTRAFLAGS_AC2DC_DONT_WAIT_FOR_VBLANK     0x08
-
-#define PPSMC_EXTRAFLAGS_AC2DC_ACTION_GOTODPMLOWSTATE   0x00
-#define PPSMC_EXTRAFLAGS_AC2DC_ACTION_GOTOINITIALSTATE  0x01
-
-#define PPSMC_DPM2FLAGS_TDPCLMP                         0x01
-#define PPSMC_DPM2FLAGS_PWRSHFT                         0x02
-#define PPSMC_DPM2FLAGS_OCP                             0x04
-
-#define PPSMC_DISPLAY_WATERMARK_LOW                     0
-#define PPSMC_DISPLAY_WATERMARK_HIGH                    1
-
-#define PPSMC_STATEFLAG_AUTO_PULSE_SKIP    		0x01
-#define PPSMC_STATEFLAG_POWERBOOST         		0x02
-#define PPSMC_STATEFLAG_PSKIP_ON_TDP_FAULT 		0x04
-#define PPSMC_STATEFLAG_POWERSHIFT         		0x08
-#define PPSMC_STATEFLAG_SLOW_READ_MARGIN   		0x10
-#define PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE 		0x20
-#define PPSMC_STATEFLAG_DEEPSLEEP_BYPASS   		0x40
-
-#define FDO_MODE_HARDWARE 0
-#define FDO_MODE_PIECE_WISE_LINEAR 1
-
-enum FAN_CONTROL {
-	FAN_CONTROL_FUZZY,
-	FAN_CONTROL_TABLE
-};
-
-//Gemini Modes
-#define PPSMC_GeminiModeNone   0  //Single GPU board
-#define PPSMC_GeminiModeMaster 1  //Master GPU on a Gemini board
-#define PPSMC_GeminiModeSlave  2  //Slave GPU on a Gemini board
-
-#define PPSMC_Result_OK             			((uint16_t)0x01)
-#define PPSMC_Result_NoMore         			((uint16_t)0x02)
-#define PPSMC_Result_NotNow         			((uint16_t)0x03)
-#define PPSMC_Result_Failed         			((uint16_t)0xFF)
-#define PPSMC_Result_UnknownCmd     			((uint16_t)0xFE)
-#define PPSMC_Result_UnknownVT      			((uint16_t)0xFD)
-
-typedef uint16_t PPSMC_Result;
-
-#define PPSMC_isERROR(x) ((uint16_t)0x80 & (x))
-
-#define PPSMC_MSG_Halt                      		((uint16_t)0x10)
-#define PPSMC_MSG_Resume                    		((uint16_t)0x11)
-#define PPSMC_MSG_EnableDPMLevel            		((uint16_t)0x12)
-#define PPSMC_MSG_ZeroLevelsDisabled        		((uint16_t)0x13)
-#define PPSMC_MSG_OneLevelsDisabled         		((uint16_t)0x14)
-#define PPSMC_MSG_TwoLevelsDisabled         		((uint16_t)0x15)
-#define PPSMC_MSG_EnableThermalInterrupt    		((uint16_t)0x16)
-#define PPSMC_MSG_RunningOnAC               		((uint16_t)0x17)
-#define PPSMC_MSG_LevelUp                   		((uint16_t)0x18)
-#define PPSMC_MSG_LevelDown                 		((uint16_t)0x19)
-#define PPSMC_MSG_ResetDPMCounters          		((uint16_t)0x1a)
-#define PPSMC_MSG_SwitchToSwState           		((uint16_t)0x20)
-#define PPSMC_MSG_SwitchToSwStateLast       		((uint16_t)0x3f)
-#define PPSMC_MSG_SwitchToInitialState      		((uint16_t)0x40)
-#define PPSMC_MSG_NoForcedLevel             		((uint16_t)0x41)
-#define PPSMC_MSG_ForceHigh                 		((uint16_t)0x42)
-#define PPSMC_MSG_ForceMediumOrHigh         		((uint16_t)0x43)
-#define PPSMC_MSG_SwitchToMinimumPower      		((uint16_t)0x51)
-#define PPSMC_MSG_ResumeFromMinimumPower    		((uint16_t)0x52)
-#define PPSMC_MSG_EnableCac                 		((uint16_t)0x53)
-#define PPSMC_MSG_DisableCac                		((uint16_t)0x54)
-#define PPSMC_DPMStateHistoryStart          		((uint16_t)0x55)
-#define PPSMC_DPMStateHistoryStop           		((uint16_t)0x56)
-#define PPSMC_CACHistoryStart               		((uint16_t)0x57)
-#define PPSMC_CACHistoryStop                		((uint16_t)0x58)
-#define PPSMC_TDPClampingActive             		((uint16_t)0x59)
-#define PPSMC_TDPClampingInactive           		((uint16_t)0x5A)
-#define PPSMC_StartFanControl               		((uint16_t)0x5B)
-#define PPSMC_StopFanControl                		((uint16_t)0x5C)
-#define PPSMC_NoDisplay                     		((uint16_t)0x5D)
-#define PPSMC_HasDisplay                    		((uint16_t)0x5E)
-#define PPSMC_MSG_UVDPowerOFF               		((uint16_t)0x60)
-#define PPSMC_MSG_UVDPowerON                		((uint16_t)0x61)
-#define PPSMC_MSG_EnableULV                 		((uint16_t)0x62)
-#define PPSMC_MSG_DisableULV                		((uint16_t)0x63)
-#define PPSMC_MSG_EnterULV                  		((uint16_t)0x64)
-#define PPSMC_MSG_ExitULV                   		((uint16_t)0x65)
-#define PPSMC_PowerShiftActive              		((uint16_t)0x6A)
-#define PPSMC_PowerShiftInactive            		((uint16_t)0x6B)
-#define PPSMC_OCPActive                     		((uint16_t)0x6C)
-#define PPSMC_OCPInactive                   		((uint16_t)0x6D)
-#define PPSMC_CACLongTermAvgEnable          		((uint16_t)0x6E)
-#define PPSMC_CACLongTermAvgDisable         		((uint16_t)0x6F)
-#define PPSMC_MSG_InferredStateSweep_Start  		((uint16_t)0x70)
-#define PPSMC_MSG_InferredStateSweep_Stop   		((uint16_t)0x71)
-#define PPSMC_MSG_SwitchToLowestInfState    		((uint16_t)0x72)
-#define PPSMC_MSG_SwitchToNonInfState       		((uint16_t)0x73)
-#define PPSMC_MSG_AllStateSweep_Start       		((uint16_t)0x74)
-#define PPSMC_MSG_AllStateSweep_Stop        		((uint16_t)0x75)
-#define PPSMC_MSG_SwitchNextLowerInfState   		((uint16_t)0x76)
-#define PPSMC_MSG_SwitchNextHigherInfState  		((uint16_t)0x77)
-#define PPSMC_MSG_MclkRetrainingTest        		((uint16_t)0x78)
-#define PPSMC_MSG_ForceTDPClamping          		((uint16_t)0x79)
-#define PPSMC_MSG_CollectCAC_PowerCorreln   		((uint16_t)0x7A)
-#define PPSMC_MSG_CollectCAC_WeightCalib    		((uint16_t)0x7B)
-#define PPSMC_MSG_CollectCAC_SQonly         		((uint16_t)0x7C)
-#define PPSMC_MSG_CollectCAC_TemperaturePwr 		((uint16_t)0x7D)
-#define PPSMC_MSG_ExtremitiesTest_Start     		((uint16_t)0x7E)
-#define PPSMC_MSG_ExtremitiesTest_Stop      		((uint16_t)0x7F)
-#define PPSMC_FlushDataCache                		((uint16_t)0x80)
-#define PPSMC_FlushInstrCache               		((uint16_t)0x81)
-#define PPSMC_MSG_SetEnabledLevels          		((uint16_t)0x82)
-#define PPSMC_MSG_SetForcedLevels           		((uint16_t)0x83)
-#define PPSMC_MSG_ResetToDefaults           		((uint16_t)0x84)
-#define PPSMC_MSG_SetForcedLevelsAndJump    		((uint16_t)0x85)
-#define PPSMC_MSG_SetCACHistoryMode         		((uint16_t)0x86)
-#define PPSMC_MSG_EnableDTE                 		((uint16_t)0x87)
-#define PPSMC_MSG_DisableDTE                		((uint16_t)0x88)
-#define PPSMC_MSG_SmcSpaceSetAddress        		((uint16_t)0x89)
-#define PPSMC_MSG_SmcSpaceWriteDWordInc     		((uint16_t)0x8A)
-#define PPSMC_MSG_SmcSpaceWriteWordInc      		((uint16_t)0x8B)
-#define PPSMC_MSG_SmcSpaceWriteByteInc      		((uint16_t)0x8C)
-
-#define PPSMC_MSG_BREAK                     		((uint16_t)0xF8)
-
-#define PPSMC_MSG_Test                      		((uint16_t)0x100)
-#define PPSMC_MSG_DRV_DRAM_ADDR_HI            		((uint16_t)0x250)
-#define PPSMC_MSG_DRV_DRAM_ADDR_LO            		((uint16_t)0x251)
-#define PPSMC_MSG_SMU_DRAM_ADDR_HI            		((uint16_t)0x252)
-#define PPSMC_MSG_SMU_DRAM_ADDR_LO            		((uint16_t)0x253)
-#define PPSMC_MSG_LoadUcodes                  		((uint16_t)0x254)
-
-typedef uint16_t PPSMC_Msg;
-
-#define PPSMC_EVENT_STATUS_THERMAL          		0x00000001
-#define PPSMC_EVENT_STATUS_REGULATORHOT     		0x00000002
-#define PPSMC_EVENT_STATUS_DC               		0x00000004
-#define PPSMC_EVENT_STATUS_GPIO17           		0x00000008
-
-#pragma pack(pop)
-
-#endif
drivers/gpu/drm/amd/include/atombios.h +79 -0

91 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h new file +617 -0

617 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/fiji_ppsmc.h new file +412 -0

412 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/fiji_pwrvirus.h new file +10299 -0

1,698 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smu73.h new file +720 -0

720 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smu73_discrete.h new file +799 -0

799 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Part of the diff is not shown here. View the raw message.

#23 lore raw

PATCH 23/51 drm/amd/powerplay: update atomctrl for fiji

In reply to Alex Deucher

From: Eric Huang <[email protected]>

Add some new functions to support Fiji. Split out from the previous patch.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c  | 489 +++++++++++++++++++++-
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h  |   6 +
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c |  10 +-
 3 files changed, 496 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c +485 -4
index 9af2f59..8b47ea0 100644
@@ -28,6 +28,8 @@
 #include "atombios.h"
 #include "cgs_common.h"
 #include "pp_debug.h"
+#include "ppevvmath.h"
+
 #define MEM_ID_MASK           0xff000000
 #define MEM_ID_SHIFT          24
 #define CLOCK_RANGE_MASK      0x00ffffff
@@ -94,7 +96,7 @@ static int atomctrl_retrieve_ac_timing(
  * VBIOS set end of memory clock AC timing registers by ucPreRegDataLength bit6 = 1
  * @param    reg_block the address ATOM_INIT_REG_BLOCK
  * @param    table the address of MCRegTable
- * @return   PP_Result_OK
+ * @return   0
  */
 static int atomctrl_set_mc_reg_address_table(
 		ATOM_INIT_REG_BLOCK *reg_block,
@@ -286,6 +288,31 @@ int atomctrl_get_memory_pll_dividers_si(
 	return result;
 }
 
+/** atomctrl_get_memory_pll_dividers_vi().
+ *
+ * @param hwmgr                 input parameter: pointer to HwMgr
+ * @param clock_value             input parameter: memory clock
+ * @param dividers               output parameter: memory PLL dividers
+ */
+int atomctrl_get_memory_pll_dividers_vi(struct pp_hwmgr *hwmgr,
+		uint32_t clock_value, pp_atomctrl_memory_clock_param *mpll_param)
+{
+	COMPUTE_MEMORY_CLOCK_PARAM_PARAMETERS_V2_2 mpll_parameters;
+	int result;
+
+	mpll_parameters.ulClock.ulClock = (uint32_t)clock_value;
+
+	result = cgs_atom_exec_cmd_table(hwmgr->device,
+			GetIndexIntoMasterTable(COMMAND, ComputeMemoryClockParam),
+			&mpll_parameters);
+
+	if (!result)
+		mpll_param->mpll_post_divider =
+				(uint32_t)mpll_parameters.ulClock.ucPostDiv;
+
+	return result;
+}
+
 int atomctrl_get_engine_pll_dividers_vi(
 		struct pp_hwmgr *hwmgr,
 		uint32_t clock_value,
@@ -387,7 +414,7 @@ uint32_t atomctrl_get_reference_clock(struct pp_hwmgr *hwmgr)
 }
 
 /**
- * Returns 0 if the given voltage type is controlled by GPIO pins.
+ * Returns true if the given voltage type is controlled by GPIO pins.
  * voltage_type is one of SET_VOLTAGE_TYPE_ASIC_VDDC,
  * SET_VOLTAGE_TYPE_ASIC_MVDDC, SET_VOLTAGE_TYPE_ASIC_MVDDQ.
  * voltage_mode is one of ATOM_SET_VOLTAGE, ATOM_SET_VOLTAGE_PHASE
@@ -402,10 +429,10 @@ bool atomctrl_is_voltage_controled_by_gpio_v3(
 	bool ret;
 
 	PP_ASSERT_WITH_CODE((NULL != voltage_info),
-			"Could not find Voltage Table in BIOS.", return -1;);
+			"Could not find Voltage Table in BIOS.", return false;);
 
 	ret = (NULL != atomctrl_lookup_voltage_type_v3
-			(voltage_info, voltage_type, voltage_mode)) ? 0 : 1;
+			(voltage_info, voltage_type, voltage_mode)) ? true : false;
 
 	return ret;
 }
@@ -525,6 +552,441 @@ bool atomctrl_get_pp_assign_pin(
 	return bRet;
 }
 
+int atomctrl_calculate_voltage_evv_on_sclk(
+		struct pp_hwmgr *hwmgr,
+		uint8_t voltage_type,
+		uint32_t sclk,
+		uint16_t virtual_voltage_Id,
+		uint16_t *voltage,
+		uint16_t dpm_level,
+		bool debug)
+{
+	ATOM_ASIC_PROFILING_INFO_V3_4 *getASICProfilingInfo;
+
+	EFUSE_LINEAR_FUNC_PARAM sRO_fuse;
+	EFUSE_LINEAR_FUNC_PARAM sCACm_fuse;
+	EFUSE_LINEAR_FUNC_PARAM sCACb_fuse;
+	EFUSE_LOGISTIC_FUNC_PARAM sKt_Beta_fuse;
+	EFUSE_LOGISTIC_FUNC_PARAM sKv_m_fuse;
+	EFUSE_LOGISTIC_FUNC_PARAM sKv_b_fuse;
+	EFUSE_INPUT_PARAMETER sInput_FuseValues;
+	READ_EFUSE_VALUE_PARAMETER sOutput_FuseValues;
+
+	uint32_t ul_RO_fused, ul_CACb_fused, ul_CACm_fused, ul_Kt_Beta_fused, ul_Kv_m_fused, ul_Kv_b_fused;
+	fInt fSM_A0, fSM_A1, fSM_A2, fSM_A3, fSM_A4, fSM_A5, fSM_A6, fSM_A7;
+	fInt fMargin_RO_a, fMargin_RO_b, fMargin_RO_c, fMargin_fixed, fMargin_FMAX_mean, fMargin_Plat_mean, fMargin_FMAX_sigma, fMargin_Plat_sigma, fMargin_DC_sigma;
+	fInt fLkg_FT, repeat;
+	fInt fMicro_FMAX, fMicro_CR, fSigma_FMAX, fSigma_CR, fSigma_DC, fDC_SCLK, fSquared_Sigma_DC, fSquared_Sigma_CR, fSquared_Sigma_FMAX;
+	fInt fRLL_LoadLine, fPowerDPMx, fDerateTDP, fVDDC_base, fA_Term, fC_Term, fB_Term, fRO_DC_margin;
+	fInt fRO_fused, fCACm_fused, fCACb_fused, fKv_m_fused, fKv_b_fused, fKt_Beta_fused, fFT_Lkg_V0NORM;
+	fInt fSclk_margin, fSclk, fEVV_V;
+	fInt fV_min, fV_max, fT_prod, fLKG_Factor, fT_FT, fV_FT, fV_x, fTDP_Power, fTDP_Power_right, fTDP_Power_left, fTDP_Current, fV_NL;
+	uint32_t ul_FT_Lkg_V0NORM;
+	fInt fLn_MaxDivMin, fMin, fAverage, fRange;
+	fInt fRoots[2];
+	fInt fStepSize = GetScaledFraction(625, 100000);
+
+	int result;
+
+	getASICProfilingInfo = (ATOM_ASIC_PROFILING_INFO_V3_4 *)
+			cgs_atom_get_data_table(hwmgr->device,
+					GetIndexIntoMasterTable(DATA, ASIC_ProfilingInfo),
+					NULL, NULL, NULL);
+
+	if (!getASICProfilingInfo)
+		return -1;
+
+	if(getASICProfilingInfo->asHeader.ucTableFormatRevision < 3 ||
+			(getASICProfilingInfo->asHeader.ucTableFormatRevision == 3 &&
+			getASICProfilingInfo->asHeader.ucTableContentRevision < 4))
+		return -1;
+
+	/*-----------------------------------------------------------
+	 *GETTING MULTI-STEP PARAMETERS RELATED TO CURRENT DPM LEVEL
+	 *-----------------------------------------------------------
+	 */
+	fRLL_LoadLine = Divide(getASICProfilingInfo->ulLoadLineSlop, 1000);
+
+	switch (dpm_level) {
+	case 1:
+		fPowerDPMx = Convert_ULONG_ToFraction(getASICProfilingInfo->usPowerDpm1);
+		fDerateTDP = GetScaledFraction(getASICProfilingInfo->ulTdpDerateDPM1, 1000);
+		break;
+	case 2:
+		fPowerDPMx = Convert_ULONG_ToFraction(getASICProfilingInfo->usPowerDpm2);
+		fDerateTDP = GetScaledFraction(getASICProfilingInfo->ulTdpDerateDPM2, 1000);
+		break;
+	case 3:
+		fPowerDPMx = Convert_ULONG_ToFraction(getASICProfilingInfo->usPowerDpm3);
+		fDerateTDP = GetScaledFraction(getASICProfilingInfo->ulTdpDerateDPM3, 1000);
+		break;
+	case 4:
+		fPowerDPMx = Convert_ULONG_ToFraction(getASICProfilingInfo->usPowerDpm4);
+		fDerateTDP = GetScaledFraction(getASICProfilingInfo->ulTdpDerateDPM4, 1000);
+		break;
+	case 5:
+		fPowerDPMx = Convert_ULONG_ToFraction(getASICProfilingInfo->usPowerDpm5);
+		fDerateTDP = GetScaledFraction(getASICProfilingInfo->ulTdpDerateDPM5, 1000);
+		break;
+	case 6:
+		fPowerDPMx = Convert_ULONG_ToFraction(getASICProfilingInfo->usPowerDpm6);
+		fDerateTDP = GetScaledFraction(getASICProfilingInfo->ulTdpDerateDPM6, 1000);
+		break;
+	case 7:
+		fPowerDPMx = Convert_ULONG_ToFraction(getASICProfilingInfo->usPowerDpm7);
+		fDerateTDP = GetScaledFraction(getASICProfilingInfo->ulTdpDerateDPM7, 1000);
+		break;
+	default:
+		printk(KERN_ERR "DPM Level not supported\n");
+		fPowerDPMx = Convert_ULONG_ToFraction(1);
+		fDerateTDP = GetScaledFraction(getASICProfilingInfo->ulTdpDerateDPM0, 1000);
+	}
+
+	/*-------------------------
+	 * DECODING FUSE VALUES
+	 * ------------------------
+	 */
+	/*Decode RO_Fused*/
+	sRO_fuse = getASICProfilingInfo->sRoFuse;
+
+	sInput_FuseValues.usEfuseIndex = sRO_fuse.usEfuseIndex;
+	sInput_FuseValues.ucBitShift = sRO_fuse.ucEfuseBitLSB;
+	sInput_FuseValues.ucBitLength = sRO_fuse.ucEfuseLength;
+
+	sOutput_FuseValues.sEfuse = sInput_FuseValues;
+
+	result = cgs_atom_exec_cmd_table(hwmgr->device,
+			GetIndexIntoMasterTable(COMMAND, ReadEfuseValue),
+			&sOutput_FuseValues);
+
+	if (result)
+		return result;
+
+	/* Finally, the actual fuse value */
+	ul_RO_fused = sOutput_FuseValues.ulEfuseValue;
+	fMin = GetScaledFraction(sRO_fuse.ulEfuseMin, 1);
+	fRange = GetScaledFraction(sRO_fuse.ulEfuseEncodeRange, 1);
+	fRO_fused = fDecodeLinearFuse(ul_RO_fused, fMin, fRange, sRO_fuse.ucEfuseLength);
+
+	sCACm_fuse = getASICProfilingInfo->sCACm;
+
+	sInput_FuseValues.usEfuseIndex = sCACm_fuse.usEfuseIndex;
+	sInput_FuseValues.ucBitShift = sCACm_fuse.ucEfuseBitLSB;
+	sInput_FuseValues.ucBitLength = sCACm_fuse.ucEfuseLength;
+
+	sOutput_FuseValues.sEfuse = sInput_FuseValues;
+
+	result = cgs_atom_exec_cmd_table(hwmgr->device,
+			GetIndexIntoMasterTable(COMMAND, ReadEfuseValue),
+			&sOutput_FuseValues);
+
+	if (result)
+		return result;
+
+	ul_CACm_fused = sOutput_FuseValues.ulEfuseValue;
+	fMin = GetScaledFraction(sCACm_fuse.ulEfuseMin, 1000);
+	fRange = GetScaledFraction(sCACm_fuse.ulEfuseEncodeRange, 1000);
+
+	fCACm_fused = fDecodeLinearFuse(ul_CACm_fused, fMin, fRange, sCACm_fuse.ucEfuseLength);
+
+	sCACb_fuse = getASICProfilingInfo->sCACb;
+
+	sInput_FuseValues.usEfuseIndex = sCACb_fuse.usEfuseIndex;
+	sInput_FuseValues.ucBitShift = sCACb_fuse.ucEfuseBitLSB;
+	sInput_FuseValues.ucBitLength = sCACb_fuse.ucEfuseLength;
+	sOutput_FuseValues.sEfuse = sInput_FuseValues;
+
+	result = cgs_atom_exec_cmd_table(hwmgr->device,
+			GetIndexIntoMasterTable(COMMAND, ReadEfuseValue),
+			&sOutput_FuseValues);
+
+	if (result)
+		return result;
+
+	ul_CACb_fused = sOutput_FuseValues.ulEfuseValue;
+	fMin = GetScaledFraction(sCACb_fuse.ulEfuseMin, 1000);
+	fRange = GetScaledFraction(sCACb_fuse.ulEfuseEncodeRange, 1000);
+
+	fCACb_fused = fDecodeLinearFuse(ul_CACb_fused, fMin, fRange, sCACb_fuse.ucEfuseLength);
+
+	sKt_Beta_fuse = getASICProfilingInfo->sKt_b;
+
+	sInput_FuseValues.usEfuseIndex = sKt_Beta_fuse.usEfuseIndex;
+	sInput_FuseValues.ucBitShift = sKt_Beta_fuse.ucEfuseBitLSB;
+	sInput_FuseValues.ucBitLength = sKt_Beta_fuse.ucEfuseLength;
+
+	sOutput_FuseValues.sEfuse = sInput_FuseValues;
+
+	result = cgs_atom_exec_cmd_table(hwmgr->device,
+			GetIndexIntoMasterTable(COMMAND, ReadEfuseValue),
+			&sOutput_FuseValues);
+
+	if (result)
+		return result;
+
+	ul_Kt_Beta_fused = sOutput_FuseValues.ulEfuseValue;
+	fAverage = GetScaledFraction(sKt_Beta_fuse.ulEfuseEncodeAverage, 1000);
+	fRange = GetScaledFraction(sKt_Beta_fuse.ulEfuseEncodeRange, 1000);
+
+	fKt_Beta_fused = fDecodeLogisticFuse(ul_Kt_Beta_fused,
+			fAverage, fRange, sKt_Beta_fuse.ucEfuseLength);
+
+	sKv_m_fuse = getASICProfilingInfo->sKv_m;
+
+	sInput_FuseValues.usEfuseIndex = sKv_m_fuse.usEfuseIndex;
+	sInput_FuseValues.ucBitShift = sKv_m_fuse.ucEfuseBitLSB;
+	sInput_FuseValues.ucBitLength = sKv_m_fuse.ucEfuseLength;
+
+	sOutput_FuseValues.sEfuse = sInput_FuseValues;
+
+	result = cgs_atom_exec_cmd_table(hwmgr->device,
+			GetIndexIntoMasterTable(COMMAND, ReadEfuseValue),
+			&sOutput_FuseValues);
+	if (result)
+		return result;
+
+	ul_Kv_m_fused = sOutput_FuseValues.ulEfuseValue;
+	fAverage = GetScaledFraction(sKv_m_fuse.ulEfuseEncodeAverage, 1000);
+	fRange = GetScaledFraction((sKv_m_fuse.ulEfuseEncodeRange & 0x7fffffff), 1000);
+	fRange = fMultiply(fRange, ConvertToFraction(-1));
+
+	fKv_m_fused = fDecodeLogisticFuse(ul_Kv_m_fused,
+			fAverage, fRange, sKv_m_fuse.ucEfuseLength);
+
+	sKv_b_fuse = getASICProfilingInfo->sKv_b;
+
+	sInput_FuseValues.usEfuseIndex = sKv_b_fuse.usEfuseIndex;
+	sInput_FuseValues.ucBitShift = sKv_b_fuse.ucEfuseBitLSB;
+	sInput_FuseValues.ucBitLength = sKv_b_fuse.ucEfuseLength;
+	sOutput_FuseValues.sEfuse = sInput_FuseValues;
+
+	result = cgs_atom_exec_cmd_table(hwmgr->device,
+			GetIndexIntoMasterTable(COMMAND, ReadEfuseValue),
+			&sOutput_FuseValues);
+
+	if (result)
+		return result;
+
+	ul_Kv_b_fused = sOutput_FuseValues.ulEfuseValue;
+	fAverage = GetScaledFraction(sKv_b_fuse.ulEfuseEncodeAverage, 1000);
+	fRange = GetScaledFraction(sKv_b_fuse.ulEfuseEncodeRange, 1000);
+
+	fKv_b_fused = fDecodeLogisticFuse(ul_Kv_b_fused,
+			fAverage, fRange, sKv_b_fuse.ucEfuseLength);
+
+	/* Decoding the Leakage - No special struct container */
+	/*
+	 * usLkgEuseIndex=56
+	 * ucLkgEfuseBitLSB=6
+	 * ucLkgEfuseLength=10
+	 * ulLkgEncodeLn_MaxDivMin=69077
+	 * ulLkgEncodeMax=1000000
+	 * ulLkgEncodeMin=1000
+	 * ulEfuseLogisticAlpha=13
+	 */
+
+	sInput_FuseValues.usEfuseIndex = getASICProfilingInfo->usLkgEuseIndex;
+	sInput_FuseValues.ucBitShift = getASICProfilingInfo->ucLkgEfuseBitLSB;
+	sInput_FuseValues.ucBitLength = getASICProfilingInfo->ucLkgEfuseLength;
+
+	sOutput_FuseValues.sEfuse = sInput_FuseValues;
+
+	result = cgs_atom_exec_cmd_table(hwmgr->device,
+			GetIndexIntoMasterTable(COMMAND, ReadEfuseValue),
+			&sOutput_FuseValues);
+
+	if (result)
+		return result;
+
+	ul_FT_Lkg_V0NORM = sOutput_FuseValues.ulEfuseValue;
+	fLn_MaxDivMin = GetScaledFraction(getASICProfilingInfo->ulLkgEncodeLn_MaxDivMin, 10000);
+	fMin = GetScaledFraction(getASICProfilingInfo->ulLkgEncodeMin, 10000);
+
+	fFT_Lkg_V0NORM = fDecodeLeakageID(ul_FT_Lkg_V0NORM,
+			fLn_MaxDivMin, fMin, getASICProfilingInfo->ucLkgEfuseLength);
+	fLkg_FT = fFT_Lkg_V0NORM;
+
+	/*-------------------------------------------
+	 * PART 2 - Grabbing all required values
+	 *-------------------------------------------
+	 */
+	fSM_A0 = fMultiply(GetScaledFraction(getASICProfilingInfo->ulSM_A0, 1000000),
+			ConvertToFraction(uPow(-1, getASICProfilingInfo->ucSM_A0_sign)));
+	fSM_A1 = fMultiply(GetScaledFraction(getASICProfilingInfo->ulSM_A1, 1000000),
+			ConvertToFraction(uPow(-1, getASICProfilingInfo->ucSM_A1_sign)));
+	fSM_A2 = fMultiply(GetScaledFraction(getASICProfilingInfo->ulSM_A2, 100000),
+			ConvertToFraction(uPow(-1, getASICProfilingInfo->ucSM_A2_sign)));
+	fSM_A3 = fMultiply(GetScaledFraction(getASICProfilingInfo->ulSM_A3, 1000000),
+			ConvertToFraction(uPow(-1, getASICProfilingInfo->ucSM_A3_sign)));
+	fSM_A4 = fMultiply(GetScaledFraction(getASICProfilingInfo->ulSM_A4, 1000000),
+			ConvertToFraction(uPow(-1, getASICProfilingInfo->ucSM_A4_sign)));
+	fSM_A5 = fMultiply(GetScaledFraction(getASICProfilingInfo->ulSM_A5, 1000),
+			ConvertToFraction(uPow(-1, getASICProfilingInfo->ucSM_A5_sign)));
+	fSM_A6 = fMultiply(GetScaledFraction(getASICProfilingInfo->ulSM_A6, 1000),
+			ConvertToFraction(uPow(-1, getASICProfilingInfo->ucSM_A6_sign)));
+	fSM_A7 = fMultiply(GetScaledFraction(getASICProfilingInfo->ulSM_A7, 1000),
+			ConvertToFraction(uPow(-1, getASICProfilingInfo->ucSM_A7_sign)));
+
+	fMargin_RO_a = ConvertToFraction(getASICProfilingInfo->ulMargin_RO_a);
+	fMargin_RO_b = ConvertToFraction(getASICProfilingInfo->ulMargin_RO_b);
+	fMargin_RO_c = ConvertToFraction(getASICProfilingInfo->ulMargin_RO_c);
+
+	fMargin_fixed = ConvertToFraction(getASICProfilingInfo->ulMargin_fixed);
+
+	fMargin_FMAX_mean = GetScaledFraction(
+			getASICProfilingInfo->ulMargin_Fmax_mean, 10000);
+	fMargin_Plat_mean = GetScaledFraction(
+			getASICProfilingInfo->ulMargin_plat_mean, 10000);
+	fMargin_FMAX_sigma = GetScaledFraction(
+			getASICProfilingInfo->ulMargin_Fmax_sigma, 10000);
+	fMargin_Plat_sigma = GetScaledFraction(
+			getASICProfilingInfo->ulMargin_plat_sigma, 10000);
+
+	fMargin_DC_sigma = GetScaledFraction(
+			getASICProfilingInfo->ulMargin_DC_sigma, 100);
+	fMargin_DC_sigma = fDivide(fMargin_DC_sigma, ConvertToFraction(1000));
+
+	fCACm_fused = fDivide(fCACm_fused, ConvertToFraction(100));
+	fCACb_fused = fDivide(fCACb_fused, ConvertToFraction(100));
+	fKt_Beta_fused = fDivide(fKt_Beta_fused, ConvertToFraction(100));
+	fKv_m_fused =  fNegate(fDivide(fKv_m_fused, ConvertToFraction(100)));
+	fKv_b_fused = fDivide(fKv_b_fused, ConvertToFraction(10));
+
+	fSclk = GetScaledFraction(sclk, 100);
+
+	fV_max = fDivide(GetScaledFraction(
+			getASICProfilingInfo->ulMaxVddc, 1000), ConvertToFraction(4));
+	fT_prod = GetScaledFraction(getASICProfilingInfo->ulBoardCoreTemp, 10);
+	fLKG_Factor = GetScaledFraction(getASICProfilingInfo->ulEvvLkgFactor, 100);
+	fT_FT = GetScaledFraction(getASICProfilingInfo->ulLeakageTemp, 10);
+	fV_FT = fDivide(GetScaledFraction(
+			getASICProfilingInfo->ulLeakageVoltage, 1000), ConvertToFraction(4));
+	fV_min = fDivide(GetScaledFraction(
+			getASICProfilingInfo->ulMinVddc, 1000), ConvertToFraction(4));
+
+	/*-----------------------
+	 * PART 3
+	 *-----------------------
+	 */
+
+	fA_Term = fAdd(fMargin_RO_a, fAdd(fMultiply(fSM_A4,fSclk), fSM_A5));
+	fB_Term = fAdd(fAdd(fMultiply(fSM_A2, fSclk), fSM_A6), fMargin_RO_b);
+	fC_Term = fAdd(fMargin_RO_c,
+			fAdd(fMultiply(fSM_A0,fLkg_FT),
+			fAdd(fMultiply(fSM_A1, fMultiply(fLkg_FT,fSclk)),
+			fAdd(fMultiply(fSM_A3, fSclk),
+			fSubtract(fSM_A7,fRO_fused)))));
+
+	fVDDC_base = fSubtract(fRO_fused,
+			fSubtract(fMargin_RO_c,
+					fSubtract(fSM_A3, fMultiply(fSM_A1, fSclk))));
+	fVDDC_base = fDivide(fVDDC_base, fAdd(fMultiply(fSM_A0,fSclk), fSM_A2));
+
+	repeat = fSubtract(fVDDC_base,
+			fDivide(fMargin_DC_sigma, ConvertToFraction(1000)));
+
+	fRO_DC_margin = fAdd(fMultiply(fMargin_RO_a,
+			fGetSquare(repeat)),
+			fAdd(fMultiply(fMargin_RO_b, repeat),
+			fMargin_RO_c));
+
+	fDC_SCLK = fSubtract(fRO_fused,
+			fSubtract(fRO_DC_margin,
+			fSubtract(fSM_A3,
+			fMultiply(fSM_A2, repeat))));
+	fDC_SCLK = fDivide(fDC_SCLK, fAdd(fMultiply(fSM_A0,repeat), fSM_A1));
+
+	fSigma_DC = fSubtract(fSclk, fDC_SCLK);
+
+	fMicro_FMAX = fMultiply(fSclk, fMargin_FMAX_mean);
+	fMicro_CR = fMultiply(fSclk, fMargin_Plat_mean);
+	fSigma_FMAX = fMultiply(fSclk, fMargin_FMAX_sigma);
+	fSigma_CR = fMultiply(fSclk, fMargin_Plat_sigma);
+
+	fSquared_Sigma_DC = fGetSquare(fSigma_DC);
+	fSquared_Sigma_CR = fGetSquare(fSigma_CR);
+	fSquared_Sigma_FMAX = fGetSquare(fSigma_FMAX);
+
+	fSclk_margin = fAdd(fMicro_FMAX,
+			fAdd(fMicro_CR,
+			fAdd(fMargin_fixed,
+			fSqrt(fAdd(fSquared_Sigma_FMAX,
+			fAdd(fSquared_Sigma_DC, fSquared_Sigma_CR))))));
+	/*
+	 fA_Term = fSM_A4 * (fSclk + fSclk_margin) + fSM_A5;
+	 fB_Term = fSM_A2 * (fSclk + fSclk_margin) + fSM_A6;
+	 fC_Term = fRO_DC_margin + fSM_A0 * fLkg_FT + fSM_A1 * fLkg_FT * (fSclk + fSclk_margin) + fSM_A3 * (fSclk + fSclk_margin) + fSM_A7 - fRO_fused;
+	 */
+
+	fA_Term = fAdd(fMultiply(fSM_A4, fAdd(fSclk, fSclk_margin)), fSM_A5);
+	fB_Term = fAdd(fMultiply(fSM_A2, fAdd(fSclk, fSclk_margin)), fSM_A6);
+	fC_Term = fAdd(fRO_DC_margin,
+			fAdd(fMultiply(fSM_A0, fLkg_FT),
+			fAdd(fMultiply(fMultiply(fSM_A1, fLkg_FT),
+			fAdd(fSclk, fSclk_margin)),
+			fAdd(fMultiply(fSM_A3,
+			fAdd(fSclk, fSclk_margin)),
+			fSubtract(fSM_A7, fRO_fused)))));
+
+	SolveQuadracticEqn(fA_Term, fB_Term, fC_Term, fRoots);
+
+	if (GreaterThan(fRoots[0], fRoots[1]))
+		fEVV_V = fRoots[1];
+	else
+		fEVV_V = fRoots[0];
+
+	if (GreaterThan(fV_min, fEVV_V))
+		fEVV_V = fV_min;
+	else if (GreaterThan(fEVV_V, fV_max))
+		fEVV_V = fSubtract(fV_max, fStepSize);
+
+	fEVV_V = fRoundUpByStepSize(fEVV_V, fStepSize, 0);
+
+	/*-----------------
+	 * PART 4
+	 *-----------------
+	 */
+
+	fV_x = fV_min;
+
+	while (GreaterThan(fAdd(fV_max, fStepSize), fV_x)) {
+		fTDP_Power_left = fMultiply(fMultiply(fMultiply(fAdd(
+				fMultiply(fCACm_fused, fV_x), fCACb_fused), fSclk),
+				fGetSquare(fV_x)), fDerateTDP);
+
+		fTDP_Power_right = fMultiply(fFT_Lkg_V0NORM, fMultiply(fLKG_Factor,
+				fMultiply(fExponential(fMultiply(fAdd(fMultiply(fKv_m_fused,
+				fT_prod), fKv_b_fused), fV_x)), fV_x)));
+		fTDP_Power_right = fMultiply(fTDP_Power_right, fExponential(fMultiply(
+				fKt_Beta_fused, fT_prod)));
+		fTDP_Power_right = fDivide(fTDP_Power_right, fExponential(fMultiply(
+				fAdd(fMultiply(fKv_m_fused, fT_prod), fKv_b_fused), fV_FT)));
+		fTDP_Power_right = fDivide(fTDP_Power_right, fExponential(fMultiply(
+				fKt_Beta_fused, fT_FT)));
+
+		fTDP_Power = fAdd(fTDP_Power_left, fTDP_Power_right);
+
+		fTDP_Current = fDivide(fTDP_Power, fV_x);
+
+		fV_NL = fAdd(fV_x, fDivide(fMultiply(fTDP_Current, fRLL_LoadLine),
+				ConvertToFraction(10)));
+
+		fV_NL = fRoundUpByStepSize(fV_NL, fStepSize, 0);
+
+		if (GreaterThan(fV_max, fV_NL) &&
+			(GreaterThan(fV_NL,fEVV_V) ||
+			Equal(fV_NL, fEVV_V))) {
+			fV_NL = fMultiply(fV_NL, ConvertToFraction(1000));
+
+			*voltage = (uint16_t)fV_NL.partial.real;
+			break;
+		} else
+			fV_x = fAdd(fV_x, fStepSize);
+	}
+
+	return result;
+}
+
 /** atomctrl_get_voltage_evv_on_sclk gets voltage via call to ATOM COMMAND table.
  * @param hwmgr               	input: pointer to hwManager
  * @param voltage_type            input: type of EVV voltage VDDC or VDDGFX
@@ -701,4 +1163,23 @@ int atomctrl_get_engine_clock_spread_spectrum(
 			ASIC_INTERNAL_ENGINE_SS, engine_clock, ssInfo);
 }
 
+int atomctrl_read_efuse(void *device, uint16_t start_index,
+		uint16_t end_index, uint32_t mask, uint32_t *efuse)
+{
+	int result;
+	READ_EFUSE_VALUE_PARAMETER efuse_param;
+
+	efuse_param.sEfuse.usEfuseIndex = (start_index / 32) * 4;
+	efuse_param.sEfuse.ucBitShift = (uint8_t)
+			(start_index - ((start_index / 32) * 32));
+	efuse_param.sEfuse.ucBitLength  = (uint8_t)
+			((end_index - start_index) + 1);
 
+	result = cgs_atom_exec_cmd_table(device,
+			GetIndexIntoMasterTable(COMMAND, ReadEfuseValue),
+			&efuse_param);
+	if (!result)
+		*efuse = efuse_param.ulEfuseValue & mask;
+
+	return result;
+}
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h +6 -0
index 23da436..b5ba371 100644
@@ -231,6 +231,12 @@ extern int atomctrl_get_engine_pll_dividers_vi(struct pp_hwmgr *hwmgr, uint32_t
 extern int atomctrl_get_dfs_pll_dividers_vi(struct pp_hwmgr *hwmgr, uint32_t clock_value, pp_atomctrl_clock_dividers_vi *dividers);
 extern bool atomctrl_is_voltage_controled_by_gpio_v3(struct pp_hwmgr *hwmgr, uint8_t voltage_type, uint8_t voltage_mode);
 extern int atomctrl_get_voltage_table_v3(struct pp_hwmgr *hwmgr, uint8_t voltage_type, uint8_t voltage_mode, pp_atomctrl_voltage_table *voltage_table);
+extern int atomctrl_get_memory_pll_dividers_vi(struct pp_hwmgr *hwmgr,
+		uint32_t clock_value, pp_atomctrl_memory_clock_param *mpll_param);
+extern int atomctrl_read_efuse(void *device, uint16_t start_index,
+		uint16_t end_index, uint32_t mask, uint32_t *efuse);
+extern int atomctrl_calculate_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
+		uint32_t sclk, uint16_t virtual_voltage_Id, uint16_t *voltage, uint16_t dpm_level, bool debug);
 
 
 #endif
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +5 -5
index 0feb1a8..1a02c7d 100644
@@ -4507,14 +4507,14 @@ int tonga_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 	data->vdd_gfx_control = TONGA_VOLTAGE_CONTROL_NONE;
 	data->mvdd_control = TONGA_VOLTAGE_CONTROL_NONE;
 
-	if (0 == atomctrl_is_voltage_controled_by_gpio_v3(hwmgr,
+	if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr,
 				VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) {
 		data->voltage_control = TONGA_VOLTAGE_CONTROL_BY_SVID2;
 	}
 
 	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_ControlVDDGFX)) {
-		if (0 == atomctrl_is_voltage_controled_by_gpio_v3(hwmgr,
+		if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr,
 			VOLTAGE_TYPE_VDDGFX, VOLTAGE_OBJ_SVID2)) {
 			data->vdd_gfx_control = TONGA_VOLTAGE_CONTROL_BY_SVID2;
 		}
@@ -4527,7 +4527,7 @@ int tonga_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 
 	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_EnableMVDDControl)) {
-		if (0 == atomctrl_is_voltage_controled_by_gpio_v3(hwmgr,
+		if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr,
 					VOLTAGE_TYPE_MVDDC, VOLTAGE_OBJ_GPIO_LUT)) {
 			data->mvdd_control = TONGA_VOLTAGE_CONTROL_BY_GPIO;
 		}
@@ -4540,10 +4540,10 @@ int tonga_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 
 	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_ControlVDDCI)) {
-		if (0 == atomctrl_is_voltage_controled_by_gpio_v3(hwmgr,
+		if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr,
 					VOLTAGE_TYPE_VDDCI, VOLTAGE_OBJ_GPIO_LUT))
 			data->vdd_ci_control = TONGA_VOLTAGE_CONTROL_BY_GPIO;
-		else if (0 == atomctrl_is_voltage_controled_by_gpio_v3(hwmgr,
+		else if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr,
 						VOLTAGE_TYPE_VDDCI, VOLTAGE_OBJ_SVID2))
 			data->vdd_ci_control = TONGA_VOLTAGE_CONTROL_BY_SVID2;
 	}
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#24 lore raw

PATCH 24/51 drm/amd/powerplay: add Fiji SMU support.

In reply to Alex Deucher

From: Eric Huang <[email protected]>

Add support for the SMU manager for Fiji. This handles the firmware loading for other IP blocks (GFX, SDMA, etc.).

---
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |    2 +-
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c | 1035 ++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h |   77 ++
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c      |    4 +
 4 files changed, 1117 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h
drivers/gpu/drm/amd/powerplay/smumgr/Makefile +1 -1
index 0e3348d..6c4ef13 100644
@@ -2,7 +2,7 @@
 # Makefile for the 'smu manager' sub-component of powerplay.
 # It provides the smu management services for the driver.
 
-SMU_MGR = smumgr.o cz_smumgr.o tonga_smumgr.o
+SMU_MGR = smumgr.o cz_smumgr.o tonga_smumgr.o fiji_smumgr.o
 
 AMD_PP_SMUMGR = $(addprefix $(AMD_PP_PATH)/smumgr/,$(SMU_MGR))
 
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c new file +1035 -0

1,035 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h new file +77 -0

77 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +4 -0
index a386ca8..063ae71 100644
@@ -29,6 +29,7 @@
 #include "linux/delay.h"
 #include "cz_smumgr.h"
 #include "tonga_smumgr.h"
+#include "fiji_smumgr.h"
 
 int smum_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 {
@@ -58,6 +59,9 @@ int smum_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 		case CHIP_TONGA:
 			tonga_smum_init(smumgr);
 			break;
+		case CHIP_FIJI:
+			fiji_smum_init(smumgr);
+			break;
 		default:
 			return -EINVAL;
 		}
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#25 lore raw

PATCH 25/51 drm/amd/powerplay: add Fiji DPM support.

In reply to Alex Deucher

From: Eric Huang <[email protected]>

This enabled DPM support for Fiji. DPM is dynamic clock and voltage scaling.

v2: rename fiji_hwmgr_early_init to fiji_hwmgr_init
v3: (agd) fold in endian fix, additional function addition

---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |    3 +-
 .../drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h    |  105 +
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c   | 4728 ++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h   |  356 ++
 .../gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c   |  553 +++
 .../gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h   |   66 +
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |    5 +
 7 files changed, 5815 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +2 -1
index fd73d3c..c78e38c 100644
@@ -6,7 +6,8 @@ HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
 	       hardwaremanager.o pp_acpi.o cz_hwmgr.o \
                cz_clockpowergating.o \
 	       tonga_processpptables.o ppatomctrl.o \
-               tonga_hwmgr.o 	pppcielanes.o
+               tonga_hwmgr.o 	pppcielanes.o \
+               fiji_powertune.o fiji_hwmgr.o
 
 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
 
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h new file +105 -0

105 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c new file +4728 -0

2,886 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h new file +356 -0

356 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c new file +553 -0

553 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h new file +66 -0

66 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +5 -0
index 407b2e3..f243e40 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Part of the diff is not shown here. View the raw message.

#26 lore raw

PATCH 26/51 drm/amdgpu: add amdgpu.powerplay module option

In reply to Alex Deucher

From: Jammy Zhou <[email protected]>

This option can be used to enable the new powerplay implementation, and it is disabled by default.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
index 885da0b..fe11a29 100644
@@ -165,6 +165,11 @@ module_param_named(sched_hw_submission, amdgpu_sched_hw_submission, int, 0444);
 MODULE_PARM_DESC(enable_semaphores, "Enable semaphores (1 = enable, 0 = disable (default))");
 module_param_named(enable_semaphores, amdgpu_enable_semaphores, int, 0644);
 
+#ifdef CONFIG_DRM_AMD_POWERPLAY
+MODULE_PARM_DESC(powerplay, "Powerplay component (1 = enable, 0 = disable (default))");
+module_param_named(powerplay, amdgpu_powerplay, int, 0444);
+#endif
+
 static struct pci_device_id pciidlist[] = {
 #ifdef CONFIG_DRM_AMDGPU_CIK
 	/* Kaveri */
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#27 lore raw

PATCH 27/51 drm/amd/amdgpu: enable powerplay and smc firmware loading for Fiji.

In reply to Alex Deucher

From: Eric Huang <[email protected]>

Switch over to handling in the powerplay module.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c       | 3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 3 +++
 drivers/gpu/drm/amd/amdgpu/vi.c               | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +3 -0
index 8f758ea..a611401a 100644
@@ -703,6 +703,9 @@ static int amdgpu_cgs_get_firmware_info(void *cgs_device,
 		case CHIP_TONGA:
 			strcpy(fw_name, "amdgpu/tonga_smc.bin");
 			break;
+		case CHIP_FIJI:
+			strcpy(fw_name, "amdgpu/fiji_smc.bin");
+			break;
 		default:
 			DRM_ERROR("SMC firmware not supported\n");
 			return -EINVAL;
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +3 -0
index 5dd2a4c..1a824f0 100644
@@ -77,6 +77,9 @@ static int amdgpu_powerplay_init(struct amdgpu_device *adev)
 		case CHIP_TONGA:
 			amd_pp->ip_funcs = &tonga_dpm_ip_funcs;
 			break;
+		case CHIP_FIJI:
+			amd_pp->ip_funcs = &fiji_dpm_ip_funcs;
+			break;
 		case CHIP_CARRIZO:
 			amd_pp->ip_funcs = &cz_dpm_ip_funcs;
 			break;
drivers/gpu/drm/amd/amdgpu/vi.c +1 -1
index ca3590f..24970ce 100644
@@ -1214,7 +1214,7 @@ static const struct amdgpu_ip_block_version fiji_ip_blocks[] =
 		.major = 7,
 		.minor = 1,
 		.rev = 0,
-		.funcs = &fiji_dpm_ip_funcs,
+		.funcs = &amdgpu_pp_ip_funcs,
 	},
 	{
 		.type = AMD_IP_BLOCK_TYPE_DCE,
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#28 lore raw

PATCH 28/51 drm/amdgpu/powerplay: add function point in hwmgr_funcs for program display gap

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Displaygap support is required for proper mclk switching.

---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +3 -1
index ca513a1..2370a72 100644
@@ -275,7 +275,6 @@ struct pp_hwmgr_func {
 
 	int (*get_pp_table_entry)(struct pp_hwmgr *hwmgr,
 			    unsigned long, struct pp_power_state *);
-
 	int (*get_num_of_pp_table_entries)(struct pp_hwmgr *hwmgr);
 	int (*powerdown_uvd)(struct pp_hwmgr *hwmgr);
 	int (*powergate_vce)(struct pp_hwmgr *hwmgr, bool bgate);
@@ -287,6 +286,8 @@ struct pp_hwmgr_func {
 	void (*print_current_perforce_level)(struct pp_hwmgr *hwmgr,
 							struct seq_file *m);
 	int (*enable_clock_power_gating)(struct pp_hwmgr *hwmgr);
+	int (*notify_smc_display_config_after_ps_adjustment)(struct pp_hwmgr *hwmgr);
+	int (*display_config_changed)(struct pp_hwmgr *hwmgr);
 };
 
 struct pp_table_func {
@@ -543,6 +544,7 @@ struct pp_hwmgr {
 	struct phm_runtime_table_header enable_dynamic_state_management;
 	struct phm_runtime_table_header set_power_state;
 	struct phm_runtime_table_header enable_clock_power_gatings;
+	struct phm_runtime_table_header display_configuration_changed;
 	const struct pp_hwmgr_func *hwmgr_func;
 	const struct pp_table_func *pptable_func;
 	struct pp_power_state    *ps;
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#29 lore raw

PATCH 29/51 drm/amdgpu/poweprlay: export program display gap function to eventmgr

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

This allows the eventmgr to properly update the displaygap on certain power events.

---
 .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c  | 27 ++++++++++++++++++++++
 .../gpu/drm/amd/powerplay/inc/hardwaremanager.h    |  2 ++
 2 files changed, 29 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +27 -0
index aec9f6d..620119f 100644
@@ -167,3 +167,30 @@ int phm_enable_clock_power_gatings(struct pp_hwmgr *hwmgr)
 	}
 	return 0;
 }
+
+int phm_display_configuration_changed(struct pp_hwmgr *hwmgr)
+{
+	if (hwmgr == NULL)
+		return -EINVAL;
+
+	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
+				 PHM_PlatformCaps_TablelessHardwareInterface)) {
+		if (NULL != hwmgr->hwmgr_func->display_config_changed)
+			hwmgr->hwmgr_func->display_config_changed(hwmgr);
+	} else
+		return phm_dispatch_table(hwmgr, &hwmgr->display_configuration_changed, NULL, NULL);
+    return 0;
+}
+
+int phm_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr)
+{
+	if (hwmgr == NULL)
+		return -EINVAL;
+
+	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
+				 PHM_PlatformCaps_TablelessHardwareInterface))
+		if (NULL != hwmgr->hwmgr_func->display_config_changed)
+			hwmgr->hwmgr_func->notify_smc_display_config_after_ps_adjustment(hwmgr);
+
+    return 0;
+}
drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h +2 -0
index 9795b9a..1d29760 100644
@@ -328,4 +328,6 @@ extern int phm_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 			     const struct pp_power_state *current_ps);
 
 extern int phm_force_dpm_levels(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_level level);
+extern int phm_display_configuration_changed(struct pp_hwmgr *hwmgr);
+extern int phm_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr);
 #endif /* _HARDWARE_MANAGER_H_ */
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#30 lore raw

PATCH 30/51 drm/amdgpu/powerplay: implement pem_task for display_configuration_change

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Add support for display configuration changes to the event manager.

---
 drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c |  2 +-
 drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c     | 15 ++++++++++++---
 drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h     |  2 +-
 drivers/gpu/drm/amd/powerplay/eventmgr/psm.c            |  2 +-
 4 files changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c +1 -1
index 49d8a29..e5dd86d 100644
@@ -152,7 +152,7 @@ const pem_event_action set_boot_state_tasks[] = {
 const pem_event_action adjust_power_state_tasks[] = {
 	pem_task_notify_hw_mgr_display_configuration_change,
 	pem_task_adjust_power_state,
-	/*pem_task_notify_smc_display_config_after_power_state_adjustment,*/
+	pem_task_notify_smc_display_config_after_power_state_adjustment,
 	pem_task_update_allowed_performance_levels,
 	/* to do pem_task_Enable_disable_bapm, */
 	NULL
drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c +12 -3
index 55d5490..8ca3280 100644
@@ -189,16 +189,25 @@ int pem_task_store_dal_configuration(struct pp_eventmgr *eventmgr, const struct
 
 int pem_task_notify_hw_mgr_display_configuration_change(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data)
 {
-	/* TODO */
-	return 0;
+	if (pem_is_hw_access_blocked(eventmgr))
+		return 0;
+
+	return phm_display_configuration_changed(eventmgr->hwmgr);
 }
 
 int pem_task_notify_hw_mgr_pre_display_configuration_change(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data)
 {
-	/* TODO */
 	return 0;
 }
 
+int pem_task_notify_smc_display_config_after_power_state_adjustment(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data)
+{
+	if (pem_is_hw_access_blocked(eventmgr))
+		return 0;
+
+	return phm_notify_smc_display_config_after_ps_adjustment(eventmgr->hwmgr);
+}
+
 int pem_task_block_adjust_power_state(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data)
 {
 	eventmgr->block_adjust_power_state = true;
drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h +1 -1
index 37d3cf1..287c87c 100644
@@ -57,7 +57,7 @@ int pem_task_block_hw_access(struct pp_eventmgr *eventmgr, struct pem_event_data
 int pem_task_un_block_hw_access(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data);
 int pem_task_reset_display_phys_access(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data);
 int pem_task_set_cpu_power_state(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data);
-
+int pem_task_notify_smc_display_config_after_power_state_adjustment(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data);
 /*powersaving*/
 
 int pem_task_set_power_source(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data);
drivers/gpu/drm/amd/powerplay/eventmgr/psm.c +1 -1
index 7469c4c..08b75bd 100644
@@ -97,7 +97,7 @@ int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip)
 	pcurrent = hwmgr->current_ps;
 	requested = hwmgr->request_ps;
 
-	if (pcurrent != NULL || requested != NULL) {
+	if ((pcurrent != NULL || requested != NULL) && (pcurrent != requested)) {
 		phm_apply_state_adjust_rules(hwmgr, requested, pcurrent);
 		phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware);
 		hwmgr->current_ps = requested;
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#31 lore raw

PATCH 31/51 drm/amdgpu/powerplay: program display gap for tonga.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Implement displaygap programming for tonga. This is required for properly mclk switching.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 91 +++++++++++++++++++++++
 1 file changed, 91 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +91 -0
index 1a02c7d..fe8b315 100644
@@ -168,6 +168,13 @@ int tonga_add_voltage(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+int tonga_notify_smc_display_change(struct pp_hwmgr *hwmgr, bool has_display)
+{
+	PPSMC_Msg msg = has_display? (PPSMC_Msg)PPSMC_HasDisplay : (PPSMC_Msg)PPSMC_NoDisplay;
+
+	return (smum_send_msg_to_smc(hwmgr->smumgr, msg) == 0) ?  0 : -1;
+}
+
 uint8_t tonga_get_voltage_id(pp_atomctrl_voltage_table *voltage_table,
 		uint32_t voltage)
 {
@@ -4392,6 +4399,10 @@ int tonga_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
 	PP_ASSERT_WITH_CODE((0 == tmp_result),
 		"Failed to populate initialize MC Reg table!", result = tmp_result);
 
+	tmp_result = tonga_notify_smc_display_change(hwmgr, false);
+	PP_ASSERT_WITH_CODE((0 == tmp_result),
+		"Failed to notify no display!", result = tmp_result);
+
 	/* enable SCLK control */
 	tmp_result = tonga_enable_sclk_control(hwmgr);
 	PP_ASSERT_WITH_CODE((0 == tmp_result),
@@ -5679,6 +5690,84 @@ static int tonga_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *input
 	return result;
 }
 
+
+int tonga_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr)
+{
+	uint32_t num_active_displays = 0;
+	struct cgs_display_info info = {0};
+	info.mode_info = NULL;
+
+	cgs_get_active_displays_info(hwmgr->device, &info);
+
+	num_active_displays = info.display_count;
+
+	if (num_active_displays > 1)  /* to do && (pHwMgr->pPECI->displayConfiguration.bMultiMonitorInSync != TRUE)) */
+		tonga_notify_smc_display_change(hwmgr, false);
+	else
+		tonga_notify_smc_display_change(hwmgr, true);
+
+	return 0;
+}
+
+/**
+* Programs the display gap
+*
+* @param    hwmgr  the address of the powerplay hardware manager.
+* @return   always OK
+*/
+int tonga_program_display_gap(struct pp_hwmgr *hwmgr)
+{
+	struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
+	uint32_t num_active_displays = 0;
+	uint32_t display_gap = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL);
+	uint32_t display_gap2;
+	uint32_t pre_vbi_time_in_us;
+	uint32_t frame_time_in_us;
+	uint32_t ref_clock;
+	uint32_t refresh_rate = 0;
+	struct cgs_display_info info = {0};
+	struct cgs_mode_info mode_info;
+
+	info.mode_info = &mode_info;
+
+	cgs_get_active_displays_info(hwmgr->device, &info);
+	num_active_displays = info.display_count;
+
+	display_gap = PHM_SET_FIELD(display_gap, CG_DISPLAY_GAP_CNTL, DISP_GAP, (num_active_displays > 0)? DISPLAY_GAP_VBLANK_OR_WM : DISPLAY_GAP_IGNORE);
+	cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL, display_gap);
+
+	ref_clock = mode_info.ref_clock;
+	refresh_rate = mode_info.refresh_rate;
+
+	if(0 == refresh_rate)
+		refresh_rate = 60;
+
+	frame_time_in_us = 1000000 / refresh_rate;
+
+	pre_vbi_time_in_us = frame_time_in_us - 200 - mode_info.vblank_time_us;
+	display_gap2 = pre_vbi_time_in_us * (ref_clock / 100);
+
+	cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL2, display_gap2);
+
+	cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, data->soft_regs_start + offsetof(SMU72_SoftRegisters, PreVBlankGap), 0x64);
+
+	cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, data->soft_regs_start + offsetof(SMU72_SoftRegisters, VBlankTimeout), (frame_time_in_us - pre_vbi_time_in_us));
+
+	if (num_active_displays == 1)
+		tonga_notify_smc_display_change(hwmgr, true);
+
+	return 0;
+}
+
+int tonga_display_configuration_changed_task(struct pp_hwmgr *hwmgr)
+{
+
+	tonga_program_display_gap(hwmgr);
+
+	/* to do PhwTonga_CacUpdateDisplayConfiguration(pHwMgr); */
+	return 0;
+}
+
 static const struct pp_hwmgr_func tonga_hwmgr_funcs = {
 	.backend_init = &tonga_hwmgr_backend_init,
 	.backend_fini = &tonga_hwmgr_backend_fini,
@@ -5694,6 +5783,8 @@ static const struct pp_hwmgr_func tonga_hwmgr_funcs = {
 	.get_pp_table_entry = tonga_get_pp_table_entry,
 	.get_num_of_pp_table_entries = tonga_get_number_of_powerplay_table_entries,
 	.print_current_perforce_level = tonga_print_current_perforce_level,
+	.notify_smc_display_config_after_ps_adjustment = tonga_notify_smc_display_config_after_ps_adjustment,
+	.display_config_changed = tonga_display_configuration_changed_task,
 };
 
 int tonga_hwmgr_init(struct pp_hwmgr *hwmgr)
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#32 lore raw

PATCH 32/51 drm/amdgpu: enable powerplay module by default for tonga.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +8 -0
index 1a824f0..cbb00e2 100644
@@ -96,6 +96,14 @@ static int amdgpu_pp_early_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	int ret = 0;
 
+	switch (adev->asic_type) {
+		case CHIP_TONGA:
+			amdgpu_powerplay = 1;
+			break;
+		default:
+			break;
+	}
+
 	ret = amdgpu_powerplay_init(adev);
 	if (ret)
 		return ret;
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#33 lore raw

PATCH 33/51 drm/amdgpu: enable powerplay module by default for fiji.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +3 -0
index cbb00e2..1ff6fd5 100644
@@ -96,13 +96,16 @@ static int amdgpu_pp_early_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	int ret = 0;
 
+#ifdef CONFIG_DRM_AMD_POWERPLAY
 	switch (adev->asic_type) {
 		case CHIP_TONGA:
+		case CHIP_FIJI:
 			amdgpu_powerplay = 1;
 			break;
 		default:
 			break;
 	}
+#endif
 
 	ret = amdgpu_powerplay_init(adev);
 	if (ret)
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#34 lore raw

PATCH 34/51 drm/amdgpu/powerplay: add some definition for other ip block to update cg pg.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Interface for clock and power gating handling.

---
 drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h | 41 +++++++++++++++++++++++
 1 file changed, 41 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h +41 -0
index 2281d88..d81b239 100644
@@ -131,6 +131,47 @@ struct amd_pp_init {
 	uint32_t rev_id;
 };
 
+enum {
+	PP_GROUP_UNKNOWN = 0,
+	PP_GROUP_GFX = 1,
+	PP_GROUP_SYS,
+	PP_GROUP_MAX
+};
+
+#define PP_GROUP_MASK        0xF0000000
+#define PP_GROUP_SHIFT       28
+
+#define PP_BLOCK_MASK        0x0FFFFF00
+#define PP_BLOCK_SHIFT       8
+
+#define PP_BLOCK_GFX_CG         0x01
+#define PP_BLOCK_GFX_MG         0x02
+#define PP_BLOCK_SYS_BIF        0x01
+#define PP_BLOCK_SYS_MC         0x02
+#define PP_BLOCK_SYS_ROM        0x04
+#define PP_BLOCK_SYS_DRM        0x08
+#define PP_BLOCK_SYS_HDP        0x10
+#define PP_BLOCK_SYS_SDMA       0x20
+
+#define PP_STATE_MASK           0x0000000F
+#define PP_STATE_SHIFT          0
+#define PP_STATE_SUPPORT_MASK   0x000000F0
+#define PP_STATE_SUPPORT_SHIFT  0
+
+#define PP_STATE_CG             0x01
+#define PP_STATE_LS             0x02
+#define PP_STATE_DS             0x04
+#define PP_STATE_SD             0x08
+#define PP_STATE_SUPPORT_CG     0x10
+#define PP_STATE_SUPPORT_LS     0x20
+#define PP_STATE_SUPPORT_DS     0x40
+#define PP_STATE_SUPPORT_SD     0x80
+
+#define PP_CG_MSG_ID(group, block, support, state) (group << PP_GROUP_SHIFT |\
+								block << PP_BLOCK_SHIFT |\
+								support << PP_STATE_SUPPORT_SHIFT |\
+								state << PP_STATE_SHIFT)
+
 struct amd_powerplay_funcs {
 	int (*get_temperature)(void *handle);
 	int (*load_firmware)(void *handle);
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#35 lore raw

PATCH 35/51 drm/amd/powerplay: add new function point in hwmgr_func for CG/PG.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Add callbacks interface for clock and powergating.

---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +3 -0
index 2370a72..f90a8b6 100644
@@ -288,6 +288,9 @@ struct pp_hwmgr_func {
 	int (*enable_clock_power_gating)(struct pp_hwmgr *hwmgr);
 	int (*notify_smc_display_config_after_ps_adjustment)(struct pp_hwmgr *hwmgr);
 	int (*display_config_changed)(struct pp_hwmgr *hwmgr);
+	int (*disable_clock_power_gating)(struct pp_hwmgr *hwmgr);
+	int (*update_clock_gatings)(struct pp_hwmgr *hwmgr,
+						const uint32_t *msg_id);
 };
 
 struct pp_table_func {
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#36 lore raw

PATCH 36/51 drm/amd/powerplay: Add CG and PG support for tonga

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Implement clock and power gating support for tonga. On Tonga this is handles by the SMU rather than direct register settings in the driver.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |   2 +-
 .../amd/powerplay/hwmgr/tonga_clockpowergating.c   | 350 +++++++++++++++++++++
 .../amd/powerplay/hwmgr/tonga_clockpowergating.h   |  36 +++
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c  |  63 +++-
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h  |   4 +
 5 files changed, 440 insertions(+), 15 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +1 -1
index c78e38c..6f38811 100644
@@ -7,7 +7,7 @@ HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
                cz_clockpowergating.o \
 	       tonga_processpptables.o ppatomctrl.o \
                tonga_hwmgr.o 	pppcielanes.o \
-               fiji_powertune.o fiji_hwmgr.o
+               fiji_powertune.o fiji_hwmgr.o tonga_clockpowergating.o
 
 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
 
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.c new file +350 -0

350 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.h new file +36 -0
new file mode 100644
index 0000000..8bc38cb
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef _TONGA_CLOCK_POWER_GATING_H_
+#define _TONGA_CLOCK_POWER_GATING_H_
+
+#include "tonga_hwmgr.h"
+#include "pp_asicblocks.h"
+
+extern int tonga_phm_set_asic_block_gating(struct pp_hwmgr *hwmgr, enum PHM_AsicBlock block, enum PHM_ClockGateSetting gating);
+extern int tonga_phm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate);
+extern int tonga_phm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate);
+extern int tonga_phm_powerdown_uvd(struct pp_hwmgr *hwmgr);
+extern int tonga_phm_disable_clock_power_gating(struct pp_hwmgr *hwmgr);
+extern int tonga_phm_update_clock_gatings(struct pp_hwmgr *hwmgr, const uint32_t *msg_id);
+#endif /* _TONGA_CLOCK_POWER_GATING_H_ */
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +49 -14

99 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h +4 -0
index d007706..c3ac966 100644
@@ -422,6 +422,10 @@ typedef struct tonga_hwmgr tonga_hwmgr;
 #define CONVERT_FROM_HOST_TO_SMC_US(X) ((X) = PP_HOST_TO_SMC_US(X))
 
 int tonga_hwmgr_init(struct pp_hwmgr *hwmgr);
+int tonga_update_vce_dpm(struct pp_hwmgr *hwmgr, const void *input);
+int tonga_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate);
+int tonga_enable_disable_uvd_dpm(struct pp_hwmgr *hwmgr, bool enable);
+int tonga_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable);
 
 #endif
 
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#37 lore raw

PATCH 37/51 drm/amdgpu/powerplay: add new function point in hwmgr_funcs for thermal control

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Add the interface for fan and thermal control.

---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +22 -0
index f90a8b6..aedb1e4 100644
@@ -35,6 +35,7 @@ struct pp_hwmgr;
 struct pp_hw_power_state;
 struct pp_power_state;
 struct PP_VCEState;
+struct phm_fan_speed_info;
 
 enum PP_Result {
 	PP_Result_TableImmediateExit = 0x13,
@@ -291,6 +292,21 @@ struct pp_hwmgr_func {
 	int (*disable_clock_power_gating)(struct pp_hwmgr *hwmgr);
 	int (*update_clock_gatings)(struct pp_hwmgr *hwmgr,
 						const uint32_t *msg_id);
+	int (*set_max_fan_rpm_output)(struct pp_hwmgr *hwmgr, uint16_t us_max_fan_pwm);
+	int (*set_max_fan_pwm_output)(struct pp_hwmgr *hwmgr, uint16_t us_max_fan_pwm);
+	int (*get_temperature)(struct pp_hwmgr *hwmgr);
+	int (*stop_thermal_controller)(struct pp_hwmgr *hwmgr);
+	int (*get_fan_speed_info)(struct pp_hwmgr *hwmgr, struct phm_fan_speed_info *fan_speed_info);
+	int (*set_fan_control_mode)(struct pp_hwmgr *hwmgr, uint32_t mode);
+	int (*get_fan_control_mode)(struct pp_hwmgr *hwmgr);
+	int (*set_fan_speed_percent)(struct pp_hwmgr *hwmgr, uint32_t percent);
+	int (*get_fan_speed_percent)(struct pp_hwmgr *hwmgr, uint32_t *speed);
+	int (*set_fan_speed_rpm)(struct pp_hwmgr *hwmgr, uint32_t percent);
+	int (*get_fan_speed_rpm)(struct pp_hwmgr *hwmgr, uint32_t *speed);
+	int (*reset_fan_speed_to_default)(struct pp_hwmgr *hwmgr);
+	int (*uninitialize_thermal_controller)(struct pp_hwmgr *hwmgr);
+	int (*register_internal_thermal_interrupt)(struct pp_hwmgr *hwmgr,
+					const void *thermal_interrupt_info);
 };
 
 struct pp_table_func {
@@ -548,12 +564,17 @@ struct pp_hwmgr {
 	struct phm_runtime_table_header set_power_state;
 	struct phm_runtime_table_header enable_clock_power_gatings;
 	struct phm_runtime_table_header display_configuration_changed;
+	struct phm_runtime_table_header start_thermal_controller;
+	struct phm_runtime_table_header set_temperature_range;
 	const struct pp_hwmgr_func *hwmgr_func;
 	const struct pp_table_func *pptable_func;
 	struct pp_power_state    *ps;
         enum pp_power_source  power_source;
 	uint32_t num_ps;
 	struct pp_thermal_controller_info thermal_controller;
+	bool fan_ctrl_is_in_default_mode;
+	uint32_t fan_ctrl_default_mode;
+	uint32_t tmin;
 	struct phm_microcode_version_info microcode_version_info;
 	uint32_t ps_size;
 	struct pp_power_state    *current_ps;
@@ -599,6 +620,7 @@ extern void phm_wait_for_indirect_register_unequal(
 
 bool phm_cf_want_uvd_power_gating(struct pp_hwmgr *hwmgr);
 bool phm_cf_want_vce_power_gating(struct pp_hwmgr *hwmgr);
+bool phm_cf_want_microcode_fan_ctrl(struct pp_hwmgr *hwmgr);
 
 #define PHM_ENTIRE_REGISTER_MASK 0xFFFFFFFFU
 
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#38 lore raw

PATCH 38/51 drm/amdgpu/powerplay: mv ppinterrupt.h to inc folder to share with other submodule.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Redefine interrupt callback function in accordance with cgs.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/ppinterrupt.h | 42 ---------------------
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h | 14 +++----
 drivers/gpu/drm/amd/powerplay/inc/ppinterrupt.h   | 46 +++++++++++++++++++++++
 3 files changed, 53 insertions(+), 49 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppinterrupt.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/ppinterrupt.h
drivers/gpu/drm/amd/powerplay/hwmgr/ppinterrupt.h deleted +0 -42
deleted file mode 100644
index 7269ac1..0000000
@@ -1,42 +0,0 @@
-/*
- * Copyright 2015 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-#ifndef PP_INTERRUPT_H
-#define PP_INTERRUPT_H
-
-/**
- * The type of the interrupt callback functions in PowerPlay
- */
-typedef void (*pp_interrupt_callback) (void *context, uint32_t ul_context_data);
-
-/**
- * Event Manager action chain list information
- */
-struct pp_interrupt_registration_info {
-	pp_interrupt_callback callback;  /* Pointer to callback function */
-	void *context;                  /* Pointer to callback function context */
-	uint32_t *interrupt_enable_id;    /* Registered interrupt id */
-};
-
-typedef struct pp_interrupt_registration_info pp_interrupt_registration_info;
-
-#endif
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h +7 -7
index c3ac966..d773d12 100644
@@ -223,17 +223,17 @@ struct tonga_hwmgr {
 	uint32_t                           vddc_vddci_delta;
 	uint32_t                           vddc_vddgfx_delta;
 
-	pp_interrupt_registration_info    internal_high_thermal_interrupt_info;
-	pp_interrupt_registration_info    internal_low_thermal_interrupt_info;
-	pp_interrupt_registration_info    smc_to_host_interrupt_info;
+	struct pp_interrupt_registration_info    internal_high_thermal_interrupt_info;
+	struct pp_interrupt_registration_info    internal_low_thermal_interrupt_info;
+	struct pp_interrupt_registration_info    smc_to_host_interrupt_info;
 	uint32_t                          active_auto_throttle_sources;
 
-	pp_interrupt_registration_info    external_throttle_interrupt;
-	pp_interrupt_callback             external_throttle_callback;
+	struct pp_interrupt_registration_info    external_throttle_interrupt;
+	irq_handler_func_t             external_throttle_callback;
 	void                             *external_throttle_context;
 
-	pp_interrupt_registration_info    ctf_interrupt_info;
-	pp_interrupt_callback             ctf_callback;
+	struct pp_interrupt_registration_info    ctf_interrupt_info;
+	irq_handler_func_t             ctf_callback;
 	void                             *ctf_context;
 
 	phw_tonga_clock_registers      	  clock_registers;
drivers/gpu/drm/amd/powerplay/inc/ppinterrupt.h new file +46 -0

46 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#39 lore raw

PATCH 39/51 drm/amdgpu/powerplay: add thermal control interface in hwmgr.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Thermal controller interface.

---
 .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c  | 29 ++++++++++++++++++++++
 .../gpu/drm/amd/powerplay/inc/hardwaremanager.h    | 16 ++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/power_state.h    |  4 +--
 3 files changed, 47 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +29 -0
index 620119f..9d910f3 100644
@@ -194,3 +194,32 @@ int phm_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr)
 
     return 0;
 }
+
+int phm_stop_thermal_controller(struct pp_hwmgr *hwmgr)
+{
+	if (hwmgr == NULL || hwmgr->hwmgr_func->stop_thermal_controller == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->stop_thermal_controller(hwmgr);
+}
+
+int phm_register_thermal_interrupt(struct pp_hwmgr *hwmgr, const void *info)
+{
+	if (hwmgr == NULL || hwmgr->hwmgr_func->register_internal_thermal_interrupt == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->register_internal_thermal_interrupt(hwmgr, info);
+}
+
+/**
+* Initializes the thermal controller subsystem.
+*
+* @param    pHwMgr  the address of the powerplay hardware manager.
+* @param    pTemperatureRange the address of the structure holding the temperature range.
+* @exception PP_Result_Failed if any of the paramters is NULL, otherwise the return value from the dispatcher.
+*/
+int phm_start_thermal_controller(struct pp_hwmgr *hwmgr, struct PP_TemperatureRange *temperature_range)
+{
+
+	return phm_dispatch_table(hwmgr, &(hwmgr->start_thermal_controller), temperature_range, NULL);
+}
drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h +16 -0
index 1d29760..a868110 100644
@@ -29,6 +29,18 @@ struct pp_hwmgr;
 struct pp_hw_power_state;
 struct pp_power_state;
 enum amd_dpm_forced_level;
+struct PP_TemperatureRange;
+
+struct phm_fan_speed_info {
+	uint32_t min_percent;
+	uint32_t max_percent;
+	uint32_t min_rpm;
+	uint32_t max_rpm;
+	bool supports_percent_read;
+	bool supports_percent_write;
+	bool supports_rpm_read;
+	bool supports_rpm_write;
+};
 
 /* Automatic Power State Throttling */
 enum PHM_AutoThrottleSource
@@ -330,4 +342,8 @@ extern int phm_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 extern int phm_force_dpm_levels(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_level level);
 extern int phm_display_configuration_changed(struct pp_hwmgr *hwmgr);
 extern int phm_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr);
+extern int phm_register_thermal_interrupt(struct pp_hwmgr *hwmgr, const void *info);
+extern int phm_start_thermal_controller(struct pp_hwmgr *hwmgr, struct PP_TemperatureRange *temperature_range);
+extern int phm_stop_thermal_controller(struct pp_hwmgr *hwmgr);
 #endif /* _HARDWARE_MANAGER_H_ */
+
drivers/gpu/drm/amd/powerplay/inc/power_state.h +2 -2
index c63bcc7..a3f0ce4 100644
@@ -122,8 +122,8 @@ struct PP_StateSoftwareAlgorithmBlock {
  * Type to hold a temperature range.
  */
 struct PP_TemperatureRange {
-	uint16_t min;
-	uint16_t max;
+	uint32_t min;
+	uint32_t max;
 };
 
 struct PP_StateValidationBlock {
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#40 lore raw

PATCH 40/51 drm/amdgpu/powerplay: enable thermal interrupt task in eventmgr.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Add thermal handling to the event manager.

---
 .../gpu/drm/amd/powerplay/eventmgr/eventactionchains.c |  1 +
 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c     | 17 ++++++++++++++++-
 .../gpu/drm/amd/powerplay/eventmgr/eventsubchains.c    | 10 ++++++++++
 .../gpu/drm/amd/powerplay/eventmgr/eventsubchains.h    |  3 ++-
 drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c    | 18 ++++++++++++++++--
 drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h    |  3 +++
 6 files changed, 48 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/eventmgr/eventactionchains.c +1 -0
index e9fe85f..bbbb76c 100644
@@ -33,6 +33,7 @@ static const pem_event_action *initialize_event[] = {
 	enable_clock_power_gatings_tasks,
 	get_2d_performance_state_tasks,
 	set_performance_state_tasks,
+	initialize_thermal_controller_tasks,
 	conditionally_force_3d_performance_state_tasks,
 	process_vbios_eventinfo_tasks,
 	broadcast_power_policy_tasks,
drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c +16 -1
index 0438442..d5ec8cc 100644
@@ -22,6 +22,8 @@
  */
 #include "eventmgr.h"
 #include "eventinit.h"
+#include "ppinterrupt.h"
+#include "hardwaremanager.h"
 
 void pem_init_feature_info(struct pp_eventmgr *eventmgr)
 {
@@ -145,12 +147,25 @@ void pem_init_feature_info(struct pp_eventmgr *eventmgr)
 	eventmgr->features[PP_Feature_ViPG].enabled = false;
 }
 
+static int thermal_interrupt_callback(void *private_data,
+				      unsigned src_id, const uint32_t *iv_entry)
+{
+	/* TO DO hanle PEM_Event_ThermalNotification (struct pp_eventmgr *)private_data*/
+	printk("current thermal is out of range \n");
+	return 0;
+}
+
 int pem_register_interrupts(struct pp_eventmgr *eventmgr)
 {
 	int result = 0;
+	struct pp_interrupt_registration_info info;
+
+	info.call_back = thermal_interrupt_callback;
+	info.context = eventmgr;
+
+	result = phm_register_thermal_interrupt(eventmgr->hwmgr, &info);
 
 	/* TODO:
-	 * 1. Register thermal events interrupt
 	 * 2. Register CTF event interrupt
 	 * 3. Register for vbios events interrupt
 	 * 4. Register External Throttle Interrupt
drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c +10 -0
index e5dd86d..3dd671e 100644
@@ -393,3 +393,13 @@ const pem_event_action create_new_user_performance_state_tasks[] = {
 	pem_task_create_user_performance_state,
 	NULL
 };
+
+const pem_event_action initialize_thermal_controller_tasks[] = {
+	pem_task_initialize_thermal_controller,
+	NULL
+};
+
+const pem_event_action uninitialize_thermal_controller_tasks[] = {
+	pem_task_uninitialize_thermal_controller,
+	NULL
+};
drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.h +2 -1
index 27e0e61..741ebfc 100644
@@ -94,5 +94,6 @@ extern const pem_event_action enable_stutter_mode_tasks[];
 extern const pem_event_action enable_disable_bapm_tasks[];
 extern const pem_event_action reset_boot_state_tasks[];
 extern const pem_event_action create_new_user_performance_state_tasks[];
-
+extern const pem_event_action initialize_thermal_controller_tasks[];
+extern const pem_event_action uninitialize_thermal_controller_tasks[];
 #endif /* _EVENT_SUB_CHAINS_H_ */
drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c +16 -2
index 8ca3280..fdd67c6 100644
@@ -32,6 +32,9 @@
 #include "amd_powerplay.h"
 #include "psm.h"
 
+#define TEMP_RANGE_MIN (90 * 1000)
+#define TEMP_RANGE_MAX (120 * 1000)
+
 int pem_task_update_allowed_performance_levels(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data)
 {
 
@@ -104,8 +107,6 @@ int pem_task_unregister_interrupts(struct pp_eventmgr *eventmgr, struct pem_even
 	return pem_unregister_interrupts(eventmgr);
 }
 
-
-
 int pem_task_get_boot_state_id(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data)
 {
 	int result;
@@ -415,3 +416,16 @@ restart_search:
 	return -1;
 }
 
+int pem_task_initialize_thermal_controller(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data)
+{
+	struct PP_TemperatureRange range;
+	range.max = TEMP_RANGE_MAX;
+	range.min = TEMP_RANGE_MIN;
+
+	return phm_start_thermal_controller(eventmgr->hwmgr, &range);
+}
+
+int pem_task_uninitialize_thermal_controller(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data)
+{
+	return phm_stop_thermal_controller(eventmgr->hwmgr);
+}
\ No newline at end of file
drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h +3 -0
index 287c87c..6c6297e 100644
@@ -81,5 +81,8 @@ int pem_task_conditionally_force_3d_performance_state(struct pp_eventmgr *eventm
 int pem_task_get_2D_performance_state_id(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data);
 int pem_task_create_user_performance_state(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data);
 int pem_task_update_allowed_performance_levels(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data);
+/*thermal */
+int pem_task_initialize_thermal_controller(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data);
+int pem_task_uninitialize_thermal_controller(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data);
 
 #endif /* _EVENT_TASKS_H_ */
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#41 lore raw

PATCH 41/51 drm/amdgpu/powerplay: implement thermal control for tonga.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Implement thermal and fan control for tonga.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |   2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c  | 150 +++++-
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h  |   1 +
 .../gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c    | 587 +++++++++++++++++++++
 .../gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h    |  60 +++
 5 files changed, 798 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +1 -1
index 6f38811..cea032c 100644
@@ -6,7 +6,7 @@ HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
 	       hardwaremanager.o pp_acpi.o cz_hwmgr.o \
                cz_clockpowergating.o \
 	       tonga_processpptables.o ppatomctrl.o \
-               tonga_hwmgr.o 	pppcielanes.o \
+               tonga_hwmgr.o pppcielanes.o  tonga_thermal.o\
                fiji_powertune.o fiji_hwmgr.o tonga_clockpowergating.o
 
 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +149 -1

186 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h +1 -0
index d773d12..44b985a 100644
@@ -426,6 +426,7 @@ int tonga_update_vce_dpm(struct pp_hwmgr *hwmgr, const void *input);
 int tonga_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate);
 int tonga_enable_disable_uvd_dpm(struct pp_hwmgr *hwmgr, bool enable);
 int tonga_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable);
+uint32_t tonga_get_xclk(struct pp_hwmgr *hwmgr);
 
 #endif
 
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c new file +587 -0

587 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h new file +60 -0

60 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#42 lore raw

PATCH 42/51 drm/amdgpu/powerplay: implement fan control interface in amd_powerplay_funcs

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

This adds the interface needed to expose powerplay fan control to sysfs via hwmon.

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c     | 85 ++++++++++++++++++++++-
 drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h |  4 ++
 2 files changed, 88 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +84 -1
index 66ccfc0..10385c0 100644
@@ -428,9 +428,88 @@ pp_debugfs_print_current_performance_level(void *handle,
 	hwmgr->hwmgr_func->print_current_perforce_level(hwmgr, m);
 }
 
+static int pp_dpm_set_fan_control_mode(void *handle, uint32_t mode)
+{
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	  hwmgr->hwmgr_func->set_fan_control_mode == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->set_fan_control_mode(hwmgr, mode);
+}
+
+static int pp_dpm_get_fan_control_mode(void *handle)
+{
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	  hwmgr->hwmgr_func->get_fan_control_mode == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->get_fan_control_mode(hwmgr);
+}
+
+static int pp_dpm_set_fan_speed_percent(void *handle, uint32_t percent)
+{
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	  hwmgr->hwmgr_func->set_fan_speed_percent == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->set_fan_speed_percent(hwmgr, percent);
+}
+
+static int pp_dpm_get_fan_speed_percent(void *handle, uint32_t *speed)
+{
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	  hwmgr->hwmgr_func->get_fan_speed_percent == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->get_fan_speed_percent(hwmgr, speed);
+}
+
+static int pp_dpm_get_temperature(void *handle)
+{
+	struct pp_hwmgr  *hwmgr;
+
+	if (handle == NULL)
+		return -EINVAL;
+
+	hwmgr = ((struct pp_instance *)handle)->hwmgr;
+
+	if (hwmgr == NULL || hwmgr->hwmgr_func == NULL ||
+	  hwmgr->hwmgr_func->get_temperature == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->get_temperature(hwmgr);
+}
 
 const struct amd_powerplay_funcs pp_dpm_funcs = {
-	.get_temperature = NULL,
+	.get_temperature = pp_dpm_get_temperature,
 	.load_firmware = pp_dpm_load_fw,
 	.wait_for_fw_loading_complete = pp_dpm_fw_loading_complete,
 	.force_performance_level = pp_dpm_force_performance_level,
@@ -442,6 +521,10 @@ const struct amd_powerplay_funcs pp_dpm_funcs = {
 	.powergate_uvd = pp_dpm_powergate_uvd,
 	.dispatch_tasks = pp_dpm_dispatch_tasks,
 	.print_current_performance_level = pp_debugfs_print_current_performance_level,
+	.set_fan_control_mode = pp_dpm_set_fan_control_mode,
+	.get_fan_control_mode = pp_dpm_get_fan_control_mode,
+	.set_fan_speed_percent = pp_dpm_set_fan_speed_percent,
+	.get_fan_speed_percent = pp_dpm_get_fan_speed_percent,
 };
 
 static int amd_pp_instance_init(struct amd_pp_init *pp_init,
drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h +4 -0
index d81b239..40ded67 100644
@@ -187,6 +187,10 @@ struct amd_powerplay_funcs {
 				   void *input, void *output);
 	void (*print_current_performance_level)(void *handle,
 						      struct seq_file *m);
+	int (*set_fan_control_mode)(void *handle, uint32_t mode);
+	int (*get_fan_control_mode)(void *handle);
+	int (*set_fan_speed_percent)(void *handle, uint32_t percent);
+	int (*get_fan_speed_percent)(void *handle, uint32_t *speed);
 };
 
 struct amd_powerplay {
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#43 lore raw

PATCH 43/51 drm/amdgpu: export fan control functions to amdgpu

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Hook up the amdgpu thermal control callbacks for powerplay.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +25 -5
index 7e381c2..227d53e 100644
@@ -2210,7 +2210,6 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 #define amdgpu_display_resume_mc_access(adev, s) (adev)->mode_info.funcs->resume_mc_access((adev), (s))
 #define amdgpu_emit_copy_buffer(adev, ib, s, d, b) (adev)->mman.buffer_funcs->emit_copy_buffer((ib),  (s), (d), (b))
 #define amdgpu_emit_fill_buffer(adev, ib, s, d, b) (adev)->mman.buffer_funcs->emit_fill_buffer((ib), (s), (d), (b))
-#define amdgpu_dpm_get_temperature(adev) (adev)->pm.funcs->get_temperature((adev))
 #define amdgpu_dpm_pre_set_power_state(adev) (adev)->pm.funcs->pre_set_power_state((adev))
 #define amdgpu_dpm_set_power_state(adev) (adev)->pm.funcs->set_power_state((adev))
 #define amdgpu_dpm_post_set_power_state(adev) (adev)->pm.funcs->post_set_power_state((adev))
@@ -2218,10 +2217,31 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 #define amdgpu_dpm_print_power_state(adev, ps) (adev)->pm.funcs->print_power_state((adev), (ps))
 #define amdgpu_dpm_vblank_too_short(adev) (adev)->pm.funcs->vblank_too_short((adev))
 #define amdgpu_dpm_enable_bapm(adev, e) (adev)->pm.funcs->enable_bapm((adev), (e))
-#define amdgpu_dpm_set_fan_control_mode(adev, m) (adev)->pm.funcs->set_fan_control_mode((adev), (m))
-#define amdgpu_dpm_get_fan_control_mode(adev) (adev)->pm.funcs->get_fan_control_mode((adev))
-#define amdgpu_dpm_set_fan_speed_percent(adev, s) (adev)->pm.funcs->set_fan_speed_percent((adev), (s))
-#define amdgpu_dpm_get_fan_speed_percent(adev, s) (adev)->pm.funcs->get_fan_speed_percent((adev), (s))
+
+#define amdgpu_dpm_get_temperature(adev) \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->get_temperature((adev)->powerplay.pp_handle) : \
+		(adev)->pm.funcs->get_temperature((adev))
+
+#define amdgpu_dpm_set_fan_control_mode(adev, m) \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->set_fan_control_mode((adev)->powerplay.pp_handle, (m)) : \
+		(adev)->pm.funcs->set_fan_control_mode((adev), (m))
+
+#define amdgpu_dpm_get_fan_control_mode(adev) \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->get_fan_control_mode((adev)->powerplay.pp_handle) : \
+		(adev)->pm.funcs->get_fan_control_mode((adev))
+
+#define amdgpu_dpm_set_fan_speed_percent(adev, s) \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->set_fan_speed_percent((adev)->powerplay.pp_handle, (s)) : \
+		(adev)->pm.funcs->set_fan_speed_percent((adev), (s))
+
+#define amdgpu_dpm_get_fan_speed_percent(adev, s) \
+		amdgpu_powerplay ? \
+		(adev)->powerplay.pp_funcs->get_fan_speed_percent((adev)->powerplay.pp_handle, (s)) : \
+		(adev)->pm.funcs->get_fan_speed_percent((adev), (s))
 
 #define amdgpu_dpm_get_sclk(adev, l) \
 		amdgpu_powerplay ? \
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#44 lore raw

PATCH 44/51 drm/amdgpu: enable sysfs interface for powerplay

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Same interface exposed in pre-powerplay dpm code.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +11 -9
index 235fae5..40ae305 100644
@@ -184,10 +184,10 @@ static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
 	struct amdgpu_device *adev = dev_get_drvdata(dev);
 	int temp;
 
-	if (adev->pm.funcs->get_temperature)
-		temp = amdgpu_dpm_get_temperature(adev);
-	else
+	if (!amdgpu_powerplay && !adev->pm.funcs->get_temperature)
 		temp = 0;
+	else
+		temp = amdgpu_dpm_get_temperature(adev);
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", temp);
 }
@@ -215,8 +215,10 @@ static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev,
 	struct amdgpu_device *adev = dev_get_drvdata(dev);
 	u32 pwm_mode = 0;
 
-	if (adev->pm.funcs->get_fan_control_mode)
-		pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
+	if (!amdgpu_powerplay && !adev->pm.funcs->get_fan_control_mode)
+		return -EINVAL;
+
+	pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
 
 	/* never 0 (full-speed), fuse or smc-controlled always */
 	return sprintf(buf, "%i\n", pwm_mode == FDO_PWM_MODE_STATIC ? 1 : 2);
@@ -231,7 +233,7 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
 	int err;
 	int value;
 
-	if (!adev->pm.funcs->set_fan_control_mode)
+	if (!amdgpu_powerplay && !adev->pm.funcs->set_fan_control_mode)
 		return -EINVAL;
 
 	err = kstrtoint(buf, 10, &value);
@@ -328,9 +330,6 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
 	struct amdgpu_device *adev = dev_get_drvdata(dev);
 	umode_t effective_mode = attr->mode;
 
-	if (amdgpu_powerplay)
-		return 0;  /* to do */
-
 	/* Skip limit attributes if DPM is not enabled */
 	if (!adev->pm.dpm_enabled &&
 	    (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr ||
@@ -341,6 +340,9 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
 	     attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
 		return 0;
 
+	if (amdgpu_powerplay)
+		return effective_mode;
+
 	/* Skip fan attributes if fan is not present */
 	if (adev->pm.no_fan &&
 	    (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#45 lore raw

PATCH 45/51 drm/amdgpu: support per device powerplay enablement (v2)

In reply to Alex Deucher

From: Jammy Zhou <[email protected]>

The amdgu_powerplay variable is global for multiple GPU instances.

v2: fold in Flora's module option change, protect adev reference in macros

Change-Id I1d00f155f17702209b8f4101a25090b5ec42e37b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           | 71 ++++++++++++++-------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        | 30 +++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 15 +++---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c         |  4 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c        |  2 +-
 6 files changed, 65 insertions(+), 61 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +36 -35
index 227d53e..dcb7c87 100644
@@ -1992,6 +1992,7 @@ struct amdgpu_device {
 
 	/* powerplay */
 	struct amd_powerplay		powerplay;
+	bool				pp_enabled;
 
 	/* dpm */
 	struct amdgpu_pm		pm;
@@ -2219,68 +2220,68 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 #define amdgpu_dpm_enable_bapm(adev, e) (adev)->pm.funcs->enable_bapm((adev), (e))
 
 #define amdgpu_dpm_get_temperature(adev) \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->get_temperature((adev)->powerplay.pp_handle) : \
-		(adev)->pm.funcs->get_temperature((adev))
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->get_temperature((adev)->powerplay.pp_handle) : \
+	      (adev)->pm.funcs->get_temperature((adev))
 
 #define amdgpu_dpm_set_fan_control_mode(adev, m) \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->set_fan_control_mode((adev)->powerplay.pp_handle, (m)) : \
-		(adev)->pm.funcs->set_fan_control_mode((adev), (m))
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->set_fan_control_mode((adev)->powerplay.pp_handle, (m)) : \
+	      (adev)->pm.funcs->set_fan_control_mode((adev), (m))
 
 #define amdgpu_dpm_get_fan_control_mode(adev) \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->get_fan_control_mode((adev)->powerplay.pp_handle) : \
-		(adev)->pm.funcs->get_fan_control_mode((adev))
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->get_fan_control_mode((adev)->powerplay.pp_handle) : \
+	      (adev)->pm.funcs->get_fan_control_mode((adev))
 
 #define amdgpu_dpm_set_fan_speed_percent(adev, s) \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->set_fan_speed_percent((adev)->powerplay.pp_handle, (s)) : \
-		(adev)->pm.funcs->set_fan_speed_percent((adev), (s))
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->set_fan_speed_percent((adev)->powerplay.pp_handle, (s)) : \
+	      (adev)->pm.funcs->set_fan_speed_percent((adev), (s))
 
 #define amdgpu_dpm_get_fan_speed_percent(adev, s) \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->get_fan_speed_percent((adev)->powerplay.pp_handle, (s)) : \
-		(adev)->pm.funcs->get_fan_speed_percent((adev), (s))
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->get_fan_speed_percent((adev)->powerplay.pp_handle, (s)) : \
+	      (adev)->pm.funcs->get_fan_speed_percent((adev), (s))
 
 #define amdgpu_dpm_get_sclk(adev, l) \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->get_sclk((adev)->powerplay.pp_handle, (l)) : \
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->get_sclk((adev)->powerplay.pp_handle, (l)) : \
 		(adev)->pm.funcs->get_sclk((adev), (l))
 
 #define amdgpu_dpm_get_mclk(adev, l)  \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->get_mclk((adev)->powerplay.pp_handle, (l)) : \
-		(adev)->pm.funcs->get_mclk((adev), (l))
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->get_mclk((adev)->powerplay.pp_handle, (l)) : \
+	      (adev)->pm.funcs->get_mclk((adev), (l))
 
 
 #define amdgpu_dpm_force_performance_level(adev, l) \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->force_performance_level((adev)->powerplay.pp_handle, (l)) : \
-		(adev)->pm.funcs->force_performance_level((adev), (l))
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->force_performance_level((adev)->powerplay.pp_handle, (l)) : \
+	      (adev)->pm.funcs->force_performance_level((adev), (l))
 
 #define amdgpu_dpm_powergate_uvd(adev, g) \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->powergate_uvd((adev)->powerplay.pp_handle, (g)) : \
-		(adev)->pm.funcs->powergate_uvd((adev), (g))
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->powergate_uvd((adev)->powerplay.pp_handle, (g)) : \
+	      (adev)->pm.funcs->powergate_uvd((adev), (g))
 
 #define amdgpu_dpm_powergate_vce(adev, g) \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->powergate_vce((adev)->powerplay.pp_handle, (g)) : \
-		(adev)->pm.funcs->powergate_vce((adev), (g))
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->powergate_vce((adev)->powerplay.pp_handle, (g)) : \
+	      (adev)->pm.funcs->powergate_vce((adev), (g))
 
 #define amdgpu_dpm_debugfs_print_current_performance_level(adev, m) \
-		amdgpu_powerplay ? \
-		(adev)->powerplay.pp_funcs->print_current_performance_level((adev)->powerplay.pp_handle, (m)) : \
-		(adev)->pm.funcs->debugfs_print_current_performance_level((adev), (m))
+	(adev)->pp_enabled ?						\
+	      (adev)->powerplay.pp_funcs->print_current_performance_level((adev)->powerplay.pp_handle, (m)) : \
+	      (adev)->pm.funcs->debugfs_print_current_performance_level((adev), (m))
 
 #define amdgpu_dpm_get_current_power_state(adev) \
-		(adev)->powerplay.pp_funcs->get_current_power_state((adev)->powerplay.pp_handle)
+	(adev)->powerplay.pp_funcs->get_current_power_state((adev)->powerplay.pp_handle)
 
 #define amdgpu_dpm_get_performance_level(adev) \
-		(adev)->powerplay.pp_funcs->get_performance_level((adev)->powerplay.pp_handle)
+	(adev)->powerplay.pp_funcs->get_performance_level((adev)->powerplay.pp_handle)
 
-#define amdgpu_dpm_dispatch_task(adev, event_id, input, output) \
+#define amdgpu_dpm_dispatch_task(adev, event_id, input, output)		\
 	(adev)->powerplay.pp_funcs->dispatch_tasks((adev)->powerplay.pp_handle, (event_id), (input), (output))
 
 #define amdgpu_gds_switch(adev, r, v, d, w, a) (adev)->gds.funcs->patch_gds_switch((r), (v), (d), (w), (a))
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -2
index fe11a29..39a26c8 100644
@@ -82,7 +82,7 @@ int amdgpu_enable_scheduler = 1;
 int amdgpu_sched_jobs = 16;
 int amdgpu_sched_hw_submission = 2;
 int amdgpu_enable_semaphores = 0;
-int amdgpu_powerplay = 0;
+int amdgpu_powerplay = -1;
 
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
 module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
@@ -166,7 +166,7 @@ MODULE_PARM_DESC(enable_semaphores, "Enable semaphores (1 = enable, 0 = disable
 module_param_named(enable_semaphores, amdgpu_enable_semaphores, int, 0644);
 
 #ifdef CONFIG_DRM_AMD_POWERPLAY
-MODULE_PARM_DESC(powerplay, "Powerplay component (1 = enable, 0 = disable (default))");
+MODULE_PARM_DESC(powerplay, "Powerplay component (1 = enable, 0 = disable, -1 = auto (default))");
 module_param_named(powerplay, amdgpu_powerplay, int, 0444);
 #endif
 
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +15 -15
index 40ae305..3b78982 100644
@@ -36,7 +36,7 @@ static int amdgpu_debugfs_pm_init(struct amdgpu_device *adev);
 
 void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev)
 {
-	if (amdgpu_powerplay)
+	if (adev->pp_enabled)
 		/* TODO */
 		return;
 
@@ -60,7 +60,7 @@ static ssize_t amdgpu_get_dpm_state(struct device *dev,
 	struct amdgpu_device *adev = ddev->dev_private;
 	enum amd_pm_state_type pm;
 
-	if (amdgpu_powerplay) {
+	if (adev->pp_enabled) {
 		pm = amdgpu_dpm_get_current_power_state(adev);
 	} else
 		pm = adev->pm.dpm.user_state;
@@ -90,7 +90,7 @@ static ssize_t amdgpu_set_dpm_state(struct device *dev,
 		goto fail;
 	}
 
-	if (amdgpu_powerplay) {
+	if (adev->pp_enabled) {
 		amdgpu_dpm_dispatch_task(adev, AMD_PP_EVENT_ENABLE_USER_STATE, &state, NULL);
 	} else {
 		mutex_lock(&adev->pm.mutex);
@@ -113,7 +113,7 @@ static ssize_t amdgpu_get_dpm_forced_performance_level(struct device *dev,
 	struct drm_device *ddev = dev_get_drvdata(dev);
 	struct amdgpu_device *adev = ddev->dev_private;
 
-	if (amdgpu_powerplay) {
+	if (adev->pp_enabled) {
 		enum amd_dpm_forced_level level;
 
 		level = amdgpu_dpm_get_performance_level(adev);
@@ -151,7 +151,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
 		goto fail;
 	}
 
-	if (amdgpu_powerplay)
+	if (adev->pp_enabled)
 		amdgpu_dpm_force_performance_level(adev, level);
 	else {
 		mutex_lock(&adev->pm.mutex);
@@ -184,7 +184,7 @@ static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
 	struct amdgpu_device *adev = dev_get_drvdata(dev);
 	int temp;
 
-	if (!amdgpu_powerplay && !adev->pm.funcs->get_temperature)
+	if (!adev->pp_enabled && !adev->pm.funcs->get_temperature)
 		temp = 0;
 	else
 		temp = amdgpu_dpm_get_temperature(adev);
@@ -215,7 +215,7 @@ static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev,
 	struct amdgpu_device *adev = dev_get_drvdata(dev);
 	u32 pwm_mode = 0;
 
-	if (!amdgpu_powerplay && !adev->pm.funcs->get_fan_control_mode)
+	if (!adev->pp_enabled && !adev->pm.funcs->get_fan_control_mode)
 		return -EINVAL;
 
 	pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
@@ -233,7 +233,7 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
 	int err;
 	int value;
 
-	if (!amdgpu_powerplay && !adev->pm.funcs->set_fan_control_mode)
+	if (!adev->pp_enabled && !adev->pm.funcs->set_fan_control_mode)
 		return -EINVAL;
 
 	err = kstrtoint(buf, 10, &value);
@@ -340,7 +340,7 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
 	     attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
 		return 0;
 
-	if (amdgpu_powerplay)
+	if (adev->pp_enabled)
 		return effective_mode;
 
 	/* Skip fan attributes if fan is not present */
@@ -674,7 +674,7 @@ done:
 
 void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable)
 {
-	if (amdgpu_powerplay)
+	if (adev->pp_enabled)
 		amdgpu_dpm_powergate_uvd(adev, !enable);
 	else {
 		if (adev->pm.funcs->powergate_uvd) {
@@ -701,7 +701,7 @@ void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable)
 
 void amdgpu_dpm_enable_vce(struct amdgpu_device *adev, bool enable)
 {
-	if (amdgpu_powerplay)
+	if (adev->pp_enabled)
 		amdgpu_dpm_powergate_vce(adev, !enable);
 	else {
 		if (adev->pm.funcs->powergate_vce) {
@@ -729,7 +729,7 @@ void amdgpu_pm_print_power_states(struct amdgpu_device *adev)
 {
 	int i;
 
-	if (amdgpu_powerplay)
+	if (adev->pp_enabled)
 		/* TO DO */
 		return;
 
@@ -745,7 +745,7 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
 	if (adev->pm.sysfs_initialized)
 		return 0;
 
-	if (!amdgpu_powerplay) {
+	if (!adev->pp_enabled) {
 		if (adev->pm.funcs->get_temperature == NULL)
 			return 0;
 	}
@@ -798,7 +798,7 @@ void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
 	if (!adev->pm.dpm_enabled)
 		return;
 
-	if (amdgpu_powerplay) {
+	if (adev->pp_enabled) {
 		int i = 0;
 
 		amdgpu_display_bandwidth_update(adev);
@@ -852,7 +852,7 @@ static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data)
 		seq_printf(m, "dpm not enabled\n");
 		return 0;
 	}
-	if (amdgpu_powerplay) {
+	if (adev->pp_enabled) {
 		amdgpu_dpm_debugfs_print_current_performance_level(adev, m);
 	} else {
 		mutex_lock(&adev->pm.mutex);
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +9 -6
index 1ff6fd5..6b46fbf 100644
@@ -40,7 +40,7 @@ static int amdgpu_powerplay_init(struct amdgpu_device *adev)
 
 	amd_pp = &(adev->powerplay);
 
-	if (amdgpu_powerplay) {
+	if (adev->pp_enabled) {
 #ifdef CONFIG_DRM_AMD_POWERPLAY
 		struct amd_pp_init *pp_init;
 
@@ -100,11 +100,14 @@ static int amdgpu_pp_early_init(void *handle)
 	switch (adev->asic_type) {
 		case CHIP_TONGA:
 		case CHIP_FIJI:
-			amdgpu_powerplay = 1;
+			adev->pp_enabled = (amdgpu_powerplay == 0) ? false : true;
 			break;
 		default:
+			adev->pp_enabled = (amdgpu_powerplay > 0) ? true : false;
 			break;
 	}
+#else
+	adev->pp_enabled = false;
 #endif
 
 	ret = amdgpu_powerplay_init(adev);
@@ -127,7 +130,7 @@ static int amdgpu_pp_sw_init(void *handle)
 					adev->powerplay.pp_handle);
 
 #ifdef CONFIG_DRM_AMD_POWERPLAY
-	if (amdgpu_powerplay) {
+	if (adev->pp_enabled) {
 		adev->pm.dpm_enabled = true;
 		amdgpu_pm_sysfs_init(adev);
 	}
@@ -148,7 +151,7 @@ static int amdgpu_pp_sw_fini(void *handle)
 		return ret;
 
 #ifdef CONFIG_DRM_AMD_POWERPLAY
-	if (amdgpu_powerplay) {
+	if (adev->pp_enabled) {
 		amdgpu_pm_sysfs_fini(adev);
 		amd_powerplay_fini(adev->powerplay.pp_handle);
 	}
@@ -162,7 +165,7 @@ static int amdgpu_pp_hw_init(void *handle)
 	int ret = 0;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-	if (amdgpu_powerplay && adev->firmware.smu_load)
+	if (adev->pp_enabled && adev->firmware.smu_load)
 		amdgpu_ucode_init_bo(adev);
 
 	if (adev->powerplay.ip_funcs->hw_init)
@@ -181,7 +184,7 @@ static int amdgpu_pp_hw_fini(void *handle)
 		ret = adev->powerplay.ip_funcs->hw_fini(
 					adev->powerplay.pp_handle);
 
-	if (amdgpu_powerplay && adev->firmware.smu_load)
+	if (adev->pp_enabled && adev->firmware.smu_load)
 		amdgpu_ucode_fini_bo(adev);
 
 	return ret;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
index 1528987..efdacbf 100644
@@ -2797,7 +2797,7 @@ static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev)
 
 	gfx_v8_0_rlc_reset(adev);
 
-	if (!amdgpu_powerplay) {
+	if (!adev->pp_enabled) {
 		if (!adev->firmware.smu_load) {
 			/* legacy rlc firmware loading */
 			r = gfx_v8_0_rlc_load_microcode(adev);
@@ -3694,7 +3694,7 @@ static int gfx_v8_0_cp_resume(struct amdgpu_device *adev)
 	if (!(adev->flags & AMD_IS_APU))
 		gfx_v8_0_enable_gui_idle_interrupt(adev, false);
 
-	if (!amdgpu_powerplay) {
+	if (!adev->pp_enabled) {
 		if (!adev->firmware.smu_load) {
 			/* legacy firmware loading */
 			r = gfx_v8_0_cp_gfx_load_microcode(adev);
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
index 8091c1c..c741c09 100644
@@ -727,7 +727,7 @@ static int sdma_v3_0_start(struct amdgpu_device *adev)
 {
 	int r, i;
 
-	if (!amdgpu_powerplay) {
+	if (!adev->pp_enabled) {
 		if (!adev->firmware.smu_load) {
 			r = sdma_v3_0_load_microcode(adev);
 			if (r)
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#46 lore raw

PATCH 46/51 drm/amd/powerplay: add and export hwmgr interface to eventmgr to check hw states.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Interface between hwmgr and eventmgr.

---
 .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c   | 21 +++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h |  8 ++++++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h           |  5 +++++
 3 files changed, 34 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +21 -0
index 9d910f3..f2d603c 100644
@@ -223,3 +223,24 @@ int phm_start_thermal_controller(struct pp_hwmgr *hwmgr, struct PP_TemperatureRa
 
 	return phm_dispatch_table(hwmgr, &(hwmgr->start_thermal_controller), temperature_range, NULL);
 }
+
+
+bool phm_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr)
+{
+	if (hwmgr == NULL || hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration(hwmgr);
+}
+
+
+int phm_check_states_equal(struct pp_hwmgr *hwmgr,
+				 const struct pp_hw_power_state *pstate1,
+				 const struct pp_hw_power_state *pstate2,
+				 bool *equal)
+{
+	if (hwmgr == NULL || hwmgr->hwmgr_func->check_states_equal == NULL)
+		return -EINVAL;
+
+	return hwmgr->hwmgr_func->check_states_equal(hwmgr, pstate1, pstate2, equal);
+}
drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h +8 -0
index a868110..a3f7bd2 100644
@@ -322,6 +322,7 @@ struct phm_clocks {
 	uint32_t num_of_entries;
 	uint32_t clock[MAX_NUM_CLOCKS];
 };
+
 extern int phm_enable_clock_power_gatings(struct pp_hwmgr *hwmgr);
 extern int phm_powergate_uvd(struct pp_hwmgr *hwmgr, bool gate);
 extern int phm_powergate_vce(struct pp_hwmgr *hwmgr, bool gate);
@@ -345,5 +346,12 @@ extern int phm_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hw
 extern int phm_register_thermal_interrupt(struct pp_hwmgr *hwmgr, const void *info);
 extern int phm_start_thermal_controller(struct pp_hwmgr *hwmgr, struct PP_TemperatureRange *temperature_range);
 extern int phm_stop_thermal_controller(struct pp_hwmgr *hwmgr);
+extern bool phm_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr);
+
+extern int phm_check_states_equal(struct pp_hwmgr *hwmgr,
+				 const struct pp_hw_power_state *pstate1,
+				 const struct pp_hw_power_state *pstate2,
+				 bool *equal);
+
 #endif /* _HARDWARE_MANAGER_H_ */
 
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +5 -0
index aedb1e4..5b5c94d 100644
@@ -307,6 +307,11 @@ struct pp_hwmgr_func {
 	int (*uninitialize_thermal_controller)(struct pp_hwmgr *hwmgr);
 	int (*register_internal_thermal_interrupt)(struct pp_hwmgr *hwmgr,
 					const void *thermal_interrupt_info);
+	bool (*check_smc_update_required_for_display_configuration)(struct pp_hwmgr *hwmgr);
+	int (*check_states_equal)(struct pp_hwmgr *hwmgr,
+					const struct pp_hw_power_state *pstate1,
+					const struct pp_hw_power_state *pstate2,
+					bool *equal);
 };
 
 struct pp_table_func {
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#47 lore raw

PATCH 47/51 drm/amd/powerplay: implement new funcs to check current states for tonga.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Implement the new callbacks for tonga.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 62 +++++++++++++++++++++++
 1 file changed, 62 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +62 -0
index 088b5bf..9a1e8bf 100644
@@ -5935,6 +5935,66 @@ int tonga_register_internal_thermal_interrupt(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+bool tonga_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr)
+{
+	struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
+	bool is_update_required = false;
+	struct cgs_display_info info = {0,0,NULL};
+
+	cgs_get_active_displays_info(hwmgr->device, &info);
+
+	if (data->display_timing.num_existing_displays != info.display_count)
+		is_update_required = true;
+/* TO DO NEED TO GET DEEP SLEEP CLOCK FROM DAL
+	if (phm_cap_enabled(hwmgr->hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) {
+		cgs_get_min_clock_settings(hwmgr->device, &min_clocks);
+		if(min_clocks.engineClockInSR != data->display_timing.minClockInSR)
+			is_update_required = true;
+*/
+	return is_update_required;
+}
+
+static inline bool tonga_are_power_levels_equal(const struct tonga_performance_level *pl1,
+							   const struct tonga_performance_level *pl2)
+{
+	return ((pl1->memory_clock == pl2->memory_clock) &&
+		  (pl1->engine_clock == pl2->engine_clock) &&
+		  (pl1->pcie_gen == pl2->pcie_gen) &&
+		  (pl1->pcie_lane == pl2->pcie_lane));
+}
+
+int tonga_check_states_equal(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *pstate1, const struct pp_hw_power_state *pstate2, bool *equal)
+{
+	const struct tonga_power_state *psa = cast_const_phw_tonga_power_state(pstate1);
+	const struct tonga_power_state *psb = cast_const_phw_tonga_power_state(pstate2);
+	int i;
+
+	if (pstate1 == NULL || pstate2 == NULL || equal == NULL)
+		return -EINVAL;
+
+	/* If the two states don't even have the same number of performance levels they cannot be the same state. */
+	if (psa->performance_level_count != psb->performance_level_count) {
+		*equal = false;
+		return 0;
+	}
+
+	for (i = 0; i < psa->performance_level_count; i++) {
+		if (!tonga_are_power_levels_equal(&(psa->performance_levels[i]), &(psb->performance_levels[i]))) {
+			/* If we have found even one performance level pair that is different the states are different. */
+			*equal = false;
+			return 0;
+		}
+	}
+
+	/* If all performance levels are the same try to use the UVD clocks to break the tie.*/
+	*equal = ((psa->uvd_clocks.VCLK == psb->uvd_clocks.VCLK) && (psa->uvd_clocks.DCLK == psb->uvd_clocks.DCLK));
+	*equal &= ((psa->vce_clocks.EVCLK == psb->vce_clocks.EVCLK) && (psa->vce_clocks.ECCLK == psb->vce_clocks.ECCLK));
+	*equal &= (psa->sclk_threshold == psb->sclk_threshold);
+	*equal &= (psa->acp_clk == psb->acp_clk);
+
+	return 0;
+}
+
 static const struct pp_hwmgr_func tonga_hwmgr_funcs = {
 	.backend_init = &tonga_hwmgr_backend_init,
 	.backend_fini = &tonga_hwmgr_backend_fini,
@@ -5968,6 +6028,8 @@ static const struct pp_hwmgr_func tonga_hwmgr_funcs = {
 	.set_fan_speed_rpm = tonga_fan_ctrl_set_fan_speed_rpm,
 	.uninitialize_thermal_controller = tonga_thermal_ctrl_uninitialize_thermal_controller,
 	.register_internal_thermal_interrupt = tonga_register_internal_thermal_interrupt,
+	.check_smc_update_required_for_display_configuration = tonga_check_smc_update_required_for_display_configuration,
+	.check_states_equal = tonga_check_states_equal,
 };
 
 int tonga_hwmgr_init(struct pp_hwmgr *hwmgr)
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#48 lore raw

PATCH 48/51 drm/amd/powerplay: refine the logic of whether need to update power state.

In reply to Alex Deucher

From: Rex Zhu <[email protected]>

Better handle power state changes.

---
 drivers/gpu/drm/amd/powerplay/eventmgr/psm.c | 13 ++++++++++---
 drivers/gpu/drm/amd/powerplay/eventmgr/psm.h |  1 +
 2 files changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/eventmgr/psm.c +10 -3
index 08b75bd..82774ac 100644
@@ -86,9 +86,10 @@ int psm_set_performance_states(struct pp_eventmgr *eventmgr, unsigned long *stat
 int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip)
 {
 
-	const struct pp_power_state  *pcurrent;
-	struct pp_power_state  *requested;
+	struct pp_power_state *pcurrent;
+	struct pp_power_state *requested;
 	struct pp_hwmgr *hwmgr;
+	bool equal;
 
 	if (skip)
 		return 0;
@@ -97,7 +98,13 @@ int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip)
 	pcurrent = hwmgr->current_ps;
 	requested = hwmgr->request_ps;
 
-	if ((pcurrent != NULL || requested != NULL) && (pcurrent != requested)) {
+	if (requested == NULL)
+		return 0;
+
+	if (pcurrent == NULL || (0 != phm_check_states_equal(hwmgr, &pcurrent->hardware, &requested->hardware, &equal)))
+		equal = false;
+
+	if (!equal || phm_check_smc_update_required_for_display_configuration(hwmgr)) {
 		phm_apply_state_adjust_rules(hwmgr, requested, pcurrent);
 		phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware);
 		hwmgr->current_ps = requested;
drivers/gpu/drm/amd/powerplay/eventmgr/psm.h +1 -0
index 15abfac..1380470 100644
@@ -25,6 +25,7 @@
 #include "eventmanagement.h"
 #include "eventmanager.h"
 #include "power_state.h"
+#include "hardwaremanager.h"
 
 int psm_get_ui_state(struct pp_eventmgr *eventmgr, enum PP_StateUILabel ui_label, unsigned long *state_id);
 
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#49 lore raw

PATCH 49/51 drm/amd/powerplay/tonga: enable pcie and mclk forcing for low

In reply to Alex Deucher

When forcing the lowest state also force mclk and pcie.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 48 +++++++++++++++++------
 1 file changed, 37 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +37 -11
index 9a1e8bf..a9cc786 100644
@@ -3279,7 +3279,7 @@ int tonga_force_dpm_highest(struct pp_hwmgr *hwmgr)
 				if (PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
 					TARGET_AND_CURRENT_PROFILE_INDEX, CURR_MCLK_INDEX) != level)
 					printk(KERN_ERR "[ powerplay ] Target_and_current_Profile_Index. \
-						Curr_Sclk_Index does not match the level \n");
+						Curr_Mclk_Index does not match the level \n");
 			}
 		}
 	}
@@ -3424,21 +3424,47 @@ static uint32_t tonga_get_lowest_enable_level(
 
 static int tonga_force_dpm_lowest(struct pp_hwmgr *hwmgr)
 {
-	uint32_t level = 0;
+	uint32_t level;
 	tonga_hwmgr *data = (tonga_hwmgr *)(hwmgr->backend);
 
-	/* for now force only sclk */
-	if (0 != data->dpm_level_enable_mask.sclk_dpm_enable_mask) {
-		level = tonga_get_lowest_enable_level(hwmgr,
-					data->dpm_level_enable_mask.sclk_dpm_enable_mask);
+	if (0 == data->pcie_dpm_key_disabled) {
+		/* PCIE */
+		if (data->dpm_level_enable_mask.pcie_dpm_enable_mask != 0) {
+			level = tonga_get_lowest_enable_level(hwmgr,
+							      data->dpm_level_enable_mask.pcie_dpm_enable_mask);
+			PP_ASSERT_WITH_CODE((0 == tonga_dpm_force_state_pcie(hwmgr, level)),
+					    "force lowest pcie dpm state failed!", return -1);
+		}
+	}
+
+	if (0 == data->sclk_dpm_key_disabled) {
+		/* SCLK */
+		if (0 != data->dpm_level_enable_mask.sclk_dpm_enable_mask) {
+			level = tonga_get_lowest_enable_level(hwmgr,
+							      data->dpm_level_enable_mask.sclk_dpm_enable_mask);
 
-		PP_ASSERT_WITH_CODE((0 == tonga_dpm_force_state(hwmgr, level)),
-			"force sclk dpm state failed!", return -1);
+			PP_ASSERT_WITH_CODE((0 == tonga_dpm_force_state(hwmgr, level)),
+					    "force sclk dpm state failed!", return -1);
 
-		if (PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device,
-			CGS_IND_REG__SMC, TARGET_AND_CURRENT_PROFILE_INDEX, CURR_SCLK_INDEX) != level)
-			printk(KERN_ERR "[ powerplay ] Target_and_current_Profile_Index.	\
+			if (PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device,
+							 CGS_IND_REG__SMC, TARGET_AND_CURRENT_PROFILE_INDEX, CURR_SCLK_INDEX) != level)
+				printk(KERN_ERR "[ powerplay ] Target_and_current_Profile_Index.	\
 				Curr_Sclk_Index does not match the level \n");
+		}
+	}
+
+	if (0 == data->mclk_dpm_key_disabled) {
+		/* MCLK */
+		if (data->dpm_level_enable_mask.mclk_dpm_enable_mask != 0) {
+			level = tonga_get_lowest_enable_level(hwmgr,
+							      data->dpm_level_enable_mask.mclk_dpm_enable_mask);
+			PP_ASSERT_WITH_CODE((0 == tonga_dpm_force_state_mclk(hwmgr, level)),
+					    "force lowest mclk dpm state failed!", return -1);
+			if (PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
+							 TARGET_AND_CURRENT_PROFILE_INDEX, CURR_MCLK_INDEX) != level)
+				printk(KERN_ERR "[ powerplay ] Target_and_current_Profile_Index. \
+						Curr_Mclk_Index does not match the level \n");
+		}
 	}
 
 	return 0;
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#50 lore raw

PATCH 50/51 drm/amd/powerplay/fiji: enable pcie and mclk forcing for low

In reply to Alex Deucher

When forcing the lowest state also force mclk and pcie.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 30 ++++++++++++++++++++----
 1 file changed, 25 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +25 -5
index 4457878..adcc2f0 100644
@@ -3576,18 +3576,38 @@ static int fiji_force_dpm_lowest(struct pp_hwmgr *hwmgr)
 {
 	struct fiji_hwmgr *data =
 			(struct fiji_hwmgr *)(hwmgr->backend);
-	uint32_t level = 0;
+	uint32_t level;
 
-	/* Only force sclk for now */
 	if (!data->sclk_dpm_key_disabled)
 		if (data->dpm_level_enable_mask.sclk_dpm_enable_mask) {
 			level = fiji_get_lowest_enabled_level(hwmgr,
-					data->dpm_level_enable_mask.sclk_dpm_enable_mask);
+							      data->dpm_level_enable_mask.sclk_dpm_enable_mask);
 			smum_send_msg_to_smc_with_parameter(hwmgr->smumgr,
-					PPSMC_MSG_SCLKDPM_SetEnabledMask,
-					(1 << level));
+							    PPSMC_MSG_SCLKDPM_SetEnabledMask,
+							    (1 << level));
+
+	}
+
+	if (!data->mclk_dpm_key_disabled) {
+		if (data->dpm_level_enable_mask.mclk_dpm_enable_mask) {
+			level = fiji_get_lowest_enabled_level(hwmgr,
+							      data->dpm_level_enable_mask.mclk_dpm_enable_mask);
+			smum_send_msg_to_smc_with_parameter(hwmgr->smumgr,
+							    PPSMC_MSG_MCLKDPM_SetEnabledMask,
+							    (1 << level));
+		}
+	}
 
+	if (!data->pcie_dpm_key_disabled) {
+		if (data->dpm_level_enable_mask.pcie_dpm_enable_mask) {
+			level = fiji_get_lowest_enabled_level(hwmgr,
+							      data->dpm_level_enable_mask.pcie_dpm_enable_mask);
+			smum_send_msg_to_smc_with_parameter(hwmgr->smumgr,
+							    PPSMC_MSG_PCIeDPM_ForceLevel,
+							    (1 << level));
+		}
 	}
+
 	return 0;
 
 }
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#51 lore raw

PATCH 51/51 drm/amdgpu: extract pcie helpers to common header

In reply to Alex Deucher

These will be used by multiple powerplay drivers and other IP modules.

---
 drivers/gpu/drm/amd/include/amd_pcie.h            |  50 ++++++++
 drivers/gpu/drm/amd/include/amd_pcie_helpers.h    | 141 ++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c  |   1 +
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h  |   2 -
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 112 +----------------
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h |  24 ----
 6 files changed, 193 insertions(+), 137 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/include/amd_pcie.h
 create mode 100644 drivers/gpu/drm/amd/include/amd_pcie_helpers.h
drivers/gpu/drm/amd/include/amd_pcie.h new file +50 -0
new file mode 100644
index 0000000..7c2a916
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __AMD_PCIE_H__
+#define __AMD_PCIE_H__
+
+/* Following flags shows PCIe link speed supported in driver which are decided by chipset and ASIC */
+#define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1        0x00010000
+#define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2        0x00020000
+#define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3        0x00040000
+#define CAIL_PCIE_LINK_SPEED_SUPPORT_MASK        0xFFFF0000
+#define CAIL_PCIE_LINK_SPEED_SUPPORT_SHIFT       16
+
+/* Following flags shows PCIe link speed supported by ASIC H/W.*/
+#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1   0x00000001
+#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2   0x00000002
+#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3   0x00000004
+#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_MASK   0x0000FFFF
+#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_SHIFT  0
+
+/* Following flags shows PCIe lane width switch supported in driver which are decided by chipset and ASIC */
+#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X1          0x00010000
+#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X2          0x00020000
+#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X4          0x00040000
+#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X8          0x00080000
+#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X12         0x00100000
+#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X16         0x00200000
+#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X32         0x00400000
+#define CAIL_PCIE_LINK_WIDTH_SUPPORT_SHIFT       16
+
+#endif
drivers/gpu/drm/amd/include/amd_pcie_helpers.h new file +141 -0

141 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +1 -0
index adcc2f0..ccbdbef 100644
@@ -49,6 +49,7 @@
 #include "tonga_pptable.h"
 #include "pp_debug.h"
 #include "pp_acpi.h"
+#include "amd_pcie_helpers.h"
 
 #define VOLTAGE_SCALE	4
 #define SMC_RAM_END		0x40000
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h +0 -2
index 38dbe49..22d985e 100644
@@ -339,8 +339,6 @@ enum Fiji_I2CLineID {
 extern int tonga_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwmgr);
 extern int tonga_hwmgr_backend_fini(struct pp_hwmgr *hwmgr);
 extern int tonga_get_mc_microcode_version (struct pp_hwmgr *hwmgr);
-extern uint16_t get_pcie_gen_support(uint32_t pcie_link_speed_cap, uint16_t ns_pcie_gen);
-extern uint16_t get_pcie_lane_support(uint32_t pcie_lane_width_cap, uint16_t ns_pcie_lanes);
 
 #define PP_HOST_TO_SMC_UL(X) cpu_to_be32(X)
 #define PP_SMC_TO_HOST_UL(X) be32_to_cpu(X)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +1 -111

124 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h +0 -24
index 44b985a..49168d2 100644
@@ -386,30 +386,6 @@ typedef struct tonga_hwmgr tonga_hwmgr;
 
 #define TONGA_UNUSED_GPIO_PIN                        0x7F
 
-/* Following flags shows PCIe link speed supported in driver which are decided by chipset and ASIC */
-#define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1        0x00010000
-#define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2        0x00020000
-#define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3        0x00040000
-#define CAIL_PCIE_LINK_SPEED_SUPPORT_MASK        0xFFFF0000
-#define CAIL_PCIE_LINK_SPEED_SUPPORT_SHIFT       16
-
-/* Following flags shows PCIe link speed supported by ASIC H/W.*/
-#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1   0x00000001
-#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2   0x00000002
-#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3   0x00000004
-#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_MASK   0x0000FFFF
-#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_SHIFT  0
-
-/* Following flags shows PCIe lane width switch supported in driver which are decided by chipset and ASIC */
-#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X1          0x00010000
-#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X2          0x00020000
-#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X4          0x00040000
-#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X8          0x00080000
-#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X12         0x00100000
-#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X16         0x00200000
-#define CAIL_PCIE_LINK_WIDTH_SUPPORT_X32         0x00400000
-#define CAIL_PCIE_LINK_WIDTH_SUPPORT_SHIFT       16
-
 #define PP_HOST_TO_SMC_UL(X) cpu_to_be32(X)
 #define PP_SMC_TO_HOST_UL(X) be32_to_cpu(X)
 
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#52 lore raw
In reply to Alex Deucher
Quoted 11 lines · Alex Deucher

This patch set adds preliminary powerplay support for amdgpu. The aim of this patch set is to eventually replace the existing dpm support for VI parts. Support for Tonga, Fiji, and VI APUs is included. The same sysfs and debugfs interfaces are supported so it's configured the same way as previous asics.

You can force it on or off via the powerplay module parameter. It is enabled by default for Tonga and Fiji.

The patches are also available here:
http://cgit.freedesktop.org/~agd5f/linux/log/?h=amdgpu-powerplay

Eureka, we finally have that out.

Since I wasn't involved into this the whole set is Acked-by: Christian König <[email protected]>

Quoted 285 lines

Alex Deucher (3):
drm/amd/powerplay/tonga: enable pcie and mclk forcing for low drm/amd/powerplay/fiji: enable pcie and mclk forcing for low drm/amdgpu: extract pcie helpers to common header

Eric Huang (5):
drm/amd/powerplay: add/update headers for Fiji SMU and DPM drm/amd/powerplay: update atomctrl for fiji drm/amd/powerplay: add Fiji SMU support. drm/amd/powerplay: add Fiji DPM support.
drm/amd/amdgpu: enable powerplay and smc firmware loading for Fiji.

Jammy Zhou (7):
drm/amd/powerplay: add SMU manager sub-component drm/amd/powerplay: add hardware manager sub-component drm/amd/powerplay: add Carrizo smu support drm/amd/powerplay: add Carrizo dpm support drm/amd/powerplay: Add Tonga SMU support drm/amdgpu: add amdgpu.powerplay module option drm/amdgpu: support per device powerplay enablement (v2)

Rex Zhu (32):
drm/amdgpu: share struct amdgpu_pm_state_type with powerplay module drm/amdgpu: mv some definition from amdgpu_acpi.c to amdgpu_acpi.h drm/amdgpu: mv amdgpu_acpi.h to amd/include/amd_acpi.h drm/amdgpu: implement new cgs interface for acpi function drm/amdgpu: implement cgs interface to query system info drm/amdgpu: add new cgs interface to get display info (v2) drm/amd/powerplay: add basic powerplay framework drm/amdgpu: disable legacy path of firmware check if powerplay is
enabled
drm/amdgpu: export amd_powerplay_func to amdgpu and other ip block drm/amd/powerplay: add CG and PG support for carrizo drm/amd/powerplay: add event manager sub-component drm/amd/powerplay: implement functions of amd_powerplay_func drm/amdgpu/powerplay: add function point in hwmgr_funcs for program
display gap
drm/amdgpu/poweprlay: export program display gap function to eventmgr drm/amdgpu/powerplay: implement pem_task for
display_configuration_change
drm/amdgpu/powerplay: program display gap for tonga. drm/amdgpu: enable powerplay module by default for tonga. drm/amdgpu: enable powerplay module by default for fiji. drm/amdgpu/powerplay: add some definition for other ip block to update
cg pg.
drm/amd/powerplay: add new function point in hwmgr_func for CG/PG. drm/amd/powerplay: Add CG and PG support for tonga drm/amdgpu/powerplay: add new function point in hwmgr_funcs for
thermal control
drm/amdgpu/powerplay: mv ppinterrupt.h to inc folder to share with
other submodule.
drm/amdgpu/powerplay: add thermal control interface in hwmgr. drm/amdgpu/powerplay: enable thermal interrupt task in eventmgr. drm/amdgpu/powerplay: implement thermal control for tonga. drm/amdgpu/powerplay: implement fan control interface in
amd_powerplay_funcs
drm/amdgpu: export fan control functions to amdgpu drm/amdgpu: enable sysfs interface for powerplay drm/amd/powerplay: add and export hwmgr interface to eventmgr to check
hw states.
drm/amd/powerplay: implement new funcs to check current states for
tonga.
drm/amd/powerplay: refine the logic of whether need to update power
state.

yanyang1 (4):
drm/amd/powerplay: Add ixSWRST_COMMAND_1 in bif_5_0_d.h drm/amd/powerplay: Move smu7*.h from amdgpu to powerplay. drm/amd/powerplay: add header file for tonga smu and dpm drm/amd/powerplay: add Tonga dpm support (v3)

  drivers/gpu/drm/Kconfig                            |     1 +
  drivers/gpu/drm/amd/amdgpu/Makefile                |    12 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu.h                |   110 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c           |    58 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.h           |   445 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c   |     2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c            |   286 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c            |     6 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |   233 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c      |   297 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h      |    33 +
  drivers/gpu/drm/amd/amdgpu/cik.c                   |    11 +-
  drivers/gpu/drm/amd/amdgpu/cz_ppsmc.h              |   185 -
  drivers/gpu/drm/amd/amdgpu/fiji_ppsmc.h            |   182 -
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c              |    80 +-
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c             |    24 +-
  drivers/gpu/drm/amd/amdgpu/smu7.h                  |   170 -
  drivers/gpu/drm/amd/amdgpu/smu7_discrete.h         |   514 -
  drivers/gpu/drm/amd/amdgpu/smu7_fusion.h           |   300 -
  drivers/gpu/drm/amd/amdgpu/smu8.h                  |    72 -
  drivers/gpu/drm/amd/amdgpu/smu8_fusion.h           |   127 -
  drivers/gpu/drm/amd/amdgpu/smu_ucode_xfer_cz.h     |   147 -
  drivers/gpu/drm/amd/amdgpu/tonga_ppsmc.h           |   198 -
  drivers/gpu/drm/amd/amdgpu/vi.c                    |     9 +-
  drivers/gpu/drm/amd/include/amd_acpi.h             |   494 +
  drivers/gpu/drm/amd/include/amd_pcie.h             |    50 +
  drivers/gpu/drm/amd/include/amd_pcie_helpers.h     |   141 +
  drivers/gpu/drm/amd/include/amd_shared.h           |    21 +
  .../gpu/drm/amd/include/asic_reg/bif/bif_5_0_d.h   |     1 +
  drivers/gpu/drm/amd/include/atombios.h             |    79 +
  drivers/gpu/drm/amd/include/cgs_common.h           |    88 +-
  drivers/gpu/drm/amd/powerplay/Kconfig              |     6 +
  drivers/gpu/drm/amd/powerplay/Makefile             |    22 +
  drivers/gpu/drm/amd/powerplay/amd_powerplay.c      |   605 ++
  drivers/gpu/drm/amd/powerplay/eventmgr/Makefile    |    11 +
  .../drm/amd/powerplay/eventmgr/eventactionchains.c |   288 +
  .../drm/amd/powerplay/eventmgr/eventactionchains.h |    62 +
  drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c |   195 +
  drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.h |    34 +
  .../drm/amd/powerplay/eventmgr/eventmanagement.c   |   215 +
  .../drm/amd/powerplay/eventmgr/eventmanagement.h   |    59 +
  drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c  |   114 +
  .../drm/amd/powerplay/eventmgr/eventsubchains.c    |   405 +
  .../drm/amd/powerplay/eventmgr/eventsubchains.h    |    99 +
  .../gpu/drm/amd/powerplay/eventmgr/eventtasks.c    |   431 +
  .../gpu/drm/amd/powerplay/eventmgr/eventtasks.h    |    88 +
  drivers/gpu/drm/amd/powerplay/eventmgr/psm.c       |   118 +
  drivers/gpu/drm/amd/powerplay/eventmgr/psm.h       |    38 +
  drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |    14 +
  .../drm/amd/powerplay/hwmgr/cz_clockpowergating.c  |   252 +
  .../drm/amd/powerplay/hwmgr/cz_clockpowergating.h  |    37 +
  drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  1417 +++
  drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.h     |   317 +
  .../drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h    |   105 +
  drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c   |  4749 +++++++++
  drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h   |   354 +
  .../gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c   |   553 +
  .../gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h   |    66 +
  .../gpu/drm/amd/powerplay/hwmgr/functiontables.c   |   154 +
  .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c  |   246 +
  drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |   228 +
  drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h    |   105 +
  drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c      |    76 +
  drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   |  1185 +++
  drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h   |   243 +
  drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h    |   617 ++
  drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.c  |    64 +
  drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.h  |    31 +
  .../gpu/drm/amd/powerplay/hwmgr/processpptables.c  |  1661 +++
  .../gpu/drm/amd/powerplay/hwmgr/processpptables.h  |    47 +
  .../amd/powerplay/hwmgr/tonga_clockpowergating.c   |   350 +
  .../amd/powerplay/hwmgr/tonga_clockpowergating.h   |    36 +
  .../drm/amd/powerplay/hwmgr/tonga_dyn_defaults.h   |   107 +
  drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c  |  5966 +++++++++++
  drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h  |   408 +
  .../gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h  |    66 +
  .../gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h    |   406 +
  .../amd/powerplay/hwmgr/tonga_processpptables.c    |  1129 ++
  .../amd/powerplay/hwmgr/tonga_processpptables.h    |    35 +
  .../gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c    |   587 ++
  .../gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h    |    60 +
  drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h  |   206 +
  drivers/gpu/drm/amd/powerplay/inc/cz_ppsmc.h       |   185 +
  drivers/gpu/drm/amd/powerplay/inc/eventmanager.h   |   109 +
  drivers/gpu/drm/amd/powerplay/inc/eventmgr.h       |   125 +
  drivers/gpu/drm/amd/powerplay/inc/fiji_ppsmc.h     |   412 +
  drivers/gpu/drm/amd/powerplay/inc/fiji_pwrvirus.h  | 10299 +++++++++++++++++++
  .../gpu/drm/amd/powerplay/inc/hardwaremanager.h    |   357 +
  drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |   765 ++
  drivers/gpu/drm/amd/powerplay/inc/power_state.h    |   200 +
  drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h        |    28 +
  drivers/gpu/drm/amd/powerplay/inc/pp_asicblocks.h  |    47 +
  drivers/gpu/drm/amd/powerplay/inc/pp_debug.h       |    40 +
  drivers/gpu/drm/amd/powerplay/inc/pp_feature.h     |    67 +
  drivers/gpu/drm/amd/powerplay/inc/pp_instance.h    |    36 +
  .../gpu/drm/amd/powerplay/inc/pp_power_source.h    |    36 +
  drivers/gpu/drm/amd/powerplay/inc/ppinterrupt.h    |    46 +
  drivers/gpu/drm/amd/powerplay/inc/smu7.h           |   170 +
  drivers/gpu/drm/amd/powerplay/inc/smu72.h          |   664 ++
  drivers/gpu/drm/amd/powerplay/inc/smu72_discrete.h |   760 ++
  drivers/gpu/drm/amd/powerplay/inc/smu73.h          |   720 ++
  drivers/gpu/drm/amd/powerplay/inc/smu73_discrete.h |   799 ++
  drivers/gpu/drm/amd/powerplay/inc/smu7_discrete.h  |   514 +
  drivers/gpu/drm/amd/powerplay/inc/smu7_fusion.h    |   300 +
  drivers/gpu/drm/amd/powerplay/inc/smu8.h           |    72 +
  drivers/gpu/drm/amd/powerplay/inc/smu8_fusion.h    |   127 +
  .../gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h  |   147 +
  .../gpu/drm/amd/powerplay/inc/smu_ucode_xfer_vi.h  |   100 +
  drivers/gpu/drm/amd/powerplay/inc/smumgr.h         |   182 +
  drivers/gpu/drm/amd/powerplay/inc/tonga_ppsmc.h    |   420 +
  drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |     9 +
  drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c   |   858 ++
  drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.h   |   102 +
  drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |  1035 ++
  drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h |    77 +
  drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c      |   263 +
  .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |   819 ++
  .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h    |    53 +
  118 files changed, 47406 insertions(+), 2580 deletions(-)

delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.h
create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h delete mode 100644 drivers/gpu/drm/amd/amdgpu/cz_ppsmc.h
delete mode 100644 drivers/gpu/drm/amd/amdgpu/fiji_ppsmc.h
delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu7.h
delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu7_discrete.h delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu7_fusion.h
delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu8.h
delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu8_fusion.h
delete mode 100644 drivers/gpu/drm/amd/amdgpu/smu_ucode_xfer_cz.h delete mode 100644 drivers/gpu/drm/amd/amdgpu/tonga_ppsmc.h
create mode 100644 drivers/gpu/drm/amd/include/amd_acpi.h
create mode 100644 drivers/gpu/drm/amd/include/amd_pcie.h
create mode 100644 drivers/gpu/drm/amd/include/amd_pcie_helpers.h create mode 100644 drivers/gpu/drm/amd/powerplay/Kconfig
create mode 100644 drivers/gpu/drm/amd/powerplay/Makefile
create mode 100644 drivers/gpu/drm/amd/powerplay/amd_powerplay.c create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/Makefile create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventactionchains.c create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventactionchains.h create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.h create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventmanagement.c create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventmanagement.h create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.h create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/psm.c create mode 100644 drivers/gpu/drm/amd/powerplay/eventmgr/psm.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pppcielanes.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_dyn_defaults.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/cz_ppsmc.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/eventmanager.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/eventmgr.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/fiji_ppsmc.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/fiji_pwrvirus.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/power_state.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_asicblocks.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_debug.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_feature.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_instance.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_power_source.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/ppinterrupt.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7.h
create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu72.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu72_discrete.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu73.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu73_discrete.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7_discrete.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7_fusion.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu8.h
create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu8_fusion.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_vi.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smumgr.h create mode 100644 drivers/gpu/drm/amd/powerplay/inc/tonga_ppsmc.h

Quoted 9 lines

create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/Makefile create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.h create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel