Commit Graph

18 Commits

Author SHA1 Message Date
Laxman Dewangan
035a437f79 block: virt-storage: tegra: Fix compilation warning
Fix below compilation warning:
- Indentation warning just after if
- return value not used from function.

Bug 4052299

Change-Id: I90fc00d41304ba34bf62fef6e2024999abc4a340
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2880032
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-01 10:54:57 -07:00
Sanjith T D
3ca382c8bf vblk: Update sanity check for erase/discard
Check if the req_bytes > mempool_len only if
IOVA is enabled and the operations are not
DISCARD and SECURE_ERASE. Mempool is not used
for DISCARD and SECURE_ERASE operations.

Bug 3854703
Bug 3994714

Change-Id: I42250f7b2d36a83a4fa169ee8e4c1652be22b006
Signed-off-by: Sanjith T D <std@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2803275
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2877386
Tested-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
2023-03-27 09:48:01 -07:00
Manish Bhardwaj
a0c0b2f212 nvidia-oot: fix crash issue in vblk driver
Using this patch we are fixing kernel crash
issue which is observed when we are unbinding
the UFS driver, and we are trying to unreserved
the mempool which was never reserved.

Bug 3960718

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: Ib684cc99b9e61aa945ef406af0889aebe57e1a75
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2860634
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sanjith T D <std@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-21 03:42:31 -08:00
Manish Bhardwaj
aa5d06bcd3 nvidia-oot: fix Coverity defects
Using this patch we are fixing coverity defects in
CAN and storage OOPS driver.

CID 10132028: Unchecked return value (CHECKED_RETURN)
CID 10166522: Uninitialized scalar variable (UNINIT)
CID 10166537: Uninitialized scalar variable (UNINIT)
CID 10166580: Uninitialized scalar variable (UNINIT)

Bug 3952896

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I3caf0a9121a4480567ce32c6777b547901f24815
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2860630
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-21 03:42:27 -08:00
Manish Bhardwaj
a51a3b4d6f nvidia-oot: protect IVC APIs using mutex
While accessing IVC framework APIs is causing concurrency
issue leading to system crash. so protecting the APIs
using mutex.
Also removing the req_lock mutex which is being used
unnecessarily since the shared resources are already protected
by ivc_lock mutex.

Bug 3937188

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: Ie49161b7f2659f9c44352d50f950d8f5a3cae32c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2856249
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Suresh Venkatachalam <skathirampat@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-15 04:26:47 -08:00
Manish Bhardwaj
db2721e896 vblk: increase vblkdev max minor count
currently the max number of minors for a vblock device is 16
With the current configuration this is exceeding and causes errors
during boot. update the max count to 32

Bug 3899893
JIRA ESLC-7100

Change-Id: I07cf631e95af673ad08d0ecf7186ce9cb0114a1b
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2849763
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-02-02 16:38:17 -08:00
Manish Bhardwaj
01a13440b4 nvidia-oot: port virtual oops storage driver
Using this patch we are porting virtual oops storage driver
to OOT kernel.

JIRA ESLC-7217
Bug 3961155

Change-Id: I60ba159b3a4662cf02d686a1916a110c5158901e
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2849807
Reviewed-by: Suresh Venkatachalam <skathirampat@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-02-02 16:37:45 -08:00
Manish Bhardwaj
4d73511481 nvidia: support HSI error injection
Using this patch we are adding HSI error
injection support for SDMMC controller.

JIRA ESLC-7042
Bug 3413214

Change-Id: Ib1300bd133eb48c30439337c8205365dfd30395d
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2849755
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-02-02 16:37:38 -08:00
Sanjith T D
8efaee4e42 nvidia:vblk: Fix "Using uninitialized value"
Initialze max_ioctl_requests to 0 to fix
"Using uninitialized value" coverity violation.
max_ioctl_requests variable will not be used if IOCTL
operations are not supported on that virtual partition.
So, initializing it to 0 will not have any impact.

CID 10165591
Bug 3952896

Change-Id: Icb50d8af08d6da854bba358722439d5c2ef2a028
Signed-off-by: Sanjith T D <std@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2849581
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-01-30 22:26:51 -08:00
Suresh Venkatachalam
11b4ca8baa nvidia: handle ioctl call gracefully
Using this patch we are gracefully handling
the scenario when ioctl(pass through) is
generated for UFS storage partition where pass
through commands are not supported

Bug 3870621
Bug 3941252

Change-Id: I22937c630a354178113acba68949465eeda81d03
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Signed-off-by: Suresh Venkatachalam <skathirampat@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2845464
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Sanjith T D <std@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-01-19 07:55:17 -08:00
Suresh Venkatachalam
eec9650f58 nvidia: remove mempool support for UFS devices
Using this patch we are removing the support of
mempool for UFS devices for which pass through
commands are not supported.

Bug 3870621
Bug 3941252

Change-Id: Ifd1be5c4ebeb6f670f0b29f6f19e5ce458446ee7
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Signed-off-by: Suresh Venkatachalam <skathirampat@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2845274
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Sanjith T D <std@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2023-01-19 07:54:34 -08:00
Suresh Venkatachalam
04ba246081 vblk: Remove restricting slots based on mempool
The number of slots that is available for queuing
requests is calculated based on mempool size.
For UFS, with IOVA feature enabled, this calculation
is not needed.
Updated code to not restrict slots based on mempool
if IOVA is enabled.

Bug 3941252

Change-Id: I5a2e6c3f6e4fd568fcff47fef7462659ee6db555
Signed-off-by: Sanjith T D <std@nvidia.com>
Signed-off-by: Suresh Venkatachalam <skathirampat@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2845252
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-01-19 07:54:30 -08:00
Jon Hunter
7125981c99 nvidia-oot: vblk: Fix build errors for various Linux versions
Building the Tegra VBLK driver fails on various Linux v5.x versions due
to mismatches in arguments. Reviewing the Linux history the arguments to
the following functions changed in the following Linux versions ...

1. Linux v5.15
- The function __alloc_disk_node() is updated to pass an additional
  argument of type 'struct request_queue'.

2. Linux v5.16
- The functions blk_get_request() and blk_put_request() are replaced by
  blk_mq_alloc_request() and blk_mq_free_request(), respectively.

3. Linux v5.17
- Removes the argument of type 'struct gendisk' from the function
  blk_execute_rq().

4. Linux v5.18
- Removes the header 'linux/genhd.h'.

5. Linux v6.0
- Replaces the function __alloc_disk_node() with
  blk_mq_alloc_disk_for_queue().

Update the Tegra VBLK driver to ensure that the correct functions and
header files are used per the exact Linux version.

Bug 3820317

Change-Id: Ia04ea78d1edcf7674030379159599949f13f3120
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2791669
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-20 02:19:53 -07:00
Manish Bhardwaj
eda5ce0144 nvidia-oot: changes to fix compilation error
Using this patch we are fixing below compilaiton error
with stable kernel.
1. nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:936:16:
   error: implicit declaration of function ___alloc_disk_node_;
   vblkdev->gd = __alloc_disk_node(vblkdev->queue, NUMA_NO_NODE, NULL);
      |              ^
2. nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:1176:3:
   error: implicit declaration of function _blk_cleanup_queue_
   [-Werror=implicit-function-declaration]
   1176 |   blk_cleanup_queue(vblkdev->queue);
      |   ^~~~~~~~~~~~~~~~~

Bug 3767126

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: Id0df2c15c42d4dcbae95f1ef33517d096bf96d06
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2787165
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-05 20:14:55 -07:00
Manish Bhardwaj
f7b80313df nvidia: vblk: fix compilation error
in linux below patches remove the support for QUEUE_FLAG_DISCARD
and QUEUE_FLAG_SECERASE.
commit 70200574cc229f6ba038259e8142af2aa09e6976
Author: Christoph Hellwig <hch@lst.de>
Date:   Fri Apr 15 06:52:55 2022 +0200

    block: remove QUEUE_FLAG_DISCARD

    Just use a non-zero max_discard_sectors as an indicator for discard
    support, similar to what is done for write zeroes.

    The only places where needs special attention is the RAID5 driver,
    which must clear discard support for security reasons by default,
    even if the default stacking rules would allow for it.

commit 44abff2c0b970ae3d310b97617525dc01f248d7c
Author: Christoph Hellwig <hch@lst.de>
Date:   Fri Apr 15 06:52:57 2022 +0200

    block: decouple REQ_OP_SECURE_ERASE from REQ_OP_DISCARD

    Secure erase is a very different operation from discard in that it is
    a data integrity operation vs hint.  Fully split the limits and helper
    infrastructure to make the separation more clear.

we are fixing below compilation error using this patch.
nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:921:22:
error: ‘QUEUE_FLAG_DISCARD’ undeclared (first use in this function);
did you mean ‘QUEUE_FLAG_DEAD’?
  921 |   blk_queue_flag_set(QUEUE_FLAG_DISCARD, vblkdev->queue);
      |                      ^~~~~~~~~~~~~~~~~~
      |                      QUEUE_FLAG_DEAD
nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:921:22:
note: each undeclared identifier is reported only once for each function
it appears in nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:928:23:
error: ‘QUEUE_FLAG_SECERASE’ undeclared (first use in this function);
did you mean ‘QUEUE_FLAG_NOMERGES’?
  928 |    blk_queue_flag_set(QUEUE_FLAG_SECERASE, vblkdev->queue);

Bug 3733730

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I47ad13be833fdd7ec7f0d2127699e28311fbeb83
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2784741
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-04 05:19:21 -07:00
Manish Bhardwaj
272be41c99 nvidia: vblk: fix compilation error
in Linux v5.18 the following upstream commit removes
genhd.h and now only blkdev.h is needed.
commit 322cbb50de711814c42fb088f6d31901502c711a
Author: Christoph Hellwig <hch@lst.de>
Date:   Mon Jan 24 10:39:13 2022 +0100

    block: remove genhd.h

Using this change we are fixing below compilation
error while upgrading the stable kernel.
/dvs/git/dirty/git-master_linux/out/nvidia/kernel-nvidia-oot/
nvidia-oot/drivers/block/tegra_virt_storage/tegra_vblk.h:9:10:
fatal error: linux/genhd.h: No such file or directory
    9 | #include <linux/genhd.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.

Bug 3733730

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: Ib110b749ca48fed092fcadb9a6ab47d81cc25397
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2784497
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-10-04 05:19:17 -07:00
Laxman Dewangan
a6fd90fb31 ivc: Add wrapper header for ivc.h to avoid multiple inclusion
The ivc.h is not protected for multiple inclusion and so
it is generating error for multiple definition when included
from the source code.

Add wrapper header to protect the multiple inclusion of the ivc.h.

This will make the OOT driers to compile against all core kernel
which does not have proper ivc.h fix.

Change-Id: Ibe85da017d60f525b05d04cd6a5ea15c5b312057
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2784877
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-02 02:39:17 -07:00
Manish Bhardwaj
95d8293e6c nvidia-oot: port tegra vblk driver
Using this patch we are adding support for
tegra vblk driver in oot kernel.

JIRA ESLC-6885

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I914bb3337019412593e05e75fa0569dd1c7398d1
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2781122
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-28 22:48:26 -07:00