Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8444157ybi; Tue, 23 Jul 2019 08:38:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5GYszTJ+qlVx1Zv5YDVxWilvpb7avUBXXikupKSC85ofenu7ibf/hHAphuvT680P0QMIT X-Received: by 2002:aa7:93a8:: with SMTP id x8mr6631932pff.49.1563896328519; Tue, 23 Jul 2019 08:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563896328; cv=none; d=google.com; s=arc-20160816; b=n70xIzSt+vpLFHIF7+wAcKMZ+fz+d2Euy2uIUh92l+kPO4c+qsaSiw9/8yp2pCwOrh exJk5sjsFYjasFCT7lBHR/kc9tcIwg/zHzD2+DDC1gM2Dyrra7jgvOvDrc6/SkGvgTAq ssB77Ml6OQRQUcClwb3pZuH13NHhThkbCFrmPBBXLlEt5J3UB8Ng3f7B41ksDelSuXMH nDHJQOWE/RU7phwZY4uyFd7SEgqanpKXrodzdje5fq4wIuMcGmrvVazg1wXt8o0kA3lR 4BXpxgVGk6Hb7mvRyv3Tts8dDHJ0Yzhh4tM7qn6Jllp0BIgSlDDwaFRxO8UNYCCSEk5o vI0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=r3UejI0fEyx4nycQ3vf7JrpqMGHRZyoys9vsmeuSdCk=; b=mtIKJrD/VvJl92OqRY1OSmk4h98260Tc/4LAb5KbvaDIFgPMmxA3GAMehA3HsuysxI bqgQN9yzm2MBz6oHtrV+0alVEPUpB1pd1/eVtfEAgEID8V6JqlsIuCShHweXylhRwxkw ldpboUa9icVhnllGmZUHc+ArDzaBFWiaOD4C6LrRPvRYe/AAVk1sm2n3JUIth2LFQcGF BiKqzmG/ayatPD6zL828vPVGIu6FPzHkqfgwjOJzkrlMyaNk8UjLYUiVEt/tdgyQpgV5 dmE4hH7jngr3sslUFy+2VgCPALOHFthoRJNvtjxmfmnbJBer/Q92/5fzuZZOxh/8Ycgi jRWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=WpYunE6Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k143si11925170pfd.212.2019.07.23.08.38.30; Tue, 23 Jul 2019 08:38:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=WpYunE6Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388899AbfGWJ1q (ORCPT + 99 others); Tue, 23 Jul 2019 05:27:46 -0400 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]:31440 "EHLO smtp-fw-9102.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727408AbfGWJ1q (ORCPT ); Tue, 23 Jul 2019 05:27:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1563874065; x=1595410065; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=r3UejI0fEyx4nycQ3vf7JrpqMGHRZyoys9vsmeuSdCk=; b=WpYunE6QvhuTBTT0kkM5lBnZ+I0Xcbplq16FNSNp3Cg+2wMmCyRyV7I4 JPqjjkOFzS+H4LZu5mbcGU9p85vScXytLx0h6e+Z4rZohlzHNFF21lVZI +upfWVJLzI2iyKs3dcWLiPrVjHnMdFT9Kc7PnBQrW7aYlwZBDDT2Qe7LJ M=; X-IronPort-AV: E=Sophos;i="5.64,298,1559520000"; d="scan'208";a="687150634" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2a-69849ee2.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 23 Jul 2019 09:27:43 +0000 Received: from EX13MTAUWA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-69849ee2.us-west-2.amazon.com (Postfix) with ESMTPS id BE1F9A2490; Tue, 23 Jul 2019 09:27:42 +0000 (UTC) Received: from EX13D13UWA001.ant.amazon.com (10.43.160.136) by EX13MTAUWA001.ant.amazon.com (10.43.160.58) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 23 Jul 2019 09:27:42 +0000 Received: from u9ff250417f405e.ant.amazon.com (10.43.161.85) by EX13D13UWA001.ant.amazon.com (10.43.160.136) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 23 Jul 2019 09:27:37 +0000 From: Jonathan Chocron To: , , , , , CC: , , , , , , , , , , , Subject: [PATCH v3 8/8] PCI: dw: Add support for PCI_PROBE_ONLY/PCI_REASSIGN_ALL_BUS flags Date: Tue, 23 Jul 2019 12:27:11 +0300 Message-ID: <20190723092711.11786-4-jonnyc@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190723092529.11310-1-jonnyc@amazon.com> References: <20190723092529.11310-1-jonnyc@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.85] X-ClientProxiedBy: EX13D27UWB003.ant.amazon.com (10.43.161.195) To EX13D13UWA001.ant.amazon.com (10.43.160.136) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This basically aligns the usage of PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS in dw_pcie_host_init() with the logic in pci_host_common_probe(). Now it will be possible to control via the devicetree whether to just probe the PCI bus (in cases where FW already configured it) or to fully configure it. Signed-off-by: Jonathan Chocron --- .../pci/controller/dwc/pcie-designware-host.c | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index d2ca748e4c85..0a294d8aa21a 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -342,6 +342,8 @@ int dw_pcie_host_init(struct pcie_port *pp) if (!bridge) return -ENOMEM; + of_pci_check_probe_only(); + ret = devm_of_pci_get_host_bridge_resources(dev, 0, 0xff, &bridge->windows, &pp->io_base); if (ret) @@ -474,6 +476,10 @@ int dw_pcie_host_init(struct pcie_port *pp) pp->root_bus_nr = pp->busn->start; + /* Do not reassign bus nums if probe only */ + if (!pci_has_flag(PCI_PROBE_ONLY)) + pci_add_flags(PCI_REASSIGN_ALL_BUS); + bridge->dev.parent = dev; bridge->sysdata = pp; bridge->busnr = pp->root_bus_nr; @@ -490,11 +496,20 @@ int dw_pcie_host_init(struct pcie_port *pp) if (pp->ops->scan_bus) pp->ops->scan_bus(pp); - pci_bus_size_bridges(pp->root_bus); - pci_bus_assign_resources(pp->root_bus); + /* + * We insert PCI resources into the iomem_resource and + * ioport_resource trees in either pci_bus_claim_resources() + * or pci_bus_assign_resources(). + */ + if (pci_has_flag(PCI_PROBE_ONLY)) { + pci_bus_claim_resources(pp->root_bus); + } else { + pci_bus_size_bridges(pp->root_bus); + pci_bus_assign_resources(pp->root_bus); - list_for_each_entry(child, &pp->root_bus->children, node) - pcie_bus_configure_settings(child); + list_for_each_entry(child, &pp->root_bus->children, node) + pcie_bus_configure_settings(child); + } pci_bus_add_devices(pp->root_bus); return 0; -- 2.17.1