conf: Introduce support for 'hv-avic' Hyper-V enlightenment

qemu-6.2 introduced support for the hv-avic enlightenment which allows
to use Hyper-V SynIC with hardware APICv/AVIC enabled.

Implement the libvirt support for it.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/402
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-11-08 13:29:04 +01:00
parent 50f65e4646
commit 9c26c1bfd4
9 changed files with 16 additions and 1 deletions

View File

@ -2016,6 +2016,7 @@ are:
tlbflush Enable PV TLB flush support on, off :since:`4.7.0 (QEMU 3.0)`
ipi Enable PV IPI support on, off :since:`4.10.0 (QEMU 3.1)`
evmcs Enable Enlightened VMCS on, off :since:`4.10.0 (QEMU 3.1)`
avic Enable use Hyper-V SynIC with hardware APICv/AVIC on, off :since:`8.10.0 (QEMU 6.2)`
=============== ====================================================================== ============================================ =======================================================
:since:`Since 8.0.0` , the hypervisor can be configured further by setting

View File

@ -206,6 +206,7 @@ VIR_ENUM_IMPL(virDomainHyperv,
"tlbflush",
"ipi",
"evmcs",
"avic",
);
VIR_ENUM_IMPL(virDomainKVM,
@ -15840,6 +15841,7 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def,
case VIR_DOMAIN_HYPERV_TLBFLUSH:
case VIR_DOMAIN_HYPERV_IPI:
case VIR_DOMAIN_HYPERV_EVMCS:
case VIR_DOMAIN_HYPERV_AVIC:
break;
case VIR_DOMAIN_HYPERV_STIMER:
@ -20160,6 +20162,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
case VIR_DOMAIN_HYPERV_TLBFLUSH:
case VIR_DOMAIN_HYPERV_IPI:
case VIR_DOMAIN_HYPERV_EVMCS:
case VIR_DOMAIN_HYPERV_AVIC:
if (src->hyperv_features[i] != dst->hyperv_features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of HyperV enlightenment "
@ -26506,6 +26509,7 @@ virDomainDefFormatFeatures(virBuffer *buf,
case VIR_DOMAIN_HYPERV_TLBFLUSH:
case VIR_DOMAIN_HYPERV_IPI:
case VIR_DOMAIN_HYPERV_EVMCS:
case VIR_DOMAIN_HYPERV_AVIC:
virBufferAddLit(&childBuf, "/>\n");
break;

View File

@ -2151,6 +2151,7 @@ typedef enum {
VIR_DOMAIN_HYPERV_TLBFLUSH,
VIR_DOMAIN_HYPERV_IPI,
VIR_DOMAIN_HYPERV_EVMCS,
VIR_DOMAIN_HYPERV_AVIC,
VIR_DOMAIN_HYPERV_LAST
} virDomainHyperv;

View File

@ -7461,6 +7461,11 @@
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="avic">
<ref name="featurestate"/>
</element>
</optional>
</interleave>
</group>
</choice>

View File

@ -6230,6 +6230,7 @@ qemuBuildCpuCommandLine(virCommand *cmd,
case VIR_DOMAIN_HYPERV_TLBFLUSH:
case VIR_DOMAIN_HYPERV_IPI:
case VIR_DOMAIN_HYPERV_EVMCS:
case VIR_DOMAIN_HYPERV_AVIC:
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
virBufferAsprintf(&buf, ",hv-%s=on",
virDomainHypervTypeToString(i));

View File

@ -4243,6 +4243,7 @@ qemuProcessVerifyHypervFeatures(virDomainDef *def,
case VIR_DOMAIN_HYPERV_TLBFLUSH:
case VIR_DOMAIN_HYPERV_IPI:
case VIR_DOMAIN_HYPERV_EVMCS:
case VIR_DOMAIN_HYPERV_AVIC:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("host doesn't support hyperv '%s' feature"),
virDomainHypervTypeToString(i));

View File

@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
-accel tcg \
-cpu 'qemu64,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x2fff,hv-vpindex=on,hv-runtime=on,hv-synic=on,hv-stimer=on,hv-reset=on,hv-vendor-id=KVM Hv,hv-frequencies=on,hv-reenlightenment=on,hv-tlbflush=on,hv-ipi=on,hv-evmcs=on' \
-cpu 'qemu64,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x2fff,hv-vpindex=on,hv-runtime=on,hv-synic=on,hv-stimer=on,hv-reset=on,hv-vendor-id=KVM Hv,hv-frequencies=on,hv-reenlightenment=on,hv-tlbflush=on,hv-ipi=on,hv-evmcs=on,hv-avic=on' \
-m 214 \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \

View File

@ -25,6 +25,7 @@
<tlbflush state='on'/>
<ipi state='on'/>
<evmcs state='on'/>
<avic state='on'/>
</hyperv>
</features>
<clock offset='utc'/>

View File

@ -25,6 +25,7 @@
<tlbflush state='on'/>
<ipi state='on'/>
<evmcs state='on'/>
<avic state='on'/>
</hyperv>
</features>
<clock offset='utc'/>