TX1 pci-tegra hotplug doesn't work
Dear Sir or Madam, we have a custom HW based on Jetson TX1 where a Cyclon V Soc is connected over PCIe to the TX1. Our SW is based now on the L4T 28.1 with kernel 4.4. We would like to use the PCIe hotplug feature provided by the pci-tegra driver, the gpio NFC_INT PI1 is prepared for this purpose. Our expectation is, that the kernel loads the pci-tegra driver asap but our PCIe device driver (CycV) will be loaded only after the hotplug gpio is getting active. If we let the pci-tegra driver run before the hotplug gpio is active the driver releases his own driver structure and if later the hotplug gpio triggers the isr the kernel generates panic. Detailed sequence in the pci-tegra.c: -pcie->num_ports remains 0 in the tegra_pcie_check_ports() because right after OS boot no PCIe endpoint is found -because pcie->num_ports == 0 the pcie_delayed_detect() releases the pcie driver structure -after the hotplug gpio is getting active the gpio_pcie_detect_isr will be called -the parameter "arg" passed in the isr contains random memory content, which can cause kernel panic in the scheduled work Is our expectation about the load sequence of the drivers proper? Thank you for your investigation
Dear Sir or Madam,
we have a custom HW based on Jetson TX1 where a Cyclon V Soc is connected over PCIe to the TX1. Our SW is based now on the L4T 28.1 with kernel 4.4. We would like to use the PCIe hotplug feature provided by the pci-tegra driver, the gpio NFC_INT PI1 is prepared for this purpose.
Our expectation is, that the kernel loads the pci-tegra driver asap but our PCIe device driver (CycV) will be loaded only after the hotplug gpio is getting active. If we let the pci-tegra driver run before the hotplug gpio is active the driver releases his own driver structure and if later the hotplug gpio triggers the isr the kernel generates panic.
Detailed sequence in the pci-tegra.c:
-pcie->num_ports remains 0 in the tegra_pcie_check_ports() because right after OS boot no PCIe endpoint is found
-because pcie->num_ports == 0 the pcie_delayed_detect() releases the pcie driver structure
-after the hotplug gpio is getting active the gpio_pcie_detect_isr will be called
-the parameter "arg" passed in the isr contains random memory content, which can cause kernel panic in the scheduled work
Is our expectation about the load sequence of the drivers proper?
Thank you for your investigation

#1
Posted 12/07/2017 08:48 AM   
Hi attila, We don't support pcie hotplug in Linux For Tegra SW release. The developer kit also does not have PRSNT pin routing. However, it may work if there is GPIO implementation in your HW board. You may grep the two keywords in pci-tegra.c: [code]tegra_pcie_prsnt_map_override() "nvidia,presence-detection-gpio"[/code] It may work by adding [code]pci@1,0 { nvidia,num-lanes = <4>; status = "okay"; + nvidia,presence-detection-gpio = <&_YOUR_GPIO_PIN_>; };[/code] Once again, please kindly notice that the result is not guaranteed.
Hi attila,
We don't support pcie hotplug in Linux For Tegra SW release. The developer kit also does not have PRSNT pin routing.

However, it may work if there is GPIO implementation in your HW board. You may grep the two keywords in pci-tegra.c:
tegra_pcie_prsnt_map_override()
"nvidia,presence-detection-gpio"


It may work by adding
pci@1,0 {
nvidia,num-lanes = <4>;
status = "okay";
+ nvidia,presence-detection-gpio = <&_YOUR_GPIO_PIN_>;
};


Once again, please kindly notice that the result is not guaranteed.

#2
Posted 12/08/2017 08:00 AM   
Although some code is present for hot plug, it is not supported. I think in this case, what you need (based on my understanding) is deferral of PCIe host controller probe function. If you know the time by which it needs to be deferred, you can input that in DT through 'nvidia,boot-detect-delay'. If you want to make it dynamic i.e. based on some other event, you may have to modify the code to start probing only after that event. You can use the same framework, i.e. in pcie_delayed_detect() API, you can have wait_for_completion() before proceeding further and the ISR registered for the GPIO which is indicating end point device readiness would send complete()
Although some code is present for hot plug, it is not supported.
I think in this case, what you need (based on my understanding) is deferral of PCIe host controller probe function.
If you know the time by which it needs to be deferred, you can input that in DT through 'nvidia,boot-detect-delay'.
If you want to make it dynamic i.e. based on some other event, you may have to modify the code to start probing only after that event.
You can use the same framework, i.e. in pcie_delayed_detect() API, you can have wait_for_completion() before proceeding further and the ISR registered for the GPIO which is indicating end point device readiness would send complete()

#3
Posted 12/08/2017 09:15 AM   
Scroll To Top

Add Reply