Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932651AbcLMAqq (ORCPT ); Mon, 12 Dec 2016 19:46:46 -0500 Received: from mail-bl2nam02on0048.outbound.protection.outlook.com ([104.47.38.48]:43557 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753284AbcLMAqm (ORCPT ); Mon, 12 Dec 2016 19:46:42 -0500 X-Greylist: delayed 890 seconds by postgrey-1.27 at vger.kernel.org; Mon, 12 Dec 2016 19:46:41 EST Authentication-Results: spf=fail (sender IP is 63.163.107.21) smtp.mailfrom=wdc.com; broadcom.com; dkim=none (message not signed) header.d=none;broadcom.com; dmarc=none action=none header.from=hgst.com; X-IncomingTopHeaderMarker: OriginalChecksum:;UpperCasedChecksum:;SizeAsReceived:2875;Count:16 X-AuditID: 0ac94369-9793798000000b53-d4-584f3f204597 From: Adam Manzanares To: , , , , , CC: , , "Adam Manzanares" Subject: [PATCH v2] mpt3sas: Recognize and act on iopriority info Date: Mon, 12 Dec 2016 16:31:40 -0800 Message-ID: <1481589100-3342-1-git-send-email-adam.manzanares@hgst.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRmVeSWpSXmKPExsXCddJ5ka6ivX+EwbfZ/Ba3j+5gsXj7djOT xaqJeRaXd81hs+i+voPNYvnxf0wWc183MFlsmHeLxeLZmRgHTo9Z98+yeTw4tJnF4+PTWywe l862s3h83iQXwBrFZZOSmpNZllqkb5fAlXFr6RSmgm7tiuV9R9kaGJtUuhg5OSQETCS2LJjF 3sXIxSEksJRJYvPJVjYIZwejxOYNTxm7GDnAqm4/jYOIb2SUWLZhLjtInE3AQGL65USQuIjA aUaJC83dbCBxZoFciZazRiALhAUcJbYdmcoOYrMIqEr8er6WFcTmFXCX2PeiiR3iCDmJm+c6 mUHmSAh0sUqcmz6JGaJIUOLkzCcsIDazgITEwRcvmEHmCwENOn5ecAKjwCwkVbOQVC1gZFrF KJabmVOcm55aYGiqV5yYl5JZnK2XnJ+7iRES3pk7GO8+8T7EKMDBqMTDu2O9X4QQa2JZcWXu IUYJDmYlEV59O/8IId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rxu976ECQmkJ5akZqemFqQWwWSZ ODilGhjPe9bwBNXOmX8/v1z218Gu8HYxC9NNsYuu/nxx/p52JFekwr0ujTP8etH/OUu2fIk4 JryztzlkGcfReWxvembZPuQViE8tVHl5vvza1j7l/IfHcjOaUv8Y9TiXF1tNm2fBdnoXc9YF /jVSht2pNWWnhLYETf4sMv/9nrPJueorWowdrXbEOiixFGckGmoxFxUnAgD/tddTawIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPJMWRmVeSWpSXmKPExsXCtZEjRbfA0T/C4N9PWYsDK24yWbx9u5nJ YtXEPIvLu+awWXRf38Fmsfz4PyaLua8bmCw2zLvFYvHsTIwDp8es+2fZPB4c2szi8fHpLRaP z5vkPNoPdDMFsEZx2aSk5mSWpRbp2yVwZdxaOoWpoFu7YnnfUbYGxiaVLkYODgkBE4nbT+O6 GLk4hATWM0p8PrSABSTOJmAgMf1yIkhcROAoo8SVK3vZuxg5OZgFsiUeHvzOCmILCzhKbDsy FSzOIqAq8ev5WrA4r4C7xIuvixhBbAkBOYmb5zqZJzByLmBkWMUolpuZU5ybnllgaKhXnJiX klmcrZecn7uJERwEnJE7GJ9OND/EyMTBKdXA6HOTSfDhKgGbvN6gCax+OqeEPKSmTdoe3/+u +XJQnO+7Hc5tEsXREpdSpuXn86pLztJYLKY+98GkadkGnAvOt8/Z5H2k/5n5MY5J0momlud+ uEXwrc6fHBG3xXVz2gvxxEfBgZe43IRfcd3vu9SksEerxuCZvcHcN78EI89ssus45S7xRX62 EktxRqKhFnNRcSIA9OjuOLIBAAA= MIME-Version: 1.0 Content-Type: text/plain X-IncomingHeaderCount: 16 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(7916002)(39850400002)(39860400002)(39450400003)(39840400002)(39410400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(2906002)(189998001)(42882006)(48376002)(5660300001)(38730400001)(77096006)(50466002)(356003)(97736004)(305945005)(8936002)(5001770100001)(50226002)(960300001)(81156014)(68736007)(69596002)(47776003)(33646002)(50986999)(81166006)(85426001)(4326007)(626004)(8676002)(92566002)(6666003)(36756003)(2201001)(105606002)(106466001)(2270400002)(5003940100001)(32563001)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0201MB1513;H:milsmgep15.sandisk.com;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD022;1:0qBaVYBln5PlFFg/qVgZ9OelcoWvXIQTxLAVV1vg5OEyym0I3Cjj5byiuCzDAVzcXRD8qC7idzcOeF9jL4y4KgSLvw6hKPt/IW2BRoWhfch21d1jlqx6fKnz4jtjLgH2m1EJC5SvMuKgwEJ0jx4gICbKmNEVSz/n8sSLWp9PEkBku4LOGgkg1xKEHnTTibyafdIPNh1HnxTqJKvzdRK1QOp1t/FabfJriu7NOoBWagsVZtCVQEDpk/0wRgz0nsvNWkHiBvCsEjCnV1QCE+uzewziWCfQziyQPVjWsSgVR+/5gzjyOWI8DqlNHLMgmH08FE9OjOqRFFXHJRbSu8mPMpMC3y7nGnSyTsoobZkg6OgV2u2ycDCVYC3jtxdQeQx3DhKZPoJOELjigi1yK99fXWQ9wSlldyg7BA2NDsSC8VCnjuQYu+Tz7YmJAaoJdoFtnrQns6go/qky5jFEl9uMwBPdjHdVwvk1PMDy04uOBzQoI4/p8hpB9XUAL6pb5LpwEinecJf8CVabJqDbDTDWk/CQm3SMdHwhRmEnEPZBJPg= X-MS-Office365-Filtering-Correlation-Id: 2511edda-ff93-49d9-7988-08d422ef6c3a X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR0201MB1513; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0201MB1513;3:SNZhXBeWST14Q2X5rfvBLzb3hlGKhX8bSBCRTRIHKSZD3d/Sx61cOwpCo9jCoK+IXHxU5TcU6EKmRVFbki9DDSSVejCQ0HxrCLiDo3keptCwIdf+FLmqXUg2wN7JjJaPqPnqyo4uEfwD0ngOoAyLfqESzVD6JBZ7aus7GXSLag4la0+6GPa8alIH8n3jmE+Ixo30BJLf80Uc6V9RvKiRyaSH6SRS2pkJZKHNfMTj6HugqrKBGPtkYsam1TX7v4EyAH5QLluVl3UKynO9vXaxH+0RCT3l/AkLeEAf8XDAIFczH1gRPi6LfHBYk35vY5/qRkeKH47jRluxSI0iF1BgJGTotdAcH50oXA7ZnCoI0Un0uqd9tQgROq6H+n0KN2nh X-Microsoft-Exchange-Diagnostics: 1;CY1PR0201MB1513;25:IRQzJUeQsmo8JNeNjMeXo7xPKZJZymuN5Brwl1S/7D8kkIn5lvsiSaBvOB9xGypgCqf460sL5XkS+LHGbkVMug+ejoxribINLKzf5u29+QeohYe9EQR6lo3Et2UBIhoeuMYPKmIkWt4OV5rJ+Fo22tBgAmJTnjqHBdCCKcajiSz3ZmNB3NDOICRp7FrR8WKERJ8DpMDcifvKSwDs9tEi3z3aQxVybMwusAM2EKsJb4AF5phxYHuVzuYlhyHkIoBHw08afRT/ooXDZ0h+zND0Jkmz5xlop8BTkYgRux2DyNbNtV2R4ad8LBnEw5J2+vNHIYDpSthEghEviAP8zaahl47Ke5fNnDhZ5jA4ROCX0985+9hlfag82BS8Bfrtjr/KcWHx18WlC2hxJz6wmPKHqfuZCOzdZFWaka76lBvSYpNtQuyQ5jUEQ4YleOuCBMMpYp6+yr9qOVg/l+rnfoXPrisAaovwCxbQy7Qly3TGV0vgoYviMbmNR4AoFWt4/3/3jaqrCAuoePINb0d0nswLS2HNJIZHtgQYJG6EP8Cu4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j4Dk3Dm6ZO+MCdjXQalsK2650FvhUG+tFE9cS6hmyJ43NMJnD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(13016025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(6072148);SRVR:CY1PR0201MB1513;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0201MB1513; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0201MB1513;4:A5uf2Tg3o8cLCYXdF4Al/vrJJ5j7Rl/MG+HGC8i23aNiL/251BHEwSE/ZekAxoSIp82dr0ExYAdq6tuTqHQXPNNxJvxRUMAjwilGIYj+iknU5iHFlti2DF+YG+eEomS+ttPVG9F9kKaDDjdh0MQDo12nPk1ExutvgdC4XISRk/Idu5lQQun5dXWOalmbglQVvnxFLuUDwUjHktAvPEJ7b5sjlCr0Nxe7y2BMPdZTTTgNZvSebIh+u09guWLzrK+dPckcDuMPQ2KXgZ5fEMlC/15f297TCmSyKicnwOGhHYZiRW68S882CFlZN4Y9yd1S0u8ymhvL8SQ1HE+BAQSjc0AXBG21KcOJ0f8eh5Ovh9Z+8jb9mlowCyMPVCDUMZ4xuBd8Vagw+WTEh9FVDR3zKs0I9ecpLgHLqoGSzzeh0mPaKo68fpHccCLctodWULsTjLKbcl9hedC/gwDPeUi5a8k8P8IfkENa3+ynt/16mhneX5tK7qQ+RlddqsG2fV1QznWJBKECJeIewLPo+5L0fQT8D+oQcbPpm5rBjG/MV49k2wFn580LABA13MtEFi8H2plS+d6+p3mjp7QXXIKTxFddvsD0nxJD/zy1XmZnpJ0lvBKVdaAzrN4jYIg7DWkD X-Forefront-PRVS: 01559F388D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0201MB1513;23:i+EvI/q6hdsI24mJAGWsVxbm2WBkKMCWZ5V6phE?= =?us-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CClukt+5rmWR0BmFZVlOW0bVwqHgVzWQgAynW4YdQH7nih71vrQM4yLDzCrWgWkLKCj5dUQWvXYD0W/v4/U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR0201MB1513;7:lZS3v9JQSCjQ7OahscAplXD8JYtrwSPbjYLfJhAxE0pY+aGQZA/v6Uvw+mckN871xyMQRWIRFwoLMVyhm+yjlQEFZXwFZvbPKOw1X5ZseM6yikY2u9jSdNZhZw9yE2II2X8tbMz4V73sbQX6JYdbqauZqpjHzJUGsLBeSkJk/6lBpO6Dl2O9MKzCKw2/MBeaAG/1Nf0rvaAbbLunBXHyk6JcTJryMztpV9b9mLnNdTkSJ6AjbAvKvGVirksppnYM87r24CpUQyn4OIekDHQajFoTxsJ/0+hxoP9CiES2c3CZ68h1B2xoLmRbh8mHohqou15Lo+Y04veoRn6LYWgV0aQr45dTwrI1ssVmVX68u+jonPtxun4VzwPNdP8L89MWPjWEij9HxU52XQW/yDNA6kFacxRzS4fbu2PW7dXiVElMObqSNA6NjxpWkEKuG6qoWJHgBGOlah6Mqu1idsdSFg==;20:ZIf5acxmbl7XZTHWxIAMLcaFm+djcfdqHettdCUbk2PY4tM9whNj419zJRt+ivkWwc2y56kGENcdvjsdcu7AKYcqwz7pSKpag1X3plAn3v+42GEhzakKUbNtSLTGADQgY7U/pD9UX7ta3orldrxzWCEo7bPlb7HscAL9IKQu5DROMvVDpk1KT1tNN4QwOFC0zI6nmR4EJYkzT4/+PQG7SvZU3etrtOoucV7zcTzOq4XhCqoAhys4Js/4/WHMu6my X-OriginatorOrg: sandiskcorp.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2016 00:31:47.3602 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d;Ip=[63.163.107.21];Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0201MB1513 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5346 Lines: 167 From: Adam Manzanares This patch adds support for request iopriority handling in the mpt3sas layer. This works only when a ATA device is behind the SATL. The ATA device also has to indicate that it supports command priorities in the identify information that is pulled from the SATL. This patch depends on block: Add iocontext priority to request v2: - Get iopriority class only if sysfs variable is set. Signed-off-by: Adam Manzanares --- drivers/scsi/mpt3sas/mpt3sas_base.h | 6 +++++ drivers/scsi/mpt3sas/mpt3sas_ctl.c | 43 ++++++++++++++++++++++++++++++++++-- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 34 +++++++++++++++++++++++++++- 3 files changed, 80 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 3e71bc1..354cdc7 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -402,6 +402,9 @@ struct MPT3SAS_DEVICE { u8 block; u8 tlr_snoop_check; u8 ignore_delay_remove; + /* Iopriority Command Handling */ + u8 ncq_prio_enable; + }; #define MPT3_CMD_NOT_USED 0x8000 /* free */ @@ -1449,4 +1452,7 @@ mpt3sas_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request, u16 smid); +/* NCQ Prio Handling Check */ +bool scsih_ncq_prio_supp(struct scsi_device *sdev); + #endif /* MPT3SAS_BASE_H_INCLUDED */ diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c index 26cdc12..3ad8339 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c @@ -3290,8 +3290,6 @@ static DEVICE_ATTR(diag_trigger_mpi, S_IRUGO | S_IWUSR, /*********** diagnostic trigger suppport *** END ****************************/ - - /*****************************************/ struct device_attribute *mpt3sas_host_attrs[] = { @@ -3367,9 +3365,50 @@ _ctl_device_handle_show(struct device *dev, struct device_attribute *attr, } static DEVICE_ATTR(sas_device_handle, S_IRUGO, _ctl_device_handle_show, NULL); +/** + * _ctl_device_ncq_io_prio_show - send prioritized io commands to device + * @dev - pointer to embedded device + * @buf - the buffer returned + * + * A sysfs 'read/write' sdev attribute, only works with SATA + */ +static ssize_t +_ctl_device_ncq_prio_enable_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct scsi_device *sdev = to_scsi_device(dev); + struct MPT3SAS_DEVICE *sas_device_priv_data = sdev->hostdata; + + return snprintf(buf, PAGE_SIZE, "%d\n", + sas_device_priv_data->ncq_prio_enable); +} + +static ssize_t +_ctl_device_ncq_prio_enable_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct scsi_device *sdev = to_scsi_device(dev); + struct MPT3SAS_DEVICE *sas_device_priv_data = sdev->hostdata; + bool ncq_prio_enable = 0; + + if (kstrtobool(buf, &ncq_prio_enable)) + return -EINVAL; + + if (!scsih_ncq_prio_supp(sdev)) + return -EINVAL; + + sas_device_priv_data->ncq_prio_enable = ncq_prio_enable; + return strlen(buf); +} +static DEVICE_ATTR(sas_ncq_prio_enable, S_IRUGO | S_IWUSR, + _ctl_device_ncq_prio_enable_show, + _ctl_device_ncq_prio_enable_store); + struct device_attribute *mpt3sas_dev_attrs[] = { &dev_attr_sas_address, &dev_attr_sas_device_handle, + &dev_attr_sas_ncq_prio_enable, NULL, }; diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 209a969..a6d1045 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -4030,6 +4030,8 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) struct MPT3SAS_DEVICE *sas_device_priv_data; struct MPT3SAS_TARGET *sas_target_priv_data; struct _raid_device *raid_device; + struct request *rq = scmd->request; + int class; Mpi2SCSIIORequest_t *mpi_request; u32 mpi_control; u16 smid; @@ -4085,7 +4087,12 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) /* set tags */ mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ; - + /* NCQ Prio supported, make sure control indicated high priority */ + if (sas_device_priv_data->ncq_prio_enable) { + class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq)); + if (class == IOPRIO_CLASS_RT) + mpi_control |= 1 << MPI2_SCSIIO_CONTROL_CMDPRI_SHIFT; + } /* Make sure Device is not raid volume. * We do not expose raid functionality to upper layer for warpdrive. */ @@ -9031,6 +9038,31 @@ scsih_pci_mmio_enabled(struct pci_dev *pdev) return PCI_ERS_RESULT_RECOVERED; } +/** + * scsih__ncq_prio_supp - Check for NCQ command priority support + * @sdev: scsi device struct + * + * This is called when a user indicates they would like to enable + * ncq command priorities. This works only on SATA devices. + */ +bool scsih_ncq_prio_supp(struct scsi_device *sdev) +{ + unsigned char *buf; + bool ncq_prio_supp = false; + + if (!scsi_device_supports_vpd(sdev)) + return ncq_prio_supp; + + buf = kmalloc(SCSI_VPD_PG_LEN, GFP_KERNEL); + if (!buf) + return ncq_prio_supp; + + if (!scsi_get_vpd_page(sdev, 0x89, buf, SCSI_VPD_PG_LEN)) + ncq_prio_supp = (buf[213] >> 4) & 1; + + kfree(buf); + return ncq_prio_supp; +} /* * The pci device ids are defined in mpi/mpi2_cnfg.h. */ -- 2.7.4