From patchwork Mon Oct 31 01:53:23 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: 13025323 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 DF9F9FA3744 for ; Mon, 31 Oct 2022 01:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbiJaBxh (ORCPT ); Sun, 30 Oct 2022 21:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbiJaBxg (ORCPT ); Sun, 30 Oct 2022 21:53:36 -0400 Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4DF295B5 for ; Sun, 30 Oct 2022 18:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667181214; x=1698717214; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u+YhafSOih06QZfSN+lI+siqPo+e0Kz4p8AfqVOVZpQ=; b=AGS4+oMMY5DQ8wjvpRINctop8rf+xC+7EZ+Sm23UfOgQkNZF/MOQENjD iqtMlVB6Rol/FoZs5RW4yJ3z8Ei1ws97GNO/ltWEQ7r0gnXnlnpRPU3Z5 7gMNKmIS+YU7+rxcYUoe81+wXW91+9CAWm7lzhvJXdVQ+CO8C2EFAUkAc W69JnmUQYX1mFuJsw6MiE//iMT/BlfjPq7U2tNz2cMrodN3ydm1zbd9c+ SurCctfaLrYZ/hgiAU4nCV+4WKeA5HzgD+sypaDaGl+5Gz1TWxnAaYeoY XANaYGGjF7cd/8t+ZqQiLIdT6/vG2nvw9KC7AgM3mBXiPB1QHLri+IG0R w==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="220246016" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 09:53:34 +0800 IronPort-SDR: uCu1sxsidAuwpzSELccXJEvlVCH3z8dji1AKKx1zDdUWCTvsqthw7IGds22kOki9mwdUiWoOtM FT/hY5diMGyRPeVgDReutc+PFPrDbytIIundzy6/AMarmHWstK1n5sQmCedruc3k/+B+hMtIxR 8pNLEHTYSesnoZzYrzbob09UmCnEu48KjDYOjSU9os+A2Z/7FwmEfTxSOdK8OPSt+Xold7SB+w SQJgXTCG5XBkVcwGbC3JH+TZun1deKrVY3TB/83UICinoLSv0t3yKp2sX12wciSeH3PyiOF7qz 2lyJY52bsvSZM8Rhh6Wi6gPD 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; 30 Oct 2022 18:07:07 -0700 IronPort-SDR: uKMHByy5gNRc0xAzUk8cHwhpELKZB08fVuTyT9/sCxLyJ6fy4H2qUcbpVKVpdgzumQmaYmDrt3 FZfWQdbv5X0+WsCCxY6gQe+L9QYHg9PWphsxYgP3Zn/MZrp6jPL7CY6Zrg/pZAEKOcamBpYK/u COv3WC+WwTIgJYi51ds1pNoiWan7JXygutlm+T8dT+N2LBpExlcA6vIO6InyjrxqhpzLLepbkF fYHgNPqjkUVo5YV/mXC/Q9fCE1lh49ZWS/4B/t4lZXjhyOr7kuDKbDN38raZAZuOuPOVF05QD3 HXE= 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; 30 Oct 2022 18:53:35 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0x5B1BpMz1RvTr for ; Sun, 30 Oct 2022 18:53:34 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667181213; x=1669773214; bh=u+YhafSOih06QZfSN+ lI+siqPo+e0Kz4p8AfqVOVZpQ=; b=XkSzakcfOWvSUX1AbLOvX2Vev048QG01oO yXkw9sbUZ1IpWGKNWvakO2Xl/g0sYhUCm5MINJPKO3WXkNwxOeQNqWscbjA3b9AA IaD7ptaVMC7tBwM8XSm2cn28rhIrPCCYcZWNvZWJdnZ2fMndb2SIKoGdx3c5rsvg y71dJizXbNg3O6MkwoNN/Vm5colGbJwqAyJM/ZtEkUIiw4ZQ0Kv/rP0MxNfYCSoA /tgQgnm3H0QLAHz+qIeL57ztcVSBTJcPTtQOT7loP3yBFDRzJDIbuc0It6OdbEyE Nwn1XSSYCqDT4m+VaDoT5WT4onmXi5ZiiF/klLr6NGpR4U0W0R5Q== 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 qVe6au2t-zjI for ; Sun, 30 Oct 2022 18:53:33 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0x585984z1RvTp; Sun, 30 Oct 2022 18:53:32 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 1/7] block: Prevent the use of REQ_FUA with read operations Date: Mon, 31 Oct 2022 10:53:23 +0900 Message-Id: <20221031015329.141954-2-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> References: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org For block devices that do not support FUA, the blk-flush machinery using preflush/postflush (synchronize cache) does not enforce media access on the device side for a REQ_FUA read. Furthermore, not all block devices support FUA for read operations (e.g. ATA devices with NCQ support turned off). Finally, while all the blk-flush.c code is clearly intended at processing FUA writes, there is no explicit checks verifying that the issued request is a write. Add a check at the beginning of blk_insert_flush() to ensure that any REQ_FUA read request is failed, reporting "not supported" to the user. Signed-off-by: Damien Le Moal --- block/blk-flush.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/block/blk-flush.c b/block/blk-flush.c index 53202eff545e..4a2693c7535b 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -397,6 +397,18 @@ void blk_insert_flush(struct request *rq) unsigned int policy = blk_flush_policy(fflags, rq); struct blk_flush_queue *fq = blk_get_flush_queue(q, rq->mq_ctx); + /* + * REQ_FUA does not apply to read requests because: + * - There is no way to reliably force media access for read operations + * with a block device that does not support FUA. + * - Not all block devices support FUA for read operations (e.g. ATA + * devices with NCQ support turned off). + */ + if (!op_is_write(rq->cmd_flags) && (rq->cmd_flags & REQ_FUA)) { + blk_mq_end_request(rq, BLK_STS_NOTSUPP); + return; + } + /* * @policy now records what operations need to be done. Adjust * REQ_PREFLUSH and FUA for the driver. From patchwork Mon Oct 31 01:53:24 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: 13025325 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 32ACAFA3744 for ; Mon, 31 Oct 2022 01:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbiJaBxl (ORCPT ); Sun, 30 Oct 2022 21:53:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbiJaBxh (ORCPT ); Sun, 30 Oct 2022 21:53:37 -0400 Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCF6595B6 for ; Sun, 30 Oct 2022 18:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667181216; x=1698717216; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x509jXSJnwObswBV4jpE+8MByFyOsaKwegxIAG6rrnw=; b=FAInFAWQt6yxHpGTGdgaSxAP4V/UYy9BiaS7589VA814pVSyOOFiH6WJ CSD2tMKCVYaabOWZOKpXry+DzqoS5QVpFoCCRZonEWZUtND4/2Fms+85Y Z6JMmveSfVfLHz8VjQ5w2UA7HJegN5PH2iT9tcjhTKAIwBOxw/RtSj6ot PP0PJ39rMe6oD8lPO2Cyt6FkNvWodmHFqwaeEsH59SV93hyXTx2i+nAkd j2LnzLR14iHzZ++ur+2NpunbxTYUKrbYIbtUDH5VQaVYbEOEqkp+lC+CH +v6ToBqmf994a18QvEO6Kd444UGQP8neQBMqEF7HmqoqstIxm6WmbdVqk g==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="220246022" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 09:53:36 +0800 IronPort-SDR: dP7IdqQGDVsBDn/n/2k3YImuaYU9lEE89f7uahUIJ7p7S0uU2unC68psm2KhBlXIl3aJIO0/ZS Hh116lgFx0iK/E7BZ+CkfBrfj1W3nzTPMOJBoNkr6mIXOUUYHp6gJlw2JuGRs3yosmJ06stfUw lz+1YDGq6DcmSgaNuV3mwYIHchJgHda5p5EJLo8AhfO8Y/xwb0Q1Z7meLLxFyQYw3YDwBZol2M LGM+HcBdLrRPTeN5WCFypmjFn7tQQBZRddnrDdKxhUlN5qY1oDKY+qyEFbHEeKonGl1/094mzj hX7n1s1gQbdzg0vQOYE68zCy 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; 30 Oct 2022 18:07:09 -0700 IronPort-SDR: 2qZgCms84YIzqEuBPmJTFXprnC4y4+kUlwzDhHXQwEIHCo6CS6sJ+FvN6YPXdw55yw28TD3gra HAiWYeLhmG7ZuuRfRUSX1iV1PAoxPFSS4Lmb9KnkFWwYj4AZz8Kl9IJAlr69PXLFTYBUJXVDqw bs8EI8b5Vqdr+ydYoUFUIwEMynetZyPUfK4yvbyCj1LaQe7PaXvn6JNVwlQB3rWaanp1Iq7NEt 2XpNeDDTAGnr8yImOjwZORUYNZlIlO6bx4+JhA5e0+GfRqo4GnA7VefCfGQnsNGtn8WB9UYfy1 8I8= 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; 30 Oct 2022 18:53:36 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0x5C3pLNz1RwtC for ; Sun, 30 Oct 2022 18:53:35 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667181215; x=1669773216; bh=x509jXSJnwObswBV4j pE+8MByFyOsaKwegxIAG6rrnw=; b=BaolBQs/9NOWktrzrrvcBCFZ9hHlqZWIl6 OgtA9Ofm+HOrnwyBGo9JTUKxw3mQyMRqZ9GaVfcy6SMW8WuTwDeRWMEInT5mYKgP ung1iA1gTgUBEwEO9hiXSHaP0Dvwc6QVKOY0x5OuUkkEZ1npdnCGm9EgIYATjY9M I/4400FyFJUWhCG3KaFy+OF0Ul2v7iODYqePhzgXNhBOg5jNaH/AgNReQF0up2GK /0oPWDmO2vHZtMw6J7iwjruqXEPu164ns/5+Z88lmk33VUMGiPc83s13UeWY/je3 CJ1zO6L7bljrLSDMFYXMZboG8EU8vgY0JGslCQhDopVuDJkMAFPA== 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 z_Z2FMTSyBqE for ; Sun, 30 Oct 2022 18:53:35 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0x5B06QSz1RvLy; Sun, 30 Oct 2022 18:53:33 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 2/7] ata: libata: Introduce ata_ncq_supported() Date: Mon, 31 Oct 2022 10:53:24 +0900 Message-Id: <20221031015329.141954-3-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> References: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Introduce the inline helper function ata_ncq_supported() to test if a device supports NCQ commands. The function ata_ncq_enabled() is also rewritten using this new helper function. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- include/linux/libata.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/include/linux/libata.h b/include/linux/libata.h index af4953b95f76..58651f565b36 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1690,21 +1690,35 @@ extern struct ata_device *ata_dev_next(struct ata_device *dev, (dev) = ata_dev_next((dev), (link), ATA_DITER_##mode)) /** - * ata_ncq_enabled - Test whether NCQ is enabled - * @dev: ATA device to test for + * ata_ncq_supported - Test whether NCQ is supported + * @dev: ATA device to test * * LOCKING: * spin_lock_irqsave(host lock) * * RETURNS: - * 1 if NCQ is enabled for @dev, 0 otherwise. + * true if @dev supports NCQ, false otherwise. */ -static inline int ata_ncq_enabled(struct ata_device *dev) +static inline bool ata_ncq_supported(struct ata_device *dev) { if (!IS_ENABLED(CONFIG_SATA_HOST)) return 0; - return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF | - ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; + return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; +} + +/** + * ata_ncq_enabled - Test whether NCQ is enabled + * @dev: ATA device to test + * + * LOCKING: + * spin_lock_irqsave(host lock) + * + * RETURNS: + * true if NCQ is enabled for @dev, false otherwise. + */ +static inline bool ata_ncq_enabled(struct ata_device *dev) +{ + return ata_ncq_supported(dev) && !(dev->flags & ATA_DFLAG_NCQ_OFF); } static inline bool ata_fpdma_dsm_supported(struct ata_device *dev) From patchwork Mon Oct 31 01:53:25 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: 13025324 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 0A98CFA3742 for ; Mon, 31 Oct 2022 01:53:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbiJaBxm (ORCPT ); Sun, 30 Oct 2022 21:53:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbiJaBxi (ORCPT ); Sun, 30 Oct 2022 21:53:38 -0400 Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C96FF9FD2 for ; Sun, 30 Oct 2022 18:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667181217; x=1698717217; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xz6ycfIfidoOOGiPhXlSF5Bv4e0fjijWd4+tMRv7Bmo=; b=b9oGJ0lePTqwMM3n8ZYG8F93fNeItbi21YFcW8vGHlSAb9wsTOyByww5 4iPX1+duv38o9xQDqIYg0G15qzfsQtEX0aius2U3VGp5uNtBNLRm1I+4f czv+JkMAqUpvkTtKo26MD1Q5BRO8HgSxeXBU5q5Hf9C/Dlx84CTzXZSZf hIWLzJHk5JQKL5/Zow1nkJU1js7oYWxrqYwRNicihqhWFKpxdlUbTAK9S 7J1LHe3pZD36UJ1Tas+cAg668w7oljZO1QBqX62/w5x4oR+6lFLUtSgqJ tMcnmKv1MhtnljWzohwtCZGATEwLKzIbdXZJROrgx1XltX+cKR83EY43e Q==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="220246023" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 09:53:37 +0800 IronPort-SDR: J138h9gtlVs3H6wxwca2jxDBWwXiml0olcszNW7B2nVgJH6xWP5jO8A8Z0f0XckTw0KFXF/gGU XYz/j8iJPdzxzW4wDfuPZoPFO0b6FpV+kAsfEhRf5lvwNdVnZar80+ljG5YEYgByzg/q+Z3n+q fmwGLEEIIc5p5aDF/ejj4i95JRiXHH0VJpoajJS1Iq1Q+4FFQIa+fmQaUeE9+gvOSAvo30t+wi vNXbflrCN/f38mTiDNlHhWs60owuCEu3w5voe4/5DvLE0hL2Yk7eIB0hU9lxqXyj9JytnvRxNc x+6LWYhNdReUrA/K0on50SKK 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; 30 Oct 2022 18:07:10 -0700 IronPort-SDR: 1Y+begoobTjfTl+sL5GJPZEMwlj8SrZCoZz/51vh3IJCzLS/lX//vjqajZ89C7eGKTu1/jHkNM MAbcosHH+qLDkFCrbhOXSduJFlU7ZnzXihLDBeEJsvvkcSQlHaWsIku++eBkd4rIxyWxMW7aBB qAD1kOLVknqewdcpK91qegigirjRVtyxmudvbq81vliNGHl63TbdbuTs/pgJlGuyE1gpoiz+8v haUFxl306yPh83lSYUPCumYSh+szeIXVCTtjMEuO50nydstqJvLaVG+ukiq66SJ1FzPpsPP/hr Z0U= 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; 30 Oct 2022 18:53:38 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0x5D50Vpz1RwqL for ; Sun, 30 Oct 2022 18:53:36 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667181216; x=1669773217; bh=xz6ycfIfidoOOGiPhX lSF5Bv4e0fjijWd4+tMRv7Bmo=; b=ONCNwipyzZ5hfPYQpYbc2AJyNirqDw2GbQ t/Kjy/Al705nYuz73rRQPS5K4kGd5xxfmHA1sFwqSMMFfjPET97iH9IRsmLrk8WB oV6vYvLAvZ/xZmg7O/0tDMX1h282iqP2l7KvTnDrxWVh7DzpfRp5Ce+EmX3gw03q +mWgdN+Hgb44aA3eYhIqwT/JR9BVYl+4oSh3mZN8BoHkH3H7c6aFqdhTfgJIHt1E tACn45SdHTqZNc99/wry9NLPvNw4KBI62tzBbUKnCzsJdGKUHjyb2ca4Whe6jq/j jZBNC8tH+MRoIVIair2yRyy6F8s0n2BS5+cVToMNrTSBC2Ty/JZg== 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 RpgWFYMh550X for ; Sun, 30 Oct 2022 18:53:36 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0x5C2XfJz1RvTp; Sun, 30 Oct 2022 18:53:35 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 3/7] ata: libata: Rename and cleanup ata_rwcmd_protocol() Date: Mon, 31 Oct 2022 10:53:25 +0900 Message-Id: <20221031015329.141954-4-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> References: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Rename ata_rwcmd_protocol() to ata_set_rwcmd_protocol() to better reflect the fact that this function sets a task file command and protocol. The arguments order is also reversed and the function return type changed to a bool to indicate if the command and protocol were set corretly (instead of returning a completely arbitrary "-1" value. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-core.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 884ae73b11ea..6ee1cbac3ab0 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -574,17 +574,18 @@ static const u8 ata_rw_cmds[] = { }; /** - * ata_rwcmd_protocol - set taskfile r/w commands and protocol - * @tf: command to examine and configure - * @dev: device tf belongs to + * ata_set_rwcmd_protocol - set taskfile r/w command and protocol + * @dev: target device for the taskfile + * @tf: taskfile to examine and configure * - * Examine the device configuration and tf->flags to calculate - * the proper read/write commands and protocol to use. + * Examine the device configuration and tf->flags to determine + * the proper read/write command and protocol to use for @tf. * * LOCKING: * caller. */ -static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev) +static bool ata_set_rwcmd_protocol(struct ata_device *dev, + struct ata_taskfile *tf) { u8 cmd; @@ -607,11 +608,12 @@ static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev) } cmd = ata_rw_cmds[index + fua + lba48 + write]; - if (cmd) { - tf->command = cmd; - return 0; - } - return -1; + if (!cmd) + return false; + + tf->command = cmd; + + return true; } /** @@ -744,7 +746,7 @@ int ata_build_rw_tf(struct ata_queued_cmd *qc, u64 block, u32 n_block, /* request too large even for LBA48 */ return -ERANGE; - if (unlikely(ata_rwcmd_protocol(tf, dev) < 0)) + if (unlikely(!ata_set_rwcmd_protocol(dev, tf))) return -EINVAL; tf->nsect = n_block & 0xff; @@ -762,7 +764,7 @@ int ata_build_rw_tf(struct ata_queued_cmd *qc, u64 block, u32 n_block, if (!lba_28_ok(block, n_block)) return -ERANGE; - if (unlikely(ata_rwcmd_protocol(tf, dev) < 0)) + if (unlikely(!ata_set_rwcmd_protocol(dev, tf))) return -EINVAL; /* Convert LBA to CHS */ From patchwork Mon Oct 31 01:53:26 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: 13025326 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 CBF17FA3747 for ; Mon, 31 Oct 2022 01:53:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229649AbiJaBxn (ORCPT ); Sun, 30 Oct 2022 21:53:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbiJaBxl (ORCPT ); Sun, 30 Oct 2022 21:53:41 -0400 Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DB439FF2 for ; Sun, 30 Oct 2022 18:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667181219; x=1698717219; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7TWEQQgjvLoQtW5Au9ZtMp+aKDP51r+1N5Z2PbiA6mU=; b=M0uwUXGg8UiZ7dyBKkaz1QHvUPn6fbom6tGq3VXNzWi+vK4l8OcTolgR hXo79C1iPaA2gVQlvNSC2+CyYzXYPFxbytuEWCkpxv5ty13Dpd0/xVwDz v0HJ1yT/uzLWqKthTA7y5BA6H630GUTLz/c8S4Vba4dslCt7EDLXoIgHz ItKZUuhCexMxcfqkW2a60F5zB8ptv5+suqmI27u08FFpOoS1W3lM1J/Gs RiDqokloBSmsd5OBLnjNoDid/CIqh1VLCMpw2VgAA89oAPAIYP8J9Fb20 AZT/IHL7kauJNX6brT+lj0Rra5YZ2nw3bMaD9Bp30D4y+MX1E6XktUG0o Q==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="220246035" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 09:53:39 +0800 IronPort-SDR: pv5FgLAwdC2UryJKABsktNfm9A1viFpCrDVVgDQ9xAXmqDhrqLLWhlwNhZxzmTAENOdwbH/h1H TAPqfPdmwPxNolYffv1xROMw1AiOmmIasCIa2/WBFEgHBIDMqf9fO2q1g14ft5YSpSr9v1JHh1 vD8GsKyBRW2qyuTDtBSqT8e/zQDWJsbU8LBpzMrBGOA52X7pA0ko4mhizRze9fDNVVvPDBy/2s 0ZT/w1Q+RiTGvWSJiS3ikHONtDT4Sj3dTd6+ewdMILZycTHEqCioEXlLx2/YIwtK+bHbwaeFk2 zNMwjmZ1+Ak4m7dz1Wt9Nv9e 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; 30 Oct 2022 18:07:11 -0700 IronPort-SDR: D8MBIsOli/hSkQQvEyDmBiyNAHW2diA4DKXfj355bXM2iZpLN7Fyq9j0V+Kmcd3suJOZBz98c3 FTTcFXQc2zpmuYfX6xZlu38MN59QrxUnPMxDYBgslPIrrTKd3jMnW3CJmH6z6nySWDq17pgQap 98coGsl2cdbSqTNjsdyliN0RMYgeCT+Ezt0eVNAoTZE2u8jrPQh5bWmgElzJSzAG5YESYvRK2O aYIjolNrvMrXKmEUWvSgenzjZf7kY3q3M5DOfvZnHgAtSglHDmdPjLNFYaEBwRBPVWY2sDeDD2 jZA= 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; 30 Oct 2022 18:53:39 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0x5G3Ts8z1Rwt8 for ; Sun, 30 Oct 2022 18:53:38 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667181217; x=1669773218; bh=7TWEQQgjvLoQtW5Au9 ZtMp+aKDP51r+1N5Z2PbiA6mU=; b=K3SKq+aAagLF+B8TS6rHajQuRrOy0xzC68 ud9Uhuf3QhVFKqie4UZnyGgetgGjA8pKlPz54/QhFfkOsxUrVJm6LamVl/BVB3M6 Pv5Ej7Xo0vEcgJLHCO9fN7fJpTdrLXvynqy9vWTIAbG5+5pm3YL1phPapSbiCWFJ MQordxw1MkwVhtRLaYxDbuzfju980OOPvROIlZ3GDhVHAEIvEVNHSRTL3rElFaBD oe6UiCuFBujmJPBUE5bdd3/YCN3qH4KDY0yvl+Q3E/o8nZA3eP0YlxKJrJynLAeF /dkw2SEkd2mJeVpVrE74VfEZjODdNc2y9azXqAknywueF+n6o0GQ== 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 gjrmQqztMHKq for ; Sun, 30 Oct 2022 18:53:37 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0x5D470Fz1RvLy; Sun, 30 Oct 2022 18:53:36 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 4/7] ata: libata: cleanup fua support detection Date: Mon, 31 Oct 2022 10:53:26 +0900 Message-Id: <20221031015329.141954-5-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> References: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Move the detection of a device FUA support from ata_scsiop_mode_sense()/ata_dev_supports_fua() to device scan time in ata_dev_configure(). The function ata_dev_config_fua() is introduced to detect if a device supports FUA and this support is indicated using the new device flag ATA_DFLAG_FUA. In order to blacklist known buggy devices, the horkage flag ATA_HORKAGE_NO_FUA is introduced. Similarly to other horkage flags, the libata.force= arguments "fua" and "nofua" are also introduced to allow a user to control this horkage flag through the "force" libata module parameter. The ATA_DFLAG_FUA device flag is set only and only if all the following conditions are met: * libata.fua module parameter is set to 1 * The device supports the WRITE DMA FUA EXT command, * The device is not marked with the ATA_HORKAGE_NO_FUA flag, either from the blacklist or set by the user with libata.force=nofua * The device supports NCQ (while this is not mandated by the standards, this restriction is introduced to avoid problems with older non-NCQ devices). Enabling or diabling libata FUA support for all devices can now also be done using the "force=[no]fua" module parameter when libata.fua is set to 1. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- .../admin-guide/kernel-parameters.txt | 3 ++ drivers/ata/libata-core.c | 30 ++++++++++++++++++- drivers/ata/libata-scsi.c | 30 ++----------------- include/linux/libata.h | 8 +++-- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a465d5242774..f9724642c703 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2786,6 +2786,9 @@ * [no]setxfer: Indicate if transfer speed mode setting should be skipped. + * [no]fua: Disable or enable FUA (Force Unit Access) + support for devices supporting this feature. + * dump_id: Dump IDENTIFY data. * disable: Disable this device. diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 6ee1cbac3ab0..30adae16efff 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -2422,6 +2422,28 @@ static void ata_dev_config_chs(struct ata_device *dev) dev->heads, dev->sectors); } +static void ata_dev_config_fua(struct ata_device *dev) +{ + /* Ignore FUA support if its use is disabled globally */ + if (!libata_fua) + goto nofua; + + /* Ignore devices without support for WRITE DMA FUA EXT */ + if (!(dev->flags & ATA_DFLAG_LBA48) || !ata_id_has_fua(dev->id)) + goto nofua; + + /* Ignore known bad devices and devices that lack NCQ support */ + if (!ata_ncq_supported(dev) || (dev->horkage & ATA_HORKAGE_NO_FUA)) + goto nofua; + + dev->flags |= ATA_DFLAG_FUA; + + return; + +nofua: + dev->flags &= ~ATA_DFLAG_FUA; +} + static void ata_dev_config_devslp(struct ata_device *dev) { u8 *sata_setting = dev->link->ap->sector_buf; @@ -2510,7 +2532,8 @@ static void ata_dev_print_features(struct ata_device *dev) return; ata_dev_info(dev, - "Features:%s%s%s%s%s%s\n", + "Features:%s%s%s%s%s%s%s\n", + dev->flags & ATA_DFLAG_FUA ? " FUA" : "", dev->flags & ATA_DFLAG_TRUSTED ? " Trust" : "", dev->flags & ATA_DFLAG_DA ? " Dev-Attention" : "", dev->flags & ATA_DFLAG_DEVSLP ? " Dev-Sleep" : "", @@ -2671,6 +2694,7 @@ int ata_dev_configure(struct ata_device *dev) ata_dev_config_chs(dev); } + ata_dev_config_fua(dev); ata_dev_config_devslp(dev); ata_dev_config_sense_reporting(dev); ata_dev_config_zac(dev); @@ -4105,6 +4129,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { */ { "SATADOM-ML 3ME", NULL, ATA_HORKAGE_NO_LOG_DIR }, + /* Buggy FUA */ + { "Maxtor", "BANC1G10", ATA_HORKAGE_NO_FUA }, + /* End Marker */ { } }; @@ -6216,6 +6243,7 @@ static const struct ata_force_param force_tbl[] __initconst = { force_horkage_onoff(lpm, ATA_HORKAGE_NOLPM), force_horkage_onoff(setxfer, ATA_HORKAGE_NOSETXFER), force_horkage_on(dump_id, ATA_HORKAGE_DUMP_ID), + force_horkage_onoff(fua, ATA_HORKAGE_NO_FUA), force_horkage_on(disable, ATA_HORKAGE_DISABLE), }; diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 4cb914103382..69948e2a8f6d 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2240,30 +2240,6 @@ static unsigned int ata_msense_rw_recovery(u8 *buf, bool changeable) return sizeof(def_rw_recovery_mpage); } -/* - * We can turn this into a real blacklist if it's needed, for now just - * blacklist any Maxtor BANC1G10 revision firmware - */ -static int ata_dev_supports_fua(u16 *id) -{ - unsigned char model[ATA_ID_PROD_LEN + 1], fw[ATA_ID_FW_REV_LEN + 1]; - - if (!libata_fua) - return 0; - if (!ata_id_has_fua(id)) - return 0; - - ata_id_c_string(id, model, ATA_ID_PROD, sizeof(model)); - ata_id_c_string(id, fw, ATA_ID_FW_REV, sizeof(fw)); - - if (strcmp(model, "Maxtor")) - return 1; - if (strcmp(fw, "BANC1G10")) - return 1; - - return 0; /* blacklisted */ -} - /** * ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands * @args: device IDENTIFY data / SCSI command of interest. @@ -2287,7 +2263,7 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf) }; u8 pg, spg; unsigned int ebd, page_control, six_byte; - u8 dpofua, bp = 0xff; + u8 dpofua = 0, bp = 0xff; u16 fp; six_byte = (scsicmd[0] == MODE_SENSE); @@ -2350,9 +2326,7 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf) goto invalid_fld; } - dpofua = 0; - if (ata_dev_supports_fua(args->id) && (dev->flags & ATA_DFLAG_LBA48) && - (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) + if (dev->flags & ATA_DFLAG_FUA) dpofua = 1 << 4; if (six_byte) { diff --git a/include/linux/libata.h b/include/linux/libata.h index 58651f565b36..d30c1288504d 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -91,6 +91,7 @@ enum { ATA_DFLAG_AN = (1 << 7), /* AN configured */ ATA_DFLAG_TRUSTED = (1 << 8), /* device supports trusted send/recv */ ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */ + ATA_DFLAG_FUA = (1 << 11), /* device supports FUA */ ATA_DFLAG_CFG_MASK = (1 << 12) - 1, ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */ @@ -113,9 +114,9 @@ enum { ATA_DFLAG_D_SENSE = (1 << 29), /* Descriptor sense requested */ ATA_DFLAG_ZAC = (1 << 30), /* ZAC device */ - ATA_DFLAG_FEATURES_MASK = ATA_DFLAG_TRUSTED | ATA_DFLAG_DA | \ - ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \ - ATA_DFLAG_NCQ_PRIO, + ATA_DFLAG_FEATURES_MASK = (ATA_DFLAG_TRUSTED | ATA_DFLAG_DA | \ + ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \ + ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA), ATA_DEV_UNKNOWN = 0, /* unknown device */ ATA_DEV_ATA = 1, /* ATA device */ @@ -381,6 +382,7 @@ enum { ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27), /* Disable NCQ on ATI chipset */ ATA_HORKAGE_NO_ID_DEV_LOG = (1 << 28), /* Identify device log missing */ ATA_HORKAGE_NO_LOG_DIR = (1 << 29), /* Do not read log directory */ + ATA_HORKAGE_NO_FUA = (1 << 30), /* Do not use FUA */ /* DMA mask for user DMA control: User visible values; DO NOT renumber */ From patchwork Mon Oct 31 01:53:27 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: 13025327 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 AE65CFA373D for ; Mon, 31 Oct 2022 01:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229898AbiJaBxx (ORCPT ); Sun, 30 Oct 2022 21:53:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbiJaBxl (ORCPT ); Sun, 30 Oct 2022 21:53:41 -0400 Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C0EE9FF8 for ; Sun, 30 Oct 2022 18:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667181220; x=1698717220; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UJ2YDLRMJY8D+U3UMEWNGFNsOs4kdiG/fA81vw5BF8c=; b=lTa7ktWNxgRWoilSvWAF5KxwayhNfEf/72tY63LjoAjP5RIOKVoJ0OQI W8cO9Tv8NElq0quXIYzd5c4/pL/TBSk+vNrHLnB7MkiJv21PP/LCU7F4e 86H6xlgljPFNWhbeYOAZ/t4zRy9jWgzhK7vu8cNCNkQn+nAUSimvKTP9j R1o1y2C9WTYdmtknEEU2EMvxmZiGNsxrzw+GRDakWl6L+EkgjHeKBdVhV Hm2pE2/etDkCXL5CJkL/QvKcRg7WKlsI9d0Nvf+AL6VXvG7FK6H+qdkO3 Ujia+uR2PdNg69CUbfAkhTlsfZmMhvNoTK+Q2MWr3gchgdysQ6OQu2hTS Q==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="220246036" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 09:53:40 +0800 IronPort-SDR: NjerH+rnVqFXwN0TOF28A+U4D2at+kiMH4c6+t9iPUUeDHE6LEJjHRltyNfiEk1sWmwjJNGaf2 kPm2GgYa6nB4aRNiUY+sSf2khk/TzmJRxpP2rwkKpJQzhGzfqYAusPO2JE14uVIx8bOXDn1TSC e5CYHB+/1S9BUyQr2/zDBuT0jukorsMja2sCiXaSMs2+gxwNyP1bZVkkhIAzLzHTFbFB7Vq6r2 TrJPFlv4Lk1iNo2bFyA3cfiffyrmcT8i3Jnx2Vt58EipVAYs9HKgWbF5vQE/XWSz33wpbCzMJ4 PoOByyHFZJNNoFBxAHMKwNnB 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; 30 Oct 2022 18:07:12 -0700 IronPort-SDR: Fs+TaEkaVTeTMUP3puJfMwkTp9idE0OtlpZnrJijGfxxI8oWIN3OBnYcVWWfW2XqJFyQVk3c04 wsMn6ljVcUB6TaZCx6Q5bmXcQoVVeSwpjyiAThWyBptALgbsT1MGUHQPIDnHr6S7oc2gKInCCv +1nw8teUwtniXZwBpOJV65ru6IpnLYCe+K/1EbeaFgpg3s/UReQAejcKWCKR2vOKAaTOt8URns ZR0D9fkl+/1cWH1t/K2pK5I2O/QjyGy8kpJM3q5QCfaULMBQ6Qpodl4ff8+QqgaB8qg/FidKLC zQA= 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; 30 Oct 2022 18:53:40 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0x5H4G3lz1Rwtl for ; Sun, 30 Oct 2022 18:53:39 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667181219; x=1669773220; bh=UJ2YDLRMJY8D+U3UME WNGFNsOs4kdiG/fA81vw5BF8c=; b=UNYjMawhOkNOP2gG5OPTLYYABQvZl1a2iK Wm7FxIwdF2L3qvcm5xLXvHbBwh3jtc08uXgTefqk8+LLD2dSrTmF8PWo3UKtMz78 d9eixrgIKTeUsrXSLvSQS9ptu81swdZafatcwsNoW8oKgwpVHApo+9++EtbbEYfg /tMRikht0jte8WxA/9RCUCa4SE68Y3Y5VzV5Y0lHODeNIE40tkitvWV5RGlL/XPI tVwKVyK6mOy+GrSkcjVzUbs1XAZRP9J42CpY0G0BDYdh7J9SnmO3nTdNfz1iM1QE hueK0y0/DH254S2P0jqQ0uLQCeB6y39/H7364cFHTJnQNpQ9zqzg== 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 9SB3OYHb2F60 for ; Sun, 30 Oct 2022 18:53:39 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0x5F6m03z1RvTp; Sun, 30 Oct 2022 18:53:37 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 5/7] ata: libata: Fix FUA handling in ata_build_rw_tf() Date: Mon, 31 Oct 2022 10:53:27 +0900 Message-Id: <20221031015329.141954-6-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> References: <20221031015329.141954-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 --- drivers/ata/libata-core.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 30adae16efff..83bea8591b08 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -552,7 +552,7 @@ static const u8 ata_rw_cmds[] = { 0, 0, 0, - ATA_CMD_WRITE_MULTI_FUA_EXT, + 0, /* pio */ ATA_CMD_PIO_READ, ATA_CMD_PIO_WRITE, @@ -693,6 +693,10 @@ int ata_build_rw_tf(struct ata_queued_cmd *qc, u64 block, u32 n_block, tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; tf->flags |= tf_flags; + /* We should never get a FUA read */ + WARN_ON_ONCE((tf->flags & ATA_TFLAG_FUA) && + !(tf->flags & ATA_TFLAG_WRITE)); + if (ata_ncq_enabled(dev)) { /* yay, NCQ */ if (!lba_48_ok(block, n_block)) @@ -727,7 +731,8 @@ int ata_build_rw_tf(struct ata_queued_cmd *qc, u64 block, u32 n_block, } else if (dev->flags & ATA_DFLAG_LBA) { tf->flags |= ATA_TFLAG_LBA; - if (lba_28_ok(block, n_block)) { + /* We need LBA48 for FUA writes */ + if (!(tf->flags & ATA_TFLAG_FUA) && lba_28_ok(block, n_block)) { /* use LBA28 */ tf->device |= (block >> 24) & 0xf; } else if (lba_48_ok(block, n_block)) { @@ -742,9 +747,10 @@ int ata_build_rw_tf(struct ata_queued_cmd *qc, u64 block, u32 n_block, tf->hob_lbah = (block >> 40) & 0xff; tf->hob_lbam = (block >> 32) & 0xff; tf->hob_lbal = (block >> 24) & 0xff; - } else + } else { /* request too large even for LBA48 */ return -ERANGE; + } if (unlikely(!ata_set_rwcmd_protocol(dev, tf))) return -EINVAL; From patchwork Mon Oct 31 01:53:28 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: 13025328 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 CF214FA373D for ; Mon, 31 Oct 2022 01:53:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229926AbiJaBxy (ORCPT ); Sun, 30 Oct 2022 21:53:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbiJaBxm (ORCPT ); Sun, 30 Oct 2022 21:53:42 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B259495AE for ; Sun, 30 Oct 2022 18:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667181221; x=1698717221; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sJYwO2YFLt4950BGsnhd04xfiHD38rnFysO3T/X3rW4=; b=D2Q2Yya7t2wn917xwYoCBchCKmnC8GLz08VoECVCsbFo9UrerzN4KQK9 v2JGFiCavPR6b7pPQVrycqyVR0m0WLc3o61rZ6s5ehNkZNVTCtQq0T/je ui/bhqs8gHYobBM7V7nj+76SD5g96XqfJI82ctcneUpF7xBQT2vxVRRvV cj1Pi+SFVeIcHU97twyEcuQA2lj5xlxC0yTCMbQaQ3B3CPAZXmWa11pil 1Rrgyv7n6S0n7N/JgOCCqgLCqoWsnCMZ9miwPE+E7W7r9hfRp0meHmvAc GN3s+zn9gvWM+40zScWmyz8BJ4MklmwDe0ZphAdoztY93UyeCcdN2pMRs A==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="213387074" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 09:53:41 +0800 IronPort-SDR: A3I3+C22KJ1jdFtMuJGP1lWzBJ+5lmVorNz9rN/quVZOE5+k2JBc2M0/Eazb3uOKNxE3ICIr+U 1lbNyA6lPxIzEkBjYbW6j2NTIq6DPG5IZ83UlzYoTIi3tEGjVBDWziOHawzQRGqc9La05kUT2F /HukxcRI4vNXSnx9HfsNH2RNxGoROlb9pw6WbSxT5bOaqooIrBmSCr/32XrZcKhFu8rI8Qh+zf A2REwPNMIbvWzY1k/HyB0k68T25771p5jkn+bQZvI/Pp3ynAaPN190/GVEvy/8u/k1b1R6BsPl 3t0JPg3z8xE07EfciEz+0vS1 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; 30 Oct 2022 18:12:58 -0700 IronPort-SDR: 6juspIb++yWr9D0IEerOSRqI9kTY5vsmWuwIPDE/gGJ9UInfDk7bmwEaBlxkzJEmpO9Y6GhZW2 1QInr4F2xyKKq+3epAPpzaTFGMDT344mf3hyz9sf5p/U9lSUee8vwvrKyPzTi1ndZRDjf7SuQf sIAstyO9LGf2jSgATnPh1kBRvQaxbYhB5dSBxjyUEs1+pnr17EsWCWCZKO9ey5PBIUpHDHr1su eg4a1Y+Ad0P9lVi6Zcohk7hu/BMqOlL+eA2HfN5uevYqgyQBUPXBIh3HhRs2JG7YUbhRYcRW1i AsI= 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; 30 Oct 2022 18:53:41 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0x5J6nmKz1Rwrq for ; Sun, 30 Oct 2022 18:53:40 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667181220; x=1669773221; bh=sJYwO2YFLt4950BGsn hd04xfiHD38rnFysO3T/X3rW4=; b=TmzQ5K3cRbhLfcayFXFn8IpWk1RaHFo7sF PbDqJTWnFco8Qzl+6MARoGylsSVI7lpQgnvo2A1/SswcRKl7iS6NipKcVp9W+b4v wwokpEUkF3mJRQF+Qm8SQSBnk/BUFYWyFXPukblboshE8LJMK9cM+LKFuhkg0KbS LU+woVIrLeFed4fvlT0VTdY8iOmdGJza3wQH8imUd0cTVRaebRZOEIioLjIKLFmX M2QfcPV9ey+3g2US5mPuYn+uH3j3TG8LLTospnSGvkbdxhP/AFHgdVTAxe0y6fXc iTtJCrcHUkVlyj7TNp4RjfONVPBSWIyg2PTDDEnXicNR0Iapp4UA== 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 C3IPrz1NGLw1 for ; Sun, 30 Oct 2022 18:53:40 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0x5H2plzz1RvLy; Sun, 30 Oct 2022 18:53:39 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 6/7] ata: libata: blacklist FUA support for known buggy drives Date: Mon, 31 Oct 2022 10:53:28 +0900 Message-Id: <20221031015329.141954-7-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> References: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Thread [1] reported back in 2012 problems with enabling FUA for 3 different drives. Add these drives to ata_device_blacklist[] to mark them with the ATA_HORKAGE_NO_FUA flag. To be conservative and avoid problems on old systems, the model number for the three new entries are defined as to widely match all drives in the same product line. [1]: https://lore.kernel.org/lkml/CA+6av4=uxu_q5U_46HtpUt=FSgbh3pZuAEY54J5_xK=MKWq-YQ@mail.gmail.com/ Suggested-by: Maciej S. Szmigiero Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Maciej S. Szmigiero --- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 83bea8591b08..29042665c550 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -4137,6 +4137,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { /* Buggy FUA */ { "Maxtor", "BANC1G10", ATA_HORKAGE_NO_FUA }, + { "WDC*WD2500J*", NULL, ATA_HORKAGE_NO_FUA }, + { "OCZ-VERTEX*", NULL, ATA_HORKAGE_NO_FUA }, + { "INTEL*SSDSC2CT*", NULL, ATA_HORKAGE_NO_FUA }, /* End Marker */ { } From patchwork Mon Oct 31 01:53:29 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: 13025329 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 B6815FA3744 for ; Mon, 31 Oct 2022 01:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229632AbiJaBx4 (ORCPT ); Sun, 30 Oct 2022 21:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbiJaBxw (ORCPT ); Sun, 30 Oct 2022 21:53:52 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56367A19A for ; Sun, 30 Oct 2022 18:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1667181225; x=1698717225; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nQOC0Pfd3xQkIpsrM2jqz2PO66oztnRmZbo1BOuXWN0=; b=Vh/9qo/EiWAzsC2Js8K4xee2nN0t9UnWHwGyblmGet8k9mXjUEpV0KLi lO65ObuOHCfrR46uAjKT3lG5mJ+QRWNjcjEq9VlE2dKO6FtZs42F4PTHB GVndGKMtDm4UU+XOHuwS6I8Adi2GjkGKWoGNzF0ad0fUZuau1yITCkYcn DXo1mKPu/I0o2+MZVZFXJneBeoFMyC5YpH1//f83BoNqL1YWZ3AyxUxak I4XYpewmBzwwrGtTxWpGT3UoesDrPzbh2XdAjbYLmAMqEd1vI/Yc1ep8t miwXKIQYuoehpHM0pgz1ggE3X3/uVMICsk/M2KJXDnsLJrY0x0uQds6lW w==; X-IronPort-AV: E=Sophos;i="5.95,227,1661788800"; d="scan'208";a="213387080" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2022 09:53:43 +0800 IronPort-SDR: ReznSuzmkHyUBv8DOillYxroOVy1dehjt72ISDwieYmD/xnaLUF9Vpnp3bVKeYIvjVG/L4bcOL aGsy2QyGBYc27Zb1MREnVFMSxAAVKK6KAOCvECgi2R7wbFtFjw5ihhqbq3STyz1N8Pga7yeyMe W8laBMDjXzrf5Q/42uCa6XB2bkVlz1lx+FYdmvVuIXJrkljrAkBmCFWI4dtEPQZrj6l32uLZdU yJOagmY1S6AM6hnGH19Exxffbl6aXlnajyeor7g4qTBGSzbE7Iq71kBfUUN+0YrJsGnB9sglUq Wi5qyRn0msAvYkL/Ocqk5bRm 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; 30 Oct 2022 18:12:59 -0700 IronPort-SDR: bOD8wVWMj74agbA4N6Xdxrcc17InzUhrr4LCOIjISmNIJGwljTDeOfCaPmpxMH7hJutzgX/uE7 YLhL1IDZI/CeGgL3mz+mQ+sdnRXMu8cyAUjl2m7/fSZNW8Xvqmmkx5oXAE3E1DLe3qEyk5cvOu 1joZB5E3w3Bn1eeSyQ6n5e5hLQK3rDlpql4gD5fVtNq6PuTgi5tKhDFiRrfdMfFFagvJIqE/99 y+Ue1xtjQaNmWpwz6/e0Txro30EBqOiTyLZ30pJnWLPwrRjnBec2GMUPCycA02YF8tGHPuYSA1 GEY= 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; 30 Oct 2022 18:53:43 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N0x5L3WTXz1Rwt8 for ; Sun, 30 Oct 2022 18:53:42 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1667181222; x=1669773223; bh=nQOC0Pfd3xQkIpsrM2 jqz2PO66oztnRmZbo1BOuXWN0=; b=cyeiD+0Tf1+QCVcztZMvBqQJxAn3gC4Pvc r0boeleua/9kJZYMOdoB85X2+y8tuRIib75BAjQ3odcIr8qI0pUcP4aOan4mgCRH 4/K1+9DGSK8lWEDW0TK1O6UbljvJsE/CQsbjTqdI6J9EZicvco38VBwFySjLetoo 6E42PjfBkt/104x3FZwVEvnlBzG/vW3CUTZgnEoLiS4OuvmZxuFZwJDW7bUmsooJ pyw9g4SPIZXbbureOScyRITEqzVPtjwtfbANvvP1fMLeakPTP8ae8Qe1wAlghWzz 4BRet5dWKTF1c+BXahHF5lCrEk6AI8vwJPtIQoAK6fSigYpikVBA== 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 la6di0ZwTRdX for ; Sun, 30 Oct 2022 18:53:42 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N0x5J5CBQz1RvTp; Sun, 30 Oct 2022 18:53:40 -0700 (PDT) From: Damien Le Moal To: linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Cc: "Maciej S . Szmigiero" , Hannes Reinecke Subject: [PATCH v4 7/7] ata: libata: Enable fua support by default Date: Mon, 31 Oct 2022 10:53:29 +0900 Message-Id: <20221031015329.141954-8-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> References: <20221031015329.141954-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Change the default value of the fua module parameter to 1 to enable fua support by default for all devices supporting it. FUA support can be disabled for individual drives using the force=[ID]nofua libata module argument. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Maciej S. Szmigiero --- drivers/ata/libata-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 29042665c550..9e9ce1905992 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -127,9 +127,9 @@ int atapi_passthru16 = 1; module_param(atapi_passthru16, int, 0444); MODULE_PARM_DESC(atapi_passthru16, "Enable ATA_16 passthru for ATAPI devices (0=off, 1=on [default])"); -int libata_fua = 0; +int libata_fua = 1; module_param_named(fua, libata_fua, int, 0444); -MODULE_PARM_DESC(fua, "FUA support (0=off [default], 1=on)"); +MODULE_PARM_DESC(fua, "FUA support (0=off, 1=on [default])"); static int ata_ignore_hpa; module_param_named(ignore_hpa, ata_ignore_hpa, int, 0644);