Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp923913pxx; Thu, 29 Oct 2020 18:55:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKlIzUZQDjwDGNgC8Y4T56vfQfWY0A58UJKMuci+a0e3UQecSVRa6UKtc0LXSQJRIRmY2g X-Received: by 2002:a05:6402:3133:: with SMTP id dd19mr7342820edb.100.1604022915648; Thu, 29 Oct 2020 18:55:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604022915; cv=none; d=google.com; s=arc-20160816; b=VFmISNB30mRTtZXvDPZqyVvUuXFxEjbcpzjxoA49uEGstE9GV+PJ/7zV8Qcz14fWCN uN3TbnWD1ZOhrCLJBeFRGgozPdHDRl1TOnsHr7IWxrOU4eCC3SXNfkR9gGAnfCrW5g4Z qPvW/Fwq/KvSCkHwu8sFzOmQw2dNvpUW6h9w1ki0M1NtFWguj92RjYBzXUtWnuXKP3Hj YAS/iw0fWhVBhMmq9Yk5ySBKOHQ5TpFNR/VhfmAFwTDuN3gwzeP3msbmjftDw8FMOpJY DSHPioaxZH/pIYklyYthA9u936QQXk6B/KUfBtS+Ge8sh9Gwwq7J4dnchMMRIwiyMYv1 SdEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=F0sxjXnBEh783fVjnu6ncFGsGt2oqOPfmKrhbhWQZjM=; b=SVZnr5m4SUU3BF0rONcK+6prgD79jLR911htsxRVeua0XuaCL7hIvGvHI9WgmePY6G Ppudk/yenmiZtF0l4JxVnOkWqaGbpnTVyml7PLY4oaHM7Vk9mlhwMr8apDlMmCHHL6tx N/sJanTtbXX/PfMP8Xb1IPCEkw3IXjTZxmdaktQntFE2CY3EXJ2+8cfdQdb99jua4/YF 1oFOou7Faj6fiScz9e/mEmO32aoK1K700gYvoMCCN7tpKppEDNrDDCpS9btjwYmawd7o ZS3Y4ixzTGE4JN7DO0wRifzysF6CymSxU12QSUaZZ5H4dgDU8i6Bz92yGBNs5VCMo3IJ BjVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=m5UhqsNw; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si3514352edn.47.2020.10.29.18.54.53; Thu, 29 Oct 2020 18:55:15 -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=@mg.codeaurora.org header.s=smtp header.b=m5UhqsNw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726263AbgJ3Bwp (ORCPT + 99 others); Thu, 29 Oct 2020 21:52:45 -0400 Received: from z5.mailgun.us ([104.130.96.5]:46913 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726306AbgJ3BwO (ORCPT ); Thu, 29 Oct 2020 21:52:14 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1604022734; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=F0sxjXnBEh783fVjnu6ncFGsGt2oqOPfmKrhbhWQZjM=; b=m5UhqsNw4NvaYltnW9+aDHF0xGUzS178MUIf8S6S+yZMfmdyMV0+oM6kM2Ck/w0xjGbFxdgd Snfg8BnhqdanccQgHSdJf1+MNcDoVuvnEs5sE+2ebSPQQaeiUNwnFH1dv3XVZ3J9+SnEZIil kvujOpt2ho4YGQMRKLXxZ86dRn0= X-Mailgun-Sending-Ip: 104.130.96.5 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 5f9b71ced292ba49082b20e6 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 30 Oct 2020 01:52:14 GMT Sender: bbhatt=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 7AD31C433F0; Fri, 30 Oct 2020 01:52:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from malabar-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: bbhatt) by smtp.codeaurora.org (Postfix) with ESMTPSA id D72E2C433C9; Fri, 30 Oct 2020 01:52:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D72E2C433C9 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=bbhatt@codeaurora.org From: Bhaumik Bhatt To: manivannan.sadhasivam@linaro.org Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Bhaumik Bhatt Subject: [PATCH v2 05/12] bus: mhi: core: Prevent sending multiple RDDM entry callbacks Date: Thu, 29 Oct 2020 18:51:56 -0700 Message-Id: <1604022723-34578-6-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604022723-34578-1-git-send-email-bbhatt@codeaurora.org> References: <1604022723-34578-1-git-send-email-bbhatt@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If an mhi_power_down() is initiated after the device has entered RDDM and a status callback was provided for it, it is possible that another BHI interrupt fires while waiting for the MHI RESET to be cleared. If that happens, MHI host would have moved a "disabled" execution environment and the check to allow sending an RDDM status callback will pass when it is should not. Add a check to see if MHI is in an active state before proceeding. Signed-off-by: Bhaumik Bhatt --- drivers/bus/mhi/core/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 1f32d67..172b48b 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -399,6 +399,10 @@ irqreturn_t mhi_intvec_threaded_handler(int irq_number, void *priv) /* If device supports RDDM don't bother processing SYS error */ if (mhi_cntrl->rddm_image) { + /* host may be performing a device power down already */ + if (!mhi_is_active(mhi_cntrl)) + goto exit_intvec; + if (mhi_cntrl->ee == MHI_EE_RDDM && mhi_cntrl->ee != ee) { mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_RDDM); wake_up_all(&mhi_cntrl->state_event); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project