On Wed, Feb 18, 2026 at 06:23:58AM +0000, Wei Liu wrote:
> On Thu, Feb 12, 2026 at 01:32:22PM +0000, Anirudh Rayabharam wrote:
> > On Wed, Feb 11, 2026 at 04:54:03PM +0100, Magnus Kulke wrote:
> > > When using the extended request format we can instruct the hypervisor to
> > > provision enough space for requested XSAVE features. This is required
> > > for supporting QEMU models provided via the -cpu flag properly.
> > > 
> > > Signed-off-by: Magnus Kulke <[email protected]>
> > > ---
> > >  accel/mshv/mshv-all.c          |  35 +++++--
> > >  include/hw/hyperv/hvgdk_mini.h |   2 +
> > >  include/hw/hyperv/hvhdk.h      | 185 +++++++++++++++++++++++++++++++++
> > >  3 files changed, 214 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
> > > index bed0fa298e..8446f7128a 100644
> > > --- a/accel/mshv/mshv-all.c
> > > +++ b/accel/mshv/mshv-all.c
> > > @@ -112,19 +112,38 @@ static int resume_vm(int vm_fd)
> > >  
> > >  static int create_partition(int mshv_fd, int *vm_fd)
> > >  {
> > > -    int ret;
> > > -    struct mshv_create_partition args = {0};
> > > +    int ret, i;
> > > +    uint64_t pt_flags;
> > > +    union hv_partition_processor_xsave_features disabled_xsave_features;
> > > +    union hv_partition_processor_features disabled_processor_features;
> > > +    struct mshv_create_partition_v2 args = {0};
> > >  
> > >      /* Initialize pt_flags with the desired features */
> > > -    uint64_t pt_flags = (1ULL << MSHV_PT_BIT_LAPIC) |
> > > -                        (1ULL << MSHV_PT_BIT_X2APIC) |
> > > -                        (1ULL << MSHV_PT_BIT_GPA_SUPER_PAGES);
> > > +    pt_flags = (1ULL << MSHV_PT_BIT_LAPIC) |
> > > +               (1ULL << MSHV_PT_BIT_X2APIC) |
> > > +               (1ULL << MSHV_PT_BIT_GPA_SUPER_PAGES) |
> > > +               (1ULL << MSHV_PT_BIT_CPU_AND_XSAVE_FEATURES);
> > >  
> > > -    /* Set default isolation type */
> > > -    uint64_t pt_isolation = MSHV_PT_ISOLATION_NONE;
> > > +    /* enable all */
> > > +    disabled_xsave_features.as_uint64 = 0;
> > >  
> > > +    /* Enable all proc features by default */
> > 
> > Instead of enabling all features by default, we could query which
> > features are supported by the hypervisor on this host and enable only
> > those.
> > 
> > To query supported features get the HvPartitionPropertyProcessorFeatures
> > property via HvCallGetPartitionProperty (with HV_PARTITION_ID_SELF).
> > 
> > I think this would be more robust. This is what Cloud Hypervisor (well,
> > technically, the mshv crate) does.
> > 
> 
> While I think querying the hypervisor is the correct action, are we
> sure this gives all the supported features on the host?

Yes, I confirmed this with the hypervisor team when implementing it in
the mshv crate.

> 
> Is there a case that the Linux root partition  has a reduced set of
> properties?

It is my understanding that the processor features we expose to a guest
must always be a subset of the processor features of the root/parent
partition. So, if some proc feature is not available for root, we cannot
make it available for any guest partitions either.

Thanks,
Anirudh.

> 
> Wei
> 

Reply via email to