Commit Graph

21 Commits

Author SHA1 Message Date
cyeddu
2e075e123d nvscic2c-pcie: Fix Top25 CWE CERT-C violations
Fix total 48 violations of below CERT-C rules:

CERT ARR30-C - 1
CERT EXP34-C - 1
CERT INT08-C - 20
CERT INT30-C - 20
CERT STR07-C - 4
CERT STR31-C - 1
FORWARD_NULL - 1

JIRA NVIPC-3120

Change-Id: I2b9b35e97fe6968ec4c656cdcdd01a764640033c
Signed-off-by: Anjanii <amohil@nvidia.com>
Signed-off-by: Janardhan Reddy <jreddya@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3263785
Reviewed-by: Deepak Kumar Badgaiyan <dbadgaiyan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
2025-07-24 10:19:17 +00:00
chandra
9dc7f5a20f nvscic2c-pcie: Fix MISRA rule 10.3 violations
Fix total 62 violations of rule 10.3

JIRA NVIPC-3121

Change-Id: I1eae97bdbd8e1b41363469a42c66c23e8899603f
Signed-off-by: cyeddu <cyeddu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3250504
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
chandra
414c0b4cf7 nvscic2c-pcie: Fix MISRA rule 10.4 violations
Fix total 65 violations of rule 10.4

JIRA NVIPC-3121

Change-Id: I5a1bead886683cbe3ec4b0e68531ee6e2a149175
Signed-off-by: cyeddu <cyeddu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3246908
Reviewed-by: Janardhan Reddy AnnapuReddy <jreddya@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: Janardhan Reddy AnnapuReddy <jreddya@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
2025-07-24 10:19:12 +00:00
Deepak Badgaiyan
d1f2b6a051 nvscic2c: Add Thor support
Configure BAR and MSI for Thor.

Add checks for chip id for chip specific code
between Orin and Thor.

Separate Stream ID's are assigned to upstream and downstream
struct device in Rootport client driver.
While accessing Rootport local memory upstream Stream ID should be used.
While accessing memories over BAR downstream Stream ID should be used.

Jira NVIPC-2877
Jira NVIPC-2484

Change-Id: I67df4b78e57b6de36f9bfaf966978f7ee875d596
Signed-off-by: Deepak Badgaiyan <dbadgaiyan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3226748
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
Reviewed-by: Janardhan Reddy AnnapuReddy <jreddya@nvidia.com>
Reviewed-by: Sivagamy Govindasamy <sivagamyg@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:11 +00:00
chandra
20c4af34ac nvscic2c-pcie: Fix Top25 CWE CERT-C violations
Fix total 13 violations of rule CERT-C EXP34-C and EXP39-C

JIRA NVIPC-3120

Change-Id: Ie96f1a93964a019645ecf38a338efa5768ca24fc
Signed-off-by: chandra <cyeddu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3261129
Reviewed-by: Janardhan Reddy AnnapuReddy <jreddya@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:11 +00:00
chandra
e946c2cbcc nvscic2c-pcie: Fix Top25 CWE CERT-C violations
Fix total 20 violations of rule CERT-C EXP34-C

JIRA NVIPC-3120

Change-Id: I1e8940269a2859a0483215cf44170dd669f637ea
Signed-off-by: chandra <cyeddu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3260920
Reviewed-by: Janardhan Reddy AnnapuReddy <jreddya@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
2025-07-24 10:19:11 +00:00
Janardhan Reddy
1fb5a4f931 nvscic2c-pcie: Fix edma error reporting issue
pci_client abstraction supports notification to application.
Each endpoint has to register with pci_client for notification which
return link_event_id after registration.
link_event_id is index in lookup table with total size as MAX_ENDPOINT.
This link_event_id is allocated sequential and does not match with ep_id
which is endpoint index with max as MAX_ENDPOINT.

stream-extension is not aware about link_event_id and uses ep_id for
notification which leads to mismatch in look up table finally dropping
notification.

Registering for link event in sequential manner does not help much as
registration against ep_id will make lookup table and endpoint database
one-to-one mapping.

Update endpoint registration for link event based on ep_id and use ep_id
in lookup table for notification purpose.

Bug 4913236

Change-Id: I75bfdbf0e8e5b7b11b0cca7dc266f01f492362f6
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233789
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Tested-by: Janardhan Reddy AnnapuReddy <jreddya@nvidia.com>
2025-07-24 10:19:10 +00:00
Janardhan Reddy
cfaad9cd6d nvscic2c-pcie: Add Buffer limts per endpoint
Address security ARR: DOS60-REQ-7169 in streaming mode.
Add per endpoint streaming mode buffer limits.

Bug 4883175
JIRA NVIPC-2453

Change-Id: I31edb2bacf4a8af560e7e6da7d378da874d105bd
Signed-off-by: Janardhan Reddy <jreddya@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3196300
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:07 +00:00
Arihant Jejani
6a2c18b943 misc: nvscic2c-pcie: fix leak/lock in deinit
- Fix missing leak for epc_ctx when probe() fails nvscic2c-pcie-epc
 - Fix mutex lock/unlock for syncpoint fence operations.

Bug 4539983

Change-Id: I18272f991d6d9821ff1a7e13e9b4807cef20d92f
Signed-off-by: Arihant Jejani <ajejani@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3087303
Reviewed-by: Deepak Kumar Badgaiyan <dbadgaiyan@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-02 09:10:48 -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
d0e427c6e1 drivers: Use conftest for vm_flags
The conftest script has a test for checking if the vm_area struct has a
const vm_flags member. So enable this test and use the definition
generated in the appropriate drivers.

Bug 4374520

Change-Id: I0e7bd105fe8a821b0af23c0a5553b8d4468fa8c4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026924
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-06 16:36:32 -08:00
Laxman Dewangan
9ce6a359f7 nvscic2c-pcie: Use vm_flags_set() APIs for Linux 6.3 and later
The VM flag is set via the API vm_flags_set() provided from core kernel
from Linux 6.3 and above. Use this API to set the flag.

Bug 4374520

Change-Id: If09eea1d03de8ac05aac692879a52f0f74eca251
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3014990
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-13 06:44:41 -08:00
Jon Hunter
ce678a37b1 drivers: Add conftest test for class_create
In Linux v6.4, the module pointer argument is removed from the
class_create() function. Add a test to the conftest script that checks
if this argument for the class_create() function has been removed and
use the definition created by conftest to select which version of the
function is used.

Bug 4183168
Bug 4221847

Change-Id: I440e4b318001886cd0319bb3499ba33178475e8c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989020
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-05 17:54:05 -07:00
Jian-Min Liu
719d3fa024 nvidia-oot: use TEGRA_SYSTEM_TYPE_ACK as ack macro
Use config TEGRA_SYSTEM_TYPE_ACK to control kernel builds only
base on the system type which also aliged to Makefile use.

Bug 4223187

Change-Id: I276208d180d1b3459eccb80d8fdb818f4507d3df
Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2966713
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-24 23:32:04 -07:00
Bruce Xu
db10888783 nvidia-oot: set/clear vm_flags via function
In new kernel, need to update vm_flags via kernel
provided function. Otherwise below error is met:
./include/linux/mm_types.h:476:20: note: non-static data member
'vm_flags' declared const here
                const vm_flags_t vm_flags;
                ~~~~~~~~~~~~~~~~~^~~~~~~~
1 error generated.

Bug 4196760

Change-Id: I03455af7ce3623d0d8a0f0cd56d569ef3c7af9ea
Signed-off-by: Bruce Xu <brucex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2938942
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-11 05:19:43 -07:00
dbadgaiyan
3067ceeb00 nvscic2c-pcie: add support for error handling
Enable AER reporting for ednpoint.

Provide error handler for AER reception and
update error code to be read by user space process.
Change PCIe link to down.

Implement error reporting for runtime eDMA xfer errors.

Bug 4088959
Jira NVIPC-334

Change-Id: I74871e5226eab1b708c72aa71216cd160c6ebf68
Signed-off-by: dbadgaiyan <dbadgaiyan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2915753
(cherry picked from commit 7b24941fb486ada70229c42ae1deec12f75028c2)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921480
Reviewed-by: Arihant Jejani <ajejani@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-19 12:29:40 -07:00
Arihant Jejani
0e6d4c804f nvscic2c: Implement Read-After-Write ordering WAR
- Ordering between message/data and host1x syncpoints is not enforced
   strictly.
 - Out of the possible WARs, implement dummy PCIe Read between
   data/message write and notifications towards peer / remote post-fences.
 - WAR: (IPC/messaging mode)For any UMD produced data towards peer,
   before notification is triggered, issue a dummy PCIe read  via CPU.
 - WAR: (streaming mode)DMA flush-ranges(data), wait for DMA interrupt,
   when success issue dummy PCIe reads via CPU on remote post-fences
   + issue CPU PCIe writes on each remote post-fence. To achieve this,
   CPU map every imported sync object.

NVIPC-974

Change-Id: Id6711d372c0a35e13e399ffbbcd8efcabf147c56
Signed-off-by: Arihant Jejani <ajejani@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2912894
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Janardhan Reddy A <jreddya@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-31 18:41:36 -07:00
Shardar Mohammed
83000c2754 misc: nvscic2c-pcie: fix build errors
Fix build errors when this driver compiled against K6.1 (kernel-oot)
- Remove dma-iommu.h header inclusion as its not present in K6.1
- Define IOVA_RANGE_CACHE_MAX_SIZE if this macro is not defined
- Import DMA_BUF "MODULE_IMPORT_NS(DMA_BUF);" to avoid below error
"ERROR: modpost: module nvscic2c-pcie-epc uses symbol dma_buf_* from
 namespace DMA_BUF, but does not import it"

Bug 3978996

Change-Id: Idd9a53b19c63467583b87f64ffa2c2e888ac02e1
Signed-off-by: Shardar Mohammed <smohammed@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2898149
Reviewed-by: Deepak Kumar Badgaiyan <dbadgaiyan@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-09 05:25:54 -07:00
dbadgaiyan
38371d55ab drivers: misc: Fix sparse issues
poll() expects return as __poll_t which is defined as
unsigned __bitwise.
returning poll mask directly leads to sparse warning.
fix sparse warning by typecasting masks explicitly.

Bug 3954363

Change-Id: Ic7717765831f4014cdc2cdb5f6d1fd77186d8a75
Signed-off-by: dbadgaiyan <dbadgaiyan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2861400
Reviewed-by: Arihant Jejani <ajejani@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-24 04:06:26 -08:00
dbadgaiyan
f2088fd15d misc: nvscic2c-pcie: Update nvscic2c-pcie license
Modify nvscic2c-pcie files to use updated licenses
as per nvidia-oot.

Bug 3739487
Jira C2C-826

Change-Id: I819b459fdb0743d37bc08b4c9b92097d87e62884
Signed-off-by: dbadgaiyan <dbadgaiyan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2830686
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arihant Jejani <ajejani@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-22 20:29:46 -08:00
dbadgaiyan
4adc5c8fb4 drivers: misc: add nvscic2c-pcie in OOT
nvscic2c enables xfer between two SoC connected over PCIe.
nvscic2c already available with K5.10

Major changes in nvscic2c-pcie for K5.15:
 Integrate with upstream PCIe endpoint function changes.

 Allocate new IOVA domain to be used for
 empty IOVA allocation.
 This IOVA range would be used in iommu_map() to map
 physical backing with IOMMU domain attached in PCIe device.

 Migrate from nvhost to host1x and tegra-drm interfaces.

Bug 3739487
Jira C2C-826
Jira C2C-830

Change-Id: Ic4d8ac680921807fb17247855ca7037623681cb7
Signed-off-by: dbadgaiyan <dbadgaiyan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2810806
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Arihant Jejani <ajejani@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-15 20:52:33 -08:00