From c73cf3c92a9e1cfbf657076543b7178e23289872 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Fri, 26 Apr 2024 15:46:47 +0100 Subject: [PATCH] block: virtual-storage: Allow build for Linux v6.10 The function blk_queue_max_hw_sectors() was removed in Linux v6.10 and so add a test to conftest to see if this function is present or not to allow the driver to build. The virtual-storage driver is currently broken for Linux v5.19+ kernel due to other incompatibilities with these newer kernels, but has been updated so that it still builds. Therefore, allow the driver to build for Linux v6.10 while the driver is fixed properly for these newer kernels. Bug 4311184 Bug 4593750 Change-Id: Ic4054c87acdf3c77f03ff94fbdde513d84fe229b Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3142216 Reviewed-by: mobile promotions Tested-by: mobile promotions --- .../block/tegra_virt_storage/tegra_hv_vblk.c | 2 ++ scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 17 +++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/drivers/block/tegra_virt_storage/tegra_hv_vblk.c b/drivers/block/tegra_virt_storage/tegra_hv_vblk.c index fd24f836..fc83a988 100644 --- a/drivers/block/tegra_virt_storage/tegra_hv_vblk.c +++ b/drivers/block/tegra_virt_storage/tegra_hv_vblk.c @@ -1164,7 +1164,9 @@ static void setup_device(struct vblk_dev *vblkdev) vblkdev->max_requests = max_requests; vblkdev->max_ioctl_requests = max_ioctl_requests; +#if defined(NV_BLK_QUEUE_MAX_HW_SECTORS_PRESENT) /* Removed in Linux v6.10 */ blk_queue_max_hw_sectors(vblkdev->queue, max_io_bytes / SECTOR_SIZE); +#endif blk_queue_flag_set(QUEUE_FLAG_NONROT, vblkdev->queue); if ((vblkdev->config.blk_config.req_ops_supported & VS_BLK_SECURE_ERASE_OP_F) diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 3e8d04cd..d23b2251 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -93,6 +93,7 @@ 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 += 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 += bus_type_struct_remove_has_int_return_type diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 4a3d6183..e2107072 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -6539,6 +6539,23 @@ compile_test() { compile_check_conftest "$CODE" "NV_BLK_MQ_DESTROY_QUEUE_PRESENT" "" "functions" ;; + blk_queue_max_hw_sectors) + # + # Determine whether function blk_queue_max_hw_sectors() is present. + # + # Commit ec84ca4025c0 ("scsi: block: Remove now unused queue limits + # helpers") removed the function blk_queue_max_hw_sectors() in Linux + # v6.10. + # + CODE=" + #include + void conftest_blk_queue_max_hw_sectors(void) { + blk_queue_max_hw_sectors(); + }" + + compile_check_conftest "$CODE" "NV_BLK_QUEUE_MAX_HW_SECTORS_PRESENT" "" "functions" + ;; + block_device_operations_open_has_gendisk_arg) # # Determine if the 'open' function pointer from the