[PATCH 2/2] drm/amd/amdgpu: add instance_number check in amdgpu_discovery_get_ip_version

Zhou, Peng Ju PengJu.Zhou at amd.com
Mon Jun 7 08:13:23 UTC 2021


[AMD Official Use Only]

Hi Alex
The following patch series were ported from amd-staging-dkms to fix VCN IB test fail.
Can you help to review it?

[PATCH 1/2] drm/amd/amdgpu: Use IP discovery data to determine VCN enablement instead of MMSCH
[PATCH 2/2] drm/amd/amdgpu: add instance_number check in amdgpu_discovery_get_ip_version


---------------------------------------------------------------------- 
BW
Pengju Zhou

 

> -----Original Message-----
> From: Peng Ju Zhou <PengJu.Zhou at amd.com>
> Sent: Thursday, June 3, 2021 6:42 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Zhou, Peng Ju <PengJu.Zhou at amd.com>; Zhang, Bokun
> <Bokun.Zhang at amd.com>
> Subject: [PATCH 2/2] drm/amd/amdgpu: add instance_number check in
> amdgpu_discovery_get_ip_version
> 
> The original code returns IP version of instantce_0 for every IP. This
> implementation may be correct for most of IPs.
> 
> However, for certain IP block (VCN for example), it may have 2 instances and
> both of them have the same hw_id, BUT they have different revision number
> (0 and 1).
> 
> In this case, the original amdgpu_discovery_get_ip_version cannot correct
> reflects the result and returns false information
> 
> Signed-off-by: Bokun Zhang <Bokun.Zhang at amd.com>
> Signed-off-by: Peng Ju Zhou <PengJu.Zhou at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 4 ++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index 99255c2f08f4..f949ed8bfd9e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -325,7 +325,7 @@ int amdgpu_discovery_reg_base_init(struct
> amdgpu_device *adev)
>  	return 0;
>  }
> 
> -int amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int hw_id,
> +int amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int
> +hw_id, int number_instance,
>  				    int *major, int *minor, int *revision)  {
>  	struct binary_header *bhdr;
> @@ -357,7 +357,7 @@ int amdgpu_discovery_get_ip_version(struct
> amdgpu_device *adev, int hw_id,
>  		for (j = 0; j < num_ips; j++) {
>  			ip = (struct ip *)(adev->mman.discovery_bin +
> ip_offset);
> 
> -			if (le16_to_cpu(ip->hw_id) == hw_id) {
> +			if ((le16_to_cpu(ip->hw_id) == hw_id) && (ip-
> >number_instance ==
> +number_instance)) {
>  				if (major)
>  					*major = ip->major;
>  				if (minor)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h
> index 1b1ae21b1037..02e340cd3a38 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h
> @@ -30,7 +30,7 @@
>  void amdgpu_discovery_fini(struct amdgpu_device *adev);  int
> amdgpu_discovery_reg_base_init(struct amdgpu_device *adev);  void
> amdgpu_discovery_harvest_ip(struct amdgpu_device *adev); -int
> amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int hw_id,
> +int amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int
> +hw_id, int number_instance,
>                                      int *major, int *minor, int *revision);  int
> amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev);
> 
> --
> 2.17.1


More information about the amd-gfx mailing list