Skip to contentSkip to conversation

PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare()

PATCH Applied Michael Kelley 6 participants 7 messages Sep 29 – Oct 22

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare()

pcibios_root_bridge_prepare() currently has code to handle Hyper-V guest root bridges with the sysdata parent field set to NULL. While this special case existed when commit 7d40c0f70d92 ("arm64: PCI:
Support root bridge preparation for Hyper-V") was accepted, more recent commit 8d21732475c6 ("PCI: hv: Propagate coherence from VMbus device to PCI device") always sets the sysdata parent field to a non-NULL value.

No harm is caused by leaving the special case in place, even though it is no longer needed. But in the interest of overall code cleanliness, remove it.

---
This patch does not just do a revert of 7d40c0f70d92 because an intervening commit moved the code to a new source code file.

 drivers/pci/pci-acpi.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/pci/pci-acpi.c +1 -11
index 42d545edd7fa..452a90317c58 100644
@@ -1572,17 +1572,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 		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);
-
+	adev = to_acpi_device(cfg->parent);
 	bus_dev = &bridge->bus->dev;
 
 	ACPI_COMPANION_SET(&bridge->dev, adev);
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Michael Kelley

pcibios_root_bridge_prepare() currently has code to handle Hyper-V guest root bridges with the sysdata parent field set to NULL. While this special case existed when commit 7d40c0f70d92 ("arm64: PCI:
Support root bridge preparation for Hyper-V") was accepted, more recent commit 8d21732475c6 ("PCI: hv: Propagate coherence from VMbus device to PCI device") always sets the sysdata parent field to a non-NULL value.

Quoted 5 lines

No harm is caused by leaving the special case in place, even though it is no longer needed. But in the interest of overall code cleanliness, remove it.

Quoted 34 lines

---
This patch does not just do a revert of 7d40c0f70d92 because an intervening commit moved the code to a new source code file.

 drivers/pci/pci-acpi.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/pci/pci-acpi.c +1 -12
index 42d545edd7fa..452a90317c58 100644
@@ -1572,17 +1572,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
                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);
-
+       adev = to_acpi_device(cfg->parent);
        bus_dev = &bridge->bus->dev;
 
        ACPI_COMPANION_SET(&bridge->dev, adev);
--

2.25.1

#4 lore raw
In reply to Michael Kelley
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines

pcibios_root_bridge_prepare() currently has code to handle Hyper-V guest root bridges with the sysdata parent field set to NULL. While this special case existed when commit 7d40c0f70d92 ("arm64: PCI:
Support root bridge preparation for Hyper-V") was accepted, more recent commit 8d21732475c6 ("PCI: hv: Propagate coherence from VMbus device to PCI device") always sets the sysdata parent field to a non-NULL value.

Quoted 5 lines

No harm is caused by leaving the special case in place, even though it is no longer needed. But in the interest of overall code cleanliness, remove it.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v1 1/1
#5 lore raw
In reply to Michael Kelley
Quoted 47 lines · Michael Kelley

pcibios_root_bridge_prepare() currently has code to handle Hyper-V guest root bridges with the sysdata parent field set to NULL. While this special case existed when commit 7d40c0f70d92 ("arm64: PCI:
Support root bridge preparation for Hyper-V") was accepted, more recent commit 8d21732475c6 ("PCI: hv: Propagate coherence from VMbus device to PCI device") always sets the sysdata parent field to a non-NULL value.

No harm is caused by leaving the special case in place, even though it is no longer needed. But in the interest of overall code cleanliness, remove it.

---
This patch does not just do a revert of 7d40c0f70d92 because an intervening commit moved the code to a new source code file.

 drivers/pci/pci-acpi.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/pci/pci-acpi.c +1 -11
index 42d545edd7fa..452a90317c58 100644
@@ -1572,17 +1572,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 		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);
-
+	adev = to_acpi_device(cfg->parent);
 	bus_dev = &bridge->bus->dev;
 
 	ACPI_COMPANION_SET(&bridge->dev, adev);
Signature · 1 line
2.25.1

I was trying to find a case where any new driver would have started using the NULL case but couldn't find any.

#2 lore raw
In reply to Rafael J. Wysocki (Intel)

From: Rafael J. Wysocki (Intel) <[email protected]> Sent: Tuesday, September 29, 2026 11:23 AM

Quoted 11 lines · Michael Kelley
Quoted 9 lines

pcibios_root_bridge_prepare() currently has code to handle Hyper-V guest root bridges with the sysdata parent field set to NULL. While this special case existed when commit 7d40c0f70d92 ("arm64: PCI:
Support root bridge preparation for Hyper-V") was accepted, more recent commit 8d21732475c6 ("PCI: hv: Propagate coherence from VMbus device to PCI device") always sets the sysdata parent field to a non-NULL value.

Quoted 7 lines
Quoted 5 lines

No harm is caused by leaving the special case in place, even though it is no longer needed. But in the interest of overall code cleanliness, remove it.

Is anything else needed for this patch? I presume it should be picked up in the PCI tree.

Michael

Quoted 35 lines
Quoted 35 lines

---
This patch does not just do a revert of 7d40c0f70d92 because an intervening commit moved the code to a new source code file.

 drivers/pci/pci-acpi.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/pci/pci-acpi.c +1 -12
index 42d545edd7fa..452a90317c58 100644
@@ -1572,17 +1572,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
                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);
-
+       adev = to_acpi_device(cfg->parent);
        bus_dev = &bridge->bus->dev;
 
        ACPI_COMPANION_SET(&bridge->dev, adev);
--

2.25.1

#3 lore raw
Quoted 17 lines · Michael Kelley

From: Rafael J. Wysocki (Intel) <[email protected]> Sent: Tuesday, September 29, 2026 11:23 AM

Quoted 15 lines · Michael Kelley
Quoted 13 lines

pcibios_root_bridge_prepare() currently has code to handle Hyper-V guest root bridges with the sysdata parent field set to NULL. While this special case existed when commit 7d40c0f70d92 ("arm64: PCI:
Support root bridge preparation for Hyper-V") was accepted, more recent commit 8d21732475c6 ("PCI: hv: Propagate coherence from VMbus device to PCI device") always sets the sysdata parent field to a non-NULL value.

No harm is caused by leaving the special case in place, even though it is no longer needed. But in the interest of overall code cleanliness, remove it.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Is anything else needed for this patch? I presume it should be picked up in the PCI tree.

Right.

I can pick it up, but then I'd rather have an ACK from Bjorn. Or we can try asking directly:

Bjorn, if you have any objections or concerns regarding this, please let me know.

Quoted 36 lines
Quoted 35 lines
Quoted 35 lines

---
This patch does not just do a revert of 7d40c0f70d92 because an intervening commit moved the code to a new source code file.

 drivers/pci/pci-acpi.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/pci/pci-acpi.c +1 -12
index 42d545edd7fa..452a90317c58 100644
@@ -1572,17 +1572,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
                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);
-
+       adev = to_acpi_device(cfg->parent);
        bus_dev = &bridge->bus->dev;
 
        ACPI_COMPANION_SET(&bridge->dev, adev);
--

2.25.1

#6 lore raw
In reply to Michael Kelley
Quoted 8 lines · Michael Kelley

pcibios_root_bridge_prepare() currently has code to handle Hyper-V guest root bridges with the sysdata parent field set to NULL. While this special case existed when commit 7d40c0f70d92 ("arm64: PCI:
Support root bridge preparation for Hyper-V") was accepted, more recent commit 8d21732475c6 ("PCI: hv: Propagate coherence from VMbus device to PCI device") always sets the sysdata parent field to a non-NULL value.

Quoted 5 lines

No harm is caused by leaving the special case in place, even though it is no longer needed. But in the interest of overall code cleanliness, remove it.

Applied to pci/pending/controller/hv for v7.5, thanks! The branch will be renamed and rebased to v7.4-rc1 after that is tagged.

Quoted 34 lines

---
This patch does not just do a revert of 7d40c0f70d92 because an intervening commit moved the code to a new source code file.

 drivers/pci/pci-acpi.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/pci/pci-acpi.c +1 -11
index 42d545edd7fa..452a90317c58 100644
@@ -1572,17 +1572,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 		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);
-
+	adev = to_acpi_device(cfg->parent);
 	bus_dev = &bridge->bus->dev;
 
 	ACPI_COMPANION_SET(&bridge->dev, adev);
Signature · 1 line
2.25.1