[PATCH] dt-bindings: PCI: mediatek-gen3: Allow memory-region for restricted DMA buffer
Chen-Yu Tsai
wenst at chromium.org
Thu May 14 00:54:29 PDT 2026
On Thu, May 14, 2026 at 1:23 PM Manivannan Sadhasivam <mani at kernel.org> wrote:
>
> On Fri, May 08, 2026 at 02:36:32PM +0800, Chen-Yu Tsai wrote:
> > On some SoCs without an IOMMU behind the PCIe controller, the PCIe
> > controller memory access could be limited to a small region by the
> > firmware configuring a memory protection unit. This memory region
> > must be assigned to the PCIe controller so that the OS knows to
> > use that region. Otherwise PCIe devices would not work properly.
> >
>
> So this means, the PCIe devices can only access a specific carveout memory
> configured by MPU for DMA? If so, you should use 'dma-ranges' as suggested by
> Rob.
>
> 'memory-region' also serves the purpose, but for PCI, we have the dedicated
> 'dma-ranges' property.
I think I need some sort of guide on writing the 'dma-ranges' property,
because it is not working for me.
I'm adding
dma-ranges = <0x42000000 0 0x00000000 0 0xc0000000 0 0x4000000>;
to the PCIe controller node, and dropping the memory-region. The WiFi
driver subsequently fails to allocate buffers:
rtw88_8822ce 0000:01:00.0: enabling device (0000 -> 0003)
rtw88_8822ce 0000:01:00.0: failed to allocate tx ring
This is dma_alloc_coherent() failing.
rtw88_8822ce 0000:01:00.0: Firmware version 9.9.15, H2C version 15
rtw88_8822ce 0000:01:00.0: failed to allocate pci resources
rtw88_8822ce 0000:01:00.0: WOW Firmware version 9.9.4, H2C version 15
rtw88_8822ce 0000:01:00.0: failed to setup pci resources
rtw88_8822ce 0000:01:00.0: probe with driver rtw88_8822ce failed
with error -12
Also, using memory-region seems more straight-forward: I have a region of
memory dedicated to the PCIe controller. I describe the memory region,
and assign it to the PCIe controller.
Thanks
ChenYu
More information about the Linux-mediatek
mailing list