Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2468733pxj; Mon, 10 May 2021 03:51:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkmU+sdOAxgbiTWm3ym9gHYfr0LKn7f11pON9O5gcCpn6pTcJL+d4AvXgEDbnHGZPr55HZ X-Received: by 2002:a17:906:c0d6:: with SMTP id bn22mr25354175ejb.267.1620643875441; Mon, 10 May 2021 03:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620643875; cv=none; d=google.com; s=arc-20160816; b=DtwCY615bKCQClqZtBZrMCe9pV5O4KWp/JLW3KSX5DOisOx40FmO6IacoGQfR57xR8 cKe1Y953XVK5xEaGY4TCZfma3WGIIl58aIeEQZCqGRDsbCEFEfceiPdhT9vL5QZiasRO KjOKeglXmwNO1Ulf459KnBYFZSPVpTA2wUsUwqtA60f7buyOoYIUEK0lW4vFQyFZjvDw bkdBSXXNpfiIcfk3Gr4WYloLFiIjXfprmq2Js6q0iJ9MsLmDUUIpTmLBkabPKcbwUhAI q7mjNS4A/P3M30llxwaAtWpLzUUXN0pHRCepnOjnfhTyOojMMyPk84lw/FU1HwGxeeX5 36fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7Mzi7LZNGQIjdQvtVCT/HdaNLjrTbBd9fzmpdkpd56g=; b=rgFYVidqS6Xm3ffT/hxj9Lz+E9EnhLSb0cXoqB47YuF2rMqO112gENTm5tJ9CnD7Ic oCCea0UTpjE+W+G/J0yQ+K7buZn65Io2hfsFEMUi4FaWikiBW0g02x4dKhWygamqCNR6 FQQUq6ur6TNe264ChTpuK52c38PWYEILsHpA0V3xQoUJuNTweA6W+I3MXRlrU2AvY90O cjre2iHWWIoA2UW30OJbWtWRB5hm511jT8bPUEWwRsQH6n2xt1xp+pM/YFRQP4crATJ0 V2iX3m/k/lZfos4QXkWT0CCJfG9YZiT7cUXzRaYUg8X20Azr1ccbsILmP6FT75+k8CMD mBkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oAE92OHH; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d18si13372320edz.163.2021.05.10.03.50.52; Mon, 10 May 2021 03:51: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=@linuxfoundation.org header.s=korg header.b=oAE92OHH; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233627AbhEJKu0 (ORCPT + 99 others); Mon, 10 May 2021 06:50:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:48330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232941AbhEJKkt (ORCPT ); Mon, 10 May 2021 06:40:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4915E61613; Mon, 10 May 2021 10:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642684; bh=xqBiIA+qKsEh0RtkH10MWKluXzc7KqCDB6F9iim7mKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oAE92OHHFfGhRLsqgE3bPCxfcQh9z2rgZe5t56AvStXDAK+xzNLlFlIt0eVn0a8FH t0vlQ9Vw7mEu0J5mj7whtlmc3zv4twsyEadlVBDK1RM7Zc4D0HOI1gn7xdt1ct2TXr 7t48QfeG1rFqIEQf4B7WEnyhaWEg/AGE9Qyi8XuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bhaumik Bhatt , Hemant Kumar , Manivannan Sadhasivam Subject: [PATCH 5.10 002/299] bus: mhi: core: Clear configuration from channel context during reset Date: Mon, 10 May 2021 12:16:39 +0200 Message-Id: <20210510102004.900838842@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bhaumik Bhatt commit 47705c08465931923e2f2b506986ca0bdf80380d upstream. When clearing up the channel context after client drivers are done using channels, the configuration is currently not being reset entirely. Ensure this is done to appropriately handle issues where clients unaware of the context state end up calling functions which expect a context. Signed-off-by: Bhaumik Bhatt Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Link: https://lore.kernel.org/r/1617311778-1254-7-git-send-email-bbhatt@codeaurora.org Signed-off-by: Manivannan Sadhasivam Signed-off-by: Greg Kroah-Hartman --- drivers/bus/mhi/core/init.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -544,6 +544,7 @@ void mhi_deinit_chan_ctxt(struct mhi_con struct mhi_ring *buf_ring; struct mhi_ring *tre_ring; struct mhi_chan_ctxt *chan_ctxt; + u32 tmp; buf_ring = &mhi_chan->buf_ring; tre_ring = &mhi_chan->tre_ring; @@ -554,7 +555,19 @@ void mhi_deinit_chan_ctxt(struct mhi_con vfree(buf_ring->base); buf_ring->base = tre_ring->base = NULL; + tre_ring->ctxt_wp = NULL; chan_ctxt->rbase = 0; + chan_ctxt->rlen = 0; + chan_ctxt->rp = 0; + chan_ctxt->wp = 0; + + tmp = chan_ctxt->chcfg; + tmp &= ~CHAN_CTX_CHSTATE_MASK; + tmp |= (MHI_CH_STATE_DISABLED << CHAN_CTX_CHSTATE_SHIFT); + chan_ctxt->chcfg = tmp; + + /* Update to all cores */ + smp_wmb(); } int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl,