summary refs log tree commit diff
path: root/arch/arm64/kernel/pci.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2021-09-02 14:56:47 -0500
committerBjorn Helgaas <bhelgaas@google.com>2021-09-02 14:56:47 -0500
commita1e4ca8eb963f58fc9c2c26a971d86456ea717f5 (patch)
tree476494ae29cc3785cf98ec13a63cf9944e9d3756 /arch/arm64/kernel/pci.c
parent53cb14d2566205ed9a08649fdc59e9446adf0727 (diff)
parent88f94c7f8f40d7e26f991f6f6ed914ff44361d75 (diff)
downloadlinux-a1e4ca8eb963f58fc9c2c26a971d86456ea717f5.tar.gz
Merge branch 'remotes/lorenzo/pci/hyper-v'
- Add domain_nr in struct pci_host_bridge (Boqun Feng)

- Use host bridge MSI domain for root buses if present (Boqun Feng)

- Allow ARM64 virtual host bridge with no ACPI companion (e.g., Hyper-V)
  (Boqun Feng)

- Make Hyper-V enumeration more generic (Arnd Bergmann)

- Set Hyper-V domain_nr at probe-time (Boqun Feng)

- Set up Hyper-V MSI domain at bridge probe-time (Boqun Feng)

- Enable Hyper-V bridge probing on ARM64 (Boqun Feng)

* remotes/lorenzo/pci/hyper-v:
  PCI: hv: Turn on the host bridge probing on ARM64
  PCI: hv: Set up MSI domain at bridge probing time
  PCI: hv: Set ->domain_nr of pci_host_bridge at probing time
  PCI: hv: Generify PCI probing
  arm64: PCI: Support root bridge preparation for Hyper-V
  arm64: PCI: Restructure pcibios_root_bridge_prepare()
  PCI: Support populating MSI domains of root buses via bridges
  PCI: Introduce domain_nr in pci_host_bridge
Diffstat (limited to 'arch/arm64/kernel/pci.c')
-rw-r--r--arch/arm64/kernel/pci.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 1006ed2d7c60..2276689b5411 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -82,14 +82,29 @@ int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
 
 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);
-		struct device *bus_dev = &bridge->bus->dev;
+	struct pci_config_window *cfg;
+	struct acpi_device *adev;
+	struct device *bus_dev;
 
-		ACPI_COMPANION_SET(&bridge->dev, adev);
-		set_dev_node(bus_dev, acpi_get_node(acpi_device_handle(adev)));
-	}
+	if (acpi_disabled)
+		return 0;
+
+	cfg = bridge->bus->sysdata;
+
+	/*
+	 * On Hyper-V there is no corresponding ACPI device for a root bridge,
+	 * therefore ->parent is set as NULL by the driver. And set 'adev' as
+	 * NULL in this case because there is no proper ACPI device.
+	 */
+	if (!cfg->parent)
+		adev = NULL;
+	else
+		adev = to_acpi_device(cfg->parent);
+
+	bus_dev = &bridge->bus->dev;
+
+	ACPI_COMPANION_SET(&bridge->dev, adev);
+	set_dev_node(bus_dev, acpi_get_node(acpi_device_handle(adev)));
 
 	return 0;
 }