block:vblk: Resolve compile error tegra_vblk V6.11

Method to configure the struct queue_limits has changed
from kernel v6.11.
The following API's are removed from v6.11
[1] blk_queue_max_secure_erase_sectors
[2] blk_queue_max_discard_sectors
[3] blk_queue_write_cache
[4] blk_queue_logical_block_size
[5] blk_queue_physical_block_size
[6] blk_queue_max_hw_sectors
[7] The semantics of the flag QUEUE_FLAG_NONROT
is set as default value for queues, so this flag
is removed in v6.11.
[8] The flag BLK_MQ_F_SHOULD_MERGE is not valid in
v6.14

The above API's are replaced by direct
assignment to the queue_limits and use the new API
queue_limits_set. This API takes the incoming
values, validates, populates the other members
of the struct accordingly and assigns the
provided queue_limits to the corresponding queue.

The change contains:
 [1] Addition of new approach that is compatible
with v6.11
 [2] Addition of a macro (NV_BLOCK_USE_QUEUE_LIMITS_SET)
for backward compatibility
 [3] This is a special case where both the variable
and the function needs to be present for the macro to be
enabled. The changes were made accordingly.
 [4] The flag BLK_MQ_F_SHOULD_MERGE is protected by
macro

Bug 4311184

Signed-off-by: gokull <gokull@nvidia.com>
Change-Id: Ida2c12de0977f6405e7cc7dec946cf0f64413c97
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3303900
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
gokull
2025-02-16 22:32:59 +00:00
committed by Jon Hunter
parent b63a822a1b
commit d8a3d29fed
4 changed files with 139 additions and 48 deletions

View File

@@ -100,6 +100,8 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_destroy_queue
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_queue_max_hw_sectors
NV_CONFTEST_FUNCTION_COMPILE_TESTS += block_device_operations_open_has_gendisk_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += block_device_operations_release_has_no_mode_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += queue_limits_struct_has_features
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_f_should_merge
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_match_has_const_drv_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_remove_has_int_return_type
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_uevent_has_const_dev_arg
@@ -224,6 +226,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += vm_area_struct_has_const_vm_flags
NV_CONFTEST_FUNCTION_COMPILE_TESTS += of_property_read_reg
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_fd_to_handle
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_handle_to_fd
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 ?=

View File

@@ -6724,6 +6724,44 @@ compile_test() {
"NV_BLOCK_DEVICE_OPERATIONS_RELEASE_HAS_NO_MODE_ARG" "" "types"
;;
blk_mq_f_should_merge)
#
# Determine if the BLK_MQ_F_SHOULD_MERGE is present.
#
# In Linux v6.14, commit cc76ace465d6 ("block: remove BLK_MQ_F_SHOULD_MERGE")
# removed the definition BLK_MQ_F_SHOULD_MERGE.
#
CODE="
#include <linux/blk-mq.h>
int conftest_blk_mq_f_should_merge(void) {
return BLK_MQ_F_SHOULD_MERGE;
}"
compile_check_conftest "$CODE" \
"NV_BLK_MQ_F_SHOULD_MERGE" "" "types"
;;
queue_limits_struct_has_features)
#
# Determine if the 'queue_limits' needs to use
# the latest set of API's
# The queue_limit set has 2 situations:
# 1. The API queue_limits_set is present but
# queue_limits.features is not present.
# 2. Both the API and queue_limits.features
# are present.
#
# Another macro is derived from this macro
# in nv_hv_vblk.c
CODE="
#include <linux/blkdev.h>
int conftest_set_queue_limits(void) {
return offsetof(struct queue_limits, features);
}"
compile_check_conftest "$CODE" \
"NV_QUEUE_LIMITS_STRUCT_HAS_FEATURES" "" "types"
;;
bus_type_struct_match_has_const_drv_arg)
#
# Determine if the 'match' callback from the 'bus_type' structure