From patchwork Sat Jun 15 00:23:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 10996899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 136011395 for ; Sat, 15 Jun 2019 00:30:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0116F28793 for ; Sat, 15 Jun 2019 00:30:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9286287A9; Sat, 15 Jun 2019 00:30:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6103C28793 for ; Sat, 15 Jun 2019 00:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=hyvm81QagPd6jTrGm4y7929u4Dwqo+2BDfvO5uOMJl0=; b=kFy U4dj3gBLMCrhq2q/YME5cqCgFlYQZszwoGkppTXkbDL3odXEVIUCshENGyYQ40SjOkTxS6VT9MC9g n7JFkrbcsETmZ0qMjXI8FTiffAJYkbHf39JZ1l0yL+Vb0IJABYQ+P9AI4secLGFeFtIrSEUjBAsI6 KtqaGO2QQaXe5h0qC9oxoWGH+UQP3k917EeP+RFNuqbiUAwCPzeTRAgpg25ONJ0uefyMfOj3D6Hw8 7e5dp0GUZz0NmfeekuyHEjKb5mS4PFQEzq3iGEjCcGuNAmLgjWeFreHN/o1iXSxS2kI/XR/nUcfDz Dt/Vr8i+HUIrnKBLPOxptg+LIVC8x1Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbwa3-0008Rf-DI; Sat, 15 Jun 2019 00:30:03 +0000 Received: from gate.crashing.org ([63.228.1.57]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hbwZz-0008Gw-LC for linux-arm-kernel@lists.infradead.org; Sat, 15 Jun 2019 00:30:01 +0000 Received: from ufdda393ec48b57.ant.amazon.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x5F0TfFQ010961; Fri, 14 Jun 2019 19:29:42 -0500 From: Benjamin Herrenschmidt To: linux-pci@vger.kernel.org Subject: [PATCH 1/4] arm64: pci: acpi: Use pci_assign_unassigned_root_bus_resources() Date: Sat, 15 Jun 2019 10:23:56 +1000 Message-Id: <20190615002359.29577-1-benh@kernel.crashing.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190614_172959_845460_CAB08A75 X-CRM114-Status: UNSURE ( 7.09 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , Ard Biesheuvel , Benjamin Herrenschmidt , Sinan Kaya , Zeev Zilberman , linux-arm-kernel , Bjorn Helgaas , Ali Saidi MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of the simpler pci_bus_size_bridges(bus); pci_bus_assign_resources(bus); Use pci_assign_unassigned_root_bus_resources(). This should have no effect as long as we are reassigning everything. Once we start honoring FW resource allocations, this will bring up the "reallocation" feature which can help making room for SR-IOV when necessary. Signed-off-by: Benjamin Herrenschmidt Acked-by: Lorenzo Pieralisi --- arch/arm64/kernel/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index bb85e2f4603f..1419b1b4e9b9 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -193,8 +193,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) if (!bus) return NULL; - 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); From patchwork Sat Jun 15 00:23:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 10996909 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E71E91395 for ; Sat, 15 Jun 2019 00:30:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D54F928707 for ; Sat, 15 Jun 2019 00:30:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9C082870F; Sat, 15 Jun 2019 00:30:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C72628707 for ; Sat, 15 Jun 2019 00:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1cTAvrYBHWQMFqPJedLlZ2h4uup5OohrCo7nWTPEJVQ=; b=IfT/UrUQf+TtKXJdqCd1wPAiS6 sI9R/Y0m1QlP11JYzej8Fh8pLzcqhML2v7IrHl+NCrt9AyZNGMkrCSw4NlDkFmmXLINOtPxGLzSZc 9bRQHTx6Mfrvh+cUVR61WIZgPjUnzjIk4C2mEPB6jmiPwjuXAq8f6/bhIIG/3EPIoSbIO7DQbS6CD y/+Vv92x/barucE0sXnu+l7ziexNenswEj3blPCR3Mj4pxrNlMS2LO54Vi9JK0+OvOrwV8oVY9QCy emos3pnRJerGQyPUfsueeoUUcvepvitWOC004B+pXsdM4PWW9gtjJkPG08qeKv1o9v/Fj9M7eY7Rk wmctSoIw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbwaa-0001ZS-O2; Sat, 15 Jun 2019 00:30:36 +0000 Received: from gate.crashing.org ([63.228.1.57]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hbwa4-00007Z-TZ for linux-arm-kernel@lists.infradead.org; Sat, 15 Jun 2019 00:30:06 +0000 Received: from ufdda393ec48b57.ant.amazon.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x5F0TfFR010961; Fri, 14 Jun 2019 19:29:46 -0500 From: Benjamin Herrenschmidt To: linux-pci@vger.kernel.org Subject: [PATCH 2/4] pci: acpi: Read _DSM #5 from ACPI on root bridges Date: Sat, 15 Jun 2019 10:23:57 +1000 Message-Id: <20190615002359.29577-2-benh@kernel.crashing.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190615002359.29577-1-benh@kernel.crashing.org> References: <20190615002359.29577-1-benh@kernel.crashing.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190614_173005_204007_536315DB X-CRM114-Status: GOOD ( 13.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , Ard Biesheuvel , Benjamin Herrenschmidt , Sinan Kaya , Zeev Zilberman , linux-arm-kernel , Bjorn Helgaas , Ali Saidi MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This reads _DSM #5 value on root bridges, and when 0, sets a "preserve_config" flag in the host bridge structure indicating that the FW has requested that the existing configuration be preserved. The upcoming spec change to define _DSM #5 for host bridges states that this should be the default behaviour, however doing so would be very intrusive and break existing setups. So we leave the default to be the existing behaviour. Signed-off-by: Benjamin Herrenschmidt --- drivers/acpi/pci_root.c | 23 +++++++++++++++++++++++ include/linux/pci-acpi.h | 7 ++++--- include/linux/pci.h | 2 ++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 39f5d172e84f..217b3916f0f1 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -881,6 +881,7 @@ 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; @@ -917,6 +918,28 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, if (!(root->osc_control_set & OSC_PCI_EXPRESS_LTR_CONTROL)) host_bridge->native_ltr = 0; + /* + * Invoke the PCI device specific method (_DSM) #5 'Ignore PCI Boot + * Configuration', on the host bridge. This tells us whether the + * firmware wants us to preserve or reassign the configuration of + * the PCI resource tree for this root bridge. + * + * For now, we only care about the function being present and returning + * 0, which we use to set a flag indicating that we'll preserve the + * FW configuration. + * + * This diverges from the spec which states that 0 is also the default + * in absence of _DSM #5. We do that today to work around the fact that + * our arm64 code doesn't implement the right defaults otherwise. This + * will be superseeded by a more thorough handling of _DSM #5 once the + * resource survey code has been consolidated further. + */ + obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 1, + IGNORE_PCI_BOOT_CONFIG_DSM, NULL); + if (obj && obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 0) + host_bridge->preserve_config = 1; + ACPI_FREE(obj); + pci_scan_child_bus(bus); pci_set_host_bridge_release(host_bridge, acpi_pci_root_release_info, info); diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 8082b612f561..62b7fdcc661c 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -107,9 +107,10 @@ static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { } #endif extern const guid_t pci_acpi_dsm_guid; -#define DEVICE_LABEL_DSM 0x07 -#define RESET_DELAY_DSM 0x08 -#define FUNCTION_DELAY_DSM 0x09 +#define IGNORE_PCI_BOOT_CONFIG_DSM 0x05 +#define DEVICE_LABEL_DSM 0x07 +#define RESET_DELAY_DSM 0x08 +#define FUNCTION_DELAY_DSM 0x09 #else /* CONFIG_ACPI */ static inline void acpi_pci_add_bus(struct pci_bus *bus) { } diff --git a/include/linux/pci.h b/include/linux/pci.h index dd436da7eccc..c50389b8df3c 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -506,6 +506,8 @@ struct pci_host_bridge { unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */ unsigned int native_pme:1; /* OS may use PCIe PME */ unsigned int native_ltr:1; /* OS may use PCIe LTR */ + unsigned int preserve_config:1; /* Preserve FW resources setup */ + /* Resource alignment requirements */ resource_size_t (*align_resource)(struct pci_dev *dev, const struct resource *res, From patchwork Sat Jun 15 00:23:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 10996907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C7D80112C for ; Sat, 15 Jun 2019 00:30:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA29228707 for ; Sat, 15 Jun 2019 00:30:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DA152870F; Sat, 15 Jun 2019 00:30:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 52C3A28707 for ; Sat, 15 Jun 2019 00:30:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=T4iEYzJK3MzPBDs4Ej1rjuF27rjAiRzdiuCjWXSaB4c=; b=GyljkACYjHD0kVpoOIf930Qp4P d1mS11vTwBYMz+yoWUUkZV9at6bjd9rRikdLBYmr2XTsmoUFQ32HxJhE5ocToQXS8jhSJ0Hp/I59k FA4mlSknhmiZ83eiAa7eNofJoANH1bOPj2kq+iAT4LU3hBb1WB2t8XFyh4IpxHtiMAlWsmYFmSYak EcQ4joyZTu+g3JaV00mUMGtV96FQKcRzagm67jB0WvBCc0Zus7Z7PD7TmZ6N94aYJwC1JbNcf49wL +HF7OoLO2ZgHGNvrEpYP/uFu/H58HpYPJ9SFAYncd9tidXjV4R1vLQTrHmSAtfDPDTTZt3Yh6Dn9j lB4J3Fww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbwaH-0001HD-2b; Sat, 15 Jun 2019 00:30:17 +0000 Received: from gate.crashing.org ([63.228.1.57]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hbwa1-0008HK-0M for linux-arm-kernel@lists.infradead.org; Sat, 15 Jun 2019 00:30:02 +0000 Received: from ufdda393ec48b57.ant.amazon.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x5F0TfFS010961; Fri, 14 Jun 2019 19:29:50 -0500 From: Benjamin Herrenschmidt To: linux-pci@vger.kernel.org Subject: [PATCH 3/4] pci: Do not auto-enable PCI reallocation when _DSM #5 returns 0 Date: Sat, 15 Jun 2019 10:23:58 +1000 Message-Id: <20190615002359.29577-3-benh@kernel.crashing.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190615002359.29577-1-benh@kernel.crashing.org> References: <20190615002359.29577-1-benh@kernel.crashing.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190614_173001_196504_37AC4E7C X-CRM114-Status: UNSURE ( 6.38 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , Ard Biesheuvel , Benjamin Herrenschmidt , Sinan Kaya , Zeev Zilberman , linux-arm-kernel , Bjorn Helgaas , Ali Saidi MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This prevents auto-enabling of bridges reallocation when the FW tells us that the initial configuration must be preserved for a given host bridge. Signed-off-by: Benjamin Herrenschmidt --- drivers/pci/setup-bus.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 0cdd5ff389de..049a5602b942 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -1684,10 +1684,16 @@ static enum enable_type pci_realloc_detect(struct pci_bus *bus, enum enable_type enable_local) { bool unassigned = false; + struct pci_host_bridge *hb; if (enable_local != undefined) return enable_local; + /* Don't realloc if ACPI tells us not to */ + hb = pci_find_host_bridge(bus); + if (hb->preserve_config) + return auto_disabled; + pci_walk_bus(bus, iov_resources_unassigned, &unassigned); if (unassigned) return auto_enabled; From patchwork Sat Jun 15 00:23:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 10996911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 47AC71395 for ; Sat, 15 Jun 2019 00:30:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36F46287AA for ; Sat, 15 Jun 2019 00:30:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A8C2287AB; Sat, 15 Jun 2019 00:30:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D765D287AD for ; Sat, 15 Jun 2019 00:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PVwagDJ32iZe1rz8NGv0xsaRM/FF8BivF7lcd0EP0OM=; b=XWDZvQ5k/TE1acRdcIw9bk6+Dl 0HCNGnKH8vGDfkNusU+NUo65XAi6quYZifMIoQ+IsXUUJIIg1ncO+OPLCEQthLXzBeBxEIsBPFus9 TwPFh74Vg2kyufOt8fS8Gq4IxPDbDv93hb2RBLBuaEDOFVHR2nusJ5XfB0hR2PTn6smblpD4HC6ll OaWB2Uux4X5JIMTF39hpEp4rIt7lckMnSEpFLSQL01lOKYLbsOmC4eyLpcOZlSM2VUj4uAfVPFpZT 2ojv3b/TlJTR90yhVtj7oC+GlipTd8lvRmGXE6AJe4W8v9vWBaV7Pt+XcGArbWngyYqTXtEsn705r riWegWKA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbwaq-0001oM-EJ; Sat, 15 Jun 2019 00:30:52 +0000 Received: from gate.crashing.org ([63.228.1.57]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hbwa7-0000Fs-6n for linux-arm-kernel@lists.infradead.org; Sat, 15 Jun 2019 00:30:08 +0000 Received: from ufdda393ec48b57.ant.amazon.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x5F0TfFT010961; Fri, 14 Jun 2019 19:29:54 -0500 From: Benjamin Herrenschmidt To: linux-pci@vger.kernel.org Subject: [PATCH 4/4] arm64: pci: acpi: Preserve PCI resources configuration when asked by ACPI Date: Sat, 15 Jun 2019 10:23:59 +1000 Message-Id: <20190615002359.29577-4-benh@kernel.crashing.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190615002359.29577-1-benh@kernel.crashing.org> References: <20190615002359.29577-1-benh@kernel.crashing.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190614_173007_481524_3B1DFFBE X-CRM114-Status: UNSURE ( 6.04 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , Ard Biesheuvel , Benjamin Herrenschmidt , Sinan Kaya , Zeev Zilberman , linux-arm-kernel , Bjorn Helgaas , Ali Saidi MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When _DSM #5 returns 0 for a host bridge, we need to claim the existing resources rather than reassign everything. Signed-off-by: Benjamin Herrenschmidt Acked-by: Lorenzo Pieralisi Acked-by: Ard Biesheuvel --- arch/arm64/kernel/pci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 1419b1b4e9b9..a2c608a3fc41 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -168,6 +168,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) struct acpi_pci_generic_root_info *ri; struct pci_bus *bus, *child; struct acpi_pci_root_ops *root_ops; + struct pci_host_bridge *hb; ri = kzalloc(sizeof(*ri), GFP_KERNEL); if (!ri) @@ -193,6 +194,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) if (!bus) return NULL; + hb = pci_find_host_bridge(bus); + + /* If ACPI tells us to preserve the resource configuration, claim now */ + if (hb->preserve_config) + pci_bus_claim_resources(bus); + + /* + * Assign whatever was left unassigned. If we didn't claim above, this will + * reassign everything. + */ pci_assign_unassigned_root_bus_resources(bus); list_for_each_entry(child, &bus->children, node)