You need to sign in or sign up before continuing.
提交 f4c39db7 编写于 作者: V Vitaly Kuznetsov 提交者: John Ferlan

conf: qemu: add support for Hyper-V PV TLB flush

Qemu-3.0 supports Hyper-V-style PV TLB flush, Windows guests can benefit
from this feature as KVM knows which vCPUs are not currently scheduled (and
thus don't require any immediate action).
Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 b5d770e1
...@@ -1976,6 +1976,7 @@ ...@@ -1976,6 +1976,7 @@
&lt;vendor_id state='on' value='KVM Hv'/&gt; &lt;vendor_id state='on' value='KVM Hv'/&gt;
&lt;frequencies state='on'/&gt; &lt;frequencies state='on'/&gt;
&lt;reenlightenment state='on'/&gt; &lt;reenlightenment state='on'/&gt;
&lt;tlbflush state='on'/&gt;
&lt;/hyperv&gt; &lt;/hyperv&gt;
&lt;kvm&gt; &lt;kvm&gt;
&lt;hidden state='on'/&gt; &lt;hidden state='on'/&gt;
...@@ -2110,6 +2111,12 @@ ...@@ -2110,6 +2111,12 @@
<td> on, off</td> <td> on, off</td>
<td><span class="since">4.7.0 (QEMU 3.0)</span></td> <td><span class="since">4.7.0 (QEMU 3.0)</span></td>
</tr> </tr>
<tr>
<td>tlbflush</td>
<td>Enable PV TLB flush support</td>
<td> on, off</td>
<td><span class="since">4.7.0 (QEMU 3.0)</span></td>
</tr>
</table> </table>
</dd> </dd>
<dt><code>pvspinlock</code></dt> <dt><code>pvspinlock</code></dt>
......
...@@ -5743,6 +5743,11 @@ ...@@ -5743,6 +5743,11 @@
<ref name="featurestate"/> <ref name="featurestate"/>
</element> </element>
</optional> </optional>
<optional>
<element name="tlbflush">
<ref name="featurestate"/>
</element>
</optional>
</interleave> </interleave>
</element> </element>
</define> </define>
......
...@@ -171,7 +171,8 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST, ...@@ -171,7 +171,8 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
"reset", "reset",
"vendor_id", "vendor_id",
"frequencies", "frequencies",
"reenlightenment") "reenlightenment",
"tlbflush")
VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST, VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST,
"hidden") "hidden")
...@@ -20282,6 +20283,7 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -20282,6 +20283,7 @@ virDomainDefParseXML(xmlDocPtr xml,
case VIR_DOMAIN_HYPERV_RESET: case VIR_DOMAIN_HYPERV_RESET:
case VIR_DOMAIN_HYPERV_FREQUENCIES: case VIR_DOMAIN_HYPERV_FREQUENCIES:
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
case VIR_DOMAIN_HYPERV_TLBFLUSH:
break; break;
case VIR_DOMAIN_HYPERV_SPINLOCKS: case VIR_DOMAIN_HYPERV_SPINLOCKS:
...@@ -22468,6 +22470,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src, ...@@ -22468,6 +22470,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
case VIR_DOMAIN_HYPERV_RESET: case VIR_DOMAIN_HYPERV_RESET:
case VIR_DOMAIN_HYPERV_FREQUENCIES: case VIR_DOMAIN_HYPERV_FREQUENCIES:
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
case VIR_DOMAIN_HYPERV_TLBFLUSH:
if (src->hyperv_features[i] != dst->hyperv_features[i]) { if (src->hyperv_features[i] != dst->hyperv_features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of HyperV enlightenment " _("State of HyperV enlightenment "
...@@ -28185,6 +28188,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, ...@@ -28185,6 +28188,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
case VIR_DOMAIN_HYPERV_RESET: case VIR_DOMAIN_HYPERV_RESET:
case VIR_DOMAIN_HYPERV_FREQUENCIES: case VIR_DOMAIN_HYPERV_FREQUENCIES:
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
case VIR_DOMAIN_HYPERV_TLBFLUSH:
break; break;
case VIR_DOMAIN_HYPERV_SPINLOCKS: case VIR_DOMAIN_HYPERV_SPINLOCKS:
......
...@@ -1793,6 +1793,7 @@ typedef enum { ...@@ -1793,6 +1793,7 @@ typedef enum {
VIR_DOMAIN_HYPERV_VENDOR_ID, VIR_DOMAIN_HYPERV_VENDOR_ID,
VIR_DOMAIN_HYPERV_FREQUENCIES, VIR_DOMAIN_HYPERV_FREQUENCIES,
VIR_DOMAIN_HYPERV_REENLIGHTENMENT, VIR_DOMAIN_HYPERV_REENLIGHTENMENT,
VIR_DOMAIN_HYPERV_TLBFLUSH,
VIR_DOMAIN_HYPERV_LAST VIR_DOMAIN_HYPERV_LAST
} virDomainHyperv; } virDomainHyperv;
......
...@@ -113,6 +113,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_FREQUENCIES, ...@@ -113,6 +113,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_FREQUENCIES,
0x40000003, 0x00000800); 0x40000003, 0x00000800);
KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT, KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT,
0x40000003, 0x00002000); 0x40000003, 0x00002000);
KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_TLBFLUSH,
0x40000004, 0x00000004);
static virCPUx86Feature x86_kvm_features[] = static virCPUx86Feature x86_kvm_features[] =
{ {
...@@ -135,6 +137,7 @@ static virCPUx86Feature x86_kvm_features[] = ...@@ -135,6 +137,7 @@ static virCPUx86Feature x86_kvm_features[] =
KVM_FEATURE(VIR_CPU_x86_KVM_HV_RESET), KVM_FEATURE(VIR_CPU_x86_KVM_HV_RESET),
KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES), KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES),
KVM_FEATURE(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT), KVM_FEATURE(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT),
KVM_FEATURE(VIR_CPU_x86_KVM_HV_TLBFLUSH),
}; };
typedef struct _virCPUx86Model virCPUx86Model; typedef struct _virCPUx86Model virCPUx86Model;
......
...@@ -65,6 +65,7 @@ struct _virCPUx86CPUID { ...@@ -65,6 +65,7 @@ struct _virCPUx86CPUID {
# define VIR_CPU_x86_KVM_HV_RESET "__kvm_hv_reset" # define VIR_CPU_x86_KVM_HV_RESET "__kvm_hv_reset"
# define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies" # define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies"
# define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "__kvm_hv_reenlightenment" # define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "__kvm_hv_reenlightenment"
# define VIR_CPU_x86_KVM_HV_TLBFLUSH "__kvm_hv_tlbflush"
# define VIR_CPU_X86_DATA_INIT { 0 } # define VIR_CPU_X86_DATA_INIT { 0 }
......
...@@ -6868,6 +6868,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, ...@@ -6868,6 +6868,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
case VIR_DOMAIN_HYPERV_RESET: case VIR_DOMAIN_HYPERV_RESET:
case VIR_DOMAIN_HYPERV_FREQUENCIES: case VIR_DOMAIN_HYPERV_FREQUENCIES:
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
case VIR_DOMAIN_HYPERV_TLBFLUSH:
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON) if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
virBufferAsprintf(&buf, ",hv_%s", virBufferAsprintf(&buf, ",hv_%s",
virDomainHypervTypeToString(i)); virDomainHypervTypeToString(i));
......
...@@ -1538,6 +1538,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom, ...@@ -1538,6 +1538,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
case VIR_DOMAIN_HYPERV_RESET: case VIR_DOMAIN_HYPERV_RESET:
case VIR_DOMAIN_HYPERV_FREQUENCIES: case VIR_DOMAIN_HYPERV_FREQUENCIES:
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
case VIR_DOMAIN_HYPERV_TLBFLUSH:
if (value) { if (value) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("HyperV feature '%s' should not " _("HyperV feature '%s' should not "
......
...@@ -3914,6 +3914,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, ...@@ -3914,6 +3914,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
case VIR_DOMAIN_HYPERV_RESET: case VIR_DOMAIN_HYPERV_RESET:
case VIR_DOMAIN_HYPERV_FREQUENCIES: case VIR_DOMAIN_HYPERV_FREQUENCIES:
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
case VIR_DOMAIN_HYPERV_TLBFLUSH:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("host doesn't support hyperv '%s' feature"), _("host doesn't support hyperv '%s' feature"),
virDomainHypervTypeToString(i)); virDomainHypervTypeToString(i));
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<vendor_id state='off'/> <vendor_id state='off'/>
<frequencies state='off'/> <frequencies state='off'/>
<reenlightenment state='off'/> <reenlightenment state='off'/>
<tlbflush state='off'/>
</hyperv> </hyperv>
</features> </features>
<clock offset='utc'/> <clock offset='utc'/>
......
...@@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \ ...@@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \
-machine pc,accel=tcg,usb=off,dump-guest-core=off \ -machine pc,accel=tcg,usb=off,dump-guest-core=off \
-cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\ -cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\
hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies,\ hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies,\
hv_reenlightenment' \ hv_reenlightenment,hv_tlbflush' \
-m 214 \ -m 214 \
-smp 6,sockets=6,cores=1,threads=1 \ -smp 6,sockets=6,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<vendor_id state='on' value='KVM Hv'/> <vendor_id state='on' value='KVM Hv'/>
<frequencies state='on'/> <frequencies state='on'/>
<reenlightenment state='on'/> <reenlightenment state='on'/>
<tlbflush state='on'/>
</hyperv> </hyperv>
</features> </features>
<clock offset='utc'/> <clock offset='utc'/>
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<vendor_id state='off'/> <vendor_id state='off'/>
<frequencies state='off'/> <frequencies state='off'/>
<reenlightenment state='off'/> <reenlightenment state='off'/>
<tlbflush state='off'/>
</hyperv> </hyperv>
</features> </features>
<clock offset='utc'/> <clock offset='utc'/>
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<vendor_id state='on' value='KVM Hv'/> <vendor_id state='on' value='KVM Hv'/>
<frequencies state='on'/> <frequencies state='on'/>
<reenlightenment state='on'/> <reenlightenment state='on'/>
<tlbflush state='on'/>
</hyperv> </hyperv>
</features> </features>
<clock offset='utc'/> <clock offset='utc'/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册