[v2,4/5] hv: Enable vmbus driver for nested root partition

Message ID b5ea40f7e84e17a4338a313ab74292a293b1efa4.1667406350.git.jinankjain@linux.microsoft.com
State New
Headers
Series Add support running nested Microsoft Hypervisor |

Commit Message

Jinank Jain Nov. 2, 2022, 4:36 p.m. UTC
  Currently VMBus driver is not initialized for root partition but we need
to enable the VMBus driver for nested root partition. This is required
to expose VMBus devices to the L2 guest in the nested setup.

Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
---
 drivers/hv/vmbus_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Michael Kelley (LINUX) Nov. 3, 2022, 3:30 a.m. UTC | #1
From: Jinank Jain <jinankjain@linux.microsoft.com> Sent: Wednesday, November 2, 2022 9:36 AM
> 
> Currently VMBus driver is not initialized for root partition but we need
> to enable the VMBus driver for nested root partition. This is required
> to expose VMBus devices to the L2 guest in the nested setup.
> 
> Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
> ---
>  drivers/hv/vmbus_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 8b2e413bf19c..2f0cf75e811b 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -2723,7 +2723,7 @@ static int __init hv_acpi_init(void)
>  	if (!hv_is_hyperv_initialized())
>  		return -ENODEV;
> 
> -	if (hv_root_partition)
> +	if (hv_root_partition && !hv_nested)

Note that this code must compile and run when Linux is built
to run as a guest on Hyper-V for ARM64.  There's currently
no definition for hv_nested on the ARM64 side, so the compile
will fail.  But per my comments in Patch 1 in this series, using the
same technique as for hv_root_partition in hv_common.c should
solve the ARM64 problem as well.

>  		return 0;
> 
>  	/*
> --
> 2.25.1
  
Anirudh Rayabharam Nov. 3, 2022, 7:02 a.m. UTC | #2
On Wed, Nov 02, 2022 at 04:36:01PM +0000, Jinank Jain wrote:
> Currently VMBus driver is not initialized for root partition but we need
> to enable the VMBus driver for nested root partition. This is required
> to expose VMBus devices to the L2 guest in the nested setup.

Perhaps more importantly, this is required so that L2 _root_ can use the
VMBus devices.

> 
> Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
> ---
>  drivers/hv/vmbus_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 8b2e413bf19c..2f0cf75e811b 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -2723,7 +2723,7 @@ static int __init hv_acpi_init(void)
>  	if (!hv_is_hyperv_initialized())
>  		return -ENODEV;
>  
> -	if (hv_root_partition)
> +	if (hv_root_partition && !hv_nested)
>  		return 0;
>  
>  	/*
> -- 
> 2.25.1
  
Wei Liu Nov. 3, 2022, 2:16 p.m. UTC | #3
On Thu, Nov 03, 2022 at 03:30:35AM +0000, Michael Kelley (LINUX) wrote:
> From: Jinank Jain <jinankjain@linux.microsoft.com> Sent: Wednesday, November 2, 2022 9:36 AM
> > 
> > Currently VMBus driver is not initialized for root partition but we need
> > to enable the VMBus driver for nested root partition. This is required
> > to expose VMBus devices to the L2 guest in the nested setup.
> > 
> > Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
> > ---
> >  drivers/hv/vmbus_drv.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> > index 8b2e413bf19c..2f0cf75e811b 100644
> > --- a/drivers/hv/vmbus_drv.c
> > +++ b/drivers/hv/vmbus_drv.c
> > @@ -2723,7 +2723,7 @@ static int __init hv_acpi_init(void)
> >  	if (!hv_is_hyperv_initialized())
> >  		return -ENODEV;
> > 
> > -	if (hv_root_partition)
> > +	if (hv_root_partition && !hv_nested)
> 
> Note that this code must compile and run when Linux is built
> to run as a guest on Hyper-V for ARM64.  There's currently
> no definition for hv_nested on the ARM64 side, so the compile
> will fail.  But per my comments in Patch 1 in this series, using the
> same technique as for hv_root_partition in hv_common.c should
> solve the ARM64 problem as well.

Jinank, you can use the following commands to cross-compile Linux.

  make ARCH=arm64 mshv_defconfig
  make -j$(nproc) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image

I think there are some follow-up patches in the internal tree which
fixed the arm64 build. You may be able to squash some of those patches
into series.

Thanks,
Wei.
  

Patch

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 8b2e413bf19c..2f0cf75e811b 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -2723,7 +2723,7 @@  static int __init hv_acpi_init(void)
 	if (!hv_is_hyperv_initialized())
 		return -ENODEV;
 
-	if (hv_root_partition)
+	if (hv_root_partition && !hv_nested)
 		return 0;
 
 	/*