Add BACO support for CI/VI asics
Subsystems (2)
cover Add BACO support for CI/VI asics
This patch set enables BACO CI and VI asics. BACO is Bus Active Chip Off. It allows us to turn off the GPU while still keeping the bus interface up, so the device does not disappear from the system. PowerXpress and Hybrid Graphics laptops support BOCO (Bus Off Chip Off) which is controlled by ACPI. BACO was conceived as a power saving feature, but we also use it for reset since the chip gets powered down. These patches are a pre-requisite for using BACO as a power saving feature which will follow in another patch set.
BACO is working well on VI parts. I haven't gotten it working yet on CI parts, but I'm including the code for reference if anyone wants to play with it.
Alex Deucher (15):
drm/amdgpu: add new BIF 4.1 register for BACO drm/amdgpu: add new BIF 5.0 register for BACO drm/amdgpu: add new SMU 7.0.1 registers for BACO drm/amdgpu: add new SMU 7.1.2 registers for BACO drm/amdgpu: add new SMU 7.1.3 registers for BACO drm/amdgpu/powerplay: add core support for pre-SOC15 baco drm/amdgpu/powerplay: add support for BACO on tonga drm/amdgpu/powerplay: add support for BACO on Iceland drm/amdgpu/powerplay: add support for BACO on polaris drm/amdgpu/powerplay: add support for BACO on VegaM drm/amdgpu/powerplay: add support for BACO on Fiji drm/amdgpu/powerplay: add support for BACO on CI drm/amdgpu/powerplay: split out common smu7 BACO code drm/amdgpu/powerplay: wire up BACO to powerplay API for smu7 drm/amdgpu: enable BACO reset for SMU7 based dGPUs (v2)
drivers/gpu/drm/amd/amdgpu/cik.c | 48 +++- drivers/gpu/drm/amd/amdgpu/cik.h | 3 + drivers/gpu/drm/amd/amdgpu/vi.c | 84 ++++++- drivers/gpu/drm/amd/amdgpu/vi.h | 3 + .../drm/amd/include/asic_reg/bif/bif_4_1_d.h | 1 + .../include/asic_reg/bif/bif_4_1_sh_mask.h | 2 + .../drm/amd/include/asic_reg/bif/bif_5_0_d.h | 1 + .../include/asic_reg/bif/bif_5_0_sh_mask.h | 2 + .../amd/include/asic_reg/smu/smu_7_0_1_d.h | 1 + .../include/asic_reg/smu/smu_7_0_1_sh_mask.h | 2 + .../amd/include/asic_reg/smu/smu_7_1_2_d.h | 1 + .../include/asic_reg/smu/smu_7_1_2_sh_mask.h | 2 + .../amd/include/asic_reg/smu/smu_7_1_3_d.h | 1 + .../include/asic_reg/smu/smu_7_1_3_sh_mask.h | 2 + drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | 3 +- drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c | 195 +++++++++++++++ drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.h | 29 +++ .../gpu/drm/amd/powerplay/hwmgr/common_baco.c | 19 ++ .../gpu/drm/amd/powerplay/hwmgr/common_baco.h | 13 + .../gpu/drm/amd/powerplay/hwmgr/fiji_baco.c | 196 +++++++++++++++ .../gpu/drm/amd/powerplay/hwmgr/fiji_baco.h | 29 +++ .../drm/amd/powerplay/hwmgr/polaris_baco.c | 222 +++++++++++++++++ .../drm/amd/powerplay/hwmgr/polaris_baco.h | 29 +++ .../gpu/drm/amd/powerplay/hwmgr/smu7_baco.c | 91 +++++++ .../gpu/drm/amd/powerplay/hwmgr/smu7_baco.h | 32 +++ .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 4 + .../gpu/drm/amd/powerplay/hwmgr/tonga_baco.c | 231 ++++++++++++++++++ .../gpu/drm/amd/powerplay/hwmgr/tonga_baco.h | 29 +++ 28 files changed, 1264 insertions(+), 11 deletions(-) create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_baco.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_baco.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_baco.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_baco.h create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.h
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20191011012135.18566-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 1/15 drm/amdgpu: add new BIF 4.1 register for BACO
--- drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_d.h | 1 + drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_d.h +1 -0
@@ -27,6 +27,7 @@#define mmMM_INDEX 0x0#define mmMM_INDEX_HI 0x6#define mmMM_DATA 0x1 +#define mmCC_BIF_BX_FUSESTRAP0 0x14D7#define mmBUS_CNTL 0x1508#define mmCONFIG_CNTL 0x1509#define mmCONFIG_MEMSIZE 0x150a
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h +2 -0
@@ -32,6 +32,8 @@#define MM_INDEX_HI__MM_OFFSET_HI__SHIFT 0x0#define MM_DATA__MM_DATA_MASK 0xffffffff#define MM_DATA__MM_DATA__SHIFT 0x0 +#define CC_BIF_BX_FUSESTRAP0__STRAP_BIF_PX_CAPABLE_MASK 0x2 +#define CC_BIF_BX_FUSESTRAP0__STRAP_BIF_PX_CAPABLE__SHIFT 0x1#define BUS_CNTL__BIOS_ROM_WRT_EN_MASK 0x1#define BUS_CNTL__BIOS_ROM_WRT_EN__SHIFT 0x0#define BUS_CNTL__BIOS_ROM_DIS_MASK 0x2
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/15 drm/amdgpu: add new BIF 5.0 register for BACO
In reply to a message not in the archive--- drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_d.h | 1 + drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_d.h +1 -0
@@ -27,6 +27,7 @@#define mmMM_INDEX 0x0#define mmMM_INDEX_HI 0x6#define mmMM_DATA 0x1 +#define mmCC_BIF_BX_FUSESTRAP0 0x14D7#define mmCC_BIF_BX_STRAP2 0x152A#define mmBIF_MM_INDACCESS_CNTL 0x1500#define mmBIF_DOORBELL_APER_EN 0x1501
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h +2 -0
@@ -32,6 +32,8 @@#define MM_INDEX_HI__MM_OFFSET_HI__SHIFT 0x0#define MM_DATA__MM_DATA_MASK 0xffffffff#define MM_DATA__MM_DATA__SHIFT 0x0 +#define CC_BIF_BX_FUSESTRAP0__STRAP_BIF_PX_CAPABLE_MASK 0x2 +#define CC_BIF_BX_FUSESTRAP0__STRAP_BIF_PX_CAPABLE__SHIFT 0x1#define BIF_MM_INDACCESS_CNTL__MM_INDACCESS_DIS_MASK 0x2#define BIF_MM_INDACCESS_CNTL__MM_INDACCESS_DIS__SHIFT 0x1#define BIF_DOORBELL_APER_EN__BIF_DOORBELL_APER_EN_MASK 0x1
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/15 drm/amdgpu: add new SMU 7.0.1 registers for BACO
In reply to a message not in the archive--- drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_0_1_d.h | 1 + drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_0_1_sh_mask.h | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_0_1_d.h +1 -0
@@ -49,6 +49,7 @@#define ixCG_SPLL_FUNC_CNTL_5 0xc0500150#define ixCG_SPLL_FUNC_CNTL_6 0xc0500154#define ixCG_SPLL_FUNC_CNTL_7 0xc0500158 +#define ixCG_SPLL_STATUS 0xC050015C#define ixSPLL_CNTL_MODE 0xc0500160#define ixCG_SPLL_SPREAD_SPECTRUM 0xc0500164#define ixCG_SPLL_SPREAD_SPECTRUM_2 0xc0500168
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_0_1_sh_mask.h +2 -0
@@ -194,6 +194,8 @@#define CG_SPLL_FUNC_CNTL_6__SPLL_LF_CNTR__SHIFT 0x19#define CG_SPLL_FUNC_CNTL_7__SPLL_BW_CNTRL_MASK 0xfff#define CG_SPLL_FUNC_CNTL_7__SPLL_BW_CNTRL__SHIFT 0x0 +#define CG_SPLL_STATUS__SPLL_CHG_STATUS_MASK 0x2 +#define CG_SPLL_STATUS__SPLL_CHG_STATUS__SHIFT 0x1#define SPLL_CNTL_MODE__SPLL_SW_DIR_CONTROL_MASK 0x1#define SPLL_CNTL_MODE__SPLL_SW_DIR_CONTROL__SHIFT 0x0#define SPLL_CNTL_MODE__SPLL_LEGACY_PDIV_MASK 0x2
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/15 drm/amdgpu: add new SMU 7.1.2 registers for BACO
In reply to a message not in the archive--- drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_2_d.h | 1 + drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_2_sh_mask.h | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_2_d.h +1 -0
@@ -49,6 +49,7 @@#define ixCG_SPLL_FUNC_CNTL_5 0xc0500150#define ixCG_SPLL_FUNC_CNTL_6 0xc0500154#define ixCG_SPLL_FUNC_CNTL_7 0xc0500158 +#define ixCG_SPLL_STATUS 0xC050015C#define ixSPLL_CNTL_MODE 0xc0500160#define ixCG_SPLL_SPREAD_SPECTRUM 0xc0500164#define ixCG_SPLL_SPREAD_SPECTRUM_2 0xc0500168
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_2_sh_mask.h +2 -0
@@ -194,6 +194,8 @@#define CG_SPLL_FUNC_CNTL_6__SPLL_LF_CNTR__SHIFT 0x19#define CG_SPLL_FUNC_CNTL_7__SPLL_BW_CNTRL_MASK 0xfff#define CG_SPLL_FUNC_CNTL_7__SPLL_BW_CNTRL__SHIFT 0x0 +#define CG_SPLL_STATUS__SPLL_CHG_STATUS_MASK 0x2 +#define CG_SPLL_STATUS__SPLL_CHG_STATUS__SHIFT 0x1#define SPLL_CNTL_MODE__SPLL_SW_DIR_CONTROL_MASK 0x1#define SPLL_CNTL_MODE__SPLL_SW_DIR_CONTROL__SHIFT 0x0#define SPLL_CNTL_MODE__SPLL_LEGACY_PDIV_MASK 0x2
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/15 drm/amdgpu: add new SMU 7.1.3 registers for BACO
In reply to a message not in the archive--- drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_d.h | 1 + drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_sh_mask.h | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_d.h +1 -0
@@ -52,6 +52,7 @@#define ixCG_SPLL_FUNC_CNTL_5 0xc0500150#define ixCG_SPLL_FUNC_CNTL_6 0xc0500154#define ixCG_SPLL_FUNC_CNTL_7 0xc0500158 +#define ixCG_SPLL_STATUS 0xC050015C#define ixSPLL_CNTL_MODE 0xc0500160#define ixCG_SPLL_SPREAD_SPECTRUM 0xc0500164#define ixCG_SPLL_SPREAD_SPECTRUM_2 0xc0500168
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_sh_mask.h +2 -0
@@ -220,6 +220,8 @@#define CG_SPLL_FUNC_CNTL_6__SPLL_LF_CNTR__SHIFT 0x19#define CG_SPLL_FUNC_CNTL_7__SPLL_BW_CNTRL_MASK 0xfff#define CG_SPLL_FUNC_CNTL_7__SPLL_BW_CNTRL__SHIFT 0x0 +#define CG_SPLL_STATUS__SPLL_CHG_STATUS_MASK 0x2 +#define CG_SPLL_STATUS__SPLL_CHG_STATUS__SHIFT 0x1#define SPLL_CNTL_MODE__SPLL_SW_DIR_CONTROL_MASK 0x1#define SPLL_CNTL_MODE__SPLL_SW_DIR_CONTROL__SHIFT 0x0#define SPLL_CNTL_MODE__SPLL_LEGACY_PDIV_MASK 0x2
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/15 drm/amdgpu/powerplay: add core support for pre-SOC15 baco
In reply to a message not in the archiveThis adds core support for BACO on pre-vega asics.
--- .../gpu/drm/amd/powerplay/hwmgr/common_baco.c | 19 +++++++++++++++++++ .../gpu/drm/amd/powerplay/hwmgr/common_baco.h | 13 +++++++++++++ 2 files changed, 32 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.c +19 -0
@@ -79,6 +79,25 @@ static bool baco_cmd_handler(struct pp_hwmgr *hwmgr, u32 command, u32 reg, u32 mreturn ret; } +bool baco_program_registers (struct pp_hwmgr *hwmgr, +const struct baco_cmd_entry *entry, +const u32 array_size) +{ +u32 i, reg =0 ; + +for (i =0 ; i < array_size; i++) { +if ((entry[i].cmd ==CMD_WRITE ) || + (entry[i].cmd ==CMD_READMODIFYWRITE ) || + (entry[i].cmd ==CMD_WAITFOR )) + reg = entry[i].reg_offset; +if (!baco_cmd_handler (hwmgr, entry[i].cmd, reg, entry[i].mask, + entry[i].shift, entry[i].val, entry[i].timeout)) +return false; + } + +return true; +} +bool soc15_baco_program_registers (struct pp_hwmgr *hwmgr,const struct soc15_baco_cmd_entry *entry,const u32 array_size)
drivers/gpu/drm/amd/powerplay/hwmgr/common_baco.h +13 -0
@@ -33,6 +33,15 @@ enum baco_cmd_type { CMD_DELAY_US, }; +struct baco_cmd_entry { +enum baco_cmd_type cmd; +uint32_t reg_offset; +uint32_t mask; +uint32_t shift; +uint32_t timeout; +uint32_t val; +}; +struct soc15_baco_cmd_entry {enum baco_cmd_type cmd;uint32_t hwip;
@@ -44,6 +53,10 @@ struct soc15_baco_cmd_entry {uint32_t timeout;uint32_t val; }; + +extern bool baco_program_registers (struct pp_hwmgr *hwmgr, +const struct baco_cmd_entry *entry, +const u32 array_size);extern bool soc15_baco_program_registers (struct pp_hwmgr *hwmgr,const struct soc15_baco_cmd_entry *entry,const u32 array_size);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/15 drm/amdgpu/powerplay: add support for BACO on tonga
In reply to a message not in the archiveThis adds BACO support for Tonga.
--- drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | 2 +- .../gpu/drm/amd/powerplay/hwmgr/tonga_baco.c | 221 ++++++++++++++++++ .../gpu/drm/amd/powerplay/hwmgr/tonga_baco.h | 32 +++ 3 files changed, 254 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +1 -1
@@ -36,7 +36,7 @@ HARDWARE_MGR = hwmgr.o processpptables.o \ pp_overdriver.o smu_helper.o \ vega20_processpptables.o vega20_hwmgr.o vega20_powertune.o \ vega20_thermal.o common_baco.o vega10_baco.o vega20_baco.o \ - vega12_baco.o smu9_baco.o + vega12_baco.o smu9_baco.o tonga_baco.o AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.c new file +221 -0
221 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright 2019 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ +#ifndef __TONGA_BACO_H__ +#define __TONGA_BACO_H__ +#include "hwmgr.h" +#include "common_baco.h" + +extern int tonga_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap); +extern int tonga_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state); +extern int tonga_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state); + +#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/15 drm/amdgpu/powerplay: add support for BACO on Iceland
In reply to a message not in the archiveThis adds BACO support for Iceland asics.
--- .../gpu/drm/amd/powerplay/hwmgr/tonga_baco.c | 54 ++++++++++++++++--- 1 file changed, 48 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.c +48 -6
@@ -152,6 +152,36 @@ static const struct baco_cmd_entry clean_baco_tbl[] = { CMD_WRITE, mmBIOS_SCRATCH_7, 0, 0, 0, 0 } }; +static const struct baco_cmd_entry gpio_tbl_iceland[] = +{ + {CMD_WRITE , mmGPIOPAD_EN,0 ,0 ,0 ,0x0 }, + {CMD_WRITE , mmGPIOPAD_PD_EN,0 ,0 ,0 ,0x0 }, + {CMD_WRITE , mmGPIOPAD_PU_EN,0 ,0 ,0 ,0x0 }, + {CMD_WRITE , mmGPIOPAD_MASK,0 ,0 ,0 ,0xff77ffff } +}; + +static const struct baco_cmd_entry exit_baco_tbl_iceland[] = +{ + {CMD_READMODIFYWRITE , mmBACO_CNTL,BACO_CNTL__BACO_RESET_EN_MASK ,BACO_CNTL__BACO_RESET_EN__SHIFT ,0 ,0x01 }, + {CMD_READMODIFYWRITE , mmBACO_CNTL,BACO_CNTL__BACO_BCLK_OFF_MASK ,BACO_CNTL__BACO_BCLK_OFF__SHIFT ,0 ,0x00 }, + {CMD_READMODIFYWRITE , mmBACO_CNTL,BACO_CNTL__BACO_POWER_OFF_MASK ,BACO_CNTL__BACO_POWER_OFF__SHIFT ,0 ,0x00 }, + {CMD_DELAY_MS ,0 ,0 ,0 ,20 ,0 }, + {CMD_WAITFOR , mmBACO_CNTL,BACO_CNTL__PWRGOOD_BF_MASK ,0 ,0xffffffff ,0x200 }, + {CMD_READMODIFYWRITE , mmBACO_CNTL,BACO_CNTL__BACO_ISO_DIS_MASK ,BACO_CNTL__BACO_ISO_DIS__SHIFT ,0 ,0x01 }, + {CMD_WAITFOR , mmBACO_CNTL,BACO_CNTL__PWRGOOD_MASK ,0 ,5 ,0x1c00 }, + {CMD_READMODIFYWRITE , mmBACO_CNTL,BACO_CNTL__BACO_ANA_ISO_DIS_MASK ,BACO_CNTL__BACO_ANA_ISO_DIS__SHIFT ,0 ,0x01 }, + {CMD_READMODIFYWRITE , mmBACO_CNTL,BACO_CNTL__BACO_BIF_SCLK_SWITCH_MASK ,BACO_CNTL__BACO_BIF_SCLK_SWITCH__SHIFT ,0 ,0x00 }, + {CMD_READMODIFYWRITE , mmBACO_CNTL,BACO_CNTL__BACO_RESET_EN_MASK ,BACO_CNTL__BACO_RESET_EN__SHIFT ,0 ,0x00 }, + {CMD_WAITFOR , mmBACO_CNTL,BACO_CNTL__RCU_BIF_CONFIG_DONE_MASK ,0 ,5 ,0x100 }, + {CMD_READMODIFYWRITE , mmBACO_CNTL,BACO_CNTL__BACO_EN_MASK ,BACO_CNTL__BACO_EN__SHIFT ,0 ,0x00 }, + {CMD_WAITFOR , mmBACO_CNTL,BACO_CNTL__BACO_MODE_MASK ,0 ,0xffffffff ,0x00 } +}; + +static const struct baco_cmd_entry clean_baco_tbl_iceland[] = +{ + {CMD_WRITE , mmBIOS_SCRATCH_7,0 ,0 ,0 ,0 } +}; +int tonga_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap) {struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
@@ -195,7 +225,10 @@ int tonga_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state)return 0 ;if (state ==BACO_STATE_IN ) { -baco_program_registers (hwmgr, gpio_tbl,ARRAY_SIZE (gpio_tbl)); +if (hwmgr->chip_id ==CHIP_TOPAZ ) +baco_program_registers (hwmgr, gpio_tbl_iceland,ARRAY_SIZE (gpio_tbl_iceland)); +else +baco_program_registers (hwmgr, gpio_tbl,ARRAY_SIZE (gpio_tbl));baco_program_registers (hwmgr, enable_fb_req_rej_tbl,ARRAY_SIZE (enable_fb_req_rej_tbl));baco_program_registers (hwmgr, use_bclk_tbl,ARRAY_SIZE (use_bclk_tbl));
@@ -209,11 +242,20 @@ int tonga_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state)/* HW requires at least 20ms between regulator off and on */ msleep (20 );/* Execute Hardware BACO exit sequence */ -if (baco_program_registers (hwmgr, exit_baco_tbl, -ARRAY_SIZE (exit_baco_tbl))) { -if (baco_program_registers (hwmgr, clean_baco_tbl, -ARRAY_SIZE (clean_baco_tbl))) -return 0 ; +if (hwmgr->chip_id ==CHIP_TOPAZ ) { +if (baco_program_registers (hwmgr, exit_baco_tbl_iceland, +ARRAY_SIZE (exit_baco_tbl_iceland))) { +if (baco_program_registers (hwmgr, clean_baco_tbl_iceland, +ARRAY_SIZE (clean_baco_tbl_iceland))) +return 0 ; + } + }else { +if (baco_program_registers (hwmgr, exit_baco_tbl, +ARRAY_SIZE (exit_baco_tbl))) { +if (baco_program_registers (hwmgr, clean_baco_tbl, +ARRAY_SIZE (clean_baco_tbl))) +return 0 ; + } } }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/15 drm/amdgpu/powerplay: add support for BACO on polaris
In reply to a message not in the archiveThis adds BACO support for Polaris asics.
--- drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | 2 +- .../drm/amd/powerplay/hwmgr/polaris_baco.c | 218 ++++++++++++++++++ .../drm/amd/powerplay/hwmgr/polaris_baco.h | 32 +++ 3 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +1 -1
@@ -36,7 +36,7 @@ HARDWARE_MGR = hwmgr.o processpptables.o \ pp_overdriver.o smu_helper.o \ vega20_processpptables.o vega20_hwmgr.o vega20_powertune.o \ vega20_thermal.o common_baco.o vega10_baco.o vega20_baco.o \ - vega12_baco.o smu9_baco.o tonga_baco.o + vega12_baco.o smu9_baco.o tonga_baco.o polaris_baco.o AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.c new file +218 -0
218 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright 2019 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 __POLARIS_BACO_H__ +#define __POLARIS_BACO_H__ +#include "hwmgr.h" +#include "common_baco.h" + +extern int polaris_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap); +extern int polaris_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state); +extern int polaris_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state); + +#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/15 drm/amdgpu/powerplay: add support for BACO on VegaM
In reply to a message not in the archiveThis adds BACO support for VegaM asics.
--- .../drm/amd/powerplay/hwmgr/polaris_baco.c | 42 +++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.c +39 -3
@@ -148,6 +148,36 @@ static const struct baco_cmd_entry clean_baco_tbl[] = { CMD_WRITE, mmBIOS_SCRATCH_7, 0, 0, 0, 0 } }; +static const struct baco_cmd_entry use_bclk_tbl_vg[] = +{ + {CMD_WRITE , mmGCK_SMC_IND_INDEX,0 ,0 ,0 , ixCG_SPLL_FUNC_CNTL }, + {CMD_READMODIFYWRITE , mmGCK_SMC_IND_DATA,CG_SPLL_FUNC_CNTL__SPLL_BYPASS_EN_MASK ,CG_SPLL_FUNC_CNTL__SPLL_BYPASS_EN__SHIFT ,0 ,0x1 }, + {CMD_WRITE , mmGCK_SMC_IND_INDEX,0 ,0 ,0 ,0xC0500170 }, + {CMD_READMODIFYWRITE , mmGCK_SMC_IND_DATA,0x4000000 ,0x1a ,0 ,0x1 }, + {CMD_WRITE , mmGCK_SMC_IND_INDEX,0 ,0 ,0 , ixGCK_DFS_BYPASS_CNTL }, + {CMD_READMODIFYWRITE , mmGCK_SMC_IND_DATA,GCK_DFS_BYPASS_CNTL__BYPASSACLK_MASK ,GCK_DFS_BYPASS_CNTL__BYPASSACLK__SHIFT ,0 ,0x1 }, + {CMD_WRITE , mmGCK_SMC_IND_INDEX,0 ,0 ,0 , ixMPLL_BYPASSCLK_SEL }, + {CMD_READMODIFYWRITE , mmGCK_SMC_IND_DATA,MPLL_BYPASSCLK_SEL__MPLL_CLKOUT_SEL_MASK ,MPLL_BYPASSCLK_SEL__MPLL_CLKOUT_SEL__SHIFT ,0 ,0x2 } +}; + +static const struct baco_cmd_entry turn_off_plls_tbl_vg[] = +{ + {CMD_READMODIFYWRITE , mmDC_GPIO_PAD_STRENGTH_1,DC_GPIO_PAD_STRENGTH_1__GENLK_STRENGTH_SP_MASK ,DC_GPIO_PAD_STRENGTH_1__GENLK_STRENGTH_SP__SHIFT ,0 ,0x1 }, + {CMD_DELAY_US ,0 ,0 ,0 ,1 ,0x0 }, + {CMD_READMODIFYWRITE , mmMC_SEQ_DRAM,MC_SEQ_DRAM__RST_CTL_MASK ,MC_SEQ_DRAM__RST_CTL__SHIFT ,0 ,0x1 }, + {CMD_WRITE , mmGCK_SMC_IND_INDEX,0 ,0 ,0 ,0xC05002B0 }, + {CMD_READMODIFYWRITE , mmGCK_SMC_IND_DATA,0x10 ,0x4 ,0 ,0x1 }, + {CMD_WAITFOR , mmGCK_SMC_IND_DATA,0x10 ,0 ,1 ,0 }, + {CMD_WRITE , mmGCK_SMC_IND_INDEX,0 ,0 ,0 ,0xC050032C }, + {CMD_READMODIFYWRITE , mmGCK_SMC_IND_DATA,0x10 ,0x4 ,0 ,0x1 }, + {CMD_WAITFOR , mmGCK_SMC_IND_DATA,0x10 ,0 ,1 ,0 }, + {CMD_WRITE , mmGCK_SMC_IND_INDEX,0 ,0 ,0 ,0xC0500080 }, + {CMD_READMODIFYWRITE , mmGCK_SMC_IND_DATA,0x1 ,0x0 ,0 ,0x1 }, + {CMD_DELAY_US ,0 ,0 ,0 ,3 ,0x0 }, + {CMD_DELAY_US ,0 ,0 ,0 ,3 ,0x0 }, + {CMD_DELAY_US ,0 ,0 ,0 ,5 ,0x0 } +}; +int polaris_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap) {struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
@@ -194,9 +224,15 @@ int polaris_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state)baco_program_registers (hwmgr, gpio_tbl,ARRAY_SIZE (gpio_tbl));baco_program_registers (hwmgr, enable_fb_req_rej_tbl,ARRAY_SIZE (enable_fb_req_rej_tbl)); -baco_program_registers (hwmgr, use_bclk_tbl,ARRAY_SIZE (use_bclk_tbl)); -baco_program_registers (hwmgr, turn_off_plls_tbl, -ARRAY_SIZE (turn_off_plls_tbl)); +if (hwmgr->chip_id ==CHIP_VEGAM ) { +baco_program_registers (hwmgr, use_bclk_tbl_vg,ARRAY_SIZE (use_bclk_tbl_vg)); +baco_program_registers (hwmgr, turn_off_plls_tbl_vg, +ARRAY_SIZE (turn_off_plls_tbl_vg)); + }else { +baco_program_registers (hwmgr, use_bclk_tbl,ARRAY_SIZE (use_bclk_tbl)); +baco_program_registers (hwmgr, turn_off_plls_tbl, +ARRAY_SIZE (turn_off_plls_tbl)); + }baco_program_registers (hwmgr, clk_req_b_tbl,ARRAY_SIZE (clk_req_b_tbl));if (baco_program_registers (hwmgr, enter_baco_tbl,ARRAY_SIZE (enter_baco_tbl)))
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/15 drm/amdgpu/powerplay: add support for BACO on Fiji
In reply to a message not in the archiveThis adds BACO support for Fiji asics.
--- drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | 2 +- .../gpu/drm/amd/powerplay/hwmgr/fiji_baco.c | 228 ++++++++++++++++++ .../gpu/drm/amd/powerplay/hwmgr/fiji_baco.h | 32 +++ 3 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_baco.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/fiji_baco.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +1 -1
@@ -36,7 +36,7 @@ HARDWARE_MGR = hwmgr.o processpptables.o \ pp_overdriver.o smu_helper.o \ vega20_processpptables.o vega20_hwmgr.o vega20_powertune.o \ vega20_thermal.o common_baco.o vega10_baco.o vega20_baco.o \ - vega12_baco.o smu9_baco.o tonga_baco.o polaris_baco.o + vega12_baco.o smu9_baco.o tonga_baco.o polaris_baco.o fiji_baco.o AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_baco.c new file +228 -0
228 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_baco.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright 2019 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_BACO_H__ +#define __FIJI_BACO_H__ +#include "hwmgr.h" +#include "common_baco.h" + +extern int fiji_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap); +extern int fiji_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state); +extern int fiji_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state); + +#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/15 drm/amdgpu/powerplay: add support for BACO on CI
In reply to a message not in the archiveThis adds BACO support for CI asics.
--- drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | 3 +- drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c | 227 ++++++++++++++++++ drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.h | 32 +++ 3 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +2 -1
@@ -36,7 +36,8 @@ HARDWARE_MGR = hwmgr.o processpptables.o \ pp_overdriver.o smu_helper.o \ vega20_processpptables.o vega20_hwmgr.o vega20_powertune.o \ vega20_thermal.o common_baco.o vega10_baco.o vega20_baco.o \ - vega12_baco.o smu9_baco.o tonga_baco.o polaris_baco.o fiji_baco.o + vega12_baco.o smu9_baco.o tonga_baco.o polaris_baco.o fiji_baco.o \ + ci_baco.o AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c new file +227 -0
227 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright 2019 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 __CI_BACO_H__ +#define __CI_BACO_H__ +#include "hwmgr.h" +#include "common_baco.h" + +extern int ci_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap); +extern int ci_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state); +extern int ci_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state); + +#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/15 drm/amdgpu/powerplay: split out common smu7 BACO code
In reply to a message not in the archiveSeveral of the BACO functions are common across smu7-based asics. Split the common code out.
--- drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | 2 +- drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c | 34 +------ drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.h | 5 +- .../gpu/drm/amd/powerplay/hwmgr/fiji_baco.c | 34 +------ .../gpu/drm/amd/powerplay/hwmgr/fiji_baco.h | 5 +- .../drm/amd/powerplay/hwmgr/polaris_baco.c | 34 +------ .../drm/amd/powerplay/hwmgr/polaris_baco.h | 5 +- .../gpu/drm/amd/powerplay/hwmgr/smu7_baco.c | 91 +++++++++++++++++++ .../gpu/drm/amd/powerplay/hwmgr/smu7_baco.h | 32 +++++++ .../gpu/drm/amd/powerplay/hwmgr/tonga_baco.c | 34 +------ .../gpu/drm/amd/powerplay/hwmgr/tonga_baco.h | 5 +- 11 files changed, 132 insertions(+), 149 deletions(-) create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_baco.c create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_baco.h
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +1 -1
@@ -37,7 +37,7 @@ HARDWARE_MGR = hwmgr.o processpptables.o \ vega20_processpptables.o vega20_hwmgr.o vega20_powertune.o \ vega20_thermal.o common_baco.o vega10_baco.o vega20_baco.o \ vega12_baco.o smu9_baco.o tonga_baco.o polaris_baco.o fiji_baco.o \ - ci_baco.o + ci_baco.o smu7_baco.o AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c +1 -33
@@ -158,43 +158,11 @@ static const struct baco_cmd_entry clean_baco_tbl[] = { CMD_WRITE, mmCP_PFP_UCODE_ADDR, 0, 0, 0, 0 } }; -int ci_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); -uint32_t reg; - - *cap = false; -if (!phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_BACO)) -return 0 ; - - reg =RREG32 (mmCC_BIF_BX_FUSESTRAP0); - -if (reg &CC_BIF_BX_FUSESTRAP0__STRAP_BIF_PX_CAPABLE_MASK ) - *cap = true; - -return 0 ; -} - -int ci_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); -uint32_t reg; - - reg =RREG32 (mmBACO_CNTL); - -if (reg &BACO_CNTL__BACO_MODE_MASK ) -/* gfx has already entered BACO state */ - *state =BACO_STATE_IN ; -else - *state =BACO_STATE_OUT ; -return 0 ; -} -int ci_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state) {enum BACO_STATE cur_state; -ci_baco_get_state (hwmgr, &cur_state); +smu7_baco_get_state (hwmgr, &cur_state);if (cur_state == state)/* aisc already in the target state */
drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.h +1 -4
@@ -22,11 +22,8 @@*/ #ifndef __CI_BACO_H__#define __CI_BACO_H__ -#include "hwmgr.h" -#include "common_baco.h" +#include "smu7_baco.h" -extern int ci_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap); -extern int ci_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state);extern int ci_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state);#endif
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_baco.c +1 -33
@@ -158,43 +158,11 @@ static const struct baco_cmd_entry clean_baco_tbl[] = { CMD_WRITE, mmBIOS_SCRATCH_15, 0, 0, 0, 0 } }; -int fiji_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); -uint32_t reg; - - *cap = false; -if (!phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_BACO)) -return 0 ; - - reg =RREG32 (mmCC_BIF_BX_FUSESTRAP0); - -if (reg &CC_BIF_BX_FUSESTRAP0__STRAP_BIF_PX_CAPABLE_MASK ) - *cap = true; - -return 0 ; -} - -int fiji_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); -uint32_t reg; - - reg =RREG32 (mmBACO_CNTL); - -if (reg &BACO_CNTL__BACO_MODE_MASK ) -/* gfx has already entered BACO state */ - *state =BACO_STATE_IN ; -else - *state =BACO_STATE_OUT ; -return 0 ; -} -int fiji_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state) {enum BACO_STATE cur_state; -fiji_baco_get_state (hwmgr, &cur_state); +smu7_baco_get_state (hwmgr, &cur_state);if (cur_state == state)/* aisc already in the target state */
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_baco.h +1 -4
@@ -22,11 +22,8 @@*/ #ifndef __FIJI_BACO_H__#define __FIJI_BACO_H__ -#include "hwmgr.h" -#include "common_baco.h" +#include "smu7_baco.h" -extern int fiji_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap); -extern int fiji_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state);extern int fiji_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state);#endif
drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.c +1 -33
@@ -178,43 +178,11 @@ static const struct baco_cmd_entry turn_off_plls_tbl_vg[] = { CMD_DELAY_US, 0, 0, 0, 5, 0x0 } }; -int polaris_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); -uint32_t reg; - - *cap = false; -if (!phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_BACO)) -return 0 ; - - reg =RREG32 (mmCC_BIF_BX_FUSESTRAP0); - -if (reg &CC_BIF_BX_FUSESTRAP0__STRAP_BIF_PX_CAPABLE_MASK ) - *cap = true; - -return 0 ; -} - -int polaris_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); -uint32_t reg; - - reg =RREG32 (mmBACO_CNTL); - -if (reg &BACO_CNTL__BACO_MODE_MASK ) -/* gfx has already entered BACO state */ - *state =BACO_STATE_IN ; -else - *state =BACO_STATE_OUT ; -return 0 ; -} -int polaris_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state) {enum BACO_STATE cur_state; -polaris_baco_get_state (hwmgr, &cur_state); +smu7_baco_get_state (hwmgr, &cur_state);if (cur_state == state)/* aisc already in the target state */
drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.h +1 -4
@@ -22,11 +22,8 @@*/ #ifndef __POLARIS_BACO_H__#define __POLARIS_BACO_H__ -#include "hwmgr.h" -#include "common_baco.h" +#include "smu7_baco.h" -extern int polaris_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap); -extern int polaris_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state);extern int polaris_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state);#endif
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_baco.c new file +91 -0
91 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_baco.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright 2019 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_BACO_H__ +#define __SMU7_BACO_H__ +#include "hwmgr.h" +#include "common_baco.h" + +extern int smu7_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap); +extern int smu7_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state); +extern int smu7_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state); + +#endif
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.c +1 -33
@@ -182,43 +182,11 @@ static const struct baco_cmd_entry clean_baco_tbl_iceland[] = { CMD_WRITE, mmBIOS_SCRATCH_7, 0, 0, 0, 0 } }; -int tonga_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); -uint32_t reg; - - *cap = false; -if (!phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_BACO)) -return 0 ; - - reg =RREG32 (mmCC_BIF_BX_FUSESTRAP0); - -if (reg &CC_BIF_BX_FUSESTRAP0__STRAP_BIF_PX_CAPABLE_MASK ) - *cap = true; - -return 0 ; -} - -int tonga_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); -uint32_t reg; - - reg =RREG32 (mmBACO_CNTL); - -if (reg &BACO_CNTL__BACO_MODE_MASK ) -/* gfx has already entered BACO state */ - *state =BACO_STATE_IN ; -else - *state =BACO_STATE_OUT ; -return 0 ; -} -int tonga_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state) {enum BACO_STATE cur_state; -tonga_baco_get_state (hwmgr, &cur_state); +smu7_baco_get_state (hwmgr, &cur_state);if (cur_state == state)/* aisc already in the target state */
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.h +1 -4
@@ -22,11 +22,8 @@*/ #ifndef __TONGA_BACO_H__#define __TONGA_BACO_H__ -#include "hwmgr.h" -#include "common_baco.h" +#include "smu7_baco.h" -extern int tonga_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap); -extern int tonga_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state);extern int tonga_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state);#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/15 drm/amdgpu/powerplay: wire up BACO to powerplay API for smu7
In reply to a message not in the archiveWire up the powerplay callbacks for for BACO for smu7 devices.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +4 -0
@@ -48,6 +48,7 @@#include "smu7_clockpowergating.h" #include "processpptables.h" #include "pp_thermal.h" +#include "smu7_baco.h" #include "ivsrcid/ivsrcid_vislands30.h"
@@ -5145,6 +5146,9 @@ static const struct pp_hwmgr_func smu7_hwmgr_funcs = { .get_power_profile_mode = smu7_get_power_profile_mode, .set_power_profile_mode = smu7_set_power_profile_mode, .get_performance_level = smu7_get_performance_level, + .get_asic_baco_capability = smu7_baco_get_capability, + .get_asic_baco_state = smu7_baco_get_state, + .set_asic_baco_state = smu7_baco_set_state, .power_off_asic = smu7_power_off_asic, };
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/15 drm/amdgpu: enable BACO reset for SMU7 based dGPUs (v2)
In reply to a message not in the archiveUse BACO to reset the GPU if supported on SMU7 based dGPUs.
v2: don't use baco on CI parts
--- drivers/gpu/drm/amd/amdgpu/cik.c | 48 ++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/cik.h | 3 ++ drivers/gpu/drm/amd/amdgpu/vi.c | 84 ++++++++++++++++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/vi.h | 3 ++ 4 files changed, 128 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik.c +43 -5
@@ -1270,15 +1270,15 @@ static int cik_gpu_pci_config_reset(struct amdgpu_device *adev) }/** -* cik_asic_reset - soft reset GPU +* cik_asic_pci_config_reset - soft reset GPU * * @adev: amdgpu_device pointer * -* Look up which blocks are hung and attempt -* to reset them. +* Use PCI Config method to reset the GPU. +* * Returns 0 for success. */ -static int cik_asic_reset (struct amdgpu_device *adev) +static int cik_asic_pci_config_reset (struct amdgpu_device *adev) {int r;
@@ -1294,7 +1294,45 @@ static int cik_asic_reset(struct amdgpu_device *adev)static enum amd_reset_method cik_asic_reset_method (struct amdgpu_device *adev) { -return AMD_RESET_METHOD_LEGACY ; +bool baco_reset; + +switch (adev->asic_type) { +case CHIP_BONAIRE : +case CHIP_HAWAII : +/* disable baco reset until it works */ +/* smu7_asic_get_baco_capability(adev, &baco_reset); */ + baco_reset = false; +break ; +default : + baco_reset = false; +break ; + } + +if (baco_reset) +return AMD_RESET_METHOD_BACO ; +else +return AMD_RESET_METHOD_LEGACY ; +} + +/** +* cik_asic_reset - soft reset GPU +* +* @adev: amdgpu_device pointer +* +* Look up which blocks are hung and attempt +* to reset them. +* Returns 0 for success. +*/ +static int cik_asic_reset (struct amdgpu_device *adev) +{ +int r; + +if (cik_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) + r =smu7_asic_baco_reset (adev); +else + r =cik_asic_pci_config_reset (adev); + +return r; }static u32 cik_get_config_memsize (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/cik.h +3 -0
@@ -31,4 +31,7 @@ void cik_srbm_select(struct amdgpu_device *adev,int cik_set_ip_blocks (struct amdgpu_device *adev);void legacy_doorbell_index_init (struct amdgpu_device *adev); +int smu7_asic_get_baco_capability (struct amdgpu_device *adev,bool *cap); +int smu7_asic_baco_reset (struct amdgpu_device *adev); +#endif
drivers/gpu/drm/amd/amdgpu/vi.c +79 -5
102 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/vi.h +3 -0
@@ -31,4 +31,7 @@ void vi_srbm_select(struct amdgpu_device *adev,int vi_set_ip_blocks (struct amdgpu_device *adev);void legacy_doorbell_index_init (struct amdgpu_device *adev); +int smu7_asic_get_baco_capability (struct amdgpu_device *adev,bool *cap); +int smu7_asic_baco_reset (struct amdgpu_device *adev); +#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20191011012135.18566-16-alexander.deucher-5C7GfCeVMHo@public.gmane.org
RE: [PATCH 15/15] drm/amdgpu: enable BACO reset for SMU7 based dGPUs (v2)
Series is reviewed-by: Evan Quan <[email protected]>
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, October 11, 2019 9:22 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 15/15] drm/amdgpu: enable BACO reset for SMU7 based dGPUs (v2)
Use BACO to reset the GPU if supported on SMU7 based dGPUs.
v2: don't use baco on CI parts
--- drivers/gpu/drm/amd/amdgpu/cik.c | 48 ++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/cik.h | 3 ++ drivers/gpu/drm/amd/amdgpu/vi.c | 84 ++++++++++++++++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/vi.h | 3 ++ 4 files changed, 128 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik.c +43 -5
@@ -1270,15 +1270,15 @@ static int cik_gpu_pci_config_reset(struct amdgpu_device *adev) }/** -* cik_asic_reset - soft reset GPU +* cik_asic_pci_config_reset - soft reset GPU * * @adev: amdgpu_device pointer * -* Look up which blocks are hung and attempt -* to reset them. +* Use PCI Config method to reset the GPU. +* * Returns 0 for success. */ -static int cik_asic_reset (struct amdgpu_device *adev) +static int cik_asic_pci_config_reset (struct amdgpu_device *adev) {int r;
@@ -1294,7 +1294,45 @@ static int cik_asic_reset(struct amdgpu_device *adev)static enum amd_reset_method cik_asic_reset_method (struct amdgpu_device *adev) { -return AMD_RESET_METHOD_LEGACY ; +bool baco_reset; + +switch (adev->asic_type) { +case CHIP_BONAIRE : +case CHIP_HAWAII : +/* disable baco reset until it works */ +/* smu7_asic_get_baco_capability(adev, &baco_reset); */ + baco_reset = false; +break ; +default : + baco_reset = false; +break ; + } + +if (baco_reset) +return AMD_RESET_METHOD_BACO ; +else +return AMD_RESET_METHOD_LEGACY ; +} + +/** +* cik_asic_reset - soft reset GPU +* +* @adev: amdgpu_device pointer +* +* Look up which blocks are hung and attempt +* to reset them. +* Returns 0 for success. +*/ +static int cik_asic_reset (struct amdgpu_device *adev) +{ +int r; + +if (cik_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) + r =smu7_asic_baco_reset (adev); +else + r =cik_asic_pci_config_reset (adev); + +return r; }static u32 cik_get_config_memsize (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/cik.h +3 -0
@@ -31,4 +31,7 @@ void cik_srbm_select(struct amdgpu_device *adev,int cik_set_ip_blocks (struct amdgpu_device *adev);void legacy_doorbell_index_init (struct amdgpu_device *adev); +int smu7_asic_get_baco_capability (struct amdgpu_device *adev,bool *cap); +int smu7_asic_baco_reset (struct amdgpu_device *adev); +#endif
drivers/gpu/drm/amd/amdgpu/vi.c +79 -5
102 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/vi.h +3 -0
@@ -31,4 +31,7 @@ void vi_srbm_select(struct amdgpu_device *adev,int vi_set_ip_blocks (struct amdgpu_device *adev);void legacy_doorbell_index_init (struct amdgpu_device *adev); +int smu7_asic_get_baco_capability (struct amdgpu_device *adev,bool *cap); +int smu7_asic_baco_reset (struct amdgpu_device *adev); +#endif
Signature · 10 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
Acked-byAm 11.10.19 um 03:21 schrieb Alex Deucher:
Quoted 11 lines
This patch set enables BACO CI and VI asics. BACO is Bus Active Chip Off. It allows us to turn off the GPU while still keeping the bus interface up, so the device does not disappear from the system. PowerXpress and Hybrid Graphics laptops support BOCO (Bus Off Chip Off) which is controlled by ACPI. BACO was conceived as a power saving feature, but we also use it for reset since the chip gets powered down. These patches are a pre-requisite for using BACO as a power saving feature which will follow in another patch set.
Quoted 3 lines
BACO is working well on VI parts. I haven't gotten it working yet on CI parts, but I'm including the code for reference if anyone wants to play with it.
Regards,
Christian.
Quoted 47 lines
Alex Deucher (15):
drm/amdgpu: add new BIF 4.1 register for BACO drm/amdgpu: add new BIF 5.0 register for BACO drm/amdgpu: add new SMU 7.0.1 registers for BACO drm/amdgpu: add new SMU 7.1.2 registers for BACO drm/amdgpu: add new SMU 7.1.3 registers for BACO drm/amdgpu/powerplay: add core support for pre-SOC15 baco drm/amdgpu/powerplay: add support for BACO on tonga drm/amdgpu/powerplay: add support for BACO on Iceland drm/amdgpu/powerplay: add support for BACO on polaris drm/amdgpu/powerplay: add support for BACO on VegaM drm/amdgpu/powerplay: add support for BACO on Fiji drm/amdgpu/powerplay: add support for BACO on CI drm/amdgpu/powerplay: split out common smu7 BACO code drm/amdgpu/powerplay: wire up BACO to powerplay API for smu7 drm/amdgpu: enable BACO reset for SMU7 based dGPUs (v2)drivers/gpu/drm/amd/amdgpu/cik.c | 48 +++- drivers/gpu/drm/amd/amdgpu/cik.h | 3 + drivers/gpu/drm/amd/amdgpu/vi.c | 84 ++++++- drivers/gpu/drm/amd/amdgpu/vi.h | 3 + .../drm/amd/include/asic_reg/bif/bif_4_1_d.h | 1 + .../include/asic_reg/bif/bif_4_1_sh_mask.h | 2 + .../drm/amd/include/asic_reg/bif/bif_5_0_d.h | 1 + .../include/asic_reg/bif/bif_5_0_sh_mask.h | 2 + .../amd/include/asic_reg/smu/smu_7_0_1_d.h | 1 + .../include/asic_reg/smu/smu_7_0_1_sh_mask.h | 2 + .../amd/include/asic_reg/smu/smu_7_1_2_d.h | 1 + .../include/asic_reg/smu/smu_7_1_2_sh_mask.h | 2 + .../amd/include/asic_reg/smu/smu_7_1_3_d.h | 1 + .../include/asic_reg/smu/smu_7_1_3_sh_mask.h | 2 + drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | 3 +- drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.c | 195 +++++++++++++++ drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.h | 29 +++ .../gpu/drm/amd/powerplay/hwmgr/common_baco.c | 19 ++ .../gpu/drm/amd/powerplay/hwmgr/common_baco.h | 13 + .../gpu/drm/amd/powerplay/hwmgr/fiji_baco.c | 196 +++++++++++++++ .../gpu/drm/amd/powerplay/hwmgr/fiji_baco.h | 29 +++ .../drm/amd/powerplay/hwmgr/polaris_baco.c | 222 +++++++++++++++++ .../drm/amd/powerplay/hwmgr/polaris_baco.h | 29 +++ .../gpu/drm/amd/powerplay/hwmgr/smu7_baco.c | 91 +++++++ .../gpu/drm/amd/powerplay/hwmgr/smu7_baco.h | 32 +++ .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 4 + .../gpu/drm/amd/powerplay/hwmgr/tonga_baco.c | 231 ++++++++++++++++++ .../gpu/drm/amd/powerplay/hwmgr/tonga_baco.h | 29 +++ 28 files changed, 1264 insertions(+), 11 deletions(-)
Quoted 11 lines
create mode 100644
drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.ccreate mode 100644drivers/gpu/drm/amd/powerplay/hwmgr/ci_baco.hcreate mode 100644drivers/gpu/drm/amd/powerplay/hwmgr/fiji_baco.ccreate mode 100644drivers/gpu/drm/amd/powerplay/hwmgr/fiji_baco.hcreate mode 100644drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.ccreate mode 100644drivers/gpu/drm/amd/powerplay/hwmgr/polaris_baco.hcreate mode 100644drivers/gpu/drm/amd/powerplay/hwmgr/smu7_baco.ccreate mode 100644drivers/gpu/drm/amd/powerplay/hwmgr/smu7_baco.hcreate mode 100644drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.ccreate mode 100644drivers/gpu/drm/amd/powerplay/hwmgr/tonga_baco.h
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx