Jetpack 4.2.1 on Tegra Tx2: facing issue in booting after updating dtb file

Hi,

We updated tegra Tx2 with latest Jetpack version and its booting fine.

We need to disable iommu for Pcie controller as our driver has this requirement
To do this we followed

  1. Extracted dts file ( extracted_proc.tx) on the running tegra using dtc tool

  2. Modified it by deleting
    pcie-controller@10003000 {
    iommu_sodev_map;
    iommus = <0x11 0x11>;
    }

  3. after this generated dtb file(tegra186-quill-p3310-1000-c03-00-base.dtb) using dtc tool

  4. copied this to linux_for_tegra/kernel/dtb

After that followed the flash steps to reflash it . Flashing successful . But not booting .

  1. Could you please check if the above steps are correct?
  2. Can we disable IOMMU for pcie in jetpack 4.1 ?
  3. Are the dts file changes correct?

extracted_proc.txt (462 KB)
extracted_proc_iommu_pice_disabled.txt (461 KB)

Just removing “iommus = <0x11 0x11>;” should suffice. It is not required to remove “iommu_sodev_map;” entry.

we tried by commenting this line alone also. Still we see its hung while booting .

We don’t have uart console or display to get the debug log.

Could you please guide us how to debug in such as case to know where it is get stuck at booting?

Do this line also need to be removed.

pcie_as = “/iommu@12000000/address-space-prop/pcie_as”;

Could you please test once after disabling iommu for Pcie on jetpack 4.2.1 kernel 32.2 and share the dts files to me and steps followed to update the new dtb file

I’ll check it internally and update in some time.

Hi,
Following is the only change required 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 9f0d21b1ca04..f342dc2a6ab1 100644
--- a/kernel-dts/tegra186-soc/tegra186-soc-base.dtsi
+++ b/kernel-dts/tegra186-soc/tegra186-soc-base.dtsi
@@ -1846,8 +1846,8 @@
                interrupt-map-mask = <0 0 0 0>;
                interrupt-map = <0 0 0 0 &intc 0 72 0x04>;// check this

-               iommus = <&smmu TEGRA_SID_AFI>;
-               iommu_sodev_map;
+//             iommus = <&smmu TEGRA_SID_AFI>;
+//             iommu_sodev_map;
 #if LINUX_VERSION >= 414
                iommu-map = <0x0 &smmu TEGRA_SID_AFI 0x1000>;
                iommu-map-mask = <0x0>;

Once, new DTB is compiled, copy it to OUT folder’s kernel/dtb/ sub-folder and update only DTB file using the following command

sudo ./flash.sh -k kernel-dtb jetson-tx2 mmcblk0p1

Thanks for your information. I am able to boot the tegra with PCIE IOMMU disabled .
We confirmed it by looking into ls /sys/kernel/debug/12000000.iommu/masters/

13e10000.host1x 13e10000.host1x:ctx4 15100000.tsecb 154c0000.nvenc 15820000.se 2600000.dma 3160000.i2c 31e0000.i2c 3507000.ahci-sata b000000.rtcpu c280000.serial
13e10000.host1x:ctx0 13e10000.host1x:ctx5 15210000.nvdisplay 15500000.tsec 15830000.se 2993000.adsp 3180000.i2c 3210000.spi 3510000.hda c1a0000.aon d000000.bpmp
13e10000.host1x:ctx1 13e10000.host1x:ctx6 15340000.vic 15600000.isp 15840000.se 3100000.serial 3190000.i2c 3240000.spi 3530000.xhci c240000.i2c smmu_test
13e10000.host1x:ctx2 13e10000.host1x:ctx7 15380000.nvjpg 15700000.vi 17000000.gp10b 3110000.serial 31b0000.i2c 3400000.sdhci 3550000.xudc c250000.i2c sound
13e10000.host1x:ctx3 150c0000.nvcsi 15480000.nvdec 15810000.se 2490000.ether_qos 3130000.serial 31c0000.i2c 3460000.sdhci aconnect@2a41000:adsp_audio c260000.spi

We loaded the drive successfully. We are no trying to call ioctl read and we see this

“Internal error: Accessing user space memory outside uaccess.h routines: 96000005 [#1] PREEMPT SMP”

But the same driver is working on same hardware in Jetpack 3.3 .Could you please guide us why we see this error?

I don’t have much insight into what your driver is doing exactly, but, it looks like you are trying to access user space memory without getting necessary permissions/without converting properly in kernel space. I think you have to just read the kernel Documentation and do it in a proper way. Well, the fact that it was working in Jetpack 3.3 doesn’t help here much as we keep upgrading kernel with patches from upstream. So, unless we write drivers following kernel guidelines, things may break at any time.

Thanks for your information.
With the 3 config params changed in default tegra_defconfig iam able to solve this error
“Internal error: Accessing user space memory outside uaccess.h routines: 96000005 [#1] PREEMPT SMP”.

CONFIG_ARM64_SW_TTBR0_PAN is not set

CONFIG_ARM64_LSE_ATOMICS is not set

CONFIG_ARM64_UAO is not set

If we enable this then what driver code need to be modified i will check later.