From patchwork Tue Jan 9 05:06:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 13514292 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2051.outbound.protection.outlook.com [40.107.223.51]) (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 8873B6126; Tue, 9 Jan 2024 05:07:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="aV+sjSTx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lX2ZGkn4U5PNVERFKSjjQKc5jcZfh6gk7pHsJR6uAm8ZQhqQUdcVfmONR+OD0GuyCmT4TaIRJ+ykxtaf3LuwDpKEB2+uwoKzceRRvoK8HCEcYUKAqZg6cswBE36dnZY7zfflfqSj20csDyqKkOijUQAJ+wEqpf7JaqEgvn6kucxTFuiNvdKBTu1Iv6zhZ37ii5pQvddHg0wZgetUVnBNaL+dg0lXjhFUi/eEZP8m7Xzg7mOc4N8hgh9VcZ+yQmjD/ZkiC3kG36GB2Dm3tK12TukyO6ELQaQRsM3qKWHgTkReZM+/E0VLfDBTsih0mR3wg9fBSfgndgTIUBIk4sIGbg== 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=R3cGwq/FHtmzGRJ8/T6FdLsDtcd2nrqjXK8ayyisOnY=; b=ADrv0qDOm7Kq687U4RNf49GrQ1IvbIHDB1xanqaJ1WAaBtMKnjiAHOcCELZoDmPK52Fp0RgWWPk6MOSiePTNhBq6tnr3R0PmXSaLqGaHLVSP3XHhmPPWb0zxqny3WgkvIyoEeD9Km8BkBdbw4GAGOQWKFEKkoRwyGpcikLFqPYJ6x3UzVR0RGApedufD41oirRKN8pKGfjKCseupG88YsuyduIF2zTv/hei8wCBeJehPM1m/CqDW/vnR1F7L1W1h7ZR2U36j4Q4lubUV4M+GqRG63Tg/3216FNyID9NkXaJPRW0rZYW6OIFRHtYllTpOD7ti70d5H67rTs4CjXwOag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R3cGwq/FHtmzGRJ8/T6FdLsDtcd2nrqjXK8ayyisOnY=; b=aV+sjSTxx4sddj70PFtf1ZNq9TDnpT5nRP4g3JSvHJM/+5I0k1Y01VnonUes8IrEikAtaHWZEALgaf1GXvZVHsTq64hCM0GyWqF8oHX+UKP567PLzEjqxQYb+enMBKodjJod6fUZPsrllF/MZFwlUKHy3UXviFWx0ngsgnLfT1gj/RkjycBI4beR7yS0i8sMTxSrQ4wWqC44N1b0HwH5/24GU/d8vR/g6YnPjOTznr6VVu1l2HP7JHcW4PioEW1zb8Iir9V++bIvvoIb9eZWGx1ZagAmFlA7gYCki9Gk9vHJ2K9EKrRySJZYruKfgqqnHnitHXtlsVbGeXFvWKBe/A== Received: from CY5PR13CA0087.namprd13.prod.outlook.com (2603:10b6:930:a::10) by BN9PR12MB5082.namprd12.prod.outlook.com (2603:10b6:408:133::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Tue, 9 Jan 2024 05:07:17 +0000 Received: from CY4PEPF0000EE30.namprd05.prod.outlook.com (2603:10b6:930:a:cafe::25) by CY5PR13CA0087.outlook.office365.com (2603:10b6:930:a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.14 via Frontend Transport; Tue, 9 Jan 2024 05:07:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CY4PEPF0000EE30.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.12 via Frontend Transport; Tue, 9 Jan 2024 05:07:17 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 8 Jan 2024 21:07:05 -0800 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 8 Jan 2024 21:07:05 -0800 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 8 Jan 2024 21:07:01 -0800 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , , , Subject: [PATCH V1 1/2] dt-bindings: Add PCIe "preserve-boot-config" property Date: Tue, 9 Jan 2024 10:36:47 +0530 Message-ID: <20240109050648.1347255-2-vidyas@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240109050648.1347255-1-vidyas@nvidia.com> References: <20240109050648.1347255-1-vidyas@nvidia.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE30:EE_|BN9PR12MB5082:EE_ X-MS-Office365-Filtering-Correlation-Id: 92a9a06d-304a-4e69-bb0a-08dc10d0d9b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RImdDc+6nj/6jBnzqgrPF8W8i76LbC0r7oxCpII5+qcTlKWhZz3MjDIdsVnwPo+n6FyJOK6p9UApKjmeWIiLRw17f7RWnx7A8aa+ZRN4KMw8xNPUTWPBDE+4FUGdjYGKkqLWvpyCDCLGa3LfE7epSp+y+74t2Vo8rQS4hZ3L8wI7Uw4fhMvgams1AdYIpEPIst32P7TCLcadANrv6PINLPd+Gb53N4Qck7J5jLHNFDFQc7EBP/Bo56h+5sTUAqT3ZvzCX3EwK3cno/IIumgoMqKSJ6PA61kEl4d9/lUnG+XqRriHK/ei1pivA2muTTgYJU0iL5zps9TYcbbq1A/sIugTSkuHEReWhG+B7mGUEdbmjqtalmc4Utk/tXrEPpKJUmc3VEog73vD10pYEAb41AwJ8lQtqKMLSMfQOtk+To8k7CnngKJviw0x76KJivhZC6npt3Exw/D4vYJ1TbvBmOq62efNAWkWXtG9t2lM7NvKR8pH7zoIiWNyGdHxLbhvFDXtWaUNaLV81WBmwwFiRm0Uw+FwMIYw7PQuAWDjGEnLsJpQNAekQEIbNy0PKgH4EaaC9VpVcFAGBVB3FtV6qkIJCqVbGzk1gNbeD0uePUNgHiFEOCHiY9esszG2/w49TSRcD8hdRiUrqYkM+0KW3frE+9Ej53SPdnJrDZVoO/+737Sni4ba/CtATLPIAgjaBl9hifLPY2bqKYL2lTcH0L7SPrkvux7XS/fmsjZ56unXdsGBdGW8aJsEtJDI8XoE X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(376002)(396003)(136003)(39860400002)(230922051799003)(82310400011)(186009)(64100799003)(1800799012)(451199024)(36840700001)(40470700004)(46966006)(316002)(70206006)(110136005)(70586007)(54906003)(8676002)(8936002)(478600001)(6666004)(86362001)(2906002)(7416002)(36756003)(41300700001)(4326008)(5660300002)(426003)(40460700003)(47076005)(40480700001)(26005)(36860700001)(1076003)(336012)(356005)(7636003)(82740400003)(7696005)(2616005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2024 05:07:17.0219 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92a9a06d-304a-4e69-bb0a-08dc10d0d9b1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE30.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5082 The existing "linux,pci-probe-only" property applies at a system level and it is not possible to selectively convey individual host bridge's requirement w.r.t preserving the boot configuration done by the platform firmware to the kernel. "preserve-boot-config" addresses that concern and can be used to preserve the boot configuration for host bridges selectivey. Signed-off-by: Vidya Sagar --- Documentation/devicetree/bindings/pci/pci.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/pci.txt b/Documentation/devicetree/bindings/pci/pci.txt index 6a8f2874a24d..0a5ff998cbe8 100644 --- a/Documentation/devicetree/bindings/pci/pci.txt +++ b/Documentation/devicetree/bindings/pci/pci.txt @@ -32,6 +32,10 @@ driver implementation may support the following properties: root port to downstream device and host bridge drivers can do programming which depends on CLKREQ signal existence. For example, programming root port not to advertise ASPM L1 Sub-States support if there is no CLKREQ signal. +- preserve-boot-config: + If present this property specifies that this host bridge is already + configured by the platform firmware and the OS doesn't need to reconfigure + it again. PCI-PCI Bridge properties ------------------------- From patchwork Tue Jan 9 05:06:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 13514293 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2085.outbound.protection.outlook.com [40.107.92.85]) (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 D3948947A; Tue, 9 Jan 2024 05:07:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="mEsYCVSV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kRCFEvHvQdk+R+XNF1wmmq4TI5Wc952FvV9paveWbQf6baHMac0LIqfGSt7OyaErN1BF0R68b9NkM27kzZsWfMlOwnxJtHJT1in0lhdinm55qDWlw+T84stDb/vk3Y9UsFDmnBi3BJRj9pGDLmnwOyYZC5WIahOBwzn+Xhuc3NMp1BEgwV0FxiLlwv1RIvGfNiS5DXp5a8nPHQpVOmAmtgWLsVgIA9FGCb3TAMB7gVcBBZ7wPM/8alQDV3DjC5riS/xjU5vAMhYWfjFRhkBW8GUg3LJWm9gCWT/7pN7YPbMrjwsxQmJq3HwaM0yH5Sf+blHpoGYav966ItDyR/0/mQ== 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=8IpyctZh/IFGJOzw+MMxJer9JbYzhMAU0rI2sPgS6Zk=; b=gooRzIZ4XmSsOVbrq5v8Eio9xYZgZ60+CySTZQjMXThRPFjq0em3XphZvj2PlQuC2+RN1DfOdFVcmjVSGmI7A4xY2f6l883UHOC9p1Fihp/2jtSfCh7vsPQ+xplwf7BFeGrcuEGJ+xs8ZBXWLGco00hOf6dQc1i9mFVD9gMY488h5Aj9errDTmBTDNqSOqH8GsU66Rc+8aZHtvzxArU/XXw3p2C2pJVKoVz4JGLaN0t+iv5BEIjK4ZkQFaVxFTdb1VV9/OvCWnUb04FJJEy8iv2p9wZjyTchvv2hdrYpSClMJJ5/YfjYg1iBolOURpAHtJNRoR+dE/+Tdj4jcUz8/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8IpyctZh/IFGJOzw+MMxJer9JbYzhMAU0rI2sPgS6Zk=; b=mEsYCVSVZWD3C/Bt9H6Pa+zrusXagHU0+Hye76IYQ5PiU2QFk+9pN1xO/rgbvjlQz5T9q2qrH1D8W/ow2gn6NUJHuIl7NgGb+jmyOiq7LV+18JSf1Ptwu3XR7cXl3YRGW0zhmj/Uv2O06h68uLJ/BhLPCZdXtYv9ihE2M+MgL1BmvfdtRBftYdXI3qChCkE9S1dZpz16uIwoMZh0sj6l0GCJMK1ANMBun04Eyt6dkDvU+drq1L13MRht2WvAAlwTtgV/qo2wk5kNZ0ddCKhWzlv3rm82rccn6PXmNvQH8OltIKOuZ5S0Ps9xS4j4epA4okjPCgsFNnnMBmtUlyDCww== Received: from PR3P193CA0039.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::14) by CY5PR12MB6599.namprd12.prod.outlook.com (2603:10b6:930:41::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Tue, 9 Jan 2024 05:07:30 +0000 Received: from SA2PEPF00001504.namprd04.prod.outlook.com (2603:10a6:102:51:cafe::80) by PR3P193CA0039.outlook.office365.com (2603:10a6:102:51::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23 via Frontend Transport; Tue, 9 Jan 2024 05:07:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00001504.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.14 via Frontend Transport; Tue, 9 Jan 2024 05:07:28 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 8 Jan 2024 21:07:12 -0800 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 8 Jan 2024 21:07:11 -0800 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 8 Jan 2024 21:07:07 -0800 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , , , Subject: [PATCH V1 2/2] PCI: Add support for "preserve-boot-config" property Date: Tue, 9 Jan 2024 10:36:48 +0530 Message-ID: <20240109050648.1347255-3-vidyas@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240109050648.1347255-1-vidyas@nvidia.com> References: <20240109050648.1347255-1-vidyas@nvidia.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001504:EE_|CY5PR12MB6599:EE_ X-MS-Office365-Filtering-Correlation-Id: e6a09ee4-ce29-40cd-399e-08dc10d0e0d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SfkIGJepp2rt/EyQXLqWe2QOILWXuo1wr8Hg5s/omyYlGBxjAzsoaDWon2x8Uz/M/lC2OdRW8O0edg1ZpK4euhUIHpu5NIjuIcipgXEUGkMABhLL51U4I4CdaLu7fE41yflpVkXBmEK0vQjpIaEhty2pX6zL8XgWt3/6ngZ6HkjQKJciH5/1dwQ+KYt8PAhrt7/Id/+Q4cqHyVFUJeMnNpRPufOFtWDd+dx/cYrdj3BsMK2u2gBn5b/SHc3/FD6Sm+mf42ko+VWyTt3Hd/SHdocH6tcprbA5q5bvyKkzVcTeXvTeHw36D8lsUkB54rDQ4hZEEj7k5JvQ1e5QUTMOlSfIj0gd0jD1aCxC02cWxrb8p1X8mL+6qoDXyYU7HcdzWJMNKrDGpCUv9HgN1O5WeVbUHoNQDxlYjLt85Sp0qpMmc5/J77nVurdjN8VdphRJTxPLkTnVqqE65wHxtg/R71anWBV5myO83mLRJJErgn77R1njOo7a3Rjs/ZKY/vLfj3XkwmuS7zwks5/+SVj0jBtkPDSMPqU3jF6eoQ/Zniu3bIz5Ee0wh6Jhw7ItrHtBCX2QCoE/zXGUWftrfdVjT2uFK3biNE1BhowQQsOpc//LbIjbTfsTJx52YcpRUbywiEABaw+cK4wdGYiwsO16k0FjRu9REZ3h5iLckh6VvSSVxKm3fDf8UnnIPTcDnjFo5RfnaEuYHQBu8EyQEbgl1NGehTvaQh4/PIQDWUHDHXrygMzAq29ITWTn9bF746Ji X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(1800799012)(82310400011)(186009)(451199024)(64100799003)(46966006)(40470700004)(36840700001)(26005)(2616005)(6666004)(1076003)(336012)(426003)(7696005)(478600001)(47076005)(83380400001)(316002)(2906002)(5660300002)(41300700001)(7416002)(54906003)(70586007)(70206006)(8676002)(110136005)(4326008)(8936002)(356005)(82740400003)(36860700001)(36756003)(86362001)(7636003)(40460700003)(40480700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2024 05:07:28.9698 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e6a09ee4-ce29-40cd-399e-08dc10d0e0d3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001504.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6599 Add support for "preserve-boot-config" property that can be used to selectively (i.e. per host bridge) instruct the kernel to preserve the boot time configuration done by the platform firmware. Signed-off-by: Vidya Sagar --- drivers/pci/controller/pci-host-common.c | 5 ++++- drivers/pci/of.c | 15 +++++++++++++++ drivers/pci/probe.c | 2 +- include/linux/of_pci.h | 6 ++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c index 6be3266cd7b5..d3475dc9ec44 100644 --- a/drivers/pci/controller/pci-host-common.c +++ b/drivers/pci/controller/pci-host-common.c @@ -68,13 +68,16 @@ int pci_host_common_probe(struct platform_device *pdev) of_pci_check_probe_only(); + bridge->preserve_config = + of_pci_check_preserve_boot_config(dev->of_node); + /* Parse and map our Configuration Space windows */ cfg = gen_pci_init(dev, bridge, ops); if (IS_ERR(cfg)) return PTR_ERR(cfg); /* Do not reassign resources if probe only */ - if (!pci_has_flag(PCI_PROBE_ONLY)) + if (!(pci_has_flag(PCI_PROBE_ONLY) || bridge->preserve_config)) pci_add_flags(PCI_REASSIGN_ALL_BUS); bridge->sysdata = cfg; diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 51e3dd0ea5ab..3216d4557212 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -258,6 +258,21 @@ void of_pci_check_probe_only(void) } EXPORT_SYMBOL_GPL(of_pci_check_probe_only); +/** + * of_pci_check_preserve_boot_config - Return true if the boot configuration + * needs to be preserved + * + * This function looks for a property called "preserve-boot-config" for a given + * PCIe controller's node and returns true if found. Having this property + * for a PCIe controller ensures that the kernel doesn't re-enumerate and + * reconfigure the BAR resources that are already done by the platform firmware. + */ +bool of_pci_check_preserve_boot_config(struct device_node *node) +{ + return of_property_read_bool(node, "preserve-boot-config"); +} +EXPORT_SYMBOL_GPL(of_pci_check_preserve_boot_config); + /** * devm_of_pci_get_host_bridge_resources() - Resource-managed parsing of PCI * host bridge resources from DT diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 795534589b98..79d0ac34f567 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -3085,7 +3085,7 @@ int pci_host_probe(struct pci_host_bridge *bridge) * ioport_resource trees in either pci_bus_claim_resources() * or pci_bus_assign_resources(). */ - if (pci_has_flag(PCI_PROBE_ONLY)) { + if (pci_has_flag(PCI_PROBE_ONLY) || bridge->preserve_config) { pci_bus_claim_resources(bus); } else { pci_bus_size_bridges(bus); diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h index 29658c0ee71f..a408e54128c6 100644 --- a/include/linux/of_pci.h +++ b/include/linux/of_pci.h @@ -13,6 +13,7 @@ struct device_node *of_pci_find_child_device(struct device_node *parent, unsigned int devfn); int of_pci_get_devfn(struct device_node *np); void of_pci_check_probe_only(void); +bool of_pci_check_preserve_boot_config(struct device_node *node); #else static inline struct device_node *of_pci_find_child_device(struct device_node *parent, unsigned int devfn) @@ -26,6 +27,11 @@ static inline int of_pci_get_devfn(struct device_node *np) } static inline void of_pci_check_probe_only(void) { } + +static bool of_pci_check_preserve_boot_config(struct device_node *node) +{ + return false; +} #endif #if IS_ENABLED(CONFIG_OF_IRQ)