mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: allocate dummy_page without DMA32 on fail
@ 2026-07-14 16:03 Anirudh Srinivasan
  2026-07-15  9:15 ` Christian König
  0 siblings, 1 reply; 6+ messages in thread
From: Anirudh Srinivasan @ 2026-07-14 16:03 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie, Simona Vetter
  Cc: amd-gfx, dri-devel, linux-kernel, Anirudh Srinivasan

radeon fails to probe on platforms that have all their memory above the
32-bit range with an -ENOMEM because dummy_page_init calls
alloc_page(GFP_DMA32), which would fail.

Allow this driver to work on such platforms by falling back to
ZONE_NORMAL regions. dma_map_page called subsequently would catch any
issues with the device being unable to DMA into the mapped page.

An equivalent fix was applied to ttm in commit 0a8c1feed387 ("drm/ttm:
allocate dummy_read_page without DMA32 on fail")

Signed-off-by: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>
---
I had issues getting a R5 430 (Oland) with the radeon driver to probe on
a spacemit K3, which has no 32-bit memory regions. With this patch, the
driver was able to probe. The K3 supports up to 40 bit DMA and also has
an IOMMU, so the card works with the board. I was able to reach a
framebuffer console with this patch.
---
 drivers/gpu/drm/radeon/radeon_device.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 705c012fcf9e0..e8b1fa715a648 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -783,9 +783,15 @@ int radeon_dummy_page_init(struct radeon_device *rdev)
 {
 	if (rdev->dummy_page.page)
 		return 0;
-	rdev->dummy_page.page = alloc_page(GFP_DMA32 | GFP_KERNEL | __GFP_ZERO);
-	if (rdev->dummy_page.page == NULL)
-		return -ENOMEM;
+	rdev->dummy_page.page = alloc_page(GFP_DMA32 | GFP_KERNEL | __GFP_ZERO |
+				    __GFP_NOWARN);
+	/* Retry without GFP_DMA32 for platforms where DMA32 is not available */
+	if (rdev->dummy_page.page == NULL) {
+		rdev->dummy_page.page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+		if (rdev->dummy_page.page == NULL)
+			return -ENOMEM;
+		dev_warn(&rdev->pdev->dev, "Falling back to non-DMA32 dummy page allocation\n");
+	}
 	rdev->dummy_page.addr = dma_map_page(&rdev->pdev->dev, rdev->dummy_page.page,
 					0, PAGE_SIZE, DMA_BIDIRECTIONAL);
 	if (dma_mapping_error(&rdev->pdev->dev, rdev->dummy_page.addr)) {

---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260714-radeon_32bit_fix-8b1058b6d571

Best regards,
--  
Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>


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

end of thread, other threads:[~2026-07-17  7:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-14 16:03 [PATCH] drm/radeon: allocate dummy_page without DMA32 on fail Anirudh Srinivasan
2026-07-15  9:15 ` Christian König
2026-07-16  2:08   ` Anirudh Srinivasan
2026-07-16  7:34     ` Christian König
2026-07-16 14:31       ` Anirudh Srinivasan
2026-07-17  7:37         ` 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