From patchwork Wed Dec 28 16:17:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 37231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1970379wrt; Wed, 28 Dec 2022 08:20:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXvzDPytFlmNf/DGMmV2eyHmszwQ3uVlDOoALFag1RTJItAEB+qQ7S6kXsbDoYpmFN4Eqn13 X-Received: by 2002:a17:906:9616:b0:78d:f457:108f with SMTP id s22-20020a170906961600b0078df457108fmr21202217ejx.76.1672244428567; Wed, 28 Dec 2022 08:20:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672244428; cv=none; d=google.com; s=arc-20160816; b=WNX+48LmNYT+uolLKs1nQmRysXJ+FSqXild0sBNH7Sw+XL/ETqIZBOw6rJAIwQv6cz 8/B8KoYhK6hzsIKg6ELE8T9FMvh4hf1V2I1c5FE6jNyip5PJSyl0js9VYZXo1Gufxuq8 Ul1//hzXR95VkevYKI+gTwG5exEr5QjQrGoYYAulRiKuqt82Q1WZU6ijACIfgWNwt/9+ NZfaDRJy+CrNJxTtFWOeYHbZQAdtXPnrjBDiqKX4s23kQIvQnV44qOPVpHCWNYoFueb0 avvseM77FNs7835aTzx2v22RVoDbvb0uD1VHscZZp6UKnu7lOgccjLZi4MDki2CqLRei 1MyA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rSAJAAdg+x2pOzW2h8I4DWXP2kQcq5rdUpJcuztv9EE=; b=TQOB/Fj+87+Fnr/xpX2I3KywWEsbBltDotMK6/wC98mhbHorhgv2OAWBraWQejSE6R OP6M8EIU4mwZnh2DluTP8RwpJxGr09tr22xoKcw6Z6T9Nj29ffmfWlWeBxFxLT6Y7EjS aujdPq+Qr8RjoXCaKr/3vP6OYujMr3kiAS5pcFmWbwomIYyejGv+yqnJOW71oTrlcdzf OWTZoRL5p20hnFepp36zKxihSos8iTFGcuUZ9VkdRXffl2TNHEUy0W4xkt885xPoAOwm 9wZdqieWOOMM4DfORPCe94UXGvlkpTkkwpPzH/JvsewGRC6o4GtPIMGEMJW0DN25FbQx zsiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zFtugpRj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020a056402348100b004511d552be3si14957442edc.4.2022.12.28.08.20.04; Wed, 28 Dec 2022 08:20:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zFtugpRj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234577AbiL1QTj (ORCPT + 99 others); Wed, 28 Dec 2022 11:19:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234572AbiL1QTG (ORCPT ); Wed, 28 Dec 2022 11:19:06 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CDE31A078 for ; Wed, 28 Dec 2022 08:17:39 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id j8-20020a17090a3e0800b00225fdd5007fso6859565pjc.2 for ; Wed, 28 Dec 2022 08:17:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rSAJAAdg+x2pOzW2h8I4DWXP2kQcq5rdUpJcuztv9EE=; b=zFtugpRj2SGg96qrJKKPlr+MyyNnNyuUCPvH4PdjNFsVHhZZmMIN/KOq4JeyQA8bys /Stl7IcHO4xx7yHuC3VjLzsueyqi0DOdGuZNyG7Uubuhene+VMbN6+vikXMigsNF05SZ zvcmwRX0TQ6HsWH3zzwpQ/vCnnK24FznH+UGjIwOWQ71x9sI+GgiaQziNz5Uj25Q28Uy xw5CcVwNaSFP/o1xg49J+RJdoV50/Mh/HnQfFslJNO4BOnMOMSLOeDNawr1LF5r4lKfg rU9UckkH2uomLEmwOiR8a0qewI0P2yFgk+YeXZFwJoJDB5zVNwYalIWdtpxnLG9FeUC5 UK+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rSAJAAdg+x2pOzW2h8I4DWXP2kQcq5rdUpJcuztv9EE=; b=jRlCpNKkZKImD9tZ58EkbHMDbfhZAPMAvhVFToCNi3hBJZRBOBinY1VdyO0grVVlAg kVG6yorL06TSiLBc1KxPm46bUqHwGqQKOkn0gEcZFo0cF0S3C6JouRPlHowlY597nAO2 b+dHJMv8tx7JPehoEAai3KLWZh+c+iLSmhPW5wuBIN/eVPVaz12ZOoPRWvoudFk4/ezI MAPafUb6ZCCyBpWjoU/6sM3xmYtphIFyBNUDNaNREkK/OcFA1izW13mdRKEsERZz/2hA 8ZNERgxqqEKB00dCEnUFgXg/Feb+n4lzkFEvnKJRkzMXPhiR567q+rVFDfChFLVyfHqR f4Yg== X-Gm-Message-State: AFqh2kqaWM5LZlL9Hl6ipA/MMSX+ePmeG6aNWqTWwPvyhcnakicUjgAR Ae9Msf1zTWte50bUzdIUPJPH X-Received: by 2002:a17:902:edd1:b0:192:50fe:504a with SMTP id q17-20020a170902edd100b0019250fe504amr23724967plk.16.1672244258560; Wed, 28 Dec 2022 08:17:38 -0800 (PST) Received: from localhost.localdomain ([117.217.178.100]) by smtp.gmail.com with ESMTPSA id s3-20020a170902c64300b00186abb95bfdsm11256798pls.25.2022.12.28.08.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 08:17:37 -0800 (PST) From: Manivannan Sadhasivam To: mhi@lists.linux.dev Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam , stable@vger.kernel.org Subject: [PATCH 6/6] bus: mhi: ep: Save channel state locally during suspend and resume Date: Wed, 28 Dec 2022 21:47:04 +0530 Message-Id: <20221228161704.255268-7-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221228161704.255268-1-manivannan.sadhasivam@linaro.org> References: <20221228161704.255268-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753475373833706700?= X-GMAIL-MSGID: =?utf-8?q?1753475373833706700?= 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 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); @@ -1151,6 +1152,7 @@ void mhi_ep_resume_channels(struct mhi_ep_cntrl *mhi_cntrl) 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);