提交 2d5f7a49 编写于 作者: D Daniel Henrique Barboza 提交者: Michal Privoznik

qemu: Implement the IBS pSeries feature

This patch adds the implementation of the IBS pSeries feature,
using the QEMU_CAPS_MACHINE_PSERIES_CAP_IBS capability added
in the previous patch.

IBS can have the following values: "broken", "workaround",
"fixed-ibs", "fixed-ccd" and "fixed-na".

This is the XML format for the cap:

<features>
  <ibs value='fixed-ibs'/>
</features>
Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 199dd6f6
......@@ -2080,6 +2080,7 @@
&lt;msrs unknown='ignore'/&gt;
&lt;cfpc value='workaround'/&gt;
&lt;sbbc value='workaround'/&gt;
&lt;ibs value='fixed-na'/&gt;
&lt;/features&gt;
...</pre>
......@@ -2428,6 +2429,19 @@
default will be used.
<span class="since">Since 6.3.0</span> (QEMU/KVM only)
</dd>
<dt><code>ibs</code></dt>
<dd>Configure ibs (Indirect Branch Speculation) availability for
pSeries guests.
Possible values for the <code>value</code> attribute
are <code>broken</code> (no protection), <code>workaround</code>
(count cache flush), <code>fixed-ibs</code> (fixed by
serializing indirect branches), <code>fixed-ccd</code> (fixed by
disabling the cache count) and <code>fixed-na (fixed in
hardware - no longer applicable)</code>.
If the attribute is not defined, the hypervisor
default will be used.
<span class="since">Since 6.3.0</span> (QEMU/KVM only)
</dd>
</dl>
<h3><a id="elementsTime">Time keeping</a></h3>
......
......@@ -5440,6 +5440,9 @@
<optional>
<ref name="sbbc"/>
</optional>
<optional>
<ref name="ibs"/>
</optional>
</interleave>
</element>
</optional>
......@@ -5723,6 +5726,20 @@
</element>
</define>
<define name="ibs">
<element name="ibs">
<attribute name="value">
<choice>
<value>broken</value>
<value>workaround</value>
<value>fixed-ibs</value>
<value>fixed-ccd</value>
<value>fixed-na</value>
</choice>
</attribute>
</element>
</define>
<define name="address">
<element name="address">
<choice>
......
......@@ -176,6 +176,7 @@ VIR_ENUM_IMPL(virDomainFeature,
"xen",
"cfpc",
"sbbc",
"ibs",
);
VIR_ENUM_IMPL(virDomainCapabilitiesPolicy,
......@@ -1284,6 +1285,16 @@ VIR_ENUM_IMPL(virDomainSBBC,
"fixed",
);
VIR_ENUM_IMPL(virDomainIBS,
VIR_DOMAIN_IBS_LAST,
"none",
"broken",
"workaround",
"fixed-ibs",
"fixed-ccd",
"fixed-na",
);
/* Internal mapping: subset of block job types that can be present in
* <mirror> XML (remaining types are not two-phase). */
VIR_ENUM_DECL(virDomainBlockJob);
......@@ -19374,6 +19385,21 @@ virDomainFeaturesDefParse(virDomainDefPtr def,
}
break;
case VIR_DOMAIN_FEATURE_IBS:
tmp = virXMLPropString(nodes[i], "value");
if (tmp) {
int value = virDomainIBSTypeFromString(tmp);
if (value < 0 || value == VIR_DOMAIN_IBS_NONE) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unknown value: %s"),
tmp);
goto error;
}
def->features[val] = value;
VIR_FREE(tmp);
}
break;
case VIR_DOMAIN_FEATURE_HTM:
case VIR_DOMAIN_FEATURE_NESTED_HV:
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
......@@ -23449,6 +23475,18 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
}
break;
case VIR_DOMAIN_FEATURE_IBS:
if (src->features[i] != dst->features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of feature '%s' differs: "
"source: '%s=%s', destination: '%s=%s'"),
featureName,
"value", virDomainIBSTypeToString(src->features[i]),
"value", virDomainIBSTypeToString(dst->features[i]));
return false;
}
break;
case VIR_DOMAIN_FEATURE_MSRS:
break;
......@@ -29299,6 +29337,14 @@ virDomainDefFormatFeatures(virBufferPtr buf,
virDomainSBBCTypeToString(def->features[i]));
break;
case VIR_DOMAIN_FEATURE_IBS:
if (def->features[i] == VIR_DOMAIN_IBS_NONE)
break;
virBufferAsprintf(&childBuf, "<ibs value='%s'/>\n",
virDomainIBSTypeToString(def->features[i]));
break;
/* coverity[dead_error_begin] */
case VIR_DOMAIN_FEATURE_LAST:
break;
......@@ -1818,6 +1818,7 @@ typedef enum {
VIR_DOMAIN_FEATURE_XEN,
VIR_DOMAIN_FEATURE_CFPC,
VIR_DOMAIN_FEATURE_SBBC,
VIR_DOMAIN_FEATURE_IBS,
VIR_DOMAIN_FEATURE_LAST
} virDomainFeature;
......@@ -2011,6 +2012,19 @@ typedef enum {
VIR_ENUM_DECL(virDomainSBBC);
typedef enum {
VIR_DOMAIN_IBS_NONE = 0,
VIR_DOMAIN_IBS_BROKEN,
VIR_DOMAIN_IBS_WORKAROUND,
VIR_DOMAIN_IBS_FIXEDIBS,
VIR_DOMAIN_IBS_FIXEDCCD,
VIR_DOMAIN_IBS_FIXEDNA,
VIR_DOMAIN_IBS_LAST
} virDomainIBS;
VIR_ENUM_DECL(virDomainIBS);
/* Operating system configuration data & machine / arch */
struct _virDomainOSEnv {
char *name;
......
......@@ -456,6 +456,8 @@ virDomainHubTypeFromString;
virDomainHubTypeToString;
virDomainHypervTypeFromString;
virDomainHypervTypeToString;
virDomainIBSTypeFromString;
virDomainIBSTypeToString;
virDomainInputBusTypeToString;
virDomainInputDefFind;
virDomainInputDefFree;
......
......@@ -7181,6 +7181,11 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
virBufferAsprintf(&buf, ",cap-sbbc=%s", str);
}
if (def->features[VIR_DOMAIN_FEATURE_IBS] != VIR_DOMAIN_IBS_NONE) {
const char *str = virDomainIBSTypeToString(def->features[VIR_DOMAIN_FEATURE_IBS]);
virBufferAsprintf(&buf, ",cap-ibs=%s", str);
}
if (cpu && cpu->model &&
cpu->mode == VIR_CPU_MODE_HOST_MODEL &&
qemuDomainIsPSeries(def) &&
......
......@@ -156,6 +156,16 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
return -1;
}
break;
case VIR_DOMAIN_FEATURE_IBS:
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_IBS)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("ibs configuration is not supported by "
"this QEMU binary"));
return -1;
}
break;
}
......@@ -216,6 +226,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
case VIR_DOMAIN_FEATURE_CFPC:
case VIR_DOMAIN_FEATURE_SBBC:
case VIR_DOMAIN_FEATURE_IBS:
if (qemuValidateDomainDefPSeriesFeature(def, qemuCaps, i) < 0)
return -1;
break;
......
......@@ -12,7 +12,7 @@ QEMU_AUDIO_DRV=none \
-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-ccf-assist=on,\
cap-cfpc=fixed,cap-sbbc=broken \
cap-cfpc=fixed,cap-sbbc=broken,cap-ibs=fixed-ccd \
-m 512 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \
......
......@@ -15,6 +15,7 @@
<ccf-assist state='on'/>
<cfpc value='fixed'/>
<sbbc value='broken'/>
<ibs value='fixed-ccd'/>
</features>
<devices>
<emulator>/usr/bin/qemu-system-ppc64</emulator>
......
......@@ -1966,6 +1966,7 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
QEMU_CAPS_MACHINE_PSERIES_CAP_IBS,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT */
......@@ -1976,7 +1977,8 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC);
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
QEMU_CAPS_MACHINE_PSERIES_CAP_IBS);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE */
DO_TEST_PARSE_ERROR("pseries-features",
......@@ -1986,6 +1988,7 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
QEMU_CAPS_MACHINE_PSERIES_CAP_IBS,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_HTM */
......@@ -1996,6 +1999,7 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
QEMU_CAPS_MACHINE_PSERIES_CAP_IBS,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV */
......@@ -2006,6 +2010,7 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
QEMU_CAPS_MACHINE_PSERIES_CAP_IBS,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST */
......@@ -2016,6 +2021,7 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
QEMU_CAPS_MACHINE_PSERIES_CAP_IBS,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_CFPC */
......@@ -2026,7 +2032,8 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC);
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
QEMU_CAPS_MACHINE_PSERIES_CAP_IBS);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_SBBC */
DO_TEST_PARSE_ERROR("pseries-features",
......@@ -2036,7 +2043,19 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC);
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
QEMU_CAPS_MACHINE_PSERIES_CAP_IBS);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_IBS */
DO_TEST_PARSE_ERROR("pseries-features",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT,
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_CAP_CFPC,
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC);
DO_TEST_PARSE_ERROR("pseries-features-invalid-machine", NONE);
......
......@@ -17,6 +17,7 @@
<ccf-assist state='on'/>
<cfpc value='fixed'/>
<sbbc value='broken'/>
<ibs value='fixed-ccd'/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
......
......@@ -697,7 +697,8 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT,
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC);
QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
QEMU_CAPS_MACHINE_PSERIES_CAP_IBS);
DO_TEST("pseries-serial-native",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册