From 3b9f5783b245d674ba3e86f7f888cc5a016f2658 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Wed, 13 Mar 2024 23:05:01 +0000 Subject: [PATCH] block: virtual-storage: Fix build for Linux v6.9 In Linux v6.9-rc1, the function blk_mq_init_queue() was renamed blk_mq_alloc_queue() and the arguments passed to the function were updated. Add a test to conftest to detect if the function blk_mq_alloc_queue() is present and update the virtual-storage driver accordingly. Bug 4471899 Change-Id: I7dc937eaad27445b1c140c57aafd36f4a4b769ba Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3095926 Reviewed-by: Paritosh Dixit --- .../block/tegra_virt_storage/tegra_hv_vblk.c | 10 ++++++---- scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/block/tegra_virt_storage/tegra_hv_vblk.c b/drivers/block/tegra_virt_storage/tegra_hv_vblk.c index 9bbc3de9..fd24f836 100644 --- a/drivers/block/tegra_virt_storage/tegra_hv_vblk.c +++ b/drivers/block/tegra_virt_storage/tegra_hv_vblk.c @@ -1,7 +1,5 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. - */ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -997,7 +995,11 @@ static void setup_device(struct vblk_dev *vblkdev) if (ret) return; +#if defined(NV_BLK_MQ_ALLOC_QUEUE_PRESENT) + vblkdev->queue = blk_mq_alloc_queue(&vblkdev->tag_set, NULL, NULL); +#else vblkdev->queue = blk_mq_init_queue(&vblkdev->tag_set); +#endif if (IS_ERR(vblkdev->queue)) { dev_err(vblkdev->device, "failed to init blk queue\n"); blk_mq_free_tag_set(&vblkdev->tag_set); diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 75214ee8..cc1e4a47 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -91,6 +91,7 @@ endef NV_CONFTEST_FUNCTION_COMPILE_TESTS += __alloc_disk_node_has_lkclass_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_execute_rq_has_no_gendisk_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_alloc_disk_for_queue +NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_alloc_queue NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_destroy_queue 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 diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index af06a843..be79e91f 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -6523,6 +6523,24 @@ compile_test() { compile_check_conftest "$CODE" "NV_BLK_MQ_ALLOC_DISK_FOR_QUEUE_PRESENT" "" "functions" ;; + blk_mq_alloc_queue) + # + # Determine if function blk_mq_alloc_queue() is present. + # + # In Linux next-20240308, commit 9ac4dd8c47d5 ("block: pass a + # queue_limits argument to blk_mq_init_queue") renames the function + # blk_mq_init_queue() to blk_mq_alloc_queue() and updates the + # arguments passed. + # + CODE=" + #include + void conftest_blk_mq_alloc_queue(void) { + blk_mq_alloc_queue(); + }" + + compile_check_conftest "$CODE" "NV_BLK_MQ_ALLOC_QUEUE_PRESENT" "" "functions" + ;; + blk_mq_destroy_queue) # # Determine whether function blk_mq_destroy_queue() is present.