Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3563775pxb; Mon, 9 Nov 2020 14:49:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJxPQmYc0C9lEzpOgEDpxCjfgz7N9kOZASvHidEkqg1XPU7CatJk1IMcBSpnsmmtzPeEzM X-Received: by 2002:a17:906:c1ce:: with SMTP id bw14mr17128606ejb.302.1604962166616; Mon, 09 Nov 2020 14:49:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604962166; cv=none; d=google.com; s=arc-20160816; b=ODy2awgN93KYpFDFbGJBf1XHsqjEN5U98oMBfVlhfYkmLY4S2Ta4bSxdEEZ4Ag84l0 RUdQgr3G2+DGziPShB3Ge6Pwc2nW0622vq4l9mwlvjarfZ9YeBxX/YVuoQibNxQy6M6p cZ+42ihv4NkDE+HTvnN6M2ajCnR8Q17RSVaarOnje/K7+M2n8+wLDV8PjZqiCu+lupJK mbLWkz22KxT8AwMbpClRImvKIqY1APgsPRycFHn9t3CwCCGwgDZP921cbTR5JKgQLnfW IN17NtSqstdQCxqS1olVL2jKqqErccMsBiZt/dTsd52iF6J/9O72i2jiUlebe7v4ACno Dizw== 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=/nSVjKT55foOjciRds6JyCEjFXHdAmnTa/icvyBelas=; b=M4JQVSv0UB8a8Rn8e8EVfAEKrphiydDNWSki6EZBFXQ9GbL0dkNrrQFIAOTuJ+T+BT 6yGB50NirAhnrZ2NBMcHMzS305SnWqqcgc+tcdnFVFBIRdJ9X+GP5JcYYFETpABSDp2Z iqpQFd2rt3hm/xNY4Jp5L7YqDsqzlrb5Fv0bQBGpthnMLGewmTApNdPniolgKFf86E2Z NhcXNwVn7Ge0JaaQo4JQ8iVgI6PWWx3+/4NeluGWyAaIXNh0wsC8jIH4B5SmoJCs50AF dZzuwY6qcZEKY5TxaX2RgTcY1l21AdhZj4YojiJBxRYktrUW7TIv+nHgraaG9nmpE6y5 PoUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ORP1w8Zs; 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 bx24si8019510ejb.449.2020.11.09.14.49.04; Mon, 09 Nov 2020 14:49:26 -0800 (PST) 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=ORP1w8Zs; 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 S1731356AbgKIWp0 (ORCPT + 99 others); Mon, 9 Nov 2020 17:45:26 -0500 Received: from m42-4.mailgun.net ([69.72.42.4]:43839 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729451AbgKIWp0 (ORCPT ); Mon, 9 Nov 2020 17:45:26 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1604961925; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=/nSVjKT55foOjciRds6JyCEjFXHdAmnTa/icvyBelas=; b=ORP1w8ZslFhNB4SezAaR2O+3xfKUWc5asGUgTHHFNGmIaJ+w1Wy6KmzU7xLlbL1gDLbUUceV JixyugRZamvnubsq9ku+CzHWnxRWDyhPVhIDw+Xrf69EPmxP31p8/oPMOJntDnbKKi9l+N67 sO/RE2GC04Q/mSClbUM5wDr1TH0= X-Mailgun-Sending-Ip: 69.72.42.4 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-n06.prod.us-east-1.postgun.com with SMTP id 5fa9c643f153feb1e864f2eb (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 09 Nov 2020 22:44:19 GMT Sender: bbhatt=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 83EE8C433F0; Mon, 9 Nov 2020 22:44:18 +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 BF375C433CB; Mon, 9 Nov 2020 22:44:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BF375C433CB 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, loic.poulain@linaro.org, linux-kernel@vger.kernel.org, Bhaumik Bhatt Subject: [PATCH v1 4/4] bus: mhi: core: Check execution environment for channel before issuing reset Date: Mon, 9 Nov 2020 14:44:10 -0800 Message-Id: <1604961850-27671-5-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604961850-27671-1-git-send-email-bbhatt@codeaurora.org> References: <1604961850-27671-1-git-send-email-bbhatt@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A client can attempt to unprepare certain channels for transfer even after the execution environment they are supposed to run in has changed. In the event that happens, the device need not be notified of the reset and the host can proceed with clean up for the channel context and memory allocated for it on the host. Signed-off-by: Bhaumik Bhatt --- drivers/bus/mhi/core/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 01845c6..1e432d4 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -1323,11 +1323,24 @@ static void __mhi_unprepare_channel(struct mhi_controller *mhi_cntrl, /* no more processing events for this channel */ mutex_lock(&mhi_chan->mutex); + if (!(BIT(mhi_cntrl->ee) & mhi_chan->ee_mask)) { + dev_err(dev, + "Current EE: %s Required EE Mask: 0x%x for chan: %s\n", + TO_MHI_EXEC_STR(mhi_cntrl->ee), mhi_chan->ee_mask, + mhi_chan->name); + goto exit_unprepare_channel; + } + ret = mhi_update_channel_state(mhi_cntrl, mhi_chan, MHI_CH_STATE_TYPE_RESET); if (ret) dev_err(dev, "Failed to reset channel, still resetting\n"); +exit_unprepare_channel: + write_lock_irq(&mhi_chan->lock); + mhi_chan->ch_state = MHI_CH_STATE_DISABLED; + write_unlock_irq(&mhi_chan->lock); + if (!mhi_chan->offload_ch) { mhi_reset_chan(mhi_cntrl, mhi_chan); mhi_deinit_chan_ctxt(mhi_cntrl, mhi_chan); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project