Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1223365lqj; Mon, 3 Jun 2024 14:16:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWRHmrtY19T0LovDWMxmL7lem+e86ymDhHAsQr/ZGPpAwGhodu9jgdk1wOqDIZ117PYVwlM6aAX/VP9OqKEHBBpeOgWKOpgpOGqdofXLw== X-Google-Smtp-Source: AGHT+IGEwl8JObBgWEzGU17/Ynt31tOMTFLjvJZNvNmlBOZHsSY5zegDGXwp/JxErOo0YJCSsnDs X-Received: by 2002:aca:190d:0:b0:3d1:d201:dfc4 with SMTP id 5614622812f47-3d1e3623129mr8935897b6e.59.1717449408628; Mon, 03 Jun 2024 14:16:48 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b42cc2fsi96564216d6.536.2024.06.03.14.16.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 14:16:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199723-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nxp.com header.s=selector2 header.b=BJt7S5Ir; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-199723-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199723-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4BE8B1C21ECD for ; Mon, 3 Jun 2024 21:16:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D953E13B5A6; Mon, 3 Jun 2024 21:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="BJt7S5Ir" Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2050.outbound.protection.outlook.com [40.107.6.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E4FE20ED; Mon, 3 Jun 2024 21:16:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.50 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717449394; cv=fail; b=lYd4ujIm3DzEGU2TP8dZBqunsYdY2FHV22c4uXPCx3NnYHU6xMV35lz4Bpyy2dhAP3sey1Fsj6bdXSeqUc/UWvqEa9SYBjyc21W9Lg8tHS8ub3gts48OID8ZAO/PzvJ/yChD+MW+glIrPEWKJd0LbizmoXLdtVFJJw5m6gAHdTA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717449394; c=relaxed/simple; bh=EXGsy0HzFQCH8IEfn5CT+s0q9AJXcrQpPpeP3urO9tI=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=oqZmiYJodljdLq8mkcXoMWO7Tmb81q07t4DWPc1N3POIXA0cMvYvzOmg8usRlxxoCI3VaU6tEkmr06HlZjL2wLyHohhkymqOw+xit+D7WbfgNJabMKpeCJpou+4dn6bxUurbLCeQqnSlLlME2JkBxtITu1SGkuW48JKJp2qLNvg= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=fail (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=BJt7S5Ir reason="signature verification failed"; arc=fail smtp.client-ip=40.107.6.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qlkk24PATCgHjh8uMcQnrTdBMhAn7Rib+q4Bfxcdf+KAavYWxIEmXmX+f/bArWcj+2hI3xD3WtGfE8TrGu/ctmsV5pajnWp9ynkZwat59wo8HGf5WYTd8Tff/drb8Da2PQbbpVtGwcRtE6ZJR0Gh3o3QNrAA6QFfGLfZ6CCMrc8XviSxWSSTi+9rCGhBZjMuvtWC6cNMcFCNbz2PPHZcvHCcfVDfRDQUPSef/mBKz5jSG/WGBqgEJkLDb8VK6LsaM/pQs5ih7zueQt3vQt+30wQbrKTBHwbGzRoOGEHqfojYtCTeYUDuZtSX5xMCkUNKfQUuT5//hNhZDEnqrnjAMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=F+HUvH417yxsNvPymRw//vSfa0trcFAW9AJeRoe+wVc=; b=CVr63kFAB00sQZZWt4eQs2oZfANVTSYwvvRUHb07r8k5JUZDrEvFxBDFa5yiMd+NxkCVqTt/EFAlyDQCaKUwUS8bJBhx07SMx6h1bjz2P8gt/5XlULNDIU9h03t6aaVFlpwnQT3D64GPTe9pk+T6YmaE2WayW+hyInniRTxSLj6J4naGrYGcPUazVR7e6I6j7yDx3SAATKj7aQNuJ+RLOu1t8SCurW5Cq+vvT2d/JUuXolkBKE9QvzXcIgMTZsDWNrmDBBmISzqVGTys6rUYZHREE7lQX/p6h0hG1ChDf4mNBiRkTrs3GRrbkRm542vUl6nW6L6qx7eHs2h4SXdZ6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F+HUvH417yxsNvPymRw//vSfa0trcFAW9AJeRoe+wVc=; b=BJt7S5IraN6L5Jsg30WQVmPLzgo3Vt378YMYwMlxvvB4+4HYbYgQQNFOIzRuBgR0V57WncZX72RIFma5J/t2EnP8rJN0g8oPJLFhXOy0ntbZpaa5XBehhpE4qKtMJqSE4+Fz4dd/EO13LyX+zqAl5yMlnG56O62vxpNlGyOXFZE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DBBPR04MB7834.eurprd04.prod.outlook.com (2603:10a6:10:1ee::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.24; Mon, 3 Jun 2024 21:16:29 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7633.021; Mon, 3 Jun 2024 21:16:29 +0000 Date: Mon, 3 Jun 2024 17:16:17 -0400 From: Frank Li To: Laurentiu Tudor Cc: Robin Murphy , Bjorn Helgaas , Richard Zhu , Lucas Stach , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Will Deacon , Joerg Roedel , Jason Gunthorpe , Alyssa Rosenzweig , Marc Zyngier Subject: Re: [PATCH v5 08/12] PCI: imx6: Config look up table(LUT) to support MSI ITS and IOMMU for i.MX95 Message-ID: References: <20240530230832.GA474962@bhelgaas> <974f1d23-aba8-432e-85b5-0e4b1c2005e7@arm.com> <7edbdb11-5135-4f26-be12-c86f4dc4c0ff@gmail.com> Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7edbdb11-5135-4f26-be12-c86f4dc4c0ff@gmail.com> X-ClientProxiedBy: BY5PR04CA0008.namprd04.prod.outlook.com (2603:10b6:a03:1d0::18) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7834:EE_ X-MS-Office365-Filtering-Correlation-Id: 126f7139-19ba-4502-aa6c-08dc84126f5a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015|7416005|52116005|38350700005; X-Microsoft-Antispam-Message-Info: =?iso-8859-1?Q?3E6PZuyg0qYyh4QKEET9mr6KNppzwh9o+tYMMSwrJOS4LktCVYJZaQl1fq?= =?iso-8859-1?Q?+VBks4r/1jaEVrN4NC+Fdzxfz5I2n1afTPxMA88IukLisMfDtr/JNUUfkb?= =?iso-8859-1?Q?WyvH2CH07V5YU3eMqyw2ZaX/M3IlJDJ3whNKgTgek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f2aNbPln5Hi5lKJtTjCvNVEJurq2+90V8bniTnZxV6H9U?= =?iso-8859-1?Q?xx5H41NZ/JHOEUzp1qcPp47Pb15q5tM/9vmQ2P5QJD8vN+++uwHblbJOSN?= =?iso-8859-1?Q?Ra8LKE3HIyFsd98MJiWu3CwGveFRq0XfTDzveqM/Lh/FYmYPe05ivh8MBl?= =?iso-8859-1?Q?3mC9Vtlyc8aD/P3XOH1Mb7tmWHzMdJCBd7h/jm8wQszIv4YL91veVLZ6CA?= =?iso-8859-1?Q?iZXnjGv22ModjyKHCe6cnCbO31zj/6+DWFfcH8TNeHZkltco+acc31/0W1?= =?iso-8859-1?Q?w+Pv4H7EbCCLmmd3Ymwfie/dTSqz89cBXyzXenYr3K8Xn1xmfbzHDS9Nro?= =?iso-8859-1?Q?cfBCuNq6bd?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(1800799015)(7416005)(52116005)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?2siqpxJU1L+p345bKEwa1UvReb6mc3pEyJWq4fFcocEH+YzECO+/52fdn5?= =?iso-8859-1?Q?8sGD0frTh7dqqkSvOFwm6uIpBPx7B+lD9xtHW8WtAlFbShGJndFAGQ7j9V?= =?iso-8859-1?Q?fQHQo1tSM/mb54hOAJpGLU3WvQKIhbtbDVWCP7y7ak4klGCEc+XcWc9AqM?= =?iso-8859-1?Q?Pvl1S48iA4rtj0BrUryH3nkjtzJpG0wdC5NH3RKuEqZYdBDA/1jhRLXtyY?= =?iso-8859-1?Q?E0v80y5W11B3FQrxWABLfYW7ACqobPN8zAEh7+Nao92xscctZV/eNbm0+V?= =?iso-8859-1?Q?ZmQRT/tO5MBHbSAaMu3aJ6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q?22mBebvi66KsogDTXdXew2/pWpyyYOhdUpguKdMuomzZrm8Y+kXqe/Ip07?= =?iso-8859-1?Q?Eo0HFUB0OeH+XMLSX8yep3+Gb2L9xrXMetl3KuMOzT3csRo48shIDRojRJ?= =?iso-8859-1?Q?Zrxz4U2sxMGpLXQ8X7Cp3/mbfRfj7xs+I4iVCfJ1NwSjvZDEUIjbBGycx6?= =?iso-8859-1?Q?w1/Uh15lG61EODI102jOlLwtmnPhr+Za7aZkMn6Wnotb00firU4V6/LFp7?= =?iso-8859-1?Q?DApp0zozxsSRl/XMhLQXr0JPkw1TcbgOrSnKwZ42toYNXPe3k1JT2jvv89?= =?iso-8859-1?Q?gPNsnj6aS2c4M9cE87QMaiwuoAYdXqx8sZObk8Us4tEXoL1imotRHJ0mZ9?= =?iso-8859-1?Q?EksxrTH1Wb1b4cmLU+//JVxBxfg1MuKdFz/JYcKj5ua17HqVtVAOqrKyoJ?= =?iso-8859-1?Q?o4MDD/mbOZNKWL3sqxPka7qqyLoNmiC5Zy?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 126f7139-19ba-4502-aa6c-08dc84126f5a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2024 21:16:29.4786 (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: 2NJ9k7qSbm1dvlMGoS7YPnZBuwq7dB3iReZTnS0vQhnjwOsG8HBqjOSybXt5yrB2YwqLs4nJD7zU+wwskltNLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7834 On Mon, Jun 03, 2024 at 11:29:38PM +0300, Laurentiu Tudor wrote: > > > On 5/31/24 17:58, Robin Murphy wrote: > > On 2024-05-31 12:08 am, Bjorn Helgaas wrote: > > > [+cc IOMMU and pcie-apple.c folks for comment] > > > > > > On Tue, May 28, 2024 at 03:39:21PM -0400, Frank Li wrote: > > > > For the i.MX95, configuration of a LUT is necessary to convert > > > > Bus Device > > > > Function (BDF) to stream IDs, which are utilized by both IOMMU and ITS. > > > > This involves examining the msi-map and smmu-map to ensure consistent > > > > mapping of PCI BDF to the same stream IDs. Subsequently, LUT-related > > > > registers are configured. In the absence of an msi-map, the built-in MSI > > > > controller is utilized as a fallback. > > > > > > > > Additionally, register a PCI bus notifier to trigger > > > > imx_pcie_add_device() > > > > upon the appearance of a new PCI device and when the bus is an iMX6 PCI > > > > controller. This function configures the correct LUT based on > > > > Device Tree > > > > Settings (DTS). > > > > > > This scheme is pretty similar to apple_pcie_bus_notifier().? If we > > > have to do this, I wish it were *more* similar, i.e., copy the > > > function names, bitmap tracking, code structure, etc. > > > > > > I don't really know how stream IDs work, but I assume they are used on > > > most or all arm64 platforms, so I'm a little surprised that of all the > > > PCI host drivers used on arm64, only pcie-apple.c and pci-imx6.c need > > > this notifier. > > > > This is one of those things that's mostly at the mercy of the PCIe root > > complex implementation. Typically the SMMU StreamID and/or GIC ITS > > DeviceID is derived directly from the PCI RID, sometimes with additional > > high-order bits hard-wired to disambiguate PCI segments. I believe this > > RID-translation LUT is a particular feature of the the Synopsys IP - I > > know there's also one on the NXP Layerscape platforms, but on those it's > > programmed by the bootloader, which also generates the appropriate > > "msi-map" and "iommu-map" properties to match. Ideally that's what i.MX > > should do as well, but hey. > > That's usually fine, except when SRIOV and/or hotplug devices (that is, not > discoverable at bootloader time) come into play. We came up with this > "solution" to cover these more dynamic scenarios. > > https://source.denx.de/u-boot/u-boot/-/commit/2a5bbb13cc39102a68fcc31056925427ab44b591 If my understand is correct, basic it was still pre-allocate method. Just reserve more streams id for SRIOV and hotplugs. It was not really depend on what devices in system. Frank > > --- > Best Regards, Laurentiu > > > > There's this path, which is pretty generic and does at least the > > > of_map_id() part of what you're doing in imx_pcie_add_device(): > > > > > > ???? __driver_probe_device > > > ?????? really_probe > > > ???????? pci_dma_configure?????????????????????? # > > > pci_bus_type.dma_configure > > > ?????????? of_dma_configure > > > ???????????? of_dma_configure_id > > > ?????????????? of_iommu_configure > > > ???????????????? of_pci_iommu_init > > > ?????????????????? of_iommu_configure_dev_id > > > ???????????????????? of_map_id > > > ???????????????????? of_iommu_xlate > > > ?????????????????????? ops = iommu_ops_from_fwnode > > > ?????????????????????? iommu_fwspec_init > > > ?????????????????????? ops->of_xlate(dev, iommu_spec) > > > > > > Maybe this needs to be extended somehow with a hook to do the > > > device-specific work like updating the LUT?? Just speculating here, > > > the IOMMU folks will know how this is expected to work. > > > > Note that that particular code path has fundamental issues and much of > > it needs to go away (I'm working on it, but it's a rich ~8-year-old pile > > of technical debt...). IOMMU configuration needs to be happening at > > device_add() time via the IOMMU layer's own bus notifier. > > > > If it's really necessary to do this programming from Linux, then there's > > still no point in it being dynamic - the mappings cannot ever change, > > since the rest of the kernel believes that what the DT said at boot time > > was already a property of the hardware. It would be a lot more logical, > > and likely simpler, for the driver to just read the relevant map > > property and program the entire LUT to match, all in one go at > > controller probe time. Rather like what's already commonly done with the > > parsing of "dma-ranges" to program address-translation LUTs for inbound > > windows. > > > > Plus that would also give a chance of safely dealing with bad DTs > > specifying invalid ID mappings (by refusing to probe at all). As it is, > > returning an error from a child's BUS_NOTIFY_ADD_DEVICE does nothing > > except prevent any further notifiers from running at that point - the > > device will still be added, allowed to bind a driver, and able to start > > sending DMA/MSI traffic without the controller being correctly > > programmed, which at best won't work and at worst may break the whole > > system. > > > > Thanks, > > Robin. > > > > _______________________________________________ > > linux-arm-kernel mailing list > > linux-arm-kernel@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel