[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210609163211.3467449-7-boqun.feng@gmail.com>
Date: Thu, 10 Jun 2021 00:32:10 +0800
From: Boqun Feng <boqun.feng@...il.com>
To: Bjorn Helgaas <bhelgaas@...gle.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-hyperv@...r.kernel.org, linux-pci@...r.kernel.org
Cc: Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Rob Herring <robh@...nel.org>, Clint Sbisa <csbisa@...zon.com>,
Boqun Feng <boqun.feng@...il.com>,
Ard Biesheuvel <ardb@...nel.org>,
Sunil Muthuswamy <sunilmut@...rosoft.com>
Subject: [RFC v3 6/7] arm64: PCI: Support root bridge preparation for Hyper-V PCI
Currently at root bridge preparation, the corresponding ACPI device will
be set as the companion, however for a Hyper-V virtual PCI root bridge,
there is no corresponding ACPI device, because a Hyper-V virtual PCI
root bridge is discovered via VMBus rather than ACPI table. In order to
support this, we need to make pcibios_root_bridge_prepare() work with
cfg->parent being NULL.
Signed-off-by: Boqun Feng <boqun.feng@...il.com>
---
arch/arm64/kernel/pci.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 1006ed2d7c60..020bc268bf06 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -84,7 +84,12 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
{
if (!acpi_disabled) {
struct pci_config_window *cfg = bridge->bus->sysdata;
- struct acpi_device *adev = to_acpi_device(cfg->parent);
+ /*
+ * On Hyper-V, there is no corresponding APCI device for a root
+ * bridge, therefore ->parent is set as NULL by the driver. Then
+ * 'adev' should be NULL in this case.
+ */
+ struct acpi_device *adev = cfg->parent ? to_acpi_device(cfg->parent) : NULL;
struct device *bus_dev = &bridge->bus->dev;
ACPI_COMPANION_SET(&bridge->dev, adev);
--
2.30.2
Powered by blists - more mailing lists