Add SMU 13.0.5 Support
Subsystems (3)
Alex Deucher
maintainercover Add SMU 13.0.5 Support
This updates the SMU 13 support for chips that use the SMU 13.0.5. The SMU (System Management Unit) is the power management microcontroller on the GPU.
Yifan Zhang (3):
drm/admgpu/pm: add smu 13.0.5 driver interface headers drm/amd/pm: update smc message sequence for smu 13.0.5 drm/amd/pm: add smu_v13_0_5_ppt implementation
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 1 + drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 + .../inc/pmfw_if/smu13_driver_if_v13_0_5.h | 140 ++ .../pm/swsmu/inc/pmfw_if/smu_v13_0_5_pmfw.h | 126 ++ .../pm/swsmu/inc/pmfw_if/smu_v13_0_5_ppsmc.h | 74 ++ drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h | 3 + drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 1 + drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile | 2 +- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 3 + .../drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c | 1142 +++++++++++++++++ .../drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.h | 28 + drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 34 +- 12 files changed, 1552 insertions(+), 6 deletions(-) create mode 100644 drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_5.h create mode 100644 drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_5_pmfw.h create mode 100644 drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_5_ppsmc.h create mode 100644 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c create mode 100644 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.h
Signature · 1 line
2.35.1
Alex Deucher
maintainerPATCH 1/3 drm/admgpu/pm: add smu 13.0.5 driver interface headers
From: Yifan Zhang <[email protected]>
This patch is to add smu 13.0.5 driver interface headers.
--- .../inc/pmfw_if/smu13_driver_if_v13_0_5.h | 140 ++++++++++++++++++ .../pm/swsmu/inc/pmfw_if/smu_v13_0_5_pmfw.h | 126 ++++++++++++++++ .../pm/swsmu/inc/pmfw_if/smu_v13_0_5_ppsmc.h | 74 +++++++++ 3 files changed, 340 insertions(+) create mode 100644 drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_5.h create mode 100644 drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_5_pmfw.h create mode 100644 drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_5_ppsmc.h
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_5.h new file +140 -0
@@ -0,0 +1,140 @@ +/* +* Copyright 2020 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 __SMU13_DRIVER_IF_V13_0_5_H__ +#define __SMU13_DRIVER_IF_V13_0_5_H__ + +#define PMFW_DRIVER_IF_VERSION 4 + +// Throttler Status Bitmask +#define THROTTLER_STATUS_BIT_SPL 0 +#define THROTTLER_STATUS_BIT_FPPT 1 +#define THROTTLER_STATUS_BIT_SPPT 2 +#define THROTTLER_STATUS_BIT_SPPT_APU 3 +#define THROTTLER_STATUS_BIT_THM_CORE 4 +#define THROTTLER_STATUS_BIT_THM_GFX 5 +#define THROTTLER_STATUS_BIT_THM_SOC 6 +#define THROTTLER_STATUS_BIT_TDC_VDD 7 +#define THROTTLER_STATUS_BIT_TDC_SOC 8 +#define THROTTLER_STATUS_BIT_PROCHOT_CPU 9 +#define THROTTLER_STATUS_BIT_PROCHOT_GFX 10 +#define THROTTLER_STATUS_BIT_EDC_CPU 11 +#define THROTTLER_STATUS_BIT_EDC_GFX 12 + +#define NUM_DCFCLK_DPM_LEVELS 4 +#define NUM_DISPCLK_DPM_LEVELS 4 +#define NUM_DPPCLK_DPM_LEVELS 4 +#define NUM_SOCCLK_DPM_LEVELS 4 +#define NUM_VCN_DPM_LEVELS 4 +#define NUM_SOC_VOLTAGE_LEVELS 4 +#define NUM_DF_PSTATE_LEVELS 4 + +typedef struct { +uint16_t MinClock;// This is either DCFCLK or SOCCLK (in MHz) +uint16_t MaxClock;// This is either DCFCLK or SOCCLK (in MHz) +uint16_t MinMclk; +uint16_t MaxMclk; +uint8_t WmSetting; +uint8_t WmType;// Used for normal pstate change or memory retraining +uint8_t Padding[2 ]; +}WatermarkRowGeneric_t ; + +#define NUM_WM_RANGES 4 +#define WM_PSTATE_CHG 0 +#define WM_RETRAINING 1 + +typedef enum { +WM_SOCCLK =0 , +WM_DCFCLK , +WM_COUNT , +}WM_CLOCK_e ; + +typedef struct { +// Watermarks +WatermarkRowGeneric_t WatermarkRow[WM_COUNT ][NUM_WM_RANGES ]; +uint32_t MmHubPadding[7 ];// SMU internal use +}Watermarks_t ; + +typedef struct { +uint32_t FClk; +uint32_t MemClk; +uint32_t Voltage; +}DfPstateTable_t ; + +typedef struct { +uint16_t GfxclkFrequency;//[MHz] +uint16_t SocclkFrequency;//[MHz] + +uint16_t VclkFrequency;//[MHz] +uint16_t DclkFrequency;//[MHz] + +uint16_t MemclkFrequency;//[MHz] +uint16_t spare; + +uint16_t GfxActivity;//[centi] +uint16_t UvdActivity;//[centi] + +uint16_t Voltage[2 ];//[mV] indices: VDDCR_VDD, VDDCR_SOC +uint16_t Current[2 ];//[mA] indices: VDDCR_VDD, VDDCR_SOC + +uint16_t Power[2 ];//[mW] indices: VDDCR_VDD, VDDCR_SOC +uint16_t GfxTemperature;//[centi-Celsius] + +uint16_t SocTemperature;//[centi-Celsius] +uint16_t ThrottlerStatus; + +uint16_t CurrentSocketPower;//[mW] +uint16_t spare1; +}SmuMetrics_t ; + +//Freq in MHz +//Voltage in milli volts with 2 fractional bits +typedef struct { +uint32_t DcfClocks[NUM_DCFCLK_DPM_LEVELS ]; +uint32_t DispClocks[NUM_DISPCLK_DPM_LEVELS ]; +uint32_t DppClocks[NUM_DPPCLK_DPM_LEVELS ]; +uint32_t SocClocks[NUM_SOCCLK_DPM_LEVELS ]; +uint32_t VClocks[NUM_VCN_DPM_LEVELS ]; +uint32_t DClocks[NUM_VCN_DPM_LEVELS ]; +uint32_t SocVoltage[NUM_SOC_VOLTAGE_LEVELS ]; +DfPstateTable_t DfPstateTable[NUM_DF_PSTATE_LEVELS ]; +uint8_t NumDcfClkLevelsEnabled; +uint8_t NumDispClkLevelsEnabled;//Applies to both Dispclk and Dppclk +uint8_t NumSocClkLevelsEnabled; +uint8_t VcnClkLevelsEnabled;//Applies to both Vclk and Dclk +uint8_t NumDfPstatesEnabled; +uint8_t spare[3 ]; +uint32_t MinGfxClk; +uint32_t MaxGfxClk; +}DpmClocks_t ; + +#define TABLE_BIOS_IF 0 // Called by BIOS +#define TABLE_WATERMARKS 1 // Called by DAL through VBIOS +#define TABLE_CUSTOM_DPM 2 // Called by Driver +#define TABLE_SPARE1 3 +#define TABLE_DPMCLOCKS 4 // Called by Driver and VBIOS +#define TABLE_MOMENTARY_PM 5 // Called by Tools +#define TABLE_MODERN_STDBY 6 // Called by Tools for Modern Standby Log +#define TABLE_SMU_METRICS 7 // Called by Driver +#define TABLE_COUNT 8 + +#endif
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_5_pmfw.h new file +126 -0
126 lines not on this page · raw message
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_5_ppsmc.h new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.35.1
Alex Deucher
maintainerPATCH 2/3 drm/amd/pm: update smc message sequence for smu 13.0.5
In reply to Alex DeucherFrom: Yifan Zhang <[email protected]>
this patch updates smc message sequence for smu 13.0.5.
--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 34 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +29 -5
@@ -51,6 +51,17 @@#define mmMP1_SMN_C2PMSG_90 0x029a#define mmMP1_SMN_C2PMSG_90_BASE_IDX 0 +/* SMU 13.0.5 has its specific mailbox messaging registers */ + +#define mmMP1_C2PMSG_2 (0xbee142 + 0xb00000 / 4) +#define mmMP1_C2PMSG_2_BASE_IDX 0 + +#define mmMP1_C2PMSG_34 (0xbee262 + 0xb00000 / 4) +#define mmMP1_C2PMSG_34_BASE_IDX 0 + +#define mmMP1_C2PMSG_33 (0xbee261 + 0xb00000 / 4) +#define mmMP1_C2PMSG_33_BASE_IDX 0 +#define MP1_C2PMSG_90__CONTENT_MASK 0xFFFFFFFFL#undef __SMU_DUMMY_MAP
@@ -73,7 +84,10 @@ static void smu_cmn_read_arg(struct smu_context *smu, {struct amdgpu_device *adev = smu->adev; - *arg =RREG32_SOC15 (MP1 ,0 , mmMP1_SMN_C2PMSG_82); +if (adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (13 ,0 ,5 )) + *arg =RREG32_SOC15 (MP1 ,0 , mmMP1_C2PMSG_34); +else + *arg =RREG32_SOC15 (MP1 ,0 , mmMP1_SMN_C2PMSG_82); }/* Redefine the SMU error codes here.
@@ -119,7 +133,10 @@ static u32 __smu_cmn_poll_stat(struct smu_context *smu)u32 reg;for ( ; timeout >0 ; timeout--) { - reg =RREG32_SOC15 (MP1 ,0 , mmMP1_SMN_C2PMSG_90); +if (adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (13 ,0 ,5 )) + reg =RREG32_SOC15 (MP1 ,0 , mmMP1_C2PMSG_33); +else + reg =RREG32_SOC15 (MP1 ,0 , mmMP1_SMN_C2PMSG_90);if ((reg &MP1_C2PMSG_90__CONTENT_MASK ) !=0 )break ;
@@ -235,9 +252,16 @@ static void __smu_cmn_send_msg(struct smu_context *smu, {struct amdgpu_device *adev = smu->adev; -WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_C2PMSG_90,0 ); -WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_C2PMSG_82, param); -WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_C2PMSG_66, msg); +if (adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (13 ,0 ,5 )) { +WREG32_SOC15 (MP1 ,0 , mmMP1_C2PMSG_33,0 ); +WREG32_SOC15 (MP1 ,0 , mmMP1_C2PMSG_34, param); +WREG32_SOC15 (MP1 ,0 , mmMP1_C2PMSG_2, msg); + }else { +WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_C2PMSG_90,0 ); +WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_C2PMSG_82, param); +WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_C2PMSG_66, msg); + } + }/**
Signature · 1 line
2.35.1
Alex Deucher
maintainerPATCH 3/3 drm/amd/pm: add smu_v13_0_5_ppt implementation
In reply to Alex DeucherFrom: Yifan Zhang <[email protected]>
this patch adds smu_v13_0_5_ppt implementation.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 1 + drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 + drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h | 3 + drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 1 + drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile | 2 +- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 3 + .../drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c | 1142 +++++++++++++++++ .../drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.h | 28 + 8 files changed, 1183 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c create mode 100644 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.h
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -0
@@ -1340,6 +1340,7 @@ static int amdgpu_discovery_set_smu_ip_blocks(struct amdgpu_device *adev)case IP_VERSION (13 ,0 ,1 ):case IP_VERSION (13 ,0 ,2 ):case IP_VERSION (13 ,0 ,3 ): +case IP_VERSION (13 ,0 ,5 ):case IP_VERSION (13 ,0 ,8 ):amdgpu_device_ip_block_add (adev, &smu_v13_0_ip_block);break ;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -0
@@ -37,6 +37,7 @@#include "aldebaran_ppt.h" #include "yellow_carp_ppt.h" #include "cyan_skillfish_ppt.h" +#include "smu_v13_0_5_ppt.h" #include "amd_pcie.h" /*
@@ -535,6 +536,9 @@ static int smu_set_funcs(struct amdgpu_device *adev)case IP_VERSION (13 ,0 ,8 ):yellow_carp_set_ppt_funcs (smu);break ; +case IP_VERSION (13 ,0 ,5 ): +smu_v13_0_5_set_ppt_funcs (smu); +break ;case IP_VERSION (11 ,0 ,8 ):cyan_skillfish_set_ppt_funcs (smu);break ;
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +3 -0
@@ -190,6 +190,7 @@__SMU_DUMMY_MAP (PowerUpCvip), \__SMU_DUMMY_MAP (PowerDownCvip), \__SMU_DUMMY_MAP (EnableGfxOff), \ +__SMU_DUMMY_MAP (DisableGfxOff), \__SMU_DUMMY_MAP (SetSoftMinGfxclk), \__SMU_DUMMY_MAP (SetSoftMinFclk), \ __SMU_DUMMY_MAP(GetThermalLimit), \
@@ -229,6 +230,7 @@__SMU_DUMMY_MAP (BoardPowerCalibration), \__SMU_DUMMY_MAP (RequestGfxclk), \__SMU_DUMMY_MAP (ForceGfxVid), \ +__SMU_DUMMY_MAP (Spare0), \__SMU_DUMMY_MAP (UnforceGfxVid), \ __SMU_DUMMY_MAP(HeavySBR),
@@ -362,6 +364,7 @@ enum smu_clk_type {__SMU_DUMMY_MAP (SMUIO_CG ), \__SMU_DUMMY_MAP (THM_CG ), \__SMU_DUMMY_MAP (CLK_CG ), \ +__SMU_DUMMY_MAP (DATA_CALCULATION ), \ #undef __SMU_DUMMY_MAP#define __SMU_DUMMY_MAP (feature) SMU_FEATURE_##feature##_BIT
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h +1 -0
@@ -30,6 +30,7 @@#define SMU13_DRIVER_IF_VERSION_ALDE 0x08#define SMU13_MODE1_RESET_WAIT_TIME_IN_MS 500 //500ms +#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_5 0x04/* MP Apertures */ #define MP0_Public 0x03800000
drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile +1 -1
@@ -23,7 +23,7 @@ # Makefile for the 'smu manager' sub-component of powerplay. # It provides the smu management services for the driver. -SMU13_MGR = smu_v13_0.o aldebaran_ppt.o yellow_carp_ppt.o +SMU13_MGR = smu_v13_0.o aldebaran_ppt.o yellow_carp_ppt.o smu_v13_0_5_ppt.o AMD_SWSMU_SMU13MGR = $(addprefix $(AMD_SWSMU_PATH)/smu13/,$(SMU13_MGR))
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +3 -0
@@ -221,6 +221,9 @@ int smu_v13_0_check_fw_version(struct smu_context *smu)case IP_VERSION (13 ,0 ,8 ): smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_YELLOW_CARP ;break ; +case IP_VERSION (13 ,0 ,5 ): + smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_SMU_V13_0_5 ; +break ;default :dev_err (adev->dev,"smu unsupported IP version: 0x%x.\n" , adev->ip_versions[MP1_HWIP ][0 ]);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c new file +1142 -0
1,142 lines not on this page · raw message
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright 2020 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 __SMU_V13_0_5_PPT_H__ +#define __SMU_V13_0_5_PPT_H__ + +extern void smu_v13_0_5_set_ppt_funcs (struct smu_context *smu); + +#endif
Signature · 1 line
2.35.1