Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp604069pxb; Wed, 11 Nov 2020 11:24:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJydvMN6jgxYNVyhkp717tS1fYvgPQKiZvr9z8rJuNN7XkIURC+jkxmcMaHLdDNV61UfPmSR X-Received: by 2002:a17:906:c1c3:: with SMTP id bw3mr25697867ejb.126.1605122672528; Wed, 11 Nov 2020 11:24:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605122672; cv=none; d=google.com; s=arc-20160816; b=UT8RyQ8ysdSlwhSSSjHk4z12sVHVQfe9H7ew8iwhK/dJbzCQ6n7B7vnPRXcIPFqgkb 5rGkWPTb8ILSmXyAyxyQ8bPmSBFPpVpvADhla7IFYaTm6+uJPobcGO9oJvI8qqUENFTl lsaU0QpIcI0iYKSt2D2yKPh7Q0FHWu2nACVrttT6U/+9v4I8KTfLbwrPNo8NNrUYACfs v91mOOftrdbbynsvdoVIibGek6B0EWQfm/FoKkxf9+eeWUYNZhcQWCold6Z1U+yQoW4T UiEYnogX/EcpVxowMfXXaqvd2SbXDmNR9Lr0VtpPv7UlbrBBU521xGujjy/5lrDShdBb GpKQ== 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=AdFskNn3rqtdWQT49khLLkUwLfPujR897XFvITFqsio=; b=tq+N9u8K4ijE2YiRDf6+/9mk+cX9t9p/Wrvugi6g5zNWNzHCYR5SM/MHFlNROyiagR SULft0QbHTSyXLCS0We9L9DfwFldN1t0dQOcIwAa8HoHDaV2UiJ1Ethw8Lb+BIsfjGbh u7WsTSmOzcjlb/ZxbkDsmdqaW0nrZn86bk9CLSo+rpk7Wfr9hevksjpIuvoEUoWp8TMA NiF1Xpb2g8lXEqiuKo535pPf+OQtU55bONyc9MGlKCOvfo2Wb5wyUY5ScEwR4KR4pw0E cMQgMPGmWmSgKwxRROJNvX2+CZ/36XhOSpw+PY4L2XeLbmKB4JTSMCbXyQfobItDmKFK BKmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=aEO4mCT2; 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 p1si2057208ejz.55.2020.11.11.11.24.08; Wed, 11 Nov 2020 11:24:32 -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=aEO4mCT2; 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 S1727753AbgKKTVy (ORCPT + 99 others); Wed, 11 Nov 2020 14:21:54 -0500 Received: from z5.mailgun.us ([104.130.96.5]:57598 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727683AbgKKTVZ (ORCPT ); Wed, 11 Nov 2020 14:21:25 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605122485; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=AdFskNn3rqtdWQT49khLLkUwLfPujR897XFvITFqsio=; b=aEO4mCT2rZk7sh29erSre+oI7iPSi9Ul/qpKQRHAPByfPX4AT6Rvdu/Z9H5H1MUbpoVCIkHc 6hfeZAHZcXoDdhrXibDc0tDar5lEuJbsNwo6hLCNUDZ+UNL+fpQUQCYkbUOwmFX5fVx2sHSZ 2FHCMntpjvIIJ6V5hmqGIST0ANc= 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-west-2.postgun.com with SMTP id 5fac39b33825e013b539a221 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 11 Nov 2020 19:21:23 GMT Sender: bbhatt=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 986F1C43387; Wed, 11 Nov 2020 19:21:23 +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 D85E2C433FE; Wed, 11 Nov 2020 19:21:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D85E2C433FE 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, kvalo@codeaurora.org, linux-kernel@vger.kernel.org, Bhaumik Bhatt Subject: [PATCH v2 4/6] bus: mhi: core: Check execution environment for channel before issuing reset Date: Wed, 11 Nov 2020 11:21:11 -0800 Message-Id: <1605122473-12179-5-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1605122473-12179-1-git-send-email-bbhatt@codeaurora.org> References: <1605122473-12179-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 1a969f4..e8af85a 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