From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB640C433E0 for ; Thu, 13 Aug 2020 01:27:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A3C5220675 for ; Thu, 13 Aug 2020 01:27:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u7s1nTcF"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="xzxPv8Nh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A3C5220675 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OdnDhjmVX7VICfz0Ib+2p3zYnyGo3sPUofNH0D25CV4=; b=u7s1nTcFB/kKD4MVL+zgIGLpZ wPJrTHqyAeXzwpv4b6S1rU/gXd4ZD4FHHXny09u+MllkuIO0RS0ekNIDYM0RGQp5gPiMFWTeGN4ZB W1l+LtYCvcUvHp/xYQJwr+UrG0WHFncq0NHCzTSRwFVYfnYetrKn9JQhhOD2LKw2Kv04YCVGclgex T1y6vrvgc91c7zNZ59mWlyfZPxTvgcgKtHFFwQsk5oELiw81V83oiB8AKUpR79Bqd2WF7JeZCYFmh Lp6jMJWpWMOqwK1l8l+WQ8dMKXb4U+2zUHITVl+Vc1dl+3+6gDpCW9NoMBX1nSE6BH0PSg4cBriT4 GJfUBbXGw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k620C-0005kH-Om; Thu, 13 Aug 2020 01:25:56 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k620A-0005jL-1M for linux-arm-kernel@lists.infradead.org; Thu, 13 Aug 2020 01:25:55 +0000 Received: from gmail.com (unknown [104.132.1.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6056A205CB; Thu, 13 Aug 2020 01:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597281950; bh=qIzZXfltMZ2c8wweV3aCSivjOgKWA6wcnMyMvK5rvOs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xzxPv8NhPd3bdEBw0WOvPDRCmOSCtSWI/RjMbtBdB9WqYX1VHf7qKA+3I7/8/HKp/ E/Hfu5DlQH6KVIGGgAyIu5w6dq8GfBfYYh9dcLMoxRSZ5e/p0776Ji/dZ0foJKbhfg R0nX1GNIG3+sILDhplnkvtvcE1+Ox6ynJPuJZEWM= Date: Wed, 12 Aug 2020 18:25:48 -0700 From: Eric Biggers To: Alim Akhtar Subject: Re: [RESEND PATCH v10 04/10] scsi: ufs: introduce UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk Message-ID: <20200813012548.GA1782889@gmail.com> References: <20200613024706.27975-1-alim.akhtar@samsung.com> <20200613024706.27975-5-alim.akhtar@samsung.com> <20200812002920.GA1352011@gmail.com> <000401d67110$0be2d9c0$23a88d40$@samsung.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <000401d67110$0be2d9c0$23a88d40$@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200812_212554_275705_B3CF9E70 X-CRM114-Status: GOOD ( 25.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robh@kernel.org, linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, martin.petersen@oracle.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, krzk@kernel.org, kwmad.kim@samsung.com, kishon@ti.com, avri.altman@wdc.com, cang@codeaurora.org, stanley.chu@mediatek.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 13, 2020 at 06:51:13AM +0530, Alim Akhtar wrote: > Hi Eric, > > > -----Original Message----- > > From: Eric Biggers > > Sent: 12 August 2020 05:59 > > To: Alim Akhtar > > Cc: robh@kernel.org; devicetree@vger.kernel.org; > linux-scsi@vger.kernel.org; > > krzk@kernel.org; avri.altman@wdc.com; martin.petersen@oracle.com; > > kwmad.kim@samsung.com; stanley.chu@mediatek.com; > > cang@codeaurora.org; linux-samsung-soc@vger.kernel.org; linux-arm- > > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; kishon@ti.com > > Subject: Re: [RESEND PATCH v10 04/10] scsi: ufs: introduce > > UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk > > > > Hi Alim, > > > > On Sat, Jun 13, 2020 at 08:17:00AM +0530, Alim Akhtar wrote: > > > Some UFS host controllers like Exynos uses granularities of PRDT > > > length and offset as bytes, whereas others uses actual segment count. > > > > > > Reviewed-by: Avri Altman > > > Signed-off-by: Kiwoong Kim > > > Signed-off-by: Alim Akhtar > > > --- > > > drivers/scsi/ufs/ufshcd.c | 30 +++++++++++++++++++++++------- > > > drivers/scsi/ufs/ufshcd.h | 6 ++++++ > > > 2 files changed, 29 insertions(+), 7 deletions(-) > > > > > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > > > index ee30ed6cc805..ba093d0d0942 100644 > > > --- a/drivers/scsi/ufs/ufshcd.c > > > +++ b/drivers/scsi/ufs/ufshcd.c > > > @@ -2151,8 +2151,14 @@ static int ufshcd_map_sg(struct ufs_hba *hba, > > struct ufshcd_lrb *lrbp) > > > return sg_segments; > > > > > > if (sg_segments) { > > > - lrbp->utr_descriptor_ptr->prd_table_length = > > > - cpu_to_le16((u16)sg_segments); > > > + > > > + if (hba->quirks & UFSHCD_QUIRK_PRDT_BYTE_GRAN) > > > + lrbp->utr_descriptor_ptr->prd_table_length = > > > + cpu_to_le16((sg_segments * > > > + sizeof(struct ufshcd_sg_entry))); > > > + else > > > + lrbp->utr_descriptor_ptr->prd_table_length = > > > + cpu_to_le16((u16) (sg_segments)); > > > > > > prd_table = (struct ufshcd_sg_entry *)lrbp->ucd_prdt_ptr; > > > > > > @@ -3500,11 +3506,21 @@ static void > > ufshcd_host_memory_configure(struct ufs_hba *hba) > > > > > cpu_to_le32(upper_32_bits(cmd_desc_element_addr)); > > > > > > /* Response upiu and prdt offset should be in double words > */ > > > - utrdlp[i].response_upiu_offset = > > > - cpu_to_le16(response_offset >> 2); > > > - utrdlp[i].prd_table_offset = cpu_to_le16(prdt_offset >> 2); > > > - utrdlp[i].response_upiu_length = > > > - cpu_to_le16(ALIGNED_UPIU_SIZE >> 2); > > > + if (hba->quirks & UFSHCD_QUIRK_PRDT_BYTE_GRAN) { > > > + utrdlp[i].response_upiu_offset = > > > + cpu_to_le16(response_offset); > > > + utrdlp[i].prd_table_offset = > > > + cpu_to_le16(prdt_offset); > > > + utrdlp[i].response_upiu_length = > > > + cpu_to_le16(ALIGNED_UPIU_SIZE); > > > + } else { > > > + utrdlp[i].response_upiu_offset = > > > + cpu_to_le16(response_offset >> 2); > > > + utrdlp[i].prd_table_offset = > > > + cpu_to_le16(prdt_offset >> 2); > > > + utrdlp[i].response_upiu_length = > > > + cpu_to_le16(ALIGNED_UPIU_SIZE >> 2); > > > + } > > > > > > ufshcd_init_lrb(hba, &hba->lrb[i], i); > > > } > > > > Isn't this patch missing an update to ufshcd_print_trs()? It uses > > ->prd_table_length as the number of segments, not the number of bytes. > > > prd_table_length will be populated before it reaches ufshcd_print_trs() > based on UFSHCD_QUIRK_PRDT_BYTE_GRAN. > Yes, which is why it seems ufshcd_print_trs() needs to be updated to take UFSHCD_QUIRK_PRDT_BYTE_GRAN into account. - Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel