drm: radeon: r600_dma: Replace cpu_to_le32() by lower_32_bits()
Subsystems (2)
PATCH 1/1 drm: radeon: r600_dma: Replace cpu_to_le32() by lower_32_bits()
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]
--- drivers/gpu/drm/radeon/r600_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/r600_dma.c +1 -1
@@ -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) {
Signature · 1 line
2.20.1
Quoted 16 lines · 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 <[email protected]>--- drivers/gpu/drm/radeon/r600_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/radeon/r600_dma.c +0
-0
drivers/gpu/drm/radeon/r600_dma.c int r600_dma_ring_test(struct radeon_device *rdev, · line 250
Quoted 8 lines
drivers/gpu/drm/radeon/r600_dma.c +1
-1@@ -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.
Signature · 2 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and X developer
Am 13.08.21 um 17:03 schrieb Michel Dänzer:
Quoted 18 lines · zhaoxiao
Quoted 17 lines
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 <[email protected]>--- drivers/gpu/drm/radeon/r600_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/radeon/r600_dma.c +0
-0@@ -244,7 +244,7 @@ int r600_dma_ring_test(struct radeon_device *rdev, gpu_addr = rdev->wb.gpu_addr + index;
Quoted 8 lines
drivers/gpu/drm/radeon/r600_dma.c int r600_dma_ring_test(struct radeon_device *rdev, · line 250
Quoted 7 lines
drivers/gpu/drm/radeon/r600_dma.c +1
-1tmp =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.wbas little endian instead. It's read withle32_to_cpu(with some exceptions which look like bugs), which would result in0xADEDFECAlike this.
Yeah, that patch doesn't look correct at all and most likely breaks ring test on big endian systems.
Christian.