Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3118440rdh; Mon, 27 Nov 2023 06:56:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPzcztXe4DoOIrFdHKkj0lufMX9roxHMJ0rp19Qkuc/ALyZ/n535F7+pk2ecb+nDB1FNmo X-Received: by 2002:a05:6808:120d:b0:3b8:79a8:cc7b with SMTP id a13-20020a056808120d00b003b879a8cc7bmr1618024oil.16.1701096974276; Mon, 27 Nov 2023 06:56:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701096974; cv=none; d=google.com; s=arc-20160816; b=ibBVroxr8UOC++u1maXA1TnWeGHgeyqkW1PJxerse50NS5EXYy/7V4oSeBJxaHvHHQ zDynmojARKdkpCQKar6259fOoLiDE4b11ypua9Kpqp3V4O6Z3tAJYanEroAyVVU9QKrt VoTiWkJ/qSYQ2MyLMLhe9No+fJ+qsulrQRoNReBFiuOSE6ICHK3QOdCS11FdyTbpAUxI aukTS6PA0BSZS2YoHqhDvRJjUBUu7NpXt4OUAO+8GqSIwcWcUVv6z0FqhkB66uYm4gru HXgCKODbHH7HNZgW0XucvriJy+bPzJV6XfUWFCXEQA9suvG7AheOIxUYBIpQ3+m/DbJc wk5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5w8AVM6ZRZcbTx9e/Vp6YkCqKtNMrWDc3V+eTYGPBek=; fh=9Sx/iPMpOkBL6I/W3pWVvXA2h5a4HkJEiZWEztvTp5I=; b=sG407BZsFhabc1DyKJnRRZPbkTa6KpXHhZtG/1FEoLJEuNqhhXLjnx1ZmcC4F4GMCs jSqUiaCKGuoFzVuaDD4fi/GWYvgvIe8FB5QNd2Ck3/+5wBn01FOTa4QhZcjJMjShY/Zw S2JYhWB12cq0XWWPa6ME2UTdFV/b1LBLoaKoUR1bdIweSjgMyd+SUjkrsxI/TUC/gcTJ zy2bV50t3H0bod4sGvuY8FC85ZAN/mcRCUHIa4zeBafFeFQfWVte17bzWaQFCQdXQOlL kY8ZI1F3BPlgtAl83egH9hyy668KpAvg4r5ZycsG3W6zFHwP9oxZWSOfWjgrgxRanAD2 90Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IXnyBvPp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id e23-20020a63db17000000b005b7ce261d0dsi9632302pgg.402.2023.11.27.06.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:56:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IXnyBvPp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id C436D8020680; Mon, 27 Nov 2023 06:56:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233867AbjK0Ozd (ORCPT + 99 others); Mon, 27 Nov 2023 09:55:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233813AbjK0OzX (ORCPT ); Mon, 27 Nov 2023 09:55:23 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03B1010CA; Mon, 27 Nov 2023 06:55:24 -0800 (PST) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ARDX4C9025349; Mon, 27 Nov 2023 14:55:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=5w8AVM6ZRZcbTx9e/Vp6YkCqKtNMrWDc3V+eTYGPBek=; b=IXnyBvPp+Wc9YNNhrklUpuYNKFbE9z71+ObmkzDuEg0IE+AOKgqHzkqbTJ9FRxYrQauD A8avsA7j+UdZnF8KIBD4zMeS+dgCgSiSLAFHMnI83Gz+HwY78yfoKLGnicz3iSIO/yYC eVpVLrTid9l0+7mCMN2frUTtqOCsPGJoXNLx7JQqfHiBTWY1hY+Z2GDSPcNwy5jvLoKb 5p0OC5heWBGBHqsYkBArEpWGxwVnmZbrvs1d7xl1Ja83dwSjwjrdan8/Lmu4eRAoXpPc DSN62a6RuMCT29Vroy0uM1yFG4gBQYdotjbL3rctnINC+jo8JCelAW3LLMJAJmuzS4m3 lw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3umt4qgjfw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 14:55:05 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AREt4sl004534 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 14:55:04 GMT Received: from hu-bibekkum-hyd.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 27 Nov 2023 06:54:58 -0800 From: Bibek Kumar Patro To: , , , , , , , , , , , , , , CC: , , , , , Bibek Kumar Patro Subject: [PATCH v3 4/4] iommu/arm-smmu: re-enable context caching in smmu reset operation Date: Mon, 27 Nov 2023 20:24:12 +0530 Message-ID: <20231127145412.3981-5-quic_bibekkum@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231127145412.3981-1-quic_bibekkum@quicinc.com> References: <20231127145412.3981-1-quic_bibekkum@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: _Yu8egJUf_Dh3CRpUn-cVfT1UcUWDUfJ X-Proofpoint-GUID: _Yu8egJUf_Dh3CRpUn-cVfT1UcUWDUfJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-27_13,2023-11-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311270102 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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 27 Nov 2023 06:56:11 -0800 (PST) Default MMU-500 reset operation disables context caching in prefetch buffer. It is however expected for context banks using the ACTLR register to retain their prefetch value during reset and runtime suspend. Replace default MMU-500 reset operation with Qualcomm specific reset operation which envelope the default reset operation and re-enables context caching in prefetch buffer for Qualcomm SoCs. Signed-off-by: Bibek Kumar Patro --- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c index f0ad09f9a974..2c676a09fa31 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c @@ -512,11 +512,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); /* * To address performance degradation in non-real time clients, @@ -543,7 +560,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, }; @@ -568,7 +585,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