From ad50d922f4857ca58dbda172d5d6356ab53e7845 Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Tue, 2 Dec 2025 13:21:35 +0100 Subject: [PATCH] ata: libata: Add libata.force parameter max_sec Add a new libata.force parameter called max_sec. The parameter can take an arbitrary value using the format: libata.force=max_sec= e.g. libata.force=max_sec=8191 or libata.force=max_sec=2048 This will allow the user to set an arbitrary maximum command size (dev->max_sectors) using libata.force. We cannot remove the existing libata.force parameters "max_sec_128" and "max_sec_1024", as these are a part of the exising user facing API. Signed-off-by: Niklas Cassel Reviewed-by: Martin K. Petersen Reviewed-by: Damien Le Moal Signed-off-by: Damien Le Moal --- Documentation/admin-guide/kernel-parameters.txt | 5 +++++ drivers/ata/libata-core.c | 1 + 2 files changed, 6 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a8d0afde7f85a..a467a7661efb1 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3412,6 +3412,11 @@ Kernel parameters * [no]logdir: Enable or disable access to the general purpose log directory. + * max_sec=: Set the transfer size limit, in + number of 512-byte sectors, to the value specified in + . The value specified in has to be + a non-zero positive integer. + * max_sec_128: Set transfer size limit to 128 sectors. * max_sec_1024: Set or clear transfer size limit to diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index cd1ebdbe659bd..9b0efca03a7d5 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -6569,6 +6569,7 @@ static const struct ata_force_param force_tbl[] __initconst = { force_quirk_val(max_sec_128, ATA_QUIRK_MAX_SEC, 128), force_quirk_val(max_sec_1024, ATA_QUIRK_MAX_SEC, 1024), + force_quirk_on(max_sec=, ATA_QUIRK_MAX_SEC), force_quirk_on(max_sec_lba48, ATA_QUIRK_MAX_SEC_LBA48), force_quirk_onoff(lpm, ATA_QUIRK_NOLPM), -- 2.47.3