Index | Thread | Search

From:
Ted Bullock <tbullock@comlore.com>
Subject:
radeondrm: fix CAFEDEAD failure during boot for old Radeons
To:
tech@openbsd.org
Date:
Thu, 08 Oct 2026 00:24:06 -0600

Download raw body.

Thread
Hello,

I think this is a plausible fix for a very longstanding bug with
regards to older Radeon GPUs on a variety of platforms.

The telltale dmesg line looks something like
[drm] *ERROR* radeon: ring test failed (scratch(0x15E4)=0xCAFEDEAD)

https://marc.info/?l=openbsd-bugs&m=162447131102854
https://marc.info/?l=openbsd-bugs&m=177938265735653
https://marc.info/?l=openbsd-misc&m=155873575216626&w=2

The call to the stubbed linux dma selection logic in
dma_addressing_limited() has been removed (always false), but according
to radeon_device.c, the older Radeon chips should be using the driver's
32 bit DMA logic.

	/* set DMA mask.
	 * PCIE - can handle 40-bits.
	 * IGP - can handle 40-bits
	 * AGP - generally dma32 is safest
	 * PCI - dma32 for legacy pci gart, 40 bits on newer asics
	 */
	dma_bits = 40;
	if (rdev->flags & RADEON_IS_AGP)
		dma_bits = 32;
	if ((rdev->flags & RADEON_IS_PCI) &&
	    (rdev->family <= CHIP_RS740))
		dma_bits = 32;
#ifdef CONFIG_PPC64
	if (rdev->family == CHIP_CEDAR)
		dma_bits = 32;
#endif

I have no idea about the PPC64 flag, nor do I have one of those fancy
Talos machines to play around with. Since AGP is disabled by default
for this driver, I'm speculating we can just use the PCI logic in lieu
of the dma_addressing_limited() function.

I can confirm that my Sun Blade 100 with the XVR-100 finally boots
without the CAFEDEAD warning in dmesg, and it also lets me enable
accelerated X.

Ted

--- sys/dev/pci/drm/radeon/radeon_ttm.c
+++ sys/dev/pci/drm/radeon/radeon_ttm.c
@@ -712,17 +712,22 @@
 			       rdev_to_drm(rdev)->vma_offset_manager,
 			       rdev->need_swiotlb,
 			       dma_addressing_limited(&rdev->pdev->dev));
 #else
 	r = ttm_device_init(&rdev->mman.bdev, &radeon_bo_driver, rdev->dev,
 			       /*rdev_to_drm(rdev)->anon_inode->i_mapping*/NULL,
 			       rdev_to_drm(rdev)->vma_offset_manager,
 			       rdev->need_swiotlb,
-			       dma_addressing_limited(&rdev->pdev->dev));
+			       /*
+			        * Extracted from the Radeon device initialization
+			        * DMA logic in sys/dev/pci/drm/radeon/radeon_device.c.
+			        */
+			       ((rdev->flags & RADEON_IS_PCI) &&
+			        rdev->family <= CHIP_RS740));
 #endif
 	if (r) {
 		DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
 		return r;
 	}
 	rdev->mman.bdev.iot = rdev->iot;
 	rdev->mman.bdev.memt = rdev->memt;
 	rdev->mman.bdev.dmat = rdev->dmat;