Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp759749rwr; Thu, 4 May 2023 09:12:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ62VW1GAJ1eJx2dYaXgA5HTvKM7bVg1c9ayYLBq5mNS0mECPOqVjgqjLKHtjS9STC8UNh44 X-Received: by 2002:a05:6a00:230a:b0:63b:5f78:d6db with SMTP id h10-20020a056a00230a00b0063b5f78d6dbmr3432803pfh.21.1683216753848; Thu, 04 May 2023 09:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683216753; cv=none; d=google.com; s=arc-20160816; b=OgnjnV/NN9/wcRx1YyYZ4sIjO8OUJJVAdjm0xea9D+B2xBrQDPCuf9Nkr8lQRJwS5Y YjOuZbze6iFVxXbpiQA8DJcuiWB3zH/DeLl0GFgYoeWQnjd8+B8H4X5cbsNQTlbRZeEg 1WKV/vtxNvselfUso9lO7FsO7kGU+pXrHYv3YTZMgcak6NBd0M8HLC1sIRgjNflkUMS2 tU9HSmb062lpCy675Ru5gW4FnlUfgOXbjc5rhB0UWO43Wcelaxng3ChggXnwKGnyWtKd mtgZrEyGWCZ9kOz5zdZzOX1qZ3MBJfZEUMcjNLplbHfHZycF/LfbDNdz2a+H1pZ9zxld ZXyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=mtLbs/R/e8yk8lscZlbb2ZTLeGtU4O9K1SQg10+Sdes=; b=borlBcaVioK2FCasPs9rkXt35GtlCvYgV1poz9Ri3KBRXRLVWcod87q8VmHh8G01QO d/GC6glPm34TOWQHUjf2SJUduof2qWYrFxXNGC2W+39N57sYwFVMj8cQaewqgDdDRbn2 RHK+M4YMwl9SDiAH74+63KHT5rb00HcTFJznFZziz9jcZwQ2N5WW8P7YmwMqRL3CEYAH z1QYi/caytCj5iDXxl185AxWJPSiarR74ThnsoihyXcO+Lqzi+w1mQtz+8wPVIuWOncs GyReVgfYGkLr9xF8pQzQryducP+bUFuxv/r+XFr77ZmQyo5Gcb8mzWazc9R75GRcLdcP 9p8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=nJHMWhII; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e13-20020a056a0000cd00b0063473a51539si31150167pfj.398.2023.05.04.09.12.19; Thu, 04 May 2023 09:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=nJHMWhII; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231512AbjEDPpp (ORCPT + 99 others); Thu, 4 May 2023 11:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231448AbjEDPpl (ORCPT ); Thu, 4 May 2023 11:45:41 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A37A49DD; Thu, 4 May 2023 08:45:11 -0700 (PDT) X-UUID: 9f9947d6ea9211ed9cb5633481061a41-20230504 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=mtLbs/R/e8yk8lscZlbb2ZTLeGtU4O9K1SQg10+Sdes=; b=nJHMWhIIlBkDHZjRv/4WMd5Doi27gbjXm+QcLeAR4h9qYDt9KNQcTS4C8ODULMvsmrvntFR5wzuE8Ji+wPWf7RnQc+DOr5B1Hycf5MQWyava+bRMiLt4/NXR45sTQh1uiGw05CiitLX+KPBD+PBq8PsLakKSZ3NW7smPyKY4IRk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.23,REQID:8f7ffe86-9c13-4e9d-949b-d335c2032fe5,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:697ab71,CLOUDID:4e28c76a-2f20-4998-991c-3b78627e4938,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 9f9947d6ea9211ed9cb5633481061a41-20230504 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1172383792; Thu, 04 May 2023 23:44:58 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 4 May 2023 23:44:57 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 4 May 2023 23:44:57 +0800 From: Po-Wen Kao To: , , , , Alim Akhtar , Avri Altman , Bart Van Assche , "James E.J. Bottomley" , "Martin K. Petersen" , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , , , , Subject: [PATCH v6 1/3] scsi: ufs: core: Fix mcq tag calcualtion Date: Thu, 4 May 2023 23:44:49 +0800 Message-ID: <20230504154454.26654-2-powen.kao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230504154454.26654-1-powen.kao@mediatek.com> References: <20230504154454.26654-1-powen.kao@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Transfer command descriptor is allocated in ufshcd_memory_alloc() and referenced by transfer request descriptor with stride size sizeof_utp_transfer_cmd_desc() instead of sizeof(struct utp_transfer_cmd_desc). Consequently, computing tag by address offset should also refer to the same stride. Signed-off-by: Po-Wen Kao Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Reviewed-by: Stanley Chu Reviewed-by: Ziqi Chen --- drivers/ufs/core/ufs-mcq.c | 2 +- drivers/ufs/core/ufshcd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c index 202ff71e1b58..b7c5f39b50e6 100644 --- a/drivers/ufs/core/ufs-mcq.c +++ b/drivers/ufs/core/ufs-mcq.c @@ -265,7 +265,7 @@ static int ufshcd_mcq_get_tag(struct ufs_hba *hba, addr = (le64_to_cpu(cqe->command_desc_base_addr) & CQE_UCD_BA) - hba->ucdl_dma_addr; - return div_u64(addr, sizeof(struct utp_transfer_cmd_desc)); + return div_u64(addr, sizeof_utp_transfer_cmd_desc(hba)); } static void ufshcd_mcq_process_cqe(struct ufs_hba *hba, diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 17d7bb875fee..6c4ae32a1c49 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8452,7 +8452,7 @@ static void ufshcd_release_sdb_queue(struct ufs_hba *hba, int nutrs) { size_t ucdl_size, utrdl_size; - ucdl_size = sizeof(struct utp_transfer_cmd_desc) * nutrs; + ucdl_size = sizeof_utp_transfer_cmd_desc(hba) * nutrs; dmam_free_coherent(hba->dev, ucdl_size, hba->ucdl_base_addr, hba->ucdl_dma_addr); -- 2.18.0