On Wed, 11 Feb 2026 17:37:05 -0800 Deborah Brouwer <[email protected]> wrote:
> From: Beata Michalska <[email protected]> > > 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. > > Signed-off-by: Beata Michalska <[email protected]> > Co-developed-by: Deborah Brouwer <[email protected]> > Signed-off-by: Deborah Brouwer <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> > --- > drivers/gpu/drm/tyr/driver.rs | 11 +++++++++++ > drivers/gpu/drm/tyr/gpu.rs | 1 - > 2 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs > index e5eae5a73371..2973a8b3cc09 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::{ > driver::Registration, > @@ -134,6 +138,13 @@ fn probe( > let gpu_info = GpuInfo::new(pdev.as_ref(), &iomem)?; > gpu_info.log(pdev); > > + // 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(gpu_info.pa_bits())?)?; > + } > + > let uninit_ddev = > UnregisteredDevice::<TyrDrmDriver>::new(pdev.as_ref())?; > let platform: ARef<platform::Device> = pdev.into(); > > diff --git a/drivers/gpu/drm/tyr/gpu.rs b/drivers/gpu/drm/tyr/gpu.rs > index affca5b0dc6c..b5f11bc96fa0 100644 > --- a/drivers/gpu/drm/tyr/gpu.rs > +++ b/drivers/gpu/drm/tyr/gpu.rs > @@ -141,7 +141,6 @@ pub(crate) fn va_bits(&self) -> u32 { > } > > /// Returns the number of physical address bits supported by the GPU. > - #[expect(dead_code)] > pub(crate) fn pa_bits(&self) -> u32 { > (self.mmu_features >> 8) & genmask_u32(0..=7) > }
