From 7c9f3cae6ae9582337dd5fddf9d5b1b65c558fe1 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Wed, 4 Nov 2020 06:03:27 +0100 Subject: [PATCH] drm/radeon: make all PCI GPUs use 32 bits DMA bit mask Prevent to fail r600_ring_test on ATI PCI devices hosted on K8 or K10 platforms: > [drm:r600_ring_test [radeon]] *ERROR* radeon: > ring 0 test failed (scratch(0x8504)=0xCAFEDEAD) > radeon 0000:03:00.0: disabling GPU acceleration and this error: > trying to bind memory to uninitialized GART ! Such PCI hardware works correctly on Intel 82801 platform, so this change may be non-optimal for them on non-K8/K10 platforms. Initial code was testing for GPU chip family to chose between 40 bits or 32 bits, it looks like a better code would be to test for platform (PCI bridge, maybe?). This is not enough to fix PCI GPUs on K8 (K8T800) and K10 (nForce3), also, non-ATI Nvidia PCI GPUs are affected by at least one other bug that may be in common. See https://bugs.launchpad.net/bugs/1902795 (PCI side) and https://bugs.launchpad.net/bugs/1899304 (AGP side) This also prevents the uninitialized GART error to occur when ATI AGP cards run in PCI mode. This is not a call to disable AGP, and other bug(s) left such AGP hardware unusable once AGP is disabled. --- drivers/gpu/drm/radeon/radeon_device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 266e3cbbd09b..282590d6f793 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -1372,8 +1372,16 @@ int radeon_device_init(struct radeon_device *rdev, dma_bits = 40; if (rdev->flags & RADEON_IS_AGP) dma_bits = 32; - if ((rdev->flags & RADEON_IS_PCI) && - (rdev->family <= CHIP_RS740)) + /* Some platform may accept 40 bits for the same PCI hardware + * that would requires 32 bits on other ones. + * PCI ATI Radeon HD 4350 (RV710) is known to work with 40-bits + * on computer running Intel Eaglelake E5200 CPU with 82801 PCI + * bridge while 32-bits is required to not fail r600_ring_test + * on computer running AMD K8 Athlon 3200+ CPU with K8T800Pro + * VT8237/8251 PCI bridge and computer running AMD K10 Phenom II + * X4 970 with Nvidia nForce3 250Gb PCI bridge. + */ + if (rdev->flags & RADEON_IS_PCI) dma_bits = 32; #ifdef CONFIG_PPC64 if (rdev->family == CHIP_CEDAR) -- 2.25.1