All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: handle VCN instances when harvesting (v2)
@ 2021-08-10  3:03 Alex Deucher
  2021-08-10  3:06 ` Chen, Guchun
  2021-08-10 12:04 ` Lazar, Lijo
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Deucher @ 2021-08-10  3:03 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, James Zhu

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: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 43e7b61d1c5c..ada7bc19118a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -299,6 +299,9 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
 				  ip->major, ip->minor,
 				  ip->revision);
 
+			if (le16_to_cpu(ip->hw_id) == VCN_HWID)
+				adev->vcn.num_vcn_inst++;
+
 			for (k = 0; k < num_base_address; k++) {
 				/*
 				 * convert the endianness of base addresses in place,
@@ -385,7 +388,7 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
 {
 	struct binary_header *bhdr;
 	struct harvest_table *harvest_info;
-	int i;
+	int i, vcn_harvest_count = 0;
 
 	bhdr = (struct binary_header *)adev->mman.discovery_bin;
 	harvest_info = (struct harvest_table *)(adev->mman.discovery_bin +
@@ -397,8 +400,7 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
 
 		switch (le32_to_cpu(harvest_info->list[i].hw_id)) {
 		case VCN_HWID:
-			adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
-			adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
+			vcn_harvest_count++;
 			break;
 		case DMU_HWID:
 			adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
@@ -407,6 +409,10 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
 			break;
 		}
 	}
+	if (vcn_harvest_count == adev->vcn.num_vcn_inst) {
+		adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
+		adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
+	}
 }
 
 int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] drm/amdgpu: handle VCN instances when harvesting (v2)
  2021-08-10  3:03 [PATCH] drm/amdgpu: handle VCN instances when harvesting (v2) Alex Deucher
@ 2021-08-10  3:06 ` Chen, Guchun
  2021-08-10 12:04 ` Lazar, Lijo
  1 sibling, 0 replies; 4+ messages in thread
From: Chen, Guchun @ 2021-08-10  3:06 UTC (permalink / raw)
  To: Deucher, Alexander, amd-gfx; +Cc: Deucher, Alexander, Zhu, James

[Public]

Reviewed-by: Guchun Chen <guchun.chen@amd.com>

Regards,
Guchun

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher
Sent: Tuesday, August 10, 2021 11:03 AM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Zhu, James <James.Zhu@amd.com>
Subject: [PATCH] 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1673&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Cff725e2787674280255308d95bab7325%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637641614198052677%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=oNLIYokjXIL2CfqeVMevwNjj9jJJo%2BmhZJ6az8TLW2c%3D&amp;reserved=0
Reviewed-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 43e7b61d1c5c..ada7bc19118a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -299,6 +299,9 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
 				  ip->major, ip->minor,
 				  ip->revision);
 
+			if (le16_to_cpu(ip->hw_id) == VCN_HWID)
+				adev->vcn.num_vcn_inst++;
+
 			for (k = 0; k < num_base_address; k++) {
 				/*
 				 * convert the endianness of base addresses in place, @@ -385,7 +388,7 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)  {
 	struct binary_header *bhdr;
 	struct harvest_table *harvest_info;
-	int i;
+	int i, vcn_harvest_count = 0;
 
 	bhdr = (struct binary_header *)adev->mman.discovery_bin;
 	harvest_info = (struct harvest_table *)(adev->mman.discovery_bin + @@ -397,8 +400,7 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
 
 		switch (le32_to_cpu(harvest_info->list[i].hw_id)) {
 		case VCN_HWID:
-			adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
-			adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
+			vcn_harvest_count++;
 			break;
 		case DMU_HWID:
 			adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK; @@ -407,6 +409,10 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
 			break;
 		}
 	}
+	if (vcn_harvest_count == adev->vcn.num_vcn_inst) {
+		adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
+		adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
+	}
 }
 
 int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)
--
2.31.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: handle VCN instances when harvesting (v2)
  2021-08-10  3:03 [PATCH] drm/amdgpu: handle VCN instances when harvesting (v2) Alex Deucher
  2021-08-10  3:06 ` Chen, Guchun
@ 2021-08-10 12:04 ` Lazar, Lijo
  2021-08-10 12:13   ` Lazar, Lijo
  1 sibling, 1 reply; 4+ messages in thread
From: Lazar, Lijo @ 2021-08-10 12:04 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx; +Cc: James Zhu



On 8/10/2021 8:33 AM, Alex Deucher wrote:
> 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: James Zhu <James.Zhu@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index 43e7b61d1c5c..ada7bc19118a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -299,6 +299,9 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
>   				  ip->major, ip->minor,
>   				  ip->revision);
>   
> +			if (le16_to_cpu(ip->hw_id) == VCN_HWID)
> +				adev->vcn.num_vcn_inst++;
> +
>   			for (k = 0; k < num_base_address; k++) {
>   				/*
>   				 * convert the endianness of base addresses in place,
> @@ -385,7 +388,7 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
>   {
>   	struct binary_header *bhdr;
>   	struct harvest_table *harvest_info;
> -	int i;
> +	int i, vcn_harvest_count = 0;
>   
>   	bhdr = (struct binary_header *)adev->mman.discovery_bin;
>   	harvest_info = (struct harvest_table *)(adev->mman.discovery_bin +
> @@ -397,8 +400,7 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
>   
>   		switch (le32_to_cpu(harvest_info->list[i].hw_id)) {
>   		case VCN_HWID:
> -			adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
> -			adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
> +			vcn_harvest_count++;
>   			break;
>   		case DMU_HWID:
>   			adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
> @@ -407,6 +409,10 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
>   			break;
>   		}
>   	}
> +	if (vcn_harvest_count == adev->vcn.num_vcn_inst) {
> +		adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
> +		adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
> +	}

If there is only one out of two harvested, I think we should add 
something like
	adev->vcn.num_vcn_inst -= vcn_harvest_count;

at the end to reflect the actual number of VCN instances available.

Thanks,
Lijo

>   }
>   
>   int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: handle VCN instances when harvesting (v2)
  2021-08-10 12:04 ` Lazar, Lijo
@ 2021-08-10 12:13   ` Lazar, Lijo
  0 siblings, 0 replies; 4+ messages in thread
From: Lazar, Lijo @ 2021-08-10 12:13 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx; +Cc: James Zhu

Please ignore the comment. Checked again - num_vcn_inst denotes the 
maximum VCN instances and not the actual number of instances.

Thanks,
Lijo

On 8/10/2021 5:34 PM, Lazar, Lijo wrote:
> 
> 
> On 8/10/2021 8:33 AM, Alex Deucher wrote:
>> 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1673&amp;data=04%7C01%7Clijo.lazar%40amd.com%7C5c039172e2774c5f712f08d95bf70409%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637641938755361590%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=bQFWRroKIinbe2bBbpe85%2BrpwemUuVYLjB1Gz7keRTQ%3D&amp;reserved=0 
>>
>> Reviewed-by: James Zhu <James.Zhu@amd.com>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 12 +++++++++---
>>   1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>> index 43e7b61d1c5c..ada7bc19118a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>> @@ -299,6 +299,9 @@ int amdgpu_discovery_reg_base_init(struct 
>> amdgpu_device *adev)
>>                     ip->major, ip->minor,
>>                     ip->revision);
>> +            if (le16_to_cpu(ip->hw_id) == VCN_HWID)
>> +                adev->vcn.num_vcn_inst++;
>> +
>>               for (k = 0; k < num_base_address; k++) {
>>                   /*
>>                    * convert the endianness of base addresses in place,
>> @@ -385,7 +388,7 @@ void amdgpu_discovery_harvest_ip(struct 
>> amdgpu_device *adev)
>>   {
>>       struct binary_header *bhdr;
>>       struct harvest_table *harvest_info;
>> -    int i;
>> +    int i, vcn_harvest_count = 0;
>>       bhdr = (struct binary_header *)adev->mman.discovery_bin;
>>       harvest_info = (struct harvest_table *)(adev->mman.discovery_bin +
>> @@ -397,8 +400,7 @@ void amdgpu_discovery_harvest_ip(struct 
>> amdgpu_device *adev)
>>           switch (le32_to_cpu(harvest_info->list[i].hw_id)) {
>>           case VCN_HWID:
>> -            adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
>> -            adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
>> +            vcn_harvest_count++;
>>               break;
>>           case DMU_HWID:
>>               adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
>> @@ -407,6 +409,10 @@ void amdgpu_discovery_harvest_ip(struct 
>> amdgpu_device *adev)
>>               break;
>>           }
>>       }
>> +    if (vcn_harvest_count == adev->vcn.num_vcn_inst) {
>> +        adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
>> +        adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
>> +    }
> 
> If there is only one out of two harvested, I think we should add 
> something like
>      adev->vcn.num_vcn_inst -= vcn_harvest_count;
> 
> at the end to reflect the actual number of VCN instances available.
> 
> Thanks,
> Lijo
> 
>>   }
>>   int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-10 12:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10  3:03 [PATCH] drm/amdgpu: handle VCN instances when harvesting (v2) Alex Deucher
2021-08-10  3:06 ` Chen, Guchun
2021-08-10 12:04 ` Lazar, Lijo
2021-08-10 12:13   ` Lazar, Lijo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.