From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11A7EBA49 for ; Tue, 7 Mar 2023 18:44:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A928C433D2; Tue, 7 Mar 2023 18:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678214656; bh=DAPalmKRd3jRAbkx9AfPcgoQr/ovQMCcdn9B9eZpwjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kt1bxaf/IMQArl2oqLGGQXXUnG9cB/VQjxl73McfL2O4JCJm4PM6Y6gNvo5/KU94b cDs5i/t0RFD0xvcljfTmPBQMhEWap89LqXdI5iR4Usok91V/L9sMTlTN82d4S/EPcp D7kJUqvDIUo+w8CRV3Rprct3SmRairFFNYSQK0Yo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Manivannan Sadhasivam Subject: [PATCH 6.1 871/885] bus: mhi: ep: Save channel state locally during suspend and resume Date: Tue, 7 Mar 2023 18:03:25 +0100 Message-Id: <20230307170039.624202045@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307170001.594919529@linuxfoundation.org> References: <20230307170001.594919529@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Manivannan Sadhasivam commit 8a1c24bb908f9ecbc4be0fea014df67d43161551 upstream. During suspend and resume, the channel state needs to be saved locally. Otherwise, the endpoint may access the channels while they were being suspended and causing access violations. Fix it by saving the channel state locally during suspend and resume. Cc: # 5.19 Fixes: e4b7b5f0f30a ("bus: mhi: ep: Add support for suspending and resuming channels") Signed-off-by: Manivannan Sadhasivam Reviewed-by: Jeffrey Hugo Signed-off-by: Greg Kroah-Hartman --- drivers/bus/mhi/ep/main.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/bus/mhi/ep/main.c +++ b/drivers/bus/mhi/ep/main.c @@ -1136,6 +1136,7 @@ void mhi_ep_suspend_channels(struct mhi_ dev_dbg(&mhi_chan->mhi_dev->dev, "Suspending channel\n"); /* Set channel state to SUSPENDED */ + mhi_chan->state = MHI_CH_STATE_SUSPENDED; tmp &= ~CHAN_CTX_CHSTATE_MASK; tmp |= FIELD_PREP(CHAN_CTX_CHSTATE_MASK, MHI_CH_STATE_SUSPENDED); mhi_cntrl->ch_ctx_cache[i].chcfg = cpu_to_le32(tmp); @@ -1165,6 +1166,7 @@ void mhi_ep_resume_channels(struct mhi_e dev_dbg(&mhi_chan->mhi_dev->dev, "Resuming channel\n"); /* Set channel state to RUNNING */ + mhi_chan->state = MHI_CH_STATE_RUNNING; tmp &= ~CHAN_CTX_CHSTATE_MASK; tmp |= FIELD_PREP(CHAN_CTX_CHSTATE_MASK, MHI_CH_STATE_RUNNING); mhi_cntrl->ch_ctx_cache[i].chcfg = cpu_to_le32(tmp);