Commit Graph

15 Commits

Author SHA1 Message Date
Jon Hunter
cdc64f43fa drivers: Drop version check for DMA BUF namespace
The MODULE_IMPORT_NS macro adds a namespace tag to the module
information. The DMA_BUF namespace is required for Linux v5.16+ kernels
for drivers that use DMA BUF, there is no reason not to populate this
for earlier kernels. Furthermore, some 3rd party kernels prior to v5.16
may require this too and so drop the version check around the DMA BUF
namespace.

Bug 4119327

Change-Id: If8a5e90340f7a0582247cb91611d275ec1f4990e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2979260
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-13 22:21:25 -07:00
Chris Dragan
97835cded8 misc: mods: update copyright header
Bug 4165184

Change-Id: Id5d570cc4e5c3364d696271b1333e47e02e17b9e
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2976924
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-11 14:06:17 -07:00
Chris Dragan
0ae09fcdd1 misc: mods: clean-up copyrights
It is unnecessary to spell out license text when we are using
SPDX license identifiers.

Change-Id: I902e18a413126f4dddb0cbb1fb5c0e0de385d2a1
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2892356
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 02:51:21 -07:00
Chris Dragan
50850d5851 misc: mods: import module DMA_BUF if needed
Bug 4036660

Change-Id: I687d582151615b50d7402d26d2f64fe604fc1d7c
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890935
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-22 04:22:36 -07:00
Chris Dragan
c7fe179f62 misc: mods: fix bugs and style issues
* Fixed __user and __iomem pointer types.
* Added __poll_t for poll() return type if possible.
* Fixed error return from poll().
* Fixed init/shutdown in mods_dma.
* Declared internal unit functions as static.
* Assign NULL to init pointers instead of 0.

Bug 3528414

Change-Id: If39a14a429e2cda5d58edb6ffd60fd13693371e6
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2688314
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 13:27:52 +00:00
Chris Dragan
a85680cbc5 misc: mods: fix compilation with k5.4
Clean up configuration in mods_config.h and make mods_config.h identical
to the official copy in Perforce.

Bug 200587200

Change-Id: I035119eb44025f45d8272729ebc5a918dd8da6fe
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2302436
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 13:27:52 +00:00
Chris Dragan
b5b2def304 misc: mods: improve logging and fix SRIOV
* Add new cl_* macros for printing client-specific messages.
  This adds client index to messages in code which is called from
  user space.  This makes it easier to diagnose errors when multiple
  clients (processes) open the driver.
* Use kernel print levels appropriate to messages being printed.
* Print process pid when opening the driver.
* Print information about access token being set or released.
* Print information about PCI devices being enabled or disabled.
  PCI device enablement is tied to the driver getting ownership
  of the device.  It also prevents multiple MODS instances from
  owning the same PCI device.
* Print info about device DMA mask, print device DMA mask when DMA
  mapping fails.
* Print more info about SRIOV actions.
* Disable SRIOV when the driver is being closed by the process
  which enables SRIOV.  Leaving SRIOV enabled when disabling PCI
  device is an error and leads to stale functions, unusable on
  subsequent MODS runs.
* Clean up log messages in a few places.

Change-Id: I51953e984a55c0990e90f89d8260f215c8c58498
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2279439
Tested-by: Ellis Roberts <ellisr@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 13:27:52 +00:00
Chris Dragan
003f79282f misc: mods: update MODS kernel driver to 3.93
Change-Id: I6bc81407edbd448867c0b6d979d2eb3920c0e95c
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2156158
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 13:27:52 +00:00
Nicolin Chen
9ca6957981 misc: mods: Fix segment_size overflow bug
The sg->length may happen to be a large size, and this
will overflow the local segment_size when accumulating
sg->length to it at line "segment_size += sg->length".

Since segment_size of MODS_DMABUF_GET_PHYSICAL_ADDRESS
structure is defined in u64 type, this patch fixes the
bug by changing the local varible to u64 as well.

Bug 2521255

Change-Id: Id1fb6d149f55f4fd9238a399393ed2efae77c84a
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2105445
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ashish Mhetre <amhetre@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 13:27:52 +00:00
Ashish Mhetre
6f325d969e drivers: mods: Add a dummy device driver
Add a dummy device driver for retrieving physical address through dma_buf.
Set dma_mask bit to 39 during probe of this driver to add large mapping
support upto 512GB.

Bug 2482094

Change-Id: I4e6204bb2b5196b7362d547ee393abf6e291a043
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2002758
Reviewed-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 13:27:52 +00:00
Ashish Mhetre
01afe170c6 drivers: mods: Assign dma_ops to the device
dummy_device created in mods test does not have dma_ops set to it.
So explicitly set the dma_ops of device to swiotlb_dma_ops.

Bug 200460613

Change-Id: Ie9902f1c0b07948ea04355aa754b023f10f7581d
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975103
Reviewed-by: Chris Dragan <kdragan@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 13:27:52 +00:00
Chris Dragan
63bb979778 misc: mods: fix handling regions >4GB
The API for retrieving PAs needs to correctly handle offsets which
exceed 4GB.

Bug 1860962

Change-Id: I877c370d97c35fde565c70cd86a95093be083ebb
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1958611
Reviewed-by: Sami Kiminki <skiminki@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 13:27:52 +00:00
Chris Dragan
4ba7812b29 misc: mods: add release function
Add dummy release function to prevent an error printed during module
unload.

Bug 200344064

Change-Id: Ifa92600e88c4152327079c37ec9ed581179c0860
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1551847
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2023-04-03 13:27:52 +00:00
Chris Dragan
324b7be6e5 mods: remove direct references to SMMU driver
Change-Id: I31d82ee0d9154b21f7531f4ed1e8b6cd45ded64c
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: http://git-master/r/1498461
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 13:27:52 +00:00
Chris Dragan
1f6ca0cb27 misc: add mods driver
* copy driver sources from kernel-4.4 repository
* sync with copy in Perforce
* fix several formatting errors
* fix issues reported by Coverity

Bug 200295104

Change-Id: I0a37cd12041d8fdcafb72b2e67d1a9234320e11b
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: http://git-master/r/1487057
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Vivek Aseeja <vaseeja@nvidia.com>
Reviewed-by: Kiran Kasamsetty <kkasamsetty@nvidia.com>
2023-04-03 13:27:52 +00:00