[PATCH v2 1/6] PCI: hv: Don't load the driver for baremetal root partition

Nuno Das Neves posted 6 patches 3 months ago
There is a newer version of this series
[PATCH v2 1/6] PCI: hv: Don't load the driver for baremetal root partition
Posted by Nuno Das Neves 3 months ago
From: Mukesh Rathor <mrathor@linux.microsoft.com>

The root partition only uses VMBus when running nested.

When running on baremetal the Hyper-V PCI driver is not needed,
so do not initialize it.

Signed-off-by: Mukesh Rathor <mrathor@linux.microsoft.com>
Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Reviewed-by: Roman Kisel <romank@linux.microsoft.com>
---
 drivers/pci/controller/pci-hyperv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index b4f29ee75848..4d25754dfe2f 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -4150,6 +4150,9 @@ static int __init init_hv_pci_drv(void)
 	if (!hv_is_hyperv_initialized())
 		return -ENODEV;
 
+	if (hv_root_partition() && !hv_nested)
+		return -ENODEV;
+
 	ret = hv_pci_irqchip_init();
 	if (ret)
 		return ret;
-- 
2.34.1
Re: [PATCH v2 1/6] PCI: hv: Don't load the driver for baremetal root partition
Posted by Bjorn Helgaas 3 months ago
On Thu, Jul 03, 2025 at 03:44:32PM -0700, Nuno Das Neves wrote:
> From: Mukesh Rathor <mrathor@linux.microsoft.com>
> 
> The root partition only uses VMBus when running nested.
> 
> When running on baremetal the Hyper-V PCI driver is not needed,
> so do not initialize it.
> 
> Signed-off-by: Mukesh Rathor <mrathor@linux.microsoft.com>
> Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
> Reviewed-by: Roman Kisel <romank@linux.microsoft.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

I assume this series will be merged elsewhere.

> ---
>  drivers/pci/controller/pci-hyperv.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index b4f29ee75848..4d25754dfe2f 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -4150,6 +4150,9 @@ static int __init init_hv_pci_drv(void)
>  	if (!hv_is_hyperv_initialized())
>  		return -ENODEV;
>  
> +	if (hv_root_partition() && !hv_nested)
> +		return -ENODEV;
> +
>  	ret = hv_pci_irqchip_init();
>  	if (ret)
>  		return ret;
> -- 
> 2.34.1
>