From patchwork Tue May 28 19:39:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677230 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2049.outbound.protection.outlook.com [40.107.21.49]) (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 98D3B17DE03; Tue, 28 May 2024 19:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925213; cv=fail; b=m5058LykTXselhRgXfjUwjxhOl8/jNEDafY2ZE3zlJYrTab7MSj9ZsmGI6mjVnBDB8wkd7EbOHrFNXp+ORyjDSqUoDQurzT/wh+9Dj5VwS9MYpIdWc2ATwbM8+4+/ihi1nxUyvA+vcyPQFmSC7NEHAh+Xn2rK6i7tpvicFRgUqc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925213; c=relaxed/simple; bh=xoXNJ0fJHAePQQUrByL1t4DV7f1MdI9LvJJHe/ZdxUE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=TbzdeytQD6fgtpRdjtp5be2caKgkMAZZuHfvc4hhYzkRF1H9L24CkaN8HiWds/2AduOijnBmY2bRoE7CGZKC9BFnwxSJA1jOkbWarGT5rEmKcd2EuziBEihM7HqKvBlEbLlUK75cWRVOt2eaocUs0AjnqIDZKJ3NhTrQAh65/zc= 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=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=W/fU7AX1; arc=fail smtp.client-ip=40.107.21.49 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="W/fU7AX1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y2yDaDXATXVcGLNyzT3ulkXB871m4a9mAWpvy26TnYKlPKBTFY/IH8JkzAl1AkJ74zY6E9M7L60A5Vm65IM/f8RqbOWYgZG4yEJmLpTK3sEtuyeK8WZd/VtOjV1N2/s6ax0PneiCxoGklku0quTD73ISzoZMqKRu910KtELWPMip2+WX3o2csSiPBApvUh1+vGL0dQwNr1e0gtaSVSxAg97UM99ZDVKzxrTOFsGlabXRggVNev3wADsBSA5tUe+Z3G7vUyJc1vm1Sd+GTcs3iO9EAl0XBG3zd8iFofbV94RevDp6FGByfE37fp9kTetz6BXJHJUMyf4Zr1qI2BHJLw== 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=fmy4S6QhQEeuj7lBEuawWfjth1Lb4DCHggXuxkqA3C4=; b=DE38Df9OjSrjbFAhilYyaxKSOR7igcu3PQPJ6QqCqwqGMbs8r+ws7j7g3Hgj+Iw5GkpYtYygQKCWWtWjealQ3DN6kaQTPZieKiNvkHzvsL2TBJpKuU5IRxq0SSR2KknAtZBp/wphP/UcjUdgvmY4lboNPUQVEnjfByOeXuFFtY56zCBbOZS03fl+ZxUUvC/dP0PYSBLhq0kF08cTWbVx4fBHTJcZXPVd0szH4oaDiUbuNLIIEcM/7Usod7LVGd3aADmkkEmR/LRsUBsT0WEZaVFAOLDXat++Nce3qeARVhbD1iALEsgej7j1vsAKkYarfYT+cCmCFeQg+hpn1qchRw== 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=fmy4S6QhQEeuj7lBEuawWfjth1Lb4DCHggXuxkqA3C4=; b=W/fU7AX1ZzwaP4vuATHF2gmk49dJkhAVEk90R1LG/GnWwmQWufTqfsu5gTfYoT8k4ffpsr2b6Bf/Y4MngsX5yzhUOyWhbt0XyqA3g5zpymzi/rOI4uZL4m8fCrztUE2vd3AkL5z1hY9FL3ZybnCZ1cCBMEty6dfiLz9tM0EZH6w= 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 PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:40:08 +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.7611.016; Tue, 28 May 2024 19:40:06 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:20 -0400 Subject: [PATCH v5 07/12] PCI: imx6: Add help function imx_pcie_match_device() Message-Id: <20240528-pci2_upstream-v5-7-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=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 Cc: 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, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1716925161; l=1526; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=xoXNJ0fJHAePQQUrByL1t4DV7f1MdI9LvJJHe/ZdxUE=; b=iUXNXi/woPUDP+oGO6Q9Pn1+lQPpcpgZwDats1iRa5nh59rW4giMit0kwn+KvaOrg6XL1wpI9 f+ohjdOSOCFAVTEGj2uWtQINpzpRAjeZPz2Phtrt2y0bNHh0/sGVOSB X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: baf21619-a6ec-4473-9924-08dc7f4dfa4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|7416005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?v/6AWM9bEAyjn54FJVN37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gB/eFr6D2vUBBf1mX3KoF?= =?utf-8?q?1ZmUOl2Bkh+njXCHrdW0zoS9E1MWtopTsLtB7SzGPdbG9trbxWJS0C6BIV2luF8lP?= =?utf-8?q?ZyMufEiaW5ZBuJaWtDId+9XqYm1uIiQviql+ke38EReehHvwV30eiwpDeJWRLcmM+?= =?utf-8?q?b7Sq6d6XOMDQ/TM4S9eBcAKFNlz0JdMn4xfC1qA9XtD3i4sGm7X06DB9Qe9CLS1S4?= =?utf-8?q?cjefAMRlbdTH+m1fQdhCZjTglwTrxmu2yWWZqthZDDKiaYJVxiwOlBTmknyA0/OcX?= =?utf-8?q?43vldDkiY9+3j3wtC38GooK9+zEcFelGEyhoHXMkcEhqGLCu0KoMlY16DXydGuvNq?= =?utf-8?q?zlRIo8SAeFk8eXFpg+4LiEOv7O8/4gwW6tgTlHnvv/k1S4+AMdzyFyDwcCS7qXe4W?= =?utf-8?q?z5w8ZxL08WmMhwjWNLI4LAE0JJHAi2K5EYesQxOx7lhQnE1Hz7G1c8u0=3D?= 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)(376005)(52116005)(7416005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7hTpDXzrsmINjTSZHvt3nPFgeB9v?= =?utf-8?q?/kduRMxsspuoKLcE+D+dapXNHVrZCeEsYPn45R4E+lmeB6j3nUUg7Dl36MrIDObSu?= =?utf-8?q?/cB0T90e5AbT2Cxk1ZzLu2R0+mTcIgzU/jfo+m1LqBifqM867YRF/9alrA7Jim+EX?= =?utf-8?q?GyfM3NDYew1HC31dhdi5pVtvpcPWoWuNg9ueM6PeaCvB1DRVZJTzxJ1pXxDZEwMBh?= =?utf-8?q?KnyX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d7cloZ5gVBQ5qCVz/0krcmCx/803CBR5Ntp1kjaupToyN5/jIPl068iWzFj?= =?utf-8?q?7ZIoPPJVQTlw4CIumA9CvMDH0pVxVtBIIS+D+XczTKSJvjp2DKAv9XQOOOuOt4cwm?= =?utf-8?q?U0UyDQ9QKhmJ4t0Z3Ped6bpzN2Eo8pImW+PnQCoqSnSMG0s2ouK4ZVZSbI3uM70kC?= =?utf-8?q?ryIsZhd9g/+07gc4a0NBniVQWSVfhV7M5OL5eycVcD1Silmj598UYCqSKo3k1jSTG?= =?utf-8?q?dZ4eBrqo+BNRBWO0sOXBSc64FOCV02q07GQ9iWxfgQXBHAUNWKX1o053BTSkLnWNm?= =?utf-8?q?M5xLghX5+M4PGibj0JMy06GhTY0nBoMF6s67egHO6py3SUoNUzAcbsvz/mse0F3K2?= =?utf-8?q?LAlzXLiIayKUunJIgFHoLASaBfAInrWcQRHag86iv9zdavf/0HY0S/Ns=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: baf21619-a6ec-4473-9924-08dc7f4dfa4b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:40:06.8941 (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: 0jL9DGuE8hboVwFs01ZdqUK2dz7MLzJhPNavv9vzpw7ewJsUP/DusJnwQXUCS2ogZaQppMAPKqegQLuM2KWrfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 Introduce the help function imx_pcie_match_device() to facilitate imx_pcie_quirk() in verifying whether the device's bus driver corresponds to the IMX6 PCI controller. This addition lays the groundwork for future support of ITS and IOMMU in the IMX95. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 5533b7ad0f092..29309ad0e352b 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1646,17 +1646,25 @@ static struct platform_driver imx_pcie_driver = { .shutdown = imx_pcie_shutdown, }; -static void imx_pcie_quirk(struct pci_dev *dev) +static bool imx_pcie_match_device(struct pci_bus *bus) { - struct pci_bus *bus = dev->bus; - struct dw_pcie_rp *pp = bus->sysdata; - /* Bus parent is the PCI bridge, its parent is this platform driver */ if (!bus->dev.parent || !bus->dev.parent->parent) - return; + return false; /* Make sure we only quirk devices associated with this driver */ if (bus->dev.parent->parent->driver != &imx_pcie_driver.driver) + return false; + + return true; +} + +static void imx_pcie_quirk(struct pci_dev *dev) +{ + struct pci_bus *bus = dev->bus; + struct dw_pcie_rp *pp = bus->sysdata; + + if (!imx_pcie_match_device(bus)) return; if (pci_is_root_bus(bus)) {