drm/amdgpu: add hdp version 4 functions
Subsystems (2)
PATCH 1/5 drm/amdgpu: add hdp version 4 functions
From: Likun Gao <[email protected]>
Unfiy hdp related function into hdp structure for hdp version 4.
--- drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c | 150 ++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h | 31 ++++++ 2 files changed, 181 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c new file +150 -0
@@ -0,0 +1,150 @@ +/* +* 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. +* +*/ +#include "amdgpu.h" +#include "amdgpu_atombios.h" +#include "hdp_v4_0.h" +#include "amdgpu_ras.h" + +#include "hdp/hdp_4_0_offset.h" +#include "hdp/hdp_4_0_sh_mask.h" +#include <uapi/linux/kfd_ioctl.h> + +#define mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL 0x00f7 +#define mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL_BASE_IDX 2 +/* for Vega20 register name change */ +#define mmHDP_MEM_POWER_CTRL 0x00d4 +#define HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK 0x00000001L +#define HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK 0x00000002L +#define HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK 0x00010000L +#define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK 0x00020000L +#define mmHDP_MEM_POWER_CTRL_BASE_IDX 0 + +static void hdp_v4_0_flush_hdp (struct amdgpu_device *adev, +struct amdgpu_ring *ring) +{ +uint32_t reg_addr; + +if (adev->flags &AMD_IS_APU || + adev->asic_type ==CHIP_VEGA20 || + adev->asic_type ==CHIP_ARCTURUS ) + reg_addr = (adev->rmmio_remap.reg_offset + +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ; +else + reg_addr =SOC15_REG_OFFSET (NBIO ,0 , + mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL); + +if (!ring || !ring->funcs->emit_wreg) +WREG32_NO_KIQ (reg_addr,0 ); +else +amdgpu_ring_emit_wreg (ring, reg_addr,0 ); +} + +static void hdp_v4_0_invalidate_hdp (struct amdgpu_device *adev, +struct amdgpu_ring *ring) +{ +if (!ring || !ring->funcs->emit_wreg) +WREG32_SOC15_NO_KIQ (HDP ,0 , mmHDP_READ_CACHE_INVALIDATE,1 ); +else +amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET ( +HDP ,0 , mmHDP_READ_CACHE_INVALIDATE),1 ); +} + +static void hdp_v4_0_reset_ras_error_count (struct amdgpu_device *adev) +{ +if (!amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__HDP )) +return ; +/*read back hdp ras counter to reset it to 0 */ +RREG32_SOC15 (HDP ,0 , mmHDP_EDC_CNT); +} + +static void hdp_v4_0_update_clock_gating (struct amdgpu_device *adev, +bool enable) +{ +uint32_t def, data; + +if (adev->asic_type ==CHIP_VEGA20 || + adev->asic_type ==CHIP_ARCTURUS || + adev->asic_type ==CHIP_RENOIR ) { + def = data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_CTRL)); + +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) + data |=HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK ; +else + data &= ~(HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK ); + +if (def != data) +WREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_CTRL), data); + }else { + def = data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS)); + +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) + data |=HDP_MEM_POWER_LS__LS_ENABLE_MASK ; +else + data &= ~HDP_MEM_POWER_LS__LS_ENABLE_MASK ; + +if (def != data) +WREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS), data); + } +} + +static void hdp_v4_0_get_clockgating_state (struct amdgpu_device *adev, +u32 *flags) +{ +int data; + +/* AMD_CG_SUPPORT_HDP_LS */ + data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS)); +if (data &HDP_MEM_POWER_LS__LS_ENABLE_MASK ) + *flags |=AMD_CG_SUPPORT_HDP_LS ; +} + +static void hdp_v4_0_init_registers (struct amdgpu_device *adev) +{ +switch (adev->asic_type) { +case CHIP_ARCTURUS : +WREG32_FIELD15 (HDP ,0 ,HDP_MMHUB_CNTL ,HDP_MMHUB_GCC ,1 ); +break ; +default : +break ; + } + +WREG32_FIELD15 (HDP ,0 ,HDP_MISC_CNTL ,FLUSH_INVALIDATE_CACHE ,1 ); + +WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE, (adev->gmc.vram_start >>8 )); +WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE_HI, (adev->gmc.vram_start >>40 )); +} + +const struct amdgpu_hdp_funcs hdp_v4_0_funcs = { + .flush_hdp = hdp_v4_0_flush_hdp, + .invalidate_hdp = hdp_v4_0_invalidate_hdp, + .reset_ras_error_count = hdp_v4_0_reset_ras_error_count, + .update_clock_gating = hdp_v4_0_update_clock_gating, + .get_clock_gating_state = hdp_v4_0_get_clockgating_state, + .init_registers = hdp_v4_0_init_registers, +};
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* 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 __HDP_V4_0_H__ +#define __HDP_V4_0_H__ + +#include "soc15_common.h" + +extern const struct amdgpu_hdp_funcs hdp_v4_0_funcs; + +#endif
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/5 drm/amdgpu: add hdp version 5 functions
From: Likun Gao <[email protected]>
Unfiy hdp related function into hdp structure for hdp version 5.
--- drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c | 212 ++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/hdp_v5_0.h | 31 ++++ 2 files changed, 243 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/hdp_v5_0.h
drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c new file +212 -0
@@ -0,0 +1,212 @@ +/* +* 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. +* +*/ +#include "amdgpu.h" +#include "amdgpu_atombios.h" +#include "hdp_v5_0.h" + +#include "hdp/hdp_5_0_0_offset.h" +#include "hdp/hdp_5_0_0_sh_mask.h" +#include <uapi/linux/kfd_ioctl.h> + +static void hdp_v5_0_flush_hdp (struct amdgpu_device *adev, +struct amdgpu_ring *ring) +{ +if (!ring || !ring->funcs->emit_wreg) +WREG32_NO_KIQ ((adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); +else +amdgpu_ring_emit_wreg (ring, (adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); +} + +static void hdp_v5_0_invalidate_hdp (struct amdgpu_device *adev, +struct amdgpu_ring *ring) +{ +if (!ring || !ring->funcs->emit_wreg) { +WREG32_SOC15_NO_KIQ (HDP ,0 , mmHDP_READ_CACHE_INVALIDATE,1 ); + }else { +amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET ( +HDP ,0 , mmHDP_READ_CACHE_INVALIDATE),1 ); + } +} + +static void hdp_v5_0_update_mem_power_gating (struct amdgpu_device *adev, +bool enable) +{ +uint32_t hdp_clk_cntl, hdp_clk_cntl1; +uint32_t hdp_mem_pwr_cntl; + +if (!(adev->cg_flags & (AMD_CG_SUPPORT_HDP_LS | +AMD_CG_SUPPORT_HDP_DS | +AMD_CG_SUPPORT_HDP_SD ))) +return ; + + hdp_clk_cntl = hdp_clk_cntl1 =RREG32_SOC15 (HDP ,0 , mmHDP_CLK_CNTL); + hdp_mem_pwr_cntl =RREG32_SOC15 (HDP ,0 , mmHDP_MEM_POWER_CTRL); + +/* Before doing clock/power mode switch, +* forced on IPH & RC clock */ + hdp_clk_cntl =REG_SET_FIELD (hdp_clk_cntl,HDP_CLK_CNTL , +IPH_MEM_CLK_SOFT_OVERRIDE ,1 ); + hdp_clk_cntl =REG_SET_FIELD (hdp_clk_cntl,HDP_CLK_CNTL , +RC_MEM_CLK_SOFT_OVERRIDE ,1 ); +WREG32_SOC15 (HDP ,0 , mmHDP_CLK_CNTL, hdp_clk_cntl); + +/* HDP 5.0 doesn't support dynamic power mode switch, +* disable clock and power gating before any changing */ + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_CTRL_EN ,0 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_LS_EN ,0 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_DS_EN ,0 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_SD_EN ,0 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +RC_MEM_POWER_CTRL_EN ,0 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +RC_MEM_POWER_LS_EN ,0 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +RC_MEM_POWER_DS_EN ,0 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +RC_MEM_POWER_SD_EN ,0 ); +WREG32_SOC15 (HDP ,0 , mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl); + +/* only one clock gating mode (LS/DS/SD) can be enabled */ +if (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS ) { + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_LS_EN , enable); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +RC_MEM_POWER_LS_EN , enable); + }else if (adev->cg_flags &AMD_CG_SUPPORT_HDP_DS ) { + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_DS_EN , enable); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +RC_MEM_POWER_DS_EN , enable); + }else if (adev->cg_flags &AMD_CG_SUPPORT_HDP_SD ) { + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_SD_EN , enable); +/* RC should not use shut down mode, fallback to ds */ + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +RC_MEM_POWER_DS_EN , enable); + } + +/* confirmed that IPH_MEM_POWER_CTRL_EN and RC_MEM_POWER_CTRL_EN have to +* be set for SRAM LS/DS/SD */ +if (adev->cg_flags & (AMD_CG_SUPPORT_HDP_LS |AMD_CG_SUPPORT_HDP_DS | +AMD_CG_SUPPORT_HDP_SD )) { + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_CTRL_EN ,1 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +RC_MEM_POWER_CTRL_EN ,1 ); + } + +WREG32_SOC15 (HDP ,0 , mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl); + +/* restore IPH & RC clock override after clock/power mode changing */ +WREG32_SOC15 (HDP ,0 , mmHDP_CLK_CNTL, hdp_clk_cntl1); +} + +static void hdp_v5_0_update_medium_grain_clock_gating (struct amdgpu_device *adev, +bool enable) +{ +uint32_t hdp_clk_cntl; + +if (!(adev->cg_flags &AMD_CG_SUPPORT_HDP_MGCG )) +return ; + + hdp_clk_cntl =RREG32_SOC15 (HDP ,0 , mmHDP_CLK_CNTL); + +if (enable) { + hdp_clk_cntl &= + ~(uint32_t ) + (HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK ); + }else { + hdp_clk_cntl |=HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK ; + } + +WREG32_SOC15 (HDP ,0 , mmHDP_CLK_CNTL, hdp_clk_cntl); +} + +static void hdp_v5_0_update_clock_gating (struct amdgpu_device *adev, +bool enable) +{ +hdp_v5_0_update_mem_power_gating (adev, enable); +hdp_v5_0_update_medium_grain_clock_gating (adev, enable); +} + +static void hdp_v5_0_get_clockgating_state (struct amdgpu_device *adev, +u32 *flags) +{ +uint32_t tmp; + +/* AMD_CG_SUPPORT_HDP_MGCG */ + tmp =RREG32_SOC15 (HDP ,0 , mmHDP_CLK_CNTL); +if (!(tmp & (HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK | +HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK ))) + *flags |=AMD_CG_SUPPORT_HDP_MGCG ; + +/* AMD_CG_SUPPORT_HDP_LS/DS/SD */ + tmp =RREG32_SOC15 (HDP ,0 , mmHDP_MEM_POWER_CTRL); +if (tmp &HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK ) + *flags |=AMD_CG_SUPPORT_HDP_LS ; +else if (tmp &HDP_MEM_POWER_CTRL__IPH_MEM_POWER_DS_EN_MASK ) + *flags |=AMD_CG_SUPPORT_HDP_DS ; +else if (tmp &HDP_MEM_POWER_CTRL__IPH_MEM_POWER_SD_EN_MASK ) + *flags |=AMD_CG_SUPPORT_HDP_SD ; +} + +static void hdp_v5_0_init_registers (struct amdgpu_device *adev) +{ +u32 tmp; + + tmp =RREG32_SOC15 (HDP ,0 , mmHDP_MISC_CNTL); + tmp |=HDP_MISC_CNTL__FLUSH_INVALIDATE_CACHE_MASK ; +WREG32_SOC15 (HDP ,0 , mmHDP_MISC_CNTL, tmp); +} + +const struct amdgpu_hdp_funcs hdp_v5_0_funcs = { + .flush_hdp = hdp_v5_0_flush_hdp, + .invalidate_hdp = hdp_v5_0_invalidate_hdp, + .update_clock_gating = hdp_v5_0_update_clock_gating, + .get_clock_gating_state = hdp_v5_0_get_clockgating_state, + .init_registers = hdp_v5_0_init_registers, +};
drivers/gpu/drm/amd/amdgpu/hdp_v5_0.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* 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 __HDP_V5_0_H__ +#define __HDP_V5_0_H__ + +#include "soc15_common.h" + +extern const struct amdgpu_hdp_funcs hdp_v5_0_funcs; + +#endif
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/5 drm/amdgpu: switch hdp callback functions for hdp v4
In reply to Likun GaoFrom: Likun Gao <[email protected]>
Switch to use the HDP functions which unfied on hdp structure instead of the scattered hdp callback functions.
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 7 ++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 21 +------ drivers/gpu/drm/amd/amdgpu/soc15.c | 82 +++------------------------ 4 files changed, 15 insertions(+), 97 deletions(-)
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -71,7 +71,7 @@ amdgpu-y += \ vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o \ vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o navi10_reg_init.o navi14_reg_init.o \ arct_reg_init.o navi12_reg_init.o mxgpu_nv.o sienna_cichlid_reg_init.o vangogh_reg_init.o \ - nbio_v7_2.o dimgrey_cavefish_reg_init.o + nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o # add DF block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -2
@@ -89,6 +89,7 @@#include "amdgpu_gfx.h" #include "amdgpu_sdma.h" #include "amdgpu_nbio.h" +#include "amdgpu_hdp.h" #include "amdgpu_dm.h" #include "amdgpu_virt.h" #include "amdgpu_csa.h"
@@ -1209,8 +1210,10 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define amdgpu_asic_read_bios_from_rom (adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l))#define amdgpu_asic_read_register (adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v)))#define amdgpu_asic_get_config_memsize (adev) (adev)->asic_funcs->get_config_memsize((adev)) -#define amdgpu_asic_flush_hdp (adev, r) (adev)->asic_funcs->flush_hdp((adev), (r)) -#define amdgpu_asic_invalidate_hdp (adev, r) (adev)->asic_funcs->invalidate_hdp((adev), (r)) +#define amdgpu_asic_flush_hdp (adev, r) \ + ((adev)->asic_funcs->flush_hdp ? (adev)->asic_funcs->flush_hdp((adev), (r)) : (adev)->hdp.funcs->flush_hdp((adev), (r))) +#define amdgpu_asic_invalidate_hdp (adev, r) \ + ((adev)->asic_funcs->invalidate_hdp ? (adev)->asic_funcs->invalidate_hdp((adev), (r)) : (adev)->hdp.funcs->invalidate_hdp((adev), (r)))#define amdgpu_asic_need_full_reset (adev) (adev)->asic_funcs->need_full_reset((adev))#define amdgpu_asic_init_doorbell_index (adev) (adev)->asic_funcs->init_doorbell_index((adev))#define amdgpu_asic_get_pcie_usage (adev, cnt0, cnt1) ((adev)->asic_funcs->get_pcie_usage((adev), (cnt0), (cnt1)))
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -19
@@ -31,8 +31,6 @@#include "amdgpu_atomfirmware.h" #include "amdgpu_gem.h" -#include "hdp/hdp_4_0_offset.h" -#include "hdp/hdp_4_0_sh_mask.h" #include "gc/gc_9_0_sh_mask.h" #include "dce/dce_12_0_offset.h" #include "dce/dce_12_0_sh_mask.h"
@@ -1571,7 +1569,6 @@ static int gmc_v9_0_hw_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;bool value;int r, i; -u32 tmp;/* The sequence of these two function calls matters.*/ gmc_v9_0_init_golden_registers (adev);
@@ -1590,24 +1587,10 @@ static int gmc_v9_0_hw_init(void *handle)if (adev->mmhub.funcs->update_power_gating) adev->mmhub.funcs->update_power_gating (adev, true); -switch (adev->asic_type) { -case CHIP_ARCTURUS : -WREG32_FIELD15 (HDP ,0 ,HDP_MMHUB_CNTL ,HDP_MMHUB_GCC ,1 ); -break ; -default : -break ; - } - -WREG32_FIELD15 (HDP ,0 ,HDP_MISC_CNTL ,FLUSH_INVALIDATE_CACHE ,1 ); - - tmp =RREG32_SOC15 (HDP ,0 , mmHDP_HOST_PATH_CNTL); -WREG32_SOC15 (HDP ,0 , mmHDP_HOST_PATH_CNTL, tmp); - -WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE, (adev->gmc.vram_start >>8 )); -WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE_HI, (adev->gmc.vram_start >>40 )); + adev->hdp.funcs->init_registers (adev);/* After HDP is initialized, flush HDP.*/ - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL );if (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) value = false;
drivers/gpu/drm/amd/amdgpu/soc15.c +7 -75
160 lines not on this page · raw message
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/5] drm/amdgpu: switch hdp callback functions for hdp v4
[AMD Public Use]
Quoted 231 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Likun Gao
Sent: Monday, December 28, 2020 2:49 PM
To: [email protected]
Cc: Gao, Likun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 3/5] drm/amdgpu: switch hdp callback functions for hdp v4[CAUTION: External Email]
From: Likun Gao <[email protected]>
Switch to use the HDP functions which unfied on hdp structure instead of the scattered hdp callback functions.
Signed-off-by Likun Gao <[email protected]>Change-Id I75016df403eca537fa30519e2918207461ec6f28---
drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 7 ++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 21 +------ drivers/gpu/drm/amd/amdgpu/soc15.c | 82 +++------------------------ 4 files changed, 15 insertions(+), 97 deletions(-)drivers/gpu/drm/amd/amdgpu/Makefile +1
-1@@ -71,7 +71,7 @@ amdgpu-y += \ vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o \ vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o navi10_reg_init.o navi14_reg_init.o \ arct_reg_init.o navi12_reg_init.o mxgpu_nv.o sienna_cichlid_reg_init.o vangogh_reg_init.o \ - nbio_v7_2.o dimgrey_cavefish_reg_init.o + nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o# add DF block amdgpu-y += \drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -89,6 +89,7 @@#include "amdgpu_gfx.h" #include "amdgpu_sdma.h" #include "amdgpu_nbio.h" +#include "amdgpu_hdp.h" #include "amdgpu_dm.h" #include "amdgpu_virt.h" #include "amdgpu_csa.h" @@ -1209,8 +1210,10 @@ int emu_soc_asic_init(struct amdgpu_device *adev); #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)-Quoted 1 line
asic_funcs->read_bios_from_rom((adev), (b), (l))#define
amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs-Quoted 1 line
read_register((adev), (se), (sh), (offset), (v))) #define
amdgpu_asic_get_config_memsize(adev)(adev)->asic_funcs-Quoted 1 line
get_config_memsize((adev))
-#define
amdgpu_asic_flush_hdp(adev, r)(adev)->asic_funcs-Quoted 1 line
flush_hdp((adev), (r))-#defineamdgpu_asic_invalidate_hdp(adev, r)(adev)->asic_funcs->invalidate_hdp((adev), (r))
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0+#define amdgpu_asic_flush_hdp (adev, r) \ + ((adev)->asic_funcs->flush_hdp ? +(adev)->asic_funcs->flush_hdp((adev), (r)) : (adev)->hdp.funcs-Quoted 1 line
flush_hdp((adev), (r))) #defineamdgpu_asic_invalidate_hdp(adev, r)\drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0+ ((adev)->asic_funcs->invalidate_hdp ? +(adev)->asic_funcs->invalidate_hdp ((adev), (r)) : +(adev)->hdp.funcs->invalidate_hdp ((adev), (r)))#define
amdgpu_asic_need_full_reset(adev)(adev)->asic_funcs-Quoted 1 line
need_full_reset((adev))
#define
amdgpu_asic_init_doorbell_index(adev)(adev)->asic_funcs-Quoted 1 line
init_doorbell_index((adev))
#define
amdgpu_asic_get_pcie_usage(adev, cnt0, cnt1)((adev)->asic_funcs-Quoted 1 line
get_pcie_usage((adev), (cnt0), (cnt1))) diff --git
a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.cb/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
indexe22268f9dba7..7b1f50fa9dac100644drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2
-19@@ -31,8 +31,6 @@#include "amdgpu_atomfirmware.h" #include "amdgpu_gem.h" -#include "hdp/hdp_4_0_offset.h" -#include "hdp/hdp_4_0_sh_mask.h" #include "gc/gc_9_0_sh_mask.h" #include "dce/dce_12_0_offset.h" #include "dce/dce_12_0_sh_mask.h" @@ -1571,7 +1569,6 @@ static int gmc_v9_0_hw_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;bool value;int r, i; -u32 tmp;/* The sequence of these two function calls matters.*/ gmc_v9_0_init_golden_registers (adev);@@ -1590,24 +1587,10 @@ static int gmc_v9_0_hw_init(void *handle)if (adev->mmhub.funcs->update_power_gating) adev->mmhub.funcs->update_power_gating (adev, true); -switch (adev->asic_type) { -case CHIP_ARCTURUS : -WREG32_FIELD15 (HDP ,0 ,HDP_MMHUB_CNTL ,HDP_MMHUB_GCC , 1); -break ; -default : -break ; - } - -WREG32_FIELD15 (HDP ,0 ,HDP_MISC_CNTL ,FLUSH_INVALIDATE_CACHE , 1); - - tmp =RREG32_SOC15 (HDP ,0 , mmHDP_HOST_PATH_CNTL); -WREG32_SOC15 (HDP ,0 , mmHDP_HOST_PATH_CNTL, tmp); - -WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE, (adev- >gmc.vram_start >> 8)); -WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE_HI, (adev- >gmc.vram_start >> 40)); + adev->hdp.funcs->init_registers (adev);/* After HDP is initialized, flush HDP.*/ - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL );if (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) value = false;drivers/gpu/drm/amd/amdgpu/soc15.c +1
-2@@ -40,8 +40,6 @@#include "gc/gc_9_0_sh_mask.h" #include "sdma0/sdma0_4_0_offset.h" #include "sdma1/sdma1_4_0_offset.h" -#include "hdp/hdp_4_0_offset.h" -#include "hdp/hdp_4_0_sh_mask.h" #include "nbio/nbio_7_0_default.h" #include "nbio/nbio_7_0_offset.h" #include "nbio/nbio_7_0_sh_mask.h" @@ -59,6 +57,7 @@#include "nbio_v6_1.h" #include "nbio_v7_0.h" #include "nbio_v7_4.h" +#include "hdp_v4_0.h" #include "vega10_ih.h" #include "vega20_ih.h" #include "navi10_ih.h" @@ -84,14 +83,6 @@#define mmMP0_MISC_LIGHT_SLEEP_CTRL
0x01ba
#definemmMP0_MISC_LIGHT_SLEEP_CTRL_BASE_IDX
0drivers/gpu/drm/amd/amdgpu/soc15.c +0
-3-/* for Vega20 register name change */ -#define mmHDP_MEM_POWER_CTRL 0x00d4 -#define HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK
0x00000001L
-#defineHDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK0x00000002L
-#defineHDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK0x00010000L
-#defineHDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK0x00020000Ldrivers/gpu/drm/amd/amdgpu/soc15.c +0
-2-#define mmHDP_MEM_POWER_CTRL_BASE_IDX 0 -/*
* Indirect registers accessor
*/drivers/gpu/drm/amd/amdgpu/soc15.c +1
-0@@ -700,6 +691,7 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) adev->nbio.funcs = &nbio_v6_1_funcs; adev->nbio.hdp_flush_reg = &nbio_v6_1_hdp_flush_reg; } + adev->hdp.funcs = &hdp_v4_0_funcs;if (adev->asic_type ==CHIP_VEGA20 || adev->asic_type ==CHIP_ARCTURUS )adev->df.funcs = &df_v3_6_funcs; @@ -835,21 +827,6 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) return 0; }-static void
soc15_flush_hdp(struct amdgpu_device *adev, struct amdgpu_ring *ring)-{drivers/gpu/drm/amd/amdgpu/soc15.c +0
-8- adev->nbio.funcs->hdp_flush (adev, ring); -} - -static void soc15_invalidate_hdp (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) - WREG32_SOC15_NO_KIQ(HDP, 0,
mmHDP_READ_CACHE_INVALIDATE, 1);drivers/gpu/drm/amd/amdgpu/soc15.c +0
-5-else -amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET ( -HDP ,0 , mmHDP_READ_CACHE_INVALIDATE),1 ); -} -static bool soc15_need_full_reset(struct amdgpu_device *adev) { /* change this when we implement soft reset */ @@ -858,10 +835,7 @@static bool
soc15_need_full_reset(struct amdgpu_device *adev)static void
vega20_reset_hdp_ras_error_count(struct amdgpu_device *adev){drivers/gpu/drm/amd/amdgpu/soc15.c +1
-4-if (!amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__HDP )) -return ; -/*read back hdp ras counter to reset it to 0 */ -RREG32_SOC15 (HDP ,0 , mmHDP_EDC_CNT); + adev->hdp.funcs->reset_ras_error_count (adev);}
static void soc15_get_pcie_usage(struct
amdgpu_device*adev,uint64_t*count0, @@ -1012,8 +986,6 @@ static const structamdgpu_asic_funcssoc15_asic_funcs=.set_uvd_clocks = &soc15_set_uvd_clocks, .set_vce_clocks = &soc15_set_vce_clocks, .get_config_memsize = &soc15_get_config_memsize,drivers/gpu/drm/amd/amdgpu/soc15.c +0
-2- .flush_hdp = &soc15_flush_hdp, - .invalidate_hdp = &soc15_invalidate_hdp, .need_full_reset = &soc15_need_full_reset, .init_doorbell_index = &vega10_doorbell_index_init, .get_pcie_usage = &soc15_get_pcie_usage, @@ -1035,8 +1007,6 @@static const struct
amdgpu_asic_funcsvega20_asic_funcs=.set_uvd_clocks = &soc15_set_uvd_clocks, .set_vce_clocks = &soc15_set_vce_clocks, .get_config_memsize = &soc15_get_config_memsize,
drivers/gpu/drm/amd/amdgpu/soc15.c static const struct amdgpu_asic_funcs vega20_asic_funcs = · line 1010
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +0
-2- .flush_hdp = &soc15_flush_hdp, - .invalidate_hdp = &soc15_invalidate_hdp, .reset_hdp_ras_error_count = &vega20_reset_hdp_ras_error_count,
Could you remove this asic function also ? You may use this check before calling hdp reset errors function.
if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__HDP))
Regards,
Lijo
Quoted 101 lines
.need_full_reset = &soc15_need_full_reset, .init_doorbell_index = &vega20_doorbell_index_init, @@ -1422,41 +1392,6 @@ static int soc15_common_soft_reset(void *handle) return 0; }-static void
soc15_update_hdp_light_sleep(struct amdgpu_device *adev, bool enable)-{drivers/gpu/drm/amd/amdgpu/soc15.c +0
-6-uint32_t def, data; - -if (adev->asic_type ==CHIP_VEGA20 || - adev->asic_type ==CHIP_ARCTURUS || - adev->asic_type ==CHIP_RENOIR ) { - def = data = RREG32(SOC15_REG_OFFSET(HDP, 0,
mmHDP_MEM_POWER_CTRL));drivers/gpu/drm/amd/amdgpu/soc15.c +0
-3- -if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) - data |=
HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK|
-HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK|
-HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK|
-HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK;drivers/gpu/drm/amd/amdgpu/soc15.c +0
-2-else - data &=~(HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK | -
HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK| -HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK| -HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK);drivers/gpu/drm/amd/amdgpu/soc15.c +0
-3- -if (def != data) - WREG32(SOC15_REG_OFFSET(HDP, 0,
mmHDP_MEM_POWER_CTRL), data);drivers/gpu/drm/amd/amdgpu/soc15.c +0
-2- }else { - def = data = RREG32(SOC15_REG_OFFSET(HDP, 0,
mmHDP_MEM_POWER_LS));drivers/gpu/drm/amd/amdgpu/soc15.c +0
-8- -if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) - data |=HDP_MEM_POWER_LS__LS_ENABLE_MASK ; -else - data &= ~HDP_MEM_POWER_LS__LS_ENABLE_MASK ; - -if (def != data) - WREG32(SOC15_REG_OFFSET(HDP, 0,
mmHDP_MEM_POWER_LS), data);drivers/gpu/drm/amd/amdgpu/soc15.c +0
-3- } -} -static void soc15_update_drm_clock_gating(struct
amdgpu_device*adev,bool enable) { uint32_t def, data;drivers/gpu/drm/amd/amdgpu/soc15.c +1
-1@@ -1517,7 +1452,7 @@ static intsoc15_common_set_clockgating_state (void *handle, state ==AMD_CG_STATE_GATE ); adev->nbio.funcs->update_medium_grain_light_sleep (adev, state ==AMD_CG_STATE_GATE ); -soc15_update_hdp_light_sleep (adev, + adev->hdp.funcs->update_clock_gating (adev, state ==AMD_CG_STATE_GATE ); soc15_update_drm_clock_gating(adev,state == AMD_CG_STATE_GATE); @@ -1534,7 +1469,7 @@ static int soc15_common_set_clockgating_state(void *handle, state == AMD_CG_STATE_GATE); adev->nbio.funcs->update_medium_grain_light_sleep(adev, state == AMD_CG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/soc15.c +1
-1-soc15_update_hdp_light_sleep (adev, + adev->hdp.funcs->update_clock_gating (adev, state ==AMD_CG_STATE_GATE );soc15_update_drm_clock_gating (adev, state == AMD_CG_STATE_GATE); @@ -1542,7 +1477,7 @@static int soc15_common_set_clockgating_state(void *handle,
state == AMD_CG_STATE_GATE); break; case CHIP_ARCTURUS:drivers/gpu/drm/amd/amdgpu/soc15.c +2
-5-soc15_update_hdp_light_sleep (adev, + adev->hdp.funcs->update_clock_gating (adev, state ==AMD_CG_STATE_GATE );break ;default :@@ -1561,10 +1496,7 @@ static voidsoc15_common_get_clockgating_state (void *handle, u32 *flags) adev->nbio.funcs->get_clockgating_state(adev, flags); -/* AMD_CG_SUPPORT_HDP_LS */ - data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS)); -if (data &HDP_MEM_POWER_LS__LS_ENABLE_MASK ) - *flags |=AMD_CG_SUPPORT_HDP_LS ; + adev->hdp.funcs->get_clock_gating_state (adev, flags);/* AMD_CG_SUPPORT_DRM_MGCG */ data = RREG32(SOC15_REG_OFFSET(MP0, 0,
mmMP0_MISC_CGTT_CTRL0));
--
2.25.1
Quoted 10 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.f
reedesktop.org%2Fmailman%2Flistinfo%2Famd- gfx&data=04%7C01%7Clijo.lazar%40amd.com%7Cba137ed79c354d2620a1 08d8ab119d0c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637447 439441071208%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQ IjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8nzvnyY DrhrG5HXAXut4N%2FXUYpWcrHbObXOxnDjwm1Y%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/5 drm/amdgpu: switch hdp callback functions for hdp v5
In reply to Likun GaoFrom: Likun Gao <[email protected]>
Switch to use the HDP functions which unfied on hdp structure instead of the scattered hdp callback functions.
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 9 +- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 14 +-- drivers/gpu/drm/amd/amdgpu/nv.c | 160 +------------------------ drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +- 5 files changed, 13 insertions(+), 174 deletions(-)
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -71,7 +71,7 @@ amdgpu-y += \ vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o \ vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o navi10_reg_init.o navi14_reg_init.o \ arct_reg_init.o navi12_reg_init.o mxgpu_nv.o sienna_cichlid_reg_init.o vangogh_reg_init.o \ - nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o + nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o hdp_v5_0.o # add DF block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -5
@@ -38,7 +38,6 @@#include "smuio/smuio_11_0_0_offset.h" #include "smuio/smuio_11_0_0_sh_mask.h" #include "navi10_enum.h" -#include "hdp/hdp_5_0_0_offset.h" #include "ivsrcid/gfx/irqsrcs_gfx_10_1.h" #include "soc15.h"
@@ -5691,7 +5690,7 @@ static int gfx_v10_0_cp_gfx_load_pfp_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_PFP_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_PFP_IC_BASE_CNTL ,VMID ,0 );
@@ -5769,7 +5768,7 @@ static int gfx_v10_0_cp_gfx_load_ce_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_CE_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_CE_IC_BASE_CNTL ,VMID ,0 );
@@ -5846,7 +5845,7 @@ static int gfx_v10_0_cp_gfx_load_me_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_ME_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_ME_IC_BASE_CNTL ,VMID ,0 );
@@ -6215,7 +6214,7 @@ static int gfx_v10_0_cp_compute_load_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_CPC_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_CPC_IC_BASE_CNTL ,CACHE_POLICY ,0 );
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3 -11
@@ -27,8 +27,6 @@#include "gmc_v10_0.h" #include "umc_v8_7.h" -#include "hdp/hdp_5_0_0_offset.h" -#include "hdp/hdp_5_0_0_sh_mask.h" #include "athub/athub_2_0_0_sh_mask.h" #include "athub/athub_2_0_0_offset.h" #include "dcn/dcn_2_0_0_offset.h"
@@ -312,7 +310,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,int r;/* flush hdp cache */ - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL );/* For SRIOV run time, driver shouldn't access the register through MMIO * Directly use kiq to do the vm invalidation instead
@@ -995,7 +993,6 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev) {int r;bool value; -u32 tmp;if (adev->gart.bo ==NULL ) {dev_err (adev->dev,"No VRAM object for PCIE GART.\n" );
@@ -1014,15 +1011,10 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev)if (r)return r; - tmp =RREG32_SOC15 (HDP ,0 , mmHDP_MISC_CNTL); - tmp |=HDP_MISC_CNTL__FLUSH_INVALIDATE_CACHE_MASK ; -WREG32_SOC15 (HDP ,0 , mmHDP_MISC_CNTL, tmp); - - tmp =RREG32_SOC15 (HDP ,0 , mmHDP_HOST_PATH_CNTL); -WREG32_SOC15 (HDP ,0 , mmHDP_HOST_PATH_CNTL, tmp); + adev->hdp.funcs->init_registers (adev);/* Flush HDP after it is initialized */ - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/nv.c +4 -156
214 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +1 -1
@@ -690,7 +690,7 @@ static int psp_v11_0_memory_training(struct psp_context *psp, uint32_t ops) }memcpy_toio (adev->mman.aper_base_kaddr, buf, sz); - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL );vfree (buf); }
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 4/5] drm/amdgpu: switch hdp callback functions for hdp v5
[AMD Public Use]
One question for this patch:
+ adev->hdp.funcs->flush_hdp(adev, NULL);
Shall we add one NULL pointer guard of hdp.funcs->flush_hdp before using it? Or it's not needed at all as hdp.funcs will be initialized for all related ASIC series.
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Likun Gao
Sent: Monday, December 28, 2020 5:19 PM
To: [email protected]
Cc: Gao, Likun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 4/5] drm/amdgpu: switch hdp callback functions for hdp v5
From: Likun Gao <[email protected]>
Switch to use the HDP functions which unfied on hdp structure instead of the scattered hdp callback functions.
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 9 +- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 14 +-- drivers/gpu/drm/amd/amdgpu/nv.c | 160 +------------------------ drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +- 5 files changed, 13 insertions(+), 174 deletions(-)
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -71,7 +71,7 @@ amdgpu-y += \ vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o \ vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o navi10_reg_init.o navi14_reg_init.o \ arct_reg_init.o navi12_reg_init.o mxgpu_nv.o sienna_cichlid_reg_init.o vangogh_reg_init.o \ - nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o + nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o hdp_v5_0.o # add DF block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -2
@@ -38,7 +38,6 @@#include "smuio/smuio_11_0_0_offset.h" #include "smuio/smuio_11_0_0_sh_mask.h" #include "navi10_enum.h" -#include "hdp/hdp_5_0_0_offset.h" #include "ivsrcid/gfx/irqsrcs_gfx_10_1.h" #include "soc15.h"
@@ -5691,7 +5690,7 @@ static int gfx_v10_0_cp_gfx_load_pfp_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_PFP_IC_BASE_CNTL); tmp = REG_SET_FIELD(tmp, CP_PFP_IC_BASE_CNTL, VMID, 0); @@ -5769,7 +5768,7 @@ static int gfx_v10_0_cp_gfx_load_ce_microcode(struct amdgpu_device *adev)
}
if (amdgpu_emu_mode == 1)
- adev->nbio.funcs->hdp_flush(adev, NULL);
+ adev->hdp.funcs->flush_hdp(adev, NULL);
tmp = RREG32_SOC15(GC, 0, mmCP_CE_IC_BASE_CNTL);
tmp = REG_SET_FIELD(tmp, CP_CE_IC_BASE_CNTL, VMID, 0); @@ -5846,7 +5845,7 @@ static int gfx_v10_0_cp_gfx_load_me_microcode(struct amdgpu_device *adev) }
if (amdgpu_emu_mode == 1)
- adev->nbio.funcs->hdp_flush(adev, NULL);
+ adev->hdp.funcs->flush_hdp(adev, NULL);
tmp = RREG32_SOC15(GC, 0, mmCP_ME_IC_BASE_CNTL);
tmp = REG_SET_FIELD(tmp, CP_ME_IC_BASE_CNTL, VMID, 0); @@ -6215,7 +6214,7 @@ static int gfx_v10_0_cp_compute_load_microcode(struct amdgpu_device *adev) }
if (amdgpu_emu_mode == 1)
- adev->nbio.funcs->hdp_flush(adev, NULL);
+ adev->hdp.funcs->flush_hdp(adev, NULL);
tmp = RREG32_SOC15(GC, 0, mmCP_CPC_IC_BASE_CNTL);
tmp = REG_SET_FIELD(tmp, CP_CPC_IC_BASE_CNTL, CACHE_POLICY, 0); diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 5648c48be77f..3b7c6c31fce1 100644
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -3
@@ -27,8 +27,6 @@#include "gmc_v10_0.h" #include "umc_v8_7.h" -#include "hdp/hdp_5_0_0_offset.h" -#include "hdp/hdp_5_0_0_sh_mask.h" #include "athub/athub_2_0_0_sh_mask.h" #include "athub/athub_2_0_0_offset.h" #include "dcn/dcn_2_0_0_offset.h"
@@ -312,7 +310,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,int r;/* flush hdp cache */ - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL );/* For SRIOV run time, driver shouldn't access the register through MMIO * Directly use kiq to do the vm invalidation instead @@ -995,7 +993,6 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev) {
int r;
bool value;
- u32 tmp;
if (adev->gart.bo == NULL) {
dev_err(adev->dev, "No VRAM object for PCIE GART.\n"); @@ -1014,15 +1011,10 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev)
if (r)
return r;
- tmp = RREG32_SOC15(HDP, 0, mmHDP_MISC_CNTL);
- tmp |= HDP_MISC_CNTL__FLUSH_INVALIDATE_CACHE_MASK;
- WREG32_SOC15(HDP, 0, mmHDP_MISC_CNTL, tmp);
-
- tmp = RREG32_SOC15(HDP, 0, mmHDP_HOST_PATH_CNTL);
- WREG32_SOC15(HDP, 0, mmHDP_HOST_PATH_CNTL, tmp);
+ adev->hdp.funcs->init_registers(adev);
/* Flush HDP after it is initialized */
- adev->nbio.funcs->hdp_flush(adev, NULL);
+ adev->hdp.funcs->flush_hdp(adev, NULL);
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
false : true;
drivers/gpu/drm/amd/amdgpu/nv.c +2 -19
@@ -38,8 +38,6 @@#include "gc/gc_10_1_0_offset.h" #include "gc/gc_10_1_0_sh_mask.h" -#include "hdp/hdp_5_0_0_offset.h" -#include "hdp/hdp_5_0_0_sh_mask.h" #include "smuio/smuio_11_0_0_offset.h" #include "mp/mp_11_0_offset.h"
@@ -50,6 +48,7 @@#include "mmhub_v2_0.h" #include "nbio_v2_3.h" #include "nbio_v7_2.h" +#include "hdp_v5_0.h" #include "nv.h" #include "navi10_ih.h" #include "gfx_v10_0.h"
@@ -514,6 +513,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) adev->nbio.funcs = &nbio_v2_3_funcs; adev->nbio.hdp_flush_reg = &nbio_v2_3_hdp_flush_reg; } + adev->hdp.funcs = &hdp_v5_0_funcs;if (adev->asic_type ==CHIP_SIENNA_CICHLID ) adev->gmc.xgmi.supported = true;
@@ -669,22 +669,6 @@ static uint32_t nv_get_rev_id(struct amdgpu_device *adev)return adev->nbio.funcs->get_rev_id (adev); } -static void nv_flush_hdp(struct amdgpu_device *adev, struct amdgpu_ring *ring) -{ - adev->nbio.funcs->hdp_flush (adev, ring); -} - -static void nv_invalidate_hdp (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) { -WREG32_SOC15_NO_KIQ (HDP ,0 , mmHDP_READ_CACHE_INVALIDATE,1 ); - }else { -amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET ( -HDP ,0 , mmHDP_READ_CACHE_INVALIDATE),1 ); - } -} -static bool nv_need_full_reset (struct amdgpu_device *adev) {return true;
@@ -788,8 +772,6 @@ static const struct amdgpu_asic_funcs nv_asic_funcs = .set_uvd_clocks = &nv_set_uvd_clocks, .set_vce_clocks = &nv_set_vce_clocks, .get_config_memsize = &nv_get_config_memsize, - .flush_hdp = &nv_flush_hdp, - .invalidate_hdp = &nv_invalidate_hdp, .init_doorbell_index = &nv_init_doorbell_index, .need_full_reset = &nv_need_full_reset, .need_reset_on_init = &nv_need_reset_on_init, @@ -1080,120 +1062,6 @@ static int nv_common_soft_reset(void *handle)
return 0;
}
-static void nv_update_hdp_mem_power_gating(struct amdgpu_device *adev,
- bool enable)
-{
- uint32_t hdp_clk_cntl, hdp_clk_cntl1;
- uint32_t hdp_mem_pwr_cntl;
-
- if (!(adev->cg_flags & (AMD_CG_SUPPORT_HDP_LS |
- AMD_CG_SUPPORT_HDP_DS |
- AMD_CG_SUPPORT_HDP_SD)))
- return;
-
- hdp_clk_cntl = hdp_clk_cntl1 = RREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL);
- hdp_mem_pwr_cntl = RREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL);
-
- /* Before doing clock/power mode switch,
- * forced on IPH & RC clock */
- hdp_clk_cntl = REG_SET_FIELD(hdp_clk_cntl, HDP_CLK_CNTL,
- IPH_MEM_CLK_SOFT_OVERRIDE, 1);
- hdp_clk_cntl = REG_SET_FIELD(hdp_clk_cntl, HDP_CLK_CNTL,
- RC_MEM_CLK_SOFT_OVERRIDE, 1);
- WREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL, hdp_clk_cntl);
-
- /* HDP 5.0 doesn't support dynamic power mode switch,
- * disable clock and power gating before any changing */
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_CTRL_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_LS_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_DS_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_SD_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_CTRL_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_LS_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_DS_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_SD_EN, 0);
- WREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl);
-
- /* only one clock gating mode (LS/DS/SD) can be enabled */
- if (adev->cg_flags & AMD_CG_SUPPORT_HDP_LS) {
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_LS_EN, enable);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_LS_EN, enable);
- } else if (adev->cg_flags & AMD_CG_SUPPORT_HDP_DS) {
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_DS_EN, enable);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_DS_EN, enable);
- } else if (adev->cg_flags & AMD_CG_SUPPORT_HDP_SD) {
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_SD_EN, enable);
- /* RC should not use shut down mode, fallback to ds */
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_DS_EN, enable);
- }
-
- /* confirmed that IPH_MEM_POWER_CTRL_EN and RC_MEM_POWER_CTRL_EN have to
- * be set for SRAM LS/DS/SD */
- if (adev->cg_flags & (AMD_CG_SUPPORT_HDP_LS | AMD_CG_SUPPORT_HDP_DS |
- AMD_CG_SUPPORT_HDP_SD)) {
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_CTRL_EN, 1);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_CTRL_EN, 1);
- }
-
- WREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl);
-
- /* restore IPH & RC clock override after clock/power mode changing */
- WREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL, hdp_clk_cntl1);
-}
-
-static void nv_update_hdp_clock_gating(struct amdgpu_device *adev,
- bool enable)
-{
- uint32_t hdp_clk_cntl;
-
- if (!(adev->cg_flags & AMD_CG_SUPPORT_HDP_MGCG))
- return;
-
- hdp_clk_cntl = RREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL);
-
- if (enable) {
- hdp_clk_cntl &=
- ~(uint32_t)
- (HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK);
- } else {
- hdp_clk_cntl |= HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK;
- }
-
- WREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL, hdp_clk_cntl);
-}
-
static int nv_common_set_clockgating_state(void *handle,
enum amd_clockgating_state state) { @@ -1213,9 +1081,7 @@ static int nv_common_set_clockgating_state(void *handle,
state == AMD_CG_STATE_GATE);
adev->nbio.funcs->update_medium_grain_light_sleep(adev,
state == AMD_CG_STATE_GATE);
- nv_update_hdp_mem_power_gating(adev,
- state == AMD_CG_STATE_GATE);
- nv_update_hdp_clock_gating(adev,
+ adev->hdp.funcs->update_clock_gating(adev,
state == AMD_CG_STATE_GATE);
break;
default:
@@ -1234,31 +1100,13 @@ static int nv_common_set_powergating_state(void *handle, static void nv_common_get_clockgating_state(void *handle, u32 *flags) {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
- uint32_t tmp;
if (amdgpu_sriov_vf(adev))
*flags = 0;
adev->nbio.funcs->get_clockgating_state(adev, flags);
- /* AMD_CG_SUPPORT_HDP_MGCG */
- tmp = RREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL);
- if (!(tmp & (HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK)))
- *flags |= AMD_CG_SUPPORT_HDP_MGCG;
-
- /* AMD_CG_SUPPORT_HDP_LS/DS/SD */
- tmp = RREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL);
- if (tmp & HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK)
- *flags |= AMD_CG_SUPPORT_HDP_LS;
- else if (tmp & HDP_MEM_POWER_CTRL__IPH_MEM_POWER_DS_EN_MASK)
- *flags |= AMD_CG_SUPPORT_HDP_DS;
- else if (tmp & HDP_MEM_POWER_CTRL__IPH_MEM_POWER_SD_EN_MASK)
- *flags |= AMD_CG_SUPPORT_HDP_SD;
+ adev->hdp.funcs->get_clock_gating_state(adev, flags);
return;
}
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +1 -1
@@ -690,7 +690,7 @@ static int psp_v11_0_memory_training(struct psp_context *psp, uint32_t ops) }memcpy_toio (adev->mman.aper_base_kaddr, buf, sz); - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL );vfree (buf); }
--
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cguchun.chen%40amd.com%7C95696db274534d8bf55108d8ab119da0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637447439447119281%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=se654MRT%2FieoLR9wKve2VuBLWM8u4Yc7PMh%2BoE1a8kQ%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 4/5] drm/amdgpu: switch hdp callback functions for hdp v5
[AMD Public Use]
hdp.funcs should be initialized for all the ASIC when do ip early init (on xx_set_ip_blocks).
Regards,
Likun
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Monday, December 28, 2020 6:10 PM
To: Gao, Likun <[email protected]>; [email protected]
Cc: Gao, Likun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 4/5] drm/amdgpu: switch hdp callback functions for hdp v5
[AMD Public Use]
One question for this patch:
+ adev->hdp.funcs->flush_hdp(adev, NULL);
Shall we add one NULL pointer guard of hdp.funcs->flush_hdp before using it? Or it's not needed at all as hdp.funcs will be initialized for all related ASIC series.
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Likun Gao
Sent: Monday, December 28, 2020 5:19 PM
To: [email protected]
Cc: Gao, Likun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 4/5] drm/amdgpu: switch hdp callback functions for hdp v5
From: Likun Gao <[email protected]>
Switch to use the HDP functions which unfied on hdp structure instead of the scattered hdp callback functions.
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 9 +- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 14 +-- drivers/gpu/drm/amd/amdgpu/nv.c | 160 +------------------------ drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +- 5 files changed, 13 insertions(+), 174 deletions(-)
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -71,7 +71,7 @@ amdgpu-y += \ vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o \ vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o navi10_reg_init.o navi14_reg_init.o \ arct_reg_init.o navi12_reg_init.o mxgpu_nv.o sienna_cichlid_reg_init.o vangogh_reg_init.o \ - nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o + nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o hdp_v5_0.o # add DF block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -2
@@ -38,7 +38,6 @@#include "smuio/smuio_11_0_0_offset.h" #include "smuio/smuio_11_0_0_sh_mask.h" #include "navi10_enum.h" -#include "hdp/hdp_5_0_0_offset.h" #include "ivsrcid/gfx/irqsrcs_gfx_10_1.h" #include "soc15.h"
@@ -5691,7 +5690,7 @@ static int gfx_v10_0_cp_gfx_load_pfp_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_PFP_IC_BASE_CNTL); tmp = REG_SET_FIELD(tmp, CP_PFP_IC_BASE_CNTL, VMID, 0); @@ -5769,7 +5768,7 @@ static int gfx_v10_0_cp_gfx_load_ce_microcode(struct amdgpu_device *adev)
}
if (amdgpu_emu_mode == 1)
- adev->nbio.funcs->hdp_flush(adev, NULL);
+ adev->hdp.funcs->flush_hdp(adev, NULL);
tmp = RREG32_SOC15(GC, 0, mmCP_CE_IC_BASE_CNTL);
tmp = REG_SET_FIELD(tmp, CP_CE_IC_BASE_CNTL, VMID, 0); @@ -5846,7 +5845,7 @@ static int gfx_v10_0_cp_gfx_load_me_microcode(struct amdgpu_device *adev) }
if (amdgpu_emu_mode == 1)
- adev->nbio.funcs->hdp_flush(adev, NULL);
+ adev->hdp.funcs->flush_hdp(adev, NULL);
tmp = RREG32_SOC15(GC, 0, mmCP_ME_IC_BASE_CNTL);
tmp = REG_SET_FIELD(tmp, CP_ME_IC_BASE_CNTL, VMID, 0); @@ -6215,7 +6214,7 @@ static int gfx_v10_0_cp_compute_load_microcode(struct amdgpu_device *adev) }
if (amdgpu_emu_mode == 1)
- adev->nbio.funcs->hdp_flush(adev, NULL);
+ adev->hdp.funcs->flush_hdp(adev, NULL);
tmp = RREG32_SOC15(GC, 0, mmCP_CPC_IC_BASE_CNTL);
tmp = REG_SET_FIELD(tmp, CP_CPC_IC_BASE_CNTL, CACHE_POLICY, 0); diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 5648c48be77f..3b7c6c31fce1 100644
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -3
@@ -27,8 +27,6 @@#include "gmc_v10_0.h" #include "umc_v8_7.h" -#include "hdp/hdp_5_0_0_offset.h" -#include "hdp/hdp_5_0_0_sh_mask.h" #include "athub/athub_2_0_0_sh_mask.h" #include "athub/athub_2_0_0_offset.h" #include "dcn/dcn_2_0_0_offset.h"
@@ -312,7 +310,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,int r;/* flush hdp cache */ - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL );/* For SRIOV run time, driver shouldn't access the register through MMIO * Directly use kiq to do the vm invalidation instead @@ -995,7 +993,6 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev) {
int r;
bool value;
- u32 tmp;
if (adev->gart.bo == NULL) {
dev_err(adev->dev, "No VRAM object for PCIE GART.\n"); @@ -1014,15 +1011,10 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev)
if (r)
return r;
- tmp = RREG32_SOC15(HDP, 0, mmHDP_MISC_CNTL);
- tmp |= HDP_MISC_CNTL__FLUSH_INVALIDATE_CACHE_MASK;
- WREG32_SOC15(HDP, 0, mmHDP_MISC_CNTL, tmp);
-
- tmp = RREG32_SOC15(HDP, 0, mmHDP_HOST_PATH_CNTL);
- WREG32_SOC15(HDP, 0, mmHDP_HOST_PATH_CNTL, tmp);
+ adev->hdp.funcs->init_registers(adev);
/* Flush HDP after it is initialized */
- adev->nbio.funcs->hdp_flush(adev, NULL);
+ adev->hdp.funcs->flush_hdp(adev, NULL);
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
false : true;
drivers/gpu/drm/amd/amdgpu/nv.c +2 -19
@@ -38,8 +38,6 @@#include "gc/gc_10_1_0_offset.h" #include "gc/gc_10_1_0_sh_mask.h" -#include "hdp/hdp_5_0_0_offset.h" -#include "hdp/hdp_5_0_0_sh_mask.h" #include "smuio/smuio_11_0_0_offset.h" #include "mp/mp_11_0_offset.h"
@@ -50,6 +48,7 @@#include "mmhub_v2_0.h" #include "nbio_v2_3.h" #include "nbio_v7_2.h" +#include "hdp_v5_0.h" #include "nv.h" #include "navi10_ih.h" #include "gfx_v10_0.h"
@@ -514,6 +513,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) adev->nbio.funcs = &nbio_v2_3_funcs; adev->nbio.hdp_flush_reg = &nbio_v2_3_hdp_flush_reg; } + adev->hdp.funcs = &hdp_v5_0_funcs;if (adev->asic_type ==CHIP_SIENNA_CICHLID ) adev->gmc.xgmi.supported = true;
@@ -669,22 +669,6 @@ static uint32_t nv_get_rev_id(struct amdgpu_device *adev)return adev->nbio.funcs->get_rev_id (adev); } -static void nv_flush_hdp(struct amdgpu_device *adev, struct amdgpu_ring *ring) -{ - adev->nbio.funcs->hdp_flush (adev, ring); -} - -static void nv_invalidate_hdp (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) { -WREG32_SOC15_NO_KIQ (HDP ,0 , mmHDP_READ_CACHE_INVALIDATE,1 ); - }else { -amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET ( -HDP ,0 , mmHDP_READ_CACHE_INVALIDATE),1 ); - } -} -static bool nv_need_full_reset (struct amdgpu_device *adev) {return true;
@@ -788,8 +772,6 @@ static const struct amdgpu_asic_funcs nv_asic_funcs = .set_uvd_clocks = &nv_set_uvd_clocks, .set_vce_clocks = &nv_set_vce_clocks, .get_config_memsize = &nv_get_config_memsize, - .flush_hdp = &nv_flush_hdp, - .invalidate_hdp = &nv_invalidate_hdp, .init_doorbell_index = &nv_init_doorbell_index, .need_full_reset = &nv_need_full_reset, .need_reset_on_init = &nv_need_reset_on_init, @@ -1080,120 +1062,6 @@ static int nv_common_soft_reset(void *handle)
return 0;
}
-static void nv_update_hdp_mem_power_gating(struct amdgpu_device *adev,
- bool enable)
-{
- uint32_t hdp_clk_cntl, hdp_clk_cntl1;
- uint32_t hdp_mem_pwr_cntl;
-
- if (!(adev->cg_flags & (AMD_CG_SUPPORT_HDP_LS |
- AMD_CG_SUPPORT_HDP_DS |
- AMD_CG_SUPPORT_HDP_SD)))
- return;
-
- hdp_clk_cntl = hdp_clk_cntl1 = RREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL);
- hdp_mem_pwr_cntl = RREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL);
-
- /* Before doing clock/power mode switch,
- * forced on IPH & RC clock */
- hdp_clk_cntl = REG_SET_FIELD(hdp_clk_cntl, HDP_CLK_CNTL,
- IPH_MEM_CLK_SOFT_OVERRIDE, 1);
- hdp_clk_cntl = REG_SET_FIELD(hdp_clk_cntl, HDP_CLK_CNTL,
- RC_MEM_CLK_SOFT_OVERRIDE, 1);
- WREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL, hdp_clk_cntl);
-
- /* HDP 5.0 doesn't support dynamic power mode switch,
- * disable clock and power gating before any changing */
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_CTRL_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_LS_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_DS_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_SD_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_CTRL_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_LS_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_DS_EN, 0);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_SD_EN, 0);
- WREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl);
-
- /* only one clock gating mode (LS/DS/SD) can be enabled */
- if (adev->cg_flags & AMD_CG_SUPPORT_HDP_LS) {
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_LS_EN, enable);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_LS_EN, enable);
- } else if (adev->cg_flags & AMD_CG_SUPPORT_HDP_DS) {
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_DS_EN, enable);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_DS_EN, enable);
- } else if (adev->cg_flags & AMD_CG_SUPPORT_HDP_SD) {
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_SD_EN, enable);
- /* RC should not use shut down mode, fallback to ds */
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl,
- HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_DS_EN, enable);
- }
-
- /* confirmed that IPH_MEM_POWER_CTRL_EN and RC_MEM_POWER_CTRL_EN have to
- * be set for SRAM LS/DS/SD */
- if (adev->cg_flags & (AMD_CG_SUPPORT_HDP_LS | AMD_CG_SUPPORT_HDP_DS |
- AMD_CG_SUPPORT_HDP_SD)) {
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- IPH_MEM_POWER_CTRL_EN, 1);
- hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL,
- RC_MEM_POWER_CTRL_EN, 1);
- }
-
- WREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl);
-
- /* restore IPH & RC clock override after clock/power mode changing */
- WREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL, hdp_clk_cntl1);
-}
-
-static void nv_update_hdp_clock_gating(struct amdgpu_device *adev,
- bool enable)
-{
- uint32_t hdp_clk_cntl;
-
- if (!(adev->cg_flags & AMD_CG_SUPPORT_HDP_MGCG))
- return;
-
- hdp_clk_cntl = RREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL);
-
- if (enable) {
- hdp_clk_cntl &=
- ~(uint32_t)
- (HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK);
- } else {
- hdp_clk_cntl |= HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK;
- }
-
- WREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL, hdp_clk_cntl);
-}
-
static int nv_common_set_clockgating_state(void *handle,
enum amd_clockgating_state state) { @@ -1213,9 +1081,7 @@ static int nv_common_set_clockgating_state(void *handle,
state == AMD_CG_STATE_GATE);
adev->nbio.funcs->update_medium_grain_light_sleep(adev,
state == AMD_CG_STATE_GATE);
- nv_update_hdp_mem_power_gating(adev,
- state == AMD_CG_STATE_GATE);
- nv_update_hdp_clock_gating(adev,
+ adev->hdp.funcs->update_clock_gating(adev,
state == AMD_CG_STATE_GATE);
break;
default:
@@ -1234,31 +1100,13 @@ static int nv_common_set_powergating_state(void *handle, static void nv_common_get_clockgating_state(void *handle, u32 *flags) {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
- uint32_t tmp;
if (amdgpu_sriov_vf(adev))
*flags = 0;
adev->nbio.funcs->get_clockgating_state(adev, flags);
- /* AMD_CG_SUPPORT_HDP_MGCG */
- tmp = RREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL);
- if (!(tmp & (HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK |
- HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK | - HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK)))
- *flags |= AMD_CG_SUPPORT_HDP_MGCG;
-
- /* AMD_CG_SUPPORT_HDP_LS/DS/SD */
- tmp = RREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL);
- if (tmp & HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK)
- *flags |= AMD_CG_SUPPORT_HDP_LS;
- else if (tmp & HDP_MEM_POWER_CTRL__IPH_MEM_POWER_DS_EN_MASK)
- *flags |= AMD_CG_SUPPORT_HDP_DS;
- else if (tmp & HDP_MEM_POWER_CTRL__IPH_MEM_POWER_SD_EN_MASK)
- *flags |= AMD_CG_SUPPORT_HDP_SD;
+ adev->hdp.funcs->get_clock_gating_state(adev, flags);
return;
}
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +1 -1
@@ -690,7 +690,7 @@ static int psp_v11_0_memory_training(struct psp_context *psp, uint32_t ops) }memcpy_toio (adev->mman.aper_base_kaddr, buf, sz); - adev->nbio.funcs->hdp_flush (adev,NULL ); + adev->hdp.funcs->flush_hdp (adev,NULL );vfree (buf); }
--
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cguchun.chen%40amd.com%7C95696db274534d8bf55108d8ab119da0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637447439447119281%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=se654MRT%2FieoLR9wKve2VuBLWM8u4Yc7PMh%2BoE1a8kQ%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/5 drm/amdgpu: remove redundant logic related HDP
In reply to Likun GaoFrom: Likun Gao <[email protected]>
Remove hdp_flush function from amdgpu_nbio struct as it have been unfied into hdp struct.
Remove the include about hdp register which was not used.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h | 1 - drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 1 - drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 10 ---------- drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c | 13 ------------- drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c | 10 ---------- drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c | 10 ---------- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 10 ---------- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 1 - drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 1 - drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 1 - drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 1 - 11 files changed, 59 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +0 -1
@@ -57,7 +57,6 @@ struct amdgpu_nbio_funcs {u32 (*get_pcie_port_data_offset)(struct amdgpu_device *adev);u32 (*get_rev_id)(struct amdgpu_device *adev);void (*mc_access_enable)(struct amdgpu_device *adev,bool enable); -void (*hdp_flush)(struct amdgpu_device *adev,struct amdgpu_ring *ring);u32 (*get_memsize)(struct amdgpu_device *adev);void (*sdma_doorbell_range)(struct amdgpu_device *adev,int instance,bool use_doorbell,int doorbell_index,int doorbell_size);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
@@ -38,7 +38,6 @@#include "gc/gc_9_0_sh_mask.h" #include "vega10_enum.h" -#include "hdp/hdp_4_0_offset.h" #include "soc15_common.h" #include "clearstate_gfx9.h"
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +0 -10
@@ -80,15 +80,6 @@ static void nbio_v2_3_mc_access_enable(struct amdgpu_device *adev, bool enable)WREG32_SOC15 (NBIO ,0 , mmBIF_FB_EN,0 ); } -static void nbio_v2_3_hdp_flush (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) -WREG32_NO_KIQ ((adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -else -amdgpu_ring_emit_wreg (ring, (adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -} -static u32 nbio_v2_3_get_memsize (struct amdgpu_device *adev) {return RREG32_SOC15 (NBIO ,0 , mmRCC_DEV0_EPF0_RCC_CONFIG_MEMSIZE);
@@ -366,7 +357,6 @@ const struct amdgpu_nbio_funcs nbio_v2_3_funcs = { .get_pcie_data_offset = nbio_v2_3_get_pcie_data_offset, .get_rev_id = nbio_v2_3_get_rev_id, .mc_access_enable = nbio_v2_3_mc_access_enable, - .hdp_flush = nbio_v2_3_hdp_flush, .get_memsize = nbio_v2_3_get_memsize, .sdma_doorbell_range = nbio_v2_3_sdma_doorbell_range, .vcn_doorbell_range = nbio_v2_3_vcn_doorbell_range,
drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c +0 -13
@@ -50,18 +50,6 @@ static void nbio_v6_1_mc_access_enable(struct amdgpu_device *adev, bool enable)WREG32_SOC15 (NBIO ,0 , mmBIF_FB_EN,0 ); } -static void nbio_v6_1_hdp_flush (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) -WREG32_SOC15_NO_KIQ (NBIO ,0 , - mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL, -0 ); -else -amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET ( -NBIO ,0 , mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL),0 ); -} -static u32 nbio_v6_1_get_memsize (struct amdgpu_device *adev) {return RREG32_SOC15 (NBIO ,0 , mmRCC_PF_0_0_RCC_CONFIG_MEMSIZE);
@@ -266,7 +254,6 @@ const struct amdgpu_nbio_funcs nbio_v6_1_funcs = { .get_pcie_data_offset = nbio_v6_1_get_pcie_data_offset, .get_rev_id = nbio_v6_1_get_rev_id, .mc_access_enable = nbio_v6_1_mc_access_enable, - .hdp_flush = nbio_v6_1_hdp_flush, .get_memsize = nbio_v6_1_get_memsize, .sdma_doorbell_range = nbio_v6_1_sdma_doorbell_range, .enable_doorbell_aperture = nbio_v6_1_enable_doorbell_aperture,
drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c +0 -10
@@ -60,15 +60,6 @@ static void nbio_v7_0_mc_access_enable(struct amdgpu_device *adev, bool enable)WREG32_SOC15 (NBIO ,0 , mmBIF_FB_EN,0 ); } -static void nbio_v7_0_hdp_flush (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) -WREG32_NO_KIQ ((adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -else -amdgpu_ring_emit_wreg (ring, (adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -} -static u32 nbio_v7_0_get_memsize (struct amdgpu_device *adev) {return RREG32_SOC15 (NBIO ,0 , mmRCC_CONFIG_MEMSIZE);
@@ -292,7 +283,6 @@ const struct amdgpu_nbio_funcs nbio_v7_0_funcs = { .get_pcie_data_offset = nbio_v7_0_get_pcie_data_offset, .get_rev_id = nbio_v7_0_get_rev_id, .mc_access_enable = nbio_v7_0_mc_access_enable, - .hdp_flush = nbio_v7_0_hdp_flush, .get_memsize = nbio_v7_0_get_memsize, .sdma_doorbell_range = nbio_v7_0_sdma_doorbell_range, .vcn_doorbell_range = nbio_v7_0_vcn_doorbell_range,
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -10
@@ -56,15 +56,6 @@ static void nbio_v7_2_mc_access_enable(struct amdgpu_device *adev, bool enable)WREG32_SOC15 (NBIO ,0 , regBIF_BX0_BIF_FB_EN,0 ); } -static void nbio_v7_2_hdp_flush (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) -WREG32_NO_KIQ ((adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -else -amdgpu_ring_emit_wreg (ring, (adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -} -static u32 nbio_v7_2_get_memsize (struct amdgpu_device *adev) {return RREG32_SOC15 (NBIO ,0 , regRCC_DEV0_EPF0_0_RCC_CONFIG_MEMSIZE);
@@ -325,7 +316,6 @@ const struct amdgpu_nbio_funcs nbio_v7_2_funcs = { .get_pcie_port_data_offset = nbio_v7_2_get_pcie_port_data_offset, .get_rev_id = nbio_v7_2_get_rev_id, .mc_access_enable = nbio_v7_2_mc_access_enable, - .hdp_flush = nbio_v7_2_hdp_flush, .get_memsize = nbio_v7_2_get_memsize, .sdma_doorbell_range = nbio_v7_2_sdma_doorbell_range, .vcn_doorbell_range = nbio_v7_2_vcn_doorbell_range,
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +0 -10
@@ -82,15 +82,6 @@ static void nbio_v7_4_mc_access_enable(struct amdgpu_device *adev, bool enable)WREG32_SOC15 (NBIO ,0 , mmBIF_FB_EN,0 ); } -static void nbio_v7_4_hdp_flush (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) -WREG32_NO_KIQ ((adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -else -amdgpu_ring_emit_wreg (ring, (adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -} -static u32 nbio_v7_4_get_memsize (struct amdgpu_device *adev) {return RREG32_SOC15 (NBIO ,0 , mmRCC_CONFIG_MEMSIZE);
@@ -541,7 +532,6 @@ const struct amdgpu_nbio_funcs nbio_v7_4_funcs = { .get_pcie_data_offset = nbio_v7_4_get_pcie_data_offset, .get_rev_id = nbio_v7_4_get_rev_id, .mc_access_enable = nbio_v7_4_mc_access_enable, - .hdp_flush = nbio_v7_4_hdp_flush, .get_memsize = nbio_v7_4_get_memsize, .sdma_doorbell_range = nbio_v7_4_sdma_doorbell_range, .vcn_doorbell_range = nbio_v7_4_vcn_doorbell_range,
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +0 -1
@@ -46,7 +46,6 @@#include "sdma6/sdma6_4_2_2_sh_mask.h" #include "sdma7/sdma7_4_2_2_offset.h" #include "sdma7/sdma7_4_2_2_sh_mask.h" -#include "hdp/hdp_4_0_offset.h" #include "sdma0/sdma0_4_1_default.h" #include "soc15_common.h"
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0 -1
@@ -32,7 +32,6 @@#include "gc/gc_10_1_0_offset.h" #include "gc/gc_10_1_0_sh_mask.h" -#include "hdp/hdp_5_0_0_offset.h" #include "ivsrcid/sdma0/irqsrcs_sdma0_5_0.h" #include "ivsrcid/sdma1/irqsrcs_sdma1_5_0.h"
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +0 -1
@@ -36,7 +36,6 @@#include "vce/vce_4_0_default.h" #include "vce/vce_4_0_sh_mask.h" #include "nbif/nbif_6_1_offset.h" -#include "hdp/hdp_4_0_offset.h" #include "mmhub/mmhub_1_0_offset.h" #include "mmhub/mmhub_1_0_sh_mask.h" #include "ivsrcid/uvd/irqsrcs_uvd_7_0.h"
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +0 -1
@@ -32,7 +32,6 @@#include "vcn/vcn_1_0_offset.h" #include "vcn/vcn_1_0_sh_mask.h" -#include "hdp/hdp_4_0_offset.h" #include "mmhub/mmhub_9_1_offset.h" #include "mmhub/mmhub_9_1_sh_mask.h"
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 5/5] drm/amdgpu: remove redundant logic related HDP
Looks like a nice cleanup to me.
Just one question: We have a flush_hdp and invalidate_hdp callback in the asic structure as well.
Would it make sense to replace those as well in the long term?
Thanks,
Christian.
Am 28.12.20 um 10:18 schrieb Likun Gao:
Quoted 230 lines
From: Likun Gao <[email protected]>
Remove
hdp_flushfunction fromamdgpu_nbiostruct as it have been unfied into hdp struct.
Remove the include about hdp register which was not used.Signed-off-by Likun Gao <[email protected]>Change-Id I7b1ce7424a97efe82ccb6ce63505e724530715ac--- drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h | 1 - drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 1 - drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 10 ---------- drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c | 13 ------------- drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c | 10 ---------- drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c | 10 ---------- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 10 ---------- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 1 - drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 1 - drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 1 - drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 1 - 11 files changed, 59 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +0
-1@@ -57,7 +57,6 @@ struct amdgpu_nbio_funcs {u32 (*get_pcie_port_data_offset)(struct amdgpu_device *adev);u32 (*get_rev_id)(struct amdgpu_device *adev);void (*mc_access_enable)(struct amdgpu_device *adev,bool enable); -void (*hdp_flush)(struct amdgpu_device *adev,struct amdgpu_ring *ring);u32 (*get_memsize)(struct amdgpu_device *adev);void (*sdma_doorbell_range)(struct amdgpu_device *adev,int instance,bool use_doorbell,int doorbell_index,int doorbell_size);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-1@@ -38,7 +38,6 @@#include "gc/gc_9_0_sh_mask.h" #include "vega10_enum.h" -#include "hdp/hdp_4_0_offset.h" #include "soc15_common.h" #include "clearstate_gfx9.h" drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +0
-10@@ -80,15 +80,6 @@ static void nbio_v2_3_mc_access_enable(struct amdgpu_device *adev, bool enable)WREG32_SOC15 (NBIO ,0 , mmBIF_FB_EN,0 ); } -static void nbio_v2_3_hdp_flush (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) -WREG32_NO_KIQ ((adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -else -amdgpu_ring_emit_wreg (ring, (adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -} -static u32 nbio_v2_3_get_memsize (struct amdgpu_device *adev) {return RREG32_SOC15 (NBIO ,0 , mmRCC_DEV0_EPF0_RCC_CONFIG_MEMSIZE);@@ -366,7 +357,6 @@ const struct amdgpu_nbio_funcs nbio_v2_3_funcs = { .get_pcie_data_offset = nbio_v2_3_get_pcie_data_offset, .get_rev_id = nbio_v2_3_get_rev_id, .mc_access_enable = nbio_v2_3_mc_access_enable, - .hdp_flush = nbio_v2_3_hdp_flush, .get_memsize = nbio_v2_3_get_memsize, .sdma_doorbell_range = nbio_v2_3_sdma_doorbell_range, .vcn_doorbell_range = nbio_v2_3_vcn_doorbell_range,drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c +0
-13@@ -50,18 +50,6 @@ static void nbio_v6_1_mc_access_enable(struct amdgpu_device *adev, bool enable)WREG32_SOC15 (NBIO ,0 , mmBIF_FB_EN,0 ); } -static void nbio_v6_1_hdp_flush (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) -WREG32_SOC15_NO_KIQ (NBIO ,0 , - mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL, -0 ); -else -amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET ( -NBIO ,0 , mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL),0 ); -} -static u32 nbio_v6_1_get_memsize (struct amdgpu_device *adev) {return RREG32_SOC15 (NBIO ,0 , mmRCC_PF_0_0_RCC_CONFIG_MEMSIZE);@@ -266,7 +254,6 @@ const struct amdgpu_nbio_funcs nbio_v6_1_funcs = { .get_pcie_data_offset = nbio_v6_1_get_pcie_data_offset, .get_rev_id = nbio_v6_1_get_rev_id, .mc_access_enable = nbio_v6_1_mc_access_enable, - .hdp_flush = nbio_v6_1_hdp_flush, .get_memsize = nbio_v6_1_get_memsize, .sdma_doorbell_range = nbio_v6_1_sdma_doorbell_range, .enable_doorbell_aperture = nbio_v6_1_enable_doorbell_aperture,drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c +0
-10@@ -60,15 +60,6 @@ static void nbio_v7_0_mc_access_enable(struct amdgpu_device *adev, bool enable)WREG32_SOC15 (NBIO ,0 , mmBIF_FB_EN,0 ); } -static void nbio_v7_0_hdp_flush (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) -WREG32_NO_KIQ ((adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -else -amdgpu_ring_emit_wreg (ring, (adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -} -static u32 nbio_v7_0_get_memsize (struct amdgpu_device *adev) {return RREG32_SOC15 (NBIO ,0 , mmRCC_CONFIG_MEMSIZE);@@ -292,7 +283,6 @@ const struct amdgpu_nbio_funcs nbio_v7_0_funcs = { .get_pcie_data_offset = nbio_v7_0_get_pcie_data_offset, .get_rev_id = nbio_v7_0_get_rev_id, .mc_access_enable = nbio_v7_0_mc_access_enable, - .hdp_flush = nbio_v7_0_hdp_flush, .get_memsize = nbio_v7_0_get_memsize, .sdma_doorbell_range = nbio_v7_0_sdma_doorbell_range, .vcn_doorbell_range = nbio_v7_0_vcn_doorbell_range,drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0
-10@@ -56,15 +56,6 @@ static void nbio_v7_2_mc_access_enable(struct amdgpu_device *adev, bool enable)WREG32_SOC15 (NBIO ,0 , regBIF_BX0_BIF_FB_EN,0 ); } -static void nbio_v7_2_hdp_flush (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) -WREG32_NO_KIQ ((adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -else -amdgpu_ring_emit_wreg (ring, (adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -} -static u32 nbio_v7_2_get_memsize (struct amdgpu_device *adev) {return RREG32_SOC15 (NBIO ,0 , regRCC_DEV0_EPF0_0_RCC_CONFIG_MEMSIZE);@@ -325,7 +316,6 @@ const struct amdgpu_nbio_funcs nbio_v7_2_funcs = { .get_pcie_port_data_offset = nbio_v7_2_get_pcie_port_data_offset, .get_rev_id = nbio_v7_2_get_rev_id, .mc_access_enable = nbio_v7_2_mc_access_enable, - .hdp_flush = nbio_v7_2_hdp_flush, .get_memsize = nbio_v7_2_get_memsize, .sdma_doorbell_range = nbio_v7_2_sdma_doorbell_range, .vcn_doorbell_range = nbio_v7_2_vcn_doorbell_range,drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +0
-10@@ -82,15 +82,6 @@ static void nbio_v7_4_mc_access_enable(struct amdgpu_device *adev, bool enable)WREG32_SOC15 (NBIO ,0 , mmBIF_FB_EN,0 ); } -static void nbio_v7_4_hdp_flush (struct amdgpu_device *adev, -struct amdgpu_ring *ring) -{ -if (!ring || !ring->funcs->emit_wreg) -WREG32_NO_KIQ ((adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -else -amdgpu_ring_emit_wreg (ring, (adev->rmmio_remap.reg_offset +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ,0 ); -} -static u32 nbio_v7_4_get_memsize (struct amdgpu_device *adev) {return RREG32_SOC15 (NBIO ,0 , mmRCC_CONFIG_MEMSIZE);@@ -541,7 +532,6 @@ const struct amdgpu_nbio_funcs nbio_v7_4_funcs = { .get_pcie_data_offset = nbio_v7_4_get_pcie_data_offset, .get_rev_id = nbio_v7_4_get_rev_id, .mc_access_enable = nbio_v7_4_mc_access_enable, - .hdp_flush = nbio_v7_4_hdp_flush, .get_memsize = nbio_v7_4_get_memsize, .sdma_doorbell_range = nbio_v7_4_sdma_doorbell_range, .vcn_doorbell_range = nbio_v7_4_vcn_doorbell_range,drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +0
-1@@ -46,7 +46,6 @@#include "sdma6/sdma6_4_2_2_sh_mask.h" #include "sdma7/sdma7_4_2_2_offset.h" #include "sdma7/sdma7_4_2_2_sh_mask.h" -#include "hdp/hdp_4_0_offset.h" #include "sdma0/sdma0_4_1_default.h" #include "soc15_common.h" drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0
-1@@ -32,7 +32,6 @@#include "gc/gc_10_1_0_offset.h" #include "gc/gc_10_1_0_sh_mask.h" -#include "hdp/hdp_5_0_0_offset.h" #include "ivsrcid/sdma0/irqsrcs_sdma0_5_0.h" #include "ivsrcid/sdma1/irqsrcs_sdma1_5_0.h" drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +0
-1@@ -36,7 +36,6 @@#include "vce/vce_4_0_default.h" #include "vce/vce_4_0_sh_mask.h" #include "nbif/nbif_6_1_offset.h" -#include "hdp/hdp_4_0_offset.h" #include "mmhub/mmhub_1_0_offset.h" #include "mmhub/mmhub_1_0_sh_mask.h" #include "ivsrcid/uvd/irqsrcs_uvd_7_0.h" drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +0
-0
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c line 37
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +0
-1@@ -32,7 +32,6 @@#include "vcn/vcn_1_0_offset.h" #include "vcn/vcn_1_0_sh_mask.h" -#include "hdp/hdp_4_0_offset.h" #include "mmhub/mmhub_9_1_offset.h" #include "mmhub/mmhub_9_1_sh_mask.h"
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
Unfiy hdp related function into hdp structure for hdp version 4.
One spelling typo by Unfiy?
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Likun Gao
Sent: Monday, December 28, 2020 5:19 PM
To: [email protected]
Cc: Gao, Likun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 1/5] drm/amdgpu: add hdp version 4 functions
From: Likun Gao <[email protected]>
Unfiy hdp related function into hdp structure for hdp version 4.
--- drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c | 150 ++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h | 31 ++++++ 2 files changed, 181 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c new file +150 -0
@@ -0,0 +1,150 @@ +/* +* 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. +* +*/ +#include "amdgpu.h" +#include "amdgpu_atombios.h" +#include "hdp_v4_0.h" +#include "amdgpu_ras.h" + +#include "hdp/hdp_4_0_offset.h" +#include "hdp/hdp_4_0_sh_mask.h" +#include <uapi/linux/kfd_ioctl.h> + +#define mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL 0x00f7 +#define mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL_BASE_IDX 2 +/* for Vega20 register name change */ +#define mmHDP_MEM_POWER_CTRL 0x00d4 +#define HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK 0x00000001L +#define HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK 0x00000002L +#define HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK 0x00010000L +#define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK 0x00020000L +#define mmHDP_MEM_POWER_CTRL_BASE_IDX 0 + +static void hdp_v4_0_flush_hdp (struct amdgpu_device *adev, +struct amdgpu_ring *ring) +{ +uint32_t reg_addr; + +if (adev->flags &AMD_IS_APU || + adev->asic_type ==CHIP_VEGA20 || + adev->asic_type ==CHIP_ARCTURUS ) + reg_addr = (adev->rmmio_remap.reg_offset + +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ; +else + reg_addr =SOC15_REG_OFFSET (NBIO ,0 , + mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL); + +if (!ring || !ring->funcs->emit_wreg) +WREG32_NO_KIQ (reg_addr,0 ); +else +amdgpu_ring_emit_wreg (ring, reg_addr,0 ); } + +static void hdp_v4_0_invalidate_hdp (struct amdgpu_device *adev, +struct amdgpu_ring *ring) +{ +if (!ring || !ring->funcs->emit_wreg) +WREG32_SOC15_NO_KIQ (HDP ,0 , mmHDP_READ_CACHE_INVALIDATE,1 ); +else +amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET ( +HDP ,0 , mmHDP_READ_CACHE_INVALIDATE),1 ); } + +static void hdp_v4_0_reset_ras_error_count (struct amdgpu_device *adev) +{ +if (!amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__HDP )) +return ; +/*read back hdp ras counter to reset it to 0 */ +RREG32_SOC15 (HDP ,0 , mmHDP_EDC_CNT); +} + +static void hdp_v4_0_update_clock_gating (struct amdgpu_device *adev, +bool enable) +{ +uint32_t def, data; + +if (adev->asic_type ==CHIP_VEGA20 || + adev->asic_type ==CHIP_ARCTURUS || + adev->asic_type ==CHIP_RENOIR ) { + def = data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_CTRL)); + +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) + data |=HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK ; +else + data &= ~(HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK ); + +if (def != data) +WREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_CTRL), data); + }else { + def = data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS)); + +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) + data |=HDP_MEM_POWER_LS__LS_ENABLE_MASK ; +else + data &= ~HDP_MEM_POWER_LS__LS_ENABLE_MASK ; + +if (def != data) +WREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS), data); + } +} + +static void hdp_v4_0_get_clockgating_state (struct amdgpu_device *adev, +u32 *flags) +{ +int data; + +/* AMD_CG_SUPPORT_HDP_LS */ + data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS)); +if (data &HDP_MEM_POWER_LS__LS_ENABLE_MASK ) + *flags |=AMD_CG_SUPPORT_HDP_LS ; +} + +static void hdp_v4_0_init_registers (struct amdgpu_device *adev) { +switch (adev->asic_type) { +case CHIP_ARCTURUS : +WREG32_FIELD15 (HDP ,0 ,HDP_MMHUB_CNTL ,HDP_MMHUB_GCC ,1 ); +break ; +default : +break ; + } + +WREG32_FIELD15 (HDP ,0 ,HDP_MISC_CNTL ,FLUSH_INVALIDATE_CACHE ,1 ); + +WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE, (adev->gmc.vram_start >>8 )); +WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE_HI, (adev->gmc.vram_start +>>40 )); }
+
+const struct amdgpu_hdp_funcs hdp_v4_0_funcs = {
+ .flush_hdp = hdp_v4_0_flush_hdp,
+ .invalidate_hdp = hdp_v4_0_invalidate_hdp,
+ .reset_ras_error_count = hdp_v4_0_reset_ras_error_count,
+ .update_clock_gating = hdp_v4_0_update_clock_gating,
+ .get_clock_gating_state = hdp_v4_0_get_clockgating_state,
+ .init_registers = hdp_v4_0_init_registers, };
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* 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 __HDP_V4_0_H__
+#define __HDP_V4_0_H__
+
+#include "soc15_common.h"
+
+extern const struct amdgpu_hdp_funcs hdp_v4_0_funcs; +
+#endif
--
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cguchun.chen%40amd.com%7C3eee4fa9521c40ab6d4c08d8ab119c3d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637447439430266697%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xawd6BS2tseGkN3pyY0cyS9PAjy3JQW%2FLHo4SgEyCOE%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
Oh, sorry, should be spelling as Unify and unified.
Regards,
Likun
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Monday, December 28, 2020 6:01 PM
To: Gao, Likun <[email protected]>; [email protected]
Cc: Gao, Likun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 1/5] drm/amdgpu: add hdp version 4 functions
[AMD Public Use]
Unfiy hdp related function into hdp structure for hdp version 4.
One spelling typo by Unfiy?
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Likun Gao
Sent: Monday, December 28, 2020 5:19 PM
To: [email protected]
Cc: Gao, Likun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 1/5] drm/amdgpu: add hdp version 4 functions
From: Likun Gao <[email protected]>
Unfiy hdp related function into hdp structure for hdp version 4.
--- drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c | 150 ++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h | 31 ++++++ 2 files changed, 181 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c new file +150 -0
@@ -0,0 +1,150 @@ +/* +* 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. +* +*/ +#include "amdgpu.h" +#include "amdgpu_atombios.h" +#include "hdp_v4_0.h" +#include "amdgpu_ras.h" + +#include "hdp/hdp_4_0_offset.h" +#include "hdp/hdp_4_0_sh_mask.h" +#include <uapi/linux/kfd_ioctl.h> + +#define mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL 0x00f7 +#define mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL_BASE_IDX 2 +/* for Vega20 register name change */ +#define mmHDP_MEM_POWER_CTRL 0x00d4 +#define HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK 0x00000001L +#define HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK 0x00000002L +#define HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK 0x00010000L +#define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK 0x00020000L +#define mmHDP_MEM_POWER_CTRL_BASE_IDX 0 + +static void hdp_v4_0_flush_hdp (struct amdgpu_device *adev, +struct amdgpu_ring *ring) +{ +uint32_t reg_addr; + +if (adev->flags &AMD_IS_APU || + adev->asic_type ==CHIP_VEGA20 || + adev->asic_type ==CHIP_ARCTURUS ) + reg_addr = (adev->rmmio_remap.reg_offset + +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ; +else + reg_addr =SOC15_REG_OFFSET (NBIO ,0 , + mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL); + +if (!ring || !ring->funcs->emit_wreg) +WREG32_NO_KIQ (reg_addr,0 ); +else +amdgpu_ring_emit_wreg (ring, reg_addr,0 ); } + +static void hdp_v4_0_invalidate_hdp (struct amdgpu_device *adev, +struct amdgpu_ring *ring) +{ +if (!ring || !ring->funcs->emit_wreg) +WREG32_SOC15_NO_KIQ (HDP ,0 , mmHDP_READ_CACHE_INVALIDATE,1 ); +else +amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET ( +HDP ,0 , mmHDP_READ_CACHE_INVALIDATE),1 ); } + +static void hdp_v4_0_reset_ras_error_count (struct amdgpu_device *adev) +{ +if (!amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__HDP )) +return ; +/*read back hdp ras counter to reset it to 0 */ +RREG32_SOC15 (HDP ,0 , mmHDP_EDC_CNT); +} + +static void hdp_v4_0_update_clock_gating (struct amdgpu_device *adev, +bool enable) +{ +uint32_t def, data; + +if (adev->asic_type ==CHIP_VEGA20 || + adev->asic_type ==CHIP_ARCTURUS || + adev->asic_type ==CHIP_RENOIR ) { + def = data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_CTRL)); + +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) + data |=HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK ; +else + data &= ~(HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK ); + +if (def != data) +WREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_CTRL), data); + }else { + def = data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS)); + +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) + data |=HDP_MEM_POWER_LS__LS_ENABLE_MASK ; +else + data &= ~HDP_MEM_POWER_LS__LS_ENABLE_MASK ; + +if (def != data) +WREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS), data); + } +} + +static void hdp_v4_0_get_clockgating_state (struct amdgpu_device *adev, +u32 *flags) +{ +int data; + +/* AMD_CG_SUPPORT_HDP_LS */ + data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS)); +if (data &HDP_MEM_POWER_LS__LS_ENABLE_MASK ) + *flags |=AMD_CG_SUPPORT_HDP_LS ; +} + +static void hdp_v4_0_init_registers (struct amdgpu_device *adev) { +switch (adev->asic_type) { +case CHIP_ARCTURUS : +WREG32_FIELD15 (HDP ,0 ,HDP_MMHUB_CNTL ,HDP_MMHUB_GCC ,1 ); +break ; +default : +break ; + } + +WREG32_FIELD15 (HDP ,0 ,HDP_MISC_CNTL ,FLUSH_INVALIDATE_CACHE ,1 ); + +WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE, (adev->gmc.vram_start >>8 )); +WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE_HI, (adev->gmc.vram_start +>>40 )); }
+
+const struct amdgpu_hdp_funcs hdp_v4_0_funcs = {
+ .flush_hdp = hdp_v4_0_flush_hdp,
+ .invalidate_hdp = hdp_v4_0_invalidate_hdp,
+ .reset_ras_error_count = hdp_v4_0_reset_ras_error_count,
+ .update_clock_gating = hdp_v4_0_update_clock_gating,
+ .get_clock_gating_state = hdp_v4_0_get_clockgating_state,
+ .init_registers = hdp_v4_0_init_registers, };
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* 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 __HDP_V4_0_H__
+#define __HDP_V4_0_H__
+
+#include "soc15_common.h"
+
+extern const struct amdgpu_hdp_funcs hdp_v4_0_funcs; +
+#endif
--
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cguchun.chen%40amd.com%7C3eee4fa9521c40ab6d4c08d8ab119c3d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637447439430266697%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xawd6BS2tseGkN3pyY0cyS9PAjy3JQW%2FLHo4SgEyCOE%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Chen, Guchun
Reviewed-by[AMD Public Use]
With the spelling typos fixed, the series is:
Regards,
Guchun
-----Original Message-----
From: Gao, Likun <[email protected]>
Sent: Monday, December 28, 2020 6:06 PM
To: Chen, Guchun <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 1/5] drm/amdgpu: add hdp version 4 functions
[AMD Public Use]
Oh, sorry, should be spelling as Unify and unified.
Regards,
Likun
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Monday, December 28, 2020 6:01 PM
To: Gao, Likun <[email protected]>; [email protected]
Cc: Gao, Likun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 1/5] drm/amdgpu: add hdp version 4 functions
[AMD Public Use]
Unfiy hdp related function into hdp structure for hdp version 4.
One spelling typo by Unfiy?
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Likun Gao
Sent: Monday, December 28, 2020 5:19 PM
To: [email protected]
Cc: Gao, Likun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 1/5] drm/amdgpu: add hdp version 4 functions
From: Likun Gao <[email protected]>
Unfiy hdp related function into hdp structure for hdp version 4.
--- drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c | 150 ++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h | 31 ++++++ 2 files changed, 181 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c new file +150 -0
@@ -0,0 +1,150 @@ +/* +* 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. +* +*/ +#include "amdgpu.h" +#include "amdgpu_atombios.h" +#include "hdp_v4_0.h" +#include "amdgpu_ras.h" + +#include "hdp/hdp_4_0_offset.h" +#include "hdp/hdp_4_0_sh_mask.h" +#include <uapi/linux/kfd_ioctl.h> + +#define mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL 0x00f7 +#define mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL_BASE_IDX 2 +/* for Vega20 register name change */ +#define mmHDP_MEM_POWER_CTRL 0x00d4 +#define HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK 0x00000001L +#define HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK 0x00000002L +#define HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK 0x00010000L +#define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK 0x00020000L +#define mmHDP_MEM_POWER_CTRL_BASE_IDX 0 + +static void hdp_v4_0_flush_hdp (struct amdgpu_device *adev, +struct amdgpu_ring *ring) +{ +uint32_t reg_addr; + +if (adev->flags &AMD_IS_APU || + adev->asic_type ==CHIP_VEGA20 || + adev->asic_type ==CHIP_ARCTURUS ) + reg_addr = (adev->rmmio_remap.reg_offset + +KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL ) >>2 ; +else + reg_addr =SOC15_REG_OFFSET (NBIO ,0 , + mmBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL); + +if (!ring || !ring->funcs->emit_wreg) +WREG32_NO_KIQ (reg_addr,0 ); +else +amdgpu_ring_emit_wreg (ring, reg_addr,0 ); } + +static void hdp_v4_0_invalidate_hdp (struct amdgpu_device *adev, +struct amdgpu_ring *ring) +{ +if (!ring || !ring->funcs->emit_wreg) +WREG32_SOC15_NO_KIQ (HDP ,0 , mmHDP_READ_CACHE_INVALIDATE,1 ); +else +amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET ( +HDP ,0 , mmHDP_READ_CACHE_INVALIDATE),1 ); } + +static void hdp_v4_0_reset_ras_error_count (struct amdgpu_device *adev) +{ +if (!amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__HDP )) +return ; +/*read back hdp ras counter to reset it to 0 */ +RREG32_SOC15 (HDP ,0 , mmHDP_EDC_CNT); +} + +static void hdp_v4_0_update_clock_gating (struct amdgpu_device *adev, +bool enable) +{ +uint32_t def, data; + +if (adev->asic_type ==CHIP_VEGA20 || + adev->asic_type ==CHIP_ARCTURUS || + adev->asic_type ==CHIP_RENOIR ) { + def = data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_CTRL)); + +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) + data |=HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK ; +else + data &= ~(HDP_MEM_POWER_CTRL__IPH_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK | +HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK ); + +if (def != data) +WREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_CTRL), data); + }else { + def = data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS)); + +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) + data |=HDP_MEM_POWER_LS__LS_ENABLE_MASK ; +else + data &= ~HDP_MEM_POWER_LS__LS_ENABLE_MASK ; + +if (def != data) +WREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS), data); + } +} + +static void hdp_v4_0_get_clockgating_state (struct amdgpu_device *adev, +u32 *flags) +{ +int data; + +/* AMD_CG_SUPPORT_HDP_LS */ + data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS)); +if (data &HDP_MEM_POWER_LS__LS_ENABLE_MASK ) + *flags |=AMD_CG_SUPPORT_HDP_LS ; +} + +static void hdp_v4_0_init_registers (struct amdgpu_device *adev) { +switch (adev->asic_type) { +case CHIP_ARCTURUS : +WREG32_FIELD15 (HDP ,0 ,HDP_MMHUB_CNTL ,HDP_MMHUB_GCC ,1 ); +break ; +default : +break ; + } + +WREG32_FIELD15 (HDP ,0 ,HDP_MISC_CNTL ,FLUSH_INVALIDATE_CACHE ,1 ); + +WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE, (adev->gmc.vram_start >>8 )); +WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE_HI, (adev->gmc.vram_start +>>40 )); }
+
+const struct amdgpu_hdp_funcs hdp_v4_0_funcs = {
+ .flush_hdp = hdp_v4_0_flush_hdp,
+ .invalidate_hdp = hdp_v4_0_invalidate_hdp,
+ .reset_ras_error_count = hdp_v4_0_reset_ras_error_count,
+ .update_clock_gating = hdp_v4_0_update_clock_gating,
+ .get_clock_gating_state = hdp_v4_0_get_clockgating_state,
+ .init_registers = hdp_v4_0_init_registers, };
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* 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 __HDP_V4_0_H__
+#define __HDP_V4_0_H__
+
+#include "soc15_common.h"
+
+extern const struct amdgpu_hdp_funcs hdp_v4_0_funcs; +
+#endif
--
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cguchun.chen%40amd.com%7C3eee4fa9521c40ab6d4c08d8ab119c3d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637447439430266697%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xawd6BS2tseGkN3pyY0cyS9PAjy3JQW%2FLHo4SgEyCOE%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx