mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare()
@ 2026-09-29 18:10 Michael Kelley
  2026-09-29 18:23 ` Rafael J. Wysocki (Intel)
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michael Kelley @ 2026-09-29 18:10 UTC (permalink / raw)
  To: rafael, lenb, bhelgaas; +Cc: linux-acpi, linux-pci, linux-kernel, linux-hyperv

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.

Signed-off-by: Michael Kelley <mhklinux@outlook.com>
---
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(-)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 42d545edd7fa..452a90317c58 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare()
  2026-09-29 18:10 [PATCH 1/1] PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare() Michael Kelley
@ 2026-09-29 18:23 ` Rafael J. Wysocki (Intel)
  2026-10-22 17:14   ` Michael Kelley
  2026-10-15 15:35 ` Saurabh Singh Sengar
  2026-10-22 20:47 ` Bjorn Helgaas
  2 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-09-29 18:23 UTC (permalink / raw)
  To: mhklinux
  Cc: rafael, lenb, bhelgaas, linux-acpi, linux-pci, linux-kernel,
	linux-hyperv

On Tue, Sep 29, 2026 at 8:11 PM Michael Kelley <mhkelley58@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: Michael Kelley <mhklinux@outlook.com>

Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>

> ---
> 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(-)
>
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 42d545edd7fa..452a90317c58 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare()
  2026-09-29 18:10 [PATCH 1/1] PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare() Michael Kelley
  2026-09-29 18:23 ` Rafael J. Wysocki (Intel)
@ 2026-10-15 15:35 ` Saurabh Singh Sengar
  2026-10-22 20:47 ` Bjorn Helgaas
  2 siblings, 0 replies; 6+ messages in thread
From: Saurabh Singh Sengar @ 2026-10-15 15:35 UTC (permalink / raw)
  To: mhklinux
  Cc: rafael, lenb, bhelgaas, linux-acpi, linux-pci, linux-kernel,
	linux-hyperv

On Tue, Sep 29, 2026 at 11:10:56AM -0700, Michael Kelley wrote:
> 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.
> 
> Signed-off-by: Michael Kelley <mhklinux@outlook.com>
> ---
> 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(-)
> 
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 42d545edd7fa..452a90317c58 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -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
>

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

Reviewed-by: Saurabh Sengar <ssengar@linux.microsoft.com> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/1] PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare()
  2026-09-29 18:23 ` Rafael J. Wysocki (Intel)
@ 2026-10-22 17:14   ` Michael Kelley
  2026-10-22 17:48     ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Kelley @ 2026-10-22 17:14 UTC (permalink / raw)
  To: Rafael J. Wysocki (Intel)
  Cc: lenb, bhelgaas, linux-acpi, linux-pci, linux-kernel, linux-hyperv

From: Rafael J. Wysocki (Intel) <rafael@kernel.org> Sent: Tuesday, September 29, 2026 11:23 AM
> 
> On Tue, Sep 29, 2026 at 8:11 PM Michael Kelley <mhkelley58@gmail.com> wrote:
> >
> > 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.
> >
> > Signed-off-by: Michael Kelley <mhklinux@outlook.com>
> 
> Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>

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

Michael

> 
> > ---
> > 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(-)
> >
> > diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> > index 42d545edd7fa..452a90317c58 100644
> > --- a/drivers/pci/pci-acpi.c
> > +++ b/drivers/pci/pci-acpi.c
> > @@ -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
> >


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare()
  2026-10-22 17:14   ` Michael Kelley
@ 2026-10-22 17:48     ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-10-22 17:48 UTC (permalink / raw)
  To: Michael Kelley, bhelgaas
  Cc: linux-acpi, linux-pci, linux-kernel, linux-hyperv

On Thu, Oct 22, 2026 at 7:14 PM Michael Kelley <mhklinux@outlook.com> wrote:
>
> From: Rafael J. Wysocki (Intel) <rafael@kernel.org> Sent: Tuesday, September 29, 2026 11:23 AM
> >
> > On Tue, Sep 29, 2026 at 8:11 PM Michael Kelley <mhkelley58@gmail.com> wrote:
> > >
> > > 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.
> > >
> > > Signed-off-by: Michael Kelley <mhklinux@outlook.com>
> >
> > Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
>
> 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.

> >
> > > ---
> > > 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(-)
> > >
> > > diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> > > index 42d545edd7fa..452a90317c58 100644
> > > --- a/drivers/pci/pci-acpi.c
> > > +++ b/drivers/pci/pci-acpi.c
> > > @@ -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
> > >
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare()
  2026-09-29 18:10 [PATCH 1/1] PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare() Michael Kelley
  2026-09-29 18:23 ` Rafael J. Wysocki (Intel)
  2026-10-15 15:35 ` Saurabh Singh Sengar
@ 2026-10-22 20:47 ` Bjorn Helgaas
  2 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2026-10-22 20:47 UTC (permalink / raw)
  To: mhklinux
  Cc: rafael, lenb, bhelgaas, linux-acpi, linux-pci, linux-kernel,
	linux-hyperv

On Tue, Sep 29, 2026 at 11:10:56AM -0700, Michael Kelley wrote:
> 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.
> 
> Signed-off-by: Michael Kelley <mhklinux@outlook.com>

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.

> ---
> 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(-)
> 
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 42d545edd7fa..452a90317c58 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -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
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-22 20:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 18:10 [PATCH 1/1] PCI/ACPI: Remove Hyper-V special case in pcibios_root_bridge_prepare() Michael Kelley
2026-09-29 18:23 ` Rafael J. Wysocki (Intel)
2026-10-22 17:14   ` Michael Kelley
2026-10-22 17:48     ` Rafael J. Wysocki (Intel)
2026-10-15 15:35 ` Saurabh Singh Sengar
2026-10-22 20:47 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®