From a9bc67761db8cb3207c977210c81be63a539b135 Mon Sep 17 00:00:00 2001 From: Beata Michalska Date: Tue, 28 Apr 2026 12:19:31 -0700 Subject: [PATCH] drm/tyr: set DMA mask using GPU physical address Configure the device DMA mask during probe using the GPU's physical address capability reported in GpuInfo. This ensures DMA allocations use an appropriate address mask. Reviewed-by: Boris Brezillon Reviewed-by: Daniel Almeida Reviewed-by: Alice Ryhl Signed-off-by: Beata Michalska Co-developed-by: Deborah Brouwer Signed-off-by: Deborah Brouwer Link: https://patch.msgid.link/20260428-fw-boot-prerequisites-v1-4-c69af9abe1af@collabora.com Signed-off-by: Alice Ryhl --- drivers/gpu/drm/tyr/driver.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs index cdb9b13bdb32..e20a5978eed6 100644 --- a/drivers/gpu/drm/tyr/driver.rs +++ b/drivers/gpu/drm/tyr/driver.rs @@ -11,6 +11,10 @@ Device, // }, devres::Devres, + dma::{ + Device as DmaDevice, + DmaMask, // + }, drm, drm::ioctl, io::{ @@ -124,6 +128,14 @@ fn probe( let gpu_info = GpuInfo::new(pdev.as_ref(), &iomem)?; gpu_info.log(pdev.as_ref()); + let pa_bits = MMU_FEATURES::from_raw(gpu_info.mmu_features) + .pa_bits() + .get(); + // SAFETY: No concurrent DMA allocations or mappings can be made because + // the device is still being probed and therefore isn't being used by + // other threads of execution. + unsafe { pdev.dma_set_mask_and_coherent(DmaMask::try_new(pa_bits)?)? }; + let platform: ARef = pdev.into(); let data = try_pin_init!(TyrDrmDeviceData {