Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1811383rdh; Sat, 25 Nov 2023 04:08:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9Ya4l/PwKNS+vX6KKSFk5fiecwB0reFNhyPskwFPRMj2JZF6Om4wHhaTOWJFvcgOuH09N X-Received: by 2002:a54:4885:0:b0:3b8:402c:7072 with SMTP id r5-20020a544885000000b003b8402c7072mr7054393oic.25.1700914082114; Sat, 25 Nov 2023 04:08:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700914082; cv=none; d=google.com; s=arc-20160816; b=ZjeJrL+LZMBgUpAv8wOGWkjsT/Y4AZQV7KwYg5YRZsPFWJ4H+1Cs8rhadffxsQrT4L 3XbOEKV65LCdGMFHav5DFBW1ivkUANRXbvFEFroYiKwmhgacRuo94MEwtY0xvWG0Fc9/ H9IGQrcf2YeiFZRqrhpL2P6/Eg5lY+Ptr8bK5RnNcpofq88suaakdyzt22QJJYozs7W8 dAlwvTSe5eNjGu6BdhZbY/naZStBfk6Dy/YxsBIsXuCcYWB777c+AC6hIRx+Ptd8wZUQ Z6dJm1WJpg+QKyv02kvhnxgAcfa/QTltc9JFiou3r/AiekT6cRBiIvaPVEvgA1ulqa1g ujkQ== 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=5jPglraMCLLrMmKCKxROtrVGZG66MYbKyD2ACULbYmQ=; fh=lma9pIRD6uYVLUAGW/GwvGNaSfQvTp948zgtOh0klTs=; b=ntqmGtdhtuyjWOaCd/1HF+WxxPdyINYsHpdtyTw6tHl54TlTYJbnrulanZ5hkRsRGm 42VSMZ7Z4N+UmtEV6gw09Thv/NdL7TAB17XWdUEZr4DiShqbrSvVP8MFpcBZX14kzKNF 9hO1idhLbOzj0U7aa1xfgqFH6h+rIeK3OpUFOmA5E/JYZlcmex7GMhNv6Hu6ztsXl3TO CunogpyarBfqqYBLdrVna2zdwR2w8ZwRoIRO4ZpqkIoD84yPwu1aawrSlqVWCwzAf/gz sr9maU5c0P2CmWNQiry2Wr+9hMpjePXMkCB9XarSPiLDxSWMeYEk6QBFBgKuxDQDpbxY s8Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@z3ntu.xyz header.s=z3ntu header.b=hqu9RjBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=z3ntu.xyz Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id f9-20020a056a0022c900b006c6b9625350si5732852pfj.281.2023.11.25.04.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 04:08:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@z3ntu.xyz header.s=z3ntu header.b=hqu9RjBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=z3ntu.xyz Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id CA0C780B0448; Sat, 25 Nov 2023 04:07:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232062AbjKYMHZ (ORCPT + 99 others); Sat, 25 Nov 2023 07:07:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232047AbjKYMHB (ORCPT ); Sat, 25 Nov 2023 07:07:01 -0500 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2AA619B1; Sat, 25 Nov 2023 04:07:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1700914026; bh=ghC3Lj4juPjhri9NNx8UZDzafbVL+7tJBOKiMXB0qU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hqu9RjBrkBOvlin79eOVfWRmNUYjkGfyASjVkmOTNQ5teANZtKW5NQaoVNu2zdbqu ZY1+iUwwPL2hb4/yHDS80lE/2qySSKxznoJ4Y6BAz21ogG0QNoCl9ic6z5sMU+/1e3 RozXMWP3bBdtcta8lnIKQvBT8666X0CBrURQlUVk= From: Luca Weiss To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Rob Clark , Will Deacon , Robin Murphy , Joerg Roedel Cc: iommu@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Vladimir Lypak Subject: Re: [PATCH] iommu/qcom: restore IOMMU state if needed Date: Sat, 25 Nov 2023 13:07:05 +0100 Message-ID: <4525320.LvFx2qVVIh@z3ntu.xyz> In-Reply-To: <20231011-msm8953-iommu-restore-v1-1-48a0c93809a2@z3ntu.xyz> References: <20231011-msm8953-iommu-restore-v1-1-48a0c93809a2@z3ntu.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 25 Nov 2023 04:07:59 -0800 (PST) On Mittwoch, 11. Oktober 2023 19:57:26 CET Luca Weiss wrote: > From: Vladimir Lypak > > If the IOMMU has a power domain then some state will be lost in > qcom_iommu_suspend and TZ will reset device if we don't call > qcom_scm_restore_sec_cfg before accessing it again. > > Signed-off-by: Vladimir Lypak > [luca@z3ntu.xyz: reword commit message a bit] > Signed-off-by: Luca Weiss > --- > This patch is required for MSM8953 GPU IOMMU. > > See also downstream sources: > https://git.codelinaro.org/clo/la/kernel/msm-4.9/-/commit/f8464885dafc5b780b > 85de29d92a08c692d3a4d0 > https://git.codelinaro.org/clo/la/kernel/msm-4.9/-/blob/LA.UM.10.6.2.r1-025 > 00-89xx.0/drivers/iommu/arm-smmu.c#L4221-4225 > > Since the compatibles provided by this driver (qcom,msm-iommu-v*) is > only used on msm8916, msm8939 and msm8953, and both 8916 and 8939 don't > have a power domain on the IOMMU, I also don't expect anything to break > there. Hi all, Any feedback on this patch? Regards Luca > --- > drivers/iommu/arm/arm-smmu/qcom_iommu.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c > b/drivers/iommu/arm/arm-smmu/qcom_iommu.c index 97b2122032b2..67abeb02cf53 > 100644 > --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c > +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c > @@ -900,8 +900,16 @@ static void qcom_iommu_device_remove(struct > platform_device *pdev) static int __maybe_unused qcom_iommu_resume(struct > device *dev) > { > struct qcom_iommu_dev *qcom_iommu = dev_get_drvdata(dev); > + int ret; > + > + ret = clk_bulk_prepare_enable(CLK_NUM, qcom_iommu->clks); > + if (ret < 0) > + return ret; > + > + if (dev->pm_domain) > + return qcom_scm_restore_sec_cfg(qcom_iommu->sec_id, 0); > > - return clk_bulk_prepare_enable(CLK_NUM, qcom_iommu->clks); > + return ret; > } > > static int __maybe_unused qcom_iommu_suspend(struct device *dev) > > --- > base-commit: 2933a1156742d8c47550493a77af8e2d81cf3c84 > change-id: 20231011-msm8953-iommu-restore-fabc2e31fee7 > > Best regards,