public inbox for linux-hyperv@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] mshv: Add nested virtualization creation flag
@ 2026-02-18 14:47 Anatol Belski
  2026-02-18 14:48 ` [PATCH 2/4] hyperv: uapi: Add bit for nested virtualization Anatol Belski
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Anatol Belski @ 2026-02-18 14:47 UTC (permalink / raw)
  To: linux-hyperv; +Cc: wei.liu, muislam

From: Muminul Islam <muislam@microsoft.com>

Introduce HV_PARTITION_CREATION_FLAG_NESTED_VIRTUALIZATION_CAPABLE to
indicate support for nested virtualization during partition creation.

This enables clearer configuration and capability checks for nested
virtualization scenarios.

Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Signed-off-by: Muminul Islam <muislam@microsoft.com>
---
 include/hyperv/hvhdk.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/hyperv/hvhdk.h b/include/hyperv/hvhdk.h
index 08965970c17d..03afb7d0412b 100644
--- a/include/hyperv/hvhdk.h
+++ b/include/hyperv/hvhdk.h
@@ -328,6 +328,7 @@ union hv_partition_isolation_properties {
 #define HV_PARTITION_ISOLATION_HOST_TYPE_RESERVED   0x2
 
 /* Note: Exo partition is enabled by default */
+#define HV_PARTITION_CREATION_FLAG_NESTED_VIRTUALIZATION_CAPABLE	BIT(1)
 #define HV_PARTITION_CREATION_FLAG_GPA_SUPER_PAGES_ENABLED		BIT(4)
 #define HV_PARTITION_CREATION_FLAG_EXO_PARTITION			BIT(8)
 #define HV_PARTITION_CREATION_FLAG_LAPIC_ENABLED			BIT(13)
-- 
2.34.1


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

* [PATCH 2/4] hyperv: uapi: Add bit for nested virtualization
  2026-02-18 14:47 [PATCH 1/4] mshv: Add nested virtualization creation flag Anatol Belski
@ 2026-02-18 14:48 ` Anatol Belski
  2026-02-18 14:48 ` [PATCH 3/4] drivers: hv: enable " Anatol Belski
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Anatol Belski @ 2026-02-18 14:48 UTC (permalink / raw)
  To: linux-hyperv; +Cc: wei.liu, muislam

From: Muminul Islam <muislam@microsoft.com>

Add a new bit for nested virtualization creation flag.
This is exposed to user-space API to enable during partition
creation.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
---
 include/uapi/linux/mshv.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/mshv.h b/include/uapi/linux/mshv.h
index dee3ece28ce5..7ef5dd67a232 100644
--- a/include/uapi/linux/mshv.h
+++ b/include/uapi/linux/mshv.h
@@ -27,6 +27,7 @@ enum {
 	MSHV_PT_BIT_X2APIC,
 	MSHV_PT_BIT_GPA_SUPER_PAGES,
 	MSHV_PT_BIT_CPU_AND_XSAVE_FEATURES,
+	MSHV_PT_BIT_NESTED_VIRTUALIZATION,
 	MSHV_PT_BIT_COUNT,
 };
 
-- 
2.34.1


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

* [PATCH 3/4] drivers: hv: enable nested virtualization
  2026-02-18 14:47 [PATCH 1/4] mshv: Add nested virtualization creation flag Anatol Belski
  2026-02-18 14:48 ` [PATCH 2/4] hyperv: uapi: Add bit for nested virtualization Anatol Belski
@ 2026-02-18 14:48 ` Anatol Belski
  2026-02-18 14:48 ` [PATCH 4/4] mshv: Add SMT_ENABLED_GUEST partition creation flag Anatol Belski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Anatol Belski @ 2026-02-18 14:48 UTC (permalink / raw)
  To: linux-hyperv; +Cc: wei.liu, muislam

From: Muminul Islam <muislam@microsoft.com>

Based on the bits provided by VMM, enable the nested
virtualization in the partition creation flag.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
---
 drivers/hv/mshv_root_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c
index 681b58154d5e..fb3ade44e1f1 100644
--- a/drivers/hv/mshv_root_main.c
+++ b/drivers/hv/mshv_root_main.c
@@ -1921,6 +1921,8 @@ static long mshv_ioctl_process_pt_flags(void __user *user_arg, u64 *pt_flags,
 		*pt_flags |= HV_PARTITION_CREATION_FLAG_X2APIC_CAPABLE;
 	if (args.pt_flags & BIT_ULL(MSHV_PT_BIT_GPA_SUPER_PAGES))
 		*pt_flags |= HV_PARTITION_CREATION_FLAG_GPA_SUPER_PAGES_ENABLED;
+	if (args.pt_flags & BIT(MSHV_PT_BIT_NESTED_VIRTUALIZATION))
+		*pt_flags |= HV_PARTITION_CREATION_FLAG_NESTED_VIRTUALIZATION_CAPABLE;
 
 	isol_props->as_uint64 = 0;
 
-- 
2.34.1


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

* [PATCH 4/4] mshv: Add SMT_ENABLED_GUEST partition creation flag
  2026-02-18 14:47 [PATCH 1/4] mshv: Add nested virtualization creation flag Anatol Belski
  2026-02-18 14:48 ` [PATCH 2/4] hyperv: uapi: Add bit for nested virtualization Anatol Belski
  2026-02-18 14:48 ` [PATCH 3/4] drivers: hv: enable " Anatol Belski
@ 2026-02-18 14:48 ` Anatol Belski
  2026-02-18 17:09 ` [PATCH 1/4] mshv: Add nested virtualization " Easwar Hariharan
  2026-02-18 23:55 ` Wei Liu
  4 siblings, 0 replies; 6+ messages in thread
From: Anatol Belski @ 2026-02-18 14:48 UTC (permalink / raw)
  To: linux-hyperv; +Cc: wei.liu, muislam

Add support for HV_PARTITION_CREATION_FLAG_SMT_ENABLED_GUEST
to allow userspace VMMs to enable SMT for guest partitions.

Expose this via new MSHV_PT_BIT_SMT_ENABLED_GUEST flag in the UAPI.

Withouth this flag, the hypervisor schedules guest VPs incorrectly,
causing SMT unusable.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
---
 drivers/hv/mshv_root_main.c | 2 ++
 include/hyperv/hvhdk.h      | 1 +
 include/uapi/linux/mshv.h   | 1 +
 3 files changed, 4 insertions(+)

diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c
index fb3ade44e1f1..899e055d975f 100644
--- a/drivers/hv/mshv_root_main.c
+++ b/drivers/hv/mshv_root_main.c
@@ -1923,6 +1923,8 @@ static long mshv_ioctl_process_pt_flags(void __user *user_arg, u64 *pt_flags,
 		*pt_flags |= HV_PARTITION_CREATION_FLAG_GPA_SUPER_PAGES_ENABLED;
 	if (args.pt_flags & BIT(MSHV_PT_BIT_NESTED_VIRTUALIZATION))
 		*pt_flags |= HV_PARTITION_CREATION_FLAG_NESTED_VIRTUALIZATION_CAPABLE;
+	if (args.pt_flags & BIT(MSHV_PT_BIT_SMT_ENABLED_GUEST))
+		*pt_flags |= HV_PARTITION_CREATION_FLAG_SMT_ENABLED_GUEST;
 
 	isol_props->as_uint64 = 0;
 
diff --git a/include/hyperv/hvhdk.h b/include/hyperv/hvhdk.h
index 03afb7d0412b..331cebc471e1 100644
--- a/include/hyperv/hvhdk.h
+++ b/include/hyperv/hvhdk.h
@@ -328,6 +328,7 @@ union hv_partition_isolation_properties {
 #define HV_PARTITION_ISOLATION_HOST_TYPE_RESERVED   0x2
 
 /* Note: Exo partition is enabled by default */
+#define HV_PARTITION_CREATION_FLAG_SMT_ENABLED_GUEST			BIT(0)
 #define HV_PARTITION_CREATION_FLAG_NESTED_VIRTUALIZATION_CAPABLE	BIT(1)
 #define HV_PARTITION_CREATION_FLAG_GPA_SUPER_PAGES_ENABLED		BIT(4)
 #define HV_PARTITION_CREATION_FLAG_EXO_PARTITION			BIT(8)
diff --git a/include/uapi/linux/mshv.h b/include/uapi/linux/mshv.h
index 7ef5dd67a232..e0645a34b55b 100644
--- a/include/uapi/linux/mshv.h
+++ b/include/uapi/linux/mshv.h
@@ -28,6 +28,7 @@ enum {
 	MSHV_PT_BIT_GPA_SUPER_PAGES,
 	MSHV_PT_BIT_CPU_AND_XSAVE_FEATURES,
 	MSHV_PT_BIT_NESTED_VIRTUALIZATION,
+	MSHV_PT_BIT_SMT_ENABLED_GUEST,
 	MSHV_PT_BIT_COUNT,
 };
 
-- 
2.34.1


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

* Re: [PATCH 1/4] mshv: Add nested virtualization creation flag
  2026-02-18 14:47 [PATCH 1/4] mshv: Add nested virtualization creation flag Anatol Belski
                   ` (2 preceding siblings ...)
  2026-02-18 14:48 ` [PATCH 4/4] mshv: Add SMT_ENABLED_GUEST partition creation flag Anatol Belski
@ 2026-02-18 17:09 ` Easwar Hariharan
  2026-02-18 23:55 ` Wei Liu
  4 siblings, 0 replies; 6+ messages in thread
From: Easwar Hariharan @ 2026-02-18 17:09 UTC (permalink / raw)
  To: Anatol Belski; +Cc: linux-hyperv, easwar.hariharan, wei.liu, muislam

On 2/18/2026 6:47 AM, Anatol Belski wrote:
> From: Muminul Islam <muislam@microsoft.com>
> 
> Introduce HV_PARTITION_CREATION_FLAG_NESTED_VIRTUALIZATION_CAPABLE to
> indicate support for nested virtualization during partition creation.
> 
> This enables clearer configuration and capability checks for nested
> virtualization scenarios.
> 
> Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
> Signed-off-by: Muminul Islam <muislam@microsoft.com>
> ---
>  include/hyperv/hvhdk.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/hyperv/hvhdk.h b/include/hyperv/hvhdk.h
> index 08965970c17d..03afb7d0412b 100644
> --- a/include/hyperv/hvhdk.h
> +++ b/include/hyperv/hvhdk.h
> @@ -328,6 +328,7 @@ union hv_partition_isolation_properties {
>  #define HV_PARTITION_ISOLATION_HOST_TYPE_RESERVED   0x2
>  
>  /* Note: Exo partition is enabled by default */
> +#define HV_PARTITION_CREATION_FLAG_NESTED_VIRTUALIZATION_CAPABLE	BIT(1)
>  #define HV_PARTITION_CREATION_FLAG_GPA_SUPER_PAGES_ENABLED		BIT(4)
>  #define HV_PARTITION_CREATION_FLAG_EXO_PARTITION			BIT(8)
>  #define HV_PARTITION_CREATION_FLAG_LAPIC_ENABLED			BIT(13)

Patches 1, 2, and 3 can all be squashed into 1 patch.

Thanks,
Easwar (he/him)

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

* Re: [PATCH 1/4] mshv: Add nested virtualization creation flag
  2026-02-18 14:47 [PATCH 1/4] mshv: Add nested virtualization creation flag Anatol Belski
                   ` (3 preceding siblings ...)
  2026-02-18 17:09 ` [PATCH 1/4] mshv: Add nested virtualization " Easwar Hariharan
@ 2026-02-18 23:55 ` Wei Liu
  4 siblings, 0 replies; 6+ messages in thread
From: Wei Liu @ 2026-02-18 23:55 UTC (permalink / raw)
  To: Anatol Belski; +Cc: linux-hyperv, wei.liu, muislam

On Wed, Feb 18, 2026 at 02:47:59PM +0000, Anatol Belski wrote:
> From: Muminul Islam <muislam@microsoft.com>
> 
> Introduce HV_PARTITION_CREATION_FLAG_NESTED_VIRTUALIZATION_CAPABLE to
> indicate support for nested virtualization during partition creation.
> 
> This enables clearer configuration and capability checks for nested
> virtualization scenarios.
> 
> Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
> Signed-off-by: Muminul Islam <muislam@microsoft.com>

Series applied. I squashed the first three patches into one.

Wei

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

end of thread, other threads:[~2026-02-18 23:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 14:47 [PATCH 1/4] mshv: Add nested virtualization creation flag Anatol Belski
2026-02-18 14:48 ` [PATCH 2/4] hyperv: uapi: Add bit for nested virtualization Anatol Belski
2026-02-18 14:48 ` [PATCH 3/4] drivers: hv: enable " Anatol Belski
2026-02-18 14:48 ` [PATCH 4/4] mshv: Add SMT_ENABLED_GUEST partition creation flag Anatol Belski
2026-02-18 17:09 ` [PATCH 1/4] mshv: Add nested virtualization " Easwar Hariharan
2026-02-18 23:55 ` Wei Liu

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