I tried using the patch from Force rescan of PCIe bus? - #6 by vidyas and now lspci shows the the PCI bridges and now it detects some device and outputs something to dmesg when I do a rescan but lspci does not show useful information and there is still not /dev/nvme device.
Before attaching NVMe:
user@tx2:~$ lspci
00:01.0 PCI bridge: NVIDIA Corporation Device 10e5 (rev a1)
00:03.0 PCI bridge: NVIDIA Corporation Device 10e6 (rev a1)
After attaching NVMe and executing echo 1 > /sys/bus/pci/rescan
user@tx2:~$ lspci
pcilib: Cannot open /sys/bus/pci/devices/0000:02:00.0/config
lspci: Unable to read the standard configuration space header of device 0000:02:00.0
00:01.0 PCI bridge: NVIDIA Corporation Device 10e5 (rev a1)
00:03.0 PCI bridge: NVIDIA Corporation Device 10e6 (rev a1)
The dmesg output when I remove and rescan the PCI bridge:
[ 83.832311] pcie_pme 0000:00:01.0:pcie001: unloading service driver pcie_pme
[ 83.832401] aer 0000:00:01.0:pcie002: unloading service driver aer
[ 83.832464] pci_bus 0000:01: busn_res: [bus 01] is released
[ 83.832563] iommu: Removing device 0000:00:01.0 from group 55
[ 94.948917] pci 0000:00:01.0: [10de:10e5] type 01 class 0x060400
[ 94.949044] pci 0000:00:01.0: PME# supported from D0 D1 D2 D3hot D3cold
[ 94.949308] iommu: Adding device 0000:00:01.0 to group 55
[ 94.949317] arm-smmu: forcing sodev map for 0000:00:01.0
[ 94.949559] pci_bus 0000:01: busn_res: can not insert [bus 01-ff] under [bus 00-ff] (conflicts with (null) [bus 02])
[ 94.949566] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[ 94.949636] pci 0000:02:00.0: [144d:a808] type 00 class 0x010802
[ 94.949694] pci 0000:02:00.0: reg 0x10: [mem 0x00000000-0x00003fff 64bit]
[ 94.950267] iommu: Adding device 0000:02:00.0 to group 57
[ 94.950274] arm-smmu: forcing sodev map for 0000:02:00.0
[ 94.950368] pci_bus 0000:02: busn_res: [bus 02] end is updated to 02
[ 94.950669] pcieport 0000:00:01.0: Signaling PME through PCIe PME interrupt
[ 94.950676] pcie_pme 0000:00:01.0:pcie001: service driver pcie_pme loaded
[ 94.950782] aer 0000:00:01.0:pcie002: service driver aer loaded