From patchwork Wed May 8 17:41:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 13658986 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 ADCC0C25B4F for ; Wed, 8 May 2024 17:42:52 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n9t+SGI+hNMEBDJsLRLnzCuP1G/JlSTQEtaexWE764E=; b=poTxlw8hyCSEx6 Sy6pUk7TmhkurtzB+Z3scMgaAPHOk5Gml2nwZNYsO1zE/yfyl/nX4RRvviKUb109APAxPGZGNFGfU xCfBkVm57inUz0xywUo8to1/qOnQZjP6n2q1iPOcEXCdQHu8vkHQa35/oYD/huiq6c8WZ9bjryhr5 ID1qtU1Pma+ZaeqXl7GyjXLjkW2FRCbscE29Evp6lH+qPA5FFr4Z0YUFNms6VBabLDs60oRG1FA3l rR8nrp8xOcRhIiNrTNvn70JpGBhnmIjh5J1DlYkU6Cx6N07xHxLgh2VMWFinvYvnEJ02hf4Ep0wRn Kxgfjl15quNMiua1nDsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4lJL-0000000GPX5-1lFg; Wed, 08 May 2024 17:42:35 +0000 Received: from mail-mw2nam12on20600.outbound.protection.outlook.com ([2a01:111:f403:200a::600] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4lJ6-0000000GPQE-3f9C for linux-arm-kernel@lists.infradead.org; Wed, 08 May 2024 17:42:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ug5IkvNCyx1B4Zt9Ziv6s+BKfD9t0lbThRmIt8CCTMqvQs0ZNp/by2YGjhFEPkkhFlAqEZzOleMQFS3W0GMFrQkNZeIhZ0YeH0I3V359C8/t9wTZ5sWLrZEkO1YaDIcukYQjIuL5CXwYQMKxuNQWyN/Q+giE6w/pOnanD53Pg4Ub0+f7ITROcYuR5X1d+sjk9TvkuG3JDB4gHVLgmq8u98azbMcx53f6v08PZvNTcenaVkJ0YEQwF/oUPibbgnsYx01XJuwJ9tVKnM2w6bV6uvbb+vjBiDwiJku4ppIECWIAuRDzaJdhVU7oSXk3G2vMlp0a31B0P3yxthD5FMbKDw== 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=wuSu85Yw8h/x1UtvtWWic3WpwzTJcJHglpKY88sTqww=; b=dLQTTrvWVExdna/GFVj180O6sEG8Qs4Vg++VxDW1V5GsVVoey+FfuGbgVZJE5VAusBQ/jS9UimBnhAtydLK163+Oj16vABYGssX3zjwdmsptj0u4dciNa7Ir/ffcp4gt/RbHkcI7wHvG5d0zJ7WbWI/1gRKRRR6fa2wOZMMi1QRJc9FqYudn2ssfUH2tln2HFHl2D9ycmTN3evp2aSWPmkb8pFKeUyb/PiAlNmz9rz/wDMCFDVTT35PKKMDHZ8E+/Q/wibizFaYXawwqUg1XhjarLiDgLd/ukdEP4Za1AxvlzQU2EIaolp0qhhB8uilvjxmt4raYbTQILYsf0luYOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=google.com 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=wuSu85Yw8h/x1UtvtWWic3WpwzTJcJHglpKY88sTqww=; b=cpHjXscYO60uVaw+SrlbZNDCeKKhL7k5dbW28X/VJJOZhDYn1kizXIkr8koDMT+za81uUeCgZLC29CI+IejUVkHDBFRRJjJp8LzJapVG7nP9SNIwD4m82gMlAFimW1zVYNqZH5CiOXwp9PX1oPblkBj0qopkwwJLrykDm8g4FRZX9cLzOU+RtJtOGGU1CnAdiBPx2rOafwVUIWUIT39FzFZaPbSAfdzrASvhpousCNIOs89rEWmChc58RjOLAPiBTzTxoS7WUp2BNmmEruzrN/u+WktJRdwZCtnWxhTj9oA9YVWAsRwLboXjOe026yLWooYZ3SUG3wtLao9bXTMszg== Received: from DM6PR11CA0047.namprd11.prod.outlook.com (2603:10b6:5:14c::24) by MN2PR12MB4488.namprd12.prod.outlook.com (2603:10b6:208:24e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.45; Wed, 8 May 2024 17:42:11 +0000 Received: from DS1PEPF00017098.namprd05.prod.outlook.com (2603:10b6:5:14c:cafe::24) by DM6PR11CA0047.outlook.office365.com (2603:10b6:5:14c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.46 via Frontend Transport; Wed, 8 May 2024 17:42:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS1PEPF00017098.mail.protection.outlook.com (10.167.18.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 17:42:11 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 8 May 2024 10:41:55 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 8 May 2024 10:41:54 -0700 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 8 May 2024 10:41:49 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , , , , Subject: [PATCH V7 1/4] PCI: Move PRESERVE_BOOT_CONFIG _DSM evaluation to pci_register_host_bridge() Date: Wed, 8 May 2024 23:11:35 +0530 Message-ID: <20240508174138.3630283-2-vidyas@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240508174138.3630283-1-vidyas@nvidia.com> References: <20240508174138.3630283-1-vidyas@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017098:EE_|MN2PR12MB4488:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c3d7ac2-8665-425a-fedb-08dc6f8630ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|1800799015|376005|7416005|82310400017; X-Microsoft-Antispam-Message-Info: JeDmRNTWyxu4EKFSJig5bRIIL5VujCZZrj580kGI5vcCtK5pX0a8Q5ovNaEZpf284RU8n0Nj6VE11KchGg4bWSuJJnDwS1Q+aL97b6AysoD7W1EPV6Wu0HafQC1TYjXusMfdUTmkn1b3oY7iHsYIXI5I4o550j/w9AogJibegFjQYFfL1Zcdnnc/P7qu4RQWsW//rnCL3qYx+mh+qO4LCLsAqXLP6/eT8DbczEpJ+63iLDlKzz0sXO0d7L5AqGLjs90zf5GLmtapv+zv7cpsxBhA10dFgqglzcOsMIzoOCPW/II/4jMBbLJ/Pzjq53T1U+keb2RJ2qgCzLL6enLRjAtWsU4lmUaD3EM8Hwf9dFT7hqdJWz2j94ZEs/UDDKBYDCglAwUMYAWrBS1dbKQdhsT1b3FrfZlwj5YJ1lcCotcZEmT/8ylMyZwrcdgCq8Ig92Nr328LAqbXhgzkdlWOZ0RBPuEgA4lxuiTx6pKkkwD/CZbDI6Dbz0vMi7YV2bNp7XNkrlwYAg9JNUPZDWMmsuwBYO2Kty5gt/sez2Q65wgW6oDzTNfpPn6my7tYx3MrP61nZYAO0Dre+NdjmL9EsMoXYjDOh7Xuvi+XEdJRUh1gGiNBOOmTFkuLfOvgsZCjfAb0AMRHjNsbq3d7Mez2Ybr24MeUVkAQS/jQyw14sc7aKURdTz92iYsVRShEAfZJAtdDjhhsFtipmc8gemZqD0UdfZ+xu363T8ur45yhU4tuylGvD2I8vUZ8KgViZW/CqrOhlIuIkZTf6HvwCGLOfqBbiCV1cmmocUKylh5zoHnl/xx02ww4RHz9ugyf7mC2MxSIve9vkl2fHmX+ONbNhe5mcgNvfqmaUCxNZUFOlyLby9f3nQYb0vy9orSASWSwzP2aUGJAWInddBpaSA3LI05S60V+JejCJzrHXHyKw9rteIOuNEuyeQqULHhCL6RJcqK/b5FzfwjiOL3lNYIUJhWu6T37oeNoEK0IP98YOLwgjDTZG+zRoy4Mgxcr0rqCiMtO/m1GU0k9xj+w0MyJjlv/1X3Q+G5XN2FfINXEUayj00xeSGgR5DpPV6bepBXMNcPJzsoMq78yPhql88D3lXt/F75FTJPTUs/9XJcyQ2cRqYZO3cYmDQ/mX/5t0cmj1aIn4QIhk7Md6gCg3wPoez/qG/+bMw8mFfViWTxgeCcv1GJOYN1uqNgbOXm3kkqBFqL16KtAPpHlpfub7e17KzO3w1j+I+/XMus9HAFtAeh6eNExHBNIOhcfl7+yk5Zo1VvTDEIJw76/maC8SqPW5lg0kzL85KPKGaRdqk7VGrqVy/YFLlJBi/Ngab1ysCsNkaq4Yh+xyt4mrR+UNvnC3lRAz4jdThPw6zJY2wmsHPvhj1/ZDEDauSH1FCcnIgOe X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(1800799015)(376005)(7416005)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2024 17:42:11.1215 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c3d7ac2-8665-425a-fedb-08dc6f8630ad X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017098.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4488 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240508_104220_940374_FCD1BC03 X-CRM114-Status: GOOD ( 17.39 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move the PRESERVE_BOOT_CONFIG _DSM evaluation from acpi_pci_root_create() to pci_register_host_bridge(). This will help unify the ACPI _DSM path and the DT-based "linux,pci-probe-only" paths. This should be safe because it happens earlier than it used to: acpi_pci_root_create pci_create_root_bus pci_register_host_bridge + bridge->preserve_config = pci_preserve_config(bridge) pci_acpi_preserve_config + acpi_evaluate_dsm_typed(DSM_PCI_PRESERVE_BOOT_CONFIG) - acpi_evaluate_dsm_typed(DSM_PCI_PRESERVE_BOOT_CONFIG) No functional change intended. Signed-off-by: Vidya Sagar --- drivers/acpi/pci_root.c | 12 ------------ drivers/pci/pci-acpi.c | 22 ++++++++++++++++++++++ drivers/pci/pci.h | 5 +++++ drivers/pci/probe.c | 11 +++++++++++ 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 58b89b8d950e..ddc2b3e89111 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -1008,7 +1008,6 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, int node = acpi_get_node(device->handle); struct pci_bus *bus; struct pci_host_bridge *host_bridge; - union acpi_object *obj; info->root = root; info->bridge = device; @@ -1050,17 +1049,6 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, if (!(root->osc_ext_control_set & OSC_CXL_ERROR_REPORTING_CONTROL)) host_bridge->native_cxl_error = 0; - /* - * Evaluate the "PCI Boot Configuration" _DSM Function. If it - * exists and returns 0, we must preserve any PCI resource - * assignments made by firmware for this host bridge. - */ - obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 1, - DSM_PCI_PRESERVE_BOOT_CONFIG, NULL, ACPI_TYPE_INTEGER); - if (obj && obj->integer.value == 0) - host_bridge->preserve_config = 1; - ACPI_FREE(obj); - acpi_dev_power_up_children_with_adr(device); pci_scan_child_bus(bus); diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 004575091596..9cc447da9475 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -119,6 +119,28 @@ phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle) return (phys_addr_t)mcfg_addr; } +bool pci_acpi_preserve_config(struct pci_host_bridge *host_bridge) +{ + if (ACPI_HANDLE(&host_bridge->dev)) { + union acpi_object *obj; + + /* + * Evaluate the "PCI Boot Configuration" _DSM Function. If it + * exists and returns 0, we must preserve any PCI resource + * assignments made by firmware for this host bridge. + */ + obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(&host_bridge->dev), + &pci_acpi_dsm_guid, + 1, DSM_PCI_PRESERVE_BOOT_CONFIG, + NULL, ACPI_TYPE_INTEGER); + if (obj && obj->integer.value == 0) + return true; + ACPI_FREE(obj); + } + + return false; +} + /* _HPX PCI Setting Record (Type 0); same as _HPP */ struct hpx_type0 { u32 revision; /* Not present in _HPP */ diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 17fed1846847..180d3907b543 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -734,6 +734,7 @@ static inline void pci_restore_aer_state(struct pci_dev *dev) { } #endif #ifdef CONFIG_ACPI +bool pci_acpi_preserve_config(struct pci_host_bridge *bridge); int pci_acpi_program_hp_params(struct pci_dev *dev); extern const struct attribute_group pci_dev_acpi_attr_group; void pci_set_acpi_fwnode(struct pci_dev *dev); @@ -747,6 +748,10 @@ int acpi_pci_wakeup(struct pci_dev *dev, bool enable); bool acpi_pci_need_resume(struct pci_dev *dev); pci_power_t acpi_pci_choose_state(struct pci_dev *pdev); #else +static inline bool pci_acpi_preserve_config(struct pci_host_bridge *bridge) +{ + return false; +} static inline int pci_dev_acpi_reset(struct pci_dev *dev, bool probe) { return -ENOTTY; diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 1325fbae2f28..ee086d029450 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -889,6 +889,14 @@ static void pci_set_bus_msi_domain(struct pci_bus *bus) dev_set_msi_domain(&bus->dev, d); } +static bool pci_preserve_config(struct pci_host_bridge *host_bridge) +{ + if (pci_acpi_preserve_config(host_bridge)) + return true; + + return false; +} + static int pci_register_host_bridge(struct pci_host_bridge *bridge) { struct device *parent = bridge->dev.parent; @@ -983,6 +991,9 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) if (nr_node_ids > 1 && pcibus_to_node(bus) == NUMA_NO_NODE) dev_warn(&bus->dev, "Unknown NUMA node; performance will be reduced\n"); + /* Check if the boot configuration by FW needs to be preserved */ + bridge->preserve_config = pci_preserve_config(bridge); + /* Coalesce contiguous windows */ resource_list_for_each_entry_safe(window, n, &resources) { if (list_is_last(&window->node, &resources)) From patchwork Wed May 8 17:41:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 13658987 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 4B50BC04FFE for ; Wed, 8 May 2024 17:43:00 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r7qXTjX69zQZd4m7OimrLSnpb3JPd62BiEjgQkwWmeU=; b=Tml/pWblRfa37L 9WZ2Pe9cABFNQtmAIZiLzM5xQybHQflw2DGKdj2C1Y3BKZXJOqZRFdGt44ctOU6BeQerkn0cOn9ZJ 5Mq4JcqAR3ENIxmlAmlRBX7Z0EDOssbl/pmbmFch5ZsvTxaPYlw6BpbZA54ItP/M2ntQOzUL1xv8Y PM7+MSFhBrptztW1JYI58b9wBQttomVxbDPs2CbSs8Su3CiaFJRJqeakfxjyXWXWdvCiKjwgXz/Og v1BroOmqriy/HiBfgKY7vXPXQDMEy9atLH9n/VNOvW4FVlcNVpcGUsC9LxrJWIKMM0wI52KrpuXo8 MczU2g81aQGQ2i0MC0lw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4lJT-0000000GPcV-42xf; Wed, 08 May 2024 17:42:44 +0000 Received: from mail-mw2nam04on20600.outbound.protection.outlook.com ([2a01:111:f403:240a::600] helo=NAM04-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4lJK-0000000GPV1-1MWE for linux-arm-kernel@lists.infradead.org; Wed, 08 May 2024 17:42:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cbq8PFHl33YpfiYnIiH4rpwcgkqmScyxMLYPiIyOw7UjdYu0C6/exmMyzzhh7Nc3VLR0RQz5Kw9921SOJpUbZRwwj+gmw/2yfVKJcqtTqLeeuuY4BolsO3UKeZsvpyvjtQSMlBgu+OQ8VzflPY+SigIgOM8SIXuL2zwZoltBe7S0rzH1LDtamby3fu12rgqMyzJCsPzG2aoomR3vKCzSUN6Wlr2elSzRrzJfd2d+4OOO9fR+FYshMpcwZgjXO8vfx5h9mcoZs3Vfdv5S2ftn/etCQsTksaXOeAhi6V5SlobyCcxVHJj1QtJmw4aDdgKbR+tfRXrphEXZpqtzSi6Lbw== 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=v0qaI7bWkocJbbMim1MkePA4fSS4RjMNRqTY7lgoiXY=; b=EoR0PogaLaVD02xB0dd2RH8D79gCK0PRksTzmYG5JaEStT3vYnNPDxwbvkg9A5mBric0C/M0cKw3rAke4aEARMVaXepljel1uWt8CpWXi6VspBkdhvTHof2wermNIZPz6swO/gzd2T9JsYXmOahOjFlIITf42127Cn+d4se4JuqZBdwEihJ+tJR3/j5KfcV+IZ6OsXCze1B13SbezbGufM4KuNpAoUkfumkEQ1Zeq7jtuzeXUC9dSuGyR0wCd445lk9FJB8i0Th9XYT3D6k5ksU1LHGtKwm3SQBkju7wyAYEAfIHzqr8e5EqQmdAc3yDtegpt9VTX/ef/BNhydq6dA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=google.com 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=v0qaI7bWkocJbbMim1MkePA4fSS4RjMNRqTY7lgoiXY=; b=fC+795WzflbTYDcETUyUUYj1OXAn4QU8M3pgPMREVRwK4a312NwCrPSoHPw7F2PhS0wjXbfpcVq66w/xuHB6fcVuZ8tXjmCF+QKwyAumwJLjvmLhv4w9fsuFGbA3m3OTu5KFAovnAbjgWudBsTCF80g47dsoMQnNhyUF9V10MT5x3/t3y+7PKrs2NvgWwNJuJ1EYVYQtNSp8BBhG+0ZCtVKr+Ug12zJmyeAPfXk20naLooD99QOLGDO9DqYo0Da1cJgrtLMHGOjAQ1hPZvk19cONWD7krIjrvgBW1tuD08EPog13aF0JrxneIzI1Rep2cnm7ONSX50wlPeAR73CVEQ== Received: from DM5PR07CA0067.namprd07.prod.outlook.com (2603:10b6:4:ad::32) by PH8PR12MB6866.namprd12.prod.outlook.com (2603:10b6:510:1c9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.45; Wed, 8 May 2024 17:42:21 +0000 Received: from DS1PEPF00017099.namprd05.prod.outlook.com (2603:10b6:4:ad:cafe::2d) by DM5PR07CA0067.outlook.office365.com (2603:10b6:4:ad::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.46 via Frontend Transport; Wed, 8 May 2024 17:42:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS1PEPF00017099.mail.protection.outlook.com (10.167.18.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 17:42:18 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 8 May 2024 10:42:02 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 8 May 2024 10:42:02 -0700 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 8 May 2024 10:41:57 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , , , , Subject: [PATCH V7 2/4] PCI: of: Add of_pci_preserve_config() for per-host bridge support Date: Wed, 8 May 2024 23:11:36 +0530 Message-ID: <20240508174138.3630283-3-vidyas@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240508174138.3630283-1-vidyas@nvidia.com> References: <20240508174138.3630283-1-vidyas@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017099:EE_|PH8PR12MB6866:EE_ X-MS-Office365-Filtering-Correlation-Id: 90f46134-1f9d-4ce1-aa6e-08dc6f86350e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|36860700004|82310400017|376005; X-Microsoft-Antispam-Message-Info: +cTjFgFuvi9x0L/L+B79AhyD1K7VSOGrtrDpLpU3oHc5FAVuZBFYDitjUitHdqjJarq6FmZJ666/EdPTq/sgJ4Rl+IhzN9Q1BOWfhNWFt0PHFEPgFQzScIki7C20ZJu9W+xydIaamnK6C/GZE15tZgJa5X/iSi9RgxLYLcCgnRmQpmkd5e9GVyDh5foBFnyRyx7fJXH2Ad75R9vGVmEw4jergdO0SHkDr3CdxHpGDKyAPQXUnSKZ1e+FGMueg04mFppB6N/s36SnZb52zDxwyFZvqiCfJ1Uxq1NWI1AagLLubG6GWR/uYPQ7bG3MEGr/WUkge3EmWQPDHouCiP6Gz9Nm9I3LjPegCZtOAf+oljqkXNnzUlOpH/Y6IDTBE1y6T98S39a9//g3pIP63R23NaxgcsDxQVak/BNqiMiTxFYwLRcH8CVAmlYGM8/TRzkTNagkROla3ipxO88+UHy8IBT107nwJv+AxxuN13XNUrYnTJHx/5WoUiTLxvdpBvIBJl8ROqvpdtbB+JKIN+F2M2Q3rAHaAm4DUToEPYJjhgsOeiwmbmK6rOGffEcU6zgou2nbVj1glLzCmU10BtWLYJQakHPZc4hyMlcrLEvdrF3K1Y623wowruKjLjjdFWT2iPD93Rm6eB4VdqQx+kvZ9ZkdzfviezS3aqON+jb2Xqgnb3vPVSmOUXwCoaaPPMhfaVxr8aGxhGFGHPpkvmNtfRNXWXABKcz2Bacpdg1FWcuYrB2ew26jwYy2Ii3a+Lhq56ApOwUDMzLlw3jtxIroYCaU/RZ83kGYdXPQh9RRrvXyILJ0Cl1vnr/hCDSfl37VU8Yiks+fdzpnpw72MtfiPux7Hm9olEA6UhDs5plyiFfLxkdoJca620STfzSWSUVRqXUKe5b2MavEHqcSnpUnUyfjFY5gX1lzggHRHzsawJuBxsqDakzEtQWwPYJ9XaCkqX5EQz722aHBMpeeCpifETfCizCt+X5AAbk2lB1h0pg6ckern0vsY9lQnVI/aiFu+Lbb0S6Yu19Mw9vReT4W7F4nUNdK+ee4rUD+nv278Iv6fsMOohwhtP7MLnBceqX+HSTN+e8zFk6ZWzwY+BbCsfc9ZqqPM/Rfbzm2deJhJMYIeX5VSTtmCGwiwsChREuoDVkScqRrjGIQODU02C8gLXPHtHgUkDxauvvCk9PbfxZXG7J2kYaHazPQzgqYJWoEmpvhuXcPwzxIn8sJHkyfMfRLKBJz7aooHNfMT+rntecwhaTMLWHUHFpG3ceo1jarmlbnjhUiFNzg42XvpPXFuzU2As15+9eUEBkTrbvmOkQgl9z8nIxkGmujhqaiXFFkBVIGCfe7nodQ4mP9EyU8DpQTFcgjuVekwge8glpQQ+hBQOf31U1ghhopbL60zSS2 X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(1800799015)(7416005)(36860700004)(82310400017)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2024 17:42:18.4659 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90f46134-1f9d-4ce1-aa6e-08dc6f86350e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017099.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6866 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240508_104234_421439_5F1BAE48 X-CRM114-Status: GOOD ( 16.33 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add of_pci_preserve_config() to look for the "linux,pci-probe-only" property under a specified node. If it's not found there, look under "of_chosen" in addition. If the caller didn't specify a node, look under "of_chosen". With a future patch, this will support "linux,pci-probe-only" on a per host bridge basis based on the presence of the property in the respective PCI host bridge DT node. Implement of_pci_check_probe_only() using of_pci_preserve_config(). Signed-off-by: Vidya Sagar --- drivers/pci/of.c | 54 ++++++++++++++++++++++++++++++++++++++--------- drivers/pci/pci.h | 7 ++++++ 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 51e3dd0ea5ab..d21c0bed36f3 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -234,27 +234,61 @@ int of_get_pci_domain_nr(struct device_node *node) EXPORT_SYMBOL_GPL(of_get_pci_domain_nr); /** - * of_pci_check_probe_only - Setup probe only mode if linux,pci-probe-only - * is present and valid + * of_pci_preserve_config - Return true if the boot configuration needs to + * be preserved + * @node: Device tree node. + * + * This function looks for "linux,pci-probe-only" property for a given + * PCI controller's node and returns true if found. It will also look in the + * chosen node if the property is not found in the given controller's node. + * Having this property ensures that the kernel doesn't reconfigure the + * BARs and bridge windows that are already done by the platform firmware. + * + * Return: true if the property exists false otherwise. */ -void of_pci_check_probe_only(void) +bool of_pci_preserve_config(struct device_node *node) { - u32 val; + u32 val = 0; int ret; - ret = of_property_read_u32(of_chosen, "linux,pci-probe-only", &val); + if (!node) { + pr_warn("device node is NULL, trying with of_chosen\n"); + node = of_chosen; + } + +retry: + ret = of_property_read_u32(node, "linux,pci-probe-only", &val); if (ret) { - if (ret == -ENODATA || ret == -EOVERFLOW) - pr_warn("linux,pci-probe-only without valid value, ignoring\n"); - return; + if (ret == -ENODATA || ret == -EOVERFLOW) { + pr_warn("Incorrect value for linux,pci-probe-only in %pOF, ignoring\n", + node); + return false; + } + if (ret == -EINVAL) { + if (node == of_chosen) + return false; + + node = of_chosen; + goto retry; + } } if (val) + return true; + else + return false; +} + +/** + * of_pci_check_probe_only - Setup probe only mode if linux,pci-probe-only + * is present and valid + */ +void of_pci_check_probe_only(void) +{ + if (of_pci_preserve_config(of_chosen)) pci_add_flags(PCI_PROBE_ONLY); else pci_clear_flags(PCI_PROBE_ONLY); - - pr_info("PROBE_ONLY %s\n", val ? "enabled" : "disabled"); } EXPORT_SYMBOL_GPL(of_pci_check_probe_only); diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 180d3907b543..feedbedd65df 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -650,6 +650,7 @@ int of_pci_get_max_link_speed(struct device_node *node); u32 of_pci_get_slot_power_limit(struct device_node *node, u8 *slot_power_limit_value, u8 *slot_power_limit_scale); +bool of_pci_preserve_config(struct device_node *node); int pci_set_of_node(struct pci_dev *dev); void pci_release_of_node(struct pci_dev *dev); void pci_set_bus_of_node(struct pci_bus *bus); @@ -688,6 +689,12 @@ of_pci_get_slot_power_limit(struct device_node *node, return 0; } +static inline bool +of_pci_preserve_config(struct device_node *node) +{ + return false; +} + static inline int pci_set_of_node(struct pci_dev *dev) { return 0; } static inline void pci_release_of_node(struct pci_dev *dev) { } static inline void pci_set_bus_of_node(struct pci_bus *bus) { } From patchwork Wed May 8 17:41:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 13658988 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 4A728C04FFE for ; Wed, 8 May 2024 17:43:05 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=L+kLm0essh9wWf9FC6EKXnJXhaL8zt5A9OBuSgHl/QA=; b=gkwmPQ2Zb8geIH XGczzSMvmXorPkngks2TJ+JxwoNbTgQvp7cTLizdyb793Vn+zxhL0YgpXbQzzivzXkxiQGY8Fooj6 8klPe7aWmODK80UQw5dKz1aIlMaUAROAUTuHlqsfL7TFTIWKQ5NVVZ1zOCUzoyS+Z4Aj6uV2bb+5y 75HUl0MQHX4KGkkoYShrMdiF1I8O/2YWIL8D/cUGMeaX3LB4OUJOi2mbbDqwuUiFLrbb10ZIiGl+K tNfrdowgac7mAR3fRIg2MFm4TylwXdEt/ZRLTM6DZs/id8dmq/+t/Oiw6o0/ixkmaP/VTDPRc5Ouy 0BIhXWxE5sumes/P9jQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4lJY-0000000GPfD-32oR; Wed, 08 May 2024 17:42:49 +0000 Received: from mail-co1nam11on20600.outbound.protection.outlook.com ([2a01:111:f403:2416::600] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4lJR-0000000GPZL-0hUV for linux-arm-kernel@lists.infradead.org; Wed, 08 May 2024 17:42:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ju2FODLadTs2AvxGFZsRqnnEBpoKUxPOSqI7YWWhwGcn7SKKe4U7ZsStnYEGBfRluBCW3rsbf0w3AEoOHfXbMyKIJTuaX/uMB7SvgGbyYUceow5QWAoyDvjRHHR1Isw51w9Y7jJ2HIN55RsGWX/dmBmPax5k2+Me21+fPkFGubfOlp3g1kpi2eBGveygtWGsoaHUCcWQkHTAzCXodxqccNpIIAZC52Yc9qZKjfEHkBK4IxslbkjOiFx/IU0DEB4I9qdmr6WLBqvVPN3HMPYj8GA9YI5JiHKW48UjC9LgKGDBEcFnlw0Siq4lXYD0XnaiTiH7Z8FOX5dLblwljouupA== 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=LKNpLXsBUlqmtukWmZYFvtj8c+Uu5VQ/A05GblTLFd4=; b=YrloX+pTirrzkMogH8wVYBnb89X7NKbv/YWCbae9MESbuqOdoBXFUJBDT0qA99i7xh4MMHD9DYzZVTk+COxLWSXtERCU+Q7SBATdcREIovSqrNfuXI366/+8K90B7kIKZKD5OHv3nUMi7b2nmPKRqx0DK39cd//yQwm+AUAJZxNPhmsDAr16CaPQcPDBPs3HBiYUA/hBDNm6LhMETs2x5MSa2M0UaRQugrv8W99fxWmvCHycw/NFJDDW5Ely7Vh5Pu7ag26/sdJUiSlqMemfYCyqpFPFjLnrPp57u1gekQYQjAxBE9nAbJDx1a/xIwmlowO1i6I2wmw8pj7SM9nHiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=google.com 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=LKNpLXsBUlqmtukWmZYFvtj8c+Uu5VQ/A05GblTLFd4=; b=G5/IzlphNSw1blfFH6emJYatwGAkADCEfV0hxZp1cVFpLr8nTbTQ9hTgFXxF7aX6w3IGq2uLVy7LQjp3tWFlQk3gLt5r8LDApspcKLg6GE75ackEhfGH1JqxT2bFvNuayePHsGU2RkZsINFQEGbiagwwdfIdk5erfCIEEqFK9xkRnJq346WsbT45rjdzVOL3S8lCS8bw9TCR0qObps3k7UpAPJJXAjPLTs4ZhHd4mfxATXgvN9/yOV991GupYC0CY/llbZ5eQFTMkku6kncW5XqUtx6AdVcESAqJBzK9vQHxgHJ3yfTD+859DcCcH0M4pebDZ3NYV+vQfpAeGa/19g== Received: from DM6PR06CA0003.namprd06.prod.outlook.com (2603:10b6:5:120::16) by DS0PR12MB8415.namprd12.prod.outlook.com (2603:10b6:8:fc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Wed, 8 May 2024 17:42:28 +0000 Received: from DS1PEPF00017096.namprd05.prod.outlook.com (2603:10b6:5:120:cafe::55) by DM6PR06CA0003.outlook.office365.com (2603:10b6:5:120::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.46 via Frontend Transport; Wed, 8 May 2024 17:42:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS1PEPF00017096.mail.protection.outlook.com (10.167.18.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 17:42:27 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 8 May 2024 10:42:09 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 8 May 2024 10:42:09 -0700 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 8 May 2024 10:42:04 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , , , , Subject: [PATCH V7 3/4] PCI: Unify ACPI and DT 'preserve config' support Date: Wed, 8 May 2024 23:11:37 +0530 Message-ID: <20240508174138.3630283-4-vidyas@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240508174138.3630283-1-vidyas@nvidia.com> References: <20240508174138.3630283-1-vidyas@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017096:EE_|DS0PR12MB8415:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ff2a747-6f5f-48e5-9017-08dc6f863aa2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|82310400017|376005|7416005|1800799015; X-Microsoft-Antispam-Message-Info: t4sc45athLZiTLhtOVR/vvWvWiFkgPnyTljw0pHXQpWQ4PzpmqiB38AOXu0dnYcb/HL5ENkuuSChPWdSQ5b4GkuMRs4KX6/ZDP1gXXV+xKw7KSjJA9F31L+7K9ttnM8bclrbDlOgicGdFyPTdAZVeZ9xR3HQDUkuI6iK4sSijaVnY8JmKt6cp6Nt7pHMdcqEMGXjNTVq4LRQ+8qJQnuj7Gz1WZ0hV0eWiOJcv1KpL+17b1Vh4Nn4+KOrUo736kB7ssvplc8voA/bpuDaBMmLjpiFRoUYLrKNQMJeovDSRVkRwRS+wK270W/nUmxz5dNBIggYIlp80WKOKoA2WSfYUyCyHHPk0/wpuOhfO9eMo6DC11+PKiRWMKIKRUhOJFRJiORR2tsLqPlwrRpaqNV2Ad5YJ6XC9Yn2WZE9R97And2Vau0nMmTlRi8Xr3FJmVtvgWaHGeoZb0+FPpd6yyNSnMPLpeOLZx/sUDKhyxxsVtwiR3E66SACaip717Zz4qlbGxhUofKYbYDYwn2yzMQuViQ62pj3ZejjdmRL6kbYvvGR2pk8/IsPSxYq5Rx14UDARunepuYiWpYnpTYg4EECPYYjiEm/7flii+iVrTZ+UugzXqgfT8c8vvGFC54XcprqAeK9yCjDVD9jIaUIAB4Acfwpfxuux83hbw8CA4OkxHa+wLsE3visgRviGkNmITOTyt6CUzWc9cWMRE6w4pOYlzjTe7idPFCoHLRvohKLeu9cS8PH0HjW5XvS1lqyfoF+DE5JiUDaT6tqPgeRyLrNbAxu5DEqJJpb178/DfIDMPo7mttP/K9kox+qYaE5M8RT+JBGXrRqJDeN9qLcRguxlkQorUV8KKUuRoD0Ex1MUi4UurFiuBjTeBgDh+uHuwwqbWKjdNk1h005HAKcKgOv9xx4LkQak/BqMheLuTmipqi/2P3MznrkgsNhM4UlKoNqBC8h5M28lVDOu/OG+dt11E71SwCU+e0wmmJSfaDe3i/asOWccSl5OYdc1PecqHdRfTFYGxvKPp/3GU2Mj1GgJgDlXWqUvw3nDc2U17GfcWRdaHYnFyoIleLkOVqKBvJr0lX15xRNTzW6QLSYbOYD25IKNp1zMipaX9OP3Q7XFdAaGzuCXjmL0+Bl0/ilpzi4f7/E4iguCta2pDW8iAqPpQAKwrmrQopIT/HgOcfDengPm9Xp1gQDeeOQCwuYN5RdmyJwREk1FYjZjGRpBFL1iAwY3cwKiVsWY8Fcc2KKOoo4I6kHsUCmIOu06bprfAk4hfCybX2XDOiQU40+SwPwVBFRquGr84eHrXtukN6clePcuXtQgiqCiTsNKyL1fwGr8LRr6SnhK/Tybia2YchtgUJPiqaL3TVnO1J0cnFQgejRQC1MluYdz1pXqwM0MgN7 X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(82310400017)(376005)(7416005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2024 17:42:27.8238 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ff2a747-6f5f-48e5-9017-08dc6f863aa2 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017096.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8415 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240508_104241_278203_DBDD639C X-CRM114-Status: UNSURE ( 8.72 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Unify the 'preserve config' support across ACPI and device-tree boot flows. Signed-off-by: Vidya Sagar --- drivers/pci/probe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index ee086d029450..2c232c22d6af 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -894,6 +894,9 @@ static bool pci_preserve_config(struct pci_host_bridge *host_bridge) if (pci_acpi_preserve_config(host_bridge)) return true; + if (host_bridge->dev.parent && host_bridge->dev.parent->of_node) + return of_pci_preserve_config(host_bridge->dev.parent->of_node); + return false; } From patchwork Wed May 8 17:41:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 13659059 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 E8FADC04FFE for ; Wed, 8 May 2024 18:46:35 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9NiJCU03/JgWgVdt1mmCGCXorl2LQrRzwdrgBnMmwTY=; b=ylAOZ0VG3YqRw3 CWlG8W4zDDO4MD+b4xju4lPYf670zKbAogI8sxnoAf7BDkBRWDQt2PbYgTbJZtTzCZVoElp+yUJGu tt5hRsrXp5pYn4G4vLyAELPmE/wwLvRhD3aXJFMXX1qyXtgZ0WTFXuuXt+QplgF8gA40GCG5SN/a/ tZy/d6a+8wjQepFz1MDNMb3DaqdAl4Vo6TPSD1FDGbnjtAHbZ32u7BPhqGhQxZ3yJSlzqoUdbMR1n wW3k0ldZW3BQUKaQxEj2upo5n4SIxfOpdsZcKz0LqAJhk/DATFMwCGsVTNkbHuH+62J/C9GCx1Y42 0xj8DUNoynyX7MdNDurQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4mJ4-0000000GaKN-0i6j; Wed, 08 May 2024 18:46:22 +0000 Received: from mail-mw2nam10on20600.outbound.protection.outlook.com ([2a01:111:f403:2412::600] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4lJe-0000000GPhz-0Evm for linux-arm-kernel@lists.infradead.org; Wed, 08 May 2024 17:43:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZIFx2Yrocpb6mlm10XmF6VS6xFEQ8xslzra3wYb0PsgttaiJKDRNIfDODHE5px+nVDidGGRJgB7P33CKWnGQ2+cHT0WKCIyYzU//KqM4Qg6JFjdPJhixdqnXPXJ0kgPjTbPMyXSLUADYx/WRoXmn3ob+hDur0mWBA/RQSFuyUy02gwIWkIDFyhNtIL1wRvqou4vnFWIhYBfazAX8aQxgFzfAhIq+0+nSn1bElO+Ldxoq2kwduEzm5vgUBv6XdbKy4uI+q6mgxPtvf64NTUaENQcoP0UW9oko7DWZpqQsUMuQakGj60z/6wyvcFwO02/OaNolboe8nqBPP266SXe+Cg== 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=y4Yn++iQ9U9uabJZAwDKvB6h6xp9uewjL/y+O76dY7A=; b=hG8ECeIDFhk7huUUQA+62RS4uqudsdh/KQjSmR/5lcweY6pgD0lgTmDAmIPozd5kBfRIzF/67fVfVUAHSJO4P0Vrj/PfULBkUpnEJLXePPy3iOyCzPWpM2SSfjo0QrYYtJEn7QJrKCwvzs2AWH0ih4WRKaZ2NYtz8p80oS8uMQbje7Ke2h4zhN8TfJD117Pyo4wvtwiN2OBFB44u5hXCCxSkkx/8Sd1knmDb/d67bzPTSJQnDbIGagJpDA+cxV4IYPuPbaiPI8JS1+FUEtME4DEFTlilH0EjM5It7mE7ZFZAdzkJgGavKJfiurk+Ki54CseWyq5O5/D2JiwxtYZPgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=google.com 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=y4Yn++iQ9U9uabJZAwDKvB6h6xp9uewjL/y+O76dY7A=; b=oid2V30vlti9Va8RYZMAjds37sfJ6QtVF4NGxSmLE6pUu4X0ToGrDc4156/Fhanz/24N6uzGyAl/VaLSfyrBnNeHL20zTEHOzPGOondufpazgZbJ/+KDQfz3A5+ELTCjD8lbyyt2Vim7zo7oQuleCd/zTfy2+pb7oaO78Ut927LpKz3Hfo7sXeNL2AfP+TpRPiOImrydNfYY07f6/lc4rdA1LKMo881l5+rY6owuZbugOFUcTVSVInB7KQlIvYRwS+ujS9clgAPoCLPW5Cq5rkP1ksCPypys+tQyINIslgWuSWY6s7zqpnFb4Ej5o1NcIKxydtRkORyDoHHjuvIxYw== Received: from SJ0PR05CA0142.namprd05.prod.outlook.com (2603:10b6:a03:33d::27) by DS0PR12MB7995.namprd12.prod.outlook.com (2603:10b6:8:14e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.45; Wed, 8 May 2024 17:42:35 +0000 Received: from CO1PEPF000066EC.namprd05.prod.outlook.com (2603:10b6:a03:33d:cafe::64) by SJ0PR05CA0142.outlook.office365.com (2603:10b6:a03:33d::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.43 via Frontend Transport; Wed, 8 May 2024 17:42:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000066EC.mail.protection.outlook.com (10.167.249.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 17:42:35 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 8 May 2024 10:42:16 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 8 May 2024 10:42:15 -0700 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 8 May 2024 10:42:11 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , , , , Subject: [PATCH V7 4/4] PCI: Use preserve_config in place of pci_flags Date: Wed, 8 May 2024 23:11:38 +0530 Message-ID: <20240508174138.3630283-5-vidyas@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240508174138.3630283-1-vidyas@nvidia.com> References: <20240508174138.3630283-1-vidyas@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000066EC:EE_|DS0PR12MB7995:EE_ X-MS-Office365-Filtering-Correlation-Id: 28de7354-08a0-419b-5ca2-08dc6f863f0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|7416005|1800799015|376005|82310400017; X-Microsoft-Antispam-Message-Info: S4vAOQFKwH6NQAeCRUE2XbaDxU2AawJsRj67mki3QzCD07m/397h7gZO0Qed91g9BVjRnuT5z80XOUTUf59/pJ5kSp/HydjctiXDa8WbdV8jfeW60D8F2JOujZZh6lucgso33x1se14MqAbcYvUbLcYhn1i6L/sxniCRABp148a8pRZsnNWl3XnKmQ5beRQSy4WAtQBkjUyk/UN5t43TBgSkHF2QQDoY6pDFOrOpMgyuHCAUV+5pyR+CsOoWj60K4Y7WeTjtZoiR23I6AHJmJDroC6mearpIdko6czxsDyuIr9DWMSXctY8UkW+3PQaIlyO9cpNSHaodpRlD/70qBvisRhXQWaM18h6CHhE2t7XMpr+TYGBg165I9vpL+g1xKP++nCX34cawrHU8vzQqFn4Rh3NWxtW4OlskUmcPdiEE+yICiCusYEHLjSNK7d5TNH+RoKZDeVpygTTm6/L//ocR4GFaEvoh2XyhZxixgKSDeaVlIA6VZZf7yLOJewcUoAq6VrcI3sZDR2taFupAoo8afKT+AHkeFFYbR3s44evuqh+6MScuRZgci3j/XKUs9Zy97NpEP/2qizt8pDZUQ8DBwJFabBrg9JjSKF3Xkf07qroHxUYcN4t4wEfJh8r6FIlAP7B395fmv+a5AcFJn0yqGuCxv57kC/XHP/VgcCwvtwS6xsndbBeSQK27exYrfJ7FvlswARd1F96/ZMSaWoU5i4pU0U0HjRp7I8k+FbNKl+usuh3ZOzIdhHwC44UQ7jL7CGryvb2QqqX5Y6UZcpNrkm8RQtpwEfb9078Gnlz/+xtjQMcABdhNXfwfQt2hWJkvzX13/48NkK9HX6eNnzmJ4YmNqgBD4psVTT8Dq7SFOhGSmLqfjBoeMw1QrAop1kU/cUuC1Pe2IvFHneTw9CIp5rfi0k3UHZnT9pjPeUGqwkbuanxWWy2BlRfjJs4gnBvB8jCvplL+JElDpaJpfI9VY73Dc7asO89eMG0tXo0I5iwtR1oqFIA6pjb1NqSixjHU4FToIOzaB12hklFC2x0xv8bqRHn3uF4GE5U5WcwWWVHIA16S/91yAde4ODPtQJa6CBAoCwaGHe/6OzSuPF7OyX9/zRaKz7DlKHYvaB2AdtSbX5DrBwSZ7bgTo5/VXBH26n1bvgMUmhT815tMuvlaZXAE0vW+FOThLRlGjRBJoosgrs9cAhBaELbbp83Ty1wp89JPhLWaTF7z7Y07Gbt/k/NpJJZFyHj7IhbxzC5x5ap6jsZVPK+Am+wFqpXfxOvqOIvD678aN5XK98SimLFoqhmCrzfyzS89NRXI7G3gyVnUAy36awQRLYEc2RijEOZqJNQcNL41CGNDwiZhvkd/nHjyO0x4DYBR0bM01Ns9o0uLv0SHn6dwn4IXu5T6 X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(7416005)(1800799015)(376005)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2024 17:42:35.2840 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28de7354-08a0-419b-5ca2-08dc6f863f0b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000066EC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7995 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240508_104254_362414_61344A17 X-CRM114-Status: GOOD ( 13.95 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use preserve_config in place of checking for PCI_PROBE_ONLY flag to enable support for "linux,pci-probe-only" on a per host bridge basis. This patch also obviates the use of adding PCI_REASSIGN_ALL_BUS flag if !PCI_PROBE_ONLY, as pci_assign_unassigned_root_bus_resources() takes care of reassigning the resources that are not already claimed. Signed-off-by: Vidya Sagar --- drivers/pci/controller/pci-host-common.c | 4 ---- drivers/pci/probe.c | 20 +++++++++----------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c index 45b71806182d..c96b2de163b5 100644 --- a/drivers/pci/controller/pci-host-common.c +++ b/drivers/pci/controller/pci-host-common.c @@ -73,10 +73,6 @@ int pci_host_common_probe(struct platform_device *pdev) if (IS_ERR(cfg)) return PTR_ERR(cfg); - /* Do not reassign resources if probe only */ - if (!pci_has_flag(PCI_PROBE_ONLY)) - pci_add_flags(PCI_REASSIGN_ALL_BUS); - bridge->sysdata = cfg; bridge->ops = (struct pci_ops *)&ops->pci_ops; bridge->msi_domain = true; diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 2c232c22d6af..b4adc33f88cf 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -3088,20 +3088,18 @@ int pci_host_probe(struct pci_host_bridge *bridge) bus = bridge->bus; + /* If we must preserve the resource configuration, claim now */ + if (bridge->preserve_config) + pci_bus_claim_resources(bus); + /* - * We insert PCI resources into the iomem_resource and - * ioport_resource trees in either pci_bus_claim_resources() - * or pci_bus_assign_resources(). + * Assign whatever was left unassigned. If we didn't claim above, + * this will reassign everything. */ - if (pci_has_flag(PCI_PROBE_ONLY)) { - pci_bus_claim_resources(bus); - } else { - pci_bus_size_bridges(bus); - pci_bus_assign_resources(bus); + pci_assign_unassigned_root_bus_resources(bus); - list_for_each_entry(child, &bus->children, node) - pcie_bus_configure_settings(child); - } + list_for_each_entry(child, &bus->children, node) + pcie_bus_configure_settings(child); pci_bus_add_devices(bus); return 0;