From patchwork Mon Oct 31 02:26:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13025348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6D33FA373D for ; Mon, 31 Oct 2022 02:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229494AbiJaC0x (ORCPT ); Sun, 30 Oct 2022 22:26:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbiJaC0v (ORCPT ); Sun, 30 Oct 2022 22:26:51 -0400 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B02AC2678 for ; Sun, 30 Oct 2022 19:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667183210; x=1698719210; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u+YhafSOih06QZfSN+lI+siqPo+e0Kz4p8AfqVOVZpQ=; b=e3tNBLGsYxuPHYqi6AMku1G8CeUz+vyFZ1EgXy16drr8sv7OOM/OohNt eb1Lcuyhq3PiH/qOBLja2oNyjjJTZT77/24zr1cAZ/ZTrjtb38cmiuxX/ bUuahlmaHx17k9/UrQ4x22X28i+KM8Cyf9TJ/l/adzBnd9xAEPT9sm6Kx bp2/ZULkpf5GfdXKF8rOgQeZXJOMLrhSx2kruxNDWF/ypmbIkOJ9MagDD ZHPcaira8lmWpNI2F6CJ5sOFosrZX4JKNVdJ957SQdE7I3fbDpDi32oqt uesE0AeyzSN4KZxQunL1RwxQInQ1tgqX/HDW/p0nBEPljbyCgVcojEdd0 g==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="215446857" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 10:26:50 +0800 IronPort-SDR: lXSzYLGNHXTDglUf0xQiELObUbY8qOvbJtIqa9/s0H8++H9gRBJt9n4mPWO89RyqGFHhi5LoSf fUjPmdm9UbQh8nnSgUbHvlldcEixlgfRWh1PqEne6fpt6BBVdGpa7j8sDFEF4T50plbEmQlMYB o1RfKI2cwMlEJYEVPc2U3euiQLTiEF/oACjP+edUP0sFNk/zP7uWgsYn/JRIP7qYsVyfhAd3uv upw5B9ZRuyWdSVvcny9ca5g+mU/mRLYsWO1kJ7WecWSv4JJPtcju0lq0qjiz3lHbmHQn0yOY0h RC+sIW0rBOq22UwoxKQHw3z1 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 18:40:23 -0700 IronPort-SDR: WoZlcPV5oxNQn7EPg1Px22LJ1EVB8JVYdxAOIlUfhzkMe551rruC6y/SK5bVaKJmIgXvqmClIR ykFwXb0e73MvT2P4h9xMNArhvihfwUBxHfikNtsMGvjuo8zlTZpqZoW94Xpa/VeZnM+iUMYs6O K+3XmSR401XVmyF6XwXA7xdbiCQ/IRlNLYCcHZMlXT3cDaHLO6ZR43cWGjvQ624U7EIoKuQ0fG MT3raQ/g/Q6ytyQ4jazgUCI/2jx6mktXzFfoPMX0d54GObJhHkhOkeCkg8ziSlO7tizzq3/uRJ oBQ= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 19:26:50 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0xqZ17c9z1RvTr for ; Sun, 30 Oct 2022 19:26:50 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667183209; x=1669775210; bh=u+YhafSOih06QZfSN+ lI+siqPo+e0Kz4p8AfqVOVZpQ=; b=PgVGgsto9AHwhU9xCf9B4tVL1gcvJbK3wn Wgf1xCLC2Xvhfbp6iCNmC+QSdd+I3ddzH+yTd90aiihdgi9xuqw2Z3VG3SCRPVw8 caRyzbunbuLipzMGsCnXLx2x5xx35TeMG6brQ3Q/qdTX19zasCLdsfWcXAGemrIo UgcwqrjJ/uDrapXsq1QNUCQVmBuZwfAuunQe7S0YaT2wkewFKMSLpJs71acof4Tj jo+S36F/OkGv66MUO3rAm45w01IIdcAUP3v97dmqhV+Yr5cMHpayX2Qp/4HrSyPA dvT2cKdorWD6dD//ot1Xnq1JcZZKxRoIB/hGsuRBeAe2V816IfnA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 96UVYQhP12ja for ; Sun, 30 Oct 2022 19:26:49 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0xqV5GHcz1RvTp; Sun, 30 Oct 2022 19:26:46 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 1/7] block: Prevent the use of REQ_FUA with read operations Date: Mon, 31 Oct 2022 11:26:36 +0900 Message-Id: <20221031022642.352794-2-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> References: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org For block devices that do not support FUA, the blk-flush machinery using preflush/postflush (synchronize cache) does not enforce media access on the device side for a REQ_FUA read. Furthermore, not all block devices support FUA for read operations (e.g. ATA devices with NCQ support turned off). Finally, while all the blk-flush.c code is clearly intended at processing FUA writes, there is no explicit checks verifying that the issued request is a write. Add a check at the beginning of blk_insert_flush() to ensure that any REQ_FUA read request is failed, reporting "not supported" to the user. Signed-off-by: Damien Le Moal Reported-by: Damien Le Moal Signed-off-by: Christoph Hellwig --- block/blk-flush.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/block/blk-flush.c b/block/blk-flush.c index 53202eff545e..4a2693c7535b 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -397,6 +397,18 @@ void blk_insert_flush(struct request *rq) unsigned int policy = blk_flush_policy(fflags, rq); struct blk_flush_queue *fq = blk_get_flush_queue(q, rq->mq_ctx); + /* + * REQ_FUA does not apply to read requests because: + * - There is no way to reliably force media access for read operations + * with a block device that does not support FUA. + * - Not all block devices support FUA for read operations (e.g. ATA + * devices with NCQ support turned off). + */ + if (!op_is_write(rq->cmd_flags) && (rq->cmd_flags & REQ_FUA)) { + blk_mq_end_request(rq, BLK_STS_NOTSUPP); + return; + } + /* * @policy now records what operations need to be done. Adjust * REQ_PREFLUSH and FUA for the driver. From patchwork Mon Oct 31 02:26:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13025349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38D58C38A02 for ; Mon, 31 Oct 2022 02:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229562AbiJaC07 (ORCPT ); Sun, 30 Oct 2022 22:26:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbiJaC0z (ORCPT ); Sun, 30 Oct 2022 22:26:55 -0400 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4A00A45D for ; Sun, 30 Oct 2022 19:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667183214; x=1698719214; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x509jXSJnwObswBV4jpE+8MByFyOsaKwegxIAG6rrnw=; b=U2WEc/kDHIocmCi+TT6SucVfhUulx8rcxeUpsv7jMFcyJuq6Nncs0WxI rw0GFZX22+7vLg9LOQLFQwUUe4TApsAcigcPSNtxaIQwTcEZuvGKtrspO UYh+baYBU0g8nTA9UUXQEPAkHX+kE5xXQdYZYTAlQcHnf5h4Je8jQV32I nCBAl+m4b5T5GaJH+QG0Xcme4uQx3595k/a5pgrmkoozaKz0cSpY9Z4ld x0s71YqEXhpg8VRKONLwInkRbmwMVEe18nRjFvlTwVnuk18PqloyrTvMK MQgyOA+yOmBeEuK1ua5aMo3cVXdHhJMY0dqwfkO91FxlR0IbX05wGiJ9g g==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="215446863" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 10:26:53 +0800 IronPort-SDR: SsE46bUklVHTXDZwjkreslicIGUsyXS1DiPqSaPk7UWDAvu7Qs7JbkxLvjwSIK9yws4/xL+NTW 325q7v+OwkZzDqO9Cmb4OTyEdqispZE7pog94h0K/odkvPaULaZHJuph7gaIWTD74HO40AhYRb NOrMLfOV7D681c1hN39wBdViRMWR5wfk5BbodiGyySPt+Pg8GwUbYYJeNkpbhmbhphpabE3KUw YmZ4hrK5nQaMhy4UZaiDZAWqQKqP5VciIF8Q/+8Oqbf3DpR79V6TQcMKs4AqF96stLRI1sDzD9 ecec7caC1wQwzJGYpg5UtdTR Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 18:46:09 -0700 IronPort-SDR: k0sbP4yisgiZ5ECE9E+/3JqgItatt5XcSf5OFdfZD+c3SHErJZy2C7+jaPwWMsjySegItbT4WW +vF6+FNJpvfbaRjZPcGgy8yp5/Lh8gaiF4C59RI0zc0wW8OQ93NL3pNnMptMTx+z+hup75YKy9 Ny/TNJNaFLlzhiD9hIq2GyJe+3ord5yqxRsdW/uiTBfRBfM62j85REHEczq6bRYeK1lJQr18lE ANo1uErHapPeuJ66fxwqJ1wFblp7I9UmjiLgOHs+xcl/9EFH3cAfXI4CxnGRU9Pfgc/3U8zoQz y9U= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 19:26:53 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0xqc6Xffz1RwqL for ; Sun, 30 Oct 2022 19:26:52 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667183212; x=1669775213; bh=x509jXSJnwObswBV4j pE+8MByFyOsaKwegxIAG6rrnw=; b=YAFV5fp8lJOT0VeNeX9BA9njCCn+gKbWzE Ffky99BX1JpbHVdf+8WLdA9mgjAIkUhYEKXE8b4LF+C/xGbf1hOWueVC0JXKbMIW 6rA0BFsxZ+J2zSe3F9UNJKcYCLkvXfnBksCuDiobdsvIL0XxMprVOexZoKfjk3H4 WravlJWJWi10YLKck5t0ZyYT2iQdBG1joj6di/ZbOaGr/R25c/d4zIAYdzQZt688 gvKCnXzm75enss1+LIMh4acDxSebiNAdysTyIIHzOw+ZDRg7bc5Cxjhf2ZkG+BCf Y3jMyWz1JwAltD+Wlq9oE38DvlaolHHgX8iN+WKAxTH+8nyUAXHA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id sbAoD5l82E-w for ; Sun, 30 Oct 2022 19:26:52 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0xqZ0PWXz1RvLy; Sun, 30 Oct 2022 19:26:49 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 2/7] ata: libata: Introduce ata_ncq_supported() Date: Mon, 31 Oct 2022 11:26:37 +0900 Message-Id: <20221031022642.352794-3-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> References: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Introduce the inline helper function ata_ncq_supported() to test if a device supports NCQ commands. The function ata_ncq_enabled() is also rewritten using this new helper function. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- include/linux/libata.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/include/linux/libata.h b/include/linux/libata.h index af4953b95f76..58651f565b36 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1690,21 +1690,35 @@ extern struct ata_device *ata_dev_next(struct ata_device *dev, (dev) = ata_dev_next((dev), (link), ATA_DITER_##mode)) /** - * ata_ncq_enabled - Test whether NCQ is enabled - * @dev: ATA device to test for + * ata_ncq_supported - Test whether NCQ is supported + * @dev: ATA device to test * * LOCKING: * spin_lock_irqsave(host lock) * * RETURNS: - * 1 if NCQ is enabled for @dev, 0 otherwise. + * true if @dev supports NCQ, false otherwise. */ -static inline int ata_ncq_enabled(struct ata_device *dev) +static inline bool ata_ncq_supported(struct ata_device *dev) { if (!IS_ENABLED(CONFIG_SATA_HOST)) return 0; - return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF | - ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; + return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; +} + +/** + * ata_ncq_enabled - Test whether NCQ is enabled + * @dev: ATA device to test + * + * LOCKING: + * spin_lock_irqsave(host lock) + * + * RETURNS: + * true if NCQ is enabled for @dev, false otherwise. + */ +static inline bool ata_ncq_enabled(struct ata_device *dev) +{ + return ata_ncq_supported(dev) && !(dev->flags & ATA_DFLAG_NCQ_OFF); } static inline bool ata_fpdma_dsm_supported(struct ata_device *dev) From patchwork Mon Oct 31 02:26:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13025350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66FCBFA3744 for ; Mon, 31 Oct 2022 02:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229457AbiJaC1A (ORCPT ); Sun, 30 Oct 2022 22:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbiJaC04 (ORCPT ); Sun, 30 Oct 2022 22:26:56 -0400 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7EB5B1DE for ; Sun, 30 Oct 2022 19:26:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667183215; x=1698719215; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xz6ycfIfidoOOGiPhXlSF5Bv4e0fjijWd4+tMRv7Bmo=; b=mhRhfVukeayVSVSj6pDvzlb79JnTQR9XKwsI8/pYE819gdmkakPKQiy6 /J+mfm/sRBNqvjOyvCZwf9vBJ7S3eTH2M9pWbkrNJmL+dv2T3eavgADTQ 1jBeuYaMuvsGig8A2z7uDnz89idkxBje5t8ZQZ+BhKwT2o7Ibc6beCzAq 8IUvh4PorM+Xy51p/kCeq5JZ2E/b2dY3wALHsOrgwqyGHa3g3kWjE2GU0 hZYZm6aFlmhaz1mtaRUBA3VTTfHBGraKee0ZndHKTBvyJMxyCKWqG/eOG kZvZb5DyuMoPAo0ZcFqbU3qn/MkzFRcYujM0HhP2eXhvbxd68prYGFT4/ Q==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="215446864" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 10:26:55 +0800 IronPort-SDR: 5m91IC0dl6/+em1rtBKfCJ6tfIFcoptb4odIbQTRuIOcmSbXr4NyTVp0xi3B3HGI4zI8NLlxIQ 4Iaw83k/OKJIkoauMztOHlCY+YMEgYbyQeTlMcTdcmKgMsiDAQZEvWsUAwaRbNXa5guLG2yU4A ADWOk7ZmVZgPxQ8cVeO+ErVd1LLmZtTGmMBvtmwZ4zUc47xZX+QBcE0yEdybAFZ5lKdD/GUyB9 xH0PtCXB1qybProXBKFOO/x5+cDDDSHlYyXUKCkYuUNr+NIiCo3i8JJFlY4cY8zQPGmJ0DJ22/ /g3mEJ0fskxtntuC6k/RYfgA Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 18:46:11 -0700 IronPort-SDR: 8xIc2e0Mw8/kSVC0N7NlAcEhs+KRkzjZ4hrlqTUK+Fnz1joFGijvMWuAmwjr+8oMFAGjDb2h7I 8IDDfjrlWiPKfu3FKDN5fO9AtBhtXHl0kGBYfZIAC6Z/u8HcrD5z20G/OiZdZRawDGUd/gLbO9 jlLgkzW4phPahRxu2jQ4xSaQEtEY8elbmvak6UYiVqOJ1Q/8YadYqf6D1q2wQssqyjlmAmO6TD QRQctZa6eKhaVd94gZzF0gCX/U2ECu4GifiWWc06/eOfFeFbNSHoCnNYSgKPruAa+YIDOwjY6n +Y8= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 19:26:55 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0xqf534pz1Rwrq for ; Sun, 30 Oct 2022 19:26:54 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667183214; x=1669775215; bh=xz6ycfIfidoOOGiPhX lSF5Bv4e0fjijWd4+tMRv7Bmo=; b=mSFPBxsKCyB+SZa2mL2FrrvuEukrzZHxrM XDzfN585gQGvVt+c2ZwuQ8sl8t9SNDstQ08FeuvZQiyPjygzLaLFCVbZklszwdMQ /e162TUmjz2f/MWXzf9H5bznUlQ4zTHd6ArZi8uSxs+zPQZJrgzmJaMC6G5+ueb3 scEykZNNBHDZ0NEqMXBvwnj0g6HTzKVtrjrylz61VcDXjUfJ/26xirBNUwHNow2A fZwp9hQnGukR/tYi5tqBk1wR6+d/VhkmkW+mNzAOFk2AtkuLaA7SljayQDUR2wGX Sfr7leXJrdhXdTFeX3aPlMmudvYmyimhghhNsOr9UAOL1sAOS1Rw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id rOKBg5DoEtkv for ; Sun, 30 Oct 2022 19:26:54 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0xqc5fNBz1RvTp; Sun, 30 Oct 2022 19:26:52 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 3/7] ata: libata: Rename and cleanup ata_rwcmd_protocol() Date: Mon, 31 Oct 2022 11:26:38 +0900 Message-Id: <20221031022642.352794-4-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> References: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Rename ata_rwcmd_protocol() to ata_set_rwcmd_protocol() to better reflect the fact that this function sets a task file command and protocol. The arguments order is also reversed and the function return type changed to a bool to indicate if the command and protocol were set corretly (instead of returning a completely arbitrary "-1" value. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-core.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 884ae73b11ea..6ee1cbac3ab0 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -574,17 +574,18 @@ static const u8 ata_rw_cmds[] = { }; /** - * ata_rwcmd_protocol - set taskfile r/w commands and protocol - * @tf: command to examine and configure - * @dev: device tf belongs to + * ata_set_rwcmd_protocol - set taskfile r/w command and protocol + * @dev: target device for the taskfile + * @tf: taskfile to examine and configure * - * Examine the device configuration and tf->flags to calculate - * the proper read/write commands and protocol to use. + * Examine the device configuration and tf->flags to determine + * the proper read/write command and protocol to use for @tf. * * LOCKING: * caller. */ -static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev) +static bool ata_set_rwcmd_protocol(struct ata_device *dev, + struct ata_taskfile *tf) { u8 cmd; @@ -607,11 +608,12 @@ static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev) } cmd = ata_rw_cmds[index + fua + lba48 + write]; - if (cmd) { - tf->command = cmd; - return 0; - } - return -1; + if (!cmd) + return false; + + tf->command = cmd; + + return true; } /** @@ -744,7 +746,7 @@ int ata_build_rw_tf(struct ata_queued_cmd *qc, u64 block, u32 n_block, /* request too large even for LBA48 */ return -ERANGE; - if (unlikely(ata_rwcmd_protocol(tf, dev) < 0)) + if (unlikely(!ata_set_rwcmd_protocol(dev, tf))) return -EINVAL; tf->nsect = n_block & 0xff; @@ -762,7 +764,7 @@ int ata_build_rw_tf(struct ata_queued_cmd *qc, u64 block, u32 n_block, if (!lba_28_ok(block, n_block)) return -ERANGE; - if (unlikely(ata_rwcmd_protocol(tf, dev) < 0)) + if (unlikely(!ata_set_rwcmd_protocol(dev, tf))) return -EINVAL; /* Convert LBA to CHS */ From patchwork Mon Oct 31 02:26:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13025351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 173B1FA3746 for ; Mon, 31 Oct 2022 02:27:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229588AbiJaC1B (ORCPT ); Sun, 30 Oct 2022 22:27:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbiJaC07 (ORCPT ); Sun, 30 Oct 2022 22:26:59 -0400 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E01E4B862 for ; Sun, 30 Oct 2022 19:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667183217; x=1698719217; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7TWEQQgjvLoQtW5Au9ZtMp+aKDP51r+1N5Z2PbiA6mU=; b=pPzixvd8XXKu6yvpqsK/74EUPeTUUmfuqu7MP+pGeATv15g7WvOWrem7 y+N/YC0x8EwhZW9XaQGinHvlzPeuNqwRU6yDHzN2FZLmFctwHVAOWUHtf tsnf8V6Ez30u5fywuE1POEhNvmF2oOsREGpekalxiTg9GjTcBsOHEGeFH H4W3LvcwqBsLMJZD9wV0VJAgU4QahWcMUWVNz/5C0gkhYeeAH8rqve8aQ O/boOxSHYBaZvCHxR5frXLn2mU8xzHX4VGo86pWx24NCaJnY5K60sYbgn r6ndiA0wCflupYjXub0LvldthSe8tJ8EcbzsSw6Oa+ycgUQHW4tJT0ik9 w==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="215446865" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 10:26:57 +0800 IronPort-SDR: FH2zjlI309hzqJ827JeCIFwOMHyQLDSHtScO9LPp8JyYjWm+aL5e7iGN9rQHlSNr/6gaeOdDRb A9xLh+RoslWC7rx6aejvvOrwvG8oI0wwe+slKbZVuu83fBnwlOMUFluw6HkDYpiBOj+tRUf1EE nQ2jLVD3ct1UjUAyoLwzAMXXncbEhJ2/skMoXvZPgu+FkCDSp553U7Za9tWfgGjTJMLD4C5+3b 8TUwBUr0zroswoKV7u+qkDOrDJqiRCrVOf0SoGIAadltebef4SwSeALW5PbjRrXD7c2QYddTjQ 1BSKImTeNvZNdGnf37J0VOI5 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 18:46:13 -0700 IronPort-SDR: unA5p6TMzhkVvXdctUUhc/2or2PgjoA2hfhrl5gF9H8tHzg6QGnNqxPakNEG5pHlwQPLNxfI3A EFbzDDmyI5VSU59KuOSeSuu18kDFzu43WVx1H29j/wMdh5BVk5150vx2IGfzD3l7Zt35kRxDxt 7/D6u5xcQXfnjtX2cBmuY2vnVnC5IfOdEuQQEWd/UXJr5AIsl2eijPCElpc5PcxT7bHStI1+Ya pM41gqkN96Rn0KKhgoxWrdmjExf0KF2eD0P7TlG9v24zKbgLIy4l/yYkbBwu9Lvk84aBDoQkuZ wSg= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 19:26:58 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0xqj24RTz1Rwrq for ; Sun, 30 Oct 2022 19:26:57 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667183216; x=1669775217; bh=7TWEQQgjvLoQtW5Au9 ZtMp+aKDP51r+1N5Z2PbiA6mU=; b=XZjm4jaxWp8gvIG8AQZhsKvBR5uDBxd4mU 6t++o3JRcDucNfW8Y2sXmnBK3eZH3aKGQiLy4h7AhZeVfef86WNjMX5WW02GD8g3 foV4N5GEQFPpw6zytFPvMWL5ng9XLyDBTXrFPTdl/G1BpJNUxu7lfcRS7Q8kb2eK Ba0CUV29pgC/r6XFJGms52L6qMns7UuN6Y3AfWbQ+jvweX//4er7t/jY2fyfQ7+d gQgDSorwMBsoD8MgNl6oqJfyY7oIDGvrN3eQoXtp7a5AR814QshE9sgUULbTSM8C up7xyQuEYIwg4J+lq/a2NLe8GxV+KC+DvW2CY8po8hn8n8jgzbMw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Th1zZPaCPQlm for ; Sun, 30 Oct 2022 19:26:56 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0xqg0HdZz1RvTp; Sun, 30 Oct 2022 19:26:54 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 4/7] ata: libata: cleanup fua support detection Date: Mon, 31 Oct 2022 11:26:39 +0900 Message-Id: <20221031022642.352794-5-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> References: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Move the detection of a device FUA support from ata_scsiop_mode_sense()/ata_dev_supports_fua() to device scan time in ata_dev_configure(). The function ata_dev_config_fua() is introduced to detect if a device supports FUA and this support is indicated using the new device flag ATA_DFLAG_FUA. In order to blacklist known buggy devices, the horkage flag ATA_HORKAGE_NO_FUA is introduced. Similarly to other horkage flags, the libata.force= arguments "fua" and "nofua" are also introduced to allow a user to control this horkage flag through the "force" libata module parameter. The ATA_DFLAG_FUA device flag is set only and only if all the following conditions are met: * libata.fua module parameter is set to 1 * The device supports the WRITE DMA FUA EXT command, * The device is not marked with the ATA_HORKAGE_NO_FUA flag, either from the blacklist or set by the user with libata.force=nofua * The device supports NCQ (while this is not mandated by the standards, this restriction is introduced to avoid problems with older non-NCQ devices). Enabling or diabling libata FUA support for all devices can now also be done using the "force=[no]fua" module parameter when libata.fua is set to 1. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- .../admin-guide/kernel-parameters.txt | 3 ++ drivers/ata/libata-core.c | 30 ++++++++++++++++++- drivers/ata/libata-scsi.c | 30 ++----------------- include/linux/libata.h | 8 +++-- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a465d5242774..f9724642c703 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2786,6 +2786,9 @@ * [no]setxfer: Indicate if transfer speed mode setting should be skipped. + * [no]fua: Disable or enable FUA (Force Unit Access) + support for devices supporting this feature. + * dump_id: Dump IDENTIFY data. * disable: Disable this device. diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 6ee1cbac3ab0..30adae16efff 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -2422,6 +2422,28 @@ static void ata_dev_config_chs(struct ata_device *dev) dev->heads, dev->sectors); } +static void ata_dev_config_fua(struct ata_device *dev) +{ + /* Ignore FUA support if its use is disabled globally */ + if (!libata_fua) + goto nofua; + + /* Ignore devices without support for WRITE DMA FUA EXT */ + if (!(dev->flags & ATA_DFLAG_LBA48) || !ata_id_has_fua(dev->id)) + goto nofua; + + /* Ignore known bad devices and devices that lack NCQ support */ + if (!ata_ncq_supported(dev) || (dev->horkage & ATA_HORKAGE_NO_FUA)) + goto nofua; + + dev->flags |= ATA_DFLAG_FUA; + + return; + +nofua: + dev->flags &= ~ATA_DFLAG_FUA; +} + static void ata_dev_config_devslp(struct ata_device *dev) { u8 *sata_setting = dev->link->ap->sector_buf; @@ -2510,7 +2532,8 @@ static void ata_dev_print_features(struct ata_device *dev) return; ata_dev_info(dev, - "Features:%s%s%s%s%s%s\n", + "Features:%s%s%s%s%s%s%s\n", + dev->flags & ATA_DFLAG_FUA ? " FUA" : "", dev->flags & ATA_DFLAG_TRUSTED ? " Trust" : "", dev->flags & ATA_DFLAG_DA ? " Dev-Attention" : "", dev->flags & ATA_DFLAG_DEVSLP ? " Dev-Sleep" : "", @@ -2671,6 +2694,7 @@ int ata_dev_configure(struct ata_device *dev) ata_dev_config_chs(dev); } + ata_dev_config_fua(dev); ata_dev_config_devslp(dev); ata_dev_config_sense_reporting(dev); ata_dev_config_zac(dev); @@ -4105,6 +4129,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { */ { "SATADOM-ML 3ME", NULL, ATA_HORKAGE_NO_LOG_DIR }, + /* Buggy FUA */ + { "Maxtor", "BANC1G10", ATA_HORKAGE_NO_FUA }, + /* End Marker */ { } }; @@ -6216,6 +6243,7 @@ static const struct ata_force_param force_tbl[] __initconst = { force_horkage_onoff(lpm, ATA_HORKAGE_NOLPM), force_horkage_onoff(setxfer, ATA_HORKAGE_NOSETXFER), force_horkage_on(dump_id, ATA_HORKAGE_DUMP_ID), + force_horkage_onoff(fua, ATA_HORKAGE_NO_FUA), force_horkage_on(disable, ATA_HORKAGE_DISABLE), }; diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 4cb914103382..69948e2a8f6d 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2240,30 +2240,6 @@ static unsigned int ata_msense_rw_recovery(u8 *buf, bool changeable) return sizeof(def_rw_recovery_mpage); } -/* - * We can turn this into a real blacklist if it's needed, for now just - * blacklist any Maxtor BANC1G10 revision firmware - */ -static int ata_dev_supports_fua(u16 *id) -{ - unsigned char model[ATA_ID_PROD_LEN + 1], fw[ATA_ID_FW_REV_LEN + 1]; - - if (!libata_fua) - return 0; - if (!ata_id_has_fua(id)) - return 0; - - ata_id_c_string(id, model, ATA_ID_PROD, sizeof(model)); - ata_id_c_string(id, fw, ATA_ID_FW_REV, sizeof(fw)); - - if (strcmp(model, "Maxtor")) - return 1; - if (strcmp(fw, "BANC1G10")) - return 1; - - return 0; /* blacklisted */ -} - /** * ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands * @args: device IDENTIFY data / SCSI command of interest. @@ -2287,7 +2263,7 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf) }; u8 pg, spg; unsigned int ebd, page_control, six_byte; - u8 dpofua, bp = 0xff; + u8 dpofua = 0, bp = 0xff; u16 fp; six_byte = (scsicmd[0] == MODE_SENSE); @@ -2350,9 +2326,7 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf) goto invalid_fld; } - dpofua = 0; - if (ata_dev_supports_fua(args->id) && (dev->flags & ATA_DFLAG_LBA48) && - (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) + if (dev->flags & ATA_DFLAG_FUA) dpofua = 1 << 4; if (six_byte) { diff --git a/include/linux/libata.h b/include/linux/libata.h index 58651f565b36..d30c1288504d 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -91,6 +91,7 @@ enum { ATA_DFLAG_AN = (1 << 7), /* AN configured */ ATA_DFLAG_TRUSTED = (1 << 8), /* device supports trusted send/recv */ ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */ + ATA_DFLAG_FUA = (1 << 11), /* device supports FUA */ ATA_DFLAG_CFG_MASK = (1 << 12) - 1, ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */ @@ -113,9 +114,9 @@ enum { ATA_DFLAG_D_SENSE = (1 << 29), /* Descriptor sense requested */ ATA_DFLAG_ZAC = (1 << 30), /* ZAC device */ - ATA_DFLAG_FEATURES_MASK = ATA_DFLAG_TRUSTED | ATA_DFLAG_DA | \ - ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \ - ATA_DFLAG_NCQ_PRIO, + ATA_DFLAG_FEATURES_MASK = (ATA_DFLAG_TRUSTED | ATA_DFLAG_DA | \ + ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \ + ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA), ATA_DEV_UNKNOWN = 0, /* unknown device */ ATA_DEV_ATA = 1, /* ATA device */ @@ -381,6 +382,7 @@ enum { ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27), /* Disable NCQ on ATI chipset */ ATA_HORKAGE_NO_ID_DEV_LOG = (1 << 28), /* Identify device log missing */ ATA_HORKAGE_NO_LOG_DIR = (1 << 29), /* Do not read log directory */ + ATA_HORKAGE_NO_FUA = (1 << 30), /* Do not use FUA */ /* DMA mask for user DMA control: User visible values; DO NOT renumber */ From patchwork Mon Oct 31 02:26:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13025352 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 778AAFA3740 for ; Mon, 31 Oct 2022 02:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229692AbiJaC1H (ORCPT ); Sun, 30 Oct 2022 22:27:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbiJaC1C (ORCPT ); Sun, 30 Oct 2022 22:27:02 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 019C39FE4 for ; Sun, 30 Oct 2022 19:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667183221; x=1698719221; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UJ2YDLRMJY8D+U3UMEWNGFNsOs4kdiG/fA81vw5BF8c=; b=eTol8Q/CeLl7+m/7JGvyUnl6DLYVuvU1iOb5rxp7FYvr1N3U6FvqgAQJ jDhlx5fAEgqLLinkd1y5SoB3VVIFkoPYlhtVNDnV3T/L3GHMYN+u/7R/N zKzSdmve8LEm+8lTbQ+nrOZxB+rDtyTAy9mjnusENS1iBN7ChteWrMs2Y uzquAIiuhwVqFng00uaANUXfo1euLVKO8KD2LHBIC9WQWjAGJ1YrRpE++ XGHsBKsl4jG8sgtAhwnurlwRM/lytL6dTmOLoiXB0+L+NyX6l3g7QxJc+ GQ1OStyQi3hOXvcuHhBS2hI/BBZLGZRlpdPgfbyAMmLgx6z37BpdsaUyf Q==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="327200435" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 10:27:01 +0800 IronPort-SDR: Cnapif39zas/tAyztmQD0dpXgEqx4rKPXnOvqeqAeoeV7DA5OVmGBkhUneOHIAcJyrHyXoVAPi md5LkqYSgKZL6Bh+/1qJV2mduhm9LOV3kVgpud0vP/Fp7UVsu31pfL349Udpd+E8ZNw8+i67JU UKusOdPdq4uzBzTjOkE1wqa5POKL/E2jA+M76FYY+foq1UDSVIT/VhjsldwkIGWVyve9wklG6S 2zBys+B/Ophr3dvGhJo+0Zt8nOxysDskLhmytRcXxqtWjfb8EKdXr9l0GAAH52vIZOTk5F86KJ p7tK773N2rLx5e5G4vw/mQQX Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 18:40:34 -0700 IronPort-SDR: ZPuhLbGewmV71LyYcSbapcBiCI2LzcJKXxmWlyQTQIlf8Vx5EZ7ey/64bhQ4THIviRzI08tQko EeLecuoKv7VJntF4EguogRHu/5xX0tYyEDEAZZMggIf+judJ8M68+ZPNA7Q077ld0NWWedRE9C oOFopVw41cZmtV3cdm+AEjc1S0qZlGev0oPrsacb1fvOMdFGro1jMRlkJvL/rmrEFgK1NpGf+F v28T5WhCLR3AClkh8RY0V6aX3uq384/HYKHBeg7eWpR79MN5SOZrthpuglY9jaOdKcahKnPCvB 1kI= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 19:27:01 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0xqn0pFQz1Rwt8 for ; Sun, 30 Oct 2022 19:27:01 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667183220; x=1669775221; bh=UJ2YDLRMJY8D+U3UME WNGFNsOs4kdiG/fA81vw5BF8c=; b=cmZ63uJkzDV7lgEHkwKPHe+XFV0x6y2rTq hs335ahY5DSJK6IWZXx0qfdphA6HfsXuPqoGfIWDJuqKU6PDjCwGHsW2j/j41uXj E7aqFH4lry1303R0jp84QxbGcIAq6Wemg4Ld+A4c9OQzq2zYKovbx6yILOvDohEG KkhLsmLGfwGYDOeRw9EQProREzzXaVtVeij0/42t98nvM7i43SEHKVoRNaaPEvST vwlpe8CHBOaygHtfshIVBjo++qI+6xDCx2PwPV5b9Z8We1WOWKFiAWW9wczm4UC7 kc2Vui1Qya9F5QhKO31S4PHfvxFyMbk9YzxB5Zpm47zHiajWf4fA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 0Nn1lgb4f7HR for ; Sun, 30 Oct 2022 19:27:00 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0xqk2sT1z1RvTr; Sun, 30 Oct 2022 19:26:56 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 5/7] ata: libata: Fix FUA handling in ata_build_rw_tf() Date: Mon, 31 Oct 2022 11:26:40 +0900 Message-Id: <20221031022642.352794-6-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> References: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org If a user issues a write command with the FUA bit set for a device with NCQ support disabled (that is, the device queue depth was set to 1), the LBA 48 command WRITE DMA FUA EXT must be used. However, ata_build_rw_tf() ignores this and first tests if LBA 28 can be used based on the write command sector and number of blocks. That is, for small FUA writes at low LBAs, ata_rwcmd_protocol() will cause the write to fail. Fix this by preventing the use of LBA 28 for any FUA write request. Given that the WRITE MULTI FUA EXT command is marked as obsolete iin the ATA specification since ACS-3 (published in 2013), remove the ATA_CMD_WRITE_MULTI_FUA_EXT command from the ata_rw_cmds array. Finally, since the block layer should never issue a FUA read request, warn in ata_build_rw_tf() if we see such request. Signed-off-by: Damien Le Moal --- drivers/ata/libata-core.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 30adae16efff..83bea8591b08 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -552,7 +552,7 @@ static const u8 ata_rw_cmds[] = { 0, 0, 0, - ATA_CMD_WRITE_MULTI_FUA_EXT, + 0, /* pio */ ATA_CMD_PIO_READ, ATA_CMD_PIO_WRITE, @@ -693,6 +693,10 @@ int ata_build_rw_tf(struct ata_queued_cmd *qc, u64 block, u32 n_block, tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; tf->flags |= tf_flags; + /* We should never get a FUA read */ + WARN_ON_ONCE((tf->flags & ATA_TFLAG_FUA) && + !(tf->flags & ATA_TFLAG_WRITE)); + if (ata_ncq_enabled(dev)) { /* yay, NCQ */ if (!lba_48_ok(block, n_block)) @@ -727,7 +731,8 @@ int ata_build_rw_tf(struct ata_queued_cmd *qc, u64 block, u32 n_block, } else if (dev->flags & ATA_DFLAG_LBA) { tf->flags |= ATA_TFLAG_LBA; - if (lba_28_ok(block, n_block)) { + /* We need LBA48 for FUA writes */ + if (!(tf->flags & ATA_TFLAG_FUA) && lba_28_ok(block, n_block)) { /* use LBA28 */ tf->device |= (block >> 24) & 0xf; } else if (lba_48_ok(block, n_block)) { @@ -742,9 +747,10 @@ int ata_build_rw_tf(struct ata_queued_cmd *qc, u64 block, u32 n_block, tf->hob_lbah = (block >> 40) & 0xff; tf->hob_lbam = (block >> 32) & 0xff; tf->hob_lbal = (block >> 24) & 0xff; - } else + } else { /* request too large even for LBA48 */ return -ERANGE; + } if (unlikely(!ata_set_rwcmd_protocol(dev, tf))) return -EINVAL; From patchwork Mon Oct 31 02:26:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13025353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55BCCFA3740 for ; Mon, 31 Oct 2022 02:27:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229645AbiJaC1J (ORCPT ); Sun, 30 Oct 2022 22:27:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229729AbiJaC1H (ORCPT ); Sun, 30 Oct 2022 22:27:07 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B794EB1DE for ; Sun, 30 Oct 2022 19:27:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667183224; x=1698719224; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sJYwO2YFLt4950BGsnhd04xfiHD38rnFysO3T/X3rW4=; b=K7n3RWewdxtqEBb+zLrpp2+Pze+xUxYziDpIgCm9pkMZPCJVnediAwTg BUddRsp+kPV6+DeK2nYd7Pw+24Gy7AZCvgsOlW0gbb7ADjGM9Mtry81Xy sVEH1g0PB2669SaObniU7Xx+9awNpNOHDR4Lt05XlWQLgjmdLFGggGD2+ qPnLQ9cPvs+Cw5qCVSftXj8dxIMZTt8xuoo7/kgFyCyqiKa7GxbbLzhPR 5oJzERKRmjotDRgRKdatqyoBGMHE6gG2a1q4Tniq+48jU7vDed36trn1r vnRf5SzXIL+EhKyVk4ThWcNc9okTV59JqeB8ew8YYRZK6muC5jGKkegzm g==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="327200442" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 10:27:04 +0800 IronPort-SDR: Zt++L+3PTY6JmRf7gECKJcCcGIJ5bAwuiWiZ/sqq9oaP7NaU00AGGNjw5NZOVg84lvTTGMbesK lBXS5x7OE94AANl/UNZsxJGMK+NzoYYWsRxv0WTvZQObKLUJdy05hiIDE71qKTOZW3XatbZfOb 6xfLglv3pdMBDUTiafQ2DOx468aB4Dn65I0ntD7qUJSCYuxvm6UB9WkeNGuWHO+sL7YnVHlRoV XotUr6GvLkFeuYbwoA4WRuuJMztBAmsfMw8eCUXC2L/bXm3dtpg2S97kVx/N3neskza4iBtZPH v5mrdj3mQ8ILN5hI3aICCOvC Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 18:40:37 -0700 IronPort-SDR: cNzraxA1pIeb4YCBtS2WxWnUOfXvetN3cP6/slxWCaMqL4dkgjL8LMmW/U4Awvu1OJU1jfPb8E EDFR+dHbUl4fcjA9nSxzxBCw5fRgbvHywWgEsKwKSF4eHnroXmML/KQnoUnX8Haew0N1mnItRR THsqp2aZ5lizPlMijfcynJzH2oREuei3sF0cIdwpdYhLMInQFnXBlc43kkHRPmQaXfa1Pb1/tZ ynT30UgiMzl66SX5iJkwBtp1fsi8PdMBAImHoTDdoPOf7zg1fL4WSkSUUXDnZTIIW89ZbuIszG MqE= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 19:27:04 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0xqq1hbxz1RvTp for ; Sun, 30 Oct 2022 19:27:03 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667183222; x=1669775223; bh=sJYwO2YFLt4950BGsn hd04xfiHD38rnFysO3T/X3rW4=; b=ufswJzzYBW5aWp7nOfZSv9NQRiNgxTeui4 xd/jCvtSJrbGs9Vy6wBI6FPjeCxJ0jACiYDrSavsfGxvPIP++sLr5rpblMKB/mdP l0Hl+S9ZU/IfwC6UPzmqPUQ9UKBzPbh/+DlHcWW4tUcv7IBa9YVVEVRhWrkr5UOu +DmlTsb93qRPKVJZLtBtNMi7SzvofAee6XQCYKNd3EOXJDeAM0PS+pp9Nv0Na+jK uN2MsoBC1v6quNd03Ago1YUw3CYzyt/kwHhhmlUWQI5i+kWjMGWqBzfxo60rzn8/ mEaAT/JLOxXBDOoTB5+olDuKZ3zvdp+np2ONVthr79fdSJbC34+g== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ORFQFmcrjMfB for ; Sun, 30 Oct 2022 19:27:02 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0xqn1DPgz1RvTr; Sun, 30 Oct 2022 19:27:01 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 6/7] ata: libata: blacklist FUA support for known buggy drives Date: Mon, 31 Oct 2022 11:26:41 +0900 Message-Id: <20221031022642.352794-7-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> References: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Thread [1] reported back in 2012 problems with enabling FUA for 3 different drives. Add these drives to ata_device_blacklist[] to mark them with the ATA_HORKAGE_NO_FUA flag. To be conservative and avoid problems on old systems, the model number for the three new entries are defined as to widely match all drives in the same product line. [1]: https://lore.kernel.org/lkml/CA+6av4=uxu_q5U_46HtpUt=FSgbh3pZuAEY54J5_xK=MKWq-YQ@mail.gmail.com/ Suggested-by: Maciej S. Szmigiero Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Maciej S. Szmigiero --- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 83bea8591b08..29042665c550 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -4137,6 +4137,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { /* Buggy FUA */ { "Maxtor", "BANC1G10", ATA_HORKAGE_NO_FUA }, + { "WDC*WD2500J*", NULL, ATA_HORKAGE_NO_FUA }, + { "OCZ-VERTEX*", NULL, ATA_HORKAGE_NO_FUA }, + { "INTEL*SSDSC2CT*", NULL, ATA_HORKAGE_NO_FUA }, /* End Marker */ { } From patchwork Mon Oct 31 02:26:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13025354 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81823C38A02 for ; Mon, 31 Oct 2022 02:33:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229515AbiJaCdI (ORCPT ); Sun, 30 Oct 2022 22:33:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbiJaCdG (ORCPT ); Sun, 30 Oct 2022 22:33:06 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66F71A45D for ; Sun, 30 Oct 2022 19:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667183585; x=1698719585; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nQOC0Pfd3xQkIpsrM2jqz2PO66oztnRmZbo1BOuXWN0=; b=qvEaUubHqaEGWTLB8submH7b5SC7/I7cNunIlAS3TVKjny97rJrt0NLd INSjHyWcK7ATnaxGjL54ZyGUUWOwHYA5GE/OL+SpxDbd/FK57per5I0rV gnsyGVVOwVMoLzrVEsXXeQ6dkcHztN+gm8VIYyZPXICtVirV29rgaCb3l bFS2fcwuDgYWe9FW5fEayUD+G/o9WfFmkj+bnbYkwOxlyVWJc8V8S8NX3 yYkyqbSqg6VuAvt2gJ2Xfgm9MxnqBT9GVV1ByyAoJ2EXmdlSoX0NmMiev Jz5qQfTVq426xi5gByypT7N/4Au+m+BKVyFhtRzSjGeIM7mHORriIQ85S A==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="327200813" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 10:33:05 +0800 IronPort-SDR: ge3ICr+yuMuWSYQJVizDu0Agqg19hLTx20oTbFv2vSYZB2AmNyoyazi1931BzmG6Z+FDVUlzdX sV9enh1z1feJgwsK6OYuHiFi17U3ukzDUhL2AXZowPfPE3TTVX0+ZahgtqfTJ0+6aMG6yFGVPl Mt+qGMdolLwUeJPbSCfUB7DGt5q9vrqBLiIGdRT6ZwRKwWOJAhoivf/i1d6HFYwhqurM6ARkC+ xTyjOe815MJFdlT2oklAm7cAIFJI4rXNyYEFTcpHfGEA7cjigJ0XFY++KqTVWfx1gSjvx4EWMD QAJI+7YjPj8DWnzIBYcs/IoQ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 18:52:21 -0700 IronPort-SDR: o0b1bshAo1ojvcaaY2cXEUQLQW4U3HNrFd0/XiGgMMnY5ebVHVzTYruFeQIkxFk5DIVGUirY6N gmrHenU2wc+RIgdEDK+ibYeRwUACmqT1TUdJVoe4/yJEl2zV4Il9gEJMcnsZn4Yn0ROgriwWxO 8p32Oo9NpwS/cTv5WIZ9K76lvag4gdMo52hPnqE10fJ1fv35rLgPlwOzinrMzXDWlyk9T+kXb/ 7PDtXyi7OkYZuYqM5mxNz1MxY0iJgeQ3kP5PKYINIGT4TmbNNCxVTPd8QlU7hDMQCvuFTDApO0 Rco= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Oct 2022 19:27:05 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0xqr3bJ1z1RwtC for ; Sun, 30 Oct 2022 19:27:04 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667183224; x=1669775225; bh=nQOC0Pfd3xQkIpsrM2 jqz2PO66oztnRmZbo1BOuXWN0=; b=lMFRxtgFdhAVjKuRBdggU+49SqLUb10GeD nAFhStOWn6RKqqt1NZAu2Cr4RfwBai04hr4Kbws+W/ObcsgdpCvbc6MwdWfnjppE a/1MP0JZhZVTGRXUJPUO++qbZOTVBAy4Eq52Dg7N2R5z/HVdDhcuAxT5D9E947Dj aP/yVLrzU1BEfderUbf+rMlnr1ISMwUaBY/6JuIMGPinQIlYxs8TVS6O0r5UEBPC HboRTvcR6Hw+7xtdl7RHbmEddZX9J+ZYNhXvduHWt4xrfbNmakJisOD1JROttzUU cNDdVX8F8Fjn70giP6RuHQLoHG5DJL5mdv7UWOFn88tWd7GyjnsQ== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id uZ6_WxJHgO4K for ; Sun, 30 Oct 2022 19:27:04 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0xqq21Gfz1Rwt8; Sun, 30 Oct 2022 19:27:03 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 7/7] ata: libata: Enable fua support by default Date: Mon, 31 Oct 2022 11:26:42 +0900 Message-Id: <20221031022642.352794-8-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> References: <20221031022642.352794-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Change the default value of the fua module parameter to 1 to enable fua support by default for all devices supporting it. FUA support can be disabled for individual drives using the force=[ID]nofua libata module argument. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Maciej S. Szmigiero --- drivers/ata/libata-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 29042665c550..9e9ce1905992 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -127,9 +127,9 @@ int atapi_passthru16 = 1; module_param(atapi_passthru16, int, 0444); MODULE_PARM_DESC(atapi_passthru16, "Enable ATA_16 passthru for ATAPI devices (0=off, 1=on [default])"); -int libata_fua = 0; +int libata_fua = 1; module_param_named(fua, libata_fua, int, 0444); -MODULE_PARM_DESC(fua, "FUA support (0=off [default], 1=on)"); +MODULE_PARM_DESC(fua, "FUA support (0=off, 1=on [default])"); static int ata_ignore_hpa; module_param_named(ignore_hpa, ata_ignore_hpa, int, 0644);