From patchwork Mon Oct 28 03:50:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11214579 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E76E7112B for ; Mon, 28 Oct 2019 03:50:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C296520659 for ; Mon, 28 Oct 2019 03:50:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="DBF0dwhJ"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="DBF0dwhJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731185AbfJ1DuY (ORCPT ); Sun, 27 Oct 2019 23:50:24 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:44456 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729328AbfJ1DuY (ORCPT ); Sun, 27 Oct 2019 23:50:24 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 95D4860923; Mon, 28 Oct 2019 03:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572234623; bh=nYsj8+XlqvZXU8+YArrtKzF6E8RdJ5PaJUfkJ9li9Nc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DBF0dwhJW1mCqXixjsvO69nPsuKT6OB8rKfTQBYQSJfsw1kfKxN2+Nj2+Od29NMR4 MZoZCPkZBVyWXfmQtFyEnSG5pKDI+/UfdmN7R1+pnQSPxRSAwM65zfcrdtW/ZBfLd0 kqtdRF2TDYG+kpyrBmzxEijEEGYE7V1Xxl+SMOq8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cang@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C5BA060863; Mon, 28 Oct 2019 03:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572234623; bh=nYsj8+XlqvZXU8+YArrtKzF6E8RdJ5PaJUfkJ9li9Nc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DBF0dwhJW1mCqXixjsvO69nPsuKT6OB8rKfTQBYQSJfsw1kfKxN2+Nj2+Od29NMR4 MZoZCPkZBVyWXfmQtFyEnSG5pKDI+/UfdmN7R1+pnQSPxRSAwM65zfcrdtW/ZBfLd0 kqtdRF2TDYG+kpyrBmzxEijEEGYE7V1Xxl+SMOq8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C5BA060863 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cang@codeaurora.org From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 1/5] scsi: Adjust DBD setting in mode sense for caching mode page per LLD Date: Sun, 27 Oct 2019 20:50:03 -0700 Message-Id: <1572234608-32654-2-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572234608-32654-1-git-send-email-cang@codeaurora.org> References: <1572234608-32654-1-git-send-email-cang@codeaurora.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Host sends MODE_SENSE_10 with caching mode page, to check if the device supports the cache feature. Some LLD standards requires DBD field to be set to 1. This patch allows LLD to define the setting of DBD if required. Change-Id: I0c8752c1888654942d6d7e6e0f6dc197033ac326 Signed-off-by: Can Guo --- drivers/scsi/sd.c | 6 +++++- include/scsi/scsi_host.h | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index aab4ed8..6d8194f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2629,6 +2629,7 @@ static int sd_try_rc16_first(struct scsi_device *sdp) { int len = 0, res; struct scsi_device *sdp = sdkp->device; + struct Scsi_Host *host = sdp->host; int dbd; int modepage; @@ -2660,7 +2661,10 @@ static int sd_try_rc16_first(struct scsi_device *sdp) dbd = 8; } else { modepage = 8; - dbd = 0; + if (host->set_dbd_for_caching) + dbd = 8; + else + dbd = 0; } /* cautiously ask */ diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 2c3f0c5..3900987 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -650,6 +650,12 @@ struct Scsi_Host { unsigned no_scsi2_lun_in_cdb:1; /* + * Set "DBD" field in mode_sense caching mode page in case it is + * mandatory by LLD standard. + */ + unsigned set_dbd_for_caching:1; + + /* * Optional work queue to be utilized by the transport */ char work_q_name[20];