From patchwork Mon Aug 16 01:44:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516981 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=gm4W51wK; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxmw3Tdjz9sWS for ; Mon, 16 Aug 2021 11:45:04 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229816AbhHPBpd (ORCPT ); Sun, 15 Aug 2021 21:45:33 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37260 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbhHPBpb (ORCPT ); Sun, 15 Aug 2021 21:45:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078299; x=1660614299; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N9HTUe3fPenLFb7TILYqOuQ90dOIPTNwU0OUTxnf8fo=; b=gm4W51wKj3gU8moPcFHy8uzxnsHZKCEb/DG8f8JEvK9TU11CfYtgCGDT LV5sqQrwV3ZrOhyoti35fn9W7Dly83kktTFjTWBRMKpeMFCmbK5kbngrW PbuCajfTto21qLOsWE6y0L5wTnR/5n/5hujw4r7f0kHmBYwM/E+8aAEMk Ue8nHsdoiDpEAJxpf5GQ25TVejd7k+nRa9M6FBitHlLrCJ3o/gP9Bgbqr J6xTmbxHxU6G4FnchuzUXx+nTz5hpjIb5MjIx9BX44mrChbrdFxgVU2DK SFPFVYgkpz1s1MwRmHjdlwvxCXrc7ayQtTuSMOSLjq/CcGiFtZV8FJyRs A==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326679" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:44:58 +0800 IronPort-SDR: /Kohvq34GAF/ljduOSOesRZL2TdQdKkgnYGdqKdpPUQHzoZpu/DYZzHbWUDYvgp3lvlhFV+Tj4 o2uvE3qmYvk3JSf9CqbhyVzFFzjNjDvCcutEn0zrxIrNGbmamukEI3R0gLrJcpkvWdNGH8dY2g 73QhRPqCwtOhnOYffVR2SMfNTLsH40XewTumBNWPPKvXzPS5kUPZ4ATOotdHCBHTRYIDx5En/8 hQZGIOQGTaI1+55Z3I02t6EkIFft259sJL4M4WoFS5ETvd8fLNJNj28+y/zT49jWVjJJHLBhNu cdG6UMmKQkuhKQsBmEc0jF1n Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:25 -0700 IronPort-SDR: KLk3XdXy/x41QHM02FW1flFBqvuFZqCVyQeelYeIyJiUnRtBaUUzUXQj2Is0EOCP8jmbKVVfPz DQ/HhnLZjEyCO0t2e8jV5WRktjg81SYmqbZapq3MA/V4mFQBQywCeRhBG5oBcqooSwYYn0C9R5 3hm69JQHEuSV3EYkilL51cnzTK+WzSmu24n94UpON1ihbCp4E0fdSMPbPdFKKoE+zfRtvUDO05 2xYniTz13w32k8hJqACW0KVL6Fr8eB74IaBK4bIxgRasEi+/5GkajOPgdFczEXkLajh8hvhhbq nFs= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:00 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 01/11] libata: fix ata_host_alloc_pinfo() Date: Mon, 16 Aug 2021 10:44:46 +0900 Message-Id: <20210816014456.2191776-2-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Avoid static checkers warnings about a potential NULL pointer dereference for the port info variable pi. To do so, test that at least one port info is available on entry to ata_host_alloc_pinfo() and start the ata port initialization for() loop with pi initialized to the first port info passed as argument (which is already checked to be non NULL). Within the for() loop, get the next port info, if it is not NULL, after initializing the ata port using the previous port info. Reported-by: kernel test robot Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-core.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 61c762961ca8..b237a718ea0f 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5441,16 +5441,17 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev, struct ata_host *host; int i, j; + /* We must have at least one port info */ + if (!ppi[0]) + return NULL; + host = ata_host_alloc(dev, n_ports); if (!host) return NULL; - for (i = 0, j = 0, pi = NULL; i < host->n_ports; i++) { + for (i = 0, j = 0, pi = ppi[0]; i < host->n_ports; i++) { struct ata_port *ap = host->ports[i]; - if (ppi[j]) - pi = ppi[j++]; - ap->pio_mask = pi->pio_mask; ap->mwdma_mask = pi->mwdma_mask; ap->udma_mask = pi->udma_mask; @@ -5460,6 +5461,15 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev, if (!host->ops && (pi->port_ops != &ata_dummy_port_ops)) host->ops = pi->port_ops; + + /* + * Check that the next port info is not NULL. + * If it is, keep using the current one. + */ + if (j < n_ports - 1 && ppi[j + 1]) { + j++; + pi = ppi[j]; + } } return host; From patchwork Mon Aug 16 01:44:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=mOcYbBEu; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxmw5nS4z9sWw for ; Mon, 16 Aug 2021 11:45:04 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbhHPBpd (ORCPT ); Sun, 15 Aug 2021 21:45:33 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37263 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229739AbhHPBpc (ORCPT ); Sun, 15 Aug 2021 21:45:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078299; x=1660614299; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EIH026mlpK847URWOEkIJeSWTxgkrb13VQ8oOv5tb/A=; b=mOcYbBEuoSG6UCsGOtS3SP3Wa/cs8SHXPVd58xlcnbBWOJPVtGTMp+2x rIy5FVNQBwN828/ugElLTVZlsgwK4ljoR4unY9qcilYvgJQ6QRt5UahbO 3M/MoC1tAEyUeFTdyAbjgLpGNO54yKimBr5wktloXqRqA6Vsc+EC5EbSP n3herJqCV+BQ4u0byUoGWomjbwR2VKWsHditLLrCv/YuGWohteKly0QY6 T5y+DJFxzD5DazNxUQjEbJta8Qj7crYv3AsOnJAyTMaefjvnQm88t2miB 8g5plmlapptCDwNxknZpRolZ7+K+SxL6bKzTNJKO9taG6ZqP3q1AY6WD9 g==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326687" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:44:59 +0800 IronPort-SDR: 40m3UTsUxGuFDIjySRusm3AXvVu/0bxfLQa0CzxzWTI3TzMU4I9YXs66aGROmIwbAbmXIJh0LY mbIYWdyAqhFdt7ssCfH0u4mZoH1tbZ50NmNelX7CF12tYLIniA+XGDd0Oddjl2kY6aTJB3RtlJ nM+AHEHwjDhL8xOwraUyDZTGTbZpAmxB9JZo7fqNsc2KomCmuh/F2uPTXpKMp2e/NaqPJeE+0Y tmlVFveOAUj21UYgoxAivx94Uet1nT2ueyQvs9z5b9kenziONG/prsESR0jV3uIeWtHGH8AIcX g7pS5SJF5L+oky+dkTvJnM8H Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:26 -0700 IronPort-SDR: 3ZtXiOTr1T2SJ6gkNJioKwtGSZNEz5+rKJB8KsfP0Fi2/iRvklUJCOF2DHTKmZXitwQ87LUJju dRQAHMvepKKakpivQ3Av2IIWPw8Oe0zxs5g5jbWNlvHMzWTikCbFc+urXzvO9XXGPq9fC569t2 zMIgMf/RD3yoHTCRIoexQd5wO8XLnFp94vQjLTHcYDWLekTqaCyMNveJJ/hGU32ghnS3OqH21+ EUhFdCNTrGWL4vAKh1FWDQ/rTVn5hWydF9LZBVhkGJkNbsFR1ac3Rhd33rACX4HKYWMwkuiWuT mWk= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:01 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 02/11] libata: fix ata_host_start() Date: Mon, 16 Aug 2021 10:44:47 +0900 Message-Id: <20210816014456.2191776-3-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org The loop on entry of ata_host_start() may not initialize host->ops to a non NULL value. The test on the host_stop field of host->ops must then be preceded by a check that host->ops is not NULL. Reported-by: kernel test robot Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index b237a718ea0f..d3f7830bda2e 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5583,7 +5583,7 @@ int ata_host_start(struct ata_host *host) have_stop = 1; } - if (host->ops->host_stop) + if (host->ops && host->ops->host_stop) have_stop = 1; if (have_stop) { From patchwork Mon Aug 16 01:44:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516983 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=V7HoUfHD; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxmx1p82z9sWS for ; Mon, 16 Aug 2021 11:45:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229527AbhHPBpe (ORCPT ); Sun, 15 Aug 2021 21:45:34 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37260 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbhHPBpd (ORCPT ); Sun, 15 Aug 2021 21:45:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078300; x=1660614300; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+WWKZF/7COHNQFSxWKyzuz9m7BPKJUtEUV2VtAma0Ug=; b=V7HoUfHDC5/rJqS6Vq52ttD5Fq7dfrdVbdFWvAZt8zyeo4wrdv+T02T8 WIJ5oKcDadoR++s88Uloxqo/UlteNXlxN6xVX1tkKrHRu+roTXPKRtbOL cEqzL6vVD/0DDV8mSU4ZDTj4en2Ly9YfOqqFmhiDdaYfGPEKRpn1LZ7Z+ l+erE6nwYeyuYolOXFMCmToLHPQEIaoyYFLS3nK5I/fP9GBz335WFvo9Z KNSDvoTqxORSMrirXrB2tEgvXB4NW0JUaQcPkoZWPCW2w5ppHOkVdpHD4 Kg4FnRXzUNWOjGnNgA5lqP7nP7+PfQe1CYM0JWzvcljOc6BHT61wPK2Kd A==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326694" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:45:00 +0800 IronPort-SDR: UQjtw+97dvPvzJR3fYRxeymvB9P5lcg3l+qRdLTPCnHZpqKvs+IyBFLV7JoItE3iPFC4cHWaHW OsXoNbN3T6ZT//EgjwFfdhkODo019LbolU1S0VFJ5hy0Win4cSlIIxuIixbT/ofSoeIifqUH47 WG0CVJR8oNG4oI9sQEFdnoVleJhDkM8qhCki9dwXeOnuZ9DpzG0m/J0xi5z3R//ysxV+za8/l3 MVTAqjqDH5CZylvR1ixMz40AxOJG0L7R9CoXhSpSLmN8jLRVRxD0iqWjUU01fmFLnYNXMgvPk4 0D7cqwGge6ihIMnxMzXhxs7g Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:27 -0700 IronPort-SDR: 6XfCTop1binbtyU7Z9JGIJvmsYJu0NXzctNwtvOoFhcHVf3CTbCADovS+C6jjA8Vvvnd91A0ii /Cj6kqUInqxYAmZtyMG8YF4O8kTw9W/uBMmGc1ZKjuM0NR7G/J/jHjNi+ahXMKA/e5mo8WlAEk AVh0wc1poRJKzomnFwiCrA4cosNndDR3S9WizGV1cMgwc2fNPso/DJikRN8zk6nilsOdxCQuqg 3U7jCXKqMjcoqN0pROiqJqkJ7Q1G9Aqhk/rmdYDok0YgzD/pYrkA6Z/4lu6fGlKemnxki9+s7n lLk= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:01 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 03/11] libata: simplify ata_scsi_rbuf_fill() Date: Mon, 16 Aug 2021 10:44:48 +0900 Message-Id: <20210816014456.2191776-4-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Sparse complains about context imbalance in ata_scsi_rbuf_get() and ata_scsi_rbuf_put() due to these functions respectively only taking and releasing the ata_scsi_rbuf_lock spinlock. Since these functions are only called from ata_scsi_rbuf_fill() with ata_scsi_rbuf_get() being called with a copy_in argument always false, the code can be simplified and ata_scsi_rbuf_{get|put} removed. This change both simplifies the code and fixes the sparse warning. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-scsi.c | 60 ++++++--------------------------------- 1 file changed, 9 insertions(+), 51 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index b9588c52815d..0b7b4624e4df 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1765,53 +1765,6 @@ struct ata_scsi_args { struct scsi_cmnd *cmd; }; -/** - * ata_scsi_rbuf_get - Map response buffer. - * @cmd: SCSI command containing buffer to be mapped. - * @flags: unsigned long variable to store irq enable status - * @copy_in: copy in from user buffer - * - * Prepare buffer for simulated SCSI commands. - * - * LOCKING: - * spin_lock_irqsave(ata_scsi_rbuf_lock) on success - * - * RETURNS: - * Pointer to response buffer. - */ -static void *ata_scsi_rbuf_get(struct scsi_cmnd *cmd, bool copy_in, - unsigned long *flags) -{ - spin_lock_irqsave(&ata_scsi_rbuf_lock, *flags); - - memset(ata_scsi_rbuf, 0, ATA_SCSI_RBUF_SIZE); - if (copy_in) - sg_copy_to_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), - ata_scsi_rbuf, ATA_SCSI_RBUF_SIZE); - return ata_scsi_rbuf; -} - -/** - * ata_scsi_rbuf_put - Unmap response buffer. - * @cmd: SCSI command containing buffer to be unmapped. - * @copy_out: copy out result - * @flags: @flags passed to ata_scsi_rbuf_get() - * - * Returns rbuf buffer. The result is copied to @cmd's buffer if - * @copy_back is true. - * - * LOCKING: - * Unlocks ata_scsi_rbuf_lock. - */ -static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, bool copy_out, - unsigned long *flags) -{ - if (copy_out) - sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), - ata_scsi_rbuf, ATA_SCSI_RBUF_SIZE); - spin_unlock_irqrestore(&ata_scsi_rbuf_lock, *flags); -} - /** * ata_scsi_rbuf_fill - wrapper for SCSI command simulators * @args: device IDENTIFY data / SCSI command of interest. @@ -1830,14 +1783,19 @@ static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, bool copy_out, static void ata_scsi_rbuf_fill(struct ata_scsi_args *args, unsigned int (*actor)(struct ata_scsi_args *args, u8 *rbuf)) { - u8 *rbuf; unsigned int rc; struct scsi_cmnd *cmd = args->cmd; unsigned long flags; - rbuf = ata_scsi_rbuf_get(cmd, false, &flags); - rc = actor(args, rbuf); - ata_scsi_rbuf_put(cmd, rc == 0, &flags); + spin_lock_irqsave(&ata_scsi_rbuf_lock, flags); + + memset(ata_scsi_rbuf, 0, ATA_SCSI_RBUF_SIZE); + rc = actor(args, ata_scsi_rbuf); + if (rc == 0) + sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), + ata_scsi_rbuf, ATA_SCSI_RBUF_SIZE); + + spin_unlock_irqrestore(&ata_scsi_rbuf_lock, flags); if (rc == 0) cmd->result = SAM_STAT_GOOD; From patchwork Mon Aug 16 01:44:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=ZnNAh7hg; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxmx45tCz9sWw for ; Mon, 16 Aug 2021 11:45:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230186AbhHPBpe (ORCPT ); Sun, 15 Aug 2021 21:45:34 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37268 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230085AbhHPBpe (ORCPT ); Sun, 15 Aug 2021 21:45:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078301; x=1660614301; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OJ59U610saF7sinR8ywqJVyZtYWG4GXw2CO3nDPQcQA=; b=ZnNAh7hgLCVJHBLoOoXGIfdLIG5v3h3ts/u7Ns9Efss5CkxTTvNrsykA JNqrwalMDDF2gqdoSgEvYWS1NHbbVazWd35IjxzlSWkyXxeIqlVGfWZnp DcSevaN6WtReTfZSsn9gziQqEqBjngQxtQAPZZHe//+B7mrunhygCl3Sn hrPm8bJHqbAsZOcjKNWDTqA+5IP7akz9TlQJZq0o7ze29jkNVMhW4wBur GYLRx+v4GInGz9hwYQUSfnMVTzgGx0EegnevYn88cpg3c7Di/oKPwp7Kj P3GrSuXvM7QzaSVcHMbGuhKofTqWVUB4hBXSVQwaj7bhNo14/VvrW2jtp g==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326699" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:45:01 +0800 IronPort-SDR: wFKy/LVGuSPGjVIh+TUsVK/LE2FWMZm0kVQwKD49CwDw3HIczYXCga+M/O7ypz3oW+XYWg961u VkZrghbeK1sCThxtLYb27Y9bn9ZJhRbVv6uPlFIIHZxAMD13AsoD/z6k2Y0/Kbx3rEwOeaEZFj vCHhbk3V6K1KFCkjaG+0F9JgNIXZAR8nfhN1lV6KVvOUFXNiz1KXeljBExc7E7PYXsPQmutIOV deHtccz36iMjMHGSRwNSh3Mbxwk3LJtsqj6U64BNXs791Ovh0BxfvKKmACznVY1H7vYYhPLEy+ r2aE6Ib/StB30kRIUqi+Yz6V Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:28 -0700 IronPort-SDR: B264OnKFl7opOEEJDtzNvIncxOoV+50sq8A/hUzIgbZnIzsHC5RWT7va3lZbrNo95pWtqlrs7/ U4qCXikic8KwMJTjxx+sMS5waje7dZTFd4GrSZT+SmFBoVGHO/jPyDvXbVbxXASg+IxIY2Occy cyc5VD1/Dy0iYUpIae0/K5gJp50+NBEKbQf9u+U3GVpZ6W7EwurBlsDzLZEfI7VY0dO4TLEUIu AXWUz6KI9vwa4M5ZGD/Qrc1PZPEHFKBo7XX6cxQq+6lCBH6Q6Y1X4cXjUFabJJHxEn2mkHw1Hb bWM= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:02 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 04/11] libata: cleanup device sleep capability detection Date: Mon, 16 Aug 2021 10:44:49 +0900 Message-Id: <20210816014456.2191776-5-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Move the code to retrieve the device sleep capability and timings out of ata_dev_configure() into the helper function ata_dev_config_devslp(). While at it, mark the device as supporting the device sleep capability only if the sata settings page was retrieved successfully to ensure that the timing information is correctly initialized. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-core.c | 55 +++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index d3f7830bda2e..499ec1380676 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -2363,6 +2363,37 @@ static void ata_dev_config_trusted(struct ata_device *dev) dev->flags |= ATA_DFLAG_TRUSTED; } +static void ata_dev_config_devslp(struct ata_device *dev) +{ + u8 *sata_setting = dev->link->ap->sector_buf; + unsigned int err_mask; + int i, j; + + /* + * Check device sleep capability. Get DevSlp timing variables + * from SATA Settings page of Identify Device Data Log. + */ + if (!ata_id_has_devslp(dev->id)) + return; + + err_mask = ata_read_log_page(dev, + ATA_LOG_IDENTIFY_DEVICE, + ATA_LOG_SATA_SETTINGS, + sata_setting, 1); + if (err_mask) { + ata_dev_dbg(dev, + "failed to get SATA Settings Log, Emask 0x%x\n", + err_mask); + return; + } + + dev->flags |= ATA_DFLAG_DEVSLP; + for (i = 0; i < ATA_LOG_DEVSLP_SIZE; i++) { + j = ATA_LOG_DEVSLP_OFFSET + i; + dev->devslp_timing[i] = sata_setting[j]; + } +} + /** * ata_dev_configure - Configure the specified ATA/ATAPI device * @dev: Target device to configure @@ -2565,29 +2596,7 @@ int ata_dev_configure(struct ata_device *dev) } } - /* Check and mark DevSlp capability. Get DevSlp timing variables - * from SATA Settings page of Identify Device Data Log. - */ - if (ata_id_has_devslp(dev->id)) { - u8 *sata_setting = ap->sector_buf; - int i, j; - - dev->flags |= ATA_DFLAG_DEVSLP; - err_mask = ata_read_log_page(dev, - ATA_LOG_IDENTIFY_DEVICE, - ATA_LOG_SATA_SETTINGS, - sata_setting, - 1); - if (err_mask) - ata_dev_dbg(dev, - "failed to get Identify Device Data, Emask 0x%x\n", - err_mask); - else - for (i = 0; i < ATA_LOG_DEVSLP_SIZE; i++) { - j = ATA_LOG_DEVSLP_OFFSET + i; - dev->devslp_timing[i] = sata_setting[j]; - } - } + ata_dev_config_devslp(dev); ata_dev_config_sense_reporting(dev); ata_dev_config_zac(dev); ata_dev_config_trusted(dev); From patchwork Mon Aug 16 01:44:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=bBmoD7c7; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxmy38Kyz9sWS for ; Mon, 16 Aug 2021 11:45:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230085AbhHPBpf (ORCPT ); Sun, 15 Aug 2021 21:45:35 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37268 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbhHPBpe (ORCPT ); Sun, 15 Aug 2021 21:45:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078302; x=1660614302; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UnaVB6KDNNEpWf+5iF0GJ2TeYxp+J3L7FRn55Pjn1Ak=; b=bBmoD7c7+uBA1y5xiD2USYl5ibvpfTh11yZYpFAcnE4MZqD4NoE8ZMxj XrkWf6+k7d1S85zNZkrzaGZF7OIONAZ18WN6x1iFmHloERoCyc8Jo3BaE OIF7EN2OssFoVBodYLcaYnACofPtClHLjo202p6lm9my81LtwXxbdNVte 2XGIW36iagVlDGBM7HdSLITkq9Nw7PQYxsE+t9kBZ0lftNFF5O/pGysKk FJmR05xV8T2nuwK9ODho+WsAoKi4gBKuIcdQvYQbm4ReEchAkz4Y/zBfX 6yh1ZKBZiBnUepI3L+lLvJzz4lyxHyN7lV6LsVnf7yYpeWywHT6m3Gpw1 g==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326704" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:45:02 +0800 IronPort-SDR: BNK9EYUyMr84cUrgN8tmEsgxKrVz2c792J4VFbrOyVQlJ3sZ/4g5U8O9zVB+gjxtZ/w455fKp6 svGfPmMfxMP3pM7A643oTNAKT8RNciB+hPk6cMRr3PF5ZoBnj+lzYxDx1yLJCmPMpbPCeLiXss dMpjC0EzhH4bwDP0UNYRd50ebL2K+U+b1ixTJvKfr7+w4bnQjbpePrmYcME2n5iSM9EretyDYL 2Dw2ctMRcrEBxxDwk89X6igNWCPRQyiSDAyAvBIuzfs8uUdd9qzW8gYfUjvhwEwibz8XXxzngl E8NYBR42d4BRtfAHwVOl2Asi Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:29 -0700 IronPort-SDR: lybTBY6fFy+yd0nQKNf1oNIfzDFzvzgIr82jV2PFxFjx34KRd+xZXKddFuxC0ls/z+C8dR6Q6V upLbQzSaWaYTG3Sh+3UBwAPMS+5q0DinoJMLYB44S7Lfd0V8vJPMqTbxAXjm7we5QCK93U/KRH PScD7p/b/kMBaBSab9xiDD7L5YM5knrcVVLz0533IBQzjEzZyTOMPv8Kk90n1Gd4oop+BoLOx4 6mqoPvpoWuqW66wwrXhz7hpGUpjRTmXIvHo6+cBibjy7wMFGx8PHY/lqZ9swBw35omzPFO/Po+ HGU= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:03 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 05/11] libata: cleanup ata_dev_configure() Date: Mon, 16 Aug 2021 10:44:50 +0900 Message-Id: <20210816014456.2191776-6-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Introduce the helper functions ata_dev_config_lba() and ata_dev_config_chs() to configure the addressing capabilities of a device. To control message printing in these new helpers, as well as in ata_dev_configure() and in ata_hpa_resize(), add the helper function ata_dev_print_info() to avoid open coding for the eh context ATA_EHI_PRINTINFO flag in multiple functions. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-core.c | 131 ++++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 56 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 499ec1380676..660b450bc498 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -159,6 +159,12 @@ MODULE_DESCRIPTION("Library module for ATA devices"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); +static inline bool ata_dev_print_info(struct ata_device *dev) +{ + struct ata_eh_context *ehc = &dev->link->eh_context; + + return ehc->i.flags & ATA_EHI_PRINTINFO; +} static bool ata_sstatus_online(u32 sstatus) { @@ -1266,8 +1272,7 @@ static int ata_set_max_sectors(struct ata_device *dev, u64 new_sectors) */ static int ata_hpa_resize(struct ata_device *dev) { - struct ata_eh_context *ehc = &dev->link->eh_context; - int print_info = ehc->i.flags & ATA_EHI_PRINTINFO; + bool print_info = ata_dev_print_info(dev); bool unlock_hpa = ata_ignore_hpa || dev->flags & ATA_DFLAG_UNLOCK_HPA; u64 sectors = ata_id_n_sectors(dev->id); u64 native_sectors; @@ -2363,6 +2368,65 @@ static void ata_dev_config_trusted(struct ata_device *dev) dev->flags |= ATA_DFLAG_TRUSTED; } +static int ata_dev_config_lba(struct ata_device *dev) +{ + struct ata_port *ap = dev->link->ap; + const u16 *id = dev->id; + const char *lba_desc; + char ncq_desc[24]; + int ret; + + dev->flags |= ATA_DFLAG_LBA; + + if (ata_id_has_lba48(id)) { + lba_desc = "LBA48"; + dev->flags |= ATA_DFLAG_LBA48; + if (dev->n_sectors >= (1UL << 28) && + ata_id_has_flush_ext(id)) + dev->flags |= ATA_DFLAG_FLUSH_EXT; + } else { + lba_desc = "LBA"; + } + + /* config NCQ */ + ret = ata_dev_config_ncq(dev, ncq_desc, sizeof(ncq_desc)); + + /* print device info to dmesg */ + if (ata_msg_drv(ap) && ata_dev_print_info(dev)) + ata_dev_info(dev, + "%llu sectors, multi %u: %s %s\n", + (unsigned long long)dev->n_sectors, + dev->multi_count, lba_desc, ncq_desc); + + return ret; +} + +static void ata_dev_config_chs(struct ata_device *dev) +{ + struct ata_port *ap = dev->link->ap; + const u16 *id = dev->id; + + if (ata_id_current_chs_valid(id)) { + /* Current CHS translation is valid. */ + dev->cylinders = id[54]; + dev->heads = id[55]; + dev->sectors = id[56]; + } else { + /* Default translation */ + dev->cylinders = id[1]; + dev->heads = id[3]; + dev->sectors = id[6]; + } + + /* print device info to dmesg */ + if (ata_msg_drv(ap) && ata_dev_print_info(dev)) + ata_dev_info(dev, + "%llu sectors, multi %u, CHS %u/%u/%u\n", + (unsigned long long)dev->n_sectors, + dev->multi_count, dev->cylinders, + dev->heads, dev->sectors); +} + static void ata_dev_config_devslp(struct ata_device *dev) { u8 *sata_setting = dev->link->ap->sector_buf; @@ -2410,8 +2474,7 @@ static void ata_dev_config_devslp(struct ata_device *dev) int ata_dev_configure(struct ata_device *dev) { struct ata_port *ap = dev->link->ap; - struct ata_eh_context *ehc = &dev->link->eh_context; - int print_info = ehc->i.flags & ATA_EHI_PRINTINFO; + bool print_info = ata_dev_print_info(dev); const u16 *id = dev->id; unsigned long xfer_mask; unsigned int err_mask; @@ -2538,62 +2601,18 @@ int ata_dev_configure(struct ata_device *dev) dev->multi_count = cnt; } - if (ata_id_has_lba(id)) { - const char *lba_desc; - char ncq_desc[24]; - - lba_desc = "LBA"; - dev->flags |= ATA_DFLAG_LBA; - if (ata_id_has_lba48(id)) { - dev->flags |= ATA_DFLAG_LBA48; - lba_desc = "LBA48"; - - if (dev->n_sectors >= (1UL << 28) && - ata_id_has_flush_ext(id)) - dev->flags |= ATA_DFLAG_FLUSH_EXT; - } + /* print device info to dmesg */ + if (ata_msg_drv(ap) && print_info) + ata_dev_info(dev, "%s: %s, %s, max %s\n", + revbuf, modelbuf, fwrevbuf, + ata_mode_string(xfer_mask)); - /* config NCQ */ - rc = ata_dev_config_ncq(dev, ncq_desc, sizeof(ncq_desc)); + if (ata_id_has_lba(id)) { + rc = ata_dev_config_lba(dev); if (rc) return rc; - - /* print device info to dmesg */ - if (ata_msg_drv(ap) && print_info) { - ata_dev_info(dev, "%s: %s, %s, max %s\n", - revbuf, modelbuf, fwrevbuf, - ata_mode_string(xfer_mask)); - ata_dev_info(dev, - "%llu sectors, multi %u: %s %s\n", - (unsigned long long)dev->n_sectors, - dev->multi_count, lba_desc, ncq_desc); - } } else { - /* CHS */ - - /* Default translation */ - dev->cylinders = id[1]; - dev->heads = id[3]; - dev->sectors = id[6]; - - if (ata_id_current_chs_valid(id)) { - /* Current CHS translation is valid. */ - dev->cylinders = id[54]; - dev->heads = id[55]; - dev->sectors = id[56]; - } - - /* print device info to dmesg */ - if (ata_msg_drv(ap) && print_info) { - ata_dev_info(dev, "%s: %s, %s, max %s\n", - revbuf, modelbuf, fwrevbuf, - ata_mode_string(xfer_mask)); - ata_dev_info(dev, - "%llu sectors, multi %u, CHS %u/%u/%u\n", - (unsigned long long)dev->n_sectors, - dev->multi_count, dev->cylinders, - dev->heads, dev->sectors); - } + ata_dev_config_chs(dev); } ata_dev_config_devslp(dev); From patchwork Mon Aug 16 01:44:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=j8b0rUhP; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxn4114Hz9sWS for ; Mon, 16 Aug 2021 11:45:12 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232236AbhHPBpl (ORCPT ); Sun, 15 Aug 2021 21:45:41 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37268 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230397AbhHPBpf (ORCPT ); Sun, 15 Aug 2021 21:45:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078303; x=1660614303; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=K6cuMyEa9XM1/DRBQ8GMISegyu7UcWsI3qu8wFRMlZw=; b=j8b0rUhPfDRGlshASJp6njHIoTKkgz92KgTkzvg6o7QugGKYdJgWsfpj SeEBD6Ttwypc8g7R9Ey4cCfi4Zco6XBSnPBdFn/RPDzyEArCTAMj6OP61 z/VgG59AwYrkVmPqXHJEIGTpayexhtrVFIxVwVERJ4TkTaTI+hNxatYQK r1RxkVh9P4CeTLRg+IaP/sUSRaSmGFyxgB9ZM0EeRgNua+sJTOY80sss1 WBrxW181bLcgQettnganEfgmDLkvIALWVIjQuC+0aJMzRz2foc1u1pPb4 YIZjsVFP8MVGFn1j/QxWG5BLFAY4yxHjDvKKoimMqhwp/dtBstO9lSyTl g==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326707" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:45:03 +0800 IronPort-SDR: SJqRcvBs/CKexzjD3G2gNVRpwOTND1QvXokqkO8SNTlJQ1HjdVMh8lX9ZbNb09q0ZI5bsnFb4c PAw4bh+ik8NNY4YraR2m8WfLYtlja8D4YinIzDfhAKN0lW5iSW9zDfqAcXFbngbX+7AErZPa2J fYT3sB7XK+hU7jkVJAGi4sEy8tSQDUItchysiXXBc6H1EuBD1vBnFKIDQe4PSg2y6GuPQELwlq fP9wlxSNBRcdKETyiZdVIqjZxYXQi7WN0Id2MxSpd2biqlAEXGUIrm5wryGju0pLra6WmX1HPC gszkCH82WFIOplcMnvzY+0aJ Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:30 -0700 IronPort-SDR: KRbVl4iAPZD4UFvbug/yueQNZq8+JmXmGO9srPaDMHcopqMTZktbT5wLwzO1lsm+dqU5lMz+UY Snw6lgU95WsuVO8LwkcT3KFIzd4BjXpUcXavfpa+SfyMcdxKg9I7MyfQXz59sR04CAYtXzKgk8 lJ6x0wlyS2H8wwJFPLBM3box7TMW4wJCffNk7/QrNLcPJBmB9zUyHUVigCz0JrREaQN7CMfhhC ZbHC9oqbCb7dIrPdtfxcnVuZX65Sso6uNHcO8Z2P6fe1ypruTErpyozeHZVPZCLOjse2HzeTBV AN0= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:04 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 06/11] libata: cleanup NCQ priority handling Date: Mon, 16 Aug 2021 10:44:51 +0900 Message-Id: <20210816014456.2191776-7-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org The ata device flag ATA_DFLAG_NCQ_PRIO indicates if a device supports the NCQ Priority feature while the ATA_DFLAG_NCQ_PRIO_ENABLE device flag indicates if the feature is enabled. Enabling NCQ priority use is controlled by the user through the device sysfs attribute ncq_prio_enable. As a result, the ATA_DFLAG_NCQ_PRIO flag should not be cleared when ATA_DFLAG_NCQ_PRIO_ENABLE is not set as the device still supports the feature even after the user disables it. This leads to the following cleanups: - In ata_build_rw_tf(), set a command high priority bit based on the ATA_DFLAG_NCQ_PRIO_ENABLE flag, not on the ATA_DFLAG_NCQ flag. That is, set a command high priority only if the user enabled NCQ priority use. - In ata_dev_config_ncq_prio(), ATA_DFLAG_NCQ_PRIO should not be cleared if ATA_DFLAG_NCQ_PRIO_ENABLE is not set. If the device does not support NCQ priority, both ATA_DFLAG_NCQ_PRIO and ATA_DFLAG_NCQ_PRIO_ENABLE must be cleared. With the above ata_dev_config_ncq_prio() change, ATA_DFLAG_NCQ_PRIO flag is set on device scan and revalidation. There is no need to trigger a device revalidation in ata_ncq_prio_enable_store() when the user enables the use of NCQ priority. Remove the revalidation code from that funciton to simplify it. Also change the return value from -EIO to -EINVAL when a user tries to enable NCQ priority for a device that does not support this feature. While at it, also simplify ata_ncq_prio_enable_show(). Overall, there is no functional change introduced by this patch. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-core.c | 32 ++++++++++++++------------------ drivers/ata/libata-sata.c | 37 ++++++++++++------------------------- 2 files changed, 26 insertions(+), 43 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 660b450bc498..a845a2b8d899 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -712,11 +712,9 @@ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, if (tf->flags & ATA_TFLAG_FUA) tf->device |= 1 << 7; - if (dev->flags & ATA_DFLAG_NCQ_PRIO) { - if (class == IOPRIO_CLASS_RT) - tf->hob_nsect |= ATA_PRIO_HIGH << - ATA_SHIFT_PRIO; - } + if (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE && + class == IOPRIO_CLASS_RT) + tf->hob_nsect |= ATA_PRIO_HIGH << ATA_SHIFT_PRIO; } else if (dev->flags & ATA_DFLAG_LBA) { tf->flags |= ATA_TFLAG_LBA; @@ -2178,11 +2176,6 @@ static void ata_dev_config_ncq_prio(struct ata_device *dev) struct ata_port *ap = dev->link->ap; unsigned int err_mask; - if (!(dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE)) { - dev->flags &= ~ATA_DFLAG_NCQ_PRIO; - return; - } - err_mask = ata_read_log_page(dev, ATA_LOG_IDENTIFY_DEVICE, ATA_LOG_SATA_SETTINGS, @@ -2190,18 +2183,21 @@ static void ata_dev_config_ncq_prio(struct ata_device *dev) 1); if (err_mask) { ata_dev_dbg(dev, - "failed to get Identify Device data, Emask 0x%x\n", + "failed to get SATA settings log, Emask 0x%x\n", err_mask); - return; + goto not_supported; } - if (ap->sector_buf[ATA_LOG_NCQ_PRIO_OFFSET] & BIT(3)) { - dev->flags |= ATA_DFLAG_NCQ_PRIO; - } else { - dev->flags &= ~ATA_DFLAG_NCQ_PRIO; - ata_dev_dbg(dev, "SATA page does not support priority\n"); - } + if (!(ap->sector_buf[ATA_LOG_NCQ_PRIO_OFFSET] & BIT(3))) + goto not_supported; + + dev->flags |= ATA_DFLAG_NCQ_PRIO; + + return; +not_supported: + dev->flags &= ~ATA_DFLAG_NCQ_PRIO_ENABLE; + dev->flags &= ~ATA_DFLAG_NCQ_PRIO; } static int ata_dev_config_ncq(struct ata_device *dev, diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 8adeab76dd38..dc397ebda089 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -839,23 +839,17 @@ static ssize_t ata_ncq_prio_enable_show(struct device *device, char *buf) { struct scsi_device *sdev = to_scsi_device(device); - struct ata_port *ap; + struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_device *dev; bool ncq_prio_enable; int rc = 0; - ap = ata_shost_to_port(sdev->host); - spin_lock_irq(ap->lock); dev = ata_scsi_find_dev(ap, sdev); - if (!dev) { + if (!dev) rc = -ENODEV; - goto unlock; - } - - ncq_prio_enable = dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE; - -unlock: + else + ncq_prio_enable = dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE; spin_unlock_irq(ap->lock); return rc ? rc : snprintf(buf, 20, "%u\n", ncq_prio_enable); @@ -869,7 +863,7 @@ static ssize_t ata_ncq_prio_enable_store(struct device *device, struct ata_port *ap; struct ata_device *dev; long int input; - int rc; + int rc = 0; rc = kstrtol(buf, 10, &input); if (rc) @@ -883,27 +877,20 @@ static ssize_t ata_ncq_prio_enable_store(struct device *device, return -ENODEV; spin_lock_irq(ap->lock); + + if (!(dev->flags & ATA_DFLAG_NCQ_PRIO)) { + rc = -EINVAL; + goto unlock; + } + if (input) dev->flags |= ATA_DFLAG_NCQ_PRIO_ENABLE; else dev->flags &= ~ATA_DFLAG_NCQ_PRIO_ENABLE; - dev->link->eh_info.action |= ATA_EH_REVALIDATE; - dev->link->eh_info.flags |= ATA_EHI_QUIET; - ata_port_schedule_eh(ap); +unlock: spin_unlock_irq(ap->lock); - ata_port_wait_eh(ap); - - if (input) { - spin_lock_irq(ap->lock); - if (!(dev->flags & ATA_DFLAG_NCQ_PRIO)) { - dev->flags &= ~ATA_DFLAG_NCQ_PRIO_ENABLE; - rc = -EIO; - } - spin_unlock_irq(ap->lock); - } - return rc ? rc : len; } From patchwork Mon Aug 16 01:44:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=QhondoGI; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxn548Tvz9sWS for ; Mon, 16 Aug 2021 11:45:13 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232465AbhHPBpm (ORCPT ); Sun, 15 Aug 2021 21:45:42 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37272 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbhHPBpg (ORCPT ); Sun, 15 Aug 2021 21:45:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078304; x=1660614304; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jcGiBKGqL/HTpWqdCz+a8CS+BImWhuMqxWT6s2+gBR8=; b=QhondoGIxJOvXVncVY9s/XK45eEEZ3FjLa8Swz3qbVDdlALKyBcWJKOc 3cM70OfZLkFoFHZDDkZOU/NVHZtg587Ks/Q9Jdc3zJkdzSXj7prM4wB0O KIEPbDrAdY850wMmHR/obQZGcj0Kb/ozRERAkX4mVgpSzF+H9m/+DSzTL l6ZbKMHy2ywsGqgY06YkD7oPcMtqw3NfaG/TdgvYSx6eodEJLNMi2vWPG hKpB7ADcdT7qbODEmF/bF5oBYDyCFyMXOUvKjFgUdcQBA/0UDJ1dEqb4/ vOqTvQJ1bVOUaFc5L8Btf8H7OG2ndjZyFUBnPAT1yjG3hCaRc7hv9OOpl Q==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326710" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:45:04 +0800 IronPort-SDR: 7TfjoICoJDFNqRWyik+3OguRhFRzITvJ0U1s8oPTXletICWh2M2XV2xI5dUAoeQiANlTtnRANz 80dOCmj4KyAHmMlNATovtN/P5cIvwIT6QS39Wm+TzPTSKci2e129TwMQJQFNOYwBddp0x51C2f mI+NTAvoWETM1yrIi1cImGgLttDUAqzW8eX/68YwbfH3Z877nYNPya7HROXNDQ1FwjuAaHpjSo UIQGeOArNW6w37yxzTYTTweoAuIogfXjVmbUCEZhRtWYrnV3Bs/P9x3F9d8A+nRbQSRPYUzG1t 1AINcQkrUiHVVGNQIWbTI3oS Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:31 -0700 IronPort-SDR: cZK7uPJBcoDGpxaFHFWSeAKZR/t2ZS8dtdfXTGl1vYAL3R5zzswpNCuH2IOopliwMUliuUGVvu rPPapHz0jGPJ1Gz+xyrJv4x6kriElrRNE90srhb5H4YZN+7ReuoW0OtyvzJ3Qb4q9OFPgMKQ92 txLWYA1ru5bP1eKmiNYsVAXhywb7rMVBqcE5QDlwI8SEhof5RmuQg+C59uLPjWFa7zlFeEIu0L Q3fL1SW9YAwdvl5WFSO2e7uAiTmXMRgpC86CoJ7gD4YRfwhHhpeC2Izdc4ZIpYWGaCAJ06h3rZ oig= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:05 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 07/11] libata: fix ata_read_log_page() warning Date: Mon, 16 Aug 2021 10:44:52 +0900 Message-Id: <20210816014456.2191776-8-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Support for the READ LOG PAGE DMA EXT command is indicated by words 119 and 120 of a device identify data. This is tested in ata_read_log_page() with ata_id_has_read_log_dma_ext() and the READ LOG PAGE DMA command used if the device reports supports for it. However, some devices lie about this support and using the DMA version of the command fails, generating the warning message "READ LOG DMA EXT failed, trying PIO". Since READ LOG PAGE DMA EXT is an optional command, this warning is not at all important but may be scary for the user. Change ata_read_log_page() to suppres this warning and to print an error message if both DMA and PIO attempts failed. With this change, there is no need to print again an error message when ata_read_log_page() returns an error. So simplify the users of this function. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-core.c | 47 +++++++++++---------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index a845a2b8d899..bad577dbbc0d 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -2026,13 +2026,15 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log, err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, buf, sectors * ATA_SECT_SIZE, 0); - if (err_mask && dma) { - dev->horkage |= ATA_HORKAGE_NO_DMA_LOG; - ata_dev_warn(dev, "READ LOG DMA EXT failed, trying PIO\n"); - goto retry; + if (err_mask) { + if (dma) { + dev->horkage |= ATA_HORKAGE_NO_DMA_LOG; + goto retry; + } + ata_dev_err(dev, "Read log page 0x%02x failed, Emask 0x%x\n", + (unsigned int)page, err_mask); } - DPRINTK("EXIT, err_mask=%x\n", err_mask); return err_mask; } @@ -2061,12 +2063,8 @@ static bool ata_identify_page_supported(struct ata_device *dev, u8 page) */ err = ata_read_log_page(dev, ATA_LOG_IDENTIFY_DEVICE, 0, ap->sector_buf, 1); - if (err) { - ata_dev_info(dev, - "failed to get Device Identify Log Emask 0x%x\n", - err); + if (err) return false; - } for (i = 0; i < ap->sector_buf[8]; i++) { if (ap->sector_buf[9 + i] == page) @@ -2130,11 +2128,7 @@ static void ata_dev_config_ncq_send_recv(struct ata_device *dev) } err_mask = ata_read_log_page(dev, ATA_LOG_NCQ_SEND_RECV, 0, ap->sector_buf, 1); - if (err_mask) { - ata_dev_dbg(dev, - "failed to get NCQ Send/Recv Log Emask 0x%x\n", - err_mask); - } else { + if (!err_mask) { u8 *cmds = dev->ncq_send_recv_cmds; dev->flags |= ATA_DFLAG_NCQ_SEND_RECV; @@ -2160,11 +2154,7 @@ static void ata_dev_config_ncq_non_data(struct ata_device *dev) } err_mask = ata_read_log_page(dev, ATA_LOG_NCQ_NON_DATA, 0, ap->sector_buf, 1); - if (err_mask) { - ata_dev_dbg(dev, - "failed to get NCQ Non-Data Log Emask 0x%x\n", - err_mask); - } else { + if (!err_mask) { u8 *cmds = dev->ncq_non_data_cmds; memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_NON_DATA_SIZE); @@ -2181,12 +2171,8 @@ static void ata_dev_config_ncq_prio(struct ata_device *dev) ATA_LOG_SATA_SETTINGS, ap->sector_buf, 1); - if (err_mask) { - ata_dev_dbg(dev, - "failed to get SATA settings log, Emask 0x%x\n", - err_mask); + if (err_mask) goto not_supported; - } if (!(ap->sector_buf[ATA_LOG_NCQ_PRIO_OFFSET] & BIT(3))) goto not_supported; @@ -2347,11 +2333,8 @@ static void ata_dev_config_trusted(struct ata_device *dev) err = ata_read_log_page(dev, ATA_LOG_IDENTIFY_DEVICE, ATA_LOG_SECURITY, ap->sector_buf, 1); - if (err) { - ata_dev_dbg(dev, - "failed to read Security Log, Emask 0x%x\n", err); + if (err) return; - } trusted_cap = get_unaligned_le64(&ap->sector_buf[40]); if (!(trusted_cap & (1ULL << 63))) { @@ -2440,12 +2423,8 @@ static void ata_dev_config_devslp(struct ata_device *dev) ATA_LOG_IDENTIFY_DEVICE, ATA_LOG_SATA_SETTINGS, sata_setting, 1); - if (err_mask) { - ata_dev_dbg(dev, - "failed to get SATA Settings Log, Emask 0x%x\n", - err_mask); + if (err_mask) return; - } dev->flags |= ATA_DFLAG_DEVSLP; for (i = 0; i < ATA_LOG_DEVSLP_SIZE; i++) { From patchwork Mon Aug 16 01:44:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=AEN/KbKR; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxn56Rtdz9sWw for ; Mon, 16 Aug 2021 11:45:13 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232623AbhHPBpn (ORCPT ); Sun, 15 Aug 2021 21:45:43 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37276 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230448AbhHPBpi (ORCPT ); Sun, 15 Aug 2021 21:45:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078306; x=1660614306; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QxLawA2FoU92rg8+3N60ckeNjg2itVghvmelVKXdIyI=; b=AEN/KbKRW2Qc8FOcHJKUECncdxX/2z7mYIVLelSejbdmApbTSEOlEC2Z VAKTWIthr/A1r2e42phFR0eHE7V4/I6uni3Nm2sBegLjzgZ+O1lIGD8dX +jYEBVK6vfyAncmHed6/AMTgT6pe6PBfQ/tqcpPIDFEmoG4mSxZ1oGsuf r7khdTyhBufV5q13qgyZgh9cwwXvrUTKJueN+snHdsYGHMnVmYFGGGcb0 asmkSit6ueY1XtKge1RQ3pOqXbXE159+3f3bDfQaD7dVc9h+pDbfTNu7A svH457qi091DZaM2eBuY9eXbY8VVr9NbUfhDzPLn2X3UUErDZ0Y6lgMrg w==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326713" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:45:05 +0800 IronPort-SDR: c/qaqMjKS7wxFOlj4nsnCq/C3rytx+AG8NVhojTRpMdr0kEVDjzavnIGvYg88mk4bj0ubw//PN iOCA+rjt7/gXA9+wh0fRIXlBbWGS69NXnTno7cTmpdQJUtR4bckspSPmowLDnx6dvH0fIPR46W wpV6i7/qcLTQdbAAoHuaJ54IWwU31AO4FPYQYCO1+vPjDv3z6HZIn2iPCDl0sDINM1nRWTTq0K qpqVnW9cyKJlxYBL6Ul1tfTtjrUOjPvTN9sQ/z75ZW6E+FwHi4bQomYSLCCSLMhK1yQ2+7qgSP 7/e27zpFsdOizCpNCzbe45FH Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:31 -0700 IronPort-SDR: olo9Grpn1QHqiaXEfCuRGX17u5dvPgmBITQpGmLhEKLV9jfcaQm4aDYR5z+I/h6OPlUonDncCH jslXCpdKF75mqFH4V0fKrbNLsTxQ5Wajkpg/rchjakK0zxZrGNizuXSNM+rBdHdwQgO1SlBfYE eGMVXUiKJ/B7qJj4DahVmJbnrWcRGcpA2JoC4/sEp3hM5W03dPUbVY+Q+BG9vogcfSRkj5c7+T T+iWmm2CXEX0CmrHi5BwG/qT1mUan7Zi//H4emt8NCBBd/ATHm0QvDaVFzjpcRoDgNFjDLLE7T h0g= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:06 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 08/11] libata: print feature list on device scan Date: Mon, 16 Aug 2021 10:44:53 +0900 Message-Id: <20210816014456.2191776-9-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Print a list of features supported by a drive when it is configured in ata_dev_configure() using the new function ata_dev_print_features(). The features printed are not already advertized and are: trusted send-recev support, device attention support, device sleep support, NCQ send-recv support and NCQ priority support. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-core.c | 17 +++++++++++++++++ include/linux/libata.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index bad577dbbc0d..68a55d3e977a 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -2433,6 +2433,20 @@ static void ata_dev_config_devslp(struct ata_device *dev) } } +static void ata_dev_print_features(struct ata_device *dev) +{ + if (!(dev->flags & ATA_DFLAG_FEATURES_MASK)) + return; + + ata_dev_info(dev, + "Features:%s%s%s%s%s\n", + dev->flags & ATA_DFLAG_TRUSTED ? " Trust" : "", + dev->flags & ATA_DFLAG_DA ? " Dev-Attention" : "", + dev->flags & ATA_DFLAG_DEVSLP ? " Dev-Sleep" : "", + dev->flags & ATA_DFLAG_NCQ_SEND_RECV ? " NCQ-sndrcv" : "", + dev->flags & ATA_DFLAG_NCQ_PRIO ? " NCQ-prio" : ""); +} + /** * ata_dev_configure - Configure the specified ATA/ATAPI device * @dev: Target device to configure @@ -2595,6 +2609,9 @@ int ata_dev_configure(struct ata_device *dev) ata_dev_config_zac(dev); ata_dev_config_trusted(dev); dev->cdb_len = 32; + + if (ata_msg_drv(ap) && print_info) + ata_dev_print_features(dev); } /* ATAPI-specific feature tests */ diff --git a/include/linux/libata.h b/include/linux/libata.h index 3fcd24236793..b23f28cfc8e0 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -161,6 +161,10 @@ 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_DEV_UNKNOWN = 0, /* unknown device */ ATA_DEV_ATA = 1, /* ATA device */ ATA_DEV_ATA_UNSUP = 2, /* ATA device (unsupported) */ From patchwork Mon Aug 16 01:44:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=Jv1GKwJK; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxn63bXjz9sWS for ; Mon, 16 Aug 2021 11:45:14 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231738AbhHPBpn (ORCPT ); Sun, 15 Aug 2021 21:45:43 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37268 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232045AbhHPBpl (ORCPT ); Sun, 15 Aug 2021 21:45:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078309; x=1660614309; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vN2oiBTls/J4Y9W2lVbQUymPeVbZdsgb/efvUuqJGVQ=; b=Jv1GKwJKfkv5dMeJ/wCdekBqtq0FwoHNTxQzQnR1YrB2VhLtYHZf2Ry8 NXCdzdG26FnuPIWnBH/3Y+b+88+TzlFV+J56eZuz15OHZlmILCfSwnbKN cLJV1MmrhR8ImAHOnT8m8Zjk9hTyYplRpSut2tiVyPzGtqtmeO0UG7qvg oS5Z2cQpPFIHm7LUXrMj0CzFzAp3i55arInxtfB6mRne3wmZ6LC8Ij59A yp5F7WK5Xax/4U4K1ufSHxxtCedV8B1kun0NscU7TwKeJJr68TS7DpFqK NKna2sNdxgiiKAkdNg32V1YRCESGHdvv4tvljfz8XzefnK8aaZqoazkrp A==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326718" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:45:05 +0800 IronPort-SDR: G+JClcilvxvoDmWdbpBCAhGeQEe0Yf/VV9qzrKX09atA/0Erpmpw6or5/PRKbi/woAEEriJRSR v9iFiFCCzwqLFEqqWvEyDxVOPREhSeTbG1ljFsRmUGZSXjuMsFu07ADoFunHx0TT0axd3kg12H odQcSTZwu5NCl+fDa8hdFhHHb2ORcQOzQ5rntRcyCaXTBRfPkKrJO9yENcuwhOH/BAXRwnUe+v 8FS7l5rZbWNmmdLJMe1yJTj4clhsq6CRxldHZXKEVPZnAqdM2rTYGEPcTQ0gl5SJcxQy4KMcOJ aMe4naImZTLfKXET6FRsAGCD Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:32 -0700 IronPort-SDR: bU9vlPLT98KheDyu1JIU5abwaiD/tqC6DjlOAjkqY93QgxNT5O0WPvbOKHMXgap482+98FPjH6 yUwcMGgzrz/4ubT1J33549Q3PDc0hZ0Wv0dz8fDxk8+3f1/ahrRVHVx/MtNsyQbxiyFXIGANzF 9Ql0ks401UrKavI/raor4JP1K5UA3nlpFQqYFu1UFQgqUKhlhbpkv1WTy1LhLImIfV/7ogyn7B 9p749VFU9zQ7bIUPv7y8G+52Cu9dxv2CkpbbBdeOPdQS/vflClac+cTehuXKk8Eazstx8HP9z2 2WI= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:07 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 09/11] libata: Introduce ncq_prio_supported sysfs sttribute Date: Mon, 16 Aug 2021 10:44:54 +0900 Message-Id: <20210816014456.2191776-10-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Currently, the only way a user can determine if a SATA device supports NCQ priority is to try to enable the use of this feature using the ncq_prio_enable sysfs device attribute. If enabling the feature fails, it is because the device does not support NCQ priority. Otherwise, the feature is enabled and success indicates that the device supports NCQ priority. Improve this odd interface by introducing the read-only ncq_prio_supported sysfs device attribute to indicate if a SATA device supports NCQ priority. The value of this attribute reflects the status of device flag ATA_DFLAG_NCQ_PRIO, which is set only for devices supporting NCQ priority. Add this new sysfs attribute to the device attributes group of libahci and libata-sata. Signed-off-by: Damien Le Moal --- drivers/ata/libahci.c | 1 + drivers/ata/libata-sata.c | 25 +++++++++++++++++++++++++ include/linux/libata.h | 1 + 3 files changed, 27 insertions(+) diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index fec2e9754aed..5b3fa2cbe722 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -125,6 +125,7 @@ EXPORT_SYMBOL_GPL(ahci_shost_attrs); struct device_attribute *ahci_sdev_attrs[] = { &dev_attr_sw_activity, &dev_attr_unload_heads, + &dev_attr_ncq_prio_supported, &dev_attr_ncq_prio_enable, NULL }; diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index dc397ebda089..8f3ff830ab0c 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -834,6 +834,30 @@ DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR, ata_scsi_lpm_show, ata_scsi_lpm_store); EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy); +static ssize_t ata_ncq_prio_supported_show(struct device *device, + struct device_attribute *attr, + char *buf) +{ + struct scsi_device *sdev = to_scsi_device(device); + struct ata_port *ap = ata_shost_to_port(sdev->host); + struct ata_device *dev; + bool ncq_prio_supported; + int rc = 0; + + spin_lock_irq(ap->lock); + dev = ata_scsi_find_dev(ap, sdev); + if (!dev) + rc = -ENODEV; + else + ncq_prio_supported = dev->flags & ATA_DFLAG_NCQ_PRIO; + spin_unlock_irq(ap->lock); + + return rc ? rc : sysfs_emit(buf, "%u\n", ncq_prio_supported); +} + +DEVICE_ATTR(ncq_prio_supported, S_IRUGO, ata_ncq_prio_supported_show, NULL); +EXPORT_SYMBOL_GPL(dev_attr_ncq_prio_supported); + static ssize_t ata_ncq_prio_enable_show(struct device *device, struct device_attribute *attr, char *buf) @@ -901,6 +925,7 @@ EXPORT_SYMBOL_GPL(dev_attr_ncq_prio_enable); struct device_attribute *ata_ncq_sdev_attrs[] = { &dev_attr_unload_heads, &dev_attr_ncq_prio_enable, + &dev_attr_ncq_prio_supported, NULL }; EXPORT_SYMBOL_GPL(ata_ncq_sdev_attrs); diff --git a/include/linux/libata.h b/include/linux/libata.h index b23f28cfc8e0..a2d1bae7900b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -539,6 +539,7 @@ typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes) extern struct device_attribute dev_attr_unload_heads; #ifdef CONFIG_SATA_HOST extern struct device_attribute dev_attr_link_power_management_policy; +extern struct device_attribute dev_attr_ncq_prio_supported; extern struct device_attribute dev_attr_ncq_prio_enable; extern struct device_attribute dev_attr_em_message_type; extern struct device_attribute dev_attr_em_message; From patchwork Mon Aug 16 01:44:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=Pi2NL+57; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxn65wZyz9sWw for ; Mon, 16 Aug 2021 11:45:14 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232045AbhHPBpo (ORCPT ); Sun, 15 Aug 2021 21:45:44 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37272 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbhHPBpl (ORCPT ); Sun, 15 Aug 2021 21:45:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078309; x=1660614309; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1QPiYuHt5dV869F8QwhdTO7THa99Yx4op/JiyCqhLpQ=; b=Pi2NL+57EJOzQFN2KnxRfxB8fYLtk1r2xID1xX9NhF+enMt+5Chjv4Ud xM6ytyNzP9i1y/CInqL2SNHI8E2nUZ33n08zdz9tEN8iuKz1Cbuo8XWaQ Fa0K95owoayWPO9b57q5ENhYu3gRdRvC0rqURgdcPu8wkt2pIXvbYGJYY XmfBOlhVhf16+coClLVrAV7wziEwS9KYcvsDtQslhXv/0cZZq1XkHRw3H wUV0N+PWpnJOZ37Ye1JhTjkqek1pH1A8zrir+PV095zY5pDS5lCWRxC4a 4Jp1Dp99hZD+qrijJLxdQ/Xafjn7JWMyNfrR1NvFgG71JwFJ4ZN4ojMP7 g==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326723" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:45:06 +0800 IronPort-SDR: 9Obp+9vB8t1jK9jm16sPLOnRJ1bq7qgolUMsqtDM6TRc9Ysf3koUdufJcUyvxN8D5Y1LWQydZ3 pNjlFCq2XraNK5o2cmIvjN8kBXEW/0lD6icQuzgs4NMkpqJc98szyixcKPsilTRh2u5IXCu1PW 2C3cKLNQGny5+kh6WWkjffyfal+8AW6Wf4KTALKwJ3XPf2Y5fT1WmGmbLhb1K3ix3Lu6EYHXF4 kKXi6mBAJ2btt3QjWdWp/7ZNCZhKWDuKnxKhh+HrG6WNtzHE7dHWamGhfrZCW9n8NpF/HhcyxW Nknx+392Xm0UbRi+kk2nCfQA Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:33 -0700 IronPort-SDR: JHY5WUkwUQSVFcj3iWVDEr3aflsmgfHBsdFT0p9PVQQeuPNndl06FMvewwU5UOqhpXexfOTuS9 nhasate5LspQXNQacTLZVZSvnGXBtCX2VlpvFqmOe7/gAjM9hwNuQhQoTnKPwJmHvJvK+ct+jO +u5pPVghzjahtCiz6ujvu2Opk8t+Jfn6sk080KTfx1VskG8sjbGb6faPofm+LULmTI7UT3fwv+ ihHGTCfZg0KlY4LJXGbiSla1S/nhomJ6VGE3VhIPUD/G3+TKYScbVwdo1TyBeVtTADlXCbUPBc MyA= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:08 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 10/11] docs: sysfs-block-device: improve ncq_prio_enable documentation Date: Mon, 16 Aug 2021 10:44:55 +0900 Message-Id: <20210816014456.2191776-11-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Niklas Cassel NCQ priority is an optional feature of the NCQ feature set and should not be confused with the NCQ feature set itself. Clarify the description of the ncq_prio_enable attribute to avoid this confusion. Also add the missing documentation for the equivalent sas_ncq_prio_enable attribute. Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- Documentation/ABI/testing/sysfs-block-device | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-block-device b/Documentation/ABI/testing/sysfs-block-device index aa0fb500e3c9..cf1013df4b92 100644 --- a/Documentation/ABI/testing/sysfs-block-device +++ b/Documentation/ABI/testing/sysfs-block-device @@ -55,6 +55,20 @@ Date: Oct, 2016 KernelVersion: v4.10 Contact: linux-ide@vger.kernel.org Description: - (RW) Write to the file to turn on or off the SATA ncq (native - command queueing) support. By default this feature is turned - off. + (RW) Write to the file to turn on or off the SATA NCQ (native + command queueing) priority support. By default this feature is + turned off. If the device does not support the SATA NCQ + priority feature, writing "1" to this file results in an error. + + +What: /sys/block/*/device/sas_ncq_prio_enable +Date: Oct, 2016 +KernelVersion: v4.10 +Contact: linux-ide@vger.kernel.org +Description: + (RW) This is the equivalent of the ncq_prio_enable attribute + file for SATA devices connected to a SAS host-bus-adapter + (HBA) implementing support for the SATA NCQ priority feature. + This file does not exist if the HBA driver does not implement + support for the SATA NCQ priority feature, regardless of the + device support for this feature. From patchwork Mon Aug 16 01:44:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1516991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=BQDqvFrk; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gnxn83pq9z9sWS for ; Mon, 16 Aug 2021 11:45:16 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232627AbhHPBpo (ORCPT ); Sun, 15 Aug 2021 21:45:44 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:37276 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232408AbhHPBpm (ORCPT ); Sun, 15 Aug 2021 21:45:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1629078309; x=1660614309; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j+YSu3G8m1N242e8AZ8+DtgpNOkgeoLoxwljEWU6T60=; b=BQDqvFrkU4BUxVs0bV6NCTKMJfX7sV4S8e8wAxbWBIS7IAEkCq6wYT5t RfdRP1ZfUU2Kn8nfBf/jx1L/aseFZx2bm9GiHajaR6MMRSwJdIkhpIkRb tywXDdvmnST9MiGYeTyhDAk3+jKf/R2/MQM/rPDQfcSlknjNM4MSBNnBx UeTELyqPVD6t//aChnh6dAVqK+XbPpmtf2Scz9BDJuryuP9hnLfndkrpX x/MhS/shqcmMF5T9IT6L2bTzO/qg2g4Db/H/2lV4frTO5EddY4AwnXseR qkjqS8Ygi3ObE7SWkR7P8n3sD+wu9tFK4aYMOg/drUbEJXXk+/ohkH7zz Q==; X-IronPort-AV: E=Sophos;i="5.84,324,1620662400"; d="scan'208";a="177326727" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Aug 2021 09:45:07 +0800 IronPort-SDR: I4bXPIJ4FwJ20KkNTwmpwJvAPVNVid9LA0/ftvaw7C/uYSHWDDC+C/shtMFIQ/OKki+2Eot76M YmlL5C0etxpN4xKaz6iORkEkVNQ/CPwihGRIQpWY1v5LWGxOYn+nLO7JbRn4IPSDaUyUYWr+NG RTOsyTt2zrspPNbQ+jgSr7oqZSFuGXP7amUos6dhrkG/rdwbg5f3ejDfHNPeDUJoXzZNHVztew CXs3SOJPmlQ0vBjAdyskusI5R1kbBfvS+wn3wy2THbQOa6Kdu+EYCty9AMfkNYJfHJP5nXse89 LqGaQTn9GyF+nIZd3IdYAIIp Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 18:20:34 -0700 IronPort-SDR: pX/X+1huhgyGVj2GKrWSu3okC5q4TmEHNcU+MAUGjtQuV2YLIyysfJSAG+wBTcAhldzcRHjG1L lluMnVrCTK6qG6Xp825SgVyV0ozvqQKDy3ZeDNf/wex+xSWC1IB89rEoGLcVnCh/N7USBMlAYQ xQ6OKep0lbRkuaDE55dYD1Ho76TxWxqbTf1oTJAqX0DF6PDZFfvi28bXum2WIXouQ4iIVw/oAM ai7noPfAAnRtnvZ8WDwrwJlUeq0kjkgIErsEsNxsHodxjoAe7PSLj6pSx8TGYoWmNgi0dkHm1k K8Y= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Aug 2021 18:45:09 -0700 From: Damien Le Moal To: Jens Axboe , linux-ide@vger.kernel.org Cc: linux-block@vger.kernel.org Subject: [PATCH v7 11/11] docs: sysfs-block-device: document ncq_prio_supported Date: Mon, 16 Aug 2021 10:44:56 +0900 Message-Id: <20210816014456.2191776-12-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816014456.2191776-1-damien.lemoal@wdc.com> References: <20210816014456.2191776-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Add documentation for the new device attribute file ncq_prio_supported, and its SAS HBA equivalent sas_ncq_prio_supported. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- Documentation/ABI/testing/sysfs-block-device | 25 +++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/ABI/testing/sysfs-block-device b/Documentation/ABI/testing/sysfs-block-device index cf1013df4b92..7ac7b19b2f72 100644 --- a/Documentation/ABI/testing/sysfs-block-device +++ b/Documentation/ABI/testing/sysfs-block-device @@ -58,7 +58,8 @@ Description: (RW) Write to the file to turn on or off the SATA NCQ (native command queueing) priority support. By default this feature is turned off. If the device does not support the SATA NCQ - priority feature, writing "1" to this file results in an error. + priority feature, writing "1" to this file results in an error + (see ncq_prio_supported). What: /sys/block/*/device/sas_ncq_prio_enable @@ -71,4 +72,26 @@ Description: (HBA) implementing support for the SATA NCQ priority feature. This file does not exist if the HBA driver does not implement support for the SATA NCQ priority feature, regardless of the + device support for this feature (see sas_ncq_prio_supported). + + +What: /sys/block/*/device/ncq_prio_supported +Date: Aug, 2021 +KernelVersion: v5.15 +Contact: linux-ide@vger.kernel.org +Description: + (RO) Indicates if the device supports the SATA NCQ (native + command queueing) priority feature. + + +What: /sys/block/*/device/sas_ncq_prio_supported +Date: Aug, 2021 +KernelVersion: v5.15 +Contact: linux-ide@vger.kernel.org +Description: + (RO) This is the equivalent of the ncq_prio_supported attribute + file for SATA devices connected to a SAS host-bus-adapter + (HBA) implementing support for the SATA NCQ priority feature. + This file does not exist if the HBA driver does not implement + support for the SATA NCQ priority feature, regardless of the device support for this feature.