drm/amdgpu: add sdma debug parameter
Subsystems (3)
Alex Deucher
maintainerPATCH 1/3 drm/amdgpu: add sdma debug parameter
From: Likun Gao <[email protected]>
Add parameter to switch sdma RB CMD for sdma v7.1.
Signed-off-by Likun Gao <[email protected]>
Reviewed-by Hawking Zhang <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 1 + drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6 -0
@@ -148,6 +148,7 @@ enum AMDGPU_DEBUG_MASK {AMDGPU_DEBUG_ENABLE_CE_CS =BIT (10 ),AMDGPU_DEBUG_HIBERNATION_THAW_RESUME_GPU =BIT (11 ),AMDGPU_DEBUG_DISABLE_IP_BLOCK_SOFT_RESET =BIT (12 ), + AMDGPU_DEBUG_SDMA_RB_CMD = BIT(13), };unsigned int amdgpu_vram_limit =UINT_MAX ;
@@ -2301,6 +2302,11 @@ static void amdgpu_init_debug_options(struct amdgpu_device *adev)pr_info ("debug: IP block soft reset disabled\n" ); adev->debug_disable_ip_block_soft_reset = true; } + +if (amdgpu_debug_mask &AMDGPU_DEBUG_SDMA_RB_CMD ) { +pr_info ("debug: enable SDMA RB command switch\n" ); + adev->sdma.sdma_debug = true; + } }static unsigned long amdgpu_fix_asic_type (struct pci_dev *pdev,unsigned long flags)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +1 -0
@@ -103,6 +103,7 @@ struct amdgpu_sdma {int num_instances;uint32_t sdma_mask; +bool sdma_debug;union {int num_inst_per_aid;int num_inst_per_xcc;
drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c +18 -0
@@ -1365,6 +1365,22 @@ static int sdma_v7_1_sw_fini(struct amdgpu_ip_block *ip_block)return 0 ; } +#define regSDMA0_SDMA_FE_CNTL0 0x10 +#define regSDMA0_SDMA_FE_CNTL0_BASE_IDX 0 +static void sdma_v7_1_rb_cmd_switch (struct amdgpu_device *adev, +uint32_t inst_mask) +{ +int i, fe_cntl; + +if (adev->sdma.sdma_debug) { +for_each_inst (i, inst_mask) { + fe_cntl =RREG32_SOC15_IP (GC ,sdma_v7_1_get_reg_offset (adev, i, regSDMA0_SDMA_FE_CNTL0)); + fe_cntl &=0x7fffffff ; +WREG32_SOC15_IP (GC ,sdma_v7_1_get_reg_offset (adev, i, regSDMA0_SDMA_FE_CNTL0), fe_cntl); + } + } +} +static int sdma_v7_1_hw_init (struct amdgpu_ip_block *ip_block) {struct amdgpu_device *adev = ip_block->adev;
@@ -1373,6 +1389,8 @@ static int sdma_v7_1_hw_init(struct amdgpu_ip_block *ip_block) inst_mask =GENMASK (adev->sdma.num_instances -1 ,0 ); +sdma_v7_1_rb_cmd_switch (adev, inst_mask); + r =sdma_v7_1_inst_start (adev, inst_mask);if (r)return r;
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 2/3 drm/amdgpu: Disable SDMA Hang WatchDog in SDMA_v7_1
From: Feifei Xu <[email protected]>
A temporary workaround to unblock usermode tests. Will revert once issue resolved.
Signed-off-by Feifei Xu <[email protected]>
Reviewed-by Hawking Zhang <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c +8 -3
@@ -551,11 +551,16 @@ static int sdma_v7_1_gfx_resume_instance(struct amdgpu_device *adev, int i, bool/* Set up sdma hang watchdog */ temp =RREG32_SOC15_IP (GC ,sdma_v7_1_get_reg_offset (adev, i, regSDMA0_SDMA_WATCHDOG_CNTL)); -/* 100ms per unit */ - temp =REG_SET_FIELD (temp,SDMA0_SDMA_WATCHDOG_CNTL ,QUEUE_HANG_COUNT , -max (adev->usec_timeout/100000 ,1 )); +/* Disable sdma hang watchdog, need revist this when issue resolved. +Once issue resoved, the QUEUE_HANG_COUNT should be set to max(adev->usec_timeout/100000,1) +*/ + temp =REG_SET_FIELD (temp,SDMA0_SDMA_WATCHDOG_CNTL ,QUEUE_HANG_COUNT ,0 ); + temp =REG_SET_FIELD (temp,SDMA0_SDMA_WATCHDOG_CNTL ,CMD_TIMEOUT_COUNT ,0 );WREG32_SOC15_IP (GC ,sdma_v7_1_get_reg_offset (adev, i, regSDMA0_SDMA_WATCHDOG_CNTL), temp); +dev_dbg (adev->dev,"Disable SDMA Hang WatchDog, regSDMA0_SDMA_WATCHDOG_CNTL = %d\n" , +RREG32_SOC15_IP (GC ,sdma_v7_1_get_reg_offset (adev, i, regSDMA0_SDMA_WATCHDOG_CNTL))); +/* Set up RESP_MODE to non-copy addresses */ temp =RREG32_SOC15_IP (GC ,sdma_v7_1_get_reg_offset (adev, i, regSDMA0_SDMA_UTCL1_CNTL)); temp =REG_SET_FIELD (temp,SDMA0_SDMA_UTCL1_CNTL ,RESP_MODE ,3 );
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 3/3 drm/amdkfd: Update SDMA engines reporting for GFX 12.1
In reply to Alex DeucherFrom: Mukul Joshi <[email protected]>
On GFX 12.1, all SDMA engines are the same from HW perspective. As a result, report all SDMA engines as regular/PCIe SDMA engines.
Signed-off-by Mukul Joshi <[email protected]>
Reviewed-by Harish Kasiviswanathan <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +5 -2
@@ -1512,8 +1512,11 @@ void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask)*/ unsigned int kfd_get_num_sdma_engines (struct kfd_node *node) { -/* If XGMI is not supported, all SDMA engines are PCIe */ -if (!node->adev->gmc.xgmi.supported) +/* If XGMI is not supported, all SDMA engines are PCIe. +* Also, on GC 12.1, all SDMA engines are the same. +*/ +if (!node->adev->gmc.xgmi.supported || +KFD_GC_VERSION (node->kfd) ==IP_VERSION (12 ,1 ,0 ))return node->adev->sdma.num_instances/(int )node->kfd->num_nodes;return min (node->adev->sdma.num_instances/(int )node->kfd->num_nodes,2 );
Signature · 1 line
2.55.0