From patchwork Tue Sep 27 18:14:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Manzanares X-Patchwork-Id: 9352559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1D2E460757 for ; Tue, 27 Sep 2016 18:15:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12B33287F3 for ; Tue, 27 Sep 2016 18:15:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0784D29193; Tue, 27 Sep 2016 18:15:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D3C4287F3 for ; Tue, 27 Sep 2016 18:15:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933067AbcI0SPd (ORCPT ); Tue, 27 Sep 2016 14:15:33 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:47177 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933709AbcI0SPc (ORCPT ); Tue, 27 Sep 2016 14:15:32 -0400 X-IronPort-AV: E=Sophos;i="5.30,406,1470672000"; d="scan'208";a="18618861" Received: from mail-cys01nam02lp0050.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.50]) by ob1.hgst.iphmx.com with ESMTP; 28 Sep 2016 02:15:19 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-hgst-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dCZ3ecGiPlBgqoIgJ5pfMvZ4WkqFdfo/M4fylVCNNzU=; b=TJv/o1ffxbgYYJX7G22PxQymUgd5INfZCkfXMu0vjaBU8XSZs/8WQK8WUPgFl0zgxkWfdUMJHhhABpQPu43k7K54qfG8SmvzcOTVFxrN+YuvWvETVhTLyO8gHblZ+WS2ON/co3Vts1VH63QFBl8Mf2XthcyTrQvQRey2+CUyD7s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Adam.Manzanares@hgst.com; Received: from penguito.sanjose.hgst.com (199.255.44.175) by BLUPR0401MB1714.namprd04.prod.outlook.com (10.162.215.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Tue, 27 Sep 2016 18:15:17 +0000 From: Adam Manzanares To: , CC: , , Adam Manzanares Subject: [PATCH 2/3] ata: Enabling ATA Command Priorities Date: Tue, 27 Sep 2016 11:14:55 -0700 Message-ID: <1475000096-6148-3-git-send-email-adam.manzanares@hgst.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1475000096-6148-1-git-send-email-adam.manzanares@hgst.com> References: <1475000096-6148-1-git-send-email-adam.manzanares@hgst.com> MIME-Version: 1.0 X-Originating-IP: [199.255.44.175] X-ClientProxiedBy: SN1PR0701CA0045.namprd07.prod.outlook.com (10.163.126.13) To BLUPR0401MB1714.namprd04.prod.outlook.com (10.162.215.16) X-MS-Office365-Filtering-Correlation-Id: aac3ce3d-553f-4363-1bff-08d3e7023c83 X-Microsoft-Exchange-Diagnostics: 1; BLUPR0401MB1714; 2:fcO/I8MHPqKaOLosBMJtjRcAM5K6ytFQ7mFfxEgbJH1VFM+1+GTpY1Ia0yzWhjA3CW8Oex470yPMoS91sBOBSHeOmT6cYocylq5785t5KqSG2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eiVAPlQXqn5RbULIcbeVKkhdEcTb3iSqKEYMJ/I0+YD6rEchEGrXwW/VyQm0CwbFhcszQE2hlbpwVhsNbdO4StATX33G37JQnebsvIw4LPpceuJRRm/VqGcXjvkXlb+Oa34d6QBJtdM3ScV1G5jB00KgVHy7lu7ACNCGiglv/A+/0hvv2gJFPQBcD6BnuHLu7ZCfjuFd/f0V9sI5aPklAD4S75KokbqPHDOXk6XRX6PbWeizsfVAOKYAzQtYHeRbYE9CmSbZjCH3CA9FJObpZCawsqBg4ti4oNa+zzuxTBPNYIBZiRSnndjfQ7xw3o2Ygw4qtL8pJHiQLxftY9Q3duchY0nPPwsRWSZ9w9+TkjorekGhCEWDmyvxX+wcdpX3FRnq6aPy/8xrS4A1UgP6FVeBe934c1xG0uZL7 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(79135771888625); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:BLUPR0401MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0401MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0401MB1714; 4:LJ2srAfVBK9X/oUqChEeY8DIeU6lkZ5VS8XAYHYOL5PLPlGdmYXWiqgIPW2mco8hQTgDwOai2atATk7JFPOZ/XLwkzv5H7yHRaxghbwAXHp0nN3dK9mYoJeDCFvJQFBqv9wUeRwhJEYJXjZr4PUTW3haDEDS83Dvt30GWBAy3paCfGQlnYlnoArF2BmY/H8qIkGhaXQdDSMNeprDoz7/vprTKhlb3IZR8gdfN0y0eStunynia6vfyYpdxDIs8JB4D+xtXgKTbOQnobQ/7J2Tqu9ZWDhAMJFz/09FbkYd+oYCkRQsT/BKlpGmOR6kMNvVXT8a5LcOh12Q6WHWBpCNQIq7QguCrztF8zKw6UgV8WmUPVn2v4OPRxfHubBwZUCZ4QsoKd5Y9m8BJGm/R3bSurxqviDUYQJCHYTogF6bsnf3Izgu74bStO4T1uTBDAr83uOCoVWDh4XGN59p78Y3Jw== X-Forefront-PRVS: 007814487B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(5001770100001)(97736004)(107886002)(5003940100001)(47776003)(101416001)(66066001)(48376002)(50466002)(77096005)(86362001)(3846002)(6116002)(19580405001)(19580395003)(189998001)(5660300001)(586003)(8676002)(33646002)(4001430100002)(42186005)(105586002)(229853001)(106356001)(81156014)(2906002)(81166006)(2950100002)(92566002)(50226002)(7846002)(50986999)(76176999)(68736007)(7736002)(305945005)(4326007)(36756003)(7099028); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR0401MB1714; H:penguito.sanjose.hgst.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: hgst.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0401MB1714; 23:+1LjJ/QYLTtw2T+7FfdWocQu8oET/PTwLFT1NUw?= =?us-ascii?Q?aOX/BghhTvBHusv9TkD2RFBRkADt+8rWqb3+jtaFq+G+wm2pz5xmiIYm4rvT?= =?us-ascii?Q?3aZ0vMcxAEE6bR6i312bAw3YgwUszS+ZyMwwFHJAhst8A7fyU0XGgMJA93xm?= =?us-ascii?Q?rGGGFp68cbh+j1UhKWxypg8OvkgJ5GTZw6kMzyuHUesW3jzhI+xOwrFVzFe3?= =?us-ascii?Q?Hc+tRnLj6l5rStBvRA96LIyJmGNYlpOoVYy1eegbBLcWWWq4W2p5l/DSneXK?= =?us-ascii?Q?dy88wLe+AMl3N1/1T1KTpTBNe141uCYKjTGAdnF302HQHeNQvJqiL1MHEJ9f?= =?us-ascii?Q?h0p2yGjzZ+9wrOQjSSMykp9oJVWEhvXXUJ6m9aHFW/yQWJhJ92P1nWG4QcLr?= =?us-ascii?Q?mgnpeWb/mwboJdRjHV2Eh5PJ3G6jyGyEOzrslpzs0Kmlsyw3QHQoZV/5ZwCh?= =?us-ascii?Q?dJ5HqKvOgUwgN9LfDkGbziFo7xYvaVtwoOJKUsE55hkfW6PXwo3cXoS7QLHE?= =?us-ascii?Q?84gLwL0pIthG1XnJnmMXUTSFHQOUQWXMNxnKbimFEFMxWoCZBxoI4NzwaR7u?= =?us-ascii?Q?Jp9h5r1EE/w4qu1ZE/30NXAugHEZHRD00Z3b9CmOontx5ZQGMviLaF0XR7ti?= =?us-ascii?Q?j56LB3CD9Xggyx1qnRuMiWVjIqMgROhcoMwxYOzE5BtNP6RCNfXh40raZGr7?= =?us-ascii?Q?pca3dN5JltkbklTjDzos+U+JQlBk/orntFHlDgDZxdq5iRm3WA0TFBHVuMH1?= =?us-ascii?Q?XNTjFfUCEkWlA9qIx8Lig7i2jaF1sqe2jXFnixNBYKffioGURDlvphK2qTnW?= =?us-ascii?Q?lsbiqKiP01HbKtmtiqU8wmqL6IL4JTLuDk8WCfy2s80otnmbvqbplujhmZLt?= =?us-ascii?Q?8mMlRYkfC7s6GpC8iXbH32VyCp2UcLYHpAXe/USveZtl2d3Gnr4cwZW065gK?= =?us-ascii?Q?4oteaBif51N1hmlxDfQd+qXse9tv8BeunVx4AreFna0UYd1DRJa0t/vE8z3c?= =?us-ascii?Q?bZjR7Q3higUH8nyxLNZYGUY6MTZ+NtZ4QFG3CoJztWRqdTEuj0U0kAJaWF7t?= =?us-ascii?Q?oDA51xMYNUelyDV4iujxPQyCyV9k7knUiwoHxGcmNHasDtFg+H4/NKw8+KRQ?= =?us-ascii?Q?J9Vy+/68VehE=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0401MB1714; 6:GMX9n6KyXFAHD/68Ee+Bfqyp8kQO9lA43+adXxqac0dekZgwSLR2X1PWdtnGw7ffhF6DR5dMZ5cEs4aFBROOAHt8HArymcn5c9zFOCIayDNjj4utTetmJDkFt8HWVCiSGXWhHDem+m+t150wAT/wD17+A83zoQIjdMk4hIEAZSWn2s5IhmYf/0DQODcz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O8hUhPuP4HCrz X-OriginatorOrg: hgst.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2016 18:15:17.5393 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0401MB1714 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch checks to see if an ATA device supports NCQ command priorities. If so and the user has specified an iocontext that indicates IO_PRIO_CLASS_RT then we build a tf with a high priority command. Signed-off-by: Adam Manzanares --- drivers/ata/libata-core.c | 35 ++++++++++++++++++++++++++++++++++- drivers/ata/libata-scsi.c | 6 +++++- drivers/ata/libata.h | 2 +- include/linux/ata.h | 6 ++++++ include/linux/libata.h | 19 +++++++++++++++++++ 5 files changed, 65 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 223a770..181b530 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -739,6 +739,7 @@ u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev) * @n_block: Number of blocks * @tf_flags: RW/FUA etc... * @tag: tag + * @class: IO priority class * * LOCKING: * None. @@ -753,7 +754,7 @@ u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev) */ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, u64 block, u32 n_block, unsigned int tf_flags, - unsigned int tag) + unsigned int tag, int class) { tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; tf->flags |= tf_flags; @@ -785,6 +786,12 @@ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, tf->device = ATA_LBA; if (tf->flags & ATA_TFLAG_FUA) tf->device |= 1 << 7; + + if (ata_ncq_prio_enabled(dev)) { + if (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; @@ -2156,6 +2163,30 @@ static void ata_dev_config_ncq_non_data(struct ata_device *dev) } } +static void ata_dev_config_ncq_prio(struct ata_device *dev) +{ + struct ata_port *ap = dev->link->ap; + unsigned int err_mask; + + err_mask = ata_read_log_page(dev, + ATA_LOG_SATA_ID_DEV_DATA, + ATA_LOG_SATA_SETTINGS, + ap->sector_buf, + 1); + if (err_mask) { + ata_dev_dbg(dev, + "failed to get Identify Device data, Emask 0x%x\n", + err_mask); + return; + } + + if (ap->sector_buf[ATA_LOG_NCQ_PRIO_OFFSET] & BIT(3)) + dev->flags |= ATA_DFLAG_NCQ_PRIO; + else + ata_dev_dbg(dev, "SATA page does not support priority\n"); + +} + static int ata_dev_config_ncq(struct ata_device *dev, char *desc, size_t desc_sz) { @@ -2205,6 +2236,8 @@ static int ata_dev_config_ncq(struct ata_device *dev, ata_dev_config_ncq_send_recv(dev); if (ata_id_has_ncq_non_data(dev->id)) ata_dev_config_ncq_non_data(dev); + if (ata_id_has_ncq_prio(dev->id)) + ata_dev_config_ncq_prio(dev); } return 0; diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index e207b33..18629e8 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -50,6 +50,7 @@ #include #include #include +#include #include "libata.h" #include "libata-transport.h" @@ -1757,6 +1758,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) { struct scsi_cmnd *scmd = qc->scsicmd; const u8 *cdb = scmd->cmnd; + struct request *rq = scmd->request; + int class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq)); unsigned int tf_flags = 0; u64 block; u32 n_block; @@ -1823,7 +1826,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) qc->nbytes = n_block * scmd->device->sector_size; rc = ata_build_rw_tf(&qc->tf, qc->dev, block, n_block, tf_flags, - qc->tag); + qc->tag, class); + if (likely(rc == 0)) return 0; diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 3b301a4..8f3a559 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h @@ -66,7 +66,7 @@ extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag); extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, u64 block, u32 n_block, unsigned int tf_flags, - unsigned int tag); + unsigned int tag, int class); extern u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev); extern unsigned ata_exec_internal(struct ata_device *dev, diff --git a/include/linux/ata.h b/include/linux/ata.h index adbc812..ebe4c3b 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -347,6 +347,7 @@ enum { ATA_LOG_DEVSLP_DETO = 0x01, ATA_LOG_DEVSLP_VALID = 0x07, ATA_LOG_DEVSLP_VALID_MASK = 0x80, + ATA_LOG_NCQ_PRIO_OFFSET = 0x09, /* NCQ send and receive log */ ATA_LOG_NCQ_SEND_RECV_SUBCMDS_OFFSET = 0x00, @@ -897,6 +898,11 @@ static inline bool ata_id_has_ncq_non_data(const u16 *id) return id[ATA_ID_SATA_CAPABILITY_2] & BIT(5); } +static inline bool ata_id_has_ncq_prio(const u16 *id) +{ + return id[ATA_ID_SATA_CAPABILITY] & BIT(12); +} + static inline bool ata_id_has_trim(const u16 *id) { if (ata_id_major_version(id) >= 7 && diff --git a/include/linux/libata.h b/include/linux/libata.h index e37d4f9..a3c66852 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -165,6 +165,7 @@ enum { ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */ ATA_DFLAG_NCQ_SEND_RECV = (1 << 19), /* device supports NCQ SEND and RECV */ + ATA_DFLAG_NCQ_PRIO = (1 << 20), /* device supports NCQ priority */ ATA_DFLAG_INIT_MASK = (1 << 24) - 1, ATA_DFLAG_DETACH = (1 << 24), @@ -341,7 +342,9 @@ enum { ATA_SHIFT_PIO = 0, ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_NR_PIO_MODES, ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_NR_MWDMA_MODES, + ATA_SHIFT_PRIO = 6, + ATA_PRIO_HIGH = 2, /* size of buffer to pad xfers ending on unaligned boundaries */ ATA_DMA_PAD_SZ = 4, @@ -1609,6 +1612,22 @@ static inline int ata_ncq_enabled(struct ata_device *dev) ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; } +/** + * ata_ncq_prio_enabled - Test whether NCQ prio is enabled + * @dev: ATA device to test for + * + * LOCKING: + * spin_lock_irqsave(host lock) + * + * RETURNS: + * 1 if NCQ prio is enabled for @dev, 0 otherwise. + */ +static inline int ata_ncq_prio_enabled(struct ata_device *dev) +{ + return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF | + ATA_DFLAG_NCQ_PRIO)) == ATA_DFLAG_NCQ_PRIO; +} + static inline bool ata_fpdma_dsm_supported(struct ata_device *dev) { return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) &&