From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org
Cc: catalin.marinas@arm.com, will.deacon@arm.com,
bhelgaas@google.com, lorenzo.pieralisi@arm.com, tn@semihalf.com,
graeme.gregory@linaro.org, leif.lindholm@linaro.org,
okaya@codeaurora.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 2/2] arm64: acpi/pci: invoke _DSM whether to preserve firmware PCI setup
Date: Tue, 11 Apr 2017 17:33:13 +0100 [thread overview]
Message-ID: <20170411163313.18577-3-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20170411163313.18577-1-ard.biesheuvel@linaro.org>
On arm64 ACPI systems, we unconditionally reconfigure the entire PCI
hierarchy at boot. This is a departure from what is customary on ACPI
systems, and may break assumptions in some places (e.g., EFIFB), that
the kernel will leave BARs of enabled PCI devices where they are.
Given that PCI already specifies a device specific ACPI method (_DSM)
for PCI root bridge nodes that tells us whether the firmware thinks
the configuration should be left alone, let's sidestep the entire
policy debate about whether the PCI configuration should be preserved
or not, and put it under the control of the firmware instead.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/arm64/kernel/pci.c | 20 ++++++++++++++++++--
include/linux/pci-acpi.h | 7 ++++---
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 4f0e3ebfea4b..c88e07e2eb84 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -185,6 +185,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;
+ union acpi_object *obj;
ri = kzalloc_node(sizeof(*ri), GFP_KERNEL, node);
if (!ri)
@@ -208,8 +209,23 @@ 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);
+ /*
+ * Invoke the PCI device specific method (_DSM) #5 'Ignore PCI Boot
+ * Configuration', which tells us whether the firmware wants us to
+ * preserve the configuration of the PCI resource tree for this root
+ * bridge.
+ */
+ obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), pci_acpi_dsm_uuid, 1,
+ IGNORE_PCI_BOOT_CONFIG_DSM, NULL);
+ if (obj && obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 0) {
+ /* preserve existing resource assignment */
+ pci_bus_claim_resources(bus);
+ } else {
+ /* reconfigure the resource tree from scratch */
+ pci_bus_size_bridges(bus);
+ pci_bus_assign_resources(bus);
+ }
+ ACPI_FREE(obj);
list_for_each_entry(child, &bus->children, node)
pcie_bus_configure_settings(child);
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 7a4e83a8c89c..308111489b83 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -106,9 +106,10 @@ static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
#endif
extern const u8 pci_acpi_dsm_uuid[];
-#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) { }
--
2.9.3
next prev parent reply other threads:[~2017-04-11 16:33 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-11 16:33 [PATCH 0/2] arm64: acpi/pci: allow the firmware BAR configuration to be preserved Ard Biesheuvel
2017-04-11 16:33 ` [PATCH 1/2] drivers: pci: do not disregard parent resources starting at 0x0 Ard Biesheuvel
2017-04-11 18:30 ` Ard Biesheuvel
2017-04-12 13:24 ` Lorenzo Pieralisi
2017-04-13 7:39 ` Ard Biesheuvel
2017-04-13 9:42 ` Lorenzo Pieralisi
2017-04-11 16:33 ` Ard Biesheuvel [this message]
2017-04-12 17:26 ` [PATCH 2/2] arm64: acpi/pci: invoke _DSM whether to preserve firmware PCI setup Lorenzo Pieralisi
2017-04-12 18:03 ` Sinan Kaya
2017-05-17 21:53 ` Bjorn Helgaas
2017-05-17 21:56 ` [PATCH 0/2] arm64: acpi/pci: allow the firmware BAR configuration to be preserved Bjorn Helgaas
2017-05-18 10:59 ` Ard Biesheuvel
2017-05-18 14:05 ` Bjorn Helgaas
2017-05-18 15:10 ` Ard Biesheuvel
2017-05-18 15:47 ` Lorenzo Pieralisi
2017-05-18 16:51 ` Ard Biesheuvel
2017-05-18 17:46 ` Lorenzo Pieralisi
2017-06-01 15:04 ` Ard Biesheuvel
2017-06-01 16:15 ` Lorenzo Pieralisi
2017-06-01 16:18 ` Ard Biesheuvel
2017-06-01 17:38 ` Lorenzo Pieralisi
2017-06-06 8:59 ` Lorenzo Pieralisi
2017-06-06 9:14 ` Ard Biesheuvel
2017-06-06 10:02 ` Lorenzo Pieralisi
2017-06-07 13:45 ` Ard Biesheuvel
2017-06-12 16:55 ` Lorenzo Pieralisi
2017-06-12 17:00 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170411163313.18577-3-ard.biesheuvel@linaro.org \
--to=ard.biesheuvel@linaro.org \
--cc=bhelgaas@google.com \
--cc=catalin.marinas@arm.com \
--cc=graeme.gregory@linaro.org \
--cc=leif.lindholm@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=okaya@codeaurora.org \
--cc=tn@semihalf.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).