conf, docs: Add support for direct and extended tlbflush features

Similarly to stimer-direct these are subelements of <tlbflush/> in the
domain XML.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Martin Kletzander 2024-12-20 12:27:22 +01:00
parent f7c33eeeb7
commit ac08b362da
6 changed files with 64 additions and 7 deletions

View File

@ -1993,7 +1993,10 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off.
<vendor_id state='on' value='KVM Hv'/>
<frequencies state='on'/>
<reenlightenment state='on'/>
<tlbflush state='on'/>
<tlbflush state='on'>
<direct state='on'/>
<extended state='on'/>
</tlbflush>
<ipi state='on'/>
<evmcs state='on'/>
<emsr_bitmap state='on'/>
@ -2068,9 +2071,9 @@ are:
Enable various features improving behavior of guests running Microsoft
Windows.
=============== ====================================================================== ============================================ =======================================================
=============== ====================================================================== ============================================ ========================================================================
Feature Description Value Since
=============== ====================================================================== ============================================ =======================================================
=============== ====================================================================== ============================================ ========================================================================
relaxed Relax constraints on timers on, off :since:`1.0.0 (QEMU 2.0)`
vapic Enable virtual APIC on, off :since:`1.1.0 (QEMU 2.0)`
spinlocks Enable spinlock support on, off; retries - at least 4095 :since:`1.1.0 (QEMU 2.0)`
@ -2082,13 +2085,13 @@ are:
vendor_id Set hypervisor vendor id on, off; value - string, up to 12 characters :since:`1.3.3 (QEMU 2.5)`
frequencies Expose frequency MSRs on, off :since:`4.7.0 (QEMU 2.12)`
reenlightenment Enable re-enlightenment notification on migration on, off :since:`4.7.0 (QEMU 3.0)`
tlbflush Enable PV TLB flush support on, off :since:`4.7.0 (QEMU 3.0)`
tlbflush Enable PV TLB flush support on, off; direct - on,off; extended - on,off :since:`4.7.0 (QEMU 3.0), direct and extended modes 11.0.0 (QEMU 7.1.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)`
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
the ``mode`` attribute to one of the following values:

View File

@ -16672,7 +16672,6 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def,
case VIR_DOMAIN_HYPERV_RESET:
case VIR_DOMAIN_HYPERV_FREQUENCIES:
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
case VIR_DOMAIN_HYPERV_TLBFLUSH:
case VIR_DOMAIN_HYPERV_IPI:
case VIR_DOMAIN_HYPERV_EVMCS:
case VIR_DOMAIN_HYPERV_AVIC:
@ -16680,6 +16679,31 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def,
case VIR_DOMAIN_HYPERV_XMM_INPUT:
break;
case VIR_DOMAIN_HYPERV_TLBFLUSH:
if (value != VIR_TRISTATE_SWITCH_ON)
break;
child = xmlFirstElementChild(node);
while (child) {
if (STREQ((const char *)child->name, "direct")) {
if (virXMLPropTristateSwitch(child, "state", VIR_XML_PROP_REQUIRED,
&def->hyperv_tlbflush_direct) < 0)
return -1;
} else if (STREQ((const char *)child->name, "extended")) {
if (virXMLPropTristateSwitch(child, "state", VIR_XML_PROP_REQUIRED,
&def->hyperv_tlbflush_extended) < 0)
return -1;
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported Hyper-V tlbflush feature: %1$s"),
child->name);
return -1;
}
child = xmlNextElementSibling(child);
}
break;
case VIR_DOMAIN_HYPERV_STIMER:
if (value != VIR_TRISTATE_SWITCH_ON)
break;

View File

@ -3101,6 +3101,8 @@ struct _virDomainDef {
virDomainXenPassthroughMode xen_passthrough_mode;
unsigned int hyperv_spinlocks;
virTristateSwitch hyperv_stimer_direct;
virTristateSwitch hyperv_tlbflush_direct;
virTristateSwitch hyperv_tlbflush_extended;
virGICVersion gic_version;
virDomainHPTResizing hpt_resizing;
unsigned long long hpt_maxpagesize; /* Stored in KiB */

View File

@ -8027,7 +8027,7 @@
</optional>
<optional>
<element name="tlbflush">
<ref name="featurestate"/>
<ref name="tlbflush"/>
</element>
</optional>
<optional>
@ -8075,6 +8075,25 @@
</interleave>
</define>
<!-- Hyper-V tlbflush features -->
<define name="tlbflush">
<interleave>
<optional>
<ref name="featurestate"/>
</optional>
<optional>
<element name="direct">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="extended">
<ref name="featurestate"/>
</element>
</optional>
</interleave>
</define>
<!-- Optional KVM features -->
<define name="kvm">
<element name="kvm">

View File

@ -99,6 +99,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_REENLIGHTENMENT,
KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER_DIRECT,
0x40000003, 0x0, 0x00080000);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH_DIRECT,
0x40000003, 0x0, 0x00004000);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH,
0x40000004, 0x00000004, 0x0);
@ -109,6 +111,9 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_IPI,
KVM_FEATURE_DEF(VIR_CPU_x86_HV_EVMCS,
0x40000004, 0x00004000, 0x0);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH_EXT,
0x40000004, 0x0, 0x00004000);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_EMSR_BITMAP,
0x4000000A, 0x00080000, 0x0);
static virCPUx86Feature x86_kvm_features[] =
@ -130,6 +135,8 @@ static virCPUx86Feature x86_kvm_features[] =
KVM_FEATURE(VIR_CPU_x86_HV_EVMCS),
KVM_FEATURE(VIR_CPU_x86_HV_STIMER_DIRECT),
KVM_FEATURE(VIR_CPU_x86_HV_EMSR_BITMAP),
KVM_FEATURE(VIR_CPU_x86_HV_TLBFLUSH_DIRECT),
KVM_FEATURE(VIR_CPU_x86_HV_TLBFLUSH_EXT),
};
typedef struct _virCPUx86Signature virCPUx86Signature;

View File

@ -60,6 +60,8 @@ struct _virCPUx86MSR {
#define VIR_CPU_x86_HV_FREQUENCIES "hv-frequencies"
#define VIR_CPU_x86_HV_REENLIGHTENMENT "hv-reenlightenment"
#define VIR_CPU_x86_HV_TLBFLUSH "hv-tlbflush"
#define VIR_CPU_x86_HV_TLBFLUSH_EXT "hv-tlbflush-ext"
#define VIR_CPU_x86_HV_TLBFLUSH_DIRECT "hv-tlbflush-direct"
#define VIR_CPU_x86_HV_IPI "hv-ipi"
#define VIR_CPU_x86_HV_EVMCS "hv-evmcs"
#define VIR_CPU_x86_HV_AVIC "hv-avic"