linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: radeon: r600_dma: Replace cpu_to_le32() by lower_32_bits()
@ 2021-08-13  8:54 zhaoxiao
  2021-08-13 15:03 ` Michel Dänzer
  0 siblings, 1 reply; 3+ messages in thread
From: zhaoxiao @ 2021-08-13  8:54 UTC (permalink / raw)
  To: airlied
  Cc: alexander.deucher, christian.koenig, David1.Zhou, amd-gfx,
	dri-devel, linux-kernel, zhaoxiao

This patch fixes the following sparse errors:
drivers/gpu/drm/radeon/r600_dma.c:247:30: warning: incorrect type in assignment (different base types)
drivers/gpu/drm/radeon/r600_dma.c:247:30:    expected unsigned int volatile [usertype]
drivers/gpu/drm/radeon/r600_dma.c:247:30:    got restricted __le32 [usertype]

Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
---
 drivers/gpu/drm/radeon/r600_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c
index fb65e6fb5c4f..a2d0b1edcd22 100644
--- a/drivers/gpu/drm/radeon/r600_dma.c
+++ b/drivers/gpu/drm/radeon/r600_dma.c
@@ -244,7 +244,7 @@ int r600_dma_ring_test(struct radeon_device *rdev,
 	gpu_addr = rdev->wb.gpu_addr + index;
 
 	tmp = 0xCAFEDEAD;
-	rdev->wb.wb[index/4] = cpu_to_le32(tmp);
+	rdev->wb.wb[index/4] = lower_32_bits(tmp);
 
 	r = radeon_ring_lock(rdev, ring, 4);
 	if (r) {
-- 
2.20.1




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

* Re: [PATCH] drm: radeon: r600_dma: Replace cpu_to_le32() by lower_32_bits()
  2021-08-13  8:54 [PATCH] drm: radeon: r600_dma: Replace cpu_to_le32() by lower_32_bits() zhaoxiao
@ 2021-08-13 15:03 ` Michel Dänzer
  2021-08-16 12:47   ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Michel Dänzer @ 2021-08-13 15:03 UTC (permalink / raw)
  To: zhaoxiao, airlied
  Cc: alexander.deucher, christian.koenig, David1.Zhou, amd-gfx,
	dri-devel, linux-kernel

On 2021-08-13 10:54 a.m., zhaoxiao wrote:
> This patch fixes the following sparse errors:
> drivers/gpu/drm/radeon/r600_dma.c:247:30: warning: incorrect type in assignment (different base types)
> drivers/gpu/drm/radeon/r600_dma.c:247:30:    expected unsigned int volatile [usertype]
> drivers/gpu/drm/radeon/r600_dma.c:247:30:    got restricted __le32 [usertype]
> 
> Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
> ---
>  drivers/gpu/drm/radeon/r600_dma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c
> index fb65e6fb5c4f..a2d0b1edcd22 100644
> --- a/drivers/gpu/drm/radeon/r600_dma.c
> +++ b/drivers/gpu/drm/radeon/r600_dma.c
> @@ -244,7 +244,7 @@ int r600_dma_ring_test(struct radeon_device *rdev,
>  	gpu_addr = rdev->wb.gpu_addr + index;
>  
>  	tmp = 0xCAFEDEAD;
> -	rdev->wb.wb[index/4] = cpu_to_le32(tmp);
> +	rdev->wb.wb[index/4] = lower_32_bits(tmp);
>  
>  	r = radeon_ring_lock(rdev, ring, 4);
>  	if (r) {
> 

Seems better to mark rdev->wb.wb as little endian instead. It's read with le32_to_cpu (with some exceptions which look like bugs), which would result in 0xADEDFECA like this.


-- 
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer

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

* Re: [PATCH] drm: radeon: r600_dma: Replace cpu_to_le32() by lower_32_bits()
  2021-08-13 15:03 ` Michel Dänzer
@ 2021-08-16 12:47   ` Christian König
  0 siblings, 0 replies; 3+ messages in thread
From: Christian König @ 2021-08-16 12:47 UTC (permalink / raw)
  To: Michel Dänzer, zhaoxiao, airlied
  Cc: alexander.deucher, christian.koenig, David1.Zhou, amd-gfx,
	dri-devel, linux-kernel



Am 13.08.21 um 17:03 schrieb Michel Dänzer:
> On 2021-08-13 10:54 a.m., zhaoxiao wrote:
>> This patch fixes the following sparse errors:
>> drivers/gpu/drm/radeon/r600_dma.c:247:30: warning: incorrect type in assignment (different base types)
>> drivers/gpu/drm/radeon/r600_dma.c:247:30:    expected unsigned int volatile [usertype]
>> drivers/gpu/drm/radeon/r600_dma.c:247:30:    got restricted __le32 [usertype]
>>
>> Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
>> ---
>>   drivers/gpu/drm/radeon/r600_dma.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c
>> index fb65e6fb5c4f..a2d0b1edcd22 100644
>> --- a/drivers/gpu/drm/radeon/r600_dma.c
>> +++ b/drivers/gpu/drm/radeon/r600_dma.c
>> @@ -244,7 +244,7 @@ int r600_dma_ring_test(struct radeon_device *rdev,
>>   	gpu_addr = rdev->wb.gpu_addr + index;
>>   
>>   	tmp = 0xCAFEDEAD;
>> -	rdev->wb.wb[index/4] = cpu_to_le32(tmp);
>> +	rdev->wb.wb[index/4] = lower_32_bits(tmp);
>>   
>>   	r = radeon_ring_lock(rdev, ring, 4);
>>   	if (r) {
>>
> Seems better to mark rdev->wb.wb as little endian instead. It's read with le32_to_cpu (with some exceptions which look like bugs), which would result in 0xADEDFECA like this.

Yeah, that patch doesn't look correct at all and most likely breaks ring 
test on big endian systems.

Christian.

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13  8:54 [PATCH] drm: radeon: r600_dma: Replace cpu_to_le32() by lower_32_bits() zhaoxiao
2021-08-13 15:03 ` Michel Dänzer
2021-08-16 12:47   ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).