Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3353473rdb; Thu, 16 Nov 2023 07:25:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbuIKEMPPKHKeYqLlqygRWJ3TLHMHRnkOYJ2CrbWrcObL3LfwVq/325Ko5gPqx/K2OvQ2R X-Received: by 2002:a9d:6741:0:b0:6d6:3fca:db0c with SMTP id w1-20020a9d6741000000b006d63fcadb0cmr10039233otm.18.1700148321921; Thu, 16 Nov 2023 07:25:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700148321; cv=none; d=google.com; s=arc-20160816; b=SVL8rqyK9AtH4Dafyadn9nc8i8NlNIdKi7ss41bGIFA4EcxdhpEr0wCveutC2JPwNM JonSsbE2ykOh5ZHqaXl7sXVReeWyAHLIRPEB1AB8TqpFkpTz5ixVC1643n3CZbmmgH8C lNlyNkfj8oxvuA3jvWLs84EqS4ZZdVfKeEoLYmoQly5nSCczwP++qPQ5GWcZ19Tt7bb9 U4kwk1ZtSPhaV91Wo65m0j6mugRApPWrXCoiqVHr7HHqqNcOXHxiYsyb8uzc4w5GQDxN dS3xICWu8bnqQk+XSCsiHvKw8+nxsYEcSLyB4q8IqGN9IroKRQAzIVciP8yP5JMHI9Sm D60A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Yoms34FsK4SCyToEqB/I9dPW/3PKklM8+dwv2tCvAnA=; fh=TZiEND9oy13nw8GkO1NM91EM1mr4eT9e+EFpfAkiP64=; b=tjUfcIN8DeZx+fQLOHqDMaJFwZ57v7aq+/NUWvwHpanVz2SoK07Kt2u1/imCEUHxvY Yf9qy91E4EozSjVIVHPdWgKRyHKpLUF5oWFf9EYFb8r7j6icYsZJ47G5ydju2Gy9RCUx yiJlR/h8TfuA4iLJzLNbSYGmrvpe4X6UGZT1UR6evJ6qFbaeXdK8+b/y4CIpUkUmxxZJ GYZiiVEP4cXaytb/2avfgKHpdr5yJidkF6reb7g32+msGPGevWktJlQWStYKyDEBsGbr +7z3wkjXoy8Qmgwy+2kiMKLcqeCySDXsKGr/0XKDjorMIJ9eEnz31hI1c6m0oLdc89Sk nUuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lb7MCzE0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p24-20020a9d7458000000b006d6452e9a38si4458053otk.230.2023.11.16.07.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 07:25:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lb7MCzE0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 422A480295BD; Thu, 16 Nov 2023 07:25:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231142AbjKPPZR (ORCPT + 99 others); Thu, 16 Nov 2023 10:25:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229996AbjKPPZQ (ORCPT ); Thu, 16 Nov 2023 10:25:16 -0500 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA5FE1AD for ; Thu, 16 Nov 2023 07:25:11 -0800 (PST) Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-d9caf5cc948so882911276.0 for ; Thu, 16 Nov 2023 07:25:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700148311; x=1700753111; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Yoms34FsK4SCyToEqB/I9dPW/3PKklM8+dwv2tCvAnA=; b=Lb7MCzE0SxQ3Ua3/bPJ4EVpPMCcmzztOlY0013ddU4Al9iXQQbpuXVgXUixbxW4a/h KR7RatDMtKTrx0fZ0uzeR7BLOnTySJxomDXdTTmF7J7gpo3XTFWuIdgOdI3E4QjrULtL uwUFanfcu4LqGFC7ZJvZ4PuDXs7/68OKyOiMdBSHMqpAh/cwWcbR3hwW8gvRa3hGPPWC LAe8uUQ2wC9K9t3HFP2JS9W0/K6/0yus1cY0CVVpSwuFdhWXWvVxGa/a3TvSEHdp9jb2 RQ60i1JtqurM5JkymGQ4Mli8xzrOvXjHh87YT9YqCq98pJCGy0l0jGLRp/Ab+MKg+kK7 WCag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700148311; x=1700753111; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Yoms34FsK4SCyToEqB/I9dPW/3PKklM8+dwv2tCvAnA=; b=soab2JAf7TVETXbCAuI6PyQD+u/HWuOgj7fYTHv7YIsxgGaI+ERbVCTtjWcT49g5id 3eoC/DzOWcLHMi9gRq6DDexJmolxDdDorHhJToHI6kB5kR+V/DOQo8H7hn4jhOQG8TBf EMZoGlSShzxbiTsL4GCfkPCfa1YxT8qufvY5S8ZmuBrEb77tmKBzndQD8WE4m74gjZE1 IqNB2glP2ZPvw7wKq2X/UC4kpNOnTpoQVIe6dMyGDr8+XjBk3VgvmuhOWVAUxxJB/kBJ 2N2RO6sAfOVlA1aGNxdERSeU4WmxFg0/l4QB502laJnVW8RqMcKEPyw4vNFipk2mXj6w Ksdw== X-Gm-Message-State: AOJu0YzE2gzjBx1ET8pQPJRy+wlnhLQ74RxtM3rCFOp6VJUfrjM2oFdP cVdLNM337cCpX/9kzfqCcC1Z8SJo+RERY60gp+9URg== X-Received: by 2002:a25:e751:0:b0:da0:514a:8f42 with SMTP id e78-20020a25e751000000b00da0514a8f42mr14661508ybh.32.1700148311009; Thu, 16 Nov 2023 07:25:11 -0800 (PST) MIME-Version: 1.0 References: <20231114135654.30475-1-quic_bibekkum@quicinc.com> <20231114135654.30475-4-quic_bibekkum@quicinc.com> <72b30354-0497-45cf-8b71-e4f265eb0005@quicinc.com> <0d290a5c-081f-4dfa-af9a-b061e6134662@quicinc.com> In-Reply-To: <0d290a5c-081f-4dfa-af9a-b061e6134662@quicinc.com> From: Dmitry Baryshkov Date: Thu, 16 Nov 2023 17:24:59 +0200 Message-ID: Subject: Re: [PATCH v2 3/3] iommu/arm-smmu: re-enable context caching in smmu reset operation To: Bibek Kumar Patro Cc: will@kernel.org, robin.murphy@arm.com, joro@8bytes.org, a39.skl@gmail.com, konrad.dybcio@linaro.org, quic_pkondeti@quicinc.com, quic_molvera@quicinc.com, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, qipl.kernel.upstream@quicinc.com Content-Type: text/plain; charset="UTF-8" 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 16 Nov 2023 07:25:20 -0800 (PST) On Thu, 16 Nov 2023 at 14:45, Bibek Kumar Patro wrote: > > > > On 11/15/2023 4:33 PM, Dmitry Baryshkov wrote: > > On Wed, 15 Nov 2023 at 11:45, Bibek Kumar Patro > > wrote: > >> > >> On 11/14/2023 7:45 PM, Dmitry Baryshkov wrote: > >>> On Tue, 14 Nov 2023 at 15:57, Bibek Kumar Patro > >>> wrote: > >>>> > >>>> Context caching is re-enabled in the prefetch buffer for Qualcomm SoCs > >>>> through SoC specific reset ops, which is disabled in the default MMU-500 > >>>> reset ops, but is expected for context banks using ACTLR register to > >>>> retain the prefetch value during reset and runtime suspend. > >>> > >>> Please refer to Documentation/process/submitting-patches.rst and > >>> rephrase this following the rules there. > >>> > >> > >> Noted, will go through the description once and rephrase it > >> in next version complying with rules. > >> > >>>> > >>>> Signed-off-by: Bibek Kumar Patro > >>>> --- > >>>> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 25 ++++++++++++++++++---- > >>>> 1 file changed, 21 insertions(+), 4 deletions(-) > >>>> > >>>> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c > >>>> index 0eaf6f2a2e49..fa867b1d9d16 100644 > >>>> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c > >>>> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c > >>>> @@ -478,11 +478,28 @@ static int qcom_smmu_def_domain_type(struct device *dev) > >>>> return match ? IOMMU_DOMAIN_IDENTITY : 0; > >>>> } > >>>> > >>>> +static int qcom_smmu500_reset(struct arm_smmu_device *smmu) > >>>> +{ > >>>> + int i; > >>>> + u32 reg; > >>>> + > >>>> + arm_mmu500_reset(smmu); > >>>> + > >>>> + /* Re-enable context caching after reset */ > >>>> + for (i = 0; i < smmu->num_context_banks; ++i) { > >>>> + reg = arm_smmu_cb_read(smmu, i, ARM_SMMU_CB_ACTLR); > >>>> + reg |= CPRE; > >>>> + arm_smmu_cb_write(smmu, i, ARM_SMMU_CB_ACTLR, reg); > >>>> + } > >>>> + > >>>> + return 0; > >>>> +} > >>>> + > >>>> static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu) > >>>> { > >>>> int ret; > >>>> > >>>> - arm_mmu500_reset(smmu); > >>>> + qcom_smmu500_reset(smmu); > >>> > >>> Is this applicable for sdm845? For all other platforms supported by > >>> qcom_smmu_500 implementation? > >>> > >> > >> In arm_mmu500_reset operation drivers/iommu/arm/arm-smmu/arm-smmu-impl.c > >> CPRE bit is reset for all SoC based on mmu500 platform, hence for all > >> Qualcomm SoCs including sm845 we are setting back the CPRE bit. > > > > The errata for the CoreLink MMU-500 requires CPRE to be disabled for > > all revisions before r2p2. Do we know whether these SoC used CoreLink > > MMU-500 and which version of it? > > > > Just checked all these SoCs are using r2p4 revision. > So CPRE needs to be enabled back here then? can be enabled, yes. > > >> > >>>> > >>>> /* > >>>> * To address performance degradation in non-real time clients, > >>>> @@ -509,7 +526,7 @@ static const struct arm_smmu_impl qcom_smmu_500_impl = { > >>>> .init_context = qcom_smmu_init_context, > >>>> .cfg_probe = qcom_smmu_cfg_probe, > >>>> .def_domain_type = qcom_smmu_def_domain_type, > >>>> - .reset = arm_mmu500_reset, > >>>> + .reset = qcom_smmu500_reset, > >>>> .write_s2cr = qcom_smmu_write_s2cr, > >>>> .tlb_sync = qcom_smmu_tlb_sync, > >>>> }; > >>>> @@ -528,7 +545,7 @@ static const struct arm_smmu_impl sm8550_smmu_500_impl = { > >>>> .init_context = qcom_smmu_init_context, > >>>> .cfg_probe = qcom_smmu_cfg_probe, > >>>> .def_domain_type = qcom_smmu_def_domain_type, > >>>> - .reset = arm_mmu500_reset, > >>>> + .reset = qcom_smmu500_reset, > >>>> .write_s2cr = qcom_smmu_write_s2cr, > >>>> .tlb_sync = qcom_smmu_tlb_sync, > >>>> }; > >>>> @@ -544,7 +561,7 @@ static const struct arm_smmu_impl qcom_adreno_smmu_v2_impl = { > >>>> static const struct arm_smmu_impl qcom_adreno_smmu_500_impl = { > >>>> .init_context = qcom_adreno_smmu_init_context, > >>>> .def_domain_type = qcom_smmu_def_domain_type, > >>>> - .reset = arm_mmu500_reset, > >>>> + .reset = qcom_smmu500_reset, > >>>> .alloc_context_bank = qcom_adreno_smmu_alloc_context_bank, > >>>> .write_sctlr = qcom_adreno_smmu_write_sctlr, > >>>> .tlb_sync = qcom_smmu_tlb_sync, > >>>> -- > >>>> 2.17.1 > >>>> > >>> > >>> > > > > > > > > -- > > With best wishes > > Dmitry -- With best wishes Dmitry