hyperv: Support hv-xmm-input enlightenment

qemu supports this enlightenment since version 7.10.

From the qemu commit:
    Hyper-V specification allows to pass parameters for certain hypercalls
    using XMM registers ("XMM Fast Hypercall Input"). When the feature is
    in use, it allows for faster hypercalls processing as KVM can avoid
    reading guest's memory.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Tim Wiederhake 2024-08-13 19:18:01 +02:00
parent 0313a500a9
commit 7b6702d516
33 changed files with 47 additions and 2 deletions

View File

@ -1990,6 +1990,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off.
<ipi state='on'/>
<evmcs state='on'/>
<emsr_bitmap state='on'/>
<xmm_input state='on'/>
</hyperv>
<kvm>
<hidden state='on'/>
@ -2079,6 +2080,7 @@ are:
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)`
emsr_bitmap Avoid unnecessary updates to L2 MSR Bitmap upon vmexits. on, off :since:`10.7.0 (QEMU 7.1)`
xmm_input Enable XMM Fast Hypercall Input on, off :since:`10.7.0 (QEMU 7.1)`
=============== ====================================================================== ============================================ =======================================================
:since:`Since 8.0.0`, the hypervisor can be configured further by setting

View File

@ -213,6 +213,7 @@ VIR_ENUM_IMPL(virDomainHyperv,
"evmcs",
"avic",
"emsr_bitmap",
"xmm_input",
);
VIR_ENUM_IMPL(virDomainKVM,
@ -16577,6 +16578,7 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def,
case VIR_DOMAIN_HYPERV_EVMCS:
case VIR_DOMAIN_HYPERV_AVIC:
case VIR_DOMAIN_HYPERV_EMSR_BITMAP:
case VIR_DOMAIN_HYPERV_XMM_INPUT:
break;
case VIR_DOMAIN_HYPERV_STIMER:
@ -21026,6 +21028,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
case VIR_DOMAIN_HYPERV_EVMCS:
case VIR_DOMAIN_HYPERV_AVIC:
case VIR_DOMAIN_HYPERV_EMSR_BITMAP:
case VIR_DOMAIN_HYPERV_XMM_INPUT:
if (src->hyperv_features[i] != dst->hyperv_features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of HyperV enlightenment feature '%1$s' differs: source: '%2$s', destination: '%3$s'"),
@ -27769,6 +27772,7 @@ virDomainDefFormatFeatures(virBuffer *buf,
case VIR_DOMAIN_HYPERV_EVMCS:
case VIR_DOMAIN_HYPERV_AVIC:
case VIR_DOMAIN_HYPERV_EMSR_BITMAP:
case VIR_DOMAIN_HYPERV_XMM_INPUT:
virBufferAddLit(&childBuf, "/>\n");
break;

View File

@ -2205,6 +2205,7 @@ typedef enum {
VIR_DOMAIN_HYPERV_EVMCS,
VIR_DOMAIN_HYPERV_AVIC,
VIR_DOMAIN_HYPERV_EMSR_BITMAP,
VIR_DOMAIN_HYPERV_XMM_INPUT,
VIR_DOMAIN_HYPERV_LAST
} virDomainHyperv;

View File

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

View File

@ -82,6 +82,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_SYNIC,
0x40000003, 0x00000004, 0x0);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER,
0x40000003, 0x00000008, 0x0);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_XMM_INPUT,
0x40000003, 0x00000010, 0x0);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_RELAXED,
0x40000003, 0x00000020, 0x0);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_VAPIC,
@ -109,13 +111,13 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_EVMCS,
KVM_FEATURE_DEF(VIR_CPU_x86_HV_EMSR_BITMAP,
0x4000000A, 0x00080000, 0x0);
static virCPUx86Feature x86_kvm_features[] =
{
KVM_FEATURE(VIR_CPU_x86_KVM_PV_UNHALT),
KVM_FEATURE(VIR_CPU_x86_HV_RUNTIME),
KVM_FEATURE(VIR_CPU_x86_HV_SYNIC),
KVM_FEATURE(VIR_CPU_x86_HV_STIMER),
KVM_FEATURE(VIR_CPU_x86_HV_XMM_INPUT),
KVM_FEATURE(VIR_CPU_x86_HV_RELAXED),
KVM_FEATURE(VIR_CPU_x86_HV_VAPIC),
KVM_FEATURE(VIR_CPU_x86_HV_VPINDEX),

View File

@ -51,6 +51,7 @@ struct _virCPUx86MSR {
#define VIR_CPU_x86_HV_RUNTIME "hv-runtime"
#define VIR_CPU_x86_HV_SYNIC "hv-synic"
#define VIR_CPU_x86_HV_STIMER "hv-stimer"
#define VIR_CPU_x86_HV_XMM_INPUT "hv-xmm_input"
#define VIR_CPU_x86_HV_RELAXED "hv-relaxed"
#define VIR_CPU_x86_HV_SPINLOCKS "hv-spinlocks"
#define VIR_CPU_x86_HV_VAPIC "hv-vapic"

View File

@ -6528,6 +6528,11 @@ qemuBuildCpuCommandLine(virCommand *cmd,
virBufferAsprintf(&buf, ",%s=on", "hv-emsr-bitmap");
break;
case VIR_DOMAIN_HYPERV_XMM_INPUT:
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
virBufferAsprintf(&buf, ",%s=on", "hv-xmm-input");
break;
case VIR_DOMAIN_HYPERV_LAST:
break;
}

View File

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

View File

@ -286,6 +286,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -288,6 +288,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -286,6 +286,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -289,6 +289,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -290,6 +290,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -289,6 +289,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -291,6 +291,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -290,6 +290,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -291,6 +291,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -291,6 +291,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -292,6 +292,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -291,6 +291,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -295,6 +295,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -291,6 +291,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -295,6 +295,7 @@
<value>ipi</value>
<value>avic</value>
<value>emsr_bitmap</value>
<value>xmm_input</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>

View File

@ -3457,5 +3457,6 @@
<cap name='ipi'/>
<cap name='avic'/>
<cap name='emsr_bitmap'/>
<cap name='xmm_input'/>
</hypervCapabilities>
</qemuCaps>

View File

@ -3786,5 +3786,6 @@
<cap name='ipi'/>
<cap name='avic'/>
<cap name='emsr_bitmap'/>
<cap name='xmm_input'/>
</hypervCapabilities>
</qemuCaps>

View File

@ -3760,5 +3760,6 @@
<cap name='ipi'/>
<cap name='avic'/>
<cap name='emsr_bitmap'/>
<cap name='xmm_input'/>
</hypervCapabilities>
</qemuCaps>

View File

@ -3695,5 +3695,6 @@
<cap name='ipi'/>
<cap name='avic'/>
<cap name='emsr_bitmap'/>
<cap name='xmm_input'/>
</hypervCapabilities>
</qemuCaps>

View File

@ -3951,5 +3951,6 @@
<cap name='ipi'/>
<cap name='avic'/>
<cap name='emsr_bitmap'/>
<cap name='xmm_input'/>
</hypervCapabilities>
</qemuCaps>

View File

@ -26,6 +26,7 @@
<ipi state='off'/>
<evmcs state='off'/>
<emsr_bitmap state='off'/>
<xmm_input state='off'/>
</hyperv>
</features>
<cpu mode='custom' match='exact' check='none'>

View File

@ -26,6 +26,7 @@
<ipi state='off'/>
<evmcs state='off'/>
<emsr_bitmap state='off'/>
<xmm_input state='off'/>
</hyperv>
</features>
<clock offset='utc'/>

View File

@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \
-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,hv-avic=on,hv-emsr-bitmap=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,hv-emsr-bitmap=on,hv-xmm-input=on' \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \

View File

@ -27,6 +27,7 @@
<evmcs state='on'/>
<avic state='on'/>
<emsr_bitmap state='on'/>
<xmm_input state='on'/>
</hyperv>
</features>
<cpu mode='custom' match='exact' check='none'>

View File

@ -27,6 +27,7 @@
<evmcs state='on'/>
<avic state='on'/>
<emsr_bitmap state='on'/>
<xmm_input state='on'/>
</hyperv>
</features>
<clock offset='utc'/>