In Linux v5.17, the GENHD_FL_EXT_DEVT and GENHD_FL_NO_PART_SCAN were
removed and in Linux v5.19, the flags QUEUE_FLAG_SECERASE and
QUEUE_FLAG_DISCARD were removed. Rather than using kernel version
checks, simply check if the flag is defined. This is beneficial for
working with 3rd party Linux kernels that may have backported changes
from upstream.
Although the Tegra virtual-storage can be compiled for v5.19 kernels, it
still needs to be fixed properly for v5.19 kernels. Add some dev_WARN
prints to warn if these flags are not supported so that it will be clear
that this is not expected to work.
Bug 4119327
Bug 4311184
Change-Id: I7f7585b238ad45b26fb1d0df42b338c904ce87e7
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2992552
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Rather than using kernel version checks to determine which kernel APIs
to use, add the necessary tests to the conftest script to determine
which kernel APIs are present in the kernel.
This is beneficial for working with 3rd party Linux kernels that may
have back-ported upstream changes into their kernel and so the kernel
version checks do not work.
Bug 4221847
Change-Id: Iec2c793ce408dab1cf7e5118c019dfe656dfa87c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2992630
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
The function blk_mq_alloc_request() has been exported in the Linux
kernel since v3.16 and the function blk_mq_free_request() has been
exported in the Linux kernel since v3.19. The function
Since Linux v5.0, blk_get_request() has always called
blk_mq_alloc_request() and blk_put_request() has always called
blk_mq_free_request(). Given that kernels newer than v5.0 are now
supported drop the version check around blk_mq_alloc_request() and
blk_mq_free_request() and always use these functions.
Bug 4119327
Change-Id: I018687b340acaa9617c81551efb436a0439b14f1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2991457
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Building the Tegra virtual storage driver for v5.14 kernels fails with
the following error ...
drivers/block/tegra_virt_storage/tegra_hv_vblk.c:1236:48: error:
passing argument 1 of '__alloc_disk_node' makes integer from pointer
without a cast [-Werror=int-conversion]
vblkdev->gd = __alloc_disk_node(vblkdev->queue, NUMA_NO_NODE);
~~~~~~~^~~~~~~
|
struct request_queue *
Fix this by correcting the arguments passed to __alloc_disk_node() for
pre-v5.15 kernels.
Bug 3820317
Change-Id: I2f208acb3ef0a009d877ab46fb110a87968862fe
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2978392
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Below race condition can happen during boot
1) Server calls sivc_reset()
2) Storage client driver has IVC event handler registered, so it gets the event
and it calls ivc_notified()
3) Server gets ivc event, it calls ivc_notified()
( this makes server local state to established )
4) Storage cliend driver also goes to established state
5) After this, storage client driver continued with probe() and
calls ivc_reset() which results in disconnecting the
already established connection.
To fix this race condition, perform ivc_reset in storage client
driver right after tegra_hv_ivc_reserve() before registering
the IVC IRQ handler.
Bug 4125055
Change-Id: I36e6db3479f34fb649bdb8d890f24b1783d10cb9
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2943766
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: Sanjith T D <std@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
Tested-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
1. If vs_blk_dev_config.req_ops_supported has only DISCARD
support enabled, then REQ_OP_DISCARD should be mapped to
DISCARD for UFS.
2. If vs_blk_dev_config.req_ops_supported has only SECURE_ERASE
support enabled, then REQ_OP_DISCARD and REQ_OP_SECURE_ERASE
both should be mapped to SECURE_ERASE for UFS.
3. If vs_blk_dev_config.req_ops_supported has only ERASE
support enabled, then REQ_OP_DISCARD and REQ_OP_SECURE_ERASE
both should be mapped to ERASE for UFS.
Bug 4176555
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I01599df9ab93525120106dfabf2d345ab8b64770
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2920433
Reviewed-by: Sanjith T D <std@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
For Linux v5.14, the function device_add_disk() has a void return type
and compilation now fails with ...
nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:1162:8:
error: invalid use of void expression
1162 | (void)!device_add_disk(vblkdev->device, vblkdev->gd, NULL);
| ^
Fix the build for kernels prior to v5.15 by not attempting to access
the return value. Finally, for kernels v5.15 and newer, do not ignore
the return value and report an error if device_add_disk() fails.
Bug 4052299
Change-Id: I975f30bc67661eacf74634b5edb70e5ad5fc1a8d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2881453
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
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>
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>
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>
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>
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>
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>