From patchwork Fri Oct 1 07:55:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UGV0ZXIgV2FuZyAo546L5L+h5Y+LKQ==?= X-Patchwork-Id: 12529831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DAC7C433F5 for ; Fri, 1 Oct 2021 07:58:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A70A861A58 for ; Fri, 1 Oct 2021 07:58:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A70A861A58 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eOjwPMVro1fUswdJP65Z6HWu/VzY/aeXo2hSyvAWLD0=; b=fAylZa3gaTRyf0 20bGqz8w54yVj389XeXYHDlu+L7QQL7gM0UFYru/Z0T78zcOpUM8T4L5Rm7Wis/dqz5g9+C8RMLCY LqGoEX/BRpkOq3+7WmjiLhA+gZ1qpyPk9QjUTks2sjtUsRsDst+g2Tn2HEmr12UI9nwQ5MSSHPAiT xOyo0J6bDADkMQDLIWloc6IFZUjiOK1ytLhPVwMfZPx60ztgl+rns6kDgeJ2gpUhPT+sxbjckl9H+ uSdXEBOTgPnwfMcaFraWDsxHJCf5J04dTqrWPSmcFqadYBAkLg+/paCvizuGUAMHOIh4oc3B+EEBI 3eULzUkGDs8j05YGRuyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mWDQw-00GxZj-G4; Fri, 01 Oct 2021 07:58:18 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mWDQt-00GxZ5-H4 for linux-mediatek@lists.infradead.org; Fri, 01 Oct 2021 07:58:17 +0000 X-UUID: 4f3e23a5bb0e48e384dbd196c8e10f5b-20211001 X-UUID: 4f3e23a5bb0e48e384dbd196c8e10f5b-20211001 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1424371661; Fri, 01 Oct 2021 00:58:12 -0700 Received: from mtkmbs10n1.mediatek.inc (172.21.101.34) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 1 Oct 2021 00:55:56 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Fri, 1 Oct 2021 15:55:55 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 1 Oct 2021 15:55:55 +0800 From: To: , , , , , CC: , , , , , , , , , , , Subject: [PATCH v1] scsi: ufs: add wmb after clear interrupt status Date: Fri, 1 Oct 2021 15:55:49 +0800 Message-ID: <20211001075549.7313-1-peter.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211001_005815_593539_4AE2B87D X-CRM114-Status: UNSURE ( 8.18 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Peter Wang Write IS(0x20) to clear interrupts should be done before read UTRLDBR(0x58) or UTRLCNR(0x64). If optimize lead to read TRLDBR(0x58) or UTRLCNR(0x64) before Write IS(0x20), the final complete task may miss. Signed-off-by: Peter Wang --- drivers/scsi/ufs/ufshcd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 3841ab49f556..3318b3b6c916 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6492,6 +6492,10 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) enabled_intr_status = intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE); ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS); + + /* Make sure interrupt status are clear before service */ + wmb(); + if (enabled_intr_status) retval |= ufshcd_sl_intr(hba, enabled_intr_status);