From mboxrd@z Thu Jan 1 00:00:00 1970 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 A5480C25B75 for ; Mon, 3 Jun 2024 17:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=VYPLZzraLyktEJm4LLP0wYPhJOsBmzPMUlrAVI9sbAQ=; b=pijvfVfeD1W07J 2OXUChvfXnt7kWbgesc/mSD8iblDqRt5zMi8yBURWtnZ63GeN7ijU9G4caDhk7OcP9NWNopA81ABQ KDPQpH9O4vwLD4tzSYpuMbDNn6Wc+nyMUZTQEMom8EKuFSzIDuZ1JURksrhRYnXhKAZuGI/vDp5ld 7Qj5OWOj2Vm1hBnzFzMNWsCoOLuU37Hml88+uhxhZ7My5tALVYDPcmt8A0FuXNLhZDrckUSNv2wrR NMXBkds3IyLpb2F9DfTiaHYgoiGxz99dZiHhxNvWoMVnVNgmnIXwc9wheaHlPIX5egKkAvFgDMVRB ETnJVQG/j1mME2GK/k8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEBE3-0000000HTE4-0LXp; Mon, 03 Jun 2024 17:12:03 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEBDz-0000000HTCm-46xE for linux-arm-kernel@lists.infradead.org; Mon, 03 Jun 2024 17:12:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 23272CE0E51; Mon, 3 Jun 2024 17:11:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09183C2BD10; Mon, 3 Jun 2024 17:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717434711; bh=i4qNqKBBW9MS/3cabi3B6YUjPjcvwTN3tabqpknsbok=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=IskPVtkRLcXqswqt5Z9Yt26xtJugDU7NoYLA91Xz03aHeSf/68YOcGpeyet22K/uN CGJKU4Ax6gmVP+obsNuJYi7dLS8e9l6ikQQ90IkHuNMKf5SoHLo9nE+NfggMAjev9k U/byZZkYySDjwi0TZ3xGln2UbTSnd5sfIZMNIHEm1GRs4/LSVHe5Opn7S+l9+0cJK+ mu+RXG9X3oFm5sXPwDXDSO7oeIVGdYZuNtdGN8PCh3PaFXdZdk/c/pFAyZL7vdowqb +kmhi3NJoYyTFwyIQFYsz8d2bophoijGhIb0k4JqhWe7qCwFI7ZEmhzsRxx1OVoR8l yfQkIEXIb7H5Q== Date: Mon, 3 Jun 2024 12:11:49 -0500 From: Bjorn Helgaas To: Frank Li Cc: 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 , Robin Murphy , 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: <20240603171149.GA685507@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240603_101200_397710_16C727EC X-CRM114-Status: GOOD ( 24.26 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 31, 2024 at 12:14:18PM -0400, Frank Li wrote: > On Thu, May 30, 2024 at 06:08:32PM -0500, Bjorn Helgaas wrote: > > 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. > > Actually, I refer apple_pcie_bus_notifier(). I can't direct use apple's > implement because in imx95 have difference PCI host controller, another one > is PCI ECAM netc controller. At lease function name should be similar with > apple. I know it's different hardware, so obviously it can't be exactly the same. These are the differences that looked possibly unnecessary: - registering from initcall instead of .probe(): apple_pcie_probe # .probe() method bus_register_notifier(&pci_bus_type, &apple_pcie_nb) imx_pcie_init # device_initcall() bus_register_notifier(&pci_bus_type, &imx_pcie_nb) - naming BUS_NOTIFY_DEL_DEVICE function: apple_pcie_release_device() imx_pcie_del_device() - tracking entries in use via bitmap vs scanning hardware for invalid entries: bitmap_find_free_region # apple imx_pcie_config_lut # imx for (i = 0; i < IMX95_MAX_LUT; i++) regmap_read(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA1, &data1) if (data1 & IMX95_PE0_LUT_VLD) continue When we fix a bug in one driver, it's easier to check whether other drivers also need the fix if they use the same structure and names. Bjorn _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel