Hi Christoph, On 15/11/19 6:36 PM, Christoph Hellwig wrote: > On Fri, Nov 15, 2019 at 04:29:31PM +0530, Kishon Vijay Abraham I wrote: >> Hi Christoph, >> >> I think we are encountering a case where the connected PCIe card (like PCIe USB >> card) supports 64-bit addressing and the ARM core supports 64-bit addressing >> but the PCIe controller in the SoC to which PCIe card is connected supports >> only 32-bits. >> >> Here dma APIs can provide an address above the 32 bit region to the PCIe card. >> However this will fail when the card tries to access the provided address via >> the PCIe controller. > > What kernel version did you see your problems with? > > Linux 5.3 added swiotlb to arm LPAE configs for exactly that case. I'm using the latest kernel commit 96b95eff4a591dbac582c2590d067e356a18aacb (HEAD, origin/master, origin/HEAD) Merge: 4e84608c7836 80591e61a0f7 Author: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Date: Thu Nov 14 08:48:10 2019 -0800 Merge tag 'kbuild-fixes-v5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild I think the fix on 5.3 was useful for platform drivers (where the platform driver will set dma_set_mask as 32bits) even when the system itself supports LPAE. Here the pci_driver will set dma_set_mask as 64 bits, since the PCI device as such is capable of addressing 64 bits. The pci_driver doesn't know if the PCI controller to which the PCI device is connected is capable of addressing 64 bits. We should find a way to set the DMA mask of of the PCI device based on the DMA mask of the PCI controller in the SoC. One option would be to change the pci_drivers all over the kernel to set DMA mask to be based on the DMA mask of the PCI controller (the PCI device hierarchy should get a reference to the device pointer of the PCI controller). Or is there a better way to handle this? Thanks Kishon