Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1508969ybk; Thu, 21 May 2020 08:31:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRt/Lm4FVzeq0SBrns/aqVi0rCWM9kAAVV/x753FSUi/UYVwIdRfVn6+A4uKASaDlaA3nH X-Received: by 2002:a17:906:3ed3:: with SMTP id d19mr4366316ejj.404.1590075085781; Thu, 21 May 2020 08:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590075085; cv=none; d=google.com; s=arc-20160816; b=bztc7XJGvMLK6hZvbB0S3UVbtELgkaTzTjD2+VQ43Oksn4uhZaTP2Mljvd+YaGM8E+ 9gs66xQ/RtmKyJm6stH2dZCe2BEOTkLl3nrQXbkmXr+o92NF0dmnnWz1fdZBDj7iMZCA enU4tMg1Ew+3XxCALvYrtHeCyhWzq4pgzMvEh4Jw7GiXBUtFTA7LmNQZmDUoQq1+VFCa /WolwzpYOGP6IQpgCCN4oKquGxKha+NXa+tdfto4t133RbmOt9w66/TGQ9Qm8PTG/eDj YfbdKBsggJzMxONOtgIQNWytgquByXG2FuN4/eqZDc0FLQRViwiB43SYlwj32fZmZFP/ 1/wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BpYRIpKi7vFlL5dWPvcWr5TFqEqDeMdL0lVyoFxj0vw=; b=mVrdE8G7H3fKGirgbHNs0odBfJTgn2HSnCttCUbhE2kmgk02fEAbkCXIY1/hxbX6BO paUXBcgs9i19xpreWOaH/xLJ9DGJJ8VXSPARcXqzobV8wotiNFKsHiRsRjxFDVgtg2pT cIWkTlU5ol0i1T3gFLjhXMRPdyv8QWO93syWFE+uoemUPj0a0iq4efDOARE75jIH/2EE mFke8LI1OUC3ueCrhCGrzWQWnKKm0QSmumK+CytPq33PhYzYkoOjfsrxPy8FGSPV32i5 9Fgnv78ykDVDiN7WSSCCKsbsDjy8IpnoHTz2ab0sCDZ3B9/vJueIaGhp+lB8GI1VnLIx CoGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=baOcq0ZU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r20si3470202ejx.622.2020.05.21.08.31.00; Thu, 21 May 2020 08:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=baOcq0ZU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730516AbgEUP0o (ORCPT + 99 others); Thu, 21 May 2020 11:26:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:34740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729934AbgEUP0n (ORCPT ); Thu, 21 May 2020 11:26:43 -0400 Received: from localhost.localdomain (unknown [157.51.235.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BB218204EA; Thu, 21 May 2020 15:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590074802; bh=i91QfTti5DB8FqfwzsBEbItnOlrRtbcA4RiEHX/m6uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=baOcq0ZUVLdo2sQu2xef367DZ+lv3M4dxWfDNBfp4euh9094xT6kRy5L4m96SaAw/ cOXwKEivrtOkKqVzsXX1XVrBjeGA2FiQuGRKGWOQ1FTRr7p07eJXbtg9dymZycfLMz oeHplKc3fqBKVVrK/XMXTJD7rvnE37GKHauIIij4= From: mani@kernel.org To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, jhugo@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 11/14] bus: mhi: core: Skip handling BHI irq if MHI reg access is not allowed Date: Thu, 21 May 2020 20:55:37 +0530 Message-Id: <20200521152540.17335-12-mani@kernel.org> X-Mailer: git-send-email 2.26.GIT In-Reply-To: <20200521152540.17335-1-mani@kernel.org> References: <20200521152540.17335-1-mani@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hemant Kumar Driver continues handling of BHI interrupt even if MHI register access is not allowed. By doing so it calls the status call back and performs early notification for the MHI client. This is not needed when MHI register access is not allowed. Hence skip the handling in this case and return. Also add debug log to print device state, local EE and device EE when reg access is valid. Signed-off-by: Hemant Kumar Reviewed-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/main.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index e5f6500e89fd..7429189840b0 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -368,22 +368,29 @@ irqreturn_t mhi_irq_handler(int irq_number, void *dev) return IRQ_HANDLED; } -irqreturn_t mhi_intvec_threaded_handler(int irq_number, void *dev) +irqreturn_t mhi_intvec_threaded_handler(int irq_number, void *priv) { - struct mhi_controller *mhi_cntrl = dev; + struct mhi_controller *mhi_cntrl = priv; + struct device *dev = &mhi_cntrl->mhi_dev->dev; enum mhi_state state = MHI_STATE_MAX; enum mhi_pm_state pm_state = 0; enum mhi_ee_type ee = 0; write_lock_irq(&mhi_cntrl->pm_lock); - if (MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) { - state = mhi_get_mhi_state(mhi_cntrl); - ee = mhi_cntrl->ee; - mhi_cntrl->ee = mhi_get_exec_env(mhi_cntrl); + if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) { + write_unlock_irq(&mhi_cntrl->pm_lock); + goto exit_intvec; } + state = mhi_get_mhi_state(mhi_cntrl); + ee = mhi_cntrl->ee; + mhi_cntrl->ee = mhi_get_exec_env(mhi_cntrl); + dev_dbg(dev, "local ee:%s device ee:%s dev_state:%s\n", + TO_MHI_EXEC_STR(mhi_cntrl->ee), TO_MHI_EXEC_STR(ee), + TO_MHI_STATE_STR(state)); + if (state == MHI_STATE_SYS_ERR) { - dev_dbg(&mhi_cntrl->mhi_dev->dev, "System error detected\n"); + dev_dbg(dev, "System error detected\n"); pm_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_SYS_ERR_DETECT); } -- 2.26.GIT