Skip to contentSkip to conversation

remove unused code and add instance number to VCN

PATCH In review David (Ming Qiang) Wu 2 participants 5 messages Aug 25, 2025 – Aug 26, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover remove unused code and add instance number to VCN

1 Remove unused code in vcn_v1_0.c and vcn_v4_0.c - found by Coverity scan 2 improve log message by adding instance number. It's more useful for
multiple VCN instances case.

David (Ming Qiang) Wu (3):
drm/amdgpu/vcn: remove unused code in vcn_v1_0.c drm/amdgpu/vcn: remove unused code in vcn_v4_0.c drm/amdgpu/vcn: add instance number to VCN version message

 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 ++++----
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c   | 2 --
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c   | 1 -
 3 files changed, 4 insertions(+), 7 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/3 drm/amdgpu/vcn: remove unused code in vcn_v1_0.c

---
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +0 -2
index c74947705d778..1e89ba153d9d3 100644
@@ -1338,7 +1338,6 @@ static int vcn_v1_0_pause_dpg_mode(struct amdgpu_vcn_inst *vinst,
 				WREG32_SOC15(UVD, 0, mmUVD_RB_RPTR2, lower_32_bits(ring->wptr));
 				WREG32_SOC15(UVD, 0, mmUVD_RB_WPTR2, lower_32_bits(ring->wptr));
 
-				ring = &adev->vcn.inst->ring_dec;
 				WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR,
 						   RREG32_SOC15(UVD, 0, mmUVD_SCRATCH2) & 0x7FFFFFFF);
 				SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_POWER_STATUS,
@@ -1399,7 +1398,6 @@ static int vcn_v1_0_pause_dpg_mode(struct amdgpu_vcn_inst *vinst,
 				WREG32_SOC15(UVD, 0, mmUVD_JRBC_RB_CNTL,
 							UVD_JRBC_RB_CNTL__RB_RPTR_WR_EN_MASK);
 
-				ring = &adev->vcn.inst->ring_dec;
 				WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR,
 						   RREG32_SOC15(UVD, 0, mmUVD_SCRATCH2) & 0x7FFFFFFF);
 				SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_POWER_STATUS,
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/3 drm/amdgpu/vcn: remove unused code in vcn_v4_0.c

In reply to David (Ming Qiang) Wu
---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +0 -1
index 1785786a72f8e..d0d27790b73b1 100644
@@ -1621,7 +1621,6 @@ static int vcn_v4_0_stop(struct amdgpu_vcn_inst *vinst)
 
 	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
 		vcn_v4_0_stop_dpg_mode(vinst);
-		r = 0;
 		goto done;
 	}
 
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/3 drm/amdgpu/vcn: add instance number to VCN version message

In reply to David (Ming Qiang) Wu

For multiple VCN instances case we get multiple lines of the same message like below:

amdgpu 0000:43:00.0: amdgpu: Found VCN firmware Version ENC: 1.24 DEC: 9 VEP: 0 Revision: 11 amdgpu 0000:43:00.0: amdgpu: Found VCN firmware Version ENC: 1.24 DEC: 9 VEP: 0 Revision: 11

By adding instance number to the log message for multiple VCN instances, each line will clearly indicate which VCN instance it refers to.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4 -4
index fd8ebf4b5a824..5a90abcea0ac1 100644
@@ -185,16 +185,16 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev, int i)
 		dec_ver = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xf;
 		vep = (le32_to_cpu(hdr->ucode_version) >> 28) & 0xf;
 		dev_info(adev->dev,
-			 "Found VCN firmware Version ENC: %u.%u DEC: %u VEP: %u Revision: %u\n",
-			 enc_major, enc_minor, dec_ver, vep, fw_rev);
+			 "[VCN instance %d] Found VCN firmware Version ENC: %u.%u DEC: %u VEP: %u Revision: %u\n",
+			 i, enc_major, enc_minor, dec_ver, vep, fw_rev);
 	} else {
 		unsigned int version_major, version_minor, family_id;
 
 		family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
 		version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
 		version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
-		dev_info(adev->dev, "Found VCN firmware Version: %u.%u Family ID: %u\n",
-			 version_major, version_minor, family_id);
+		dev_info(adev->dev, "[VCN instance %d] Found VCN firmware Version: %u.%u Family ID: %u\n",
+			 i, version_major, version_minor, family_id);
 	}
 
 	bo_size = AMDGPU_VCN_STACK_SIZE + AMDGPU_VCN_CONTEXT_SIZE;
Signature · 1 line
2.43.0
Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] drm/amdgpu/vcn: add instance number to VCN version message

Quoted 11 lines · David (Ming Qiang) Wu

For multiple VCN instances case we get multiple lines of the same message like below:

amdgpu 0000:43:00.0: amdgpu: Found VCN firmware Version ENC: 1.24 DEC: 9 VEP: 0 Revision: 11 amdgpu 0000:43:00.0: amdgpu: Found VCN firmware Version ENC: 1.24 DEC: 9 VEP: 0 Revision: 11

By adding instance number to the log message for multiple VCN instances, each line will clearly indicate which VCN instance it refers to.

Series is:

Quoted 32 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4 -5
index fd8ebf4b5a824..5a90abcea0ac1 100644
@@ -185,16 +185,16 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev, int i)
                dec_ver = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xf;
                vep = (le32_to_cpu(hdr->ucode_version) >> 28) & 0xf;
                dev_info(adev->dev,
-                        "Found VCN firmware Version ENC: %u.%u DEC: %u VEP: %u Revision: %u\n",
-                        enc_major, enc_minor, dec_ver, vep, fw_rev);
+                        "[VCN instance %d] Found VCN firmware Version ENC: %u.%u DEC: %u VEP: %u Revision: %u\n",
+                        i, enc_major, enc_minor, dec_ver, vep, fw_rev);
        } else {
                unsigned int version_major, version_minor, family_id;
 
                family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
                version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
                version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
-               dev_info(adev->dev, "Found VCN firmware Version: %u.%u Family ID: %u\n",
-                        version_major, version_minor, family_id);
+               dev_info(adev->dev, "[VCN instance %d] Found VCN firmware Version: %u.%u Family ID: %u\n",
+                        i, version_major, version_minor, family_id);
        }
 
        bo_size = AMDGPU_VCN_STACK_SIZE + AMDGPU_VCN_CONTEXT_SIZE;
--

2.43.0