Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: handle VCN instances when harvesting (v2)

There may be multiple instances and only one is harvested.

v2: fix typo in commit message

Fixes: 83a0b8639185 ("drm/amdgpu: add judgement when add ip blocks (v2)")
Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1673
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org

+9 -3
+9 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
··· 299 299 ip->major, ip->minor, 300 300 ip->revision); 301 301 302 + if (le16_to_cpu(ip->hw_id) == VCN_HWID) 303 + adev->vcn.num_vcn_inst++; 304 + 302 305 for (k = 0; k < num_base_address; k++) { 303 306 /* 304 307 * convert the endianness of base addresses in place, ··· 388 385 { 389 386 struct binary_header *bhdr; 390 387 struct harvest_table *harvest_info; 391 - int i; 388 + int i, vcn_harvest_count = 0; 392 389 393 390 bhdr = (struct binary_header *)adev->mman.discovery_bin; 394 391 harvest_info = (struct harvest_table *)(adev->mman.discovery_bin + ··· 400 397 401 398 switch (le32_to_cpu(harvest_info->list[i].hw_id)) { 402 399 case VCN_HWID: 403 - adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK; 404 - adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK; 400 + vcn_harvest_count++; 405 401 break; 406 402 case DMU_HWID: 407 403 adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK; ··· 408 406 default: 409 407 break; 410 408 } 409 + } 410 + if (vcn_harvest_count == adev->vcn.num_vcn_inst) { 411 + adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK; 412 + adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK; 411 413 } 412 414 } 413 415