Skip to contentSkip to conversation

powerplay code refactoring.

PATCH Superseded Rex Zhu 1 participant 21 messages Sep 9, 2016 1 message not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

cover powerplay code refactoring.

implement smu7_hwmgr smu7_smumgr to manager asics with smu version 7. so can delete duplicated code.

There are subtle differences in firmware image between different asics implement asic_name_smc.c under smumgr to deal with fw related jobs.

Rex Zhu (20):
drm/amd/powerplay: add common interface in smumgr to help to visit fw
image.
drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip
version 7.
drm/amd/powerplay: implement fw image related smum interface for
Polaris.
drm/amd/powerplay: use smu7 hwmgr to manager polaris10/11 drm/amd/powerplay: implement fw image related smu interface for Fiji. drm/amd/powerplay: use smu7 hwmgr to manager fiji drm/amd/powerplay: implement fw image related smum interface for
tonga.
drm/amd/powerplay: use smu7_hwmgr to manager tonga. drm/amd/powerplay: implement smu7_smumgr for asics with smu ip version

    7.
  drm/amd/powerplay: use smu7 common functions and data on Tonga.
  drm/amd/powerplay: use smu7 common functions and data on Polars10.
  drm/amd/powerplay: use smu7 common functions and data on Fiji.
  drm/amd/powerplay: use smu7 common functions and data on icelannd.
  drm/amd/powerplay: rename tonga_processpptable* to
    processpptable_v1_0*.

drm/amd/powerplay: add pp_table_version in hwmgr. drm/amd/powerplay: add pp table v0 support in smu7_hwmgr. drm/amd/powerplay: add pptable point check before use it drm/amd/powerplay: implement fw related smu interface for iceland. drm/amd/powerplay: use smu7 hwmgr to manager iceland drm/amd/powerplay: delete useless files.

 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |   16 +-
 .../amd/powerplay/hwmgr/fiji_clockpowergating.c    |  121 -
 .../amd/powerplay/hwmgr/fiji_clockpowergating.h    |   35 -
 .../drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h    |  105 -
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c   | 5596 --------------------
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h   |  350 --
 .../gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c   |  610 ---
 .../gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h   |   81 -
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.c |  687 ---
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.h |   62 -
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |  115 +-
 .../amd/powerplay/hwmgr/iceland_clockpowergating.c |  119 -
 .../amd/powerplay/hwmgr/iceland_clockpowergating.h |   38 -
 .../drm/amd/powerplay/hwmgr/iceland_dyn_defaults.h |   41 -
 .../gpu/drm/amd/powerplay/hwmgr/iceland_hwmgr.c    |   50 +-
 .../gpu/drm/amd/powerplay/hwmgr/iceland_hwmgr.h    |  424 --
 .../drm/amd/powerplay/hwmgr/iceland_powertune.c    |  490 --
 .../drm/amd/powerplay/hwmgr/iceland_powertune.h    |   14 -
 .../gpu/drm/amd/powerplay/hwmgr/iceland_thermal.c  |  595 ---
 .../gpu/drm/amd/powerplay/hwmgr/iceland_thermal.h  |   58 -
 .../powerplay/hwmgr/polaris10_clockpowergating.c   |  444 --
 .../powerplay/hwmgr/polaris10_clockpowergating.h   |   40 -
 .../amd/powerplay/hwmgr/polaris10_dyn_defaults.h   |   62 -
 .../gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h  |  355 --
 .../drm/amd/powerplay/hwmgr/polaris10_powertune.c  |  988 ----
 .../drm/amd/powerplay/hwmgr/polaris10_powertune.h  |   81 -
 .../drm/amd/powerplay/hwmgr/polaris10_thermal.c    |  716 ---
 .../drm/amd/powerplay/hwmgr/polaris10_thermal.h    |   62 -
 drivers/gpu/drm/amd/powerplay/hwmgr/pptable_v1_0.h |  436 ++
 .../amd/powerplay/hwmgr/process_pptables_v1_0.c    | 1326 +++++
 .../amd/powerplay/hwmgr/process_pptables_v1_0.h    |   35 +
 .../amd/powerplay/hwmgr/smu7_clockpowergating.c    |  491 ++
 .../amd/powerplay/hwmgr/smu7_clockpowergating.h    |   40 +
 .../drm/amd/powerplay/hwmgr/smu7_dyn_defaults.h    |   55 +
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 4232 +++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h   |  351 ++
 .../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c   |  729 +++
 .../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.h   |   62 +
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c |  577 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.h |   62 +
 .../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  |    2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h  |  402 --
 .../gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h  |   80 -
 .../gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h    |  436 --
 .../amd/powerplay/hwmgr/tonga_processpptables.c    | 1326 -----
 .../amd/powerplay/hwmgr/tonga_processpptables.h    |   35 -
 .../gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c    |  590 ---
 .../gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h    |   61 -
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |    9 +
 .../gpu/drm/amd/powerplay/inc/polaris10_pwrvirus.h |    3 +-
 drivers/gpu/drm/amd/powerplay/inc/smu7_common.h    |   58 +
 drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h     |  412 ++
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h         |   70 +
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |    5 +-
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    | 2374 +++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.h    |   51 +
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |  612 +--
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h |   32 +-
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c | 2577 +++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.h |   40 +
 .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c  |  613 +--
 .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.h  |   63 +-
 .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   | 2287 ++++++++
 .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.h   |   42 +
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    |  703 +--
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.h    |   41 +-
 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c |  571 ++
 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.h |   87 +
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c      |  101 +-
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   | 3092 +++++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.h   |   60 +
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |  672 +--
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h    |   46 +-
 76 files changed, 20658 insertions(+), 18139 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_clockpowergating.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_clockpowergating.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_clockpowergating.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_clockpowergating.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_dyn_defaults.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_hwmgr.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_powertune.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_thermal.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_thermal.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_dyn_defaults.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pptable_v1_0.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_dyn_defaults.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_dyn_defaults.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7_common.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.h
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#2 lore raw

PATCH 1/20 drm/amd/powerplay: add common interface in smumgr to help to visit fw image.

In reply to a message not in the archive
Change-Id I2ea5b1dc70883e8656fe0b1fd7a2b9a9c4ddcb27
---
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h    |  69 ++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c | 101 +++++++++++++++++++++++++-
 2 files changed, 169 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/inc/smumgr.h +69 -0
index 34abfd2..e7af643 100644
@@ -28,6 +28,7 @@
 
 struct pp_smumgr;
 struct pp_instance;
+struct pp_hwmgr;
 
 #define smu_lower_32_bits(n) ((uint32_t)(n))
 #define smu_upper_32_bits(n) ((uint32_t)(((n)>>16)>>16))
@@ -53,6 +54,44 @@ enum AVFS_BTC_STATUS {
 	AVFS_BTC_SMUMSG_ERROR
 };
 
+enum SMU_TABLE {
+	SMU_UVD_TABLE = 0,
+	SMU_VCE_TABLE,
+	SMU_SAMU_TABLE,
+	SMU_BIF_TABLE,
+};
+
+enum SMU_TYPE {
+	SMU_SoftRegisters = 0,
+	SMU_Discrete_DpmTable,
+};
+
+enum SMU_MEMBER {
+	HandshakeDisables = 0,
+	VoltageChangeTimeout,
+	AverageGraphicsActivity,
+	PreVBlankGap,
+	VBlankTimeout,
+	UvdBootLevel,
+	VceBootLevel,
+	SamuBootLevel,
+	LowSclkInterruptThreshold,
+};
+
+
+enum SMU_MAC_DEFINITION {
+	SMU_MAX_LEVELS_GRAPHICS = 0,
+	SMU_MAX_LEVELS_MEMORY,
+	SMU_MAX_LEVELS_LINK,
+	SMU_MAX_ENTRIES_SMIO,
+	SMU_MAX_LEVELS_VDDC,
+	SMU_MAX_LEVELS_VDDGFX,
+	SMU_MAX_LEVELS_VDDCI,
+	SMU_MAX_LEVELS_MVDD,
+	SMU_UVD_MCLK_HANDSHAKE_DISABLE,
+};
+
+
 struct pp_smumgr_func {
 	int (*smu_init)(struct pp_smumgr *smumgr);
 	int (*smu_fini)(struct pp_smumgr *smumgr);
@@ -69,6 +108,18 @@ struct pp_smumgr_func {
 	int (*download_pptable_settings)(struct pp_smumgr *smumgr,
 					 void **table);
 	int (*upload_pptable_settings)(struct pp_smumgr *smumgr);
+	int (*update_smc_table)(struct pp_hwmgr *hwmgr, uint32_t type);
+	int (*process_firmware_header)(struct pp_hwmgr *hwmgr);
+	int (*update_sclk_threshold)(struct pp_hwmgr *hwmgr);
+	int (*thermal_setup_fan_table)(struct pp_hwmgr *hwmgr);
+	int (*thermal_avfs_enable)(struct pp_hwmgr *hwmgr);
+	int (*init_smc_table)(struct pp_hwmgr *hwmgr);
+	int (*populate_all_graphic_levels)(struct pp_hwmgr *hwmgr);
+	int (*populate_all_memory_levels)(struct pp_hwmgr *hwmgr);
+	int (*initialize_mc_reg_table)(struct pp_hwmgr *hwmgr);
+	uint32_t (*get_offsetof)(uint32_t type, uint32_t member);
+	uint32_t (*get_mac_definition)(uint32_t value);
+	bool (*is_dpm_running)(struct pp_hwmgr *hwmgr);
 };
 
 struct pp_smumgr {
@@ -127,6 +178,24 @@ extern int tonga_smum_init(struct pp_smumgr *smumgr);
 extern int fiji_smum_init(struct pp_smumgr *smumgr);
 extern int polaris10_smum_init(struct pp_smumgr *smumgr);
 
+extern int smum_update_sclk_threshold(struct pp_hwmgr *hwmgr);
+
+extern int smum_update_smc_table(struct pp_hwmgr *hwmgr, uint32_t type);
+extern int smum_process_firmware_header(struct pp_hwmgr *hwmgr);
+extern int smum_thermal_avfs_enable(struct pp_hwmgr *hwmgr,
+		void *input, void *output, void *storage, int result);
+extern int smum_thermal_setup_fan_table(struct pp_hwmgr *hwmgr,
+		void *input, void *output, void *storage, int result);
+extern int smum_init_smc_table(struct pp_hwmgr *hwmgr);
+extern int smum_populate_all_graphic_levels(struct pp_hwmgr *hwmgr);
+extern int smum_populate_all_memory_levels(struct pp_hwmgr *hwmgr);
+extern int smum_initialize_mc_reg_table(struct pp_hwmgr *hwmgr);
+extern uint32_t smum_get_offsetof(struct pp_smumgr *smumgr,
+				uint32_t type, uint32_t member);
+extern uint32_t smum_get_mac_definition(struct pp_smumgr *smumgr, uint32_t value);
+
+extern bool smum_is_dpm_running(struct pp_hwmgr *hwmgr);
+
 #define SMUM_FIELD_SHIFT(reg, field) reg##__##field##__SHIFT
 
 #define SMUM_FIELD_MASK(reg, field) reg##__##field##_MASK
drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +100 -1

122 lines not on this page · raw message

Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#3 lore raw

PATCH 2/20 drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.

In reply to a message not in the archive
Change-Id Ia931e59ba0885ac55027d79fb66094b42d8d1651
---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |   22 +-
 .../amd/powerplay/hwmgr/smu7_clockpowergating.c    |  491 +++
 .../amd/powerplay/hwmgr/smu7_clockpowergating.h    |   40 +
 .../drm/amd/powerplay/hwmgr/smu7_dyn_defaults.h    |   55 +
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 3622 ++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h   |  351 ++
 .../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c   |  720 ++++
 .../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.h   |   62 +
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c |  577 ++++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.h |   62 +
 drivers/gpu/drm/amd/powerplay/inc/smu7_common.h    |   58 +
 drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h     |  412 +++
 12 files changed, 6462 insertions(+), 10 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_dyn_defaults.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7_common.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +12 -10
index abbcbc9..897eecf 100644
@@ -3,16 +3,18 @@
 # 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 \
-               cz_clockpowergating.o tonga_powertune.o\
-	       tonga_processpptables.o ppatomctrl.o \
-               tonga_hwmgr.o pppcielanes.o  tonga_thermal.o\
-               fiji_powertune.o fiji_hwmgr.o tonga_clockpowergating.o \
-               fiji_clockpowergating.o fiji_thermal.o \
-	       polaris10_hwmgr.o polaris10_powertune.o polaris10_thermal.o \
-	       polaris10_clockpowergating.o iceland_hwmgr.o \
-	       iceland_clockpowergating.o iceland_thermal.o \
-	       iceland_powertune.o
+		hardwaremanager.o pp_acpi.o cz_hwmgr.o \
+		cz_clockpowergating.o tonga_powertune.o\
+		tonga_processpptables.o ppatomctrl.o \
+		tonga_hwmgr.o pppcielanes.o  tonga_thermal.o\
+		fiji_powertune.o fiji_hwmgr.o tonga_clockpowergating.o \
+		fiji_clockpowergating.o fiji_thermal.o \
+		polaris10_hwmgr.o polaris10_powertune.o polaris10_thermal.o \
+		polaris10_clockpowergating.o \
+		smu7_hwmgr.o smu7_powertune.o smu7_thermal.o \
+		smu7_clockpowergating.o iceland_hwmgr.o \
+		iceland_clockpowergating.o iceland_thermal.o \
+		iceland_powertune.o
 
 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
 
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c new file +491 -0

491 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.h new file +40 -0
new file mode 100644
index 0000000..d52a28c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2016 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_CLOCK_POWER_GATING_H_
+#define _SMU7_CLOCK__POWER_GATING_H_
+
+#include "smu7_hwmgr.h"
+#include "pp_asicblocks.h"
+
+int smu7_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate);
+int smu7_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate);
+int smu7_powerdown_uvd(struct pp_hwmgr *hwmgr);
+int smu7_powergate_samu(struct pp_hwmgr *hwmgr, bool bgate);
+int smu7_powergate_acp(struct pp_hwmgr *hwmgr, bool bgate);
+int smu7_disable_clock_power_gating(struct pp_hwmgr *hwmgr);
+int smu7_update_clock_gatings(struct pp_hwmgr *hwmgr,
+					const uint32_t *msg_id);
+int smu7_enable_per_cu_power_gating(struct pp_hwmgr *hwmgr, bool enable);
+
+#endif
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_dyn_defaults.h new file +55 -0

55 lines not on this page · raw message

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

2,386 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h new file +351 -0

351 lines not on this page · raw message

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

720 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.h new file +62 -0

62 lines not on this page · raw message

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

577 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.h new file +62 -0

62 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smu7_common.h new file +58 -0

58 lines not on this page · raw message

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

412 lines not on this page · raw message

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

Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

author
#4 lore raw

PATCH 3/20 drm/amd/powerplay: implement fw image related smum interface for Polaris.

In reply to a message not in the archive
Change-Id I22767dc03fcec497e5cd76e82459916abf130105
---
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |    2 +-
 .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   | 2284 ++++++++++++++++++++
 .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.h   |   42 +
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    |   24 +-
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.h    |   23 +-
 5 files changed, 2367 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.h
drivers/gpu/drm/amd/powerplay/smumgr/Makefile +1 -1
index 19e7946..872a2f0 100644
@@ -3,7 +3,7 @@
 # It provides the smu management services for the driver.
 
 SMU_MGR = smumgr.o cz_smumgr.o tonga_smumgr.o fiji_smumgr.o \
-	  polaris10_smumgr.o iceland_smumgr.o
+	  polaris10_smumgr.o iceland_smumgr.o polaris10_smc.o
 
 AMD_PP_SMUMGR = $(addprefix $(AMD_PP_PATH)/smumgr/,$(SMU_MGR))
 
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c new file +2284 -0

2,285 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.h new file +42 -0

42 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +21 -3
index 8047ad2..b13ea42 100644
@@ -38,6 +38,8 @@
 #include "ppatomctrl.h"
 #include "pp_debug.h"
 #include "cgs_common.h"
+#include "polaris10_smc.h"
+#include "smu7_ppsmc.h"
 
 #define POLARIS10_SMC_SIZE 0x20000
 
@@ -46,7 +48,7 @@
 #define MAX_STRING_SIZE             15
 #define BUFFER_SIZETWO              131072  /* 128 *1024 */
 
-#define SMC_RAM_END 0x40000
+#define PPPOLARIS10_TARGETACTIVITY_DFLT                     50
 
 static const SMU74_Discrete_GraphicsLevel avfs_graphics_level_polaris10[8] = {
 	/*  Min      pcie   DeepSleep Activity  CgSpll      CgSpll    CcPwr  CcPwr  Sclk         Enabled      Enabled                       Voltage    Power */
@@ -61,8 +63,8 @@ static const SMU74_Discrete_GraphicsLevel avfs_graphics_level_polaris10[8] = {
 	{ 0xa00fa446, 0x01, 0x00, 0x3200, 0, 0, 0, 0, 0, 0, 0x01, 0x01, 0x0a, 0x00, 0x00, 0x00, { 0xa0860100, 0x2800, 0, 0x2000, 2, 1, 0x0004, 0x0c02, 0xffff, 0x2700, 0x6433, 0x2100 } }
 };
 
-static const SMU74_Discrete_MemoryLevel avfs_memory_level_polaris10 =
-	{0x100ea446, 0, 0x30750000, 0x01, 0x01, 0x01, 0x00, 0x00, 0x64, 0x00, 0x00, 0x1f00, 0x00, 0x00};
+static const SMU74_Discrete_MemoryLevel avfs_memory_level_polaris10 = {
+	0x100ea446, 0, 0x30750000, 0x01, 0x01, 0x01, 0x00, 0x00, 0x64, 0x00, 0x00, 0x1f00, 0x00, 0x00};
 
 /**
 * Set the address for reading/writing the SMC SRAM space.
@@ -921,6 +923,8 @@ static int polaris10_smu_init(struct pp_smumgr *smumgr)
 	struct polaris10_smumgr *smu_data;
 	uint8_t *internal_buf;
 	uint64_t mc_addr = 0;
+	int i;
+
 	/* Allocate memory for backend private data */
 	smu_data = (struct polaris10_smumgr *)(smumgr->backend);
 	smu_data->header_buffer.data_size =
@@ -974,6 +978,9 @@ static int polaris10_smu_init(struct pp_smumgr *smumgr)
 	else
 		smu_data->avfs.avfs_btc_status = AVFS_BTC_NOTSUPPORTED;
 
+	for (i = 0; i < SMU74_MAX_LEVELS_GRAPHICS; i++)
+		smu_data->activity_target[i] = PPPOLARIS10_TARGETACTIVITY_DFLT;
+
 	return 0;
 }
 
@@ -988,6 +995,17 @@ static const struct pp_smumgr_func polaris10_smu_funcs = {
 	.send_msg_to_smc_with_parameter = polaris10_send_msg_to_smc_with_parameter,
 	.download_pptable_settings = NULL,
 	.upload_pptable_settings = NULL,
+	.update_smc_table = polaris10_update_smc_table,
+	.get_offsetof = polaris10_get_offsetof,
+	.process_firmware_header = polaris10_process_firmware_header,
+	.init_smc_table = polaris10_init_smc_table,
+	.update_sclk_threshold = polaris10_update_sclk_threshold,
+	.thermal_avfs_enable = polaris10_thermal_avfs_enable,
+	.thermal_setup_fan_table = polaris10_thermal_setup_fan_table,
+	.populate_all_graphic_levels = polaris10_populate_all_graphic_levels,
+	.populate_all_memory_levels = polaris10_populate_all_memory_levels,
+	.get_mac_definition = polaris10_get_mac_definition,
+	.is_dpm_running = polaris10_is_dpm_running,
 };
 
 int polaris10_smum_init(struct pp_smumgr *smumgr)
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.h +19 -4
index 7c2445f..1ab9b1d 100644
@@ -24,9 +24,13 @@
 #ifndef _POLARIS10_SMUMANAGER_H
 #define _POLARIS10_SMUMANAGER_H
 
-#include <polaris10_ppsmc.h>
+
 #include <pp_endian.h>
 #include "smu74.h"
+#include "smu74_discrete.h"
+
+
+#define SMC_RAM_END 0x40000
 
 struct polaris10_avfs {
 	enum AVFS_BTC_STATUS avfs_btc_status;
@@ -65,7 +69,13 @@ struct polaris10_smumgr {
 	uint8_t *mec_image;
 	struct polaris10_buffer_entry smu_buffer;
 	struct polaris10_buffer_entry header_buffer;
-	uint32_t soft_regs_start;
+
+	uint32_t                             soft_regs_start;
+	uint32_t                             dpm_table_start;
+	uint32_t                             mc_reg_table_start;
+	uint32_t                             fan_table_start;
+	uint32_t                             arb_table_start;
+
 	uint8_t *read_rrm_straps;
 	uint32_t read_drm_straps_mc_address_high;
 	uint32_t read_drm_straps_mc_address_low;
@@ -74,15 +84,20 @@ struct polaris10_smumgr {
 	uint8_t protected_mode;
 	uint8_t security_hard_key;
 	struct polaris10_avfs  avfs;
+	SMU74_Discrete_DpmTable              smc_state_table;
+	struct SMU74_Discrete_Ulv            ulv_setting;
+	struct SMU74_Discrete_PmFuses  power_tune_table;
+	struct polaris10_range_table                range_table[NUM_SCLK_RANGE];
+	const struct polaris10_pt_defaults       *power_tune_defaults;
+	uint32_t                   activity_target[SMU74_MAX_LEVELS_GRAPHICS];
+	uint32_t                   bif_sclk_table[SMU74_MAX_LEVELS_LINK];
 };
 
 
 int polaris10_smum_init(struct pp_smumgr *smumgr);
-
 int polaris10_read_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t *value, uint32_t limit);
 int polaris10_write_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t value, uint32_t limit);
 int polaris10_copy_bytes_to_smc(struct pp_smumgr *smumgr, uint32_t smc_start_address,
 				const uint8_t *src, uint32_t byte_count, uint32_t limit);
 
 #endif
-
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#5 lore raw

PATCH 4/20 drm/amd/powerplay: use smu7 hwmgr to manager polaris10/11

In reply to a message not in the archive
Change-Id Ia3dae5b7ef0889acd9479f83d5f3b8a91786f4bf
---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile |  2 --
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c  | 35 ++++++++++++++++++++++++++--
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h    |  1 +
 3 files changed, 34 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +0 -2
index 897eecf..3c08209 100644
@@ -9,8 +9,6 @@ HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
 		tonga_hwmgr.o pppcielanes.o  tonga_thermal.o\
 		fiji_powertune.o fiji_hwmgr.o tonga_clockpowergating.o \
 		fiji_clockpowergating.o fiji_thermal.o \
-		polaris10_hwmgr.o polaris10_powertune.o polaris10_thermal.o \
-		polaris10_clockpowergating.o \
 		smu7_hwmgr.o smu7_powertune.o smu7_thermal.o \
 		smu7_clockpowergating.o iceland_hwmgr.o \
 		iceland_clockpowergating.o iceland_thermal.o \
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +33 -2
index e64b6a2..28f1ed9 100644
@@ -38,9 +38,9 @@
 extern int cz_hwmgr_init(struct pp_hwmgr *hwmgr);
 extern int tonga_hwmgr_init(struct pp_hwmgr *hwmgr);
 extern int fiji_hwmgr_init(struct pp_hwmgr *hwmgr);
-extern int polaris10_hwmgr_init(struct pp_hwmgr *hwmgr);
 extern int iceland_hwmgr_init(struct pp_hwmgr *hwmgr);
 
+static int polaris_set_asic_special_caps(struct pp_hwmgr *hwmgr);
 static void hwmgr_init_default_caps(struct pp_hwmgr *hwmgr);
 static int hwmgr_set_user_specify_caps(struct pp_hwmgr *hwmgr);
 
@@ -88,7 +88,9 @@ int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 			break;
 		case CHIP_POLARIS11:
 		case CHIP_POLARIS10:
-			polaris10_hwmgr_init(hwmgr);
+			smu7_hwmgr_init(hwmgr);
+			polaris_set_asic_special_caps(hwmgr);
+			hwmgr->feature_mask &= ~(PP_UVD_HANDSHAKE_MASK);
 			break;
 		default:
 			return -EINVAL;
@@ -205,6 +207,8 @@ int phm_wait_on_register(struct pp_hwmgr *hwmgr, uint32_t index,
 }
 
 
+
+
 /**
  * Returns once the part of the register indicated by the mask has
  * reached the given value.The indirect space is described by giving
@@ -753,3 +757,30 @@ int phm_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
 	return ret;
 }
 
+int polaris_set_asic_special_caps(struct pp_hwmgr *hwmgr)
+{
+	/* power tune caps Assume disabled */
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+						PHM_PlatformCaps_SQRamping);
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+						PHM_PlatformCaps_DBRamping);
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+						PHM_PlatformCaps_TDRamping);
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+						PHM_PlatformCaps_TCPRamping);
+
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+							PHM_PlatformCaps_CAC);
+
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+						PHM_PlatformCaps_RegulatorHot);
+
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+						PHM_PlatformCaps_AutomaticDCTransition);
+
+	if (hwmgr->chip_id == CHIP_POLARIS11)
+		phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+					PHM_PlatformCaps_SPLLShutdownSupport);
+	return 0;
+}
+
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
index 0665c8c..8916b94 100644
@@ -705,6 +705,7 @@ extern int phm_add_voltage(struct pp_hwmgr *hwmgr,
 	phm_ppt_v1_voltage_lookup_table *look_up_table,
 	phm_ppt_v1_voltage_lookup_record *record);
 
+extern int smu7_hwmgr_init(struct pp_hwmgr *hwmgr);
 extern int phm_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
 				uint32_t sclk, uint16_t id, uint16_t *voltage);
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#6 lore raw

PATCH 5/20 drm/amd/powerplay: implement fw image related smu interface for Fiji.

In reply to a message not in the archive
Change-Id I1bab73135461c289264b14972fbf15eb424734ee
---
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |    2 +-
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    | 2371 ++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.h    |   51 +
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |   37 +-
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h |   19 +-
 5 files changed, 2472 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.h
drivers/gpu/drm/amd/powerplay/smumgr/Makefile +1 -1
index 872a2f0..7561239 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 fiji_smumgr.o \
+SMU_MGR = smumgr.o cz_smumgr.o tonga_smumgr.o fiji_smumgr.o fiji_smc.o\
 	  polaris10_smumgr.o iceland_smumgr.o polaris10_smc.o
 
 AMD_PP_SMUMGR = $(addprefix $(AMD_PP_PATH)/smumgr/,$(SMU_MGR))
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c new file +2371 -0

2,371 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.h new file +51 -0

51 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c +32 -5
index 8e52a2e..82a8be4 100644
@@ -38,6 +38,7 @@
 #include "bif/bif_5_0_sh_mask.h"
 #include "pp_debug.h"
 #include "fiji_pwrvirus.h"
+#include "fiji_smc.h"
 
 #define AVFS_EN_MSB                                        1568
 #define AVFS_EN_LSB                                        1568
@@ -219,17 +220,28 @@ bool fiji_is_smc_ram_running(struct pp_smumgr *smumgr)
 */
 int fiji_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg)
 {
+	int ret;
+
 	if (!fiji_is_smc_ram_running(smumgr))
 		return -1;
 
-	if (1 != SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP)) {
-		printk(KERN_ERR "Failed to send Previous Message.");
-		SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0);
-	}
+
+	SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0);
+
+	ret = SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP);
+
+	if (ret != 1)
+		printk("\n failed to send pre message %x ret is %d \n",  msg, ret);
 
 	cgs_write_register(smumgr->device, mmSMC_MESSAGE_0, msg);
+
 	SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0);
 
+	ret = SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP);
+
+	if (ret != 1)
+		printk("\n failed to send message %x ret is %d \n",  msg, ret);
+
 	return 0;
 }
 
@@ -840,7 +852,7 @@ int fiji_avfs_event_mgr(struct pp_smumgr *smumgr, bool smu_started)
 	case AVFS_BTC_COMPLETED_RESTORED: /*S3 State - Post SMU Start*/
 		priv->avfs.AvfsBtcStatus = AVFS_BTC_SMUMSG_ERROR;
 		PP_ASSERT_WITH_CODE(0 == fiji_send_msg_to_smc(smumgr,
-				PPSMC_MSG_VftTableIsValid),
+				0x666),
 				"[AVFS][fiji_avfs_event_mgr] SMU did not respond "
 				"correctly to VftTableIsValid Msg",
 				return -1;);
@@ -964,6 +976,7 @@ static int fiji_smu_init(struct pp_smumgr *smumgr)
 {
 	struct fiji_smumgr *priv = (struct fiji_smumgr *)(smumgr->backend);
 	uint64_t mc_addr;
+	int i;
 
 	priv->header_buffer.data_size =
 			((sizeof(struct SMU_DRAMData_TOC) / 4096) + 1) * 4096;
@@ -1001,6 +1014,9 @@ static int fiji_smu_init(struct pp_smumgr *smumgr)
 
 	priv->acpi_optimization = 1;
 
+	for (i = 0; i < SMU73_MAX_LEVELS_GRAPHICS; i++)
+		priv->activity_target[i] = 30;
+
 	return 0;
 }
 
@@ -1030,6 +1046,17 @@ static const struct pp_smumgr_func fiji_smu_funcs = {
 	.send_msg_to_smc_with_parameter = &fiji_send_msg_to_smc_with_parameter,
 	.download_pptable_settings = NULL,
 	.upload_pptable_settings = NULL,
+	.update_smc_table = fiji_update_smc_table,
+	.get_offsetof = fiji_get_offsetof,
+	.process_firmware_header = fiji_process_firmware_header,
+	.init_smc_table = fiji_init_smc_table,
+	.update_sclk_threshold = fiji_update_sclk_threshold,
+	.thermal_setup_fan_table = fiji_thermal_setup_fan_table,
+	.populate_all_graphic_levels = fiji_populate_all_graphic_levels,
+	.populate_all_memory_levels = fiji_populate_all_memory_levels,
+	.get_mac_definition = fiji_get_mac_definition,
+	.initialize_mc_reg_table = fiji_initialize_mc_reg_table,
+	.is_dpm_running = fiji_is_dpm_running,
 };
 
 int fiji_smum_init(struct pp_smumgr *smumgr)
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h +17 -2
index b4eb483..291f704 100644
@@ -23,6 +23,10 @@
 #ifndef _FIJI_SMUMANAGER_H_
 #define _FIJI_SMUMANAGER_H_
 
+#include "smu73_discrete.h"
+#include <pp_endian.h>
+
+#define SMC_RAM_END		0x40000
 
 struct fiji_smu_avfs {
 	enum AVFS_BTC_STATUS AvfsBtcStatus;
@@ -40,11 +44,22 @@ struct fiji_buffer_entry {
 struct fiji_smumgr {
 	uint8_t        *header;
 	uint8_t        *mec_image;
-	uint32_t        soft_regs_start;
+
+	uint32_t                             soft_regs_start;
+	uint32_t                             dpm_table_start;
+	uint32_t                             mc_reg_table_start;
+	uint32_t                             fan_table_start;
+	uint32_t                             arb_table_start;
 	struct fiji_smu_avfs avfs;
 	uint32_t        acpi_optimization;
-
 	struct fiji_buffer_entry header_buffer;
+
+	struct SMU73_Discrete_DpmTable       smc_state_table;
+	struct SMU73_Discrete_Ulv            ulv_setting;
+	struct SMU73_Discrete_PmFuses  power_tune_table;
+	const struct fiji_pt_defaults  *power_tune_defaults;
+	uint32_t        activity_target[SMU73_MAX_LEVELS_GRAPHICS];
+
 };
 
 int fiji_smum_init(struct pp_smumgr *smumgr);
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#7 lore raw

PATCH 6/20 drm/amd/powerplay: use smu7 hwmgr to manager fiji

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile |  3 +--
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c  | 25 +++++++++++++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +1 -2
index 3c08209..6689f29 100644
@@ -7,10 +7,9 @@ HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
 		cz_clockpowergating.o tonga_powertune.o\
 		tonga_processpptables.o ppatomctrl.o \
 		tonga_hwmgr.o pppcielanes.o  tonga_thermal.o\
-		fiji_powertune.o fiji_hwmgr.o tonga_clockpowergating.o \
-		fiji_clockpowergating.o fiji_thermal.o \
 		smu7_hwmgr.o smu7_powertune.o smu7_thermal.o \
 		smu7_clockpowergating.o iceland_hwmgr.o \
+		tonga_clockpowergating.o \
 		iceland_clockpowergating.o iceland_thermal.o \
 		iceland_powertune.o
 
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +23 -2
index 28f1ed9..6b55067 100644
@@ -37,12 +37,12 @@
 
 extern int cz_hwmgr_init(struct pp_hwmgr *hwmgr);
 extern int tonga_hwmgr_init(struct pp_hwmgr *hwmgr);
-extern int fiji_hwmgr_init(struct pp_hwmgr *hwmgr);
 extern int iceland_hwmgr_init(struct pp_hwmgr *hwmgr);
 
 static int polaris_set_asic_special_caps(struct pp_hwmgr *hwmgr);
 static void hwmgr_init_default_caps(struct pp_hwmgr *hwmgr);
 static int hwmgr_set_user_specify_caps(struct pp_hwmgr *hwmgr);
+static int fiji_set_asic_special_caps(struct pp_hwmgr *hwmgr);
 
 uint8_t convert_to_vid(uint16_t vddc)
 {
@@ -83,8 +83,13 @@ int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 		case CHIP_TONGA:
 			tonga_hwmgr_init(hwmgr);
 			break;
+
 		case CHIP_FIJI:
-			fiji_hwmgr_init(hwmgr);
+			smu7_hwmgr_init(hwmgr);
+			fiji_set_asic_special_caps(hwmgr);
+			hwmgr->feature_mask &= ~(PP_SMC_VOLTAGE_CONTROL_MASK |
+						PP_VBI_TIME_SUPPORT_MASK |
+						PP_ENABLE_GFX_CG_THRU_SMU);
 			break;
 		case CHIP_POLARIS11:
 		case CHIP_POLARIS10:
@@ -784,3 +789,19 @@ int polaris_set_asic_special_caps(struct pp_hwmgr *hwmgr)
 	return 0;
 }
 
+int fiji_set_asic_special_caps(struct pp_hwmgr *hwmgr)
+{
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_SQRamping);
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_DBRamping);
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_TDRamping);
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_TCPRamping);
+
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_CAC);
+	return 0;
+}
+
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#8 lore raw

PATCH 7/20 drm/amd/powerplay: implement fw image related smum interface for tonga.

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c  |    2 +-
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |    2 +-
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   | 3090 ++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.h   |   60 +
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |   17 +
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h    |   37 +-
 6 files changed, 3205 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.h
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +1 -1
index 0e1919d..bf0c234 100644
@@ -802,7 +802,7 @@ static int tonga_process_firmware_header(struct pp_hwmgr *hwmgr)
 
 	if (0 == result) {
 		data->soft_regs_start = tmp;
-		tonga_smu->ulSoftRegsStart = tmp;
+		tonga_smu->soft_regs_start = tmp;
 	}
 
 	error |= (0 != result);
drivers/gpu/drm/amd/powerplay/smumgr/Makefile +1 -1
index 7561239..2ff4aa0 100644
@@ -3,7 +3,7 @@
 # It provides the smu management services for the driver.
 
 SMU_MGR = smumgr.o cz_smumgr.o tonga_smumgr.o fiji_smumgr.o fiji_smc.o\
-	  polaris10_smumgr.o iceland_smumgr.o polaris10_smc.o
+	  polaris10_smumgr.o iceland_smumgr.o polaris10_smc.o tonga_smc.o
 
 AMD_PP_SMUMGR = $(addprefix $(AMD_PP_PATH)/smumgr/,$(SMU_MGR))
 
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c new file +3090 -0

2,984 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.h new file +60 -0

60 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c +17 -0
index f42c536..b543d6c 100644

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

drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h +36 -1
index 33c788d..b2ad232 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.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

author
#9 lore raw

PATCH 8/20 drm/amd/powerplay: use smu7_hwmgr to manager tonga.

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile |  5 ++---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c  | 30 +++++++++++++++++++++++++---
 2 files changed, 29 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +2 -3
index 6689f29..1158e3e 100644
@@ -4,12 +4,11 @@
 
 HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
 		hardwaremanager.o pp_acpi.o cz_hwmgr.o \
-		cz_clockpowergating.o tonga_powertune.o\
+		cz_clockpowergating.o pppcielanes.o\
 		tonga_processpptables.o ppatomctrl.o \
-		tonga_hwmgr.o pppcielanes.o  tonga_thermal.o\
+		pppcielanes.o  \
 		smu7_hwmgr.o smu7_powertune.o smu7_thermal.o \
 		smu7_clockpowergating.o iceland_hwmgr.o \
-		tonga_clockpowergating.o \
 		iceland_clockpowergating.o iceland_thermal.o \
 		iceland_powertune.o
 
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +27 -3
index 6b55067..cb5627f 100644
@@ -36,13 +36,13 @@
 #include "amd_acpi.h"
 
 extern int cz_hwmgr_init(struct pp_hwmgr *hwmgr);
-extern int tonga_hwmgr_init(struct pp_hwmgr *hwmgr);
 extern int iceland_hwmgr_init(struct pp_hwmgr *hwmgr);
 
 static int polaris_set_asic_special_caps(struct pp_hwmgr *hwmgr);
 static void hwmgr_init_default_caps(struct pp_hwmgr *hwmgr);
 static int hwmgr_set_user_specify_caps(struct pp_hwmgr *hwmgr);
 static int fiji_set_asic_special_caps(struct pp_hwmgr *hwmgr);
+static int tonga_set_asic_special_caps(struct pp_hwmgr *hwmgr);
 
 uint8_t convert_to_vid(uint16_t vddc)
 {
@@ -81,9 +81,12 @@ int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 			iceland_hwmgr_init(hwmgr);
 			break;
 		case CHIP_TONGA:
-			tonga_hwmgr_init(hwmgr);
+			smu7_hwmgr_init(hwmgr);
+			tonga_set_asic_special_caps(hwmgr);
+			hwmgr->feature_mask &= ~(PP_SMC_VOLTAGE_CONTROL_MASK |
+						PP_VBI_TIME_SUPPORT_MASK |
+						PP_ULV_MASK);
 			break;
-
 		case CHIP_FIJI:
 			smu7_hwmgr_init(hwmgr);
 			fiji_set_asic_special_caps(hwmgr);
@@ -805,3 +808,24 @@ int fiji_set_asic_special_caps(struct pp_hwmgr *hwmgr)
 	return 0;
 }
 
+int tonga_set_asic_special_caps(struct pp_hwmgr *hwmgr)
+{
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_SQRamping);
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_DBRamping);
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_TDRamping);
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_TCPRamping);
+
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+		      PHM_PlatformCaps_UVDPowerGating);
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+		      PHM_PlatformCaps_VCEPowerGating);
+
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_CAC);
+
+	return 0;
+}
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#10 lore raw

PATCH 9/20 drm/amd/powerplay: implement smu7_smumgr for asics with smu ip version 7.

In reply to a message not in the archive
Change-Id Id0017fcdd179cc726349eacc2ee56be96279b526
---
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h         |   1 +
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |   2 +-
 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 571 +++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.h |  87 ++++
 4 files changed, 660 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.h
drivers/gpu/drm/amd/powerplay/inc/smumgr.h +1 -0
index e7af643..2139072 100644
@@ -72,6 +72,7 @@ enum SMU_MEMBER {
 	AverageGraphicsActivity,
 	PreVBlankGap,
 	VBlankTimeout,
+	UcodeLoadStatus,
 	UvdBootLevel,
 	VceBootLevel,
 	SamuBootLevel,
drivers/gpu/drm/amd/powerplay/smumgr/Makefile +1 -1
index 2ff4aa0..a4d7462 100644
@@ -3,7 +3,7 @@
 # It provides the smu management services for the driver.
 
 SMU_MGR = smumgr.o cz_smumgr.o tonga_smumgr.o fiji_smumgr.o fiji_smc.o\
-	  polaris10_smumgr.o iceland_smumgr.o polaris10_smc.o tonga_smc.o
+	  polaris10_smumgr.o iceland_smumgr.o polaris10_smc.o tonga_smc.o smu7_smumgr.o
 
 AMD_PP_SMUMGR = $(addprefix $(AMD_PP_PATH)/smumgr/,$(SMU_MGR))
 
drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c new file +571 -0

571 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.h new file +87 -0

88 lines not on this page · raw message

Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#11 lore raw

PATCH 10/20 drm/amd/powerplay: use smu7 common functions and data on Tonga.

In reply to a message not in the archive
Change-Id If9ca14557f99f3e13e17086e8c0a90c53f232631
---
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   |  74 +--
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    | 657 +--------------------
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h    |  33 +-
 3 files changed, 58 insertions(+), 706 deletions(-)
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c +38 -36
index 565d08b..ee844c2 100644
@@ -580,7 +580,7 @@ int tonga_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
 	struct smu7_dpm_table *dpm_table = &data->dpm_table;
 	struct phm_ppt_v1_pcie_table *pcie_table = pptable_info->pcie_table;
 	uint8_t pcie_entry_count = (uint8_t) data->dpm_table.pcie_speed_table.count;
-	uint32_t level_array_adress = smu_data->dpm_table_start +
+	uint32_t level_array_adress = smu_data->smu7_data.dpm_table_start +
 				offsetof(SMU72_Discrete_DpmTable, GraphicsLevel);
 
 	uint32_t level_array_size = sizeof(SMU72_Discrete_GraphicsLevel) *
@@ -667,7 +667,7 @@ int tonga_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
 		smu_data->smc_state_table.GraphicsLevel[1].pcieDpmLevel = mid_pcie_level_enabled;
 	}
 	/* level count will send to smc once at init smc table and never change*/
-	result = tonga_copy_bytes_to_smc(hwmgr->smumgr, level_array_adress,
+	result = smu7_copy_bytes_to_smc(hwmgr->smumgr, level_array_adress,
 				(uint8_t *)levels, (uint32_t)level_array_size,
 								SMC_RAM_END);
 
@@ -978,7 +978,7 @@ int tonga_populate_all_memory_levels(struct pp_hwmgr *hwmgr)
 	int result;
 
 	/* populate MCLK dpm table to SMU7 */
-	uint32_t level_array_adress = smu_data->dpm_table_start + offsetof(SMU72_Discrete_DpmTable, MemoryLevel);
+	uint32_t level_array_adress = smu_data->smu7_data.dpm_table_start + offsetof(SMU72_Discrete_DpmTable, MemoryLevel);
 	uint32_t level_array_size = sizeof(SMU72_Discrete_MemoryLevel) * SMU72_MAX_LEVELS_MEMORY;
 	SMU72_Discrete_MemoryLevel *levels = smu_data->smc_state_table.MemoryLevel;
 	uint32_t i;
@@ -1012,7 +1012,7 @@ int tonga_populate_all_memory_levels(struct pp_hwmgr *hwmgr)
 	smu_data->smc_state_table.MemoryLevel[dpm_table->mclk_table.count-1].DisplayWatermark = PPSMC_DISPLAY_WATERMARK_HIGH;
 
 	/* level count will send to smc once at init smc table and never change*/
-	result = tonga_copy_bytes_to_smc(hwmgr->smumgr,
+	result = smu7_copy_bytes_to_smc(hwmgr->smumgr,
 		level_array_adress, (uint8_t *)levels, (uint32_t)level_array_size,
 		SMC_RAM_END);
 
@@ -1424,9 +1424,9 @@ static int tonga_program_memory_timing_parameters(struct pp_hwmgr *hwmgr)
 	}
 
 	if (0 == result) {
-		result = tonga_copy_bytes_to_smc(
+		result = smu7_copy_bytes_to_smc(
 				hwmgr->smumgr,
-				smu_data->arb_table_start,
+				smu_data->smu7_data.arb_table_start,
 				(uint8_t *)&arb_regs,
 				sizeof(SMU72_Discrete_MCArbDramTimingTable),
 				SMC_RAM_END
@@ -1484,7 +1484,6 @@ static int tonga_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
 	return result;
 }
 
-
 static int tonga_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr)
 {
 	uint32_t ro, efuse, efuse2, clock_freq, volt_without_cks,
@@ -1536,6 +1535,7 @@ static int tonga_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr)
 	/* Populate Stretch amount */
 	smu_data->smc_state_table.ClockStretcherAmount = stretch_amount;
 
+
 	/* Populate Sclk_CKS_masterEn0_7 and Sclk_voltageOffset */
 	for (i = 0; i < sclk_table->count; i++) {
 		smu_data->smc_state_table.Sclk_CKS_masterEn0_7 |=
@@ -1738,8 +1738,8 @@ static int tonga_init_arb_table_index(struct pp_smumgr *smumgr)
 	* This solution is ugly, but we never write the whole table only individual fields in it.
 	* In reality this field should not be in that structure but in a soft register.
 	*/
-	result = tonga_read_smc_sram_dword(smumgr,
-				smu_data->arb_table_start, &tmp, SMC_RAM_END);
+	result = smu7_read_smc_sram_dword(smumgr,
+				smu_data->smu7_data.arb_table_start, &tmp, SMC_RAM_END);
 
 	if (0 != result)
 		return result;
@@ -1747,8 +1747,8 @@ static int tonga_init_arb_table_index(struct pp_smumgr *smumgr)
 	tmp &= 0x00FFFFFF;
 	tmp |= ((uint32_t)MC_CG_ARB_FREQ_F1) << 24;
 
-	return tonga_write_smc_sram_dword(smumgr,
-			smu_data->arb_table_start,  tmp, SMC_RAM_END);
+	return smu7_write_smc_sram_dword(smumgr,
+			smu_data->smu7_data.arb_table_start, tmp, SMC_RAM_END);
 }
 
 
@@ -1840,7 +1840,7 @@ static int tonga_populate_dw8(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offset
 	struct tonga_pt_defaults *defaults = smu_data->power_tune_defaults;
 	uint32_t temp;
 
-	if (tonga_read_smc_sram_dword(hwmgr->smumgr,
+	if (smu7_read_smc_sram_dword(hwmgr->smumgr,
 			fuse_table_offset +
 			offsetof(SMU72_Discrete_PmFuses, TdcWaterfallCtl),
 			(uint32_t *)&temp, SMC_RAM_END))
@@ -1926,7 +1926,7 @@ static int tonga_populate_pm_fuses(struct pp_hwmgr *hwmgr)
 
 	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_PowerContainment)) {
-		if (tonga_read_smc_sram_dword(hwmgr->smumgr,
+		if (smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU72_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU72_Firmware_Header, PmFuseTable),
 				&pm_fuse_table_offset, SMC_RAM_END))
@@ -1979,7 +1979,7 @@ static int tonga_populate_pm_fuses(struct pp_hwmgr *hwmgr)
 					"Attempt to populate BapmVddCBaseLeakage Hi and Lo Sidd Failed!",
 					return -EINVAL);
 
-		if (tonga_copy_bytes_to_smc(hwmgr->smumgr, pm_fuse_table_offset,
+		if (smu7_copy_bytes_to_smc(hwmgr->smumgr, pm_fuse_table_offset,
 				(uint8_t *)&smu_data->power_tune_table,
 				sizeof(struct SMU72_Discrete_PmFuses), SMC_RAM_END))
 			PP_ASSERT_WITH_CODE(false,
@@ -2098,9 +2098,9 @@ static int tonga_update_and_upload_mc_reg_table(struct pp_hwmgr *hwmgr)
 		return result;
 
 
-	address = smu_data->mc_reg_table_start + (uint32_t)offsetof(SMU72_Discrete_MCRegisters, data[0]);
+	address = smu_data->smu7_data.mc_reg_table_start + (uint32_t)offsetof(SMU72_Discrete_MCRegisters, data[0]);
 
-	return  tonga_copy_bytes_to_smc(hwmgr->smumgr, address,
+	return  smu7_copy_bytes_to_smc(hwmgr->smumgr, address,
 				 (uint8_t *)&smu_data->mc_regs.data[0],
 				sizeof(SMU72_Discrete_MCRegisterSet) * data->dpm_table.mclk_table.count,
 				SMC_RAM_END);
@@ -2121,7 +2121,7 @@ static int tonga_populate_initial_mc_reg_table(struct pp_hwmgr *hwmgr)
 	PP_ASSERT_WITH_CODE(0 == result,
 		"Failed to initialize MCRegTable for driver state!", return result;);
 
-	return tonga_copy_bytes_to_smc(smumgr, smu_data->mc_reg_table_start,
+	return smu7_copy_bytes_to_smc(smumgr, smu_data->smu7_data.mc_reg_table_start,
 			(uint8_t *)&smu_data->mc_regs, sizeof(SMU72_Discrete_MCRegisters), SMC_RAM_END);
 }
 
@@ -2360,7 +2360,7 @@ int tonga_init_smc_table(struct pp_hwmgr *hwmgr)
 	CONVERT_FROM_HOST_TO_SMC_US(table->PhaseResponseTime);
 
 	/* Upload all dpm data to SMC memory.(dpm level, dpm level count etc) */
-	result = tonga_copy_bytes_to_smc(hwmgr->smumgr, smu_data->dpm_table_start +
+	result = smu7_copy_bytes_to_smc(hwmgr->smumgr, smu_data->smu7_data.dpm_table_start +
 										offsetof(SMU72_Discrete_DpmTable, SystemFlags),
 										(uint8_t *)&(table->SystemFlags),
 										sizeof(SMU72_Discrete_DpmTable)-3 * sizeof(SMU72_PIDController),
@@ -2407,7 +2407,7 @@ int tonga_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
 	if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl))
 		return 0;
 
-	if (0 == smu_data->fan_table_start) {
+	if (0 == smu_data->smu7_data.fan_table_start) {
 		phm_cap_unset(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl);
 		return 0;
 	}
@@ -2459,7 +2459,7 @@ int tonga_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
 
 	fan_table.FanControl_GL_Flag = 1;
 
-	res = tonga_copy_bytes_to_smc(hwmgr->smumgr, smu_data->fan_table_start, (uint8_t *)&fan_table, (uint32_t)sizeof(fan_table), SMC_RAM_END);
+	res = smu7_copy_bytes_to_smc(hwmgr->smumgr, smu_data->smu7_data.fan_table_start, (uint8_t *)&fan_table, (uint32_t)sizeof(fan_table), SMC_RAM_END);
 /* TO DO FOR SOME DEVICE ID 0X692b, send this msg return invalid command.
 	if (res == 0 && hwmgr->thermal_controller.advanceFanControlParameters.ucMinimumPWMLimit != 0)
 		res = (0 == smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_SetFanMinPwm, \
@@ -2506,9 +2506,9 @@ int tonga_update_sclk_threshold(struct pp_hwmgr *hwmgr)
 
 		CONVERT_FROM_HOST_TO_SMC_UL(low_sclk_interrupt_threshold);
 
-		result = tonga_copy_bytes_to_smc(
+		result = smu7_copy_bytes_to_smc(
 				hwmgr->smumgr,
-				smu_data->dpm_table_start +
+				smu_data->smu7_data.dpm_table_start +
 				offsetof(SMU72_Discrete_DpmTable,
 					LowSclkInterruptThreshold),
 				(uint8_t *)&low_sclk_interrupt_threshold,
@@ -2543,6 +2543,8 @@ uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU72_SoftRegisters, PreVBlankGap);
 		case VBlankTimeout:
 			return offsetof(SMU72_SoftRegisters, VBlankTimeout);
+		case UcodeLoadStatus:
+			return offsetof(SMU72_SoftRegisters, UcodeLoadStatus);
 		}
 	case SMU_Discrete_DpmTable:
 		switch (member) {
@@ -2597,7 +2599,7 @@ static int tonga_update_uvd_smc_table(struct pp_hwmgr *hwmgr)
 	if (table_info->mm_dep_table->count > 0)
 		smu_data->smc_state_table.UvdBootLevel =
 				(uint8_t) (table_info->mm_dep_table->count - 1);
-	mm_boot_level_offset = smu_data->dpm_table_start + offsetof(SMU72_Discrete_DpmTable,
+	mm_boot_level_offset = smu_data->smu7_data.dpm_table_start + offsetof(SMU72_Discrete_DpmTable,
 						UvdBootLevel);
 	mm_boot_level_offset /= 4;
 	mm_boot_level_offset *= 4;
@@ -2629,7 +2631,7 @@ static int tonga_update_vce_smc_table(struct pp_hwmgr *hwmgr)
 	smu_data->smc_state_table.VceBootLevel =
 		(uint8_t) (table_info->mm_dep_table->count - 1);
 
-	mm_boot_level_offset = smu_data->dpm_table_start +
+	mm_boot_level_offset = smu_data->smu7_data.dpm_table_start +
 					offsetof(SMU72_Discrete_DpmTable, VceBootLevel);
 	mm_boot_level_offset /= 4;
 	mm_boot_level_offset *= 4;
@@ -2653,7 +2655,7 @@ static int tonga_update_samu_smc_table(struct pp_hwmgr *hwmgr)
 	uint32_t mm_boot_level_offset, mm_boot_level_value;
 
 	smu_data->smc_state_table.SamuBootLevel = 0;
-	mm_boot_level_offset = smu_data->dpm_table_start +
+	mm_boot_level_offset = smu_data->smu7_data.dpm_table_start +
 				offsetof(SMU72_Discrete_DpmTable, SamuBootLevel);
 
 	mm_boot_level_offset /= 4;
@@ -2707,63 +2709,63 @@ int tonga_process_firmware_header(struct pp_hwmgr *hwmgr)
 	int result;
 	bool error = false;
 
-	result = tonga_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU72_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU72_Firmware_Header, DpmTable),
 				&tmp, SMC_RAM_END);
 
 	if (0 == result) {
-		smu_data->dpm_table_start = tmp;
+		smu_data->smu7_data.dpm_table_start = tmp;
 	}
 
 	error |= (0 != result);
 
-	result = tonga_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU72_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU72_Firmware_Header, SoftRegisters),
 				&tmp, SMC_RAM_END);
 
 	if (0 == result) {
 		data->soft_regs_start = tmp;
-		smu_data->soft_regs_start = tmp;
+		smu_data->smu7_data.soft_regs_start = tmp;
 	}
 
 	error |= (0 != result);
 
 
-	result = tonga_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU72_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU72_Firmware_Header, mcRegisterTable),
 				&tmp, SMC_RAM_END);
 
 	if (0 == result) {
-		smu_data->mc_reg_table_start = tmp;
+		smu_data->smu7_data.mc_reg_table_start = tmp;
 	}
 
-	result = tonga_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU72_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU72_Firmware_Header, FanTable),
 				&tmp, SMC_RAM_END);
 
 	if (0 == result) {
-		smu_data->fan_table_start = tmp;
+		smu_data->smu7_data.fan_table_start = tmp;
 	}
 
 	error |= (0 != result);
 
-	result = tonga_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU72_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU72_Firmware_Header, mcArbDramTimingTable),
 				&tmp, SMC_RAM_END);
 
 	if (0 == result) {
-		smu_data->arb_table_start = tmp;
+		smu_data->smu7_data.arb_table_start = tmp;
 	}
 
 	error |= (0 != result);
 
 
-	result = tonga_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU72_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU72_Firmware_Header, Version),
 				&tmp, SMC_RAM_END);
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c +18 -639

716 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h +2 -31
index b2ad232..edb5f20 100644
@@ -26,16 +26,7 @@
 
 #include "smu72_discrete.h"
 
-#define SMC_RAM_END		0x40000
-
-struct tonga_buffer_entry {
-	uint32_t data_size;
-	uint32_t mc_addr_low;
-	uint32_t mc_addr_high;
-	void *kaddr;
-	unsigned long  handle;
-};
-
+#include "smu7_smumgr.h"
 
 struct tonga_mc_reg_entry {
 	uint32_t mclk_max;
@@ -52,19 +43,8 @@ struct tonga_mc_reg_table {
 
 
 struct tonga_smumgr {
-	uint8_t *pHeader;
-	uint8_t *pMecImage;
-
-
-	uint32_t soft_regs_start;
-	uint32_t dpm_table_start;
-	uint32_t mc_reg_table_start;
-	uint32_t fan_table_start;
-	uint32_t arb_table_start;
-
-	struct tonga_buffer_entry header_buffer;
-	struct tonga_buffer_entry smu_buffer;
 
+	struct smu7_smumgr                   smu7_data;
 	struct SMU72_Discrete_DpmTable       smc_state_table;
 	struct SMU72_Discrete_Ulv            ulv_setting;
 	struct SMU72_Discrete_PmFuses  power_tune_table;
@@ -76,13 +56,4 @@ struct tonga_smumgr {
 
 };
 
-extern int tonga_smum_init(struct pp_smumgr *smumgr);
-extern int tonga_copy_bytes_to_smc(struct pp_smumgr *smumgr,
-		uint32_t smcStartAddress, const uint8_t *src,
-		uint32_t byteCount, uint32_t limit);
-extern int tonga_read_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smcAddress,
-		uint32_t *value, uint32_t limit);
-extern int tonga_write_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smcAddress,
-		uint32_t value, uint32_t limit);
-
 #endif
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#12 lore raw

PATCH 11/20 drm/amd/powerplay: use smu7 common functions and data on Polars10.

In reply to a message not in the archive
---
 .../gpu/drm/amd/powerplay/inc/polaris10_pwrvirus.h |   3 +-
 .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   |  81 +--
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    | 681 ++-------------------
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.h    |  34 +-
 4 files changed, 84 insertions(+), 715 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/polaris10_pwrvirus.h +1 -2
index f497e7d..0de4436 100644
@@ -23,8 +23,7 @@
 #ifndef _POLARIS10_PWRVIRUS_H
 #define _POLARIS10_PWRVIRUS_H
 
-#define mmSMC_IND_INDEX_11                              0x01AC
-#define mmSMC_IND_DATA_11                               0x01AD
+
 #define mmCP_HYP_MEC1_UCODE_ADDR	0xf81a
 #define mmCP_HYP_MEC1_UCODE_DATA	0xf81b
 #define mmCP_HYP_MEC2_UCODE_ADDR	0xf81c
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c +42 -39

267 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +38 -643

796 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.h +3 -31
index 1ab9b1d..49ebf1d 100644
@@ -28,7 +28,7 @@
 #include <pp_endian.h>
 #include "smu74.h"
 #include "smu74_discrete.h"
-
+#include "smu7_smumgr.h"
 
 #define SMC_RAM_END 0x40000
 
@@ -51,13 +51,7 @@ struct polaris10_pt_defaults {
 	uint16_t  BAPMTI_RC[SMU74_DTE_ITERATIONS * SMU74_DTE_SOURCES * SMU74_DTE_SINKS];
 };
 
-struct polaris10_buffer_entry {
-	uint32_t data_size;
-	uint32_t mc_addr_low;
-	uint32_t mc_addr_high;
-	void *kaddr;
-	unsigned long  handle;
-};
+
 
 struct polaris10_range_table {
 	uint32_t trans_lower_frequency; /* in 10khz */
@@ -65,24 +59,8 @@ struct polaris10_range_table {
 };
 
 struct polaris10_smumgr {
-	uint8_t *header;
-	uint8_t *mec_image;
-	struct polaris10_buffer_entry smu_buffer;
-	struct polaris10_buffer_entry header_buffer;
-
-	uint32_t                             soft_regs_start;
-	uint32_t                             dpm_table_start;
-	uint32_t                             mc_reg_table_start;
-	uint32_t                             fan_table_start;
-	uint32_t                             arb_table_start;
-
-	uint8_t *read_rrm_straps;
-	uint32_t read_drm_straps_mc_address_high;
-	uint32_t read_drm_straps_mc_address_low;
-	uint32_t acpi_optimization;
-	bool post_initial_boot;
+	struct smu7_smumgr smu7_data;
 	uint8_t protected_mode;
-	uint8_t security_hard_key;
 	struct polaris10_avfs  avfs;
 	SMU74_Discrete_DpmTable              smc_state_table;
 	struct SMU74_Discrete_Ulv            ulv_setting;
@@ -94,10 +72,4 @@ struct polaris10_smumgr {
 };
 
 
-int polaris10_smum_init(struct pp_smumgr *smumgr);
-int polaris10_read_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t *value, uint32_t limit);
-int polaris10_write_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t value, uint32_t limit);
-int polaris10_copy_bytes_to_smc(struct pp_smumgr *smumgr, uint32_t smc_start_address,
-				const uint8_t *src, uint32_t byte_count, uint32_t limit);
-
 #endif
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#13 lore raw

PATCH 12/20 drm/amd/powerplay: use smu7 common functions and data on Fiji.

In reply to a message not in the archive
Change-Id Ie63ee99aa515e37943aee726103260819c9e2913
---
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    |  69 +--
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c | 605 +--------------------
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h |  29 +-
 3 files changed, 68 insertions(+), 635 deletions(-)
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c +36 -33
index fd0c001..76310ac 100644
@@ -42,6 +42,7 @@
 #include "bif/bif_5_0_sh_mask.h"
 #include "dce/dce_10_0_d.h"
 #include "dce/dce_10_0_sh_mask.h"
+#include "smu7_smumgr.h"
 
 #define VOLTAGE_SCALE 4
 #define POWERTUNE_DEFAULT_SET_MAX    1
@@ -337,7 +338,7 @@ static int fiji_populate_dw8(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offset)
 	const struct fiji_pt_defaults *defaults = smu_data->power_tune_defaults;
 	uint32_t temp;
 
-	if (fiji_read_smc_sram_dword(hwmgr->smumgr,
+	if (smu7_read_smc_sram_dword(hwmgr->smumgr,
 			fuse_table_offset +
 			offsetof(SMU73_Discrete_PmFuses, TdcWaterfallCtl),
 			(uint32_t *)&temp, SMC_RAM_END))
@@ -429,7 +430,7 @@ static int fiji_populate_pm_fuses(struct pp_hwmgr *hwmgr)
 
 	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_PowerContainment)) {
-		if (fiji_read_smc_sram_dword(hwmgr->smumgr,
+		if (smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU7_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU73_Firmware_Header, PmFuseTable),
 				&pm_fuse_table_offset, SMC_RAM_END))
@@ -483,7 +484,7 @@ static int fiji_populate_pm_fuses(struct pp_hwmgr *hwmgr)
 					"Attempt to populate BapmVddCBaseLeakage Hi and Lo "
 					"Sidd Failed!", return -EINVAL);
 
-		if (fiji_copy_bytes_to_smc(hwmgr->smumgr, pm_fuse_table_offset,
+		if (smu7_copy_bytes_to_smc(hwmgr->smumgr, pm_fuse_table_offset,
 				(uint8_t *)&smu_data->power_tune_table,
 				sizeof(struct SMU73_Discrete_PmFuses), SMC_RAM_END))
 			PP_ASSERT_WITH_CODE(false,
@@ -781,7 +782,7 @@ int fiji_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
 	struct phm_ppt_v1_pcie_table *pcie_table = table_info->pcie_table;
 	uint8_t pcie_entry_cnt = (uint8_t) data->dpm_table.pcie_speed_table.count;
 	int result = 0;
-	uint32_t array = smu_data->dpm_table_start +
+	uint32_t array = smu_data->smu7_data.dpm_table_start +
 			offsetof(SMU73_Discrete_DpmTable, GraphicsLevel);
 	uint32_t array_size = sizeof(struct SMU73_Discrete_GraphicsLevel) *
 			SMU73_MAX_LEVELS_GRAPHICS;
@@ -858,7 +859,7 @@ int fiji_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
 		levels[1].pcieDpmLevel = mid_pcie_level_enabled;
 	}
 	/* level count will send to smc once at init smc table and never change */
-	result = fiji_copy_bytes_to_smc(hwmgr->smumgr, array, (uint8_t *)levels,
+	result = smu7_copy_bytes_to_smc(hwmgr->smumgr, array, (uint8_t *)levels,
 			(uint32_t)array_size, SMC_RAM_END);
 
 	return result;
@@ -1003,7 +1004,7 @@ int fiji_populate_all_memory_levels(struct pp_hwmgr *hwmgr)
 	struct smu7_dpm_table *dpm_table = &data->dpm_table;
 	int result;
 	/* populate MCLK dpm table to SMU7 */
-	uint32_t array = smu_data->dpm_table_start +
+	uint32_t array = smu_data->smu7_data.dpm_table_start +
 			offsetof(SMU73_Discrete_DpmTable, MemoryLevel);
 	uint32_t array_size = sizeof(SMU73_Discrete_MemoryLevel) *
 			SMU73_MAX_LEVELS_MEMORY;
@@ -1042,7 +1043,7 @@ int fiji_populate_all_memory_levels(struct pp_hwmgr *hwmgr)
 			PPSMC_DISPLAY_WATERMARK_HIGH;
 
 	/* level count will send to smc once at init smc table and never change */
-	result = fiji_copy_bytes_to_smc(hwmgr->smumgr, array, (uint8_t *)levels,
+	result = smu7_copy_bytes_to_smc(hwmgr->smumgr, array, (uint8_t *)levels,
 			(uint32_t)array_size, SMC_RAM_END);
 
 	return result;
@@ -1368,9 +1369,9 @@ static int fiji_program_memory_timing_parameters(struct pp_hwmgr *hwmgr)
 	}
 
 	if (!result)
-		result = fiji_copy_bytes_to_smc(
+		result = smu7_copy_bytes_to_smc(
 				hwmgr->smumgr,
-				smu_data->arb_table_start,
+				smu_data->smu7_data.arb_table_start,
 				(uint8_t *)&arb_regs,
 				sizeof(SMU73_Discrete_MCArbDramTimingTable),
 				SMC_RAM_END);
@@ -1707,8 +1708,8 @@ static int fiji_init_arb_table_index(struct pp_smumgr *smumgr)
 	 * In reality this field should not be in that structure
 	 * but in a soft register.
 	 */
-	result = fiji_read_smc_sram_dword(smumgr,
-			smu_data->arb_table_start, &tmp, SMC_RAM_END);
+	result = smu7_read_smc_sram_dword(smumgr,
+			smu_data->smu7_data.arb_table_start, &tmp, SMC_RAM_END);
 
 	if (result)
 		return result;
@@ -1716,8 +1717,8 @@ static int fiji_init_arb_table_index(struct pp_smumgr *smumgr)
 	tmp &= 0x00FFFFFF;
 	tmp |= ((uint32_t)MC_CG_ARB_FREQ_F1) << 24;
 
-	return fiji_write_smc_sram_dword(smumgr,
-			smu_data->arb_table_start,  tmp, SMC_RAM_END);
+	return smu7_write_smc_sram_dword(smumgr,
+			smu_data->smu7_data.arb_table_start,  tmp, SMC_RAM_END);
 }
 
 /**
@@ -1917,8 +1918,8 @@ int fiji_init_smc_table(struct pp_hwmgr *hwmgr)
 	CONVERT_FROM_HOST_TO_SMC_US(table->PhaseResponseTime);
 
 	/* Upload all dpm data to SMC memory.(dpm level, dpm level count etc) */
-	result = fiji_copy_bytes_to_smc(hwmgr->smumgr,
-			smu_data->dpm_table_start +
+	result = smu7_copy_bytes_to_smc(hwmgr->smumgr,
+			smu_data->smu7_data.dpm_table_start +
 			offsetof(SMU73_Discrete_DpmTable, SystemFlags),
 			(uint8_t *)&(table->SystemFlags),
 			sizeof(SMU73_Discrete_DpmTable) - 3 * sizeof(SMU73_PIDController),
@@ -1957,7 +1958,7 @@ int fiji_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
 	int res;
 	uint64_t tmp64;
 
-	if (smu_data->fan_table_start == 0) {
+	if (smu_data->smu7_data.fan_table_start == 0) {
 		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
 				PHM_PlatformCaps_MicrocodeFanControl);
 		return 0;
@@ -2023,7 +2024,7 @@ int fiji_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
 			hwmgr->device, CGS_IND_REG__SMC,
 			CG_MULT_THERMAL_CTRL, TEMP_SEL);
 
-	res = fiji_copy_bytes_to_smc(hwmgr->smumgr, smu_data->fan_table_start,
+	res = smu7_copy_bytes_to_smc(hwmgr->smumgr, smu_data->smu7_data.fan_table_start,
 			(uint8_t *)&fan_table, (uint32_t)sizeof(fan_table),
 			SMC_RAM_END);
 
@@ -2078,9 +2079,9 @@ int fiji_update_sclk_threshold(struct pp_hwmgr *hwmgr)
 
 		CONVERT_FROM_HOST_TO_SMC_UL(low_sclk_interrupt_threshold);
 
-		result = fiji_copy_bytes_to_smc(
+		result = smu7_copy_bytes_to_smc(
 				hwmgr->smumgr,
-				smu_data->dpm_table_start +
+				smu_data->smu7_data.dpm_table_start +
 				offsetof(SMU73_Discrete_DpmTable,
 					LowSclkInterruptThreshold),
 				(uint8_t *)&low_sclk_interrupt_threshold,
@@ -2109,6 +2110,8 @@ uint32_t fiji_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU73_SoftRegisters, PreVBlankGap);
 		case VBlankTimeout:
 			return offsetof(SMU73_SoftRegisters, VBlankTimeout);
+		case UcodeLoadStatus:
+			return offsetof(SMU73_SoftRegisters, UcodeLoadStatus);
 		}
 	case SMU_Discrete_DpmTable:
 		switch (member) {
@@ -2163,7 +2166,7 @@ static int fiji_update_uvd_smc_table(struct pp_hwmgr *hwmgr)
 	if (table_info->mm_dep_table->count > 0)
 		smu_data->smc_state_table.UvdBootLevel =
 				(uint8_t) (table_info->mm_dep_table->count - 1);
-	mm_boot_level_offset = smu_data->dpm_table_start + offsetof(SMU73_Discrete_DpmTable,
+	mm_boot_level_offset = smu_data->smu7_data.dpm_table_start + offsetof(SMU73_Discrete_DpmTable,
 						UvdBootLevel);
 	mm_boot_level_offset /= 4;
 	mm_boot_level_offset *= 4;
@@ -2198,7 +2201,7 @@ static int fiji_update_vce_smc_table(struct pp_hwmgr *hwmgr)
 	else
 		smu_data->smc_state_table.VceBootLevel = 0;
 
-	mm_boot_level_offset = smu_data->dpm_table_start +
+	mm_boot_level_offset = smu_data->smu7_data.dpm_table_start +
 					offsetof(SMU73_Discrete_DpmTable, VceBootLevel);
 	mm_boot_level_offset /= 4;
 	mm_boot_level_offset *= 4;
@@ -2223,7 +2226,7 @@ static int fiji_update_samu_smc_table(struct pp_hwmgr *hwmgr)
 
 
 	smu_data->smc_state_table.SamuBootLevel = 0;
-	mm_boot_level_offset = smu_data->dpm_table_start +
+	mm_boot_level_offset = smu_data->smu7_data.dpm_table_start +
 				offsetof(SMU73_Discrete_DpmTable, SamuBootLevel);
 
 	mm_boot_level_offset /= 4;
@@ -2276,57 +2279,57 @@ int fiji_process_firmware_header(struct pp_hwmgr *hwmgr)
 	int result;
 	bool error = false;
 
-	result = fiji_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 			SMU7_FIRMWARE_HEADER_LOCATION +
 			offsetof(SMU73_Firmware_Header, DpmTable),
 			&tmp, SMC_RAM_END);
 
 	if (0 == result)
-		smu_data->dpm_table_start = tmp;
+		smu_data->smu7_data.dpm_table_start = tmp;
 
 	error |= (0 != result);
 
-	result = fiji_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 			SMU7_FIRMWARE_HEADER_LOCATION +
 			offsetof(SMU73_Firmware_Header, SoftRegisters),
 			&tmp, SMC_RAM_END);
 
 	if (!result) {
 		data->soft_regs_start = tmp;
-		smu_data->soft_regs_start = tmp;
+		smu_data->smu7_data.soft_regs_start = tmp;
 	}
 
 	error |= (0 != result);
 
-	result = fiji_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 			SMU7_FIRMWARE_HEADER_LOCATION +
 			offsetof(SMU73_Firmware_Header, mcRegisterTable),
 			&tmp, SMC_RAM_END);
 
 	if (!result)
-		smu_data->mc_reg_table_start = tmp;
+		smu_data->smu7_data.mc_reg_table_start = tmp;
 
-	result = fiji_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 			SMU7_FIRMWARE_HEADER_LOCATION +
 			offsetof(SMU73_Firmware_Header, FanTable),
 			&tmp, SMC_RAM_END);
 
 	if (!result)
-		smu_data->fan_table_start = tmp;
+		smu_data->smu7_data.fan_table_start = tmp;
 
 	error |= (0 != result);
 
-	result = fiji_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 			SMU7_FIRMWARE_HEADER_LOCATION +
 			offsetof(SMU73_Firmware_Header, mcArbDramTimingTable),
 			&tmp, SMC_RAM_END);
 
 	if (!result)
-		smu_data->arb_table_start = tmp;
+		smu_data->smu7_data.arb_table_start = tmp;
 
 	error |= (0 != result);
 
-	result = fiji_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 			SMU7_FIRMWARE_HEADER_LOCATION +
 			offsetof(SMU73_Firmware_Header, Version),
 			&tmp, SMC_RAM_END);
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c +28 -577

730 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h +4 -25
index 291f704..adcbdfb 100644
@@ -25,35 +25,20 @@
 
 #include "smu73_discrete.h"
 #include <pp_endian.h>
+#include "smu7_smumgr.h"
+
 
-#define SMC_RAM_END		0x40000
 
 struct fiji_smu_avfs {
 	enum AVFS_BTC_STATUS AvfsBtcStatus;
 	uint32_t           AvfsBtcParam;
 };
 
-struct fiji_buffer_entry {
-	uint32_t data_size;
-	uint32_t mc_addr_low;
-	uint32_t mc_addr_high;
-	void *kaddr;
-	unsigned long  handle;
-};
 
 struct fiji_smumgr {
-	uint8_t        *header;
-	uint8_t        *mec_image;
+	struct smu7_smumgr                   smu7_data;
 
-	uint32_t                             soft_regs_start;
-	uint32_t                             dpm_table_start;
-	uint32_t                             mc_reg_table_start;
-	uint32_t                             fan_table_start;
-	uint32_t                             arb_table_start;
 	struct fiji_smu_avfs avfs;
-	uint32_t        acpi_optimization;
-	struct fiji_buffer_entry header_buffer;
-
 	struct SMU73_Discrete_DpmTable       smc_state_table;
 	struct SMU73_Discrete_Ulv            ulv_setting;
 	struct SMU73_Discrete_PmFuses  power_tune_table;
@@ -62,13 +47,7 @@ struct fiji_smumgr {
 
 };
 
-int fiji_smum_init(struct pp_smumgr *smumgr);
-int fiji_read_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smcAddress,
-		uint32_t *value, uint32_t limit);
-int fiji_write_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr,
-		uint32_t value, uint32_t limit);
-int fiji_copy_bytes_to_smc(struct pp_smumgr *smumgr, uint32_t smcStartAddress,
-		const uint8_t *src,	uint32_t byteCount, uint32_t limit);
+
 
 #endif
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#14 lore raw

PATCH 13/20 drm/amd/powerplay: use smu7 common functions and data on icelannd.

In reply to a message not in the archive
Change-Id I8144e52141f7e6a49a18be3523540a6edd898ec0
---
 .../gpu/drm/amd/powerplay/hwmgr/iceland_hwmgr.c    |  50 +-
 .../drm/amd/powerplay/hwmgr/iceland_powertune.c    |   6 +-
 .../gpu/drm/amd/powerplay/hwmgr/iceland_thermal.c  |   2 +-
 .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c  | 598 ++-------------------
 .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.h  |  35 +-
 5 files changed, 82 insertions(+), 609 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/iceland_hwmgr.c +16 -34
index 3128228..742d9b5 100644
@@ -767,12 +767,7 @@ int iceland_program_voting_clients(struct pp_hwmgr *hwmgr)
 
 static int iceland_upload_firmware(struct pp_hwmgr *hwmgr)
 {
-	int ret = 0;
-
-	if (!iceland_is_smc_ram_running(hwmgr->smumgr))
-		ret = iceland_smu_upload_firmware_image(hwmgr->smumgr);
-
-	return ret;
+	return 0;
 }
 
 /**
@@ -789,7 +784,7 @@ static int iceland_process_firmware_header(struct pp_hwmgr *hwmgr)
 	int result;
 	bool error = 0;
 
-	result = iceland_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU71_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU71_Firmware_Header, DpmTable),
 				&tmp, data->sram_end);
@@ -800,7 +795,7 @@ static int iceland_process_firmware_header(struct pp_hwmgr *hwmgr)
 
 	error |= (0 != result);
 
-	result = iceland_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU71_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU71_Firmware_Header, SoftRegisters),
 				&tmp, data->sram_end);
@@ -812,7 +807,7 @@ static int iceland_process_firmware_header(struct pp_hwmgr *hwmgr)
 	error |= (0 != result);
 
 
-	result = iceland_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU71_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU71_Firmware_Header, mcRegisterTable),
 				&tmp, data->sram_end);
@@ -821,7 +816,7 @@ static int iceland_process_firmware_header(struct pp_hwmgr *hwmgr)
 		data->mc_reg_table_start = tmp;
 	}
 
-	result = iceland_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU71_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU71_Firmware_Header, FanTable),
 				&tmp, data->sram_end);
@@ -832,7 +827,7 @@ static int iceland_process_firmware_header(struct pp_hwmgr *hwmgr)
 
 	error |= (0 != result);
 
-	result = iceland_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU71_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU71_Firmware_Header, mcArbDramTimingTable),
 				&tmp, data->sram_end);
@@ -844,7 +839,7 @@ static int iceland_process_firmware_header(struct pp_hwmgr *hwmgr)
 	error |= (0 != result);
 
 
-	result = iceland_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU71_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU71_Firmware_Header, Version),
 				&tmp, data->sram_end);
@@ -855,7 +850,7 @@ static int iceland_process_firmware_header(struct pp_hwmgr *hwmgr)
 
 	error |= (0 != result);
 
-	result = iceland_read_smc_sram_dword(hwmgr->smumgr,
+	result = smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU71_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU71_Firmware_Header, UlvSettings),
 				&tmp, data->sram_end);
@@ -1507,7 +1502,7 @@ int iceland_program_memory_timing_parameters(struct pp_hwmgr *hwmgr)
 	}
 
 	if (0 == result) {
-		result = iceland_copy_bytes_to_smc(
+		result = smu7_copy_bytes_to_smc(
 				hwmgr->smumgr,
 				data->arb_table_start,
 				(uint8_t *)&arb_regs,
@@ -2438,7 +2433,7 @@ static int iceland_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
 	data->smc_state_table.GraphicsLevel[1].pcieDpmLevel = mid_pcie_level_enabled;
 
 	/* level count will send to smc once at init smc table and never change*/
-	result = iceland_copy_bytes_to_smc(hwmgr->smumgr, level_array_adress, (uint8_t *)levels, (uint32_t)level_array_size, data->sram_end);
+	result = smu7_copy_bytes_to_smc(hwmgr->smumgr, level_array_adress, (uint8_t *)levels, (uint32_t)level_array_size, data->sram_end);
 
 	if (0 != result)
 		return result;
@@ -2492,7 +2487,7 @@ static int iceland_populate_all_memory_levels(struct pp_hwmgr *hwmgr)
 	data->smc_state_table.MemoryLevel[dpm_table->mclk_table.count-1].DisplayWatermark = PPSMC_DISPLAY_WATERMARK_HIGH;
 
 	/* level count will send to smc once at init smc table and never change*/
-	result = iceland_copy_bytes_to_smc(hwmgr->smumgr,
+	result = smu7_copy_bytes_to_smc(hwmgr->smumgr,
 		level_array_adress, (uint8_t *)levels, (uint32_t)level_array_size, data->sram_end);
 
 	if (0 != result) {
@@ -2754,7 +2749,7 @@ static int iceland_init_smc_table(struct pp_hwmgr *hwmgr)
 	table->BootMVdd = PP_HOST_TO_SMC_US(table->BootMVdd * VOLTAGE_SCALE);
 
 	/* Upload all dpm data to SMC memory.(dpm level, dpm level count etc) */
-	result = iceland_copy_bytes_to_smc(hwmgr->smumgr, data->dpm_table_start +
+	result = smu7_copy_bytes_to_smc(hwmgr->smumgr, data->dpm_table_start +
 				offsetof(SMU71_Discrete_DpmTable, SystemFlags),
 				(uint8_t *)&(table->SystemFlags),
 				sizeof(SMU71_Discrete_DpmTable) - 3 * sizeof(SMU71_PIDController),
@@ -2764,7 +2759,7 @@ static int iceland_init_smc_table(struct pp_hwmgr *hwmgr)
 		"Failed to upload dpm data to SMC memory!", return result);
 
 	/* Upload all ulv setting to SMC memory.(dpm level, dpm level count etc) */
-	result = iceland_copy_bytes_to_smc(hwmgr->smumgr,
+	result = smu7_copy_bytes_to_smc(hwmgr->smumgr,
 			data->ulv_settings_start,
 			(uint8_t *)&(data->ulv_setting),
 			sizeof(SMU71_Discrete_Ulv),
@@ -2884,7 +2879,7 @@ int iceland_populate_initial_mc_reg_table(struct pp_hwmgr *hwmgr)
 	PP_ASSERT_WITH_CODE(0 == result,
 		"Failed to initialize MCRegTable for driver state!", return result;);
 
-	return iceland_copy_bytes_to_smc(hwmgr->smumgr, data->mc_reg_table_start,
+	return smu7_copy_bytes_to_smc(hwmgr->smumgr, data->mc_reg_table_start,
 			(uint8_t *)&data->mc_reg_table, sizeof(SMU71_Discrete_MCRegisters), data->sram_end);
 }
 
@@ -3047,15 +3042,6 @@ static int iceland_enable_thermal_auto_throttle(struct pp_hwmgr *hwmgr)
 	return iceland_enable_auto_throttle_source(hwmgr, PHM_AutoThrottleSource_Thermal);
 }
 
-static int iceland_tf_start_smc(struct pp_hwmgr *hwmgr)
-{
-	int ret = 0;
-
-	if (!iceland_is_smc_ram_running(hwmgr->smumgr))
-		ret = iceland_smu_start_smc(hwmgr->smumgr);
-
-	return ret;
-}
 
 /**
 * Programs the Deep Sleep registers
@@ -3141,10 +3127,6 @@ static int iceland_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
 	PP_ASSERT_WITH_CODE((0 == tmp_result),
 		"Failed to populate PM fuses!", return tmp_result);
 
-	/* start SMC */
-	tmp_result = iceland_tf_start_smc(hwmgr);
-	PP_ASSERT_WITH_CODE((0 == tmp_result),
-		"Failed to start SMC!", return tmp_result);
 
 	/* enable SCLK control */
 	tmp_result = iceland_enable_sclk_control(hwmgr);
@@ -4636,7 +4618,7 @@ static int iceland_update_sclk_threshold(struct pp_hwmgr *hwmgr)
 
 		CONVERT_FROM_HOST_TO_SMC_UL(low_sclk_interrupt_threshold);
 
-		result = iceland_copy_bytes_to_smc(
+		result = smu7_copy_bytes_to_smc(
 				hwmgr->smumgr,
 				data->dpm_table_start + offsetof(SMU71_Discrete_DpmTable,
 				LowSclkInterruptThreshold),
@@ -4670,7 +4652,7 @@ static int iceland_update_and_upload_mc_reg_table(struct pp_hwmgr *hwmgr)
 
 	address = data->mc_reg_table_start + (uint32_t)offsetof(SMU71_Discrete_MCRegisters, data[0]);
 
-	return  iceland_copy_bytes_to_smc(hwmgr->smumgr, address,
+	return  smu7_copy_bytes_to_smc(hwmgr->smumgr, address,
 				 (uint8_t *)&data->mc_reg_table.data[0],
 				sizeof(SMU71_Discrete_MCRegisterSet) * data->dpm_table.mclk_table.count,
 				data->sram_end);
drivers/gpu/drm/amd/powerplay/hwmgr/iceland_powertune.c +3 -3
index 041e964..7662806 100644
@@ -239,7 +239,7 @@ static int iceland_populate_dw8(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offs
 	const struct iceland_pt_defaults *defaults = data->power_tune_defaults;
 	uint32_t temp;
 
-	if (iceland_read_smc_sram_dword(hwmgr->smumgr,
+	if (smu7_read_smc_sram_dword(hwmgr->smumgr,
 			fuse_table_offset +
 			offsetof(SMU71_Discrete_PmFuses, TdcWaterfallCtl),
 			(uint32_t *)&temp, data->sram_end))
@@ -299,7 +299,7 @@ int iceland_populate_pm_fuses(struct pp_hwmgr *hwmgr)
 
 	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_PowerContainment)) {
-		if (iceland_read_smc_sram_dword(hwmgr->smumgr,
+		if (smu7_read_smc_sram_dword(hwmgr->smumgr,
 				SMU71_FIRMWARE_HEADER_LOCATION +
 				offsetof(SMU71_Firmware_Header, PmFuseTable),
 				&pm_fuse_table_offset, data->sram_end))
@@ -359,7 +359,7 @@ int iceland_populate_pm_fuses(struct pp_hwmgr *hwmgr)
 					"Attempt to populate BapmVddCBaseLeakage Hi and Lo Sidd Failed!",
 					return -EINVAL);
 
-		if (iceland_copy_bytes_to_smc(hwmgr->smumgr, pm_fuse_table_offset,
+		if (smu7_copy_bytes_to_smc(hwmgr->smumgr, pm_fuse_table_offset,
 				(uint8_t *)&data->power_tune_table,
 				sizeof(struct SMU71_Discrete_PmFuses), data->sram_end))
 			PP_ASSERT_WITH_CODE(false,
drivers/gpu/drm/amd/powerplay/hwmgr/iceland_thermal.c +1 -1
index 527f370..45d17d7 100644
@@ -426,7 +426,7 @@ int tf_iceland_thermal_setup_fan_table(struct pp_hwmgr *hwmgr, void *input, void
 
 	//fan_table.FanControl_GL_Flag = 1;
 
-	res = iceland_copy_bytes_to_smc(hwmgr->smumgr, data->fan_table_start, (uint8_t *)&fan_table, (uint32_t)sizeof(fan_table), data->sram_end);
+	res = smu7_copy_bytes_to_smc(hwmgr->smumgr, data->fan_table_start, (uint8_t *)&fan_table, (uint32_t)sizeof(fan_table), data->sram_end);
 /* TO DO FOR SOME DEVICE ID 0X692b, send this msg return invalid command.
 	if (res == 0 && hwmgr->thermal_controller.advanceFanControlParameters.ucMinimumPWMLimit != 0)
 		res = (0 == smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_SetFanMinPwm, \
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c +58 -540

674 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.h +4 -31
index 62009a7..331e278 100644
@@ -26,39 +26,12 @@
 #ifndef _ICELAND_SMUMGR_H_
 #define _ICELAND_SMUMGR_H_
 
-struct iceland_buffer_entry {
-	uint32_t data_size;
-	uint32_t mc_addr_low;
-	uint32_t mc_addr_high;
-	void *kaddr;
-	unsigned long  handle;
-};
-
-/* Iceland only has header_buffer, don't have smu buffer. */
-struct iceland_smumgr {
-	uint8_t *pHeader;
-	uint8_t *pMecImage;
-	uint32_t ulSoftRegsStart;
-
-	struct iceland_buffer_entry header_buffer;
-};
-
-extern int iceland_smum_init(struct pp_smumgr *smumgr);
-extern int iceland_copy_bytes_to_smc(struct pp_smumgr *smumgr,
-				     uint32_t smcStartAddress,
-				     const uint8_t *src,
-				     uint32_t byteCount, uint32_t limit);
 
-extern int iceland_smu_start_smc(struct pp_smumgr *smumgr);
+#include "smu7_smumgr.h"
 
-extern int iceland_read_smc_sram_dword(struct pp_smumgr *smumgr,
-				       uint32_t smcAddress,
-				       uint32_t *value, uint32_t limit);
-extern int iceland_write_smc_sram_dword(struct pp_smumgr *smumgr,
-					uint32_t smcAddress,
-					uint32_t value, uint32_t limit);
 
-extern bool iceland_is_smc_ram_running(struct pp_smumgr *smumgr);
-extern int iceland_smu_upload_firmware_image(struct pp_smumgr *smumgr);
+struct iceland_smumgr {
+	struct smu7_smumgr smu7_data;
+};
 
 #endif
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#15 lore raw

PATCH 14/20 drm/amd/powerplay: rename tonga_processpptable* to processpptable_v1_0*.

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |    2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/pptable_v1_0.h |  436 +++++++
 .../amd/powerplay/hwmgr/process_pptables_v1_0.c    | 1326 ++++++++++++++++++++
 .../amd/powerplay/hwmgr/process_pptables_v1_0.h    |   35 +
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |   10 +-
 .../gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h    |  436 -------
 .../amd/powerplay/hwmgr/tonga_processpptables.c    | 1326 --------------------
 .../amd/powerplay/hwmgr/tonga_processpptables.h    |   35 -
 8 files changed, 1803 insertions(+), 1803 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pptable_v1_0.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +1 -1
index 1158e3e..129c1d0 100644
@@ -5,7 +5,7 @@
 HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
 		hardwaremanager.o pp_acpi.o cz_hwmgr.o \
 		cz_clockpowergating.o pppcielanes.o\
-		tonga_processpptables.o ppatomctrl.o \
+		process_pptables_v1_0.o ppatomctrl.o \
 		pppcielanes.o  \
 		smu7_hwmgr.o smu7_powertune.o smu7_thermal.o \
 		smu7_clockpowergating.o iceland_hwmgr.o \
drivers/gpu/drm/amd/powerplay/hwmgr/pptable_v1_0.h new file +436 -0

436 lines not on this page · raw message

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

1,326 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.h new file +35 -0
new file mode 100644
index 0000000..b9710ab
@@ -0,0 +1,35 @@
+/*
+ * 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 _PROCESSPPTABLES_V1_0_H
+#define _PROCESSPPTABLES_V1_0_H
+
+#include "hwmgr.h"
+
+extern const struct pp_table_func pptable_v1_0_funcs;
+extern int get_number_of_powerplay_table_entries_v1_0(struct pp_hwmgr *hwmgr);
+extern int get_powerplay_table_entry_v1_0(struct pp_hwmgr *hwmgr, uint32_t entry_index,
+		struct pp_power_state *power_state, int (*call_back_func)(struct pp_hwmgr *, void *,
+				struct pp_power_state *, void *, uint32_t));
+
+#endif
+
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +5 -5
index 645b370..4379697 100644
@@ -29,11 +29,11 @@
 #include "pp_debug.h"
 #include "ppatomctrl.h"
 #include "atombios.h"
-#include "tonga_pptable.h"
+#include "pptable_v1_0.h"
 #include "pppcielanes.h"
 #include "amd_pcie_helpers.h"
 #include "hardwaremanager.h"
-#include "tonga_processpptables.h"
+#include "process_pptables_v1_0.h"
 #include "cgs_common.h"
 
 #include "smu7_common.h"
@@ -2368,7 +2368,7 @@ static int smu7_get_pp_table_entry(struct pp_hwmgr *hwmgr,
 
 	ps = (struct smu7_power_state *)(&state->hardware);
 
-	result = tonga_get_powerplay_table_entry(hwmgr, entry_index, state,
+	result = get_powerplay_table_entry_v1_0(hwmgr, entry_index, state,
 			smu7_get_pp_table_entry_callback_func);
 
 	/* This is the earliest time we have all the dependency table and the VBIOS boot state
@@ -3558,7 +3558,7 @@ static struct pp_hwmgr_func smu7_hwmgr_funcs = {
 	.get_sclk = smu7_dpm_get_sclk,
 	.patch_boot_state = smu7_dpm_patch_boot_state,
 	.get_pp_table_entry = smu7_get_pp_table_entry,
-	.get_num_of_pp_table_entries = tonga_get_number_of_powerplay_table_entries,
+	.get_num_of_pp_table_entries = get_number_of_powerplay_table_entries_v1_0,
 	.print_current_perforce_level = smu7_print_current_perforce_level,
 	.powerdown_uvd = smu7_powerdown_uvd,
 	.powergate_uvd = smu7_powergate_uvd,
@@ -3614,7 +3614,7 @@ int smu7_hwmgr_init(struct pp_hwmgr *hwmgr)
 	int ret = 0;
 
 	hwmgr->hwmgr_func = &smu7_hwmgr_funcs;
-	hwmgr->pptable_func = &tonga_pptable_funcs;
+	hwmgr->pptable_func = &pptable_v1_0_funcs;
 	pp_smu7_thermal_initialize(hwmgr);
 
 	return ret;
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h deleted +0 -436

436 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c deleted +0 -1326

722 lines not on this page · raw message

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

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.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

author
#16 lore raw

PATCH 15/20 drm/amd/powerplay: add pp_table_version in hwmgr.

In reply to a message not in the archive
Change-Id Iee3c7ab9c1318ec7206bf5a5ae59d8c48b8e823b

Conflicts:
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h

---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +8 -0
index 8916b94..909f854 100644
@@ -599,6 +599,13 @@ enum PP_VCE_LEVEL {
 };
 
 
+enum PP_TABLE_VERSION {
+	PP_TABLE_V0 = 0,
+	PP_TABLE_V1,
+	PP_TABLE_V2,
+	PP_TABLE_MAX
+};
+
 /**
  * The main hardware manager structure.
  */
@@ -606,6 +613,7 @@ struct pp_hwmgr {
 	uint32_t chip_family;
 	uint32_t chip_id;
 
+	uint32_t pp_table_version;
 	void *device;
 	struct pp_smumgr *smumgr;
 	const void *soft_pp_table;
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#17 lore raw

PATCH 16/20 drm/amd/powerplay: add pp table v0 support in smu7_hwmgr.

In reply to a message not in the archive
Change-Id I5cbd25597b02a01e7de28347659139a5e0a30098
---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |   2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 704 +++++++++++++++++++--
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h   |   2 +-
 .../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c   |  15 +-
 4 files changed, 671 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +1 -1
index cb5627f..2b162ee 100644
@@ -70,7 +70,7 @@ int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 
 	hwmgr_init_default_caps(hwmgr);
 	hwmgr_set_user_specify_caps(hwmgr);
-
+	hwmgr->pp_table_version = PP_TABLE_V1;
 	switch (hwmgr->chip_family) {
 	case AMDGPU_FAMILY_CZ:
 		cz_hwmgr_init(hwmgr);
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +657 -47

896 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h +1 -1
index 46176c2..039081d 100644
@@ -208,7 +208,7 @@ struct smu7_hwmgr {
 	uint32_t                       pcie_lane_cap;
 	uint32_t                       pcie_spc_cap;
 	struct smu7_leakage_voltage          vddc_leakage;
-	struct smu7_leakage_voltage          Vddci_leakage;
+	struct smu7_leakage_voltage          vddci_leakage;
 	struct smu7_leakage_voltage          vddcgfx_leakage;
 
 	uint32_t                             mvdd_control;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c +12 -3
index e472480..260fce050 100644
@@ -616,8 +616,14 @@ int smu7_enable_power_containment(struct pp_hwmgr *hwmgr)
 			(struct phm_ppt_v1_information *)(hwmgr->pptable);
 	int smc_result;
 	int result = 0;
+	struct phm_cac_tdp_table *cac_table;
 
 	data->power_containment_features = 0;
+	if (hwmgr->pp_table_version == PP_TABLE_V1)
+		cac_table = table_info->cac_dtp_table;
+	else
+		cac_table = hwmgr->dyn_state.cac_dtp_table;
+
 	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_PowerContainment)) {
 
@@ -637,8 +643,6 @@ int smu7_enable_power_containment(struct pp_hwmgr *hwmgr)
 			PP_ASSERT_WITH_CODE((0 == smc_result),
 					"Failed to enable PkgPwrTracking in SMC.", result = -1;);
 			if (0 == smc_result) {
-				struct phm_cac_tdp_table *cac_table =
-						table_info->cac_dtp_table;
 				uint32_t default_limit =
 					(uint32_t)(cac_table->usMaximumPowerDeliveryLimit * 256);
 
@@ -699,10 +703,15 @@ int smu7_power_control_set_level(struct pp_hwmgr *hwmgr)
 {
 	struct phm_ppt_v1_information *table_info =
 			(struct phm_ppt_v1_information *)(hwmgr->pptable);
-	struct phm_cac_tdp_table *cac_table = table_info->cac_dtp_table;
+	struct phm_cac_tdp_table *cac_table;
+
 	int adjust_percent, target_tdp;
 	int result = 0;
 
+	if (hwmgr->pp_table_version == PP_TABLE_V1)
+		cac_table = table_info->cac_dtp_table;
+	else
+		cac_table = hwmgr->dyn_state.cac_dtp_table;
 	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_PowerContainment)) {
 		/* adjustment percentage has already been validated */
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#18 lore raw

PATCH 17/20 drm/amd/powerplay: add pptable point check before use it

In reply to a message not in the archive
Change-Id Ibad281cd7fd660abe612894df82be284c9b865a9
---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +2 -1
index 2b162ee..11a4683 100644
@@ -566,7 +566,8 @@ int phm_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwmgr
 		table_clk_vlt->entries[2].v = 810;
 		table_clk_vlt->entries[3].clk = PP_DAL_POWERLEVEL_PERFORMANCE;
 		table_clk_vlt->entries[3].v = 900;
-		pptable_info->vddc_dep_on_dal_pwrl = table_clk_vlt;
+		if (pptable_info != NULL)
+			pptable_info->vddc_dep_on_dal_pwrl = table_clk_vlt;
 		hwmgr->dyn_state.vddc_dep_on_dal_pwrl = table_clk_vlt;
 	}
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#19 lore raw

PATCH 18/20 drm/amd/powerplay: implement fw related smu interface for iceland.

In reply to a message not in the archive
Change-Id Ic5b83029c4e326ef4e02ee341ba8b1109d17328b
---
 .../drm/amd/powerplay/hwmgr/iceland_powertune.h    |   14 -
 drivers/gpu/drm/amd/powerplay/smumgr/Makefile      |    5 +-
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c | 2577 ++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.h |   40 +
 .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c  |   21 +-
 .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.h  |   34 +
 6 files changed, 2674 insertions(+), 17 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.h
drivers/gpu/drm/amd/powerplay/hwmgr/iceland_powertune.h +0 -14
index 6c25ee1..4008d49 100644
@@ -49,20 +49,6 @@ struct iceland_pt_config_reg {
 	enum iceland_pt_config_reg_type       type;
 };
 
-struct iceland_pt_defaults
-{
-	uint8_t   svi_load_line_en;
-	uint8_t   svi_load_line_vddc;
-	uint8_t   tdc_vddc_throttle_release_limit_perc;
-	uint8_t   tdc_mawt;
-	uint8_t   tdc_waterfall_ctl;
-	uint8_t   dte_ambient_temp_base;
-	uint32_t  display_cac;
-	uint32_t  bamp_temp_gradient;
-	uint16_t  bapmti_r[SMU71_DTE_ITERATIONS * SMU71_DTE_SOURCES * SMU71_DTE_SINKS];
-	uint16_t  bapmti_rc[SMU71_DTE_ITERATIONS * SMU71_DTE_SOURCES * SMU71_DTE_SINKS];
-};
-
 void iceland_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr);
 int iceland_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr);
 int iceland_populate_pm_fuses(struct pp_hwmgr *hwmgr);
drivers/gpu/drm/amd/powerplay/smumgr/Makefile +3 -2
index a4d7462..51ff083 100644
@@ -2,8 +2,9 @@
 # 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 fiji_smumgr.o fiji_smc.o\
-	  polaris10_smumgr.o iceland_smumgr.o polaris10_smc.o tonga_smc.o smu7_smumgr.o
+SMU_MGR = smumgr.o cz_smumgr.o tonga_smumgr.o fiji_smumgr.o fiji_smc.o \
+	  polaris10_smumgr.o iceland_smumgr.o polaris10_smc.o tonga_smc.o \
+	  smu7_smumgr.o iceland_smc.o
 
 AMD_PP_SMUMGR = $(addprefix $(AMD_PP_PATH)/smumgr/,$(SMU_MGR))
 
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c new file +2577 -0

2,577 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.h new file +40 -0
new file mode 100644
index 0000000..13c8dbb
@@ -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 _ICELAND_SMC_H
+#define _ICELAND_SMC_H
+
+#include "smumgr.h"
+
+
+int iceland_populate_all_graphic_levels(struct pp_hwmgr *hwmgr);
+int iceland_populate_all_memory_levels(struct pp_hwmgr *hwmgr);
+int iceland_init_smc_table(struct pp_hwmgr *hwmgr);
+int iceland_thermal_setup_fan_table(struct pp_hwmgr *hwmgr);
+int iceland_update_sclk_threshold(struct pp_hwmgr *hwmgr);
+uint32_t iceland_get_offsetof(uint32_t type, uint32_t member);
+uint32_t iceland_get_mac_definition(uint32_t value);
+int iceland_process_firmware_header(struct pp_hwmgr *hwmgr);
+int iceland_initialize_mc_reg_table(struct pp_hwmgr *hwmgr);
+bool iceland_is_dpm_running(struct pp_hwmgr *hwmgr);
+#endif
+
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c +20 -1
index 31b6de8..eeafefc 100644
@@ -35,6 +35,7 @@
 #include "smu/smu_7_1_1_d.h"
 #include "smu/smu_7_1_1_sh_mask.h"
 #include "cgs_common.h"
+#include "iceland_smc.h"
 
 #define ICELAND_SMC_SIZE               0x20000
 
@@ -199,7 +200,15 @@ static int iceland_start_smu(struct pp_smumgr *smumgr)
  */
 static int iceland_smu_init(struct pp_smumgr *smumgr)
 {
-	return smu7_init(smumgr);
+	int i;
+	struct iceland_smumgr *smu_data = (struct iceland_smumgr *)(smumgr->backend);
+	if (smu7_init(smumgr))
+		return -EINVAL;
+
+	for (i = 0; i < SMU71_MAX_LEVELS_GRAPHICS; i++)
+		smu_data->activity_target[i] = 30;
+
+	return 0;
 }
 
 static const struct pp_smumgr_func iceland_smu_funcs = {
@@ -213,6 +222,16 @@ static const struct pp_smumgr_func iceland_smu_funcs = {
 	.send_msg_to_smc_with_parameter = &smu7_send_msg_to_smc_with_parameter,
 	.download_pptable_settings = NULL,
 	.upload_pptable_settings = NULL,
+	.get_offsetof = iceland_get_offsetof,
+	.process_firmware_header = iceland_process_firmware_header,
+	.init_smc_table = iceland_init_smc_table,
+	.update_sclk_threshold = iceland_update_sclk_threshold,
+	.thermal_setup_fan_table = iceland_thermal_setup_fan_table,
+	.populate_all_graphic_levels = iceland_populate_all_graphic_levels,
+	.populate_all_memory_levels = iceland_populate_all_memory_levels,
+	.get_mac_definition = iceland_get_mac_definition,
+	.initialize_mc_reg_table = iceland_initialize_mc_reg_table,
+	.is_dpm_running = iceland_is_dpm_running,
 };
 
 int iceland_smum_init(struct pp_smumgr *smumgr)
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.h +34 -0
index 331e278..cfadfee 100644
@@ -28,10 +28,44 @@
 
 
 #include "smu7_smumgr.h"
+#include "pp_endian.h"
+#include "smu71_discrete.h"
 
+struct iceland_pt_defaults {
+	uint8_t   svi_load_line_en;
+	uint8_t   svi_load_line_vddc;
+	uint8_t   tdc_vddc_throttle_release_limit_perc;
+	uint8_t   tdc_mawt;
+	uint8_t   tdc_waterfall_ctl;
+	uint8_t   dte_ambient_temp_base;
+	uint32_t  display_cac;
+	uint32_t  bamp_temp_gradient;
+	uint16_t  bapmti_r[SMU71_DTE_ITERATIONS * SMU71_DTE_SOURCES * SMU71_DTE_SINKS];
+	uint16_t  bapmti_rc[SMU71_DTE_ITERATIONS * SMU71_DTE_SOURCES * SMU71_DTE_SINKS];
+};
+
+struct iceland_mc_reg_entry {
+	uint32_t mclk_max;
+	uint32_t mc_data[SMU71_DISCRETE_MC_REGISTER_ARRAY_SIZE];
+};
+
+struct iceland_mc_reg_table {
+	uint8_t   last;               /* number of registers*/
+	uint8_t   num_entries;        /* number of entries in mc_reg_table_entry used*/
+	uint16_t  validflag;          /* indicate the corresponding register is valid or not. 1: valid, 0: invalid. bit0->address[0], bit1->address[1], etc.*/
+	struct iceland_mc_reg_entry    mc_reg_table_entry[MAX_AC_TIMING_ENTRIES];
+	SMU71_Discrete_MCRegisterAddress mc_reg_address[SMU71_DISCRETE_MC_REGISTER_ARRAY_SIZE];
+};
 
 struct iceland_smumgr {
 	struct smu7_smumgr smu7_data;
+	struct SMU71_Discrete_DpmTable       smc_state_table;
+	struct SMU71_Discrete_PmFuses  power_tune_table;
+	struct SMU71_Discrete_Ulv            ulv_setting;
+	struct iceland_pt_defaults  *power_tune_defaults;
+	SMU71_Discrete_MCRegisters      mc_regs;
+	struct iceland_mc_reg_table mc_reg_table;
+	uint32_t        activity_target[SMU71_MAX_LEVELS_GRAPHICS];
 };
 
 #endif
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#20 lore raw

PATCH 19/20 drm/amd/powerplay: use smu7 hwmgr to manager iceland

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile |  4 +---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c  | 36 +++++++++++++++++++++-------
 2 files changed, 28 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +1 -3
index 129c1d0..cbf0153 100644
@@ -8,9 +8,7 @@ HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
 		process_pptables_v1_0.o ppatomctrl.o \
 		pppcielanes.o  \
 		smu7_hwmgr.o smu7_powertune.o smu7_thermal.o \
-		smu7_clockpowergating.o iceland_hwmgr.o \
-		iceland_clockpowergating.o iceland_thermal.o \
-		iceland_powertune.o
+		smu7_clockpowergating.o
 
 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
 
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +27 -9
index 11a4683..6354008 100644
@@ -36,13 +36,13 @@
 #include "amd_acpi.h"
 
 extern int cz_hwmgr_init(struct pp_hwmgr *hwmgr);
-extern int iceland_hwmgr_init(struct pp_hwmgr *hwmgr);
 
 static int polaris_set_asic_special_caps(struct pp_hwmgr *hwmgr);
 static void hwmgr_init_default_caps(struct pp_hwmgr *hwmgr);
 static int hwmgr_set_user_specify_caps(struct pp_hwmgr *hwmgr);
 static int fiji_set_asic_special_caps(struct pp_hwmgr *hwmgr);
 static int tonga_set_asic_special_caps(struct pp_hwmgr *hwmgr);
+static int topaz_set_asic_special_caps(struct pp_hwmgr *hwmgr);
 
 uint8_t convert_to_vid(uint16_t vddc)
 {
@@ -78,31 +78,33 @@ int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
 	case AMDGPU_FAMILY_VI:
 		switch (hwmgr->chip_id) {
 		case CHIP_TOPAZ:
-			iceland_hwmgr_init(hwmgr);
+			topaz_set_asic_special_caps(hwmgr);
+			hwmgr->feature_mask &= ~(PP_SMC_VOLTAGE_CONTROL_MASK |
+						PP_VBI_TIME_SUPPORT_MASK |
+						PP_ULV_MASK |
+						PP_ENABLE_GFX_CG_THRU_SMU);
+			hwmgr->pp_table_version = PP_TABLE_V0;
 			break;
 		case CHIP_TONGA:
-			smu7_hwmgr_init(hwmgr);
 			tonga_set_asic_special_caps(hwmgr);
 			hwmgr->feature_mask &= ~(PP_SMC_VOLTAGE_CONTROL_MASK |
 						PP_VBI_TIME_SUPPORT_MASK |
 						PP_ULV_MASK);
 			break;
 		case CHIP_FIJI:
-			smu7_hwmgr_init(hwmgr);
 			fiji_set_asic_special_caps(hwmgr);
 			hwmgr->feature_mask &= ~(PP_SMC_VOLTAGE_CONTROL_MASK |
-						PP_VBI_TIME_SUPPORT_MASK |
-						PP_ENABLE_GFX_CG_THRU_SMU);
+						PP_VBI_TIME_SUPPORT_MASK);
 			break;
 		case CHIP_POLARIS11:
 		case CHIP_POLARIS10:
-			smu7_hwmgr_init(hwmgr);
 			polaris_set_asic_special_caps(hwmgr);
 			hwmgr->feature_mask &= ~(PP_UVD_HANDSHAKE_MASK);
 			break;
 		default:
 			return -EINVAL;
 		}
+		smu7_hwmgr_init(hwmgr);
 		break;
 	default:
 		return -EINVAL;
@@ -215,8 +217,6 @@ int phm_wait_on_register(struct pp_hwmgr *hwmgr, uint32_t index,
 }
 
 
-
-
 /**
  * Returns once the part of the register indicated by the mask has
  * reached the given value.The indirect space is described by giving
@@ -830,3 +830,21 @@ int tonga_set_asic_special_caps(struct pp_hwmgr *hwmgr)
 
 	return 0;
 }
+
+int topaz_set_asic_special_caps(struct pp_hwmgr *hwmgr)
+{
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_SQRamping);
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_DBRamping);
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_TDRamping);
+	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_TCPRamping);
+
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_CAC);
+	phm_cap_set(hwmgr->platform_descriptor.platformCaps,
+		    PHM_PlatformCaps_EVV);
+	return 0;
+}
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#21 lore raw

PATCH 20/20 drm/amd/powerplay: delete useless files.

In reply to a message not in the archive
Change-Id I99cae788f2d6d4bb747c028b0c59f50ce459252b
---
 .../amd/powerplay/hwmgr/fiji_clockpowergating.c    |  121 -
 .../amd/powerplay/hwmgr/fiji_clockpowergating.h    |   35 -
 .../drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h    |  105 -
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c   | 5596 --------------------
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h   |  350 --
 .../gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c   |  610 ---
 .../gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h   |   81 -
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.c |  687 ---
 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.h |   62 -
 .../amd/powerplay/hwmgr/iceland_clockpowergating.c |  119 -
 .../amd/powerplay/hwmgr/iceland_clockpowergating.h |   38 -
 .../drm/amd/powerplay/hwmgr/iceland_dyn_defaults.h |   41 -
 .../gpu/drm/amd/powerplay/hwmgr/iceland_hwmgr.h    |  424 --
 .../drm/amd/powerplay/hwmgr/iceland_powertune.c    |  490 --
 .../gpu/drm/amd/powerplay/hwmgr/iceland_thermal.c  |  595 ---
 .../gpu/drm/amd/powerplay/hwmgr/iceland_thermal.h  |   58 -
 .../powerplay/hwmgr/polaris10_clockpowergating.c   |  444 --
 .../powerplay/hwmgr/polaris10_clockpowergating.h   |   40 -
 .../amd/powerplay/hwmgr/polaris10_dyn_defaults.h   |   62 -
 .../gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h  |  355 --
 .../drm/amd/powerplay/hwmgr/polaris10_powertune.c  |  988 ----
 .../drm/amd/powerplay/hwmgr/polaris10_powertune.h  |   81 -
 .../drm/amd/powerplay/hwmgr/polaris10_thermal.c    |  716 ---
 .../drm/amd/powerplay/hwmgr/polaris10_thermal.h    |   62 -
 .../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.h  |  402 --
 .../gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h  |   80 -
 .../gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c    |  590 ---
 .../gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h    |   61 -
 31 files changed, 13786 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_clockpowergating.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_clockpowergating.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_clockpowergating.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_clockpowergating.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_dyn_defaults.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_hwmgr.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_powertune.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_thermal.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/iceland_thermal.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_dyn_defaults.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_dyn_defaults.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_clockpowergating.c deleted +0 -121
deleted file mode 100644
index 5afe820..0000000
@@ -1,121 +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.
- *
- */
-
-#include "hwmgr.h"
-#include "fiji_clockpowergating.h"
-#include "fiji_ppsmc.h"
-#include "fiji_hwmgr.h"
-
-int fiji_phm_disable_clock_power_gating(struct pp_hwmgr *hwmgr)
-{
-	struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
-
-	data->uvd_power_gated = false;
-	data->vce_power_gated = false;
-	data->samu_power_gated = false;
-	data->acp_power_gated = false;
-
-	return 0;
-}
-
-int fiji_phm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate)
-{
-	struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
-
-	if (data->uvd_power_gated == bgate)
-		return 0;
-
-	data->uvd_power_gated = bgate;
-
-	if (bgate) {
-		cgs_set_clockgating_state(hwmgr->device,
-					  AMD_IP_BLOCK_TYPE_UVD,
-					  AMD_CG_STATE_GATE);
-		fiji_update_uvd_dpm(hwmgr, true);
-	} else {
-		fiji_update_uvd_dpm(hwmgr, false);
-		cgs_set_clockgating_state(hwmgr->device,
-					  AMD_IP_BLOCK_TYPE_UVD,
-					  AMD_CG_STATE_UNGATE);
-	}
-
-	return 0;
-}
-
-int fiji_phm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate)
-{
-	struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
-	struct phm_set_power_state_input states;
-	const struct pp_power_state  *pcurrent;
-	struct pp_power_state  *requested;
-
-	if (data->vce_power_gated == bgate)
-		return 0;
-
-	data->vce_power_gated = bgate;
-
-	pcurrent = hwmgr->current_ps;
-	requested = hwmgr->request_ps;
-
-	states.pcurrent_state = &(pcurrent->hardware);
-	states.pnew_state = &(requested->hardware);
-
-	fiji_update_vce_dpm(hwmgr, &states);
-	fiji_enable_disable_vce_dpm(hwmgr, !bgate);
-
-	return 0;
-}
-
-int fiji_phm_powergate_samu(struct pp_hwmgr *hwmgr, bool bgate)
-{
-	struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
-
-	if (data->samu_power_gated == bgate)
-		return 0;
-
-	data->samu_power_gated = bgate;
-
-	if (bgate)
-		fiji_update_samu_dpm(hwmgr, true);
-	else
-		fiji_update_samu_dpm(hwmgr, false);
-
-	return 0;
-}
-
-int fiji_phm_powergate_acp(struct pp_hwmgr *hwmgr, bool bgate)
-{
-	struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
-
-	if (data->acp_power_gated == bgate)
-		return 0;
-
-	data->acp_power_gated = bgate;
-
-	if (bgate)
-		fiji_update_acp_dpm(hwmgr, true);
-	else
-		fiji_update_acp_dpm(hwmgr, false);
-
-	return 0;
-}
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_clockpowergating.h deleted +0 -35
deleted file mode 100644
index 33af5f5..0000000
@@ -1,35 +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 _FIJI_CLOCK_POWER_GATING_H_
-#define _FIJI_CLOCK_POWER_GATING_H_
-
-#include "fiji_hwmgr.h"
-#include "pp_asicblocks.h"
-
-extern int fiji_phm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate);
-extern int fiji_phm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate);
-extern int fiji_phm_powergate_samu(struct pp_hwmgr *hwmgr, bool bgate);
-extern int fiji_phm_powergate_acp(struct pp_hwmgr *hwmgr, bool bgate);
-extern int fiji_phm_disable_clock_power_gating(struct pp_hwmgr *hwmgr);
-#endif /* _TONGA_CLOCK_POWER_GATING_H_ */
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_dyn_defaults.h deleted +0 -105

105 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c deleted +0 -5596

2,739 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h deleted +0 -350

350 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.c deleted +0 -610

610 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_powertune.h deleted +0 -81

81 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.c deleted +0 -687

687 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/fiji_thermal.h deleted +0 -62

62 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/iceland_clockpowergating.c deleted +0 -119

119 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/iceland_clockpowergating.h deleted +0 -38
deleted file mode 100644
index ff5ef00..0000000

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

drivers/gpu/drm/amd/powerplay/hwmgr/iceland_dyn_defaults.h deleted +0 -41

41 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/iceland_hwmgr.h deleted +0 -424

424 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/iceland_powertune.c deleted +0 -490

490 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/iceland_thermal.c deleted +0 -595

595 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/iceland_thermal.h deleted +0 -58

58 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c deleted +0 -444

444 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.h deleted +0 -40
deleted file mode 100644
index 88d68cb..0000000

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

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_dyn_defaults.h deleted +0 -62

62 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h deleted +0 -355

355 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c deleted +0 -988

988 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.h deleted +0 -81

81 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c deleted +0 -716

716 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.h deleted +0 -62

62 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.c deleted +0 -350

350 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_clockpowergating.h deleted +0 -36
deleted file mode 100644
index 8bc38cb..0000000

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

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_dyn_defaults.h deleted +0 -107

107 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h deleted +0 -402

402 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_powertune.h deleted +0 -80

80 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.c deleted +0 -590

590 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/tonga_thermal.h deleted +0 -61

61 lines not on this page · raw message

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

Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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