From patchwork Wed May 25 15:02:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petros Koutoupis X-Patchwork-Id: 9135671 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 1F77D607D7 for ; Wed, 25 May 2016 15:02:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12904282B3 for ; Wed, 25 May 2016 15:02:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07686282DC; Wed, 25 May 2016 15:02:51 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 CF150282B3 for ; Wed, 25 May 2016 15:02:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755661AbcEYPCn (ORCPT ); Wed, 25 May 2016 11:02:43 -0400 Received: from mout.perfora.net ([74.208.4.197]:61609 "EHLO mout.perfora.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755658AbcEYPCm convert rfc822-to-8bit (ORCPT ); Wed, 25 May 2016 11:02:42 -0400 Received: from [10.0.3.15] ([67.92.53.130]) by mrelay.perfora.net (mreueus001) with ESMTPSA (Nemesis) id 0MD7da-1bJot02QvM-00GYBZ; Wed, 25 May 2016 17:02:38 +0200 Message-ID: <1464188556.3020.4.camel@petroskoutoupis.com> Subject: sd: ZBC Update Read/Write Commands to SCSI spec From: Petros Koutoupis To: hare@suse.de, linux-scsi@vger.kernel.org Cc: petros@petroskoutoupis.com Date: Wed, 25 May 2016 10:02:36 -0500 X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 X-Provags-ID: V03:K0:3rrIgnW2vcD2Gl57pxCI8w4kp5TPCPUV24W1lMxzMZ+VIHtTPLy cl9BbtzsrYQ7hrY6KbsI/GCQvxHGsNSTFmwhwLoeVdV2XgAqikHeEubZQhidnrKmuplHNRn EGUf3gzQV/s6uPmZ85RIdUAeY5oI0a0V4T81L99bGjYC+I6XYIiGVe3z11uBzeLIyF0AOT8 2hbuYd/NXiVSraamDC66w== X-UI-Out-Filterresults: notjunk:1; V01:K0:ymnS+XLeGkY=:FzoOY4NYI65Z2hiZW6q+Qg CO4ydnGRKwtgS2BQopNQSvIHufqeyzt1GDEI7+WFiiakif65uS0Y6hck9KAVxcCuvl7lvYKjB Mppu/wvy/0ZAcLOOMRYCIQKY+//KF/KKhczy1Yu1LHlFBBZEtUe3WxmTt2Z0vKPe3uFKgl9fi +LJ0aRUv3aa0pei7MgFBv5WVWPOPh6uSwjgjp70SOLwHj/sQagwNsqBOJpvpQhBHBWDQ3k7jh LsGjAajFZOeTPa8kiJfjpLADEsUuIgbhM6+iwM+w1t6xtlyFWr0a14w9trOBScymxvF2eWrUt CioqQTIS3LKtuodMmvRId7YsCZz49USYweZblNxnXC2Ue3q4hMn5KTOAmgE3X8dBOgN6Kk5ht MTFyGez0zLd1PhajFPI5Hp8CzL+lYSlNGIMJkn8fVTgJYKDNmYPrzh4Yi87P6VTskfz8kmX6H 1dErIyj3fEIyXaH2Ah2bvSjpHvb8QmX7EDDli6B+Nb0xVpbw2B4BwHWSW+K4SWdvWiBb55wHZ LJhIlIgHa+df3ZyI2o0B2eUnraHnVyCkbkAklYx2cBpNM7Msre3G4mYtaQr8NBw2VRdMyVchJ tT5Ef1kv/rsw0My3LHjcZ/t5obcaL55PTWmmhZ+pghwVA3ZLA5a6l6PBzLsTV4zGoOcZWEJGP OS88BPfk6cxNH5t51F8QXLZT7njNwIiPeLYXG5+LKBdFpDJQJMB6QSP7IvVabGle7QISvPk3C gv/fRjazgLziozea Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is based on: git.kernel.org:/pub/scm/linux/kernel/git/hare/scsi-devel branch zbc.v6 According to the Zoned Block Commands (ZBC) Revision 5 SCSI specification, a Host Managed and Host Aware device is limited to support at a minimum the READ (16) and WRITE (16) read/write CDBs. This means that a drive manufacturer is not obligated to support anything else. We shouldn't assume that we can send other read/write commands and should instead limit sd to only the mandatory list highlighted in the specification. Note, I did not place the a check for zoned devices in the DIF-enabled conditional above, under the assumption that if the media supports Type-2 then it should also support the 32-byte commands. Thoughts? Signed-off-by: Petros Koutoupis --- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- scsi-devel/drivers/scsi/sd.c.orig 2016-05-12 23:21:04.314000000 -0500 +++ scsi-devel/drivers/scsi/sd.c 2016-05-25 08:55:21.715506056 -0500 @@ -1159,7 +1159,8 @@ static int sd_setup_read_write_cmnd(stru   SCpnt->cmnd[29] = (unsigned char) (this_count >> 16) & 0xff;   SCpnt->cmnd[30] = (unsigned char) (this_count >> 8) & 0xff;   SCpnt->cmnd[31] = (unsigned char) this_count & 0xff; - } else if (sdp->use_16_for_rw || (this_count > 0xffff)) { + } else if (sdp->use_16_for_rw || (this_count > 0xffff) || +    sdkp->zoned == 1 || sdp->type == TYPE_ZBC) {   SCpnt->cmnd[0] += READ_16 - READ_6;   SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0);   SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0;