blk: vblk: Enable Ioctl in tegra_hv_vblk

Previous code was using the struct request.completion_data
to pass the struct ioctl_request to the processing thread.
This member variable is removed from kernel v6.5.

Change contains:
 [1] Moving this variable from struct request to struct struct vblk_dev.
 [2] Copyright Banner is updated

This makes the passing of the struct ioctl_request independent of
linux kernel transition

Bug 4311184

Change-Id: I3dd2c4ee9861516db770adcba345362395bf3fa3
Signed-off-by: gokull <gokull@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3314801
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
gokull
2025-03-06 10:25:23 +00:00
committed by Jon Hunter
parent 5ad213c183
commit 4f98504989
5 changed files with 5 additions and 45 deletions

View File

@@ -1,7 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
/* SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
#include <nvidia/conftest.h>
@@ -136,10 +134,7 @@ int vblk_submit_ioctl_req(struct block_device *bdev,
err = PTR_ERR(rq);
goto free_ioctl_req;
}
#if defined(NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG) /* Removed in Linux v6.5 */
rq->completion_data = (void *)ioctl_req;
#endif
vblkdev->ioctl_req = ioctl_req;
#if defined(NV_BLK_EXECUTE_RQ_HAS_NO_GENDISK_ARG) /* Linux v5.17 */
blk_execute_rq(rq, 0);

View File

@@ -677,11 +677,7 @@ static bool submit_bio_req(struct vblk_dev *vblkdev)
} else {
if (vblkdev->config.blk_config.req_ops_supported & VS_BLK_IOCTL_OP_F
&& !vblk_prep_ioctl_req(vblkdev,
#if defined(NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG) /* Removed in Linux v6.5 */
(struct vblk_ioctl_req *)bio_req->completion_data,
#else
NULL,
#endif
vblkdev->ioctl_req,
vsc_req)) {
vblkdev->inflight_ioctl_reqs++;
} else if (!(vblkdev->config.blk_config.req_ops_supported & VS_BLK_IOCTL_OP_F)) {
@@ -916,14 +912,7 @@ static const struct block_device_operations vblk_ops_no_ioctl = {
.open = vblk_open,
.release = vblk_release,
.getgeo = vblk_getgeo,
#if defined(NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG) /* Removed in Linux v6.5 */
/*
* FIXME: ioctl is not supported for Linux v6.5 where the
* 'completion_data' member has been removed from the
* 'request' structure.
*/
.ioctl = vblk_ioctl_not_supported
#endif
.ioctl = vblk_ioctl
};
/* The device operations structure. */
@@ -932,14 +921,7 @@ static const struct block_device_operations vblk_ops_ioctl = {
.open = vblk_ioctl_open,
.release = vblk_ioctl_release,
.getgeo = vblk_getgeo,
#if defined(NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG) /* Removed in Linux v6.5 */
/*
* FIXME: ioctl is not supported for Linux v6.5 where the
* 'completion_data' member has been removed from the
* 'request' structure.
*/
.ioctl = vblk_ioctl
#endif
};
static ssize_t

View File

@@ -130,6 +130,7 @@ struct vblk_dev {
/* partition specific task struct */
struct task_struct *vblk_kthread;
struct completion complete;
struct vblk_ioctl_req *ioctl_req;
};
int vblk_complete_ioctl_req(struct vblk_dev *vblkdev,

View File

@@ -232,7 +232,6 @@ NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_queue_limits_set
NV_CONFTEST_FUNCTION_COMPILE_TESTS += crypto_engine_ctx_struct_removed_test
NV_CONFTEST_MACRO_COMPILE_TESTS ?=
NV_CONFTEST_SYMBOL_COMPILE_TESTS ?=
NV_CONFTEST_TYPE_COMPILE_TESTS += request_struct_has_completion_data_arg
$(eval $(call NV_GENERATE_COMPILE_TEST_HEADER,functions,$(NV_CONFTEST_FUNCTION_COMPILE_TESTS)))
$(eval $(call NV_GENERATE_COMPILE_TEST_HEADER,generic,$(NV_CONFTEST_GENERIC_COMPILE_TESTS)))

View File

@@ -8161,23 +8161,6 @@ compile_test() {
compile_check_conftest "$CODE" "NV_REGISTER_SHRINKER_HAS_FMT_ARG" "" "types"
;;
request_struct_has_completion_data_arg)
#
# Determine if the 'struct request' has the 'completion_data' member.
#
# In Linux v6.5, commit dc8cbb65dc17 ("block: remove dead struc
# request->completion_data field") removes the 'completion_data' member
# from the 'struct request'.
#
CODE="
#include <linux/blk-mq.h>
int conftest_request_struct_has_completion_data_arg(void) {
return offsetof(struct request, completion_data);
}"
compile_check_conftest "$CODE" "NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG" "" "types"
;;
shrinker_alloc)
#
# Determine if the shrinker alloc present or not.