From patchwork Tue May 7 18:45:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13657561 X-Patchwork-Delegate: kw@linux.com Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2047.outbound.protection.outlook.com [40.107.8.47]) (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 DB02816F293; Tue, 7 May 2024 18:47:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715107624; cv=fail; b=tLHaxGJ1CdBN2b31KF5Wk4ZxpXJ4KgnYcZdQsAxvBQ83NnweoM5uBGqows4yF8VZfRGifCFnktf4Z4yC5SAs9pnBurqwcZHhALB8eldpFQOUw52pw8/4tnfZNx3fJ7zVMC0kWe9IppBIAr9/70dJVGjHhONLsM5i2/2QacERn/k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715107624; c=relaxed/simple; bh=fRuAnexzFcdciFfcdAEZxW1Yau8j1A65EcffAYhydkg=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=cURfM1nFjsugAQIdpFkxQDnQltrkyTxQ29KlNf97JBxcEm2z5BACgipvvJRGDJEJCvELjN6nQ5xo8WqyeJ3PiDerLhL7TEcBlkMn+wgoUobv+ygqo0e73FPTjc4z89F9OK1+YHaPXRSYs2AAHQs/kmFf98bP+2sWveYf8gOC6eQ= 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=VbFJIgtf; arc=fail smtp.client-ip=40.107.8.47 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="VbFJIgtf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gay4YOq0YjuUS26IcPIf3HDtwjKXyzNsRrazs5XWZ/Aj9U0AH+Glyuq5o7rIBC4iF8GapKK9zdjen8qCAEzaX292F7+vnu1nWz7c1ZJU1fnNLoN5DNkW8GQ+W2Pk58B4tp/Pw4t3zIh5gR7SA7v0ioonTsc6eeYoWuw3MKVwyQ2JsvLa6xoejIt857pcBJyJ5YeCJzfKjCaeLgqHdjwogRrEX2UYnu5HmoEjokFeqhxb5O4sC/D8cF10jVkZ9a+hECCeDTEt7KRXgK3KckLC4PoxXPwx5+frr5Ehuu8JgIdHd6P5MCeIKa6wsBA/yfmt507aaM4qgLmG7NahvRv8Ww== 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=l3hLRtu6tlq4CUbpU2aouIFuo+Jil+5bWfaulAUHiw8=; b=OXF97OIAwyKj/qFsv7TF6dmx7Bthn2Xf+/iWd+sIzmcoPNF+ZvPRHCZe0GbMEakxgxhJOcT5cIjZpRmoGDmK6BmyPrPyw/oOszQ2XugCh5HQRybhZa5vufpUe61mEbQN1YXSEFzxdk39hDc6LjpuEkSeHw3MLDJLv4kF7FMB+moEE3VueAVfhOrsyCxIS3pS5lkripigaBzITH5kUx3gwQREZ5qwW8+B4mRDQx1xoMe3yT8Bqf1vNrnhqslsVJ0yJHFp3NHUQ2ASXC+QjdWR/JL3/gn37hZ0G6PaJQPaVU8eDujNYB7rzP8x4Owj6qt+Ja9AOrwApipUm6kfiYTFJQ== 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=l3hLRtu6tlq4CUbpU2aouIFuo+Jil+5bWfaulAUHiw8=; b=VbFJIgtfeatXeQJkNCBu/BJpzB8hQik3CsFqy7Bfe5debo2P68reGUI/Y8tX+0iNHBFZNRwMxBwjbNuw3N1FAljHLUbUR1r8mJMsmQFSIYVg38Xps0/AyKq5AftYsMTC3KXI8ogGwBkjfYQMVAP6n24+WElItL7qP3Fqsk2MUVI= 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 DU0PR04MB9636.eurprd04.prod.outlook.com (2603:10a6:10:320::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Tue, 7 May 2024 18:46:59 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::1e67:dfc9:d0c1:fe58]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::1e67:dfc9:d0c1:fe58%7]) with mapi id 15.20.7544.041; Tue, 7 May 2024 18:46:59 +0000 From: Frank Li Date: Tue, 07 May 2024 14:45:45 -0400 Subject: [PATCH v4 07/12] PCI: imx6: Add help function imx_pcie_match_device() Message-Id: <20240507-pci2_upstream-v4-7-e8c80d874057@nxp.com> References: <20240507-pci2_upstream-v4-0-e8c80d874057@nxp.com> In-Reply-To: <20240507-pci2_upstream-v4-0-e8c80d874057@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=1715107574; l=1526; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=fRuAnexzFcdciFfcdAEZxW1Yau8j1A65EcffAYhydkg=; b=3YVnuaByILStdkLLA+qLb8m/jl0Ys3Esr56UQFrMbjUc1CPdSlChVR5pnQ8FAP07s7WOxK2KU H0G5o2iU/gsBz0ZKjM153QM8huItXIre0UgtwS4oPNLhrHg9M2WpD7Q X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0026.namprd17.prod.outlook.com (2603:10b6:a03:1b8::39) 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_|DU0PR04MB9636:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d3c31d0-1b84-47c8-883c-08dc6ec613e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|7416005|52116005|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?4CRdyQKF5AqUHFO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J/Rk301NUwiymiVt?= =?utf-8?q?rjeswG+Btk2iO8AjUHctYF7YylddgtECDxNoNgYj3OTewbWiwnYBIValEhn8u4ATb?= =?utf-8?q?pYz9RiaJI2A+G/t1TZcKr1VoQ11oLSHCA2Dt4w/Dso5UvhjbSyPNFLq93hkIqNgZt?= =?utf-8?q?CiXt4ndTDZcDTXmHRKEgKlVryO5WbdQni5gSuMpGVFdoKDf8Fwvu/VQ0AMw4ubtZC?= =?utf-8?q?nAfGkaF4X4fITJmZ9ue4CzBVTyGt73+ZbrEylUMEMT4a5SDieS4Kip8MVAQLbd6Ke?= =?utf-8?q?jLtktx2lJF5RMugtJSL8Gdal4bEkVqEVnLiQqcWPJtN2EVRAdXCfAKXHOhsIxLWRo?= =?utf-8?q?bdyB64dOFcwSB8wawSGpAV6aQ3+cxqriByRDZzNSLIdHafcesgstmFJ8242h7k5QW?= =?utf-8?q?xdEU4OOGs3SbqFX2HNceqOGLSQ6Y2YYkADVrFAp6vVntyWnDrzQGL0v0=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)(1800799015)(376005)(7416005)(52116005)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Xg4mbzMBIgNsg5CW05eV3OwOw9gS?= =?utf-8?q?7C3XSRE6n0CamI8he/BpQwI+e3nLzdMOEiq3Q+umt9ETFNoAExRhSpYBI5GUxP9wd?= =?utf-8?q?+3phKBNIV54I4PXYKovhbiAg+JBqYOhx9+zNhfdL/JeJQcetStkaPT5HLxcSmNY6/?= =?utf-8?q?9hulcQ764m3jD21r6L7EadzUwU/Cf7vfe1JKgLr2fSQYVwdOkA1HlChltDauQ/38/?= =?utf-8?q?3Kac0pYcyMmvkSS3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RT1898fOgFGMNHJFUeG0geY57C8YhSWpSOe/zQcYFkJ?= =?utf-8?q?X/t8UmvIXWHlFIPJjvDR8vRrERP2WJtloIaoIO+qEBGx7Hii1ouLGE6RXvQLsiGIh?= =?utf-8?q?dStfMfcAa7spyMk5GSctPuGGOG9TZpTOAyCP96IGve7QtM3YBhkx6T870xlvW55JK?= =?utf-8?q?rgdFuh28lUVAYxWrXxjodCCv5frR44dptZv0vxsL95tCk26kWZbSmemHX5JoaDhsb?= =?utf-8?q?H5s/jpFte15JBkg0MR0rlruODynmIiGOXqcFIpoQmsesWl0RwcWWOwlxkPgz8cyiz?= =?utf-8?q?kWCehvlaSEN3OBUG0LghbbDCfWQt1zWE0w2PWkIFp/iTWRuouvx+uiYCNi7zbYGYn?= =?utf-8?q?5TrM3qFWz9vHdJvEtc2d2NHvJlGhhz0nyZA6dtluIcWIisGCzO+kTuy+9ynQ2533k?= =?utf-8?q?J1/sjJKjjj/Q?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d3c31d0-1b84-47c8-883c-08dc6ec613e4 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 18:46:59.6986 (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: ARu326s5w14mlG5Cdhah7zUOuU37OQ/ZoUbIsHGFgtQjRc14+kUy5haKFFG6oFKOZJxBHK5/sUwCzDEFHGjWfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9636 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 d074bcc34d7a7..b33d8790a93af 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1652,17 +1652,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)) {