Commit Graph

100 Commits

Author SHA1 Message Date
Nagarjuna Kristam
b55db09752 pci: epf: dma-test: Fix free_irq during remove
Issue: epf-dma-test driver uses MSI IRQ for CRC handling, however, different
IRQ is used when free the same.

Fix: Correct IRQ number to free. Correct ordering of free_irq and
platform MSI irq free.

Bug 4820157

Change-Id: Idbbaed61ddbd45a52e8e833e76c6b64f0fd3e48f
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3204910
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:07 +00:00
Jon Hunter
951b2423a8 drivers: Fix platform_driver remove for Linux v6.11
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update all the impacted drivers
as necessary to fix this.

Bug 4749580

Change-Id: I3bb5c549777f7ccad0e3f870373fdd25726ad7ed
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3182878
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-11 17:20:34 -07:00
Jon Hunter
b0ff4f1358 pci: endpoint: Update drivers for Linux v6.11
For Linux v6.11, the 'pci_epc_event_ops' structure 'core_init' callback
was renamed to 'epc_init' and a new 'epc_deinit' callback was added.

Update the PCI endpoint drivers for Linux v6.11 by:

 1. Adding tests to conftest to detect the presence of 'epc_init' and
    'epc_deinit'.
 2. Update the drivers as necessary to use the appropriate callback
    depending upon what is present in the kernel.

Bug 4749580

Change-Id: Ife7e2d5d18332bf84f22142c9727dc1ece913c49
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3186686
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-08-05 12:28:50 -07:00
Nagarjuna Kristam
6a29330225 pci: epf: dma-test: Use predefined macros for MSI
Use pre-defined  MSI interrupt numbers for read, write and CRC.

Bug 4779415

Change-Id: I03fd5c9d5f955c2aeefdf26b2fb7d10a2b080d5b
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3186459
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
2024-08-05 12:27:32 -07:00
Nagarjuna Kristam
38bbe2a3b0 pci: endpoint: functions: dma-test: Remove read and add IRQ handling
Remove readtest debugfs, as same can be achieved from regular DMA tests.
Add RP IRQ handling to calculate CRC.

Bug 4747330

Change-Id: Iac07195eb3fcc05b8af16ca6d7e5e8849b14a98c
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3184953
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2024-08-02 16:44:06 -07:00
Nagarjuna Kristam
c0896b1af7 pci: epf: dma-test: Clear bar only for T23x
During EP deinit, BAR is cleared. However, For T26x, this notification
is triggered from stop() ops callback. Both stop and clear bar executes
on EPC mutex lock, resulting in deadlock.
Since during EP deinit all EP registers are cleared, clear_bar execution
is not needed.

Bug 4567932

Change-Id: I7b28a85a4da51bdaf5228b6462fb723758c46753
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3171420
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-07-13 12:45:34 -07:00
Jason Mei
b8d1d9a28e PCI: EPF: tvnet: disable the edma interrupt
1. Disable the corresponding PCIe EP controller
   EDMA interrupt.
2. Disable IP checksum to improve performance
   since the PCIe link is reliable.
3. DMA unmap matches the map size.
4. Adjust the SKB buffer link list handle.

Bug 4704944

Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Change-Id: I05f76fa60e3533c2dd01e53ed17664d6898fcffd
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3158126
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3164057
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
2024-07-13 12:35:19 -07:00
Jon Hunter
d449f6cfd6 PCI: EPF: dma-test: Fix build for Linux v6.10
In Linux v6.10, the 'core_init_notifier' flag has been removed and
dw_pcie_ep_init_notify() is now called by the designware endpoint driver
so it is not necessary to call from the EPF DMA test driver. Add a test
to the conftest script to detect the presence of the
'core_init_notifier' flag and update the EPF DMA test driver as
necessary.

Bug 4593750

Change-Id: I1c3862df2c673fcb2d7c19ebbf5e7d1cbdefea1f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3152309
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-07-13 02:47:36 -07:00
Laxman Dewangan
13027c8c90 pci: Port pci-epf-tegra-vnet to support 5.14.0
Most of the code in the file pci-epf-tegra-vnet.c is written
to support the linux kernel version 5.14.x (x != 0), all minor
version above 0.
Make the condition of linux version check such that 5.14.0 is
also part of 5.14.x i.e. (5.14).

Jira HOSTX-5375

Change-Id: Ib3d7ca619497761b8bc77796c9fe0f59c2ab9cf8
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3166767
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-07-03 07:47:55 -07:00
Laxman Dewangan
00a95facef pci: Add conftest to determine if msi_get_virq() present
The API msi_get_virq() get added by commit 98043704f375 ("genirq/msi:
Make msi_get_virq() device domain aware") in Linux v6.1. Use
conftest to determine if this API is available or not.

Jira HOSTX-5375

Change-Id: I5e4cef9622d852fc889d9652e6631a79f2d21f9b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3166766
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-07-03 07:47:50 -07:00
Laxman Dewangan
b260a8f442 pci: Use conf test to determine API change of pci_epc_write_header()
Add conftest to determine if the pci_epc_write_header() has the vfn
argument or not.

Commit 53fd3cbe5e9d791("PCI: endpoint: Add virtual function number
in pci_epc ops") added virtual function number as argument in the
APIs in Linux 5.14.

Jira HOSTX-5375

Change-Id: Ib0b1fbc2a33f9159f3497374d253e264a90f7b4d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3166765
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-07-03 07:47:40 -07:00
Manikanta Maddireddy
49bb1dec11 PCI: EPF: dma-test: Add outbound ATU test function
PCIe endpoint controller supports 8 outbound channels to map Root port
address and access it as memory mapped IO. Add test function to verify
this feature.

Bug 4705051

Change-Id: I126e94619c581ed15f1d6db54845de209742af0e
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3163953
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
2024-07-01 14:38:00 -07:00
Laxman Dewangan
1cf1d3f858 pcie: private-soc: Add dummy driver for soc specific pcie driver
The L4T packaging needs the soc specific dummy driver to be
available always. However, it is not available in generic build and
it creates the packaging/configuration fail.

Add soc specific dummy driver for pcie so that the respective binary
should be available always.

Bug 4695516

Change-Id: Ic40e60a12de35cebc7e9acec9b09e39aa267276b
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3154314
Tested-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2024-06-13 10:15:06 -07:00
Jon Hunter
cb8b9f5a53 drivers: Fix missing vmalloc.h for Linux v6.10
Upstream commit 690da22dbfa8 ("asm-generic/io.h: kill vmalloc.h
dependency") removed the vmalloc.h header file from io.h and this breaks
building various drivers with the latest -next kernels. Fix this
by ensuring vmalloc.h is included and in most cases slab is not actually
needed and so remove this where possible. Note that it is fine to make
this change for all current supported kernels.

Bug 4593750

Change-Id: I003d1302bda226d356467e6ede99949b2716940a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3141984
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-22 09:19:24 -07:00
Manikanta Maddireddy
a77ffaf1d0 PCI: EPF: dma-test: Fix BAR and MSI allocations
Fix BAR-1 and BAR-2 allocations for T264. Platform MSI is supported in
T264 only, fix the chip_id comparision check so that MSI is allocated
only for T264.

Bug 4549851

Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Change-Id: I13dad41375e607d78c6a99924ed6fef0c9113208
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3131939
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2024-05-09 19:35:55 -07:00
Jason Mei
fe07e96ce3 PCI: EPF: Add lpci_epc_map_addr for pre-v5.15 Linux kernels
Build the Tegra PCI vnet driver fails with Linux v5.14 because the
lpci_epc_map_addr() have the incorrect number of arguments.
The arguments to the lpci_epc_map_addr() functions were updated
in Linux v5.12 but the current Tegra PCI EPF driver assumes that they
were updating after Linux v5.14. Update the Tegra PCI EPF driver to
use the correct arguments for v5.12 onwards.

Bug 4456727
Bug 4451567

Change-Id: Ie4ef36854d380e0a896a0f256d846ab8b89ca447
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3070170
(cherry picked from commit 5a65235c0d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3084983
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
2024-05-07 02:15:17 -07:00
Laxman Dewangan
a1d5f342d5 pcie: endpoint: Add support to build with k6.9
Few of the APIs from msi are deprecated in the
kernel 6.9. These APIs are:
  platform_msi_domain_alloc_irqs
  platform_msi_domain_free_irqs

The change is with commit commit 1a4671ff7a903e87 ("platform-msi: Remove
unused interfaces")

Add support to not use these APIs via conftest.

Bug 4471899

Change-Id: I3b07236eeb69900b06c4e17b7675f6419b8321e4
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3131464
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-05 07:50:31 -07:00
Manikanta Maddireddy
b0c580762b PCI: Add T264 PCIe DMA support in PCIe EPF and client driver
Replace the exisiting T234 DMA APIs with common APIs and also add chip
specific changes like BAR.

Bug 4549851

Change-Id: I021e1e93a4fa4ff1d4429bd9db852e0e707ba879
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3116906
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-04 16:43:14 -07:00
Jason Mei
df830d411d PCI: EPF: tvnet: fixed the fence memory issue
1.Make the allocate_fence() thread-safe
2.Update the fence_do_work according to auto
  fix: https://nvbugs/4539983
3.Shouldn't creat fence in callback
4.There was typo which mixed ctrl with data.

Bug 4456727
Bug 4451567

Change-Id: If7676c8d77dc40bd5f77927efa7616e7970da183
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3087944
(cherry picked from commit 396db89160)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3096906
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-05-03 14:44:42 -07:00
Brad Griffis
f67a6565fb pci: endpoint: use conftest for pci-epf-tegra-vnet.c
There are several build issues observed in pci-epf-tegra-vnet.c
when building against mainline.

These errors pertain to the following previous commits:

* Use conftest to find if pci_epc_event_ops struct has core_deinit.
* pci: Use conftest to find if probe of pci_epf_driver has ID arg
* misc: nvscic2c-pcie: Drop usage of enum pci_epc_irq_type from Linux 6.8

The pci-epf-tegra-vnet.c is recently added and needs to use those
same new conftest capabilities.

Bug 4346767

Change-Id: I4ea66524513cdc4d62607a061c3f253e2a3cee2b
Signed-off-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3128608
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
(cherry picked from commit b0e75c8874)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3130622
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-05-03 14:44:32 -07:00
Brad Griffis
cdbedbf31e drivers: pci: Fix the argument of iommu_map() for Linux v6.3
There is additional argument added in iommu_map() from Linux v6.3.
Pass the proper argument from the driver who are using this
APIs. Using conftest methods for differentiating whether
additional argument is needed or not.

Bug 4374520

Change-Id: I3d6452cf6c71f495e3b6e3b240b2c2d839aa4b0d
Signed-off-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3128547
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
(cherry picked from commit 222eebeb31)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3130621
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-05-03 14:44:22 -07:00
Jason Mei
d99e65db74 PCI: EPF: tvnet: porting the PCIe tvnet driver
Port the PCIe tvnet to 5.15 kernel

Bug 4456727
Bug 4451567

Change-Id: I1b7a68479749145eca33361d6c79d53622c57ce7
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3070167
(cherry picked from commit e70b9e4c10)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3084980
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-05-03 14:44:12 -07:00
Jason Mei
217da833a0 net: Use conftest to determime NAPI interface
Add compile time tests to the conftest.sh script
to determine netif_napi interface check at compile
time for the kernel being used. This is beneficial
for working with 3rd party Linux kernels that may
have back-ported upstream changes into the kernel
and so the kernel version checks do not work.

Bug 4456727
Bug 4451567

Change-Id: I7b00c3b491d778a9bf2f0d1069a5e4546b722e2a
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3096002
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
(cherry picked from commit 888f248ee2)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3096946
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-05-03 14:44:07 -07:00
Jason Mei
0510889913 PCI: EPF: tvnet: porting the PCIe EP tvnet driver
Port the PCIe EP tvnet to 5.15 kernel
switch to host1x sycpt method and others kernel
interfaces

Bug 4456727
Bug 4451567

Change-Id: I78a1ed5e1f80210a03dc83775937ba90c2839a5b
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3070173
(cherry picked from commit 3506076764)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3084981
Tested-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-05-03 14:42:54 -07:00
Jon Hunter
971680aadb PCI: Fix endpoint DMA test for Linux v6.9
Building the PCI EPF DMA test driver for Linux v6.9 is failing because
the parameters for the pci_epf_alloc_space() function has been updated
to pass the alignment value via the 'pci_epc_features' structure instead
of passing the value directly.

Instead of hard-coding the endpoint alignment in the EPF DMA test driver
use the 'pcie_epc_get_features()' function to retrieve the endpoint
features structure which has the endpoint alignment.

By using the conftest script to detect the parameters for the
pci_epf_alloc_space() function, we can then pass the appropriate
arguments to the pci_epf_alloc_space() function.

Bug 4471899

Change-Id: Id80259a4c90d6f6ae2132cccbec1a96113d22be7
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3116548
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-04-18 01:14:35 -07:00
Manikanta Maddireddy
fc47fbceba PCI: Fix PCIe Endpoint device IDs
PCIe device ids 0x229a and 0x229c belongs to Root port, so this driver
is binding instead of pcieport. Tegra PCIe Endpoint production device ids
are 0x1ad4 and 0x1ad5, correct the device ids accordingly.

Bug 4477934

Change-Id: Ia86c4dcc6b4527e984a473c941713ef58dd6f74d
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3067109
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-02 04:21:13 -08:00
Laxman Dewangan
932f9757ab misc: nvscic2c-pcie: Drop usage of enum pci_epc_irq_type from Linux 6.8
The enum pci_epc_irq_type is dropped from Linux 6.8 with
commit 74955cb8ccc385 ("PCI: endpoint: Drop PCI_EPC_IRQ_XXX definitions")
Use alternative definition from mainline.

Bug 4448428

Change-Id: Ic248ee2522f171c311ac1086c2792bcf3ad6ed64
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3062520
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-25 17:26:42 -08:00
Jon Hunter
ab65399274 drivers: Fix missing headers for Linux v6.8
For Linux v6.8, commit ef175b29a242 ("of: Stop circularly including
of_device.h and of_platform.h") updated the OF headers included by these
header files. This breaks the build for various drivers and so fix this
by including the headers that are actually needed for each driver.

Bug 4448428

Change-Id: Ia40ab13f865d5631c96855ecc49145848f99c996
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032442
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
2024-01-25 09:11:21 -08:00
Nagarjuna Kristam
e94216eeb9 pci: tegra-edma: add check for irq sync
Issue:
When AER error received during PCIe driver(c2C) probe, it results in
EDMA driver de-initing and AER handling happening at same time. PCIe
driver probe happens inside device lock and so is AER handling.
synchronize_irq() done by EDMA driver causes dead lock with AER device
lock.

Trace at RP hot-plug:
[  605.149061] INFO: task irq/344-tegra_p:394 blocked for more than 120 seconds.
<3>[  605.149066]       Not tainted 5.10.120-rt70-tegra #1
<3>[  605.149068] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
<6>[  605.149070] task:irq/344-tegra_p state:D
<6>[  605.149071] sched_debug_info: last_run_cpu 0 wake_cpu 0
<6>[  605.149073]  on_cpu 0 on_rq 0 migrate_dis 0
<4>[  605.149074]  stack:    0 pid:  394 ppid:     2 flags:0x00000028
<6>[  605.149077] Call trace:
<6>[  605.149078]  __switch_to+0xc8/0x120
<6>[  605.149090]  __schedule+0x334/0x930
<6>[  605.149095]  schedule+0x64/0x120
<6>[  605.149097]  synchronize_irq+0x8c/0xc0
<6>[  605.149101]  edma_stop+0x1ac/0x320
<6>[  605.149105]  tegra_pcie_edma_deinit+0x60/0x170
<6>[  605.149106]  nvscic2c_pcie_epc_probe+0x3ec/0x4a0 [nvscic2c_pcie_epc]
<6>[  605.149120]  pci_device_probe+0xe8/0x1a0
<6>[  605.149123]  really_probe+0xf8/0x3d0
<6>[  605.149126]  driver_probe_device+0x60/0xc0
<6>[  605.149128]  __device_attach_driver+0x8c/0xd0
<6>[  605.149130]  bus_for_each_drv+0x8c/0xe0
<6>[  605.149133]  __device_attach+0xf8/0x160
<6>[  605.149135]  device_attach+0x28/0x40
<6>[  605.149137]  pci_bus_add_device+0x5c/0xc0
<6>[  605.149141]  pci_bus_add_devices+0x40/0x90
<6>[  605.149142]  pci_bus_add_devices+0x6c/0x90
<6>[  605.149143]  pci_host_probe+0x50/0xd0
<6>[  605.149145]  dw_pcie_host_init+0x1c0/0x420
<6>[  605.149148]  tegra_pcie_config_rp+0x78/0x250
<6>[  605.149151]  tegra_pcie_prsnt_irq+0xb0/0x120

Trace at AER ISR at the same time:
<6>[  605.149335] Call trace:
<6>[  605.149336]  __switch_to+0xc8/0x120
<6>[  605.149339]  __schedule+0x334/0x930
<6>[  605.149342]  schedule+0x64/0x120
<6>[  605.149344]  __rt_mutex_slowlock+0xc4/0x150
<6>[  605.149346]  rt_mutex_slowlock_locked+0xb0/0x230
<6>[  605.149348]  rt_mutex_slowlock+0x88/0xf0
<6>[  605.149350]  __rt_mutex_lock_state+0x64/0xa0
<6>[  605.149352]  _mutex_lock_blk_flush+0x58/0x80
<6>[  605.149356]  _mutex_lock+0x28/0x40
<6>[  605.149358]  report_error_detected+0x34/0x120
<6>[  605.149361]  report_frozen_detected+0x30/0x40
<6>[  605.149363]  pci_walk_bus+0x68/0xc0
<6>[  605.149366]  pcie_do_recovery+0x154/0x1d0
<6>[  605.149368]  aer_process_err_devices+0xec/0x110
<6>[  605.149372]  aer_isr+0x154/0x1d0
<6>[  605.149374]  irq_thread_fn+0x34/0xa0
<6>[  605.149376]  irq_thread+0x188/0x280
<6>[  605.149379]  kthread+0x16c/0x1a0
<6>[  605.149381]  ret_from_fork+0x10/0x18

Fix:
Perform synchronize_irq() in EDMA de-init, only if there are any
descriptors pending processing. This acts as a WAR to avoid dead
lock during probe and any other shared interrupt handling in device
lock scope.

Bug 4414241

Change-Id: Ie389ebc3b32d6a1121c154ab60d08aa6c3c53e36
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3042451
(cherry picked from commit 2453fa2e09eafd23570f25091c5c1f9d92ed2aa4)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3047403
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-09 18:14:40 -08:00
Laxman Dewangan
0ed8b4e22a pci: Use conftest to find if probe of pci_epf_driver has ID arg
Use conftest to determine if the struct pci_epf_driver probe
API has ID argument or not

The additional argument as ID is added in probe() of the
struct pci_epf_driver with commit 081c715dfd5054 ("PCI:
endpoint: Pass EPF device ID to the probe function")
in Linux 6.4.

Bug 4346767

Change-Id: I004d1d3a8df922c0534c5631baa26f82f6992e4d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3030052
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-07 18:21:31 -08:00
Laxman Dewangan
1e9fc00bc2 pci: Use conftest to find if pci_epc_event_ops struct has core_deinit
Use the conftest to find if the struct pci_epc_event_ops has
core_deinit as callback function. This callback is added
by Nvidia in core kernel.

Bug 4346767

Change-Id: I399197917ac7746ca367f55b9dc4e3a5bd79f073
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028740
Reviewed-by: Shardar Mohammed <smohammed@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-07 18:20:56 -08:00
Laxman Dewangan
64b442b57d pci-epf: probe has additional APIs for Linux 6.6
The probe callback of driver "pci_epf_driver" has additonal
APIs as pci_epf_device_id for Linux 6.6 and above.

Add this new argument for Linux 6.6 and above.

Bug 4374520

Change-Id: Ie744a98947b895fce83f1a9df598ddbee2c3d138
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3014991
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-13 06:44:46 -08:00
Laxman Dewangan
dc69c0b58a pcie: Enable core_deinit only when core has implemented it
The core_deinit callback is the Nvidia internal feature
which is not upstreamed yet. Enable the call back from
OOT modules only when core have implemented this callback.

Bug 4374520

Change-Id: Iee2b92b7d70326ea3ce99ce6f6600d27f1e2896b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3014989
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-13 06:44:36 -08:00
Nagarjuna Kristam
55e4803b61 PCI: tegra194: Ring doorbell If DMA is not running
Issue:
During multi threaded testing, there are cases where EDMA HW enters
stopped state even through there are pending descriptors to process.
This happens even when doorbell is rung after updating descriptors and
barriers places.

Fix:
After processing channel interrupt, ring doorbell, if there are pending
descriptors and for that channel is not running.

Bug 4111305

Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2905177
Change-Id: I9d1bd391f690abc58cf262f62606c42504150b13
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2910921
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-30 07:40:00 -07:00
Nagarjuna Kristam
37956be9b4 PCI: EPF: dma-test: Remove dead code
pci-epf-dma-test is initially written with DMA programming part of
it. Now DMA driver is available separate and DMA programming part of
this driver conflicts with actual programming and results in unexpected
behaviour. Remove non DMA driver test interaction code.

Bug 4124875

Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2907365
Change-Id: Id86ea10d64c13381d4931aa742ba530e0295d10f
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2910916
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-30 07:39:29 -07:00
Nagarjuna Kristam
ffda313d72 PCI: tegra194: Fix edma desc size for remote EDMA
For Remote EDMA desc size is not updated and this results in
error during IRQ processing. Fix the same

Bug 4130564

Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2909597
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Change-Id: I5129f258a60139fe0f9e6c1226d0faf7c546f488
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2910912
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-30 07:39:08 -07:00
Nagarjuna Kristam
6a981ab712 PCI: EPF: dma-test: Fix Coevrity issues
Fix coverity issue of dead code and unreachable code.

Bug 3952896

Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Change-Id: I6ca4b485f6b053ea6787b76f3fae95d8f6914c98
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2905249
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-18 23:46:12 -07:00
Nagarjuna Kristam
0221df9441 PCI: edma: Fix Coverity Issues
Perform ULL typecast during total size calculation for numerics.

Bug 3956683

Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Change-Id: Id9671dc37ff8747a6390063cc92a038e355990cc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2881281
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 21:54:45 -07:00
Manikanta Maddireddy
6afc085f93 PCI: Create a empty Makefile as a placeholder
Create a empty Makefile as a placeholder to copy priviate SoC PCIe driver.

Bug 4000789

Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Change-Id: I38a900eacb8ada86b387e01bb4bfe7f40d08043b
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2870780
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 21:43:45 -07:00
Nagarjuna Kristam
ff5e03daaf PCI: edma: Fix Coverity Issues
Perform U64 typecast when calculating total size of all nents.

Bug 3956683

Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Change-Id: I7b489213cb4c994190b58b09a149b08dfa3ebba5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2876297
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-31 04:17:22 -07:00
Nagarjuna Kristam
a62b3e3686 pci: edma: Update SW ring before final PCS
Updated PCS to final descriptor after SW ring callback is updated.
Read back PCS and add mb to ensure write and read AI's of descriptor
are ordered before rining doorbell.

Bug 3747376
Bug 3960792

Change-Id: Ief7e6e91edb19571777c6f589da3e6262b4d24b3
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2778528
(cherry picked from commit df94316dc980657a66a2becbef94e21e52376a60)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2855011
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-10 23:45:32 -08:00
Nagarjuna Kristam
7e6a8f88f6 pcie: edma: Fix CERT issues
Fix CERT L2 issues.
Fixed CID's are 436308, 441509, 428257, 369367, 452877, 431183, 337589.

Bug 3798243
Bug 3877429

Change-Id: I672fb272e5c1ca3d3d67213412b18f58b5a6cef9
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2776714
(cherry picked from commit aad3f73328e78744fa56f68914074656a0915917)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2815930
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-29 04:17:32 -08:00
Manikanta Maddireddy
319fa69bd5 PCI: Add data integrity check for PCIe DMA
Add CRC check after PCIe DMA to verify data integrity.

Bug 3636902
Bug 3868928

Change-Id: If497ce769571c6c837acbfbbb64b2242dfabef26
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2718787
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2720336
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2815927
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Nagarjuna Kristam <nkristam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-29 04:17:18 -08:00
Nagarjuna Kristam
e1f7bf59ed PCI: EPF: dma-test: Use callback instead of notifier
EPF framework no longer supports notifers but supports callbacks instead.
Register callbacks for init and deinit.
Enable DMA test driver only if EP support is enabled.

Bug 3790460

Change-Id: Ic1e14cdc1a0bd80d49991b5f94713b705085825b
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2702389
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-15 11:19:59 -08:00
Jon Hunter
a600207e7d pci: epf: Fix build for pre-v5.15 Linux kernels
Build the Tegra PCI EPF driver fails with Linux v5.14 because the
pci_epf_alloc/free_space() have the incorrect number of arguments.
The arguments to the pci_epf_alloc/free_space() functions were updated
in Linux v5.12 but the current Tegra PCI EPF driver assumes that they
were updating after Linux v5.14. Update the Tegra PCI EPF driver to
use the correct arguments for v5.12 onwards.

Bug 3820317

Change-Id: Ieba44bfc22e0f978a5ff227b6d07a6a56ad23f3b
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2791670
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-20 02:19:35 -07:00
Jon Hunter
1733a8ddee pci: tegra: Fix build for Linux v6.1
Upstream Linux kernel commit f2042ed21da7 ("iommu/dma: Make header
private") made the header "linux/dma-iommu.h" a private header file and
so compiling the Tegra PCI EDMA driver for Linux v6.1-rc1 now fails
because this header is not found. On further review, instead of
including "linux/dma-iommu.h" it is only necessary to include
"linux/dma-mapping.h" instead.

Bug 3831575

Change-Id: I3552eca64071bba98bb322377d7c211e3c22e7b6
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2793515
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2022-10-18 11:24:47 -07:00
Manikanta Maddireddy
2db1b1e964 PCI: EPF: Use latest MSI accessors and iterator functions
MSI accessors and iterator functions are updated in Linux 5.16 version.
Use these function to fix build error.

Bug 3604749

Change-Id: Ibda5372ee743d5e224d0eef898c4cfc665107367
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2742830
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2022-07-13 16:40:29 -07:00
Nagarjuna Kristam
c18482299d PCI: controller: Add VF driver support
Add tegra PCIe VF driver support from Nvidia repo

Bug 3583632

Change-Id: I323ae5a7aaa20647bfd80404bc354a5a52097cce
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2736248
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-07-05 14:32:15 -07:00
Nagarjuna Kristam
87f4a51862 pci: epf: Add dma test function driver
Add DMA test function driver from Nvidia repro

Bug 3583632

Change-Id: I603d16f74cba2b4752ab31af59b12e7c784f042e
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2736247
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-07-05 14:32:06 -07:00
Nagarjuna Kristam
0d83600487 PCI: tegra194: Add PCIe EDMA and its RP drivers
Add PCI EDMA drivers from nvidia repo.

Bug 3583632

Change-Id: Id54bec8d70424d56d4b91f781568edbfa27c5a82
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2736242
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-07-05 14:32:02 -07:00