From patchwork Tue Oct 15 03:14:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13835691 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0D06D1627F for ; Tue, 15 Oct 2024 03:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0OAVDj4lxiUm9B2gMs19l7f2hsZrxwWooSsM29M+/kI=; b=W5mPrUdm7GEDP1jLLukZ0gdWyX pmMgWgdy82x3hvZJ5/DkiTPtlj39+w4bCNR6BKMruN1izAl9WhMmfhgolztnCijktD8T5mBeu7Og1 uvF9O+yTbs5XIPYFDnyER4wlr7EoAaRtVilsOZ65GWEolIdAZ4zy3dOmxd6EMcJHf4m191iXQUBsp x1kyMNB6T8UCBZCP+G/nwVjBXuTBPB7OkfE9NYWQAuUHkLFOeZ9Y+aNmQs/WvUi1r2NCt+4a81ngU fO3LEPWJCmN6aGVuEqufGX1XqhevcWYuh/Sm9CU7GQJQ1GYS2A9p7QqWtAklVHhCz9qJ4l/yRXkPi /t5w2F0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0Xx6-00000006xWE-0wsm; Tue, 15 Oct 2024 03:10:28 +0000 Received: from mail-db8eur05on20609.outbound.protection.outlook.com ([2a01:111:f403:2614::609] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0Xt0-00000006x5F-3TAo for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2024 03:06:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LBm3pusfHiS9FAIlz2hn6Rf94xSDPZ5wno6iF2wbILYP18FteDcuir6NMclV6/UhwnRpFthAVq6UHOgopEQikFxBNIU4SuMp2vbGBncJ0NjZLSSxOF/CL78gV+HIrKthS21Ds1agkx+jzcF79NX2gC8KzERTFhrUporSG5PDOLko4h1PBgilJAR5zm51K2bBC7B5A1TqQ8+HWA3d6v67389uON+dO7IVsY2ozpnub8QNTsOl4tIPQD7ypM2pBp2qEM8LKTrvmHgQjqACxxUTutc2qNHY33WeMTbxu5++yEhb9XCRSsjoi+dXNxsW7TNZypQ2YpY0Xdc9QZNoG+DqbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0OAVDj4lxiUm9B2gMs19l7f2hsZrxwWooSsM29M+/kI=; b=DNQVq0WJU4dMqF0lMzAcWSS9bLkg0y6GUzXxCMRFaVY7r/44VEulBG6IaiOk05+/TK5LSR5430lpJbC73wQhx8jlFccOWiXYiPvRVgY0PZpYGixejrjbwTZVAErjJ//ZJFr3XEeSby3XzsnzA+AygqzZZv+Ik6TiLztCIT4TXvoeIeqCMmyVKuPsNDfA6fd83WyemLLKic2ZOQCRh0lWbv7MmfYyZYTtGJYjzOtv1afrcE1Il6d+IIz5lSD+GycEoEayrqQkBWcmv0g7YJULNRh9+pC6MrpT2zzFBImenKqTB2vf3BqGZpKbbvwWI4vmdoJYnMpItqcvLuGZwfQLtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0OAVDj4lxiUm9B2gMs19l7f2hsZrxwWooSsM29M+/kI=; b=NYBVWvxIoN+5VTh07EpQXaa5hAJF8yK2lsCsNVEoPu4Lt2TYPAmfQ5+PCsFCHvsTTSjUrBduobFGRPcS7sLk98gEjnHJOgBzYp7+mfif5JGm0vQzhx0zIxlAgu5pbxTVH6AaoJM/aVdHn9A0DhglV31fS0SF9aX7c8riAm2SUThO7c+1gRxurYxy0FQbLWVdCDGZowURyPX4IcGcdUm28feEvXfA78EAwxFrWfz+Sg8AvzAAe+cfTrOxi71EuZrV68XMCCDMN3kBms2DoZsdqFcGmff/vT7Z3q6FlVSMyINbU4MtVbOrHL3xxydkSN0Qf8CnJy6NImCvk5dyIUaM2w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by AS8PR04MB9173.eurprd04.prod.outlook.com (2603:10a6:20b:448::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 03:06:12 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%5]) with mapi id 15.20.8048.020; Tue, 15 Oct 2024 03:06:12 +0000 From: "Peng Fan (OSS)" Date: Tue, 15 Oct 2024 11:14:43 +0800 Subject: [PATCH RFC 2/2] iommu/arm-smmu-v3: Bypass SID0 for NXP i.MX95 Message-Id: <20241015-smmuv3-v1-2-e4b9ed1b5501@nxp.com> References: <20241015-smmuv3-v1-0-e4b9ed1b5501@nxp.com> In-Reply-To: <20241015-smmuv3-v1-0-e4b9ed1b5501@nxp.com> To: Will Deacon , Robin Murphy , Joerg Roedel , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Joy Zou , linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Fan , Jason Gunthorpe X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728962092; l=2967; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=lDCDQiGPOSRXc7ev1dUa1F8oSAhBoTCxcJi2puh3lOw=; b=fIWBFLYMswv9hNrVHTz6dQ2yEimP0aeNQGlcDp3joMWgSJ2N62QpiooFtiRX86YTStp97zcmQ zoR15HltTAFAGM0jrzS5kH9Hvz/JgRMXprlCNpIyzeRTyM+L8m3uMv+ X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0026.apcprd02.prod.outlook.com (2603:1096:4:1f4::11) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AS8PR04MB9173:EE_ X-MS-Office365-Filtering-Correlation-Id: 35428267-57f9-435e-7815-08dcecc65321 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yVgdkOn0QVFzy+ZrgCPPheWb+oTtcGE?= =?utf-8?q?UuKoXLmlnXVALJyQt9Mp/bA5rLC9TCYeuldOc+t3oLKgnHJApsJ6I4MyET255HhVp?= =?utf-8?q?Ub4SMTWH6CNIR+9VUUHdHIv7K7gTza/JCdUaVF8dj6H2MtxuXnaCdS+aE1s0G6RSY?= =?utf-8?q?OudQq2fTARMIdHdt5+MdP0vK4PEDDV+ZdG/b9WrIDPh3hgYkJXPZgT+u+4w5MVihA?= =?utf-8?q?LpoTZIfpUtbUmM8x4LLPuDH5QUmVDQbMjfA6YXMXi7vJc8q8OhXSGAKHuMGE0F78k?= =?utf-8?q?LsjG89MfwPpiXXTvl9R5v/xm2A3bIrDO9BrKyE1+00fef0/YRI1QfgzBVV8+Ged4n?= =?utf-8?q?cg9Ow2AziekNsg7v+NDSz9Q/J+N0/nUx/2mNtxcTlA4Z/brfKeV9Chav+AJBdXPSR?= =?utf-8?q?Mh9aFw5xlj7h6iXWsaUuh2Ws9f+LiNCZQW3wRBVxMy52AX/ezZQ08zH4TbarQxfCs?= =?utf-8?q?Pq+tWBBj+u4zcvjvF1yJuw9OLM50C/NQvfDiWRAlvoeniVDtg5PH9rPCvfOzCtRot?= =?utf-8?q?mhyC7QkzSlAjWObIiD89aWvymINxBfbmHR6c8iuk9em9Orzei3duPBz/NNmywUWOU?= =?utf-8?q?RhOoX2+29/fE8ykyHwBzvy9BXGZRI6iVWZhgqoFvlaqc+3jbZQZVsYAjWiTgiHkhw?= =?utf-8?q?B/NrgORYNZ0ocLKnM5wdOTbQyZaXHTrahceF9C1qpdQTkTnWDdcqNr8nlBCEbniiX?= =?utf-8?q?d/XVNV94zOBg3BjmrL/n5ye4MB2sq5aPS77jTrLViTwjTjUPi9m60pBvb0CMcrv3d?= =?utf-8?q?1KHNt0njyOSOekpZlW/1Zpw039DTnGqKKOUj0FzYAcfUD3TlIwX7Nkq/VIAMhmQ3J?= =?utf-8?q?9K7LnVqsWF4+uvRfel8qfDMnJRrXzRr2JRcHjqgGTIkepDMcARLo0srjBvseiN443?= =?utf-8?q?ILBOsdAxZ1gIZYwam8LzNhgsTTLKiYCmajaDPV6NE7xDkUE8DqFagxmBz9QZQxYsM?= =?utf-8?q?PKpnxci2b/Q8JlNOyoHIOicfvc0N7OXy5Z7iNTusFxjFLcZModWmlz1aKXqWXnYPZ?= =?utf-8?q?9lm4axfgdfr6nd1nuOdGFCVufLDRzbBnhfo3CG8aEGQaSBqJBEuY5aCDGRo8FGKTV?= =?utf-8?q?7eo5XeUdAuhEtQIlIs32jqRcYhjSU5qyIOet96Lrpb4eA5IGPd6jN2hdFz5lnTjQ1?= =?utf-8?q?l+30FgtyZ/Ekv4lQjHLTzVm9vob45Su6cGhp+Z3SSzr6bRQpZNXFRD/5TSVZHV6Li?= =?utf-8?q?RUZqUxqok1e2JwOiO9+ZvYoIyjZ7BuPswUT++CJGN1tLZDUpLG9e27c/Z/If9THf3?= =?utf-8?q?ytktiTYlnzvx39uqa8IMYf4qnxuJSU7CYBw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?NUIXAlyA5PcuyjvG/tYjobcDd+j/?= =?utf-8?q?CTlUylq3GOCdUZMpGlEv8q6Vlc54D9ua8RqyX2l0FQlY04K7pZqmo1KZ6oZtmh141?= =?utf-8?q?7QsyEf2p/5opwgt0mkvUVpySvHmuvSqoPnm1P4axylwtm8/1MlvmgqR9cM/4ydIMf?= =?utf-8?q?d9WZrgfpTV56n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Y/46ovzYGri2jvIRpAzE0OPqsiI30z0msTu/ptN?= =?utf-8?q?FFg9fi6+L9NJjKrDJSKab2f8vANTvJWsGutF5aFbgPCxVDaLf0X8+AXzszLEGf4yp?= =?utf-8?q?uCcMC+guZMot0HmXqThSuNPiJk8atoqzisxcielujAgy9RzXfGco5A7HG4M2t9ko4?= =?utf-8?q?FulZBPfabxITOK8+qkLGbEvqo1w5a0XopMJk8jmki55Xj2fCftxZ6SnP/dvlZy8dQ?= =?utf-8?q?pHyYlGGSLlM2jvbt3zrVC+HpuPKvCUWkNCbWlZToQkPhzUwe5yhIvWAp2Eg8YnfId?= =?utf-8?q?zeViGR2grtbJOuK82R3yJV9G5Y8supJ9ukBfW3z1fq4ZHVWNfHW9fs8PQqfkbB5Cv?= =?utf-8?q?Po+PI3sUhDtRgHBOutI7ivpoOlTd/R/OWc+rYeVnPwNd94VAIvFuMuWBt0q6Jrlvj?= =?utf-8?q?3M/0HyAx9K+AL6Cn+aUZXwhcoKCxLuO20u72hBinaEo4X4j1s2HqUTJmsy3eWl8uC?= =?utf-8?q?2mYMn3N3rfs1?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35428267-57f9-435e-7815-08dcecc65321 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 03:06:12.3182 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SYmwQJ+52sG1WJgM+Sjsj5RDY5xUkGCwNbpj+zbM3wxzGxGM1NiHGsZWUUXXImWDhdhlXULUMW8z6Z9B0PpbaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9173 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241014_200614_911073_739A2CE3 X-CRM114-Status: GOOD ( 15.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan i.MX95 eDMA3 connects to DSU ACP, supporting dma coherent memory to memory operations. However TBU is in the path between eDMA3 and ACP, need to bypass the default SID 0 to make eDMA3 work properly. Signed-off-by: Peng Fan --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 19 ++++++++++++++++--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 737c5b88235510e3ddb91a28cecbdcdc14854b32..3db7b3e2ac94e16130fc0356f7954ffa1a9dfb33 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -80,6 +80,7 @@ DEFINE_MUTEX(arm_smmu_asid_lock); static struct arm_smmu_option_prop arm_smmu_options[] = { { ARM_SMMU_OPT_SKIP_PREFETCH, "hisilicon,broken-prefetch-cmd" }, { ARM_SMMU_OPT_PAGE0_REGS_ONLY, "cavium,cn9900-broken-page1-regspace"}, + { ARM_SMMU_OPT_IMX95_BYPASS_SID0, "nxp,imx95-bypass-sid-zero"}, { 0, NULL}, }; @@ -4465,7 +4466,7 @@ static void __iomem *arm_smmu_ioremap(struct device *dev, resource_size_t start, return devm_ioremap_resource(dev, &res); } -static void arm_smmu_rmr_install_bypass_ste(struct arm_smmu_device *smmu) +static void arm_smmu_install_bypass_ste(struct arm_smmu_device *smmu) { struct list_head rmr_list; struct iommu_resv_region *e; @@ -4496,6 +4497,18 @@ static void arm_smmu_rmr_install_bypass_ste(struct arm_smmu_device *smmu) } iort_put_rmr_sids(dev_fwnode(smmu->dev), &rmr_list); + + if (smmu->options & ARM_SMMU_OPT_IMX95_BYPASS_SID0) { + int ret = arm_smmu_init_sid_strtab(smmu, 0); + + if (ret) { + dev_err(smmu->dev, "i.MX95 SID0 bypass failed\n"); + return; + } + + arm_smmu_make_bypass_ste(smmu, + arm_smmu_get_step_for_sid(smmu, 0)); + } } static void arm_smmu_impl_remove(void *data) @@ -4614,8 +4627,8 @@ static int arm_smmu_device_probe(struct platform_device *pdev) /* Record our private device structure */ platform_set_drvdata(pdev, smmu); - /* Check for RMRs and install bypass STEs if any */ - arm_smmu_rmr_install_bypass_ste(smmu); + /* Install bypass STEs if any */ + arm_smmu_install_bypass_ste(smmu); /* Reset the device */ ret = arm_smmu_device_reset(smmu); diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h index 1e9952ca989f87957197f4d4b400f9d74bb685ac..06481b923284776e7dc4f3301e5cbe8ab7869a9c 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h @@ -733,6 +733,7 @@ struct arm_smmu_device { #define ARM_SMMU_OPT_MSIPOLL (1 << 2) #define ARM_SMMU_OPT_CMDQ_FORCE_SYNC (1 << 3) #define ARM_SMMU_OPT_TEGRA241_CMDQV (1 << 4) +#define ARM_SMMU_OPT_IMX95_BYPASS_SID0 (1 << 5) u32 options; struct arm_smmu_cmdq cmdq;