From patchwork Tue Nov 8 05:55: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: 13035911 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 B4F29C4332F for ; Tue, 8 Nov 2022 05:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233337AbiKHFzy (ORCPT ); Tue, 8 Nov 2022 00:55:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233313AbiKHFzu (ORCPT ); Tue, 8 Nov 2022 00:55:50 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AD422F67D for ; Mon, 7 Nov 2022 21:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667886950; x=1699422950; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vr6aZ39Sl8l5+IvhfiJt7mmTQgIrV6exE26ZC1eho1g=; b=BGNw4ijUlVbaaOVX8Gvk+vZ6VC4828Vg7vlDdU6n8oqTn/c3KPnR0cJR QKbTex8CykKH/0mTKnM84alG0c3R9EY4SN86NZz/jpV5ZrORHp0QKI5hc FThjw8bMB2vdPd2/qRv1SPqAI66nj9afY+HXmoRiKjUD8Yk+Q7pbfZtfn owHql9321Q1kvaPxV0iKUIZviHV5iC6THi+Va/INdpMAEoyjyqxxgieMg IisUyhnWtZ5tuIrd7ZRU4GJadB1tSbc5jQtjDiGnIzC2Xil4hG3SdPqwp 9lKJQdExlq1/JmtWZI+h11L9hbRnchfLAGX2gECDkmcPTupDm0WKrFGL8 w==; X-IronPort-AV: E=Sophos;i="5.96,145,1665417600"; d="scan'208";a="320067439" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Nov 2022 13:55:49 +0800 IronPort-SDR: uBfY5ISW5CiN2nzYh9okuivRfsDn0lYaS6dxU26UYCSAoktUyW6WttwBPywFNBQvu39Ombe/3U ggIh5tePoBWxL0U7VLPBNWP5osPbUxx5X7r4eFxQaHrzatJG9jTFBu5oWQec9fSrcyhyHmTbDj 6ibdis+QP5tYAtZYLcCs139jesUigza3cu5WS7Tc5js3EqhlzYVyKx8vzsKeL6Rr7bopC0D7lD m0eZdGptFefH+E8/OCrBMAXGDY4rznrSUDO7jqFdj1mIpEuJpm35mYGIbTz4fXDXtc6zonbbAX dr4= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:09:11 -0800 IronPort-SDR: ZEpzpklL+hGzkBQ2iyjSe3iKnztDwz3Z/M8xfrzosIJyxkaiUWPBmrGClWhw4+3P0VHrP5KmnP jo5dxe/XdMCYx9N2JAEa6U1aYtqleBbeI3QbonuUBHuammWpcwjl1NF714p1Ko80nThrXsRFey 1DiMdwp2pAjfyL73Qwb5BJq533ship6MCcqFhaI+/uRVe5jsWYuTFTcGz1N8Dd0SK5XMKtbnvQ lmUEB+ElF5YSdi07F85Dk+HrTLmbBY0WN70E5ZiZG9Nwxx9PWVv0Sy3cs3N3Zmi++/VOYH5dgL g6k= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:55:50 -0800 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 4N5y511t2mz1RvTr for ; Mon, 7 Nov 2022 21:55:49 -0800 (PST) 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=1667886948; x=1670478949; bh=vr6aZ39Sl8l5+Ivhfi Jt7mmTQgIrV6exE26ZC1eho1g=; b=WpS9ChoUvJMnqO2XMCvbIgdveBv4dsZprV okAy4MoJjNEsZ5EJRhBRaAm+xscbCTZV6zFVWk8t+FJg9bUMBP8bYktssZ9YglkT vjHf2zstfb14ISEzVlhmP4OgP9EHTcaorraeapewn/syx0s4zTMLzAF3QNkahx/O nrg5TCfI96efGRth0gu8I++pWrqoR0fUIOcP8/mFTKg8NosvX8Sn3YhbuCE32iBH GtPZprr8dTU08WUMcLFGabS5PCLipjFtj7CUC3rT69M3kYRZzuhEau1FnsoW0NH7 IOUJqf4oWjbm8YWr5rJwbLH7FfPPoVUQpaK/zYHCJd6H55yWnljw== 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 d9ZUmDfVj5tn for ; Mon, 7 Nov 2022 21:55:48 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N5y4z60ZXz1RvTp; Mon, 7 Nov 2022 21:55:47 -0800 (PST) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke , Christoph Hellwig Subject: [PATCH v6 1/7] block: add a sanity check for non-write flush/fua bios Date: Tue, 8 Nov 2022 14:55:38 +0900 Message-Id: <20221108055544.1481583-2-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108055544.1481583-1-damien.lemoal@opensource.wdc.com> References: <20221108055544.1481583-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Christoph Hellwig Check that the PREFUSH and FUA flags are only set on write bios, given that the flush state machine expects that. Reported-by: Damien Le Moal Signed-off-by: Christoph Hellwig Signed-off-by: Damien Le Moal Reviewed-by: Chaitanya Kulkarni Reviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn Reviewed-by: Jens Axboe --- block/blk-core.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 17667159482e..d3446d38ba77 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -730,12 +730,15 @@ void submit_bio_noacct(struct bio *bio) * Filter flush bio's early so that bio based drivers without flush * support don't have to worry about them. */ - if (op_is_flush(bio->bi_opf) && - !test_bit(QUEUE_FLAG_WC, &q->queue_flags)) { - bio->bi_opf &= ~(REQ_PREFLUSH | REQ_FUA); - if (!bio_sectors(bio)) { - status = BLK_STS_OK; + if (op_is_flush(bio->bi_opf)) { + if (WARN_ON_ONCE(bio_op(bio) != REQ_OP_WRITE)) goto end_io; + if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags)) { + bio->bi_opf &= ~(REQ_PREFLUSH | REQ_FUA); + if (!bio_sectors(bio)) { + status = BLK_STS_OK; + goto end_io; + } } } From patchwork Tue Nov 8 05:55: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: 13035910 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 ED9A5C43219 for ; Tue, 8 Nov 2022 05:55:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233122AbiKHFzw (ORCPT ); Tue, 8 Nov 2022 00:55:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233337AbiKHFzv (ORCPT ); Tue, 8 Nov 2022 00:55:51 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC1F313F6C for ; Mon, 7 Nov 2022 21:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667886950; x=1699422950; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FRMf2u660Bw8sHzkZ7hdCZ58aBmYZ5UfbTABJ8LEdQ0=; b=iegZCqu2h6gaoTo7xT79pdRkRphv2F0QcnGYDiZr4sVbhBJMuLEDxcf+ d1dy+Ok86mvOzDY6EKiUEhcZcWBER+mT3v2cJsSTTsY1rn0wkMKIxYSod yIfiXtFnvqi5O3D1QugrZf71vGNx0vhbmfBkYkJB7Pf+9zOUD37uz2SSf V/8bbHx1XHKKs35iCRVjajE8PQvULlchH2DxZJOsm87Al+j8+z7rmfFyT tC1KVgxL50MkABTPHdLDqz0sguQrgN+xqp482ix4A3lBNpa1byiC4loaL 73QX89WBaqboOzn8VhSQMsp4AgGPz2Pn2JHhNu2a3sh6V8BZHfyQuPs39 A==; X-IronPort-AV: E=Sophos;i="5.96,145,1665417600"; d="scan'208";a="320067444" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Nov 2022 13:55:50 +0800 IronPort-SDR: a5PYT5nauYNprd3MTcG95GHDvJUsykUb2Orr1dmxvrn0OZCAWgr0yiMn9EfGIbj1WwTp7A5RFw M5IjR2aGlhA4U+n00m5+exyg1oQZ2dbIgWe7wt4xxdhyMejVDA3KX+rvZzNSWKF2ks6Jlp+ok0 b5mHUomUXlAMhi1CbMUPogPNkzmCwTcsUMyzSAYskH8/wBEt/1VMx+pBqBa8b++FxPkL7uEKKu WEAo+lc17hDUM2ZVykYwIYctpecmQ+zYHnNhF94sWIS0y4rP4d+Xjat1fANRNRC2PCsQBHwtoR jAI= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:09:12 -0800 IronPort-SDR: 1epq7adSTiijPLLtap0//yqc+glyN8xKHExB7T/0Cukasop3G/4G862mJhfVrRKTISWske0ICl eOQDK/590cRQSAQlztbL9rtxoW65FSe8KOFTMNlGqb/1yVr01qswuopA9DZTUGvGc6NFSn/KHm P29mnUH4RAYUtne/j79sSFZXn+rZB+oLg9zPeq1rftOzpKqHNgyYtGSyiI9lucSUW2yiYxHaOw FzhA0VvIZSCGI6+ZUbti34acAtRp7Gt57MLD8M2GtIZqmYJ71liQekBKgR43gyeM87OSaXgOhM Z1I= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:55:51 -0800 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 4N5y523Ns6z1RwqL for ; Mon, 7 Nov 2022 21:55:50 -0800 (PST) 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=1667886950; x=1670478951; bh=FRMf2u660Bw8sHzkZ7 hdCZ58aBmYZ5UfbTABJ8LEdQ0=; b=iExdd4xjzzNpE78qmauCzrFzlGq14NfenC cQucrxFKK3ZzIy2MBnNhZytHT4RI/uN3UYcwhFcXu9UwhjC8y5QQKBRVL6fNCaop a5BIaDanK6jHBAEeztExfpGBz/b8E5gFPTp0LVY/XtvUJF7BB2IO3UNsMwNNYLur tBCktXqCeuw2KWyR24W4rEzVBctLxkKkjkyEcQocteypOUs1rWngXXuD3kC27YEf 9ooleb6VlO7gK/sT8zssaVrM6ebuBcQoJcdC+k5m7/wdAoJnGV4LjyDRr3HoLFXk IZ6IN/2AUUXaaQJWgje0l38y/36N17Pzw4Rcf3EoOfqKlF8UgySA== 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 IAN06fl6ditI for ; Mon, 7 Nov 2022 21:55:50 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N5y510lr5z1RvLy; Mon, 7 Nov 2022 21:55:48 -0800 (PST) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke , Christoph Hellwig Subject: [PATCH v6 2/7] ata: libata: Introduce ata_ncq_supported() Date: Tue, 8 Nov 2022 14:55:39 +0900 Message-Id: <20221108055544.1481583-3-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108055544.1481583-1-damien.lemoal@opensource.wdc.com> References: <20221108055544.1481583-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 Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Niklas Cassel --- 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 Tue Nov 8 05:55: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: 13035912 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 9BFC6C4167D for ; Tue, 8 Nov 2022 05:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233360AbiKHFzz (ORCPT ); Tue, 8 Nov 2022 00:55:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233352AbiKHFzx (ORCPT ); Tue, 8 Nov 2022 00:55:53 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 950E013F6C for ; Mon, 7 Nov 2022 21:55:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667886952; x=1699422952; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=72yD6iRsTcTQnmTGrcE8Sp21QO5a7ZQHprkJJaWcZdk=; b=MGHHvbDVCvcgsJ6/XtXgmzSrPB5P82yVkeRaK/yKoMA3lfC6OaMGhRLq 6eOjB/NB1qau+T5orfX9SgiFFJSH/8uqzq+m8jWoPQz89hUnW/ZMawqSk dEHrL53dnGgaVnp9Gz24l04Z52KUceJ6Vl0carQcWKvwwrHdRrdGu6tVk QJbVxb++YeUbLBoRXtM/qmhhjJlSxj2VAyo2BdFtcW0Lr7xk3aOuSD4Pi JIYt3XrSioc9GFVBt2ShhyfSNzc16gfl0DJhf/VvYAbwPut1CmUiCyTr2 63Z9tBy+IZj06M34jN2oXB5I6WNn/kHM51MzAJjF/jZTZqc51fZhLVrLQ w==; X-IronPort-AV: E=Sophos;i="5.96,145,1665417600"; d="scan'208";a="320067450" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Nov 2022 13:55:52 +0800 IronPort-SDR: exNjBxV9712GgWedQHYWJjXO/fVmKgKQVgVJKVp+uDVoAhWtMX3rMGMMHxIb1nqdzMKFikbUb+ O7+PW5SEehn44mFcDdTf8KodIGZBhcpOpuPsDP5T4B1UJLXNNXXeW++7aDEgU9RThQyJ9AMpXM DefKz4nVJWbxhuzZk8SiZz2BPIPEYFfGJh61NxLX5sKEfTiGovkAI+W1tWHdQ1K+smI6UoDVmi 3eawUQTxott3HoT9Dt/9G9AVVHR+D6+ht5CJhUmC6YVs9pwrDM2vE44zyH4vA/EmPWr1nx5jGk nt8= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:09:13 -0800 IronPort-SDR: h/QwyiSyfrSunDMjA1Y4KXo5zaYwX9ljo7hYGkbX1z3TosQdlwDACID/NSyYTJFER8RhDJ3+WB RDYlUmlc9ZAzK+h30mzwuzwrzDTXaO3LV6ZXumud/NpnVprrMICu2VC4OnVOjmOXW+1+hRMxmm 0UnT4/UNYNIri9ASWP90ZdMgh9IepfpiMGxwyXUdA3W1FW+ZHylk4rwQMAzVxSkEJk0ii58cwp yJwpb0VEyhRqCIVuIHdTaMDHTgU08uMNkYEwaCussriXOXOMXTOPbz4fPHyBM9Vzl0CWlY6GK6 w4s= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:55:52 -0800 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 4N5y5366wjz1RvTr for ; Mon, 7 Nov 2022 21:55:51 -0800 (PST) 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=1667886951; x=1670478952; bh=72yD6iRsTcTQnmTGrc E8Sp21QO5a7ZQHprkJJaWcZdk=; b=pzNM/9yDuzQaBSXXI3kLYzFeP7eWQgNysM RUO48Ams/0lv5AXHNtKN12RC+qMjME/q2mYE5qg9B0wYDVLLZwWqx4DAaKKLKIzN 9iEqq/6/xrtwl0vie6KjIUd5G1nQJ9KagfoSeV2YlwzDbVqIJdnqM+BVfILcwzHD wvwfQUrAmrmVR2HfX/9aIa4tf9AoiDsGFpVQ9sm9zF+wYe5Y2hPWAdoj8Uupwpj6 myrDeB8DC8A72z82siUjkTlXy+PTBhV0gzhxS5KE/DP8IhumRLw8d4o82THaNA38 wPYW973sxjw37701YHBQgIJJhnqUeKReKk7NKgTuzudtc9Zb4tTA== 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 G_YPmqfRpS8f for ; Mon, 7 Nov 2022 21:55:51 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N5y522Qqqz1RvTp; Mon, 7 Nov 2022 21:55:50 -0800 (PST) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke , Christoph Hellwig Subject: [PATCH v6 3/7] ata: libata: Rename and cleanup ata_rwcmd_protocol() Date: Tue, 8 Nov 2022 14:55:40 +0900 Message-Id: <20221108055544.1481583-4-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108055544.1481583-1-damien.lemoal@opensource.wdc.com> References: <20221108055544.1481583-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 Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Niklas Cassel --- 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 Tue Nov 8 05:55: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: 13035913 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 B0249C4321E for ; Tue, 8 Nov 2022 05:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233372AbiKHFz4 (ORCPT ); Tue, 8 Nov 2022 00:55:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233343AbiKHFzz (ORCPT ); Tue, 8 Nov 2022 00:55:55 -0500 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BDE93121F for ; Mon, 7 Nov 2022 21:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667886954; x=1699422954; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Y1oHlaEfygn6ztjf50HbQqd13kQE8Z4x3RUaGrVkcfw=; b=Lt8IWztjQzjUiUzDGGqhdkB/76pHgU+n+d7W5ceKE+EuHxDZmAbhGqsO yfqeCG5QRw4IRmm0gLl7qdZYKvHjTri5twuZLXGLU4Kbjd7YVZY44752I 7doKelwZw8OlZP0zmoT0+oElzamE0F1K427YgCWvpXiC0AIYeYD+mAIC/ Pl9GlBgD2wCkZmoPgDVCkF5UvZ5+ZGZGfw/F3N25DvDas2xreEc+pTfoz 1Yem03idZ7aDwYqx8E+O81p3iU5ahuQ2A1r9XyM11C/dRraHjTj44ofqZ yEJKY9SI+S9iTln+MCgk5Ex2GsQq2+BKi3MWrOQUt4VeB/8Z29lRlYmak A==; X-IronPort-AV: E=Sophos;i="5.96,145,1665417600"; d="scan'208";a="327831369" 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; 08 Nov 2022 13:55:54 +0800 IronPort-SDR: 5JbhHL52PpfI+PhHehHVgvCohuYbGqcr8BSE+dKmrGOKCs7BQoBEPAvuFpAUtDFtpX/4n83d38 KoaUs0LuZWvSp7hJE3y8YWQ+nfw+VW9lshc19w5nVRyLZtycVWl3KPgYT1uYOcS6D0wLDer8MP 8dQMo97L3xTwcwQy9HwUfM0BjbWpuSPijRDEyEpujv0OKq2Sk1NR0UG+4U8wlu41PARjqVq3am Xt+qvWPsMWVv+SD2Li0Xqftw5McUbgQMLLE3CbPJlOoo4HhYVnToiVRhek+mC7OyX89/z75rsq 3i4= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:15:00 -0800 IronPort-SDR: ePXfoX82rekteKdMTX0G1Do7U1S8azg76qDgQ5j7409RE3BUj+wLCjz67muJDt6lUQklFatuoz eG0P1Q7+LMQSEcUKBA4ehRFz0EL9V3fiO/PDns3yPfSEa9gWT42b5e0c07ONRVPfR6jUyNaHrg n1mK4mob2oKCTSIcC6ZNHUHxt9GLHqRUwC/Ux9N2ggzG2OmNUv5KhKLUSSebM6FNVnm05ER8tT YQzVtLVzzlTFnHiUfAwnvfeQzvDnP/zvF69+VVyqbj68Kr6ji/+vj512cdRO/eFUyxV5UlgZge vkE= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:55:54 -0800 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 4N5y553x6qz1Rwtl for ; Mon, 7 Nov 2022 21:55:53 -0800 (PST) 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=1667886952; x=1670478953; bh=Y1oHlaEfygn6ztjf50 HbQqd13kQE8Z4x3RUaGrVkcfw=; b=ICPEDfVs1V6YuCTaou+WpaHfI+UlPu10PZ 3tas01YaLac//R8KJFK9F6SuOtW9T9IeuEetrsXCNhtr3kIkDaZYfSGRAZHfQYKy KI78KoUILL2KRWHr1zsipffwdtIELSQwY8ViWD9xIljKDuk50IzKRizozBdW2UC9 WkefCEK9NHtA4yFhzdDYApyJzAu5O8dAqIaYZ/TjAxrHU3X8uKW2qNEYjjarttke b7Smkrt4ADFJj+QmyaCcjiRSRGih5zk23bE6ydpVHlQWHAUQehIJJV2V2FPAXWKz GGXkBzTU2nW78xQO3y6mWAekJWdzIJMqr8l7xAPqFeLoPcdIhi4A== 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 Z8qjOYrez0iD for ; Mon, 7 Nov 2022 21:55:52 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N5y533pwPz1RvLy; Mon, 7 Nov 2022 21:55:51 -0800 (PST) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke , Christoph Hellwig Subject: [PATCH v6 4/7] ata: libata: cleanup fua support detection Date: Tue, 8 Nov 2022 14:55:41 +0900 Message-Id: <20221108055544.1481583-5-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108055544.1481583-1-damien.lemoal@opensource.wdc.com> References: <20221108055544.1481583-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 Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Niklas Cassel --- .../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 Tue Nov 8 05:55: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: 13035914 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 4DDA4C4332F for ; Tue, 8 Nov 2022 05:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233358AbiKHFz7 (ORCPT ); Tue, 8 Nov 2022 00:55:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233352AbiKHFz4 (ORCPT ); Tue, 8 Nov 2022 00:55:56 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3828713F6C for ; Mon, 7 Nov 2022 21:55:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667886955; x=1699422955; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3yZJ4tehjcS9Lp4+CyZQIBgOYumFf8isDBiTp4IA14E=; b=kaRKQGP4FzwmFN3OJElqq3mf0TB8VK3POCie/jCt9cbDTZqsDBmnhTkE LERABXELZJMe5Ei3qC99D+Vf8ucPeupsTqgO/ZJUcsIjDxlf7Q5KZ9/7V T/C/X5rGQFeMx/ozTaT1QJOT20ur9MzatSWVAU0kCGiIo/WwdlZ/xIT0f By9qCP3mcsjZQeblX3FDVa6yuEBQ4zC6QiTdV3ZQoqQd2A0QTA9CnvWYv KyKV3tgygoc7Qslt0NAz2TnFZ19lASwncbqD7HQmMKPsQzTFOahErGrPF KkAnE3gIh/fg0ZEVlnzORUWbRp72P34+Z2ESnEDo002YzlZlwYKRKYO+3 A==; X-IronPort-AV: E=Sophos;i="5.96,145,1665417600"; d="scan'208";a="320067458" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Nov 2022 13:55:54 +0800 IronPort-SDR: ZVn4mfZEurbD/YSBkJS4xfHuAXMaJxfNKE/PCoK6Jq8Xf41fG9F+lYsbbfcC+Nm+uGiOW+PPtM 2iJoE3bKg1ait178zR/zohvqP6eJq6Wbm19QTrazeBaqjzyqKlQHWUw32KQz5ctURzutWVNGgJ I6SHeskn07CLnZO8tCy0XNyYOTVQDNpo2Q/qTrtT/82WgbbsRImF0ZLGcbeEZqy33wBkvE09GI qTPMowNKTpPp4Xo/s6+GOk5K8UJMS7Nq5xgWA53gVclAVW2e52SMNVtz05yS1nwkq6P4xoXAx0 o6g= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:09:16 -0800 IronPort-SDR: /g/uSUYaDOuK8FTOrYyXO1Agsw8ghsilcy1t1vLMoOS42+qAys8hDMFALjs6pl62f0QQjmNiet FaldXJmhsRyd1L3w1xk9wFu+b6Nyw0IK5Dw5PCnmj6Uu39lj/JXFgRsnIxmLXxqEqLHhw86cEm vHhXncsuBT0+J/FHUhesmeS1XymyJ68hXdZMmB9a7bYcLaaIwPLpC8JaBZca4XCWL64HRmKPYw Ov7yR4w1+lgHxxMPgbnJaFDtkHIcySAxXeYla3UFG9QXaI9RF9Wj+8z5TAFZGw5jVTmNr+q9IE occ= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:55:55 -0800 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 4N5y563c8vz1Rwrq for ; Mon, 7 Nov 2022 21:55:54 -0800 (PST) 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=1667886954; x=1670478955; bh=3yZJ4tehjcS9Lp4+Cy ZQIBgOYumFf8isDBiTp4IA14E=; b=QQ2MAL6tk5L3gNK06YKAKPOcDjAyFgTTYU nFXlWMENAG7Srlo4DUxm13JyEmfWSGttOVlR/j1oqpgeoacsm2IJbQ4twhaR6M/8 UGPBIjD1h4+nuKQplYZhdiA5M4JmYIY7oXm3xHSbBWhZ+7zT+VGSSwrWPLMdJW5c ZnTLD8l8tADImXm2GxOQAIJh9vbUX9ocWFoGXnOAMf6r7gBwc8N+ZFMtEtPIjdb5 D9yqE6mcpl7R+lg7rUGJSRJEe+jrdVoW8HAJ0YGsW+q9nlh9/ozngaL4s7ku+2BC xJuqGuO9Ybiw+IEaUyeJBAOGwf4u1nKqH0j8Mh3pKE8lcsUNmZPg== 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 6YCh6ormGw04 for ; Mon, 7 Nov 2022 21:55:54 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N5y546TBXz1RvTp; Mon, 7 Nov 2022 21:55:52 -0800 (PST) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke , Christoph Hellwig Subject: [PATCH v6 5/7] ata: libata: Fix FUA handling in ata_build_rw_tf() Date: Tue, 8 Nov 2022 14:55:42 +0900 Message-Id: <20221108055544.1481583-6-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108055544.1481583-1-damien.lemoal@opensource.wdc.com> References: <20221108055544.1481583-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 in the ATA specification since ACS-3 (published in 2013), remove the ATA_CMD_WRITE_MULTI_FUA_EXT command from the ata_rw_cmds array. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Niklas Cassel --- drivers/ata/libata-core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 30adae16efff..2b66fe529d81 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, @@ -727,7 +727,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 +743,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 Tue Nov 8 05:55:43 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: 13035915 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 F3584C4332F for ; Tue, 8 Nov 2022 05:56:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233420AbiKHF4S (ORCPT ); Tue, 8 Nov 2022 00:56:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233401AbiKHFz6 (ORCPT ); Tue, 8 Nov 2022 00:55:58 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B763123E for ; Mon, 7 Nov 2022 21:55:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667886956; x=1699422956; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WB7NEHrkve32a+KNZp5b6r13nV5v7Yd/VdIsBGzIuYo=; b=MoWDcIGW1gc0XdIJG6W/fDeuwGRrvxDv3qbHuFy3e6IIQvq0qHg3ojsE FUmfY1WtI2M+wQJqjCTDMy0UKveThdzVFsq+empVRMuGajqVodduDqU2O Jg4Qs/ytPb52zT0hNSYSFct5lGs5DdI7L6ptvKVvwYAwA3bMMLFfOCk1p 0nGs7B8SGp6erm608P4tjfgtupZDc6W8yuHZLeq5A+GDQSZueG3DK6hIX cDDuzdBlhU1qUYaZEsUKoiHiu49JuO3eq2HYLJ2iZyMqK8RbqDYNDXwAu ZnHWyCE92YoFJgZV5iz3XCOPOzMgg/yZKfqQiPwYh5CEQfVO5p8b7mk65 g==; X-IronPort-AV: E=Sophos;i="5.96,145,1665417600"; d="scan'208";a="320067467" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Nov 2022 13:55:56 +0800 IronPort-SDR: HNKC5SgZbmUpQMzcEAM7nbEyK650SOhHws5rbt0qVqKYRDjf1tqQkayC/2Liv1Rg+72DFApJFe NAx/xW74UeEvER/2qSO5PCAHzPhJUlkDlFPOO78jH6J6PbYFM8z1limIYdNXy4hohnIGmEKC3h fUk1hBlTOVMYvDFLz5+8mqyjtgHp8iOhtveLphUC6S/Ar3xa0IAjQArFtVI4jcvmG/k8BUHz5a Jvp45/g+QSCLSSefnJeeuTcRRzedd5rC4XpDAMKV9ELLAYa4pM2/astt8RscTiLhhN4Gl/baQj 5To= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:09:18 -0800 IronPort-SDR: 3+qjY/TAYrjROImX7vFUNklaZYyJsXC5lyUQlaFxE5+wVVMdx/wa6MAsj4RH2is4dAqM2APxS/ 1T8+eE415X2Ymex2/wT67BIONDJCv1K3NpqdTj6/t8LHsS9KxBVdiOT+c57kXwrzMXI5mZ9iQs RvuN0XbhDxWFlucFZ6O7vjXLS6U+DPSKGL6omJEUzlSsCtNGW1hxo3QoAP0MJaIGVWpsrxZnOu R814Y+xKjbfI2/EmdnV1cdo6sfm1jkdZVRILkGrjGwJbFcOCNOR0wznuv5OJxCaYLnGweoxRSi 8t0= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:55:57 -0800 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 4N5y576yyDz1Rwt8 for ; Mon, 7 Nov 2022 21:55:55 -0800 (PST) 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=1667886955; x=1670478956; bh=WB7NEHrkve32a+KNZp 5b6r13nV5v7Yd/VdIsBGzIuYo=; b=KGypXn7j48rFHt04x5hD9ULEX/b+BiuOHB jUNwX1cyEwqQ0/a1hTXe2NnlgUolfpstk82kCBPmyO3fKzODUW8JZX65fR/VR4bz lIxYt/14qWhBUddOVQnhLAmRsrSdnzd/+1HtFaDzYmwSYmT1ZDVYGOnOJZDnVs3c d3zkxJFB5Peoy7bJMYvmlL5RytFEFoG/Mo/91SZvv+DvtBd8sotDPAIN88ikPWIy rm1ut986yuBC6W1U+JkMxKmjXr6J6zBFakrGCozc3bljzUpPPXSNL9V7P9LrXpDF MoCjBQRDrv5JG7IhLwfS0vhQLXIyv02fJL1BbgRNr9QvIJJCJ5NA== 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 wLzEq9bMyWZI for ; Mon, 7 Nov 2022 21:55:55 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N5y562Y3Lz1RvLy; Mon, 7 Nov 2022 21:55:54 -0800 (PST) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke , Christoph Hellwig Subject: [PATCH v6 6/7] ata: libata: blacklist FUA support for known buggy drives Date: Tue, 8 Nov 2022 14:55:43 +0900 Message-Id: <20221108055544.1481583-7-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108055544.1481583-1-damien.lemoal@opensource.wdc.com> References: <20221108055544.1481583-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 Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Niklas Cassel --- 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 2b66fe529d81..97ade977b830 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -4133,6 +4133,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 Tue Nov 8 05:55:44 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: 13035916 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 26BB0C4332F for ; Tue, 8 Nov 2022 05:56:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233446AbiKHF4b (ORCPT ); Tue, 8 Nov 2022 00:56:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233413AbiKHF4G (ORCPT ); Tue, 8 Nov 2022 00:56:06 -0500 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D29E2F672 for ; Mon, 7 Nov 2022 21:55:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667886957; x=1699422957; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MzodolIBXzjJzo8qX7vax6iZ+4wEc086CZFFgStxWSw=; b=fmlGCiXcgDnqA3qmwKXcbMZZVb0LijFkD+tPNH67KFlquYB3eXuRO/7g cFr0Ln17qC8UNSXhPEkyfISjRSt1gAM5PsOWKNGswMTbG2N65fE640HZU pQzBzS4rg9nj/0ttdNOJGo9PXBYanBfu/r16b+a+zoFJBxV0XX6XwkFUt KW5C4Yl9js5bQltlk+O0dMrMm5ZLvRpOMrzJozCbxWzXyKU6FQSO1yZP/ Wh+6XMSQMH68hcurgToVgSvOGomWcaCi0UTK7ghDwzepqIMoO/m+rSiYp yFAZ6/jIe1TgWpvcF+AdOiZv3q89Yxnf3HFlek217/ulhZdNa47ONBjfC w==; X-IronPort-AV: E=Sophos;i="5.96,145,1665417600"; d="scan'208";a="327831375" 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; 08 Nov 2022 13:55:57 +0800 IronPort-SDR: Cg/Peohw3MC5jupJ/VyTHN28weT72gyPJXvuvS4OIbVpoMLLqoMq57hl+pTKJGO7nfEBX+T7Hx zAfu/vlbv9W2XsrNQsX9C6EX73qGyp7wQU6yl8s6JtLu8x6fCBQ7zV9AhvNr5+zIAYY5P5O28o wu9AgqTrNf/i2cGPKV57mP2R3cC4PzQqgLbV4D+4kvsfjB1Qoxt+y7qvErl6+WS/8o9Mj+tHFe WQV4nUfu73F8y5mybI3FpGZ7gO00yQrypmaDvdsOJliaZZahqZtIgQLkuwD+gaQOpvUL9vlDKU Jio= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:15:04 -0800 IronPort-SDR: N4u1KjzNqhtPE7kSlpt/gj7pRI4tOHrliMez/YEynWWi6MiqtV+AqiM2h/q0xZPfGn6cDSdwFo FtxbRXGU6Lhq12eKVsx+CpF8jcjJi8ub6CUbVVqWfEr2yT0/9gPrG8T39BEMmdh3v66Sdb7+xH +y9TfTJaKtWd8IL/vFQXThFT5XoWtSDRpAPb+PCJYh4ylo0SfQpurtCsIwrc8/gTyTqKMJK+LY wB1bhtKBKOlzEni4sYscjNXqdKN3ir5IGq38JJspG9zwS6k+8TkkfCBFWZKVJgzQsvGHa917rM Wk8= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Nov 2022 21:55:58 -0800 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 4N5y5907c7z1Rwrq for ; Mon, 7 Nov 2022 21:55:57 -0800 (PST) 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=1667886956; x=1670478957; bh=MzodolIBXzjJzo8qX7 vax6iZ+4wEc086CZFFgStxWSw=; b=a5DHYDEOiXZLKy7A2nc8/vr7X5DowBMNue cojTCNemnbJh9rsDLtZOQTgrd6COznK9mNypsBskBb33d2RhyNZ+adf9Grj9YP24 O6HHrqnlFVho2uvbo1+pTmsCcsySSH4NBealyxvwd6m2JlSV8aANq5WDiyBz+Sjq rdPeQ9hYkbS/Rncvf+ZrVIMmBbmRgn+GRRaeMyHc6XIGM3r2Tad5LeTK4najJXj7 cMkHFqVUEQvmjaJzz/ODPvt/yXcShGbTenDCgo88RvRN3JkJiOkMwIu8ZnHKQnXz RAq5HJLTLx/miuGLG2H8LNtupNIakNsu3XUsJON6p2NQf1z0sC+w== 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 qhAIo1p3ibGW for ; Mon, 7 Nov 2022 21:55:56 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N5y574bhCz1RvTp; Mon, 7 Nov 2022 21:55:55 -0800 (PST) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke , Christoph Hellwig Subject: [PATCH v6 7/7] ata: libata: Enable fua support by default Date: Tue, 8 Nov 2022 14:55:44 +0900 Message-Id: <20221108055544.1481583-8-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108055544.1481583-1-damien.lemoal@opensource.wdc.com> References: <20221108055544.1481583-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 Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn Reviewed-by: Niklas Cassel --- 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 97ade977b830..2967671131d2 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);