iommu unhandled context fault on reserved memory

Hi,

We’re building a PCIe device that would access to TX1/TX2’s memory. To do that, we need to allocate a large “cached” memory region (512 MB) (we don’t want to use dma_alloc_coherent here because of performance). So far with TX1, we can reserve that amount of memory in device tree, and do ioremap_cache later on (PCIe’s iommu has been also disabled previously). It’s working great this way.

However, in TX2, we can’t find any place to disable PCIe’s iommu like TX1 so we see this error whenever the device accesses to TX2’s memory:

arm-smmu 12000000.iommu: Unhandled context fault: iova=0xe0000000, fsynr=0x11, cb=20, sid=17(0x1
1 - AFI), pgd=0, pud=0, pmd=0, pte=0

We’re stuck here and don’t know which way to move on. If anyone has any idea, please help.

Thanks.

P/s: We define the reserved memory as below:

reserved-memory {
                ntb_reserved: ntb_mem@0 {
                        reg = <0x0 0xe0000000 0x0 0x20000000>;
                        no-map;
                };
        };

You can apply the following patch to disable SMMU for PCIe.

diff --git a/kernel-dts/tegra186-soc/tegra186-soc-base.dtsi b/kernel-dts/tegra186-soc/tegra186-soc-base.dtsi
index 6da7a71..76d0dff 100644
--- a/kernel-dts/tegra186-soc/tegra186-soc-base.dtsi
+++ b/kernel-dts/tegra186-soc/tegra186-soc-base.dtsi
@@ -182,7 +182,6 @@
                   <&tegra_adsp_audio    TEGRA_SID_APE>,
                   <&{/sound}        TEGRA_SID_APE>,
                   <&{/sound_ref}        TEGRA_SID_APE>,
-                  <&{/pcie-controller@10003000} TEGRA_SID_AFI>,
                   <&{/ahci-sata@3507000}    TEGRA_SID_SATA2>,
                   <&{/aon@c160000}      TEGRA_SID_AON>,
                   <&{/rtcpu@b000000}    TEGRA_SID_RCE>,
@@ -1407,8 +1406,6 @@
         interrupt-map-mask = <0 0 0 0>;
         interrupt-map = <0 0 0 0 &intc 0 72 0x04>;// check this

-        #stream-id-cells = <1>;
-
         bus-range = <0x00 0xff>;
         #address-cells = <3>;
         #size-cells = <2>;

Thank you very much. It works perfectly!

Best regards,
Huy Duong