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'/> <section node='1' size='262144' unit='KiB'/>
</sections> </sections>
</sgx> </sgx>
<hyperv supported='yes'>
<enum name='features'>
<value>relaxed</value>
<value>vapic</value>
</enum>
</hyperv>
</features> </features>
</domainCapabilities> </domainCapabilities>
@ -733,3 +739,12 @@ document store. In order to use SGX with libvirt have a look at `SGX in domain X
``sections`` ``sections``
The sections of the SGX enclave page cache (called EPC). 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); virCPUDefFree(caps->cpu.hostModel);
virSEVCapabilitiesFree(caps->sev); virSEVCapabilitiesFree(caps->sev);
virSGXCapabilitiesFree(caps->sgx); virSGXCapabilitiesFree(caps->sgx);
g_free(caps->hyperv);
values = &caps->os.loader.values; values = &caps->os.loader.values;
for (i = 0; i < values->nvalues; i++) for (i = 0; i < values->nvalues; i++)
@ -678,6 +679,20 @@ virDomainCapsFeatureSGXFormat(virBuffer *buf,
virBufferAddLit(buf, "</sgx>\n"); 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 static void
virDomainCapsFormatFeatures(const virDomainCaps *caps, virDomainCapsFormatFeatures(const virDomainCaps *caps,
virBuffer *buf) virBuffer *buf)
@ -698,6 +713,7 @@ virDomainCapsFormatFeatures(const virDomainCaps *caps,
virDomainCapsFeatureSEVFormat(&childBuf, caps->sev); virDomainCapsFeatureSEVFormat(&childBuf, caps->sev);
virDomainCapsFeatureSGXFormat(&childBuf, caps->sgx); virDomainCapsFeatureSGXFormat(&childBuf, caps->sgx);
virDomainCapsFeatureHypervFormat(&childBuf, caps->hyperv);
virXMLFormatElement(buf, "features", NULL, &childBuf); virXMLFormatElement(buf, "features", NULL, &childBuf);
} }

View File

@ -158,6 +158,13 @@ struct _virDomainCapsFeatureGIC {
virDomainCapsEnum version; /* Info about virGICVersion */ 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 { typedef enum {
VIR_DOMCAPS_CPU_USABLE_UNKNOWN, VIR_DOMCAPS_CPU_USABLE_UNKNOWN,
VIR_DOMCAPS_CPU_USABLE_YES, VIR_DOMCAPS_CPU_USABLE_YES,
@ -263,6 +270,7 @@ struct _virDomainCaps {
virDomainCapsFeatureGIC gic; virDomainCapsFeatureGIC gic;
virSEVCapability *sev; virSEVCapability *sev;
virSGXCapability *sgx; virSGXCapability *sgx;
virDomainCapsFeatureHyperv *hyperv;
/* add new domain features here */ /* add new domain features here */
virTristateBool features[VIR_DOMAIN_CAPS_FEATURE_LAST]; virTristateBool features[VIR_DOMAIN_CAPS_FEATURE_LAST];

View File

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