diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a99407675fbd840f5a386540e58ec8f803d1c395..dd8172fff2100fc9bc237174eab2c2885dabbfb2 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2079,6 +2079,7 @@
<ccf-assist state='on'/>
<msrs unknown='ignore'/>
<cfpc value='workaround'/>
+ <sbbc value='workaround'/>
</features>
...
@@ -2417,6 +2418,16 @@
default will be used.
Since 6.3.0 (QEMU/KVM only)
+
sbbc
+ Configure sbbc (Speculation Barrier Bounds Checking) availability for
+ pSeries guests.
+ Possible values for the value
attribute
+ are broken
(no protection), workaround
+ (software workaround available) and fixed
(fixed in
+ hardware). If the attribute is not defined, the hypervisor
+ default will be used.
+ Since 6.3.0 (QEMU/KVM only)
+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 6441e01717c209a95ced5dd623e837f4f8121a89..2a7a433c0360fbe7c2f9baf0bba1fbda07befec0 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5437,6 +5437,9 @@
+
+
+
@@ -5708,6 +5711,18 @@
+
+
+
+
+ broken
+ workaround
+ fixed
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e53586cdf2d7c55c47ccb4dc2817fb8ec54a88dd..226a0012fc968b5cd9190dbf0fb3d9620d19f519 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -175,6 +175,7 @@ VIR_ENUM_IMPL(virDomainFeature,
"ccf-assist",
"xen",
"cfpc",
+ "sbbc",
);
VIR_ENUM_IMPL(virDomainCapabilitiesPolicy,
@@ -1275,6 +1276,14 @@ VIR_ENUM_IMPL(virDomainCFPC,
"fixed",
);
+VIR_ENUM_IMPL(virDomainSBBC,
+ VIR_DOMAIN_SBBC_LAST,
+ "none",
+ "broken",
+ "workaround",
+ "fixed",
+);
+
/* Internal mapping: subset of block job types that can be present in
* XML (remaining types are not two-phase). */
VIR_ENUM_DECL(virDomainBlockJob);
@@ -19350,6 +19359,21 @@ virDomainFeaturesDefParse(virDomainDefPtr def,
}
break;
+ case VIR_DOMAIN_FEATURE_SBBC:
+ tmp = virXMLPropString(nodes[i], "value");
+ if (tmp) {
+ int value = virDomainSBBCTypeFromString(tmp);
+ if (value < 0 || value == VIR_DOMAIN_SBBC_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:
@@ -23413,6 +23437,18 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
}
break;
+ case VIR_DOMAIN_FEATURE_SBBC:
+ 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", virDomainSBBCTypeToString(src->features[i]),
+ "value", virDomainSBBCTypeToString(dst->features[i]));
+ return false;
+ }
+ break;
+
case VIR_DOMAIN_FEATURE_MSRS:
break;
@@ -29255,6 +29291,14 @@ virDomainDefFormatFeatures(virBufferPtr buf,
virDomainCFPCTypeToString(def->features[i]));
break;
+ case VIR_DOMAIN_FEATURE_SBBC:
+ if (def->features[i] == VIR_DOMAIN_SBBC_NONE)
+ break;
+
+ virBufferAsprintf(&childBuf, "\n",
+ virDomainSBBCTypeToString(def->features[i]));
+ break;
+
/* coverity[dead_error_begin] */
case VIR_DOMAIN_FEATURE_LAST:
break;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8594049e52704b6aee5aef765c7a0d028a34d8ab..ac84591b17c6bc4348d76970c1e695bd8b601f0c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1817,6 +1817,7 @@ typedef enum {
VIR_DOMAIN_FEATURE_CCF_ASSIST,
VIR_DOMAIN_FEATURE_XEN,
VIR_DOMAIN_FEATURE_CFPC,
+ VIR_DOMAIN_FEATURE_SBBC,
VIR_DOMAIN_FEATURE_LAST
} virDomainFeature;
@@ -1999,6 +2000,17 @@ typedef enum {
VIR_ENUM_DECL(virDomainCFPC);
+typedef enum {
+ VIR_DOMAIN_SBBC_NONE = 0,
+ VIR_DOMAIN_SBBC_BROKEN,
+ VIR_DOMAIN_SBBC_WORKAROUND,
+ VIR_DOMAIN_SBBC_FIXED,
+
+ VIR_DOMAIN_SBBC_LAST
+} virDomainSBBC;
+
+VIR_ENUM_DECL(virDomainSBBC);
+
/* Operating system configuration data & machine / arch */
struct _virDomainOSEnv {
char *name;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9c09f9ac63eea4436bbc5f9178ca8804bb1ca3e9..6a4cc16ce62a3c9d462f57ac52af57ef8b916e7f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -583,6 +583,8 @@ virDomainRNGModelTypeToString;
virDomainRNGRemove;
virDomainRunningReasonTypeFromString;
virDomainRunningReasonTypeToString;
+virDomainSBBCTypeFromString;
+virDomainSBBCTypeToString;
virDomainSCSIDriveAddressIsUsed;
virDomainSeclabelTypeFromString;
virDomainSeclabelTypeToString;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4cb454769a4de179f6cc71b394ff739430fdd7a6..b7c6be0d503fba6053044885c42fc62c2d51dfa1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7176,6 +7176,11 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
virBufferAsprintf(&buf, ",cap-cfpc=%s", str);
}
+ if (def->features[VIR_DOMAIN_FEATURE_SBBC] != VIR_DOMAIN_SBBC_NONE) {
+ const char *str = virDomainSBBCTypeToString(def->features[VIR_DOMAIN_FEATURE_SBBC]);
+ virBufferAsprintf(&buf, ",cap-sbbc=%s", str);
+ }
+
if (cpu && cpu->model &&
cpu->mode == VIR_CPU_MODE_HOST_MODEL &&
qemuDomainIsPSeries(def) &&
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 31d36e938b99025ae0ef7bc3abcb8b75b9f98d63..0d5df6f42640affb20e28c0eea113ea8a44931bf 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -146,6 +146,16 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
return -1;
}
+ break;
+
+ case VIR_DOMAIN_FEATURE_SBBC:
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("sbbc configuration is not supported by "
+ "this QEMU binary"));
+ return -1;
+ }
+
break;
}
@@ -205,6 +215,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
case VIR_DOMAIN_FEATURE_NESTED_HV:
case VIR_DOMAIN_FEATURE_CCF_ASSIST:
case VIR_DOMAIN_FEATURE_CFPC:
+ case VIR_DOMAIN_FEATURE_SBBC:
if (qemuValidateDomainDefPSeriesFeature(def, qemuCaps, i) < 0)
return -1;
break;
diff --git a/tests/qemuxml2argvdata/pseries-features.args b/tests/qemuxml2argvdata/pseries-features.args
index 8540252c1799b4cbc729d481a55dc7993122e76a..9a64df7593520a85e53324e086e5aebcc8010b19 100644
--- a/tests/qemuxml2argvdata/pseries-features.args
+++ b/tests/qemuxml2argvdata/pseries-features.args
@@ -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-cfpc=fixed,cap-sbbc=broken \
-m 512 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/pseries-features.xml b/tests/qemuxml2argvdata/pseries-features.xml
index f07a204cb70bccbd8de935dfde44c4950f3ed95b..ef431b0067b7757fc10c3cf32db9d36b87f98f15 100644
--- a/tests/qemuxml2argvdata/pseries-features.xml
+++ b/tests/qemuxml2argvdata/pseries-features.xml
@@ -14,6 +14,7 @@
+
/usr/bin/qemu-system-ppc64
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1bad60bfce0a3345ff4c4d833542f6d9fc3e3b1d..83f451f750f897544dc50f041959a024c88fda7b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1965,6 +1965,7 @@ 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_RESIZE_HPT);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT */
@@ -1974,7 +1975,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_CFPC);
+ QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
+ QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE */
DO_TEST_PARSE_ERROR("pseries-features",
@@ -1983,6 +1985,7 @@ 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_RESIZE_HPT);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_HTM */
@@ -1992,6 +1995,7 @@ 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_RESIZE_HPT);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV */
@@ -2001,6 +2005,7 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
+ QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST */
@@ -2010,6 +2015,7 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
+ QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
/* parse error: no QEMU_CAPS_MACHINE_PSERIES_CFPC */
@@ -2019,7 +2025,18 @@ 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_CAP_CCF_ASSIST,
+ QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC);
+
+ /* parse error: no QEMU_CAPS_MACHINE_PSERIES_SBBC */
+ 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);
DO_TEST_PARSE_ERROR("pseries-features-invalid-machine", NONE);
diff --git a/tests/qemuxml2xmloutdata/pseries-features.xml b/tests/qemuxml2xmloutdata/pseries-features.xml
index 1b5d78ce74b3df2da91bd103cb0dab91957f9cf4..3700ffa195f1a9bfc71ed0391dacac82f1355e45 100644
--- a/tests/qemuxml2xmloutdata/pseries-features.xml
+++ b/tests/qemuxml2xmloutdata/pseries-features.xml
@@ -16,6 +16,7 @@
+
destroy
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2a89c289a4cb1303645fca56108a6f8a22012d23..c2596161c350aed01fb4571f9dbca53e849d732c 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -696,7 +696,8 @@ mymain(void)
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT,
- QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC);
+ QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
+ QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC);
DO_TEST("pseries-serial-native",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,