Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1193797ybx; Fri, 1 Nov 2019 18:21:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0WfB279PcrkFI0U6ZDIFhpZNbir6kk6i1nmM+nA2OfSnbRGaS+p/MpOb2EwL2NoPsJsyZ X-Received: by 2002:a17:906:1b41:: with SMTP id p1mr7485387ejg.65.1572657704646; Fri, 01 Nov 2019 18:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572657704; cv=none; d=google.com; s=arc-20160816; b=c29Bp2a/Kg/p2KE7GTiKX7m58nVWj2JzTGsTqyBZcjAJmvHe+yRzaBnJE3neSci2h9 AGnO0mxOA+ofzgc7oQudiPc5pKicC5AKc9+Yeul9WoZwAktKu/tPkG1sp0e3lxA/110J lmKsPXcychqUBoZEeU6Vl0bQ0dmIv2EATA3TqKrNlAKeTqYpcQI1oiiCX1hntpqDQPSN 7AP6C/Sv/6RQKGl4N7jDAVSMzwcy8iJEgz7mN7ktRVRgG08yB6PUVmrDW2dBXXHIKWAS Y4dYl7fYmRDKYkKAhJ9AikiP9au1oQVNOn9Cx6qIi5Z8+TC5ofTYzkW4rkYhcXBswxKA drew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter; bh=wAKrp5w10+/4BSl+GBrgOGnlyuo0lkvR3BF8AELtjE8=; b=VKECa82uufUgc0uf4+qVcALZiu1ePc1UO/j141Wju6f+yiil5N064uUPgEhBhiVSPC Q8XRPW79gC/NPpAqe7vFWDaJTJ1E3MLNTOWZovqQ4M+XitmkDokJiQIRs6Xj1Da/UXK7 jPboqyvFgEG20z2JHjof1P/I205a3QD764zU9RTStaLC4KiYUUdL/l42KFNrUVicnpzp p942zZJdYKfKjYkZsIWRhL3hQn5Ppp6NMQs9gb5gxFS+uaO5q4k13pFMaTy+NHTtWarc SBWO0QLavnn+o4RTK1Zy4blu/RcjBp7QtPnUxtxbseQnyA9S1tWGDoFELK1oqfH5wMCD Y0bQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=qti.qualcomm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si6664589ejw.206.2019.11.01.18.21.20; Fri, 01 Nov 2019 18:21:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=qti.qualcomm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728279AbfKBBUo (ORCPT + 99 others); Fri, 1 Nov 2019 21:20:44 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33314 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726892AbfKBBUn (ORCPT ); Fri, 1 Nov 2019 21:20:43 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 22898615C4; Sat, 2 Nov 2019 01:20:43 +0000 (UTC) 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.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_PASS autolearn=unavailable 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 EC9FA61587; Sat, 2 Nov 2019 01:20:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EC9FA61587 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=pass (p=none dis=none) header.from=qti.qualcomm.com Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=cang@qti.qualcomm.com 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 v3 1/5] scsi: Adjust DBD setting in mode sense for caching mode page per LLD Date: Fri, 1 Nov 2019 18:20:26 -0700 Message-Id: <1572657631-25749-2-git-send-email-cang@qti.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572657631-25749-1-git-send-email-cang@qti.qualcomm.com> References: <1572657631-25749-1-git-send-email-cang@qti.qualcomm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Can Guo Host sends MODE_SENSE_10 with caching mode page, to check if the device supports the cache feature. UFS JEDEC standards require DBD field to be set to 1. This patch allows LLD to define the setting of DBD if required. Signed-off-by: Can Guo --- drivers/scsi/sd.c | 2 +- include/scsi/scsi_host.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index aab4ed8..a9cca2f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2660,7 +2660,7 @@ static int sd_try_rc16_first(struct scsi_device *sdp) dbd = 8; } else { modepage = 8; - dbd = 0; + dbd = sdp->host->set_dbd_for_caching ? 8 : 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]; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project