qemu: Implement the ccf-assist pSeries feature

This patch adds the implementation of the ccf-assist pSeries
feature, based on the QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST
capability that was added in the previous patch.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Daniel Henrique Barboza 2019-10-08 17:06:24 -03:00 committed by Cole Robinson
parent 86a8e5a84c
commit cab3ea2303
11 changed files with 45 additions and 1 deletions

View File

@ -2059,6 +2059,7 @@
&lt;tseg unit='MiB'&gt;48&lt;/tseg&gt;
&lt;/smm&gt;
&lt;htm state='on'/&gt;
&lt;ccf-assist state='on'/&gt;
&lt;msrs unknown='ignore'/&gt;
&lt;/features&gt;
...</pre>
@ -2357,6 +2358,14 @@
will not be ignored.
<span class="since">Since 5.1.0</span> (bhyve only)
</dd>
<dt><code>ccf-assist</code></dt>
<dd>Configure ccf-assist (Count Cache Flush Assist) availability for
pSeries guests.
Possible values for the <code>state</code> attribute
are <code>on</code> and <code>off</code>. If the attribute is not
defined, the hypervisor default will be used.
<span class="since">Since 5.9.0</span> (QEMU/KVM only)
</dd>
</dl>
<h3><a id="elementsTime">Time keeping</a></h3>

View File

@ -5121,6 +5121,11 @@
<optional>
<ref name="msrs"/>
</optional>
<optional>
<element name="ccf-assist">
<ref name="featurestate"/>
</element>
</optional>
</interleave>
</element>
</optional>

View File

@ -171,6 +171,7 @@ VIR_ENUM_IMPL(virDomainFeature,
"htm",
"nested-hv",
"msrs",
"ccf-assist",
);
VIR_ENUM_IMPL(virDomainCapabilitiesPolicy,
@ -20398,6 +20399,7 @@ virDomainDefParseXML(xmlDocPtr xml,
case VIR_DOMAIN_FEATURE_HTM:
case VIR_DOMAIN_FEATURE_NESTED_HV:
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
if (!(tmp = virXMLPropString(nodes[i], "state"))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("missing state attribute '%s' of feature '%s'"),
@ -22623,6 +22625,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
case VIR_DOMAIN_FEATURE_VMCOREINFO:
case VIR_DOMAIN_FEATURE_HTM:
case VIR_DOMAIN_FEATURE_NESTED_HV:
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
if (src->features[i] != dst->features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of feature '%s' differs: "
@ -28189,6 +28192,7 @@ virDomainDefFormatFeatures(virBufferPtr buf,
case VIR_DOMAIN_FEATURE_VMPORT:
case VIR_DOMAIN_FEATURE_HTM:
case VIR_DOMAIN_FEATURE_NESTED_HV:
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
switch ((virTristateSwitch) def->features[i]) {
case VIR_TRISTATE_SWITCH_LAST:
case VIR_TRISTATE_SWITCH_ABSENT:

View File

@ -1756,6 +1756,7 @@ typedef enum {
VIR_DOMAIN_FEATURE_HTM,
VIR_DOMAIN_FEATURE_NESTED_HV,
VIR_DOMAIN_FEATURE_MSRS,
VIR_DOMAIN_FEATURE_CCF_ASSIST,
VIR_DOMAIN_FEATURE_LAST
} virDomainFeature;

View File

@ -7412,6 +7412,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
virBufferAsprintf(&buf, ",cap-nested-hv=%s", str);
}
if (def->features[VIR_DOMAIN_FEATURE_CCF_ASSIST] != VIR_TRISTATE_SWITCH_ABSENT) {
const char *str;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("ccf-assist configuration is not supported by this "
"QEMU binary"));
return -1;
}
str = virTristateSwitchTypeToString(def->features[VIR_DOMAIN_FEATURE_CCF_ASSIST]);
if (!str) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Invalid setting for ccf-assist state"));
return -1;
}
virBufferAsprintf(&buf, ",cap-ccf-assist=%s", str);
}
if (cpu && cpu->model &&
cpu->mode == VIR_CPU_MODE_HOST_MODEL &&
qemuDomainIsPSeries(def) &&

View File

@ -4730,6 +4730,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
case VIR_DOMAIN_FEATURE_HPT:
case VIR_DOMAIN_FEATURE_HTM:
case VIR_DOMAIN_FEATURE_NESTED_HV:
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
!qemuDomainIsPSeries(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,

View File

@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name guest \
-S \
-machine pseries,accel=tcg,usb=off,dump-guest-core=off,resize-hpt=required,\
cap-hpt-max-page-size=1048576k,cap-htm=on,cap-nested-hv=off \
cap-hpt-max-page-size=1048576k,cap-htm=on,cap-nested-hv=off,cap-ccf-assist=on \
-m 512 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \

View File

@ -12,6 +12,7 @@
</hpt>
<htm state='on'/>
<nested-hv state='off'/>
<ccf-assist state='on'/>
</features>
<devices>
<emulator>/usr/bin/qemu-system-ppc64</emulator>

View File

@ -1960,6 +1960,7 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
DO_TEST_FAILURE("pseries-features",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);

View File

@ -14,6 +14,7 @@
</hpt>
<htm state='on'/>
<nested-hv state='off'/>
<ccf-assist state='on'/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>

View File

@ -608,6 +608,7 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
DO_TEST("pseries-serial-native",