From patchwork Mon Nov 7 00:50:15 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: 13033711 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 A0761C43217 for ; Mon, 7 Nov 2022 00:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbiKGAu2 (ORCPT ); Sun, 6 Nov 2022 19:50:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbiKGAu1 (ORCPT ); Sun, 6 Nov 2022 19:50:27 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CBF8BF5C for ; Sun, 6 Nov 2022 16:50:27 -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=1667782226; x=1699318226; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4V2Rz9TG67q8oD35wKvWjqMf6Te/5DihZHiUpOsyzqE=; b=nOcVW9Mz0faLjnFydlx12Icldii9Nzk0uvX3X6LPKCQYPUpaRCvDbNRl N2Wgp9tjBwxBLX/6d8IjtBzqYMYKtq+9Hxe2NXaeY4jCxPLJ8h/4edPmq Bjszq82qOEL0R/4iI9Q+oH/SuexL8NYuFJqdXBKvIq/L13ggX5bufBnho t/S9MdgtkJI1fE82DRCI7al0VzOb1YSP9WjvTC4Hj1sJXj+GmlUx9DL/O QZQ0CYMsE4rII18aXw2MYEPrPXX04Y94+yoWruGWsV3e4HIkjaFPABXUE sp7uNzt/rmio4mqYHTf8UBlQNQ9FSU9FUWfxR5NHzHFBRr56Gr2FyI+38 g==; X-IronPort-AV: E=Sophos;i="5.96,143,1665417600"; d="scan'208";a="215958469" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Nov 2022 08:50:26 +0800 IronPort-SDR: J4coywGsDOFjkvu7WTQRMJsYlZrxiu/HAYSeNHCugsyT94ODX/Ghn+NSRAX1YvD/EIvuln10Qr nRibUylRH68ICYN5HCKteZDrfhfIOVO6m2t6ot3wfaoSw62/3/fyf0Z1Ck9e/HSUnovKmeDvTd XCgtbx8lgZVCd65nFUzCLOtfGd+rAXxDqP9WVZBBMK6/LTeOOSvWey07vFS36E7h3LJoWLcYis OSGqgv9sTYNr78p+VzLw2wfco2c/mLZAkDW09lRc8st3sgvxw5VHdBKBW9tkunJ7cG41RGK5To omI= 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; 06 Nov 2022 16:09:34 -0800 IronPort-SDR: nnWEMFzmTwmipOeFNA69WupDIKkZU4fqMuxpRBglPfwC1pYJnOUQo8dTTM3pFGjgHTpdvrPeBg /TkRIDFNd7eg2uBlXSJYwS0rF05LO7xiFm7btz3qyKNEFbdfXe+SVKb5C5F7b8xI1RCEyjvnEC ftsH3Y2WvFAI0CFp+Ti7yfVEVb6fpwE8U2CbC4lFVEddIA8SDKHCeLGxDst1NvXidiDxu3/Nbh 6mR3G0SigCDvtmqgb3sRKjknFOYPi7DITntaxZgs90Y7ks60g4zZq61aNaraXyVXFJ8rMnYjt5 3bk= 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; 06 Nov 2022 16:50:27 -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 4N5CM52bJQz1RvTr for ; Sun, 6 Nov 2022 16:50:25 -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=1667782224; x=1670374225; bh=4V2Rz9TG67q8oD35wK vWjqMf6Te/5DihZHiUpOsyzqE=; b=jTa262oWavLeLGHCQ2LkaqqcaTphRkVB+2 8bVeCq4mbKLvWLyoxO9iesDR1VEAQAFWqD9wsriRLuJrMHlaGZF0vsR69bTIMGjK Xq67lxvlnpslvxjjWznuoycjbrxx0M1Prmz21dFZBMpJzf8aV5fFSoY8lMUgg4mR oXV+4a9nby+51xGr7IrqlpcOUgDwAfQ/i0nDzMGHPFAuJbl07/3CTch35GCfNU/a PrAueJjlznPH1ae3uuUWJiuW8pQyOLfWg42uM9fA28ybYpWxu30vrkshLfLXo5v5 ZgP1QFcpl+RNpBlkLEPpSUDB0JiFg80rs3N8jjwlFq6NRpqlaAPw== 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 gEbrtcRXpRB0 for ; Sun, 6 Nov 2022 16:50:24 -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 4N5CM36hJMz1RvTp; Sun, 6 Nov 2022 16:50:23 -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 v5 1/7] block: add a sanity check for non-write flush/fua bios Date: Mon, 7 Nov 2022 09:50:15 +0900 Message-Id: <20221107005021.1327692-2-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221107005021.1327692-1-damien.lemoal@opensource.wdc.com> References: <20221107005021.1327692-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 --- 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 Mon Nov 7 00:50:16 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: 13033712 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 5FE7CC4332F for ; Mon, 7 Nov 2022 00:50:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230205AbiKGAu3 (ORCPT ); Sun, 6 Nov 2022 19:50:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbiKGAu2 (ORCPT ); Sun, 6 Nov 2022 19:50:28 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68FD9BF70 for ; Sun, 6 Nov 2022 16:50:27 -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=1667782227; x=1699318227; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x509jXSJnwObswBV4jpE+8MByFyOsaKwegxIAG6rrnw=; b=i0h5vKngrskFp5pvYdHCJvyCyxmIs6WbAZwcoaNyjGfQ0ORqk6jHMHf1 DRAI2IXYNZHrEwsThyGSmKrL36AT7STiTUqq8IlbmCF5rce6V3pBZkLeU Xdx7DCvvc7k1XXc5Afv/nsxJoeVIrUhJ1OwiCNhrde9j7G4VQ7UbX8f22 /SKpRPnn25T5E+r0H2q9qAGLty+/xhvZJeGi9lJ+dxL47L0dQce3Ug7e+ hyQECRXjMp8VBP2vNIkZtmOB6nL0LIFFZFs+w8BjoDZP17Hm94ziGmB1J Ze65CsVS3y7Hr7I83yhCEDAUPIiVTzz0kpn6oqGFmoXac+OeWopp+N4kO A==; X-IronPort-AV: E=Sophos;i="5.96,143,1665417600"; d="scan'208";a="215958471" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Nov 2022 08:50:27 +0800 IronPort-SDR: sAVF9HoxfJUu+++/Ib/zYgziZ3Ca8F6EYXRWkojjakN9cr5Um+C+ONHYRMJ4I6FB1zS1qY2bvU W6HQL+dL42tyeCT64OWR3TlX3XGfaP/gUCK3+pOFAR99Fh8y4oIwUKBPVZRkzZ+ikMKgHM/vTI euQWfbsaQhoDFhEheykt7RZCcHw9NlUsJER+SfziCGQxBS8u+qXTJSvnvrpMZQ6MtHH8Au0eL5 bO428addBrjhifcXlNG7cyUcwi7Vd04VM4/ip1BzvxqP0sgBw61RiqCDshs3mAXe8r2l+StDwg qJU= 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; 06 Nov 2022 16:09:34 -0800 IronPort-SDR: gi9yYThZyxAbXWUW3X9Hf3S8uuoK/LYIdsyQuxpyuMz/FIrykUFoExIbQ4nzEPqnH+zXbR1gxN e5l3QgKmZO6fGBWkgevO21KqudkG6uLlOeqJwG9j6pf5QgX8Z0w3ln6sloFuMdF2CbfGEuOh+0 1JtPzOhAVjKKCTJ6YdkRgQpJ6qn4GtU+I7eos+yyuiqcmshKHqnCAAQkswr4Al9DPDwmcX/VVY SFQTIy3NW9HN0+tGAAQ9tYTGAmQJ5FCWmR/0kuh6hLepoQL4TuXMCCS0KpOQ8bUDv7xy2cYyhX kY4= 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; 06 Nov 2022 16:50:27 -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 4N5CM64zhMz1Rwt8 for ; Sun, 6 Nov 2022 16:50:26 -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=1667782226; x=1670374227; bh=x509jXSJnwObswBV4j pE+8MByFyOsaKwegxIAG6rrnw=; b=r3FfqeGEm+idEbtNTXbu9RtDl/jJdejw1B bgXIVSnhGy1sRSbhLGW+NDmb4lcK9Nyrrok8sBa1v+w7abQ0w4sceEITkn/HEose ilWvTAzXyVx4NqDlAQ33PixmVvej0KZ60ei1Kb4BaVeKw0iJw+RJVHoiQSWVZBgC wjcuMOW6Z2xEcv/bR4cwKT40Sk+jBwaYculy/Wz7umCCoUpnG19wHkFjbsn0eXlB W2MhTmK4RdE+ZZLSgWH2hbHwcEh/ZXY2AWdXU01Me+GAEaPPnz+L4/MVCMTV094f MvDTmnygj9ER37VmaLaAi/7Kw14cA4RshnskP6tOmGDOEwvgeTlw== 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 rPgK8wDVHCzT for ; Sun, 6 Nov 2022 16:50:26 -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 4N5CM51Yg8z1RvLy; Sun, 6 Nov 2022 16:50:25 -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 v5 2/7] ata: libata: Introduce ata_ncq_supported() Date: Mon, 7 Nov 2022 09:50:16 +0900 Message-Id: <20221107005021.1327692-3-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221107005021.1327692-1-damien.lemoal@opensource.wdc.com> References: <20221107005021.1327692-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 --- 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 Nov 7 00:50:17 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: 13033713 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 BD6D9C4332F for ; Mon, 7 Nov 2022 00:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbiKGAub (ORCPT ); Sun, 6 Nov 2022 19:50:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbiKGAua (ORCPT ); Sun, 6 Nov 2022 19:50:30 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00BC7BF6E for ; Sun, 6 Nov 2022 16:50:28 -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=1667782228; x=1699318228; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xz6ycfIfidoOOGiPhXlSF5Bv4e0fjijWd4+tMRv7Bmo=; b=OYsp32JXca9fp48VsKHZQwxZkgruuQvNcmhiUKUspVPtIoU9XW9PiezA 7LRqVU56uziCqi1HaMl40MqXjS938y9yec/bHUIcTRx3BUzl3Yn7LHp3w HsyY0tuKQq6oIg6j7YBX30rAdQt1zIzzGXCq1Rge2xxEwH/6UuMP7SGFF YSMy97yENFeNtdiUP4N59H1zonyg7VnvF9XybptV0sqtQCYqxY5Z/M73M DP9gSmFP31PelTsHbCNceMM8/SokReEIMzwyQJ5jpPonHy+fGnqhMnSVl ozWbX/Q2HXxFFTNONGm4ptwii8edD79ox1gaRhLeUDn/rG50x6y2ldmV6 g==; X-IronPort-AV: E=Sophos;i="5.96,143,1665417600"; d="scan'208";a="215958475" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Nov 2022 08:50:28 +0800 IronPort-SDR: OxJKTwH9Saj1twEhy65oAdaOlSh0d4cVI3+beVHS9pgJ/wb6KGXz+aRDkp6XyAdjtHhGo6BVaJ HyMC74CnXrIKOr7ijAf65jdfnfZrY7oMVUoUKBnKyI+05inOXoye7c+4xR7+63eKeKL/Zbn/fx xGd/W+Ijepb8rhLb9znupXZekH3OrTr/eGLT6soaqkc7j5V0HcnENzVoG2+B6hAR4yreYPKCCh DzvQgQhir90uII3CZ4SVYkPyhoq5XmN8eEfdQ/71FVTNaPS0zGxuu0JbnR5nVP/9DnERU2dKy5 Nz8= 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; 06 Nov 2022 16:09:36 -0800 IronPort-SDR: Nbz+W0WUvktiGbB1f4GuKGddC6iVBXe+wfae+uqgvZDfE7vIWL6hqLa3h7Oq7zpB3EezBH+SS1 hfJxri8C0VrDxm7pszcxhVKEMsXvMhWNUgcOkMDVv51uSRkWkkf8mqa63FaOXnjk4je4P8Ktxu bR63BhGmrS0XG0bg0q2ynTwmIWILZY7WUS5886rqRVOf3uke4XTrRE98Cyw/gcGyYpqwzWOA+r BmnETfdLi7vuDtjKCQDPTBzD00BywfgEZae6a8c/fMVmyXDQ9BTqyDoakOZr9hQMOdXmelXSgA IvA= 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; 06 Nov 2022 16:50:29 -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 4N5CM80rwqz1Rwt8 for ; Sun, 6 Nov 2022 16:50:28 -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=1667782227; x=1670374228; bh=xz6ycfIfidoOOGiPhX lSF5Bv4e0fjijWd4+tMRv7Bmo=; b=DMDdbM5qMjqlcRYkIThNQ0G42Yj5EhNkP/ t66xUS0rLnL5c/wrS/hLz6uhfnrk2PR54dkWGacki5FNvh68hslhJTiGbA7wXAxh umLFWA5QYVXQzzF/rOO99GKwIo7RUIz0nqoABdgI35yIUihR8pLNY8uwiXNaAwp4 Uw1yTpNLXOATrgRJFAjnTts+TEyIjaWhaHbCPpXzBJoEF04oTavOUVXUPWcW6QEX MW6EcgMq6nRidNgq0YiE19qrVvjIPYyOyrBthDa27TL0lzsKRH+dU9YERE9qSoxO ZI9924g7JxpBzFSkHHaKFluk5QRcZtuOdT59TmJb50hhaBzdET6g== 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 csC2puh3QdEs for ; Sun, 6 Nov 2022 16:50:27 -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 4N5CM63qm7z1RvTp; Sun, 6 Nov 2022 16:50:26 -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 v5 3/7] ata: libata: Rename and cleanup ata_rwcmd_protocol() Date: Mon, 7 Nov 2022 09:50:17 +0900 Message-Id: <20221107005021.1327692-4-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221107005021.1327692-1-damien.lemoal@opensource.wdc.com> References: <20221107005021.1327692-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 --- 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 Nov 7 00:50:18 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: 13033714 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 465C9C4332F for ; Mon, 7 Nov 2022 00:50:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230106AbiKGAug (ORCPT ); Sun, 6 Nov 2022 19:50:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbiKGAub (ORCPT ); Sun, 6 Nov 2022 19:50:31 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E06CFBF6E for ; Sun, 6 Nov 2022 16:50:30 -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=1667782230; x=1699318230; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7TWEQQgjvLoQtW5Au9ZtMp+aKDP51r+1N5Z2PbiA6mU=; b=Fb6+aaIxCzJlq+rprCN0/DBZGBgW6SXR5W7xb+vWCOsNP7Eiiygvf5O8 v2egsH4BjQWyXQi7Rrn4WbLEZipPxNH0CsNiqQW4X301+R2ygyuarBp/T KgB1dGprOO0unF8VsaPojDa7fpR1Y/CRn3YID5KbxwHXgJqylKLZDnuK6 NxrgyUm/4/jgPnXWUjAvvD9npSESlucR0QwWCzc+JNmwaX0WunxGcvhYC KcgWBK4VA7IFj+y+MLjQfX5wwtj/JxEYQLvWgKGPGHcEvRTolxzHvgayR joUWfCsEsgArpeoxMBpcu5pCAUUoGg5q8SAyg/1h6v1xzsvcp72Ma0ay/ Q==; X-IronPort-AV: E=Sophos;i="5.96,143,1665417600"; d="scan'208";a="215958479" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Nov 2022 08:50:30 +0800 IronPort-SDR: YinuIBwBMxR8t2RVvFFRhOvBB4UUK0Kcdza9VlNWkswH6E1A2vfuEMPOFdWl0pEgm+RmlHmYKO YeFrjzHD+EwGMNqNAQ/JFdHK4hUBnua7YyDtLbyJZi89VIe9FjDGTVvJVmcZfqfT//ZxTpGQiu CaK1G24PmFjyRm/CKOujcQ7yPIET23H8TSwwpMM+xz90TAiSdNbjdHc+lHbYjdiQadpCJ9U/Mn sJp8nDVmhJUVtH6b3sQSr65MHrg7gszMtlc8O03dDx/w/FPHqO9vjivE9+LJkVd22x+ul+uHss fWA= 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; 06 Nov 2022 16:09:38 -0800 IronPort-SDR: ZSpXU1RLdPI72ANU1KFlXX39PDcimHfd+8e4VhfidAd5eiM2UNx2vQUZfMv8TB4Y/LpL6j52yW 8YwLpqRyD/Ga1AcrGSHzLUHonkAVpMg1Dnvb09gBgUT6ps8S7PC+vytJyJVLk4OOzTnnYJyk0Y Bt7dCOKy35Pj8NC0KXkGwN1c7cyIZum+HLF4cpc/5yuStqqHMnzZQaj2jQXS3jYs/DPoPQRFOH ay6skzj/WzVUaTnhZiA5rVIq582eH6BnpURQ84ifzxIrhaiJLWErje0eIsxfZUhdKZbLcpD0CL xL8= 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; 06 Nov 2022 16:50:30 -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 4N5CM95zt9z1Rwrq for ; Sun, 6 Nov 2022 16:50:29 -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=1667782228; x=1670374229; bh=7TWEQQgjvLoQtW5Au9 ZtMp+aKDP51r+1N5Z2PbiA6mU=; b=RIu6xP5ws9zmMp4e53wmGOF7hpLRZSmoq6 wSDjF0+lS26L1GF2obBq214oituDOAkv6DUBHGZ/8Y7zIEWLuR62y1yGB1Y4kLhN IihSnM1njhCOpsqs3ABSofXuw8vFnPCtm072lC0vb5H70BKETTnCzIZuftEraSAK yxFYuxWdI/FtjMYCVk2yBRYwi3bthzFazbU0pYZMg4jBsPbOpuxqAOlIw19ejyFM Zj5uYVjCEMGGxI687GwPDTlBwt3LnzlOUSGoclAXE2U7+56B7lwoT66Xt9/XFK5a 5qbK3UPyNfTQj0dVyeCKjtDevAIxUXbiRAtLW7nrh1LstwK+hP5A== 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 vtRtysu_NuiF for ; Sun, 6 Nov 2022 16:50:28 -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 4N5CM76c1sz1RvLy; Sun, 6 Nov 2022 16:50:27 -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 v5 4/7] ata: libata: cleanup fua support detection Date: Mon, 7 Nov 2022 09:50:18 +0900 Message-Id: <20221107005021.1327692-5-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221107005021.1327692-1-damien.lemoal@opensource.wdc.com> References: <20221107005021.1327692-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 --- .../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 Nov 7 00:50:19 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: 13033715 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 7803FC4332F for ; Mon, 7 Nov 2022 00:50:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbiKGAul (ORCPT ); Sun, 6 Nov 2022 19:50:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbiKGAug (ORCPT ); Sun, 6 Nov 2022 19:50:36 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 159A1BF7E for ; Sun, 6 Nov 2022 16:50:32 -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=1667782231; x=1699318231; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iCGQuYuIA21oG69sabowShd8BAXIR6ZFcrUBS9czmYc=; b=nzhU+DjAXgobHeZLYYSrYRuoVYSMc5GEA+gHCq52JE2pM5o2NgZKvbLp ++uxl6NrrTnRsCMk2+CFl0Ev8nvpB5NtWF61KcQdmUxpD70T7vCbrVpvn I0J64Rt0Kar2BcKKjAOxJKLPLb9kjELsOYFhBEJigWcEggx5lo8xZcj8K uE/5p2ZU46oogTNPOVj/0tBnq3xhWsQmilph2bvdOK2ZfkdwQdlqc/l4v V5gZadyMl21TIjPMaYfFGf9bbWkzIC8lUuBDmk1ESy+Bbkh8WUzIs1h2F wUL9/GVvrwfoeqXh7DY3I/LKL2YNUsNMl50tzYYloby9jodr0XlkM8jE2 A==; X-IronPort-AV: E=Sophos;i="5.96,143,1665417600"; d="scan'208";a="215958484" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Nov 2022 08:50:31 +0800 IronPort-SDR: u5mZsurt39fwGBUavpAqtzsCR3AFHwfqagGCT48tW7x+tBevhMCBIT0MJGhDpnQuhdydTSUOlJ +5aPkbNYv4P/HFYIxlwuVrTjnd6xRQfwbt79ZO7JpaTVZUGe8Ksnilal7fIyOHc0z0TreW+hXK spTHD9a8QnzP3On6ObrpIpYHjw7RsCInAUC5TxU9h7Ap1w4vzR+LzF1dzA9iMPovEg3BBHWPhC dvRTNchbLM70+KBDeErKtiF5GhvYwz0+UMFQfnJ5mEOOfvkikws4rdE5xX6YjdWtftAqFB1FQO ywk= 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; 06 Nov 2022 16:09:38 -0800 IronPort-SDR: 3wbscUiqaH4yLlw0G1138a8go7IdZYAhyq01jvcIUu9MSbXfrHRx5aTgz3P+IkfrpXljaN7VHM jWsmcD/NsmnSxeTWr21I+Edg3mtr4oFpKCWH4hwGSOMlwg5Ub2DN2ffuNJ6zqx2TrRacyqpp1e lOe2X1MH7Iy6utGd83uYNdCUW/l3jP7aHGl95ziji0g7Cxez4WMJQPS7YyqxhNw3MhJdcmb+dt nXvHFBNrAYE7YFKKXYLxM5TuwkK3mjYimvkNsEkjYQpcD5sImn2SGzFs8V8HmQsAZa+7wahSvy nz8= 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; 06 Nov 2022 16:50:32 -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 4N5CMC1B1mz1RwtC for ; Sun, 6 Nov 2022 16:50:31 -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=1667782230; x=1670374231; bh=iCGQuYuIA21oG69sab owShd8BAXIR6ZFcrUBS9czmYc=; b=PYugiMKYF/TkkfKhf0uhh9WIpdqwAL0yFU XR8n252+5ISlpsyHOtknlKodo0FEfy03HM9zVhsBtN8lffZiIgIdHNUOrSzmNEgm lMTEPyMle+617doabt1oku+J33pctPSwnRs/3XTj2zsbyahB/aLmhZFv6fbmNcYv yfQvARiQcoSavA7rbN1S/XKA5ffWIdKXoaf/hfz9hLWco7MbxX0IcsQzuZyvIsG5 /vvk/S1Y0WPzHeZwjqcFf92P22f7BMRYqxBgwMUswmuhFEo6qDX6NLOLMRfE9F0w 4lthls3od17Rt87Hz/9ebjLoxwhmkrvO6jc9aNekpG0cIVKX9h7Q== 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 46KrotoLTS1O for ; Sun, 6 Nov 2022 16:50:30 -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 4N5CM91b6qz1RvTp; Sun, 6 Nov 2022 16:50:29 -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 v5 5/7] ata: libata: Fix FUA handling in ata_build_rw_tf() Date: Mon, 7 Nov 2022 09:50:19 +0900 Message-Id: <20221107005021.1327692-6-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221107005021.1327692-1-damien.lemoal@opensource.wdc.com> References: <20221107005021.1327692-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 Reviewed-by: Hannes Reinecke Reviewed-by: Chaitanya Kulkarni --- 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 Nov 7 00:50:20 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: 13033716 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 68143C4321E for ; Mon, 7 Nov 2022 00:50:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230087AbiKGAuo (ORCPT ); Sun, 6 Nov 2022 19:50:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbiKGAuj (ORCPT ); Sun, 6 Nov 2022 19:50:39 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBDB4C759 for ; Sun, 6 Nov 2022 16:50:33 -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=1667782233; x=1699318233; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sJYwO2YFLt4950BGsnhd04xfiHD38rnFysO3T/X3rW4=; b=jFeAeGZK4eSF4uWY235FHaE1Fyz7I1U9unZH5n7BayzbdIieDj3aYcUW RtAHBjcEYwMHj08ULOdVd4ttsq/fyeszh6LRvaGft2oSj5f4cw0FUGWwE DlkyOa3TPDcKBQ4q/YgUyhC5FMbaFaj9rOhKm9JttWjhNoDFraPTiHpoP cqLP7JP8VMulhMprGmkO+plEOw3i9tOY3HLkH5BcS+9DCabnUdHMNx8G1 8IdZShV+Cp0JQJalf+yY/PxLe8W6azegSPPnJZS02XAe41Q7iqooFjYqH hgpSZ0WYLz2RzVc4QLUC0jgcjr2HqsRP7UUeFZPgsO4ft6a5zazR0uoH5 g==; X-IronPort-AV: E=Sophos;i="5.96,143,1665417600"; d="scan'208";a="215958492" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Nov 2022 08:50:33 +0800 IronPort-SDR: 1V00CRFP/9096Q4ePZVcaK+Pfi08M8K+QRmF1fWR6nvDSlfO6PYoJk8jy5JkCLFfqEE7zmllt2 112de8bOSFZCMpxz2c6jxQVjiZGh5sSqsdyF5UoAThZKQ1jokJ8ePIGlMANZ8EI0L1NyML/4b8 LwJ4WEEgVB2Ph0WwQ1Ndw30nQhprX91AzC7gq5mipxbaddTx/k1otowS3CTLz0I5aBvYwsCMW6 GDVquDKWr2huUdl9f4hn/1ZIH/toJ0z+RUm4BfdfyfgOT7eprXwnvI5zTIDi/KPAyKkF5qeMjR njg= 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; 06 Nov 2022 16:09:41 -0800 IronPort-SDR: Dtx3bR5dTLGyUdzhG4AuzrR1cu8dhIvyiX8DcLwnAjWgO7ZLO+TufoOBsH9khMm4TQgt2qEqsf Fyqvi5yRt4Dd0ihwS7FbDYhjWsM81YaZAl1xRLzZyxZW/kZC/Os9oHir9cVuTmRsspN1Yzu2a7 eITHD1mbxWsO2nPIe3h+LOfX+MoazNelVEViQG0fa2PXe+NOvuNfSy5UccQr5LOgD8XH2ZV9g7 0OQlewi8ow7DRNmnAmgsVQrXJ+lYbOXhlr39M8JAVPzE5+3WdgjA2lmrgYRwmMOsVQBh9CYtEj OsE= 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; 06 Nov 2022 16:50:34 -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 4N5CMD3fzrz1RwtC for ; Sun, 6 Nov 2022 16:50:32 -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=1667782231; x=1670374232; bh=sJYwO2YFLt4950BGsn hd04xfiHD38rnFysO3T/X3rW4=; b=ZsS6mpUyPxvThlR659m6Oi6780OUpp5tGn KFFs5z2fljlimQLwMi0kqCBSN9fZJvO0mM2lHIWsWnsBnhZeliRHkLcRfA+B17bh A+8ule6deIPoLPYCwueVAoOWe6c2IgGgKFaVU/bbPkzJFf6gP2UiIiy5gaJASTRB aw5ivMIcdMdyYkdKMmv8ijzH5U/f5je39JdWarwPminIzY6r3dmtlj4Kg2hGIigA i4aryZG16lfvIyXsQFkXVmXXXCMaUrB9GZS9P32BL4HClXLO26k7FLAexrC+AaAO n/K/KMTYmK0/5V4F5z2fv9HI9bXyHmHtLKV6XWl0LH+qAWRlhytQ== 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 lbhX0RnMlA4X for ; Sun, 6 Nov 2022 16:50:31 -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 4N5CMB65D2z1RvLy; Sun, 6 Nov 2022 16:50:30 -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 v5 6/7] ata: libata: blacklist FUA support for known buggy drives Date: Mon, 7 Nov 2022 09:50:20 +0900 Message-Id: <20221107005021.1327692-7-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221107005021.1327692-1-damien.lemoal@opensource.wdc.com> References: <20221107005021.1327692-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 --- 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 Nov 7 00:50:21 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: 13033717 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 4D6B1C4332F for ; Mon, 7 Nov 2022 00:50:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230135AbiKGAum (ORCPT ); Sun, 6 Nov 2022 19:50:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230150AbiKGAuj (ORCPT ); Sun, 6 Nov 2022 19:50:39 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 318ECC76B for ; Sun, 6 Nov 2022 16:50:34 -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=1667782234; x=1699318234; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nQOC0Pfd3xQkIpsrM2jqz2PO66oztnRmZbo1BOuXWN0=; b=M4hig+LCcXkE52h/gz2vSpSPu8tktub6beXV9cgvSaGyA8Kj8li7B1rW I+RHa59ISHVgn9PyeYj+MMH6DOO6YShv5bERQh0OyB3Y8/Tz0pCjzVtze LCmgCveylyGwm5mUUR1kGq+BfWspe5Nc1soRMt9nIza/NppSu7PH8B2/c 5BOe7zGI3fKE8EuEi8VbnbVmjRfG9JZ/OBd3ZmNi0Kj99OAOhCjjtNEOL SqnUqrjyN85z8VMkcSTGJBamXeySTkNNqRY/uT5HL6jGkIp3upuq4vIvV SFO2qrg5xJeUMeGfhc3MW78poyg88zfN1vTG3Vl0UFwlPBtvsq3mbMeBX A==; X-IronPort-AV: E=Sophos;i="5.96,143,1665417600"; d="scan'208";a="215958495" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Nov 2022 08:50:33 +0800 IronPort-SDR: f9KRHUVZ2WxEEVurufcsV5qpkPUjbdGO95OBtUI7rzP6cJffalIuHiAozBs71qUZbj6eJvapCL 7GxuzcR3s/meqCKKIw4hoBoAxXbOYqcd7yMq+/ewvZirvGHOrlOYDPtKnPvjQLNd428Fdn5Z11 nWCPvcCzTcDE28kQHI6jpB2Lm/Z7jwUSiEphhsqtBY0gOpjzMcrrbJIeOA3+a7toG1APbf33vx AeEaS/vS300fQs7lekKqA74Q5edwMtRqMiPzZqmdqAGogSQ082hLeoafK2Nz2m9pIOo9kDtUMy ObI= 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; 06 Nov 2022 16:09:41 -0800 IronPort-SDR: fek6OdA0kA8qY3UDq/QCMsej3W+a2ATbOrfXppDVOQYKuB1sj4Etpt45tfBp7k1oP8tzyqJBiR Eu4Nu3Cwzgwx1uzBcQcTBHMJRNvn9nWV7AYcjn8J7wxziNKBQ8YShmeaCX7W9ppnvVUNg2UcUJ CZmCm4VBb30S/V75mAixttqctGD5krfZ7YGkOJ4pWj4ggpCIeUCIbitY4xVPYDCRdQx4fftMJo m6HG6EVgsKcnYAPcdg/Fj4asJYDqg+Nsl63m886G0aFo2Tk0OIaSvz9Ge3tJ7v9XnU6KXXd47t UeY= 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; 06 Nov 2022 16:50:34 -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 4N5CMF4Cqmz1RwtC for ; Sun, 6 Nov 2022 16:50:33 -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=1667782233; x=1670374234; bh=nQOC0Pfd3xQkIpsrM2 jqz2PO66oztnRmZbo1BOuXWN0=; b=SdDM5nYNXvoK9pnw2cxmoQW4E5nCWcRnNP +wu/mFHBAvW9Gnlvk/l/Ljfejm+MfuZ+qCtTTB3bMtpzitEC8YaYxN6HkqBixc9o mKGEe8i3WXMUc5efYooxzTbpdYBEBwxI13eCwWEqfIx9rNkxm6EobZ+1cIPodxxD z3+HCi7V0fZBNPfexHChg65JUCjxE9rbMeuJ/jTf3V1OpU4CQPNB1naWglCZENFo jCDzXBdW69C60B3KAFZPeJDJJ8Z9cgk+jCVdAZQPab0zNbPalp4Vx/57yJ1WPyoI CjA2o886zCzOVTyzQEEL9AM86qPyg0BOHy4aN23zT/cOV1PZsI/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 QjJf4dn3HlRv for ; Sun, 6 Nov 2022 16:50:33 -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 4N5CMD0ycRz1RvTp; Sun, 6 Nov 2022 16:50:31 -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 v5 7/7] ata: libata: Enable fua support by default Date: Mon, 7 Nov 2022 09:50:21 +0900 Message-Id: <20221107005021.1327692-8-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221107005021.1327692-1-damien.lemoal@opensource.wdc.com> References: <20221107005021.1327692-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 --- 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);