1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

domain_capabilities: Expose Hyper-V Enlightenments

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2022-12-21 15:14:54 +01:00
parent 179e45d237
commit 7c1ecfd512
4 changed files with 49 additions and 0 deletions

View File

@ -624,6 +624,12 @@ capabilities. All features occur as children of the main ``features`` element.
<section node='1' size='262144' unit='KiB'/>
</sections>
</sgx>
<hyperv supported='yes'>
<enum name='features'>
<value>relaxed</value>
<value>vapic</value>
</enum>
</hyperv>
</features>
</domainCapabilities>
@ -733,3 +739,12 @@ document store. In order to use SGX with libvirt have a look at `SGX in domain X
``sections``
The sections of the SGX enclave page cache (called EPC).
Hyper-V Enlightenments
^^^^^^^^^^^^^^^^^^^^^^
Report which features improving behavior of guests running Microsoft Windows
are supported. The ``features`` enum corresponds to the ``<hyperv/>`` element
(well, its children) as documented in `Hypervisor features
<formatdomain.html#hypervisor-features>`__

View File

@ -100,6 +100,7 @@ virDomainCapsDispose(void *obj)
virCPUDefFree(caps->cpu.hostModel);
virSEVCapabilitiesFree(caps->sev);
virSGXCapabilitiesFree(caps->sgx);
g_free(caps->hyperv);
values = &caps->os.loader.values;
for (i = 0; i < values->nvalues; i++)
@ -678,6 +679,20 @@ virDomainCapsFeatureSGXFormat(virBuffer *buf,
virBufferAddLit(buf, "</sgx>\n");
}
static void
virDomainCapsFeatureHypervFormat(virBuffer *buf,
const virDomainCapsFeatureHyperv *hyperv)
{
if (!hyperv)
return;
FORMAT_PROLOGUE(hyperv);
ENUM_PROCESS(hyperv, features, virDomainHypervTypeToString);
FORMAT_EPILOGUE(hyperv);
}
static void
virDomainCapsFormatFeatures(const virDomainCaps *caps,
virBuffer *buf)
@ -698,6 +713,7 @@ virDomainCapsFormatFeatures(const virDomainCaps *caps,
virDomainCapsFeatureSEVFormat(&childBuf, caps->sev);
virDomainCapsFeatureSGXFormat(&childBuf, caps->sgx);
virDomainCapsFeatureHypervFormat(&childBuf, caps->hyperv);
virXMLFormatElement(buf, "features", NULL, &childBuf);
}

View File

@ -158,6 +158,13 @@ struct _virDomainCapsFeatureGIC {
virDomainCapsEnum version; /* Info about virGICVersion */
};
STATIC_ASSERT_ENUM(VIR_DOMAIN_HYPERV_LAST);
typedef struct _virDomainCapsFeatureHyperv virDomainCapsFeatureHyperv;
struct _virDomainCapsFeatureHyperv {
virTristateBool supported;
virDomainCapsEnum features; /* Info about supported virDomainHyperv features */
};
typedef enum {
VIR_DOMCAPS_CPU_USABLE_UNKNOWN,
VIR_DOMCAPS_CPU_USABLE_YES,
@ -263,6 +270,7 @@ struct _virDomainCaps {
virDomainCapsFeatureGIC gic;
virSEVCapability *sev;
virSGXCapability *sgx;
virDomainCapsFeatureHyperv *hyperv;
/* add new domain features here */
virTristateBool features[VIR_DOMAIN_CAPS_FEATURE_LAST];

View File

@ -296,6 +296,9 @@
<optional>
<ref name="sgx"/>
</optional>
<optional>
<ref name="hyperv"/>
</optional>
</element>
</define>
@ -396,6 +399,13 @@
</element>
</define>
<define name="hyperv">
<element name="hyperv">
<ref name="supported"/>
<ref name="enum"/>
</element>
</define>
<define name="value">
<zeroOrMore>
<element name="value">