Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp981493pxx; Thu, 29 Oct 2020 21:13:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNaFD47SwvneJD2R+m7Xrg7gH9i8dIniCGp25iFGiDikBTgxGbdTfixB984XSe1mpfHx29 X-Received: by 2002:a50:da8d:: with SMTP id q13mr302645edj.370.1604031185201; Thu, 29 Oct 2020 21:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604031185; cv=none; d=google.com; s=arc-20160816; b=fvzQb5hJpGN6uAIUBAoUnqo0SuObZlR1fdCN8CGJWQgDPPxycoQneFP6NkFzMj4JtF kjvaW1eYYy8HWbDw8PBuwTHx8cxD2g7mxRL/PfHOYME8Elmwj4Itv8zxseujS0HoxzSa ByLC+9/bqFu2u8kDiJJ8O0Ebsy90xCLlKj+lu1usaNJcH2GWV8yaD0rJv3dLu2scKGPm FoRhMX5u44/LNIdXaSPoNm5wcHt3QMum6UmDhNqTM9FhQBaBkcdLASwVDbUZ+1q1hQov HYddN+gSRseWxUmoMDmlUgTPEfQVR6Tncj4y6QXleiTf5MwqNYZTr0bk/6GtAzSPpDDp w/Ag== 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=xEa3MfK7XB1/k0iKNON6E6IcSjjnVCA+F+FYLEFfpV2YfFHejPoDRCDqUk+M/Bi4bs oSRDkfJdO59ez7Ux6kteaea2zCF1gIiZBSY0Tc8cBnoZpUFwp1M8HVLq70J6bt4n+IrQ tH3WFGO+FN8WWIC+xk23NQn2O6OD6+JhE4WxjlOBU6i6RlBgeF52Dl6CwybZgLj7k0NL 2pWIG26bQzy5KdNMTuqX9/UEP4s34IvrFNoQUj/oHrBVSyqbowmAPnJN66xyu5FyI0+1 PryTSLcZvK8JcECrjhcKyUqbe5VjcBwF9mxxXRfhKot70TNKf1f0VbrqT2yQusVdHhPM aKsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="r/5Ri5H4"; 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 z61si3577069ede.133.2020.10.29.21.12.43; Thu, 29 Oct 2020 21:13:05 -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="r/5Ri5H4"; 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 S1726480AbgJ3ELP (ORCPT + 99 others); Fri, 30 Oct 2020 00:11:15 -0400 Received: from z5.mailgun.us ([104.130.96.5]:20282 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725780AbgJ3ELL (ORCPT ); Fri, 30 Oct 2020 00:11:11 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1604031070; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=F0sxjXnBEh783fVjnu6ncFGsGt2oqOPfmKrhbhWQZjM=; b=r/5Ri5H4GNvdfBM9o1BseczOmEIdYFfJhFqmCgza164hgeooLBMyW9h1GBIAY0mx0lMyY7D6 Hnf64UtQ5t/IEnMqDssYmEjEHqVOgps6BU8cPBFKwE07yRqEfJ8DntD8ojOcEwE+iUw7+2hc pJgvXo+ahbchvOQEJWQ7Ho+Q3iI= 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-n03.prod.us-east-1.postgun.com with SMTP id 5f9b925c156c34a69fc08d07 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 30 Oct 2020 04:11:08 GMT Sender: bbhatt=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id C1331C433FF; Fri, 30 Oct 2020 04:11:07 +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 0B73CC43385; Fri, 30 Oct 2020 04:11:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0B73CC43385 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 v3 05/12] bus: mhi: core: Prevent sending multiple RDDM entry callbacks Date: Thu, 29 Oct 2020 21:10:50 -0700 Message-Id: <1604031057-32820-6-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604031057-32820-1-git-send-email-bbhatt@codeaurora.org> References: <1604031057-32820-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