diff --git a/add-qemu-VIRTCCA-capability-detection.patch b/add-qemu-VIRTCCA-capability-detection.patch new file mode 100644 index 0000000000000000000000000000000000000000..310179eb6596ebee790cb2a925fc74e1c217fab6 --- /dev/null +++ b/add-qemu-VIRTCCA-capability-detection.patch @@ -0,0 +1,473 @@ +From 5ea63e7421dc9e4c711a9d206d6a6bcd9ad7561a Mon Sep 17 00:00:00 2001 +From: panhengchang +Date: Wed, 4 Jun 2025 09:38:52 +0800 +Subject: [PATCH 1/2] add qemu VIRTCCA capability detection + +This patch is used to detect virtcca capability +on Hisi Kunpeng platform through qmp command +"query-virtcca-capabilities". The result will +be formated to xml, such as +"" or +"" + +This function can be called by +"virsh domcapabilities" command or libvirt api +"qemuConnectGetDomainCapabilities". + +Signed-off-by: panghengchang +--- + src/conf/domain_capabilities.c | 35 +++++++++++ + src/conf/domain_capabilities.h | 11 ++++ + src/libvirt_private.syms | 1 + + src/qemu/qemu_capabilities.c | 108 +++++++++++++++++++++++++++++++++ + src/qemu/qemu_capabilities.h | 1 + + src/qemu/qemu_monitor.c | 10 +++ + src/qemu/qemu_monitor.h | 3 + + src/qemu/qemu_monitor_json.c | 45 ++++++++++++++ + src/qemu/qemu_monitor_json.h | 4 ++ + 9 files changed, 218 insertions(+) + +diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c +index f6e09dc584..4a83777e9c 100644 +--- a/src/conf/domain_capabilities.c ++++ b/src/conf/domain_capabilities.c +@@ -88,6 +88,16 @@ virSGXCapabilitiesFree(virSGXCapability *cap) + } + + ++void ++virVIRTCCACapabilitiesFree(virVIRTCCACapability *cap) ++{ ++ if (!cap) ++ return; ++ ++ g_free(cap); ++} ++ ++ + static void + virDomainCapsDispose(void *obj) + { +@@ -101,6 +111,7 @@ virDomainCapsDispose(void *obj) + virCPUDefFree(caps->cpu.hostModel); + virSEVCapabilitiesFree(caps->sev); + virSGXCapabilitiesFree(caps->sgx); ++ virVIRTCCACapabilitiesFree(caps->virtcca); + g_free(caps->hyperv); + + values = &caps->os.loader.values; +@@ -707,6 +718,29 @@ virDomainCapsFeatureHypervFormat(virBuffer *buf, + FORMAT_EPILOGUE(hyperv); + } + ++/** ++ * virDomainCapsFeatureVIRTCCAFormat: ++ * @buf: target buffer ++ * @virtcca: VIRTCCA features ++ * ++ * Format VIRTCCA features for inclusion in the domcapabilities XML. ++ * ++ * The resulting XML will look like ++ * ++ * ++ */ ++static void ++virDomainCapsFeatureVIRTCCAFormat(virBuffer *buf, ++ const virVIRTCCACapability *virtcca) ++{ ++ if (!virtcca) { ++ virBufferAddLit(buf, "\n"); ++ return; ++ } ++ ++ virBufferAddLit(buf, "\n"); ++} ++ + static void + virDomainCapsFormatFeatures(const virDomainCaps *caps, + virBuffer *buf) +@@ -728,6 +762,7 @@ virDomainCapsFormatFeatures(const virDomainCaps *caps, + virDomainCapsFeatureSEVFormat(&childBuf, caps->sev); + virDomainCapsFeatureSGXFormat(&childBuf, caps->sgx); + virDomainCapsFeatureHypervFormat(&childBuf, caps->hyperv); ++ virDomainCapsFeatureVIRTCCAFormat(&childBuf, caps->virtcca); + + virXMLFormatElement(buf, "features", NULL, &childBuf); + } +diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h +index 01bcfa2e39..718fb75467 100644 +--- a/src/conf/domain_capabilities.h ++++ b/src/conf/domain_capabilities.h +@@ -231,6 +231,11 @@ struct _virSGXCapability { + virSGXSection *sgxSections; + }; + ++typedef struct _virVIRTCCACapability virVIRTCCACapability; ++struct _virVIRTCCACapability { ++ bool enabled; ++}; ++ + STATIC_ASSERT_ENUM(VIR_DOMAIN_CRYPTO_MODEL_LAST); + STATIC_ASSERT_ENUM(VIR_DOMAIN_CRYPTO_TYPE_LAST); + STATIC_ASSERT_ENUM(VIR_DOMAIN_CRYPTO_BACKEND_LAST); +@@ -284,6 +289,7 @@ struct _virDomainCaps { + virSEVCapability *sev; + virSGXCapability *sgx; + virDomainCapsFeatureHyperv *hyperv; ++ virVIRTCCACapability *virtcca; + /* add new domain features here */ + + virTristateBool features[VIR_DOMAIN_CAPS_FEATURE_LAST]; +@@ -339,3 +345,8 @@ void + virSGXCapabilitiesFree(virSGXCapability *capabilities); + + G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSGXCapability, virSGXCapabilitiesFree); ++ ++void ++virVIRTCCACapabilitiesFree(virVIRTCCACapability *capabilities); ++ ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(virVIRTCCACapability, virVIRTCCACapabilitiesFree); +\ No newline at end of file +diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms +index 4d712f0d79..cd99cc302a 100644 +--- a/src/libvirt_private.syms ++++ b/src/libvirt_private.syms +@@ -218,6 +218,7 @@ virDomainCapsFormat; + virDomainCapsNew; + virSEVCapabilitiesFree; + virSGXCapabilitiesFree; ++virVIRTCCACapabilitiesFree; + + + # conf/domain_conf.h +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 86f1491bc5..72c6eed5ef 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -699,6 +699,7 @@ VIR_ENUM_IMPL(virQEMUCaps, + "run-with.async-teardown", /* QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN */ + "virtio-blk-vhost-vdpa", /* QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA */ + "smp-clusters", /* QEMU_CAPS_SMP_CLUSTERS */ ++ "tmm-guest", /* QEMU_CAPS_VIRTCCA */ + ); + + +@@ -784,6 +785,8 @@ struct _virQEMUCaps { + + virSGXCapability *sgxCapabilities; + ++ virVIRTCCACapability *virtccaCapabilities; ++ + virDomainCapsFeatureHyperv *hypervCapabilities; + + /* Capabilities which may differ depending on the accelerator. */ +@@ -1387,6 +1390,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { + { "virtio-crypto-device", QEMU_CAPS_DEVICE_VIRTIO_CRYPTO }, + { "cryptodev-backend-lkcf", QEMU_CAPS_OBJECT_CRYPTO_LKCF }, + { "pvpanic-pci", QEMU_CAPS_DEVICE_PANIC_PCI }, ++ { "tmm-guest", QEMU_CAPS_VIRTCCA }, + }; + + +@@ -1910,6 +1914,25 @@ virQEMUCapsSGXInfoCopy(virSGXCapability **dst, + } + + ++static void ++virQEMUCapsVIRTCCAInfoCopy(virVIRTCCACapability **dst, ++ virVIRTCCACapability *src) ++{ ++ g_autoptr(virVIRTCCACapability) tmp = NULL; ++ ++ if (!src) { ++ *dst = NULL; ++ return; ++ } ++ ++ tmp = g_new0(virVIRTCCACapability, 1); ++ ++ tmp->enabled = src->enabled; ++ ++ *dst = g_steal_pointer(&tmp); ++} ++ ++ + static void + virQEMUCapsAccelCopyMachineTypes(virQEMUCapsAccel *dst, + virQEMUCapsAccel *src) +@@ -1985,6 +2008,9 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGX_EPC)) + virQEMUCapsSGXInfoCopy(&ret->sgxCapabilities, qemuCaps->sgxCapabilities); + ++ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTCCA)) ++ virQEMUCapsVIRTCCAInfoCopy(&ret->virtccaCapabilities, qemuCaps->virtccaCapabilities); ++ + ret->hypervCapabilities = g_memdup(qemuCaps->hypervCapabilities, + sizeof(virDomainCapsFeatureHyperv)); + +@@ -2027,6 +2053,7 @@ void virQEMUCapsDispose(void *obj) + + virSEVCapabilitiesFree(qemuCaps->sevCapabilities); + virSGXCapabilitiesFree(qemuCaps->sgxCapabilities); ++ virVIRTCCACapabilitiesFree(qemuCaps->virtccaCapabilities); + + g_free(qemuCaps->hypervCapabilities); + +@@ -3485,6 +3512,31 @@ virQEMUCapsProbeQMPSGXCapabilities(virQEMUCaps *qemuCaps, + } + + ++static int ++virQEMUCapsProbeQMPVIRTCCACapabilities(virQEMUCaps *qemuCaps, ++ qemuMonitor *mon) ++{ ++ int rc = -1; ++ virVIRTCCACapability *caps = NULL; ++ ++ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTCCA)) ++ return 0; ++ ++ if ((rc = qemuMonitorGetVIRTCCACapabilities(mon, &caps)) < 0) ++ return -1; ++ ++ /* VIRTCCA isn't actually supported */ ++ if (rc == 0) { ++ virQEMUCapsClear(qemuCaps, QEMU_CAPS_VIRTCCA); ++ return 0; ++ } ++ ++ virVIRTCCACapabilitiesFree(qemuCaps->virtccaCapabilities); ++ qemuCaps->virtccaCapabilities = caps; ++ return 0; ++} ++ ++ + /* + * Filter for features which should never be passed to QEMU. Either because + * QEMU never supported them or they were dropped as they never did anything +@@ -4356,6 +4408,28 @@ virQEMUCapsParseSGXInfo(virQEMUCaps *qemuCaps, + } + + ++static int ++virQEMUCapsParseVIRTCCAInfo(virQEMUCaps *qemuCaps, ++ xmlXPathContextPtr ctxt) ++{ ++ g_autoptr(virVIRTCCACapability) virtcca = NULL; ++ ++ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTCCA)) ++ return 0; ++ ++ if (virXPathBoolean("boolean(./virtcca)", ctxt) == 0) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("missing virtcca platform data in QEMU capabilities cache")); ++ return -1; ++ } ++ ++ virtcca = g_new0(virVIRTCCACapability, 1); ++ ++ qemuCaps->virtccaCapabilities = g_steal_pointer(&virtcca); ++ return 0; ++} ++ ++ + static int + virQEMUCapsParseHypervCapabilities(virQEMUCaps *qemuCaps, + xmlXPathContextPtr ctxt) +@@ -4682,6 +4756,9 @@ virQEMUCapsLoadCache(virArch hostArch, + if (virQEMUCapsParseSGXInfo(qemuCaps, ctxt) < 0) + return -1; + ++ if (virQEMUCapsParseVIRTCCAInfo(qemuCaps, ctxt) < 0) ++ return -1; ++ + if (virQEMUCapsParseHypervCapabilities(qemuCaps, ctxt) < 0) + return -1; + +@@ -4910,6 +4987,14 @@ virQEMUCapsFormatSGXInfo(virQEMUCaps *qemuCaps, + } + + ++static void ++virQEMUCapsFormatVIRTCCAInfo(virBuffer *buf) ++{ ++ virBufferAddLit(buf, "\n"); ++ virBufferAddLit(buf, "\n"); ++} ++ ++ + static void + virQEMUCapsFormatHypervCapabilities(virQEMUCaps *qemuCaps, + virBuffer *buf) +@@ -5018,6 +5103,9 @@ virQEMUCapsFormatCache(virQEMUCaps *qemuCaps) + if (qemuCaps->sgxCapabilities) + virQEMUCapsFormatSGXInfo(qemuCaps, &buf); + ++ if (qemuCaps->virtccaCapabilities) ++ virQEMUCapsFormatVIRTCCAInfo(&buf); ++ + if (qemuCaps->hypervCapabilities) + virQEMUCapsFormatHypervCapabilities(qemuCaps, &buf); + +@@ -5572,6 +5660,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCaps *qemuCaps, + return -1; + if (virQEMUCapsProbeQMPSGXCapabilities(qemuCaps, mon) < 0) + return -1; ++ if (virQEMUCapsProbeQMPVIRTCCACapabilities(qemuCaps, mon) < 0) ++ return -1; + + virQEMUCapsInitProcessCaps(qemuCaps); + +@@ -6607,6 +6697,23 @@ virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCaps *qemuCaps, + } + + ++/** ++ * virQEMUCapsFillDomainFeatureVIRTCCACaps: ++ * @qemuCaps: QEMU capabilities ++ * @domCaps: domain capabilities ++ * ++ * Take the information about VIRTCCA capabilities that has been obtained ++ * using the 'query-virtcca-capabilities' QMP command and stored in @qemuCaps ++ * and convert it to a form suitable for @domCaps. ++ */ ++static void ++virQEMUCapsFillDomainFeatureVIRTCCACaps(virQEMUCaps *qemuCaps, ++ virDomainCaps *domCaps) ++{ ++ virQEMUCapsVIRTCCAInfoCopy(&domCaps->virtcca, qemuCaps->virtccaCapabilities); ++} ++ ++ + static void + virQEMUCapsFillDomainFeatureS390PVCaps(virQEMUCaps *qemuCaps, + virDomainCaps *domCaps) +@@ -6706,6 +6813,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, + virQEMUCapsFillDomainFeatureSGXCaps(qemuCaps, domCaps); + virQEMUCapsFillDomainFeatureHypervCaps(qemuCaps, domCaps); + virQEMUCapsFillDomainDeviceCryptoCaps(qemuCaps, crypto); ++ virQEMUCapsFillDomainFeatureVIRTCCACaps(qemuCaps, domCaps); + + return 0; + } +diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h +index a928f5947d..f32109573c 100644 +--- a/src/qemu/qemu_capabilities.h ++++ b/src/qemu/qemu_capabilities.h +@@ -678,6 +678,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ + QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN, /* asynchronous teardown -run-with async-teardown=on|off */ + QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA, /* virtio-blk-vhost-vdpa block driver */ + QEMU_CAPS_SMP_CLUSTERS, /* -smp clusters= */ ++ QEMU_CAPS_VIRTCCA, /* tmm-guest */ + + QEMU_CAPS_LAST /* this must always be the last item */ + } virQEMUCapsFlags; +diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c +index e270bee2cd..3fd26a0433 100644 +--- a/src/qemu/qemu_monitor.c ++++ b/src/qemu/qemu_monitor.c +@@ -3469,6 +3469,16 @@ qemuMonitorGetSGXCapabilities(qemuMonitor *mon, + } + + ++int ++qemuMonitorGetVIRTCCACapabilities(qemuMonitor *mon, ++ virVIRTCCACapability **capabilities) ++{ ++ QEMU_CHECK_MONITOR(mon); ++ ++ return qemuMonitorJSONGetVIRTCCACapabilities(mon, capabilities); ++} ++ ++ + int + qemuMonitorNBDServerStart(qemuMonitor *mon, + const virStorageNetHostDef *server, +diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h +index 4cbd225e8f..6c6e18da50 100644 +--- a/src/qemu/qemu_monitor.h ++++ b/src/qemu/qemu_monitor.h +@@ -849,6 +849,9 @@ int qemuMonitorGetSEVCapabilities(qemuMonitor *mon, + int qemuMonitorGetSGXCapabilities(qemuMonitor *mon, + virSGXCapability **capabilities); + ++int qemuMonitorGetVIRTCCACapabilities(qemuMonitor *mon, ++ virVIRTCCACapability **capabilities); ++ + typedef enum { + QEMU_MONITOR_MIGRATE_RESUME = 1 << 0, /* resume failed post-copy migration */ + QEMU_MONITOR_MIGRATION_FLAGS_LAST +diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c +index 3748034bb9..7f23d034b8 100644 +--- a/src/qemu/qemu_monitor_json.c ++++ b/src/qemu/qemu_monitor_json.c +@@ -6139,6 +6139,51 @@ qemuMonitorJSONGetSGXCapabilities(qemuMonitor *mon, + } + + ++/** ++ * qemuMonitorJSONGetVIRTCCACapabilities: ++ * @mon: qemu monitor object ++ * @capabilities: pointer to pointer to a VIRTCCA capability structure to be filled ++ * ++ * Returns: -1 on error, ++ * 0 if VIRTCCA is not supported, and ++ * 1 if VIRTCCA is supported on the platform. ++ */ ++int ++qemuMonitorJSONGetVIRTCCACapabilities(qemuMonitor *mon, ++ virVIRTCCACapability **capabilities) ++{ ++ g_autoptr(virJSONValue) cmd = NULL; ++ g_autoptr(virJSONValue) reply = NULL; ++ g_autoptr(virVIRTCCACapability) capability = NULL; ++ virJSONValue *caps; ++ ++ *capabilities = NULL; ++ capability = g_new0(virVIRTCCACapability, 1); ++ ++ if (!(cmd = qemuMonitorJSONMakeCommand("query-virtcca-capabilities", NULL))) ++ return -1; ++ ++ if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) ++ return -1; ++ ++ /* QEMU not support VIRTCCA */ ++ if (qemuMonitorJSONCheckError(cmd, reply) < 0) ++ return 0; ++ ++ caps = virJSONValueObjectGetObject(reply, "return"); ++ ++ if (virJSONValueObjectGetBoolean(caps, "enabled", &capability->enabled) < 0) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("query-virtcca-capabilities reply was missing 'enabled' field")); ++ return -1; ++ } ++ ++ *capabilities = g_steal_pointer(&capability); ++ ++ return 1; ++} ++ ++ + static virJSONValue * + qemuMonitorJSONBuildInetSocketAddress(const char *host, + const char *port) +diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h +index ed0027c118..2e0f2e2594 100644 +--- a/src/qemu/qemu_monitor_json.h ++++ b/src/qemu/qemu_monitor_json.h +@@ -168,6 +168,10 @@ int + qemuMonitorJSONGetSEVCapabilities(qemuMonitor *mon, + virSEVCapability **capabilities); + ++int ++qemuMonitorJSONGetVIRTCCACapabilities(qemuMonitor *mon, ++ virVIRTCCACapability **capabilities); ++ + int + qemuMonitorJSONMigrate(qemuMonitor *mon, + unsigned int flags, +-- +2.33.0 + diff --git a/add-virtcca-test-xml.patch b/add-virtcca-test-xml.patch new file mode 100644 index 0000000000000000000000000000000000000000..00a2538eae341ecb0923458877427045fbba12ec --- /dev/null +++ b/add-virtcca-test-xml.patch @@ -0,0 +1,979 @@ +From fb9955954172baa42cf91317272ecdbadd400014 Mon Sep 17 00:00:00 2001 +From: panhengchang +Date: Thu, 5 Jun 2025 17:07:16 +0800 +Subject: [PATCH 2/2] add virtcca test xml + +add "" in +tests/domaincapsdata + +Signed-off-by: panghengchang +--- + src/conf/schemas/domaincaps.rng | 9 +++++++++ + tests/domaincapsdata/bhyve_basic.x86_64.xml | 1 + + tests/domaincapsdata/bhyve_fbuf.x86_64.xml | 1 + + tests/domaincapsdata/bhyve_uefi.x86_64.xml | 1 + + tests/domaincapsdata/empty.xml | 1 + + tests/domaincapsdata/libxl-xenfv.xml | 1 + + tests/domaincapsdata/libxl-xenpv.xml | 1 + + tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.1.0.sparc.xml | 1 + + tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.s390x.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.0.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.0.0.s390x.xml | 1 + + tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml | 1 + + tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.1.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_7.1.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml | 1 + + tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml | 1 + + tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.2.0.ppc.xml | 1 + + tests/domaincapsdata/qemu_7.2.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_8.0.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.1.0.s390x.xml | 1 + + tests/domaincapsdata/qemu_8.1.0.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.2.0.x86_64.xml | 1 + + 79 files changed, 87 insertions(+) + +diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.rng +index e7aa4a1066..5ad452ac5f 100644 +--- a/src/conf/schemas/domaincaps.rng ++++ b/src/conf/schemas/domaincaps.rng +@@ -317,6 +317,9 @@ + + + ++ ++ ++ + + + +@@ -430,6 +433,12 @@ + + + ++ ++ ++ ++ ++ ++ + + + +diff --git a/tests/domaincapsdata/bhyve_basic.x86_64.xml b/tests/domaincapsdata/bhyve_basic.x86_64.xml +index dd054577c0..eff2a8e4a5 100644 +--- a/tests/domaincapsdata/bhyve_basic.x86_64.xml ++++ b/tests/domaincapsdata/bhyve_basic.x86_64.xml +@@ -34,5 +34,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/bhyve_fbuf.x86_64.xml b/tests/domaincapsdata/bhyve_fbuf.x86_64.xml +index 0b1d9c17d7..a7cb29972f 100644 +--- a/tests/domaincapsdata/bhyve_fbuf.x86_64.xml ++++ b/tests/domaincapsdata/bhyve_fbuf.x86_64.xml +@@ -51,5 +51,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/bhyve_uefi.x86_64.xml b/tests/domaincapsdata/bhyve_uefi.x86_64.xml +index 69fff197a7..bbf5805afd 100644 +--- a/tests/domaincapsdata/bhyve_uefi.x86_64.xml ++++ b/tests/domaincapsdata/bhyve_uefi.x86_64.xml +@@ -43,5 +43,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/empty.xml b/tests/domaincapsdata/empty.xml +index 97752ca04a..387a8c3c3d 100644 +--- a/tests/domaincapsdata/empty.xml ++++ b/tests/domaincapsdata/empty.xml +@@ -14,5 +14,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/libxl-xenfv.xml b/tests/domaincapsdata/libxl-xenfv.xml +index c71d759517..013184882b 100644 +--- a/tests/domaincapsdata/libxl-xenfv.xml ++++ b/tests/domaincapsdata/libxl-xenfv.xml +@@ -77,5 +77,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/libxl-xenpv.xml b/tests/domaincapsdata/libxl-xenpv.xml +index 8ae2370b7e..6448259709 100644 +--- a/tests/domaincapsdata/libxl-xenpv.xml ++++ b/tests/domaincapsdata/libxl-xenpv.xml +@@ -67,5 +67,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +index 152f201ff9..2cdfdf2be6 100644 +--- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +@@ -318,5 +318,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml +index cea9377cfe..27686a047f 100644 +--- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml +@@ -264,5 +264,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml +index ab68d3547b..468e26e694 100644 +--- a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml +@@ -196,5 +196,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml +index ab68d3547b..468e26e694 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml +@@ -196,5 +196,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml +index 66a9ba87e9..3c10eee92a 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml +@@ -164,5 +164,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml b/tests/domaincapsdata/qemu_4.2.0.s390x.xml +index c0567ffdde..2566693e49 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml +@@ -270,5 +270,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml +index 8b7cf44d6d..ca942c1790 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml +@@ -318,5 +318,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml +index 1d29a40f74..5e38ee09ec 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml +@@ -320,5 +320,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml +index 1c7d7c97df..83a90709ba 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml +@@ -149,5 +149,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml +index 7b7420ff8e..cd1e975072 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml +@@ -266,5 +266,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml +index d3cd333c07..ee9031fa88 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml +@@ -209,5 +209,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml +index 3272241b8f..4a353a5830 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml +@@ -152,5 +152,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml +index d3cd333c07..ee9031fa88 100644 +--- a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml +@@ -209,5 +209,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +index 5f29f5c4ae..bb5af8be43 100644 +--- a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +@@ -171,5 +171,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml +index f3b3adb19e..c6e7631c78 100644 +--- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml +@@ -320,5 +320,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml +index 2a8a784813..8148aea254 100644 +--- a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml +@@ -253,5 +253,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml +index 272d9bed08..1ce59092f3 100644 +--- a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml +@@ -266,5 +266,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.1.0.sparc.xml b/tests/domaincapsdata/qemu_5.1.0.sparc.xml +index 7baee953ce..3e94d2c2a0 100644 +--- a/tests/domaincapsdata/qemu_5.1.0.sparc.xml ++++ b/tests/domaincapsdata/qemu_5.1.0.sparc.xml +@@ -135,5 +135,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml +index 735cd42466..98d8d97131 100644 +--- a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml +@@ -253,5 +253,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +index 968cfe68e8..1ea56e4614 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +@@ -253,5 +253,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml +index 1c7d7c97df..83a90709ba 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml +@@ -149,5 +149,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +index 526f39254e..d808c675fa 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +@@ -266,5 +266,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml +index f32634548b..52a2def30c 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml +@@ -209,5 +209,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml +index 3272241b8f..4a353a5830 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml +@@ -152,5 +152,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml +index f32634548b..52a2def30c 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml +@@ -209,5 +209,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +index 96fd13e06e..75979d3110 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +@@ -171,5 +171,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.s390x.xml b/tests/domaincapsdata/qemu_5.2.0.s390x.xml +index 2af88d081a..30513a6b9a 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.s390x.xml +@@ -272,5 +272,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +index 9bbb22b0d8..cfe12255cd 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +@@ -253,5 +253,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml +index 66da296d8e..a5073137d1 100644 +--- a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml +@@ -260,5 +260,6 @@ + 450 + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml +index 0ffd95aee6..6ee80e581c 100644 +--- a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml +@@ -274,5 +274,6 @@ + 450 + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml +index 64e62aacf2..f929b95bb1 100644 +--- a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml +@@ -211,5 +211,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml +index 64e62aacf2..f929b95bb1 100644 +--- a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml +@@ -211,5 +211,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0.s390x.xml b/tests/domaincapsdata/qemu_6.0.0.s390x.xml +index c8dd1e88c9..782640e0c9 100644 +--- a/tests/domaincapsdata/qemu_6.0.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_6.0.0.s390x.xml +@@ -273,5 +273,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml +index 0af8b9d064..a790cc39bc 100644 +--- a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml +@@ -260,5 +260,6 @@ + 450 + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml +index cc2081955d..61f1c94e10 100644 +--- a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml +@@ -256,5 +256,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml +index a80c86df4f..9f9a66f59d 100644 +--- a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml +@@ -269,5 +269,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml +index 22f8c8a397..ceaa05bde8 100644 +--- a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml +@@ -256,5 +256,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml +index 782aa792a9..15916b8880 100644 +--- a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml +@@ -256,5 +256,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml +index 7ed62fb522..b93cf90da5 100644 +--- a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml +@@ -271,5 +271,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml +index 64bed8b367..77db9c1371 100644 +--- a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml +@@ -218,5 +218,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml +index 64bed8b367..77db9c1371 100644 +--- a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml +@@ -218,5 +218,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +index 69a6bcc8bc..f97d146dc3 100644 +--- a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +@@ -170,5 +170,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml +index e6283ff153..a60d9e0186 100644 +--- a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml +@@ -256,5 +256,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml b/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml +index 94a79e8743..a086cfa7c1 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml +@@ -172,5 +172,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml +index 50b2ee2ffe..19708706eb 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml +@@ -266,5 +266,6 @@ +
+ + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml +index 3a71b54847..fbeb374c33 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml +@@ -281,5 +281,6 @@ +
+ + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml +index d5830c46a3..18bd214788 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml +@@ -217,5 +217,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0.aarch64.xml b/tests/domaincapsdata/qemu_7.0.0.aarch64.xml +index d5830c46a3..18bd214788 100644 +--- a/tests/domaincapsdata/qemu_7.0.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0.aarch64.xml +@@ -217,5 +217,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0.ppc64.xml b/tests/domaincapsdata/qemu_7.0.0.ppc64.xml +index c865dcf418..7d84541deb 100644 +--- a/tests/domaincapsdata/qemu_7.0.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0.ppc64.xml +@@ -175,5 +175,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0.x86_64.xml b/tests/domaincapsdata/qemu_7.0.0.x86_64.xml +index fa4b912168..b533d60836 100644 +--- a/tests/domaincapsdata/qemu_7.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0.x86_64.xml +@@ -266,5 +266,6 @@ +
+ + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml +index 2eec2e3162..53bb94ec93 100644 +--- a/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml +@@ -256,5 +256,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml +index 1ae2a7c342..7d9ad4d5ac 100644 +--- a/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml +@@ -270,5 +270,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.1.0.ppc64.xml b/tests/domaincapsdata/qemu_7.1.0.ppc64.xml +index aa3a0571b6..797da263c4 100644 +--- a/tests/domaincapsdata/qemu_7.1.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0.ppc64.xml +@@ -168,5 +168,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.1.0.x86_64.xml b/tests/domaincapsdata/qemu_7.1.0.x86_64.xml +index 449e1b51d1..6c8603b385 100644 +--- a/tests/domaincapsdata/qemu_7.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0.x86_64.xml +@@ -256,5 +256,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml b/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml +index dfd319431e..0b39233102 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml +@@ -179,5 +179,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml +index e48a07da28..9803645d19 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml +@@ -262,5 +262,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml +index 69b6be7616..1a687681c9 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml +@@ -260,5 +260,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml +index 69b6be7616..1a687681c9 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml +@@ -260,5 +260,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0.ppc.xml b/tests/domaincapsdata/qemu_7.2.0.ppc.xml +index 7fd4b1ce17..13959c2daa 100644 +--- a/tests/domaincapsdata/qemu_7.2.0.ppc.xml ++++ b/tests/domaincapsdata/qemu_7.2.0.ppc.xml +@@ -154,5 +154,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0.x86_64.xml b/tests/domaincapsdata/qemu_7.2.0.x86_64.xml +index d116cf2e48..5976ca3a96 100644 +--- a/tests/domaincapsdata/qemu_7.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.2.0.x86_64.xml +@@ -262,5 +262,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml +index 2815064abc..b16771e9b6 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml +@@ -281,5 +281,6 @@ + avic + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml b/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml +index 1911e34b07..8293545d74 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml +@@ -155,5 +155,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml +index efb5fcb99d..749bf7ea97 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml +@@ -283,5 +283,6 @@ + avic + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml b/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml +index d331dc45e5..0bdba04bc2 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml +@@ -158,5 +158,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.0.0.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0.x86_64.xml +index 07d1d06115..5dbdf5263f 100644 +--- a/tests/domaincapsdata/qemu_8.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0.x86_64.xml +@@ -281,5 +281,6 @@ + avic + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml +index 4d438efdf7..e8ca73563b 100644 +--- a/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml +@@ -283,5 +283,6 @@ + avic + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml +index e32cd80c17..f2b1422f04 100644 +--- a/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml +@@ -284,5 +284,6 @@ + avic + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.1.0.s390x.xml b/tests/domaincapsdata/qemu_8.1.0.s390x.xml +index 37c7c3b8bf..f84459c981 100644 +--- a/tests/domaincapsdata/qemu_8.1.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_8.1.0.s390x.xml +@@ -280,5 +280,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.1.0.x86_64.xml b/tests/domaincapsdata/qemu_8.1.0.x86_64.xml +index 919357e577..cb5e569825 100644 +--- a/tests/domaincapsdata/qemu_8.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.1.0.x86_64.xml +@@ -283,5 +283,6 @@ + avic + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml +index f711a51044..7c0407c057 100644 +--- a/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml +@@ -285,5 +285,6 @@ + avic + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml +index 784a29acd9..a713f4916a 100644 +--- a/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml +@@ -284,5 +284,6 @@ + avic + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.2.0.x86_64.xml b/tests/domaincapsdata/qemu_8.2.0.x86_64.xml +index bc060e21b6..9107392448 100644 +--- a/tests/domaincapsdata/qemu_8.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.2.0.x86_64.xml +@@ -285,5 +285,6 @@ + avic + + ++ + + +-- +2.33.0 + diff --git a/backport-domcaps-Report-launchSecurity.patch b/backport-domcaps-Report-launchSecurity.patch new file mode 100644 index 0000000000000000000000000000000000000000..d7bd57047bf91727ce28ea52ca8b7fe5b10f4e81 --- /dev/null +++ b/backport-domcaps-Report-launchSecurity.patch @@ -0,0 +1,146 @@ +From 9a61141fe2adec5e7c7fba4167663c201b401d3d Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Thu, 21 Aug 2025 20:44:37 +0800 +Subject: [PATCH 1/5] [backport]domcaps: Report launchSecurity +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +bugzilla:https://gitee.com/openeuler/libvirt/issues/ICU4UF?from=project-issue +reference:https://gitlab.com/libvirt/libvirt/-/commit/d460e17282bec89dee1252db4fb3f2b7aa1b5ee8 + +-------------------------------- + +In order to learn what types of are supported +users can turn to domain capabilities and find and + elements. While these may expose some additional info +on individual launchSecurity types, we are lacking clean +enumeration (like we do for say device models). And given that +SEV and SEV SNP share the same basis (info found under is +applicable to SEV SNP too) we have no other way to report SEV SNP +support. + +Therefore, report supported launchSecurity types in domain +capabilities. + +Signed-off-by: Michal Privoznik +Reviewed-by: Jiri Denemark +Reviewed-by: Daniel P. Berrangé + +[conflicts:src/conf/domain_capabilities.h, src/conf/domain_capabilities.c] +Signed-off-by: Xu Raoqing +--- + docs/formatdomaincaps.rst | 10 ++++++++++ + src/conf/domain_capabilities.c | 14 ++++++++++++++ + src/conf/domain_capabilities.h | 9 +++++++++ + src/conf/schemas/domaincaps.rng | 10 ++++++++++ + 4 files changed, 43 insertions(+) + +diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst +index ef752a0f3a..86353a6d9a 100644 +--- a/docs/formatdomaincaps.rst ++++ b/docs/formatdomaincaps.rst +@@ -796,3 +796,13 @@ are supported. The ``features`` enum corresponds to the ```` element + Please note that depending on the QEMU version some capabilities might be + missing even though QEMU does support them. This is because prior to QEMU-6.1.0 + not all features were reported by QEMU. ++ ++Launch security ++^^^^^^^^^^^^^^^ ++ ++The ``launchSecurity`` element exposes supported aspects of encrypted guests. ++The ``sectype`` enum corresponds to ``type`` attribute of ```` ++element as documented in `Launch Security ++`__. :since:`(Since 10.5.0)` For additional ++information on individual types, see sections above: `s390-pv capability`_ for ++S390 PV, `SEV capabilities`_ for AMD SEV and/or AMD SEV-SNP. +diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c +index 4a83777e9c..edbfc58199 100644 +--- a/src/conf/domain_capabilities.c ++++ b/src/conf/domain_capabilities.c +@@ -741,6 +741,19 @@ virDomainCapsFeatureVIRTCCAFormat(virBuffer *buf, + virBufferAddLit(buf, "\n"); + } + ++ ++static void ++virDomainCapsLaunchSecurityFormat(virBuffer *buf, ++ const virDomainCapsLaunchSecurity *launchSecurity) ++{ ++ FORMAT_PROLOGUE(launchSecurity); ++ ++ ENUM_PROCESS(launchSecurity, sectype, virDomainLaunchSecurityTypeToString); ++ ++ FORMAT_EPILOGUE(launchSecurity); ++} ++ ++ + static void + virDomainCapsFormatFeatures(const virDomainCaps *caps, + virBuffer *buf) +@@ -763,6 +776,7 @@ virDomainCapsFormatFeatures(const virDomainCaps *caps, + virDomainCapsFeatureSGXFormat(&childBuf, caps->sgx); + virDomainCapsFeatureHypervFormat(&childBuf, caps->hyperv); + virDomainCapsFeatureVIRTCCAFormat(&childBuf, caps->virtcca); ++ virDomainCapsLaunchSecurityFormat(&childBuf, &caps->launchSecurity); + + virXMLFormatElement(buf, "features", NULL, &childBuf); + } +diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h +index 718fb75467..ff363d0772 100644 +--- a/src/conf/domain_capabilities.h ++++ b/src/conf/domain_capabilities.h +@@ -165,6 +165,14 @@ struct _virDomainCapsFeatureHyperv { + virDomainCapsEnum features; /* Info about supported virDomainHyperv features */ + }; + ++STATIC_ASSERT_ENUM(VIR_DOMAIN_LAUNCH_SECURITY_LAST); ++typedef struct _virDomainCapsLaunchSecurity virDomainCapsLaunchSecurity; ++struct _virDomainCapsLaunchSecurity { ++ virTristateBool supported; ++ virDomainCapsEnum sectype; /* Info about supported virDomainLaunchSecurity */ ++}; ++ ++ + typedef enum { + VIR_DOMCAPS_CPU_USABLE_UNKNOWN, + VIR_DOMCAPS_CPU_USABLE_YES, +@@ -290,6 +298,7 @@ struct _virDomainCaps { + virSGXCapability *sgx; + virDomainCapsFeatureHyperv *hyperv; + virVIRTCCACapability *virtcca; ++ virDomainCapsLaunchSecurity launchSecurity; + /* add new domain features here */ + + virTristateBool features[VIR_DOMAIN_CAPS_FEATURE_LAST]; +diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.rng +index 5ad452ac5f..317c3d4e96 100644 +--- a/src/conf/schemas/domaincaps.rng ++++ b/src/conf/schemas/domaincaps.rng +@@ -285,6 +285,13 @@ + + + ++ ++ ++ ++ ++ ++ ++ + + + +@@ -320,6 +327,9 @@ + + + ++ ++ ++ + + + +-- +2.33.0 + diff --git a/backport-qemu-Fill-launchSecurity-in-domaincaps.patch b/backport-qemu-Fill-launchSecurity-in-domaincaps.patch new file mode 100644 index 0000000000000000000000000000000000000000..3c7a563acdc9b09962811df9d5cbf7b6ff02159c --- /dev/null +++ b/backport-qemu-Fill-launchSecurity-in-domaincaps.patch @@ -0,0 +1,976 @@ +From 7d6838718ba03f77ba9f39fb798032a907ab2df6 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Sat, 23 Aug 2025 11:44:50 +0800 +Subject: [PATCH 2/5] [backport]qemu: Fill launchSecurity in domaincaps +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +bugzilla:https://gitee.com/openeuler/libvirt/issues/ICU4UF?from=project-issue +reference:https://gitlab.com/libvirt/libvirt/-/commit/66df7992d8efd6462148d2ddf39323dc552eb92a + +-------------------------------- + +The inspiration for these rules comes from +qemuValidateDomainDef(). + +Signed-off-by: Michal Privoznik +Reviewed-by: Jiri Denemark +Reviewed-by: Daniel P. Berrangé + +[conflicts:src/qemu/qemu_capabilities.c,src/qemu/qemu_capabilities.h and modify tests xml] +src/conf/domain_capabilities.c and drop tests modification] + +Signed-off-by: Xu Raoqing +--- + src/qemu/qemu_capabilities.c | 21 +++++++++++++++++++ + src/qemu/qemu_capabilities.h | 3 +++ + .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 + + .../qemu_4.2.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 + + .../qemu_5.0.0-tcg-virt.riscv64.xml | 1 + + .../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 + + .../qemu_5.0.0-virt.aarch64.xml | 1 + + .../qemu_5.0.0-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.1.0.sparc.xml | 1 + + tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 1 + + .../qemu_5.2.0-tcg-virt.riscv64.xml | 1 + + .../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 1 + + .../qemu_5.2.0-virt.aarch64.xml | 1 + + .../qemu_5.2.0-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.s390x.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 5 +++++ + .../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 5 +++++ + .../qemu_6.0.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.0.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.0.0.s390x.xml | 5 +++++ + tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 5 +++++ + .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 1 + + .../qemu_6.2.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 1 + + .../qemu_7.0.0-hvf.aarch64+hvf.xml | 1 + + .../domaincapsdata/qemu_7.0.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml | 1 + + .../qemu_7.0.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_7.1.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_7.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.1.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_7.1.0.x86_64.xml | 1 + + .../qemu_7.2.0-hvf.x86_64+hvf.xml | 1 + + .../domaincapsdata/qemu_7.2.0-q35.x86_64.xml | 1 + + .../qemu_7.2.0-tcg.x86_64+hvf.xml | 1 + + .../domaincapsdata/qemu_7.2.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.2.0.ppc.xml | 1 + + tests/domaincapsdata/qemu_7.2.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_8.0.0-q35.x86_64.xml | 1 + + .../qemu_8.0.0-tcg-virt.riscv64.xml | 1 + + .../domaincapsdata/qemu_8.0.0-tcg.x86_64.xml | 1 + + .../qemu_8.0.0-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_8.0.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_8.1.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_8.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.1.0.s390x.xml | 5 +++++ + tests/domaincapsdata/qemu_8.1.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_8.2.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_8.2.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.2.0.x86_64.xml | 1 + + 74 files changed, 116 insertions(+) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 72c6eed5ef..c3f57cbd49 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -6593,6 +6593,25 @@ virQEMUCapsFillDomainDeviceCryptoCaps(virQEMUCaps *qemuCaps, + } + + ++void ++virQEMUCapsFillDomainLaunchSecurity(virQEMUCaps *qemuCaps, ++ virDomainCapsLaunchSecurity *launchSecurity) ++{ ++ launchSecurity->supported = VIR_TRISTATE_BOOL_YES; ++ launchSecurity->sectype.report = true; ++ ++ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) ++ VIR_DOMAIN_CAPS_ENUM_SET(launchSecurity->sectype, VIR_DOMAIN_LAUNCH_SECURITY_SEV); ++ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST) && ++ virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT)) ++ VIR_DOMAIN_CAPS_ENUM_SET(launchSecurity->sectype, VIR_DOMAIN_LAUNCH_SECURITY_PV); ++ ++ if (launchSecurity->sectype.values == 0) { ++ launchSecurity->supported = VIR_TRISTATE_BOOL_NO; ++ } ++} ++ ++ + /** + * virQEMUCapsSupportsGICVersion: + * @qemuCaps: QEMU capabilities +@@ -6774,6 +6793,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, + virDomainCapsDeviceChannel *channel = &domCaps->channel; + virDomainCapsMemoryBacking *memoryBacking = &domCaps->memoryBacking; + virDomainCapsDeviceCrypto *crypto = &domCaps->crypto; ++ virDomainCapsLaunchSecurity *launchSecurity = &domCaps->launchSecurity; + + virQEMUCapsFillDomainFeaturesFromQEMUCaps(qemuCaps, domCaps); + +@@ -6814,6 +6834,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, + virQEMUCapsFillDomainFeatureHypervCaps(qemuCaps, domCaps); + virQEMUCapsFillDomainDeviceCryptoCaps(qemuCaps, crypto); + virQEMUCapsFillDomainFeatureVIRTCCACaps(qemuCaps, domCaps); ++ virQEMUCapsFillDomainLaunchSecurity(qemuCaps, launchSecurity); + + return 0; + } +diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h +index f32109573c..32756ee696 100644 +--- a/src/qemu/qemu_capabilities.h ++++ b/src/qemu/qemu_capabilities.h +@@ -856,6 +856,9 @@ void virQEMUCapsFillDomainDeviceChannelCaps(virQEMUCaps *qemuCaps, + void virQEMUCapsFillDomainDeviceCryptoCaps(virQEMUCaps *qemuCaps, + virDomainCapsDeviceCrypto *crypto); + ++void virQEMUCapsFillDomainLaunchSecurity(virQEMUCaps *qemuCaps, ++ virDomainCapsLaunchSecurity *launchSecurity); ++ + bool virQEMUCapsGuestIsNative(virArch host, + virArch guest); + +diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +index 2cdfdf2be6..8c4787375e 100644 +--- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +@@ -319,5 +319,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml +index 27686a047f..b825a24456 100644 +--- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml +@@ -265,5 +265,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml +index 468e26e694..bd290073ee 100644 +--- a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml +@@ -197,5 +197,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml +index 468e26e694..bd290073ee 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml +@@ -197,5 +197,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml +index 3c10eee92a..f29ca3fb42 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml +@@ -165,5 +165,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml b/tests/domaincapsdata/qemu_4.2.0.s390x.xml +index 2566693e49..92e7124d52 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml +@@ -271,5 +271,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml +index ca942c1790..5fc8c2aabd 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml +@@ -319,5 +319,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml +index 5e38ee09ec..e7ca3c32fb 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml +@@ -321,5 +321,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml +index 83a90709ba..99ec7de885 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml +@@ -150,5 +150,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml +index cd1e975072..a4b5b75165 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml +@@ -267,5 +267,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml +index ee9031fa88..bd3cde285f 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml +@@ -210,5 +210,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml +index 4a353a5830..b4874246d8 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml +@@ -153,5 +153,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml +index ee9031fa88..bd3cde285f 100644 +--- a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml +@@ -210,5 +210,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +index bb5af8be43..210fc373b3 100644 +--- a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +@@ -172,5 +172,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml +index c6e7631c78..316551390c 100644 +--- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml +@@ -321,5 +321,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml +index 8148aea254..d285d41c6f 100644 +--- a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml +@@ -254,5 +254,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml +index 1ce59092f3..1503574db1 100644 +--- a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml +@@ -267,5 +267,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.1.0.sparc.xml b/tests/domaincapsdata/qemu_5.1.0.sparc.xml +index 3e94d2c2a0..8b73bb1265 100644 +--- a/tests/domaincapsdata/qemu_5.1.0.sparc.xml ++++ b/tests/domaincapsdata/qemu_5.1.0.sparc.xml +@@ -136,5 +136,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml +index 98d8d97131..83f5d2c6d0 100644 +--- a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml +@@ -254,5 +254,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +index 1ea56e4614..ce65b7734b 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +@@ -254,5 +254,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml +index 83a90709ba..99ec7de885 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml +@@ -150,5 +150,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +index d808c675fa..1dc4aa5874 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +@@ -267,5 +267,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml +index 52a2def30c..7cfb6393f1 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml +@@ -210,5 +210,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml +index 4a353a5830..b4874246d8 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml +@@ -153,5 +153,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml +index 52a2def30c..7cfb6393f1 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml +@@ -210,5 +210,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +index 75979d3110..2d95357d35 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +@@ -172,5 +172,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.s390x.xml b/tests/domaincapsdata/qemu_5.2.0.s390x.xml +index 30513a6b9a..da56ee08f9 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.s390x.xml +@@ -273,5 +273,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +index cfe12255cd..743a308079 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +@@ -254,5 +254,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml +index a5073137d1..04a6a9e65b 100644 +--- a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml +@@ -261,5 +261,10 @@ + + + ++ ++ ++ sev ++ ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml +index 6ee80e581c..d4572a79ff 100644 +--- a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml +@@ -275,5 +275,10 @@ + + + ++ ++ ++ sev ++ ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml +index f929b95bb1..20ca13bdd2 100644 +--- a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml +@@ -212,5 +212,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml +index f929b95bb1..20ca13bdd2 100644 +--- a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml +@@ -212,5 +212,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0.s390x.xml b/tests/domaincapsdata/qemu_6.0.0.s390x.xml +index 782640e0c9..25ca3909ab 100644 +--- a/tests/domaincapsdata/qemu_6.0.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_6.0.0.s390x.xml +@@ -274,5 +274,10 @@ + + + ++ ++ ++ s390-pv ++ ++ + + +diff --git a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml +index a790cc39bc..6ccc13cf33 100644 +--- a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml +@@ -261,5 +261,10 @@ + + + ++ ++ ++ sev ++ ++ + + +diff --git a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml +index 61f1c94e10..b9a541e4b0 100644 +--- a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml +@@ -257,5 +257,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml +index 9f9a66f59d..de9a53f026 100644 +--- a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml +@@ -270,5 +270,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml +index ceaa05bde8..2d013e4a04 100644 +--- a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml +@@ -257,5 +257,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml +index 15916b8880..05dbabfaa6 100644 +--- a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml +@@ -257,5 +257,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml +index b93cf90da5..22849abbe9 100644 +--- a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml +@@ -272,5 +272,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml +index 77db9c1371..6ab93b3a8e 100644 +--- a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml +@@ -219,5 +219,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml +index 77db9c1371..6ab93b3a8e 100644 +--- a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml +@@ -219,5 +219,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +index f97d146dc3..6799c988bb 100644 +--- a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +@@ -171,5 +171,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml +index a60d9e0186..4b431ae978 100644 +--- a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml +@@ -257,5 +257,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml b/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml +index a086cfa7c1..a69e97190b 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml +@@ -173,5 +173,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml +index 19708706eb..8a320eeebc 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml +@@ -267,5 +267,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml +index fbeb374c33..21a8e69ef3 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml +@@ -282,5 +282,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml +index 18bd214788..9a9db9192e 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml +@@ -218,5 +218,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0.aarch64.xml b/tests/domaincapsdata/qemu_7.0.0.aarch64.xml +index 18bd214788..9a9db9192e 100644 +--- a/tests/domaincapsdata/qemu_7.0.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0.aarch64.xml +@@ -218,5 +218,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0.ppc64.xml b/tests/domaincapsdata/qemu_7.0.0.ppc64.xml +index 7d84541deb..857dc47344 100644 +--- a/tests/domaincapsdata/qemu_7.0.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0.ppc64.xml +@@ -176,5 +176,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.0.0.x86_64.xml b/tests/domaincapsdata/qemu_7.0.0.x86_64.xml +index b533d60836..288f3aff03 100644 +--- a/tests/domaincapsdata/qemu_7.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0.x86_64.xml +@@ -267,5 +267,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml +index 53bb94ec93..66c685f7e5 100644 +--- a/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml +@@ -257,5 +257,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml +index 7d9ad4d5ac..b2fb423dd0 100644 +--- a/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml +@@ -271,5 +271,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.1.0.ppc64.xml b/tests/domaincapsdata/qemu_7.1.0.ppc64.xml +index 797da263c4..3b0b0b959d 100644 +--- a/tests/domaincapsdata/qemu_7.1.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0.ppc64.xml +@@ -169,5 +169,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.1.0.x86_64.xml b/tests/domaincapsdata/qemu_7.1.0.x86_64.xml +index 6c8603b385..e7432371dd 100644 +--- a/tests/domaincapsdata/qemu_7.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0.x86_64.xml +@@ -257,5 +257,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml b/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml +index 0b39233102..bd7bc17cb8 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml +@@ -180,5 +180,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml +index 9803645d19..a1601974b9 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml +@@ -263,5 +263,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml +index 1a687681c9..94c74962da 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml +@@ -261,5 +261,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml +index 1a687681c9..94c74962da 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml +@@ -261,5 +261,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0.ppc.xml b/tests/domaincapsdata/qemu_7.2.0.ppc.xml +index 13959c2daa..6d6b4f3ad8 100644 +--- a/tests/domaincapsdata/qemu_7.2.0.ppc.xml ++++ b/tests/domaincapsdata/qemu_7.2.0.ppc.xml +@@ -155,5 +155,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_7.2.0.x86_64.xml b/tests/domaincapsdata/qemu_7.2.0.x86_64.xml +index 5976ca3a96..1a24731d8c 100644 +--- a/tests/domaincapsdata/qemu_7.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.2.0.x86_64.xml +@@ -263,5 +263,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml +index b16771e9b6..9c0e57efb4 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml +@@ -282,5 +282,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml b/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml +index 8293545d74..7608db45b7 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml +@@ -156,5 +156,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml +index 749bf7ea97..386b49beb7 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml +@@ -284,5 +284,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml b/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml +index 0bdba04bc2..a5cf95dc9d 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml +@@ -159,5 +159,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.0.0.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0.x86_64.xml +index 5dbdf5263f..5a68b9235f 100644 +--- a/tests/domaincapsdata/qemu_8.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0.x86_64.xml +@@ -282,5 +282,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml +index e8ca73563b..3d79376162 100644 +--- a/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml +@@ -284,5 +284,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml +index f2b1422f04..b69f776874 100644 +--- a/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml +@@ -285,5 +285,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.1.0.s390x.xml b/tests/domaincapsdata/qemu_8.1.0.s390x.xml +index f84459c981..660897f552 100644 +--- a/tests/domaincapsdata/qemu_8.1.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_8.1.0.s390x.xml +@@ -281,5 +281,10 @@ + + + ++ ++ ++ s390-pv ++ ++ + + +diff --git a/tests/domaincapsdata/qemu_8.1.0.x86_64.xml b/tests/domaincapsdata/qemu_8.1.0.x86_64.xml +index cb5e569825..d68b670b92 100644 +--- a/tests/domaincapsdata/qemu_8.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.1.0.x86_64.xml +@@ -284,5 +284,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml +index 7c0407c057..f9ed4492b8 100644 +--- a/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml +@@ -286,5 +286,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml +index a713f4916a..b7867cec90 100644 +--- a/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml +@@ -285,5 +285,6 @@ + + + ++ + + +diff --git a/tests/domaincapsdata/qemu_8.2.0.x86_64.xml b/tests/domaincapsdata/qemu_8.2.0.x86_64.xml +index 9107392448..d8929616dc 100644 +--- a/tests/domaincapsdata/qemu_8.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.2.0.x86_64.xml +@@ -286,5 +286,6 @@ + + + ++ + + +-- +2.33.0 + diff --git a/conf-add-support-for-cachetune-L3-priority.patch b/conf-add-support-for-cachetune-L3-priority.patch new file mode 100644 index 0000000000000000000000000000000000000000..6c094db970e20cddc61116344ce2b8133d08dc92 --- /dev/null +++ b/conf-add-support-for-cachetune-L3-priority.patch @@ -0,0 +1,125 @@ +From f6081b2631ac124b73be5953a9b9ce4922bf505e Mon Sep 17 00:00:00 2001 +From: lutong +Date: Mon, 28 Jul 2025 14:59:13 +0800 +Subject: [PATCH 3/6] conf: add support for cachetune/L3 priority + +--- + src/conf/domain_conf.c | 29 +++++++++++++++++++++-------- + src/conf/schemas/domaincommon.rng | 1 + + src/util/virresctrl.c | 27 +++++++++++++++++++++++++-- + 3 files changed, 47 insertions(+), 10 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 9643b9ce01..5dbbe5cd3c 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -17680,10 +17680,15 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt, + VIR_XML_PROP_REQUIRED, &type) < 0) + return -1; + +- if (virParseScaledValue("./@size", "./@unit", +- ctxt, &size, 1024, +- ULLONG_MAX, true) < 0) ++ if (type == VIR_CACHE_TYPE_PRIORITY) { ++ if (virXMLPropULongLong(node, "size", 10, VIR_XML_PROP_REQUIRED, &size) < 0) ++ return -1; ++ } else { ++ if (virParseScaledValue("./@size", "./@unit", ++ ctxt, &size, 1024, ++ ULLONG_MAX, true) < 0) + return -1; ++ } + + if (virResctrlAllocSetCacheSize(alloc, level, type, cache, size) < 0) + return -1; +@@ -26749,11 +26754,19 @@ virDomainCachetuneDefFormatHelper(unsigned int level, + virBuffer *buf = opaque; + unsigned long long short_size = virFormatIntPretty(size, &unit); + +- virBufferAsprintf(buf, +- "\n", +- cache, level, virCacheTypeToString(type), +- short_size, unit); ++ if (type == VIR_CACHE_TYPE_PRIORITY) { ++ virBufferAsprintf(buf, ++ "\n", ++ cache, level, virCacheTypeToString(type), ++ size); ++ } else { ++ virBufferAsprintf(buf, ++ "\n", ++ cache, level, virCacheTypeToString(type), ++ short_size, unit); ++ } + + return 0; + } +diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng +index f31603b2fd..7278b699e0 100644 +--- a/src/conf/schemas/domaincommon.rng ++++ b/src/conf/schemas/domaincommon.rng +@@ -1147,6 +1147,7 @@ + both + code + data ++ priority + + + +diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c +index 3d2be7560c..7bdbc85bc9 100644 +--- a/src/util/virresctrl.c ++++ b/src/util/virresctrl.c +@@ -1184,6 +1184,15 @@ virResctrlAllocCheckCollision(virResctrlAlloc *alloc, + if (!a_level) + return false; + ++ if (type == VIR_CACHE_TYPE_PRIORITY) { ++ a_type = a_level->types[VIR_CACHE_TYPE_PRIORITY]; ++ ++ if (a_type && a_type->nsizes > cache && a_type->sizes[cache]) ++ return true; ++ ++ return false; ++ } ++ + a_type = a_level->types[VIR_CACHE_TYPE_BOTH]; + + /* If there is an allocation for type 'both', there can be no other +@@ -2330,14 +2339,28 @@ virResctrlAllocAssign(virResctrlInfo *resctrl, + if (!a_type->sizes[cache]) + continue; + +- if (!a_type->priorities[cache]) { ++ if (a_type->npriorities == 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Cache level %1$d does not support tuning for scope type '%2$s'"), + level, virCacheTypeToString(type)); + return -1; + } + +- *a_type->priorities[cache] = *a_type->sizes[cache]; ++ if (a_type->npriorities <= cache || !a_type->priorities[cache]) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("Cache id %1$d does not exist for level %2$d"), ++ cache, level); ++ return -1; ++ } ++ ++ if (*(a_type->sizes[cache]) > 3) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("Cache level %1$d id %2$d priority value just support 0-3"), ++ level, cache); ++ return -1; ++ } ++ ++ *(a_type->priorities[cache]) = *(a_type->sizes[cache]); + } + continue; + } +-- +2.33.0 + diff --git a/conf-add-support-for-memorytune-XML-processing-for-M.patch b/conf-add-support-for-memorytune-XML-processing-for-M.patch new file mode 100644 index 0000000000000000000000000000000000000000..7e555347c7d127268bff2b15e6178d0772d10de5 --- /dev/null +++ b/conf-add-support-for-memorytune-XML-processing-for-M.patch @@ -0,0 +1,195 @@ +From f2d73e1d3b02894f40dbb9513f6ed923d2132e88 Mon Sep 17 00:00:00 2001 +From: lutong +Date: Mon, 4 Aug 2025 10:19:41 +0800 +Subject: [PATCH 5/6] conf: add support for memorytune XML processing for MB + hardlimit + +--- + src/conf/domain_conf.c | 23 ++++++++++++++--- + src/conf/schemas/domaincommon.rng | 5 ++++ + src/util/virresctrl.c | 43 ++++++++++++++++++++++++------- + src/util/virresctrl.h | 3 ++- + 4 files changed, 59 insertions(+), 15 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 12e02e4893..6c25d62998 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -18237,6 +18237,7 @@ virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt, + VIR_XPATH_NODE_AUTORESTORE(ctxt) + unsigned int id; + unsigned int bandwidth; ++ unsigned int hard_limit = UINT_MAX; + + ctxt->node = node; + +@@ -18250,6 +18251,13 @@ virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt, + if (virResctrlAllocSetMemoryBandwidth(alloc, VIR_MEMORY_TYPE_BANDWIDTH, id, bandwidth) < 0) + return -1; + ++ if (virXMLPropUIntDefault(node, "hardlimit", 10, 0, &hard_limit, UINT_MAX) < 0) ++ return -1; ++ ++ if (hard_limit != UINT_MAX && ++ virResctrlAllocSetMemoryBandwidth(alloc, VIR_MEMORY_TYPE_HARDLIMIT, id, hard_limit) < 0) ++ return -1; ++ + return 0; + } + +@@ -26846,14 +26854,21 @@ virDomainCachetuneDefFormat(virBuffer *buf, + + static int + virDomainMemorytuneDefFormatHelper(unsigned int id, +- unsigned int bandwidth, ++ unsigned int *types, ++ unsigned int *values, + void *opaque) + { + virBuffer *buf = opaque; ++ size_t i; + +- virBufferAsprintf(buf, +- "\n", +- id, bandwidth); ++ virBufferAsprintf(buf, "\n"); + return 0; + } + +diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng +index 7278b699e0..504147a0b5 100644 +--- a/src/conf/schemas/domaincommon.rng ++++ b/src/conf/schemas/domaincommon.rng +@@ -1185,6 +1185,11 @@ + + + ++ ++ ++ ++ ++ + + + +diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c +index 77abf03a3c..e262deae73 100644 +--- a/src/util/virresctrl.c ++++ b/src/util/virresctrl.c +@@ -1383,10 +1383,11 @@ virResctrlAllocForeachCache(virResctrlAlloc *alloc, + + /* virResctrlAllocSetMemoryBandwidth + * @alloc: Pointer to an active allocation ++ * @type: type of memory bandwidth to be set + * @id: node id of MBA to be set +- * @memory_bandwidth: new memory bandwidth value ++ * @value: new memory bandwidth type value + * +- * Set the @memory_bandwidth for the node @id entry in the @alloc. ++ * Set the @value for the node @id entry in the @alloc. + * + * Returns 0 on success, -1 on failure with error message set. + */ +@@ -1394,13 +1395,13 @@ int + virResctrlAllocSetMemoryBandwidth(virResctrlAlloc *alloc, + virMemoryType type, + unsigned int id, +- unsigned int memory_bandwidth) ++ unsigned int value) + { + virResctrlAllocMemBW *mem_bw = alloc->mem_bw; + virResctrlAllocMemPerType *a_type = NULL; + + if (type == VIR_MEMORY_TYPE_HARDLIMIT) { +- if (memory_bandwidth > 1) { ++ if (value > 1) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Memory Bandwidth hard limit value just support 0 or 1.")); + return -1; +@@ -1408,7 +1409,7 @@ virResctrlAllocSetMemoryBandwidth(virResctrlAlloc *alloc, + } + + if (type == VIR_MEMORY_TYPE_BANDWIDTH) { +- if (memory_bandwidth > 100) { ++ if (value > 100) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Memory Bandwidth value exceeding 100 is invalid.")); + return -1; +@@ -1437,7 +1438,7 @@ virResctrlAllocSetMemoryBandwidth(virResctrlAlloc *alloc, + } + + a_type->user_values[id] = g_new0(unsigned int, 1); +- *(a_type->user_values[id]) = memory_bandwidth; ++ *(a_type->user_values[id]) = value; + + return 0; + } +@@ -1458,18 +1459,40 @@ virResctrlAllocForeachMemory(virResctrlAlloc *alloc, + virResctrlAllocForeachMemoryCallback cb, + void *opaque) + { +- size_t i = 0; ++ unsigned int i, type; + virResctrlAllocMemBW *mem_bw; ++ g_autofree unsigned int *types = NULL; ++ g_autofree unsigned int *values = NULL; + + if (!alloc || !alloc->mem_bw) + return 0; + + mem_bw = alloc->mem_bw; ++ ++ if (!mem_bw->types) ++ return 0; ++ ++ if (!mem_bw->types[VIR_MEMORY_TYPE_BANDWIDTH]) ++ return 0; ++ ++ types = g_new0(unsigned int, VIR_MEMORY_TYPE_LAST); ++ values = g_new0(unsigned int, VIR_MEMORY_TYPE_LAST); ++ + for (i = 0; i < mem_bw->types[VIR_MEMORY_TYPE_BANDWIDTH]->nuser_values; i++) { +- if (mem_bw->types[VIR_MEMORY_TYPE_BANDWIDTH]->user_values[i]) { +- if (cb(i, *mem_bw->types[VIR_MEMORY_TYPE_BANDWIDTH]->user_values[i], opaque) < 0) +- return -1; ++ if (!mem_bw->types[VIR_MEMORY_TYPE_BANDWIDTH]->user_values[i]) ++ continue; ++ ++ for (type = 0; type < VIR_MEMORY_TYPE_LAST; type++) { ++ virResctrlAllocMemPerType *a_type = mem_bw->types[type]; ++ if (!a_type || a_type->nuser_values <= i || !a_type->user_values[i]) { ++ types[type] = VIR_MEMORY_TYPE_LAST; ++ continue; ++ } ++ ++ types[type] = type; ++ values[type] = *(a_type->user_values[i]); + } ++ cb(i, types, values, opaque); + } + + return 0; +diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h +index 9ee76eb225..9b317187f5 100644 +--- a/src/util/virresctrl.h ++++ b/src/util/virresctrl.h +@@ -129,7 +129,8 @@ typedef int virResctrlAllocForeachCacheCallback(unsigned int level, + void *opaque); + + typedef int virResctrlAllocForeachMemoryCallback(unsigned int id, +- unsigned int size, ++ unsigned int *types, ++ unsigned int *values, + void *opaque); + + virResctrlAlloc * +-- +2.33.0 + diff --git a/conf-add-support-for-memorytune-XML-processing-for-M2.patch b/conf-add-support-for-memorytune-XML-processing-for-M2.patch new file mode 100644 index 0000000000000000000000000000000000000000..f5769e1c3d12167bbbcdf76f2296de79be4086ab --- /dev/null +++ b/conf-add-support-for-memorytune-XML-processing-for-M2.patch @@ -0,0 +1,109 @@ +From 3d24834d3cccccfe8e482ae3c86c10fa990d560f Mon Sep 17 00:00:00 2001 +From: lutong +Date: Tue, 12 Aug 2025 15:26:52 +0800 +Subject: [PATCH 6/6] conf: add support for memorytune XML processing for MB + priority + +--- + src/conf/domain_conf.c | 8 +++++++ + src/conf/schemas/domaincommon.rng | 5 ++++ + src/util/virresctrl.c | 40 +++++++++++++++++++++---------- + 3 files changed, 40 insertions(+), 13 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 6c25d62998..28b2157424 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -18238,6 +18238,7 @@ virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt, + unsigned int id; + unsigned int bandwidth; + unsigned int hard_limit = UINT_MAX; ++ unsigned int priority = UINT_MAX; + + ctxt->node = node; + +@@ -18258,6 +18259,13 @@ virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt, + virResctrlAllocSetMemoryBandwidth(alloc, VIR_MEMORY_TYPE_HARDLIMIT, id, hard_limit) < 0) + return -1; + ++ if (virXMLPropUIntDefault(node, "priority", 10, 0, &priority, UINT_MAX) < 0) ++ return -1; ++ ++ if (priority != UINT_MAX && ++ virResctrlAllocSetMemoryBandwidth(alloc, VIR_MEMORY_TYPE_PRIORITY, id, priority) < 0) ++ return -1; ++ + return 0; + } + +diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng +index 504147a0b5..1b2256fddf 100644 +--- a/src/conf/schemas/domaincommon.rng ++++ b/src/conf/schemas/domaincommon.rng +@@ -1190,6 +1190,11 @@ + + + ++ ++ ++ ++ ++ + + + +diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c +index e262deae73..06935cc11f 100644 +--- a/src/util/virresctrl.c ++++ b/src/util/virresctrl.c +@@ -1400,20 +1400,34 @@ virResctrlAllocSetMemoryBandwidth(virResctrlAlloc *alloc, + virResctrlAllocMemBW *mem_bw = alloc->mem_bw; + virResctrlAllocMemPerType *a_type = NULL; + +- if (type == VIR_MEMORY_TYPE_HARDLIMIT) { +- if (value > 1) { +- virReportError(VIR_ERR_XML_ERROR, "%s", +- _("Memory Bandwidth hard limit value just support 0 or 1.")); +- return -1; +- } +- } +- +- if (type == VIR_MEMORY_TYPE_BANDWIDTH) { +- if (value > 100) { +- virReportError(VIR_ERR_XML_ERROR, "%s", +- _("Memory Bandwidth value exceeding 100 is invalid.")); ++ switch (type) { ++ case VIR_MEMORY_TYPE_BANDWIDTH: ++ if (value > 100) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Memory Bandwidth value exceeding 100 is invalid.")); ++ return -1; ++ } ++ break; ++ case VIR_MEMORY_TYPE_HARDLIMIT: ++ if (value > 1) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Memory Bandwidth hard limit value just support 0 or 1.")); ++ return -1; ++ } ++ break; ++ case VIR_MEMORY_TYPE_PRIORITY: ++ if (value > 7) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Memory Bandwidth priority value just support 0-7.")); ++ return -1; ++ } ++ break; ++ case VIR_MEMORY_TYPE_MIN_BANDWIDTH: ++ case VIR_MEMORY_TYPE_LAST: ++ default: ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("Invalid memory bandwidth type.")); + return -1; +- } + } + + if (!mem_bw) { +-- +2.33.0 + diff --git a/conf-add-support-for-memorytune-XML-processing-for-M3.patch b/conf-add-support-for-memorytune-XML-processing-for-M3.patch new file mode 100644 index 0000000000000000000000000000000000000000..d13a3e3433a4a89fb6eabf085bd505689c7a03de --- /dev/null +++ b/conf-add-support-for-memorytune-XML-processing-for-M3.patch @@ -0,0 +1,99 @@ +From 2b6d170cc9b511657cd0aefc8515bdc4b7467a94 Mon Sep 17 00:00:00 2001 +From: hy <941973499@qq.com> +Date: Mon, 18 Aug 2025 11:02:40 +0800 +Subject: [PATCH] conf: add support for memorytune XML processing for MB + min_bandwidth + +--- + src/conf/domain_conf.c | 12 ++++++++++-- + src/conf/schemas/domaincommon.rng | 5 +++++ + src/util/virresctrl.c | 8 +++++++- + 3 files changed, 22 insertions(+), 3 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 28b2157424..04f2642109 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -18239,6 +18239,7 @@ virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt, + unsigned int bandwidth; + unsigned int hard_limit = UINT_MAX; + unsigned int priority = UINT_MAX; ++ unsigned int min_bandwidth = UINT_MAX; + + ctxt->node = node; + +@@ -18252,20 +18253,27 @@ virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt, + if (virResctrlAllocSetMemoryBandwidth(alloc, VIR_MEMORY_TYPE_BANDWIDTH, id, bandwidth) < 0) + return -1; + +- if (virXMLPropUIntDefault(node, "hardlimit", 10, 0, &hard_limit, UINT_MAX) < 0) ++ if (virXMLPropUIntDefault(node, "hardlimit", 10, VIR_XML_PROP_NONE, &hard_limit, UINT_MAX) < 0) + return -1; + + if (hard_limit != UINT_MAX && + virResctrlAllocSetMemoryBandwidth(alloc, VIR_MEMORY_TYPE_HARDLIMIT, id, hard_limit) < 0) + return -1; + +- if (virXMLPropUIntDefault(node, "priority", 10, 0, &priority, UINT_MAX) < 0) ++ if (virXMLPropUIntDefault(node, "priority", 10, VIR_XML_PROP_NONE, &priority, UINT_MAX) < 0) + return -1; + + if (priority != UINT_MAX && + virResctrlAllocSetMemoryBandwidth(alloc, VIR_MEMORY_TYPE_PRIORITY, id, priority) < 0) + return -1; + ++ if (virXMLPropUIntDefault(node, "min_bandwidth", 10, VIR_XML_PROP_NONE, &min_bandwidth, UINT_MAX) < 0) ++ return -1; ++ ++ if (min_bandwidth != UINT_MAX && ++ virResctrlAllocSetMemoryBandwidth(alloc, VIR_MEMORY_TYPE_MIN_BANDWIDTH, id, min_bandwidth) < 0) ++ return -1; ++ + return 0; + } + +diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng +index 1b2256fddf..a2e0119888 100644 +--- a/src/conf/schemas/domaincommon.rng ++++ b/src/conf/schemas/domaincommon.rng +@@ -1195,6 +1195,11 @@ + + + ++ ++ ++ ++ ++ + + + +diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c +index 06935cc11f..afd70c821a 100644 +--- a/src/util/virresctrl.c ++++ b/src/util/virresctrl.c +@@ -87,7 +87,7 @@ VIR_ENUM_IMPL(virMemory, + "bandwidth", + "hardlimit", + "priority", +- "minbandwidth", ++ "min_bandwidth", + ); + + VIR_ENUM_DECL(virResctrlMemory); +@@ -1423,6 +1423,12 @@ virResctrlAllocSetMemoryBandwidth(virResctrlAlloc *alloc, + } + break; + case VIR_MEMORY_TYPE_MIN_BANDWIDTH: ++ if (value > 100) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Memory Bandwidth min_bandwidth value exceeding 100 is invalid.")); ++ return -1; ++ } ++ break; + case VIR_MEMORY_TYPE_LAST: + default: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", +-- +2.33.0 + diff --git a/hostdev-add-numa-configure-for-host-pci-device.patch b/hostdev-add-numa-configure-for-host-pci-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..1420d2e4e70b35d0c8619c774ceea3edaec0e2e9 --- /dev/null +++ b/hostdev-add-numa-configure-for-host-pci-device.patch @@ -0,0 +1,142 @@ +From 38668d6706abd0b5d4afb740bad031a44e6f73c2 Mon Sep 17 00:00:00 2001 +From: ShenYage +Date: Mon, 25 Aug 2025 15:41:20 +0800 +Subject: [PATCH] hostdev: add numa configure for host pci device + +Signed-off-by: ShenYage +--- + src/conf/device_conf.h | 5 ++++ + src/conf/domain_conf.c | 60 ++++++++++++++++++++++++++++++++++++++++++ + src/conf/domain_conf.h | 1 + + 3 files changed, 66 insertions(+) + +diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h +index a83377417a..dff40134ee 100644 +--- a/src/conf/device_conf.h ++++ b/src/conf/device_conf.h +@@ -169,6 +169,11 @@ struct _virDomainDeviceInfo { + bool isolationGroupLocked; + }; + ++typedef struct _virDomainDeviceNuma virDomainDeviceNuma; ++struct _virDomainDeviceNuma { ++ int node; ++}; ++ + void virDomainDeviceInfoClear(virDomainDeviceInfo *info); + void virDomainDeviceInfoFree(virDomainDeviceInfo *info); + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 28b2157424..2c9c3e4152 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -3413,6 +3413,8 @@ virDomainHostdevDefNew(void) + + def->info = g_new0(virDomainDeviceInfo, 1); + ++ def->numa.node = -1; ++ + return def; + } + +@@ -6207,6 +6209,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, + { + xmlNodePtr sourcenode; + xmlNodePtr driver_node = NULL; ++ xmlNodePtr numa_node = NULL; + virDomainHostdevSubsysPCI *pcisrc = &def->source.subsys.u.pci; + virDomainHostdevSubsysSCSI *scsisrc = &def->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHost *scsihostsrc = &def->source.subsys.u.scsi_host; +@@ -6329,6 +6332,13 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, + &pcisrc->backend) < 0) + return -1; + ++ if ((numa_node = virXPathNode("./numa", ctxt))) { ++ if (virXMLPropInt(numa_node, "node", 10, VIR_XML_PROP_NONE, ++ &def->numa.node, 0) < 0) { ++ return -1; ++ } ++ } ++ + break; + + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: +@@ -16905,6 +16915,53 @@ virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDef *def) + return 0; + } + ++static int ++virDomainDefMaybeAddHostdevPxbcontroller(virDomainDef *def, ++ virDomainHostdevDef *hostdev) ++{ ++ virDomainControllerDef *pxbCont; ++ virDomainControllerDef *pxbRootPort; ++ int tnode = hostdev->numa.node; ++ int nnode = virDomainNumaGetNodeCount(def->numa); ++ ++ if (hostdev->numa.node < 0) { ++ return 0; ++ } ++ ++ if (tnode >= nnode) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("Invalid host device target numa node[%d]"), tnode); ++ return -1; ++ } ++ ++ if (!(pxbCont = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_PCI))) { ++ return -1; ++ } ++ pxbCont->idx = virDomainControllerFindUnusedIndex(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI); ++ pxbCont->model = VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS; ++ pxbCont->opts.pciopts.numaNode = tnode; ++ pxbCont->opts.pciopts.modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB_PCIE; ++ VIR_APPEND_ELEMENT_COPY(def->controllers, def->ncontrollers, pxbCont); ++ ++ if (!(pxbRootPort = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_PCI))) { ++ return -1; ++ } ++ pxbRootPort->idx = virDomainControllerFindUnusedIndex(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI); ++ pxbRootPort->model = VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT; ++ pxbRootPort->opts.pciopts.modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT; ++ pxbRootPort->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; ++ pxbRootPort->info.addr.pci.bus = pxbCont->idx; ++ pxbRootPort->info.addr.pci.slot = 0U; ++ pxbRootPort->info.addr.pci.function = 0U; ++ VIR_APPEND_ELEMENT_COPY(def->controllers, def->ncontrollers, pxbRootPort); ++ ++ hostdev->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; ++ hostdev->info->addr.pci.bus = pxbRootPort->idx; ++ hostdev->info->addr.pci.slot = 0U; ++ hostdev->info->addr.pci.function = 0U; ++ ++ return 0; ++} + + static int + virDomainLoaderDefParseXMLNvram(virDomainLoaderDef *loader, +@@ -19227,6 +19284,9 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt, + */ + if (virDomainDefMaybeAddHostdevSCSIcontroller(def) < 0) + return NULL; ++ ++ if (virDomainDefMaybeAddHostdevPxbcontroller(def, hostdev) < 0) ++ return NULL; + } + VIR_FREE(nodes); + +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 180f092c06..4f150c16d9 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -380,6 +380,7 @@ struct _virDomainHostdevDef { + + virDomainHostdevMode mode; + virDomainStartupPolicy startupPolicy; ++ virDomainDeviceNuma numa; + bool managed; + bool missing; + bool readonly; +-- +2.33.0 + diff --git a/libvirt.spec b/libvirt.spec index 6c5e52f1afb4deb456c719bc43707d2ffb85ead2..2d1bf016a5af76a7c75f9b8186f6e82db78a5e5d 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -262,7 +262,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 9.10.0 -Release: 17 +Release: 18 License: LGPLv2+ URL: https://libvirt.org/ @@ -341,7 +341,22 @@ Patch0067: Revert-qemu-Remove-pre-blockdev-PFLASH-setup.patch Patch0068: qemu_command-get-disk-alias-from-disk-instead-of-nod.patch Patch0069: migration-Add-the-VIR_MIGRATE_RETURNPATH-flag.patch Patch0070: Revert-Automatically-unbind-all-devices-driver-under.patch - +Patch0071: add-qemu-VIRTCCA-capability-detection.patch +Patch0072: add-virtcca-test-xml.patch +Patch0073: virtcca-use-hugepage-disable-bind-numa.patch +Patch0074: util-resctrl-add-parsing-process-for-the-new-paramet.patch +Patch0075: util-resctrl-add-L3-priority-parse-and-format-method.patch +Patch0076: conf-add-support-for-cachetune-L3-priority.patch +Patch0077: util-resctrl-define-memory-bandwidth-types-add-parse.patch +Patch0078: conf-add-support-for-memorytune-XML-processing-for-M.patch +Patch0079: conf-add-support-for-memorytune-XML-processing-for-M2.patch +Patch0080: conf-add-support-for-memorytune-XML-processing-for-M3.patch +Patch0081: backport-domcaps-Report-launchSecurity.patch +Patch0082: backport-qemu-Fill-launchSecurity-in-domaincaps.patch +Patch0083: v4-1-4-src-Add-ARM-CCA-support-in-qemu-driver-to-lau.patch +Patch0084: v4-2-4-src-Add-ARM-CCA-support-in-domain-capabilitie.patch +Patch0085: v4-3-4-src-Add-ARM-CCA-support-in-domain-schema.patch +Patch0086: hostdev-add-numa-configure-for-host-pci-device.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2633,6 +2648,24 @@ exit 0 %endif %changelog +* Mon Sep 01 2025 PengruiZhang - 9.10.0-18 +- add qemu VIRTCCA capability detection +- add virtcca test xml +- virtcca use hugepage disable bind numa +- util: resctrl: add parsing process for the new parameters cache id +- util:resctrl:add L3 priority parse and format method +- conf: add support for cachetune/L3 priority +- util: resctrl: define memory bandwidth types & add parse and format method +- conf: add support for memorytune XML processing for MB hardlimit +- conf: add support for memorytune XML processing for MB priority +- conf: add support for memorytune XML processing for MB min_bandwidth +- [backport]domcaps: Report launchSecurity +- [backport]qemu: Fill launchSecurity in domaincaps +- [v4-1-4]src: Add ARM CCA support in qemu driver to launch VM +- [v4-2-4]src: Add ARM CCA support in domain capabilities command +- [v4-3-4]src: Add ARM CCA support in domain schema +- hostdev: add numa configure for host pci device + * Wed Jul 30 2025 JiaboFeng - 9.10.0-17 - Revert "Automatically unbind all devices' driver under same root port and bind to vfio-pci in the context of CVM." diff --git a/util-resctrl-add-L3-priority-parse-and-format-method.patch b/util-resctrl-add-L3-priority-parse-and-format-method.patch new file mode 100644 index 0000000000000000000000000000000000000000..f8241d7792f85255f9e3669afbf18136ba6d4e61 --- /dev/null +++ b/util-resctrl-add-L3-priority-parse-and-format-method.patch @@ -0,0 +1,365 @@ +From fbc6ac1471bdc6ffdb5fe5e47bf6df2753acf949 Mon Sep 17 00:00:00 2001 +From: lutong +Date: Sat, 26 Jul 2025 17:40:03 +0800 +Subject: [PATCH 2/6] util:resctrl:add L3 priority parse and format method + +--- + src/libvirt_private.syms | 2 + + src/util/virresctrl.c | 168 +++++++++++++++++++++++++++++++------- + src/util/virresctrl.h | 1 + + src/util/virresctrlpriv.h | 7 ++ + tests/virresctrltest.c | 5 ++ + 5 files changed, 153 insertions(+), 30 deletions(-) + +diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms +index cd99cc302a..a3799a0108 100644 +--- a/src/libvirt_private.syms ++++ b/src/libvirt_private.syms +@@ -3252,11 +3252,13 @@ virCacheKernelTypeToString; + virCacheTypeFromString; + virCacheTypeToString; + virResctrlAllocAddPID; ++virResctrlAllocCopyCacheProperties; + virResctrlAllocCreate; + virResctrlAllocDeterminePath; + virResctrlAllocForeachCache; + virResctrlAllocForeachMemory; + virResctrlAllocFormat; ++virResctrlAllocGetDefault; + virResctrlAllocGetID; + virResctrlAllocGetUnused; + virResctrlAllocIsEmpty; +diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c +index 7d661e944f..3d2be7560c 100644 +--- a/src/util/virresctrl.c ++++ b/src/util/virresctrl.c +@@ -60,6 +60,7 @@ VIR_ENUM_IMPL(virCacheKernel, + "Unified", + "Instruction", + "Data", ++ "Priority", + ); + + /* Cache name mapping for our XML naming. */ +@@ -68,6 +69,7 @@ VIR_ENUM_IMPL(virCache, + "both", + "code", + "data", ++ "priority", + ); + + /* Cache name mapping for resctrl interface naming. */ +@@ -77,6 +79,7 @@ VIR_ENUM_IMPL(virResctrl, + "", + "CODE", + "DATA", ++ "PRI", + ); + + /* Monitor feature name prefix mapping for monitor naming */ +@@ -313,6 +316,10 @@ struct _virResctrlAllocPerType { + /* cache id map for each cache */ + unsigned int **cache_ids; + size_t ncache_ids; ++ ++ /* priority for each cahe */ ++ unsigned long long **priorities; ++ size_t npriorities; + }; + + struct _virResctrlAllocPerLevel { +@@ -401,9 +408,13 @@ virResctrlAllocDispose(void *obj) + for (k = 0; k < type->ncache_ids; k++) + g_free(type->cache_ids[k]); + ++ for (k = 0; k < type->npriorities; k++) ++ g_free(type->priorities[k]); ++ + g_free(type->sizes); + g_free(type->masks); + g_free(type->cache_ids); ++ g_free(type->priorities); + g_free(type); + } + g_free(level->types); +@@ -1518,19 +1529,25 @@ virResctrlAllocFormatCache(virResctrlAlloc *alloc, + + virBufferAsprintf(buf, "L%u%s:", level, virResctrlTypeToString(type)); + +- for (cache = 0; cache < a_type->nmasks; cache++) { +- virBitmap *mask = a_type->masks[cache]; +- char *mask_str = NULL; +- +- if (!mask) +- continue; +- +- mask_str = virBitmapToString(mask); +- if (!mask_str) +- return -1; +- +- virBufferAsprintf(buf, "%u=%s;", *a_type->cache_ids[cache], mask_str); +- VIR_FREE(mask_str); ++ if (type == VIR_CACHE_TYPE_PRIORITY) { ++ for (cache = 0; cache < a_type->npriorities; cache++) { ++ virBufferAsprintf(buf, "%u=%llu;", *(a_type->cache_ids[cache]), *(a_type->priorities[cache])); ++ } ++ } else { ++ for (cache = 0; cache < a_type->nmasks; cache++) { ++ virBitmap *mask = a_type->masks[cache]; ++ char *mask_str = NULL; ++ ++ if (!mask) ++ continue; ++ ++ mask_str = virBitmapToString(mask); ++ if (!mask_str) ++ return -1; ++ ++ virBufferAsprintf(buf, "%u=%s;", *(a_type->cache_ids[cache]), mask_str); ++ VIR_FREE(mask_str); ++ } + } + + virBufferTrim(buf, ";"); +@@ -1604,6 +1621,41 @@ virResctrlAllocParseProcessCacheId(virResctrlInfo *resctrl, + } + + ++static int ++virResctrlAllocParseProcessCachePriority(virResctrlAlloc *alloc, ++ unsigned int level, ++ virCacheType type, ++ char *value, ++ unsigned int node_id) ++{ ++ unsigned int priority = 0; ++ virResctrlAllocPerType *a_type = NULL; ++ ++ if (virStrToLong_uip(value, NULL, 10, &priority) < 0) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("Invalid priority '%1$s'"), value); ++ return -1; ++ } ++ ++ a_type = virResctrlAllocGetType(alloc, level, type); ++ ++ if (!a_type) ++ return -1; ++ ++ if (a_type->npriorities <= node_id) { ++ VIR_EXPAND_N(a_type->priorities, a_type->npriorities, ++ node_id - a_type->npriorities + 1); ++ } ++ ++ if (!a_type->priorities[node_id]) ++ a_type->priorities[node_id] = g_new0(unsigned long long, 1); ++ ++ *(a_type->priorities[node_id]) = priority; ++ ++ return 0; ++} ++ ++ + static int + virResctrlAllocParseProcessCache(virResctrlInfo *resctrl, + virResctrlAlloc *alloc, +@@ -1613,7 +1665,6 @@ virResctrlAllocParseProcessCache(virResctrlInfo *resctrl, + unsigned int node_id) + { + char *tmp = strchr(cache, '='); +- unsigned int cache_id = 0; + g_autoptr(virBitmap) mask = NULL; + + if (!tmp) +@@ -1626,10 +1677,8 @@ virResctrlAllocParseProcessCache(virResctrlInfo *resctrl, + return -1; + } + +- if (virStrToLong_uip(cache, NULL, 10, &cache_id) < 0) { +- virReportError(VIR_ERR_INTERNAL_ERROR, +- _("Invalid cache id '%1$s'"), cache); +- return -1; ++ if (type == VIR_CACHE_TYPE_PRIORITY) { ++ return virResctrlAllocParseProcessCachePriority(alloc, level, type, tmp, node_id); + } + + mask = virBitmapNewString(tmp); +@@ -1762,7 +1811,7 @@ virResctrlAllocGetGroup(virResctrlInfo *resctrl, + } + + +-static virResctrlAlloc * ++virResctrlAlloc * + virResctrlAllocGetDefault(virResctrlInfo *resctrl) + { + virResctrlAlloc *ret = NULL; +@@ -2128,9 +2177,9 @@ virResctrlAllocCopyMemBW(virResctrlAlloc *dst, + } + + +-static int +-virResctrlAllocCopyCache(virResctrlAlloc *dst, +- virResctrlAlloc *src) ++int ++virResctrlAllocCopyCacheProperties(virResctrlAlloc *dst, ++ virResctrlAlloc *src) + { + unsigned int level = 0; + +@@ -2153,13 +2202,6 @@ virResctrlAllocCopyCache(virResctrlAlloc *dst, + if (!d_type) + return -1; + +- for (cache = 0; cache < s_type->nmasks; cache++) { +- virBitmap *mask = s_type->masks[cache]; +- +- if (mask && virResctrlAllocUpdateMask(dst, level, type, cache, mask) < 0) +- return -1; +- } +- + if (s_type->ncache_ids > d_type->ncache_ids) + VIR_EXPAND_N(d_type->cache_ids, d_type->ncache_ids, + s_type->ncache_ids - d_type->ncache_ids); +@@ -2168,7 +2210,18 @@ virResctrlAllocCopyCache(virResctrlAlloc *dst, + if (d_type->cache_ids[cache]) + continue; + d_type->cache_ids[cache] = g_new0(unsigned int, 1); +- *d_type->cache_ids[cache] = *s_type->cache_ids[cache]; ++ *(d_type->cache_ids[cache]) = *(s_type->cache_ids[cache]); ++ } ++ ++ if (s_type->npriorities > d_type->npriorities) ++ VIR_EXPAND_N(d_type->priorities, d_type->npriorities, ++ s_type->npriorities - d_type->npriorities); ++ ++ for (cache = 0; cache < s_type->npriorities; cache++) { ++ if (d_type->priorities[cache]) ++ continue; ++ d_type->priorities[cache] = g_new0(long long unsigned int, 1); ++ *(d_type->priorities[cache]) = *(s_type->priorities[cache]); + } + } + } +@@ -2177,6 +2230,44 @@ virResctrlAllocCopyCache(virResctrlAlloc *dst, + } + + ++static int ++virResctrlAllocCopyCache(virResctrlAlloc *dst, ++ virResctrlAlloc *src) ++{ ++ unsigned int level = 0; ++ ++ for (level = 0; level < src->nlevels; level++) { ++ virResctrlAllocPerLevel *s_level = src->levels[level]; ++ unsigned int type = 0; ++ ++ if (!s_level) ++ continue; ++ ++ for (type = 0; type < VIR_CACHE_TYPE_LAST; type++) { ++ virResctrlAllocPerType *s_type = s_level->types[type]; ++ virResctrlAllocPerType *d_type = NULL; ++ unsigned int cache = 0; ++ ++ if (!s_type) ++ continue; ++ ++ d_type = virResctrlAllocGetType(dst, level, type); ++ if (!d_type) ++ return -1; ++ ++ for (cache = 0; cache < s_type->nmasks; cache++) { ++ virBitmap *mask = s_type->masks[cache]; ++ ++ if (mask && virResctrlAllocUpdateMask(dst, level, type, cache, mask) < 0) ++ return -1; ++ } ++ } ++ } ++ ++ return virResctrlAllocCopyCacheProperties(dst, src); ++} ++ ++ + /* + * This function is called when creating an allocation in the system. + * What it does is that it gets all the unused resources using +@@ -2234,6 +2325,23 @@ virResctrlAllocAssign(virResctrlInfo *resctrl, + if (!a_type) + continue; + ++ if (type == VIR_CACHE_TYPE_PRIORITY) { ++ for (cache = 0; cache < a_type->nsizes; cache++) { ++ if (!a_type->sizes[cache]) ++ continue; ++ ++ if (!a_type->priorities[cache]) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("Cache level %1$d does not support tuning for scope type '%2$s'"), ++ level, virCacheTypeToString(type)); ++ return -1; ++ } ++ ++ *a_type->priorities[cache] = *a_type->sizes[cache]; ++ } ++ continue; ++ } ++ + if (!f_type) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Cache level %1$d does not support tuning for scope type '%2$s'"), +diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h +index 0e4b535f9e..af135520d7 100644 +--- a/src/util/virresctrl.h ++++ b/src/util/virresctrl.h +@@ -27,6 +27,7 @@ typedef enum { + VIR_CACHE_TYPE_BOTH, + VIR_CACHE_TYPE_CODE, + VIR_CACHE_TYPE_DATA, ++ VIR_CACHE_TYPE_PRIORITY, + + VIR_CACHE_TYPE_LAST + } virCacheType; +diff --git a/src/util/virresctrlpriv.h b/src/util/virresctrlpriv.h +index 803f9b62ab..646b040761 100644 +--- a/src/util/virresctrlpriv.h ++++ b/src/util/virresctrlpriv.h +@@ -26,3 +26,10 @@ + + virResctrlAlloc * + virResctrlAllocGetUnused(virResctrlInfo *resctrl); ++ ++virResctrlAlloc * ++virResctrlAllocGetDefault(virResctrlInfo *resctrl); ++ ++int ++virResctrlAllocCopyCacheProperties(virResctrlAlloc *dst, ++ virResctrlAlloc *src); +\ No newline at end of file +diff --git a/tests/virresctrltest.c b/tests/virresctrltest.c +index c5733a7972..d5bc37259c 100644 +--- a/tests/virresctrltest.c ++++ b/tests/virresctrltest.c +@@ -21,6 +21,7 @@ test_virResctrlGetUnused(const void *opaque) + g_autofree char *system_dir = NULL; + g_autofree char *resctrl_dir = NULL; + g_autoptr(virResctrlAlloc) alloc = NULL; ++ g_autoptr(virResctrlAlloc) default_alloc = NULL; + g_autofree char *schemata_str = NULL; + g_autofree char *schemata_file = NULL; + g_autoptr(virCaps) caps = NULL; +@@ -44,6 +45,10 @@ test_virResctrlGetUnused(const void *opaque) + } + + alloc = virResctrlAllocGetUnused(caps->host.resctrl); ++ default_alloc = virResctrlAllocGetDefault(caps->host.resctrl); ++ ++ if (virResctrlAllocCopyCacheProperties(alloc, default_alloc) < 0) ++ return -1; + + virFileWrapperClearPrefixes(); + +-- +2.33.0 + diff --git a/util-resctrl-add-parsing-process-for-the-new-paramet.patch b/util-resctrl-add-parsing-process-for-the-new-paramet.patch new file mode 100644 index 0000000000000000000000000000000000000000..bef15467f1d37c5af777f3d25896a72ca3c2df19 --- /dev/null +++ b/util-resctrl-add-parsing-process-for-the-new-paramet.patch @@ -0,0 +1,184 @@ +From a63abd6836364df141e2428df2f76b233ebc56aa Mon Sep 17 00:00:00 2001 +From: lutong +Date: Sat, 26 Jul 2025 15:49:33 +0800 +Subject: [PATCH 1/6] util: resctrl: add parsing process for the new parameters + cache id + +--- + src/util/virresctrl.c | 83 +++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 76 insertions(+), 7 deletions(-) + +diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c +index 30ae25c487..7d661e944f 100644 +--- a/src/util/virresctrl.c ++++ b/src/util/virresctrl.c +@@ -309,6 +309,10 @@ struct _virResctrlAllocPerType { + /* Mask for each cache */ + virBitmap **masks; + size_t nmasks; ++ ++ /* cache id map for each cache */ ++ unsigned int **cache_ids; ++ size_t ncache_ids; + }; + + struct _virResctrlAllocPerLevel { +@@ -394,8 +398,12 @@ virResctrlAllocDispose(void *obj) + for (k = 0; k < type->nmasks; k++) + virBitmapFree(type->masks[k]); + ++ for (k = 0; k < type->ncache_ids; k++) ++ g_free(type->cache_ids[k]); ++ + g_free(type->sizes); + g_free(type->masks); ++ g_free(type->cache_ids); + g_free(type); + } + g_free(level->types); +@@ -1521,7 +1529,7 @@ virResctrlAllocFormatCache(virResctrlAlloc *alloc, + if (!mask_str) + return -1; + +- virBufferAsprintf(buf, "%u=%s;", cache, mask_str); ++ virBufferAsprintf(buf, "%u=%s;", *a_type->cache_ids[cache], mask_str); + VIR_FREE(mask_str); + } + +@@ -1552,12 +1560,57 @@ virResctrlAllocFormat(virResctrlAlloc *alloc) + } + + ++static int ++virResctrlAllocParseProcessCacheId(virResctrlInfo *resctrl, ++ virResctrlAlloc *alloc, ++ unsigned int level, ++ virCacheType type, ++ char *cache, ++ unsigned int node_id) ++{ ++ unsigned int cache_id = 0; ++ virResctrlAllocPerType *a_type = NULL; ++ ++ if (virStrToLong_uip(cache, NULL, 10, &cache_id) < 0) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("Invalid cache id '%1$s'"), cache); ++ return -1; ++ } ++ ++ if (!resctrl || ++ level >= resctrl->nlevels || ++ !resctrl->levels[level]) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("Missing or inconsistent resctrl info for level '%1$u'"), ++ level); ++ return -1; ++ } ++ ++ a_type = virResctrlAllocGetType(alloc, level, type); ++ if (!a_type) ++ return -1; ++ ++ if (a_type->ncache_ids <= node_id) { ++ VIR_EXPAND_N(a_type->cache_ids, a_type->ncache_ids, ++ node_id - a_type->ncache_ids + 1); ++ } ++ ++ if (!a_type->cache_ids[node_id]) ++ a_type->cache_ids[node_id] = g_new0(unsigned int, 1); ++ ++ *(a_type->cache_ids[node_id]) = cache_id; ++ ++ return 0; ++} ++ ++ + static int + virResctrlAllocParseProcessCache(virResctrlInfo *resctrl, + virResctrlAlloc *alloc, + unsigned int level, + virCacheType type, +- char *cache) ++ char *cache, ++ unsigned int node_id) + { + char *tmp = strchr(cache, '='); + unsigned int cache_id = 0; +@@ -1569,6 +1622,10 @@ virResctrlAllocParseProcessCache(virResctrlInfo *resctrl, + *tmp = '\0'; + tmp++; + ++ if (virResctrlAllocParseProcessCacheId(resctrl, alloc, level, type, cache, node_id) < 0) { ++ return -1; ++ } ++ + if (virStrToLong_uip(cache, NULL, 10, &cache_id) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid cache id '%1$s'"), cache); +@@ -1591,7 +1648,7 @@ virResctrlAllocParseProcessCache(virResctrlInfo *resctrl, + + virBitmapShrink(mask, resctrl->levels[level]->types[type]->bits); + +- if (virResctrlAllocUpdateMask(alloc, level, type, cache_id, mask) < 0) ++ if (virResctrlAllocUpdateMask(alloc, level, type, node_id, mask) < 0) + return -1; + + return 0; +@@ -1607,6 +1664,7 @@ virResctrlAllocParseCacheLine(virResctrlInfo *resctrl, + GStrv next; + char *tmp = NULL; + unsigned int level = 0; ++ unsigned int node_id = 0; + int type = -1; + + /* For no reason there can be spaces */ +@@ -1643,8 +1701,8 @@ virResctrlAllocParseCacheLine(virResctrlInfo *resctrl, + if (!caches) + return 0; + +- for (next = caches; *next; next++) { +- if (virResctrlAllocParseProcessCache(resctrl, alloc, level, type, *next) < 0) ++ for (next = caches; *next; next++, node_id++) { ++ if (virResctrlAllocParseProcessCache(resctrl, alloc, level, type, *next, node_id) < 0) + return -1; + } + +@@ -2071,7 +2129,7 @@ virResctrlAllocCopyMemBW(virResctrlAlloc *dst, + + + static int +-virResctrlAllocCopyMasks(virResctrlAlloc *dst, ++virResctrlAllocCopyCache(virResctrlAlloc *dst, + virResctrlAlloc *src) + { + unsigned int level = 0; +@@ -2101,6 +2159,17 @@ virResctrlAllocCopyMasks(virResctrlAlloc *dst, + if (mask && virResctrlAllocUpdateMask(dst, level, type, cache, mask) < 0) + return -1; + } ++ ++ if (s_type->ncache_ids > d_type->ncache_ids) ++ VIR_EXPAND_N(d_type->cache_ids, d_type->ncache_ids, ++ s_type->ncache_ids - d_type->ncache_ids); ++ ++ for (cache = 0; cache < s_type->ncache_ids; cache++) { ++ if (d_type->cache_ids[cache]) ++ continue; ++ d_type->cache_ids[cache] = g_new0(unsigned int, 1); ++ *d_type->cache_ids[cache] = *s_type->cache_ids[cache]; ++ } + } + } + +@@ -2133,7 +2202,7 @@ virResctrlAllocAssign(virResctrlInfo *resctrl, + if (virResctrlAllocMemoryBandwidth(resctrl, alloc) < 0) + return -1; + +- if (virResctrlAllocCopyMasks(alloc, alloc_default) < 0) ++ if (virResctrlAllocCopyCache(alloc, alloc_default) < 0) + return -1; + + if (virResctrlAllocCopyMemBW(alloc, alloc_default) < 0) +-- +2.33.0 + diff --git a/util-resctrl-define-memory-bandwidth-types-add-parse.patch b/util-resctrl-define-memory-bandwidth-types-add-parse.patch new file mode 100644 index 0000000000000000000000000000000000000000..fb6b4563b51d5b8a9cfba14661693e912a9ee584 --- /dev/null +++ b/util-resctrl-define-memory-bandwidth-types-add-parse.patch @@ -0,0 +1,526 @@ +From b8ff1a5efe7ae9a173fb1a6fdf47f3c76de9b73a Mon Sep 17 00:00:00 2001 +From: lutong +Date: Wed, 30 Jul 2025 15:22:05 +0800 +Subject: [PATCH 4/6] util: resctrl: define memory bandwidth types & add parse + and format method + +--- + src/conf/domain_conf.c | 2 +- + src/util/virresctrl.c | 274 ++++++++++++++++++++++++++++++++--------- + src/util/virresctrl.h | 13 +- + 3 files changed, 227 insertions(+), 62 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 5dbbe5cd3c..12e02e4893 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -18247,7 +18247,7 @@ virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt, + &bandwidth) < 0) + return -1; + +- if (virResctrlAllocSetMemoryBandwidth(alloc, id, bandwidth) < 0) ++ if (virResctrlAllocSetMemoryBandwidth(alloc, VIR_MEMORY_TYPE_BANDWIDTH, id, bandwidth) < 0) + return -1; + + return 0; +diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c +index 7bdbc85bc9..77abf03a3c 100644 +--- a/src/util/virresctrl.c ++++ b/src/util/virresctrl.c +@@ -82,6 +82,23 @@ VIR_ENUM_IMPL(virResctrl, + "PRI", + ); + ++VIR_ENUM_IMPL(virMemory, ++ VIR_MEMORY_TYPE_LAST, ++ "bandwidth", ++ "hardlimit", ++ "priority", ++ "minbandwidth", ++); ++ ++VIR_ENUM_DECL(virResctrlMemory); ++VIR_ENUM_IMPL(virResctrlMemory, ++ VIR_MEMORY_TYPE_LAST, ++ "", ++ "HDL", ++ "PRI", ++ "MIN", ++); ++ + /* Monitor feature name prefix mapping for monitor naming */ + VIR_ENUM_IMPL(virResctrlMonitorPrefix, + VIR_RESCTRL_MONITOR_TYPE_LAST, +@@ -106,6 +123,8 @@ typedef struct _virResctrlAllocPerType virResctrlAllocPerType; + + typedef struct _virResctrlAllocPerLevel virResctrlAllocPerLevel; + ++typedef struct _virResctrlAllocMemPerType virResctrlAllocMemPerType; ++ + typedef struct _virResctrlAllocMemBW virResctrlAllocMemBW; + + +@@ -333,9 +352,18 @@ struct _virResctrlAllocPerLevel { + * Since it can have several last level caches in a NUMA system, it is + * also represented as a nested sparse arrays as virRestrlAllocPerLevel. + */ ++struct _virResctrlAllocMemPerType { ++ unsigned int **values; ++ size_t nvalues; ++ ++ unsigned int **user_values; ++ size_t nuser_values; ++}; ++ + struct _virResctrlAllocMemBW { +- unsigned int **bandwidths; +- size_t nbandwidths; ++ virResctrlAllocMemPerType **types; /* Indexed with enum virMemoryType */ ++ /* There is no `ntypes` member variable as it is always allocated for ++ * VIR_MEMORY_TYPE_LAST number of items */ + }; + + struct _virResctrlAlloc { +@@ -423,9 +451,24 @@ virResctrlAllocDispose(void *obj) + + if (alloc->mem_bw) { + virResctrlAllocMemBW *mem_bw = alloc->mem_bw; +- for (i = 0; i < mem_bw->nbandwidths; i++) +- g_free(mem_bw->bandwidths[i]); +- g_free(alloc->mem_bw->bandwidths); ++ ++ for (i = 0; i < VIR_MEMORY_TYPE_LAST; i++) { ++ virResctrlAllocMemPerType *type = mem_bw->types[i]; ++ ++ if (!type) ++ continue; ++ ++ for (j = 0; j < type->nvalues; j++) ++ g_free(type->values[j]); ++ ++ for (j = 0; j < type->nuser_values; j++) ++ g_free(type->user_values[j]); ++ ++ g_free(type->values); ++ g_free(type->user_values); ++ g_free(type); ++ } ++ g_free(mem_bw->types); + g_free(alloc->mem_bw); + } + +@@ -1104,6 +1147,28 @@ virResctrlAllocGetType(virResctrlAlloc *alloc, + } + + ++static virResctrlAllocMemPerType * ++virResctrlAllocGetMemType(virResctrlAlloc *alloc, ++ virMemoryType type) ++{ ++ virResctrlAllocMemBW *mem_bw = NULL; ++ ++ if (!alloc->mem_bw) ++ alloc->mem_bw = g_new0(virResctrlAllocMemBW, 1); ++ ++ mem_bw = alloc->mem_bw; ++ ++ if (!mem_bw->types) { ++ mem_bw->types = g_new0(virResctrlAllocMemPerType *, VIR_MEMORY_TYPE_LAST); ++ } ++ ++ if (!mem_bw->types[type]) ++ mem_bw->types[type] = g_new0(virResctrlAllocMemPerType, 1); ++ ++ return mem_bw->types[type]; ++} ++ ++ + static int + virResctrlAllocUpdateMask(virResctrlAlloc *alloc, + unsigned int level, +@@ -1154,6 +1219,41 @@ virResctrlAllocUpdateSize(virResctrlAlloc *alloc, + } + + ++static int ++virResctrlAllocUpdateMBValue(virResctrlAlloc *alloc) ++{ ++ virResctrlAllocMemBW *mem_bw = alloc->mem_bw; ++ virResctrlAllocMemPerType *a_type = NULL; ++ unsigned int type = 0; ++ unsigned int id = 0; ++ ++ if (!mem_bw || !mem_bw->types) ++ return 0; ++ ++ for (type = 0; type < VIR_MEMORY_TYPE_LAST; type++) { ++ a_type = mem_bw->types[type]; ++ if (!a_type) ++ continue; ++ ++ for (id = 0; id < a_type->nuser_values; id++) { ++ if (!a_type->user_values[id]) ++ continue; ++ ++ if (a_type->nvalues <= id || !a_type->values[id]) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("Node %1$u memory bandwidth does not support tuning for scope type '%2$s'"), ++ id, virMemoryTypeToString(type)); ++ return -1; ++ } ++ ++ *(a_type->values[id]) = *(a_type->user_values[id]); ++ } ++ } ++ ++ return 0; ++} ++ ++ + /* + * Check if there is an allocation for this level/type/cache already. Called + * before updating the structure. VIR_CACHE_TYPE_BOTH collides with any type, +@@ -1292,15 +1392,27 @@ virResctrlAllocForeachCache(virResctrlAlloc *alloc, + */ + int + virResctrlAllocSetMemoryBandwidth(virResctrlAlloc *alloc, ++ virMemoryType type, + unsigned int id, + unsigned int memory_bandwidth) + { + virResctrlAllocMemBW *mem_bw = alloc->mem_bw; ++ virResctrlAllocMemPerType *a_type = NULL; + +- if (memory_bandwidth > 100) { +- virReportError(VIR_ERR_XML_ERROR, "%s", +- _("Memory Bandwidth value exceeding 100 is invalid.")); +- return -1; ++ if (type == VIR_MEMORY_TYPE_HARDLIMIT) { ++ if (memory_bandwidth > 1) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Memory Bandwidth hard limit value just support 0 or 1.")); ++ return -1; ++ } ++ } ++ ++ if (type == VIR_MEMORY_TYPE_BANDWIDTH) { ++ if (memory_bandwidth > 100) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Memory Bandwidth value exceeding 100 is invalid.")); ++ return -1; ++ } + } + + if (!mem_bw) { +@@ -1308,19 +1420,25 @@ virResctrlAllocSetMemoryBandwidth(virResctrlAlloc *alloc, + alloc->mem_bw = mem_bw; + } + +- if (mem_bw->nbandwidths <= id) +- VIR_EXPAND_N(mem_bw->bandwidths, mem_bw->nbandwidths, +- id - mem_bw->nbandwidths + 1); ++ a_type = virResctrlAllocGetMemType(alloc, type); ++ if (!a_type) ++ return -1; + +- if (mem_bw->bandwidths[id]) { ++ if (a_type->nuser_values <= id) ++ VIR_EXPAND_N(a_type->user_values, a_type->nuser_values, ++ id - a_type->nuser_values + 1); ++ ++ if (a_type->user_values[id]) { + virReportError(VIR_ERR_XML_ERROR, +- _("Memory Bandwidth already defined for node %1$u"), ++ _("Memory Bandwidth type '%1$s' already defined for node %2$u"), ++ virMemoryTypeToString(type), + id); + return -1; + } + +- mem_bw->bandwidths[id] = g_new0(unsigned int, 1); +- *(mem_bw->bandwidths[id]) = memory_bandwidth; ++ a_type->user_values[id] = g_new0(unsigned int, 1); ++ *(a_type->user_values[id]) = memory_bandwidth; ++ + return 0; + } + +@@ -1347,9 +1465,9 @@ virResctrlAllocForeachMemory(virResctrlAlloc *alloc, + return 0; + + mem_bw = alloc->mem_bw; +- for (i = 0; i < mem_bw->nbandwidths; i++) { +- if (mem_bw->bandwidths[i]) { +- if (cb(i, *mem_bw->bandwidths[i], opaque) < 0) ++ for (i = 0; i < mem_bw->types[VIR_MEMORY_TYPE_BANDWIDTH]->nuser_values; i++) { ++ if (mem_bw->types[VIR_MEMORY_TYPE_BANDWIDTH]->user_values[i]) { ++ if (cb(i, *mem_bw->types[VIR_MEMORY_TYPE_BANDWIDTH]->user_values[i], opaque) < 0) + return -1; + } + } +@@ -1408,22 +1526,26 @@ static int + virResctrlAllocMemoryBandwidthFormat(virResctrlAlloc *alloc, + virBuffer *buf) + { +- size_t i; ++ unsigned int i, type; + + if (!alloc->mem_bw) + return 0; + +- virBufferAddLit(buf, "MB:"); ++ for (type = 0; type < VIR_MEMORY_TYPE_LAST; type++) { ++ virResctrlAllocMemPerType *a_type = alloc->mem_bw->types[type]; ++ if (!a_type) ++ continue; ++ ++ virBufferAsprintf(buf, "MB%s:", virResctrlMemoryTypeToString(type)); + +- for (i = 0; i < alloc->mem_bw->nbandwidths; i++) { +- if (alloc->mem_bw->bandwidths[i]) { +- virBufferAsprintf(buf, "%zd=%u;", i, +- *(alloc->mem_bw->bandwidths[i])); ++ for (i = 0; i < a_type->nvalues; i++) { ++ virBufferAsprintf(buf, "%u=%u;", i, *(a_type->values[i])); + } ++ ++ virBufferTrim(buf, ";"); ++ virBufferAddChar(buf, '\n'); + } + +- virBufferTrim(buf, ";"); +- virBufferAddChar(buf, '\n'); + return 0; + } + +@@ -1431,11 +1553,13 @@ virResctrlAllocMemoryBandwidthFormat(virResctrlAlloc *alloc, + static int + virResctrlAllocParseProcessMemoryBandwidth(virResctrlInfo *resctrl, + virResctrlAlloc *alloc, ++ virMemoryType type, + char *mem_bw) + { +- unsigned int bandwidth; ++ unsigned int value; + unsigned int id; + char *tmp = NULL; ++ virResctrlAllocMemPerType *a_type = NULL; + + tmp = strchr(mem_bw, '='); + if (!tmp) +@@ -1448,26 +1572,32 @@ virResctrlAllocParseProcessMemoryBandwidth(virResctrlInfo *resctrl, + _("Invalid node id %1$u "), id); + return -1; + } +- if (virStrToLong_uip(tmp, NULL, 10, &bandwidth) < 0) { ++ if (virStrToLong_uip(tmp, NULL, 10, &value) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, +- _("Invalid bandwidth %1$u"), bandwidth); ++ _("Invalid MB%1$s value %2$u"), ++ virResctrlMemoryTypeToString(type), value); + return -1; + } +- if (bandwidth < resctrl->membw_info->min_bandwidth || ++ if ((type == VIR_MEMORY_TYPE_BANDWIDTH && value < resctrl->membw_info->min_bandwidth) || + id > resctrl->membw_info->max_id) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing or inconsistent resctrl info for memory bandwidth node '%1$u'"), + id); + return -1; + } +- if (alloc->mem_bw->nbandwidths <= id) { +- VIR_EXPAND_N(alloc->mem_bw->bandwidths, alloc->mem_bw->nbandwidths, +- id - alloc->mem_bw->nbandwidths + 1); ++ ++ a_type = virResctrlAllocGetMemType(alloc, type); ++ if (!a_type) ++ return -1; ++ ++ if (a_type->nvalues <= id) { ++ VIR_EXPAND_N(a_type->values, a_type->nvalues, ++ id - a_type->nvalues + 1); + } +- if (!alloc->mem_bw->bandwidths[id]) +- alloc->mem_bw->bandwidths[id] = g_new0(unsigned int, 1); ++ if (!a_type->values[id]) ++ a_type->values[id] = g_new0(unsigned int, 1); + +- *(alloc->mem_bw->bandwidths[id]) = bandwidth; ++ *(a_type->values[id]) = value; + return 0; + } + +@@ -1483,6 +1613,7 @@ virResctrlAllocParseMemoryBandwidthLine(virResctrlInfo *resctrl, + g_auto(GStrv) mbs = NULL; + GStrv next; + char *tmp = NULL; ++ int type = -1; + + /* For no reason there can be spaces */ + virSkipSpaces((const char **) &line); +@@ -1504,11 +1635,19 @@ virResctrlAllocParseMemoryBandwidthLine(virResctrlInfo *resctrl, + tmp = strchr(line, ':'); + if (!tmp) + return 0; ++ *tmp = '\0'; + tmp++; + ++ type = virResctrlMemoryTypeFromString(line + 2); ++ if (type < 0) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("Cannot parse resctrl schemata line '%1$s'"), line); ++ return -1; ++ } ++ + mbs = g_strsplit(tmp, ";", 0); + for (next = mbs; *next; next++) { +- if (virResctrlAllocParseProcessMemoryBandwidth(resctrl, alloc, *next) < 0) ++ if (virResctrlAllocParseProcessMemoryBandwidth(resctrl, alloc, type, *next) < 0) + return -1; + } + +@@ -1908,14 +2047,19 @@ virResctrlAllocNewFromInfo(virResctrlInfo *info) + + /* set default free memory bandwidth to 100% */ + if (info->membw_info) { ++ virResctrlAllocMemPerType *type = NULL; + ret->mem_bw = g_new0(virResctrlAllocMemBW, 1); + +- VIR_EXPAND_N(ret->mem_bw->bandwidths, ret->mem_bw->nbandwidths, ++ type = virResctrlAllocGetMemType(ret, VIR_MEMORY_TYPE_BANDWIDTH); ++ if (!type) ++ return NULL; ++ ++ VIR_EXPAND_N(type->values, type->nvalues, + info->membw_info->max_id + 1); + +- for (i = 0; i < ret->mem_bw->nbandwidths; i++) { +- ret->mem_bw->bandwidths[i] = g_new0(unsigned int, 1); +- *(ret->mem_bw->bandwidths[i]) = 100; ++ for (i = 0; i < type->nvalues; i++) { ++ type->values[i] = g_new0(unsigned int, 1); ++ *(type->values[i]) = 100; + } + } + +@@ -2126,21 +2270,21 @@ virResctrlAllocMemoryBandwidth(virResctrlInfo *resctrl, + return -1; + } + +- for (i = 0; i < mem_bw_alloc->nbandwidths; i++) { +- if (!mem_bw_alloc->bandwidths[i]) ++ for (i = 0; i < mem_bw_alloc->types[VIR_MEMORY_TYPE_BANDWIDTH]->nuser_values; i++) { ++ if (!mem_bw_alloc->types[VIR_MEMORY_TYPE_BANDWIDTH]->user_values[i]) + continue; + +- if (*(mem_bw_alloc->bandwidths[i]) % mem_bw_info->bandwidth_granularity) { ++ if (*(mem_bw_alloc->types[VIR_MEMORY_TYPE_BANDWIDTH]->user_values[i]) % mem_bw_info->bandwidth_granularity) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Memory Bandwidth allocation of size %1$u is not divisible by granularity %2$u"), +- *(mem_bw_alloc->bandwidths[i]), ++ *(mem_bw_alloc->types[VIR_MEMORY_TYPE_BANDWIDTH]->user_values[i]), + mem_bw_info->bandwidth_granularity); + return -1; + } +- if (*(mem_bw_alloc->bandwidths[i]) < mem_bw_info->min_bandwidth) { ++ if (*(mem_bw_alloc->types[VIR_MEMORY_TYPE_BANDWIDTH]->user_values[i]) < mem_bw_info->min_bandwidth) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Memory Bandwidth allocation of size %1$u is smaller than the minimum allowed allocation %2$u"), +- *(mem_bw_alloc->bandwidths[i]), ++ *(mem_bw_alloc->types[VIR_MEMORY_TYPE_BANDWIDTH]->user_values[i]), + mem_bw_info->min_bandwidth); + return -1; + } +@@ -2160,26 +2304,33 @@ virResctrlAllocCopyMemBW(virResctrlAlloc *dst, + virResctrlAlloc *src) + { + size_t i = 0; +- virResctrlAllocMemBW *dst_bw = NULL; ++ unsigned int type = 0; + virResctrlAllocMemBW *src_bw = src->mem_bw; + + if (!src->mem_bw) + return 0; + +- if (!dst->mem_bw) +- dst->mem_bw = g_new0(virResctrlAllocMemBW, 1); ++ for (type = 0; type < VIR_MEMORY_TYPE_LAST; type++) { ++ virResctrlAllocMemPerType *s_type = src_bw->types[type]; ++ virResctrlAllocMemPerType *d_type = NULL; + +- dst_bw = dst->mem_bw; ++ if (!s_type) ++ continue; + +- if (src_bw->nbandwidths > dst_bw->nbandwidths) +- VIR_EXPAND_N(dst_bw->bandwidths, dst_bw->nbandwidths, +- src_bw->nbandwidths - dst_bw->nbandwidths); ++ d_type = virResctrlAllocGetMemType(dst, type); ++ if (!d_type) ++ return -1; + +- for (i = 0; i < src_bw->nbandwidths; i++) { +- if (dst_bw->bandwidths[i]) +- continue; +- dst_bw->bandwidths[i] = g_new0(unsigned int, 1); +- *dst_bw->bandwidths[i] = *src_bw->bandwidths[i]; ++ if (s_type->nvalues > d_type->nvalues) ++ VIR_EXPAND_N(d_type->values, d_type->nvalues, ++ s_type->nvalues - d_type->nvalues); ++ ++ for (i = 0; i < s_type->nvalues; i++) { ++ if (d_type->values[i]) ++ continue; ++ d_type->values[i] = g_new0(unsigned int, 1); ++ *(d_type->values[i]) = *(s_type->values[i]); ++ } + } + + return 0; +@@ -2308,6 +2459,9 @@ virResctrlAllocAssign(virResctrlInfo *resctrl, + if (virResctrlAllocCopyMemBW(alloc, alloc_default) < 0) + return -1; + ++ if (virResctrlAllocUpdateMBValue(alloc) < 0) ++ return -1; ++ + for (level = 0; level < alloc->nlevels; level++) { + virResctrlAllocPerLevel *a_level = alloc->levels[level]; + virResctrlAllocPerLevel *f_level = NULL; +diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h +index af135520d7..9ee76eb225 100644 +--- a/src/util/virresctrl.h ++++ b/src/util/virresctrl.h +@@ -32,8 +32,18 @@ typedef enum { + VIR_CACHE_TYPE_LAST + } virCacheType; + ++typedef enum { ++ VIR_MEMORY_TYPE_BANDWIDTH, ++ VIR_MEMORY_TYPE_HARDLIMIT, ++ VIR_MEMORY_TYPE_PRIORITY, ++ VIR_MEMORY_TYPE_MIN_BANDWIDTH, ++ ++ VIR_MEMORY_TYPE_LAST ++} virMemoryType; ++ + VIR_ENUM_DECL(virCache); + VIR_ENUM_DECL(virCacheKernel); ++VIR_ENUM_DECL(virMemory); + + typedef enum { + VIR_RESCTRL_MONITOR_TYPE_UNSUPPORT, +@@ -142,8 +152,9 @@ virResctrlAllocForeachCache(virResctrlAlloc *alloc, + + int + virResctrlAllocSetMemoryBandwidth(virResctrlAlloc *alloc, ++ virMemoryType type, + unsigned int id, +- unsigned int memory_bandwidth); ++ unsigned int value); + + int + virResctrlAllocForeachMemory(virResctrlAlloc *alloc, +-- +2.33.0 + diff --git a/v4-1-4-src-Add-ARM-CCA-support-in-qemu-driver-to-lau.patch b/v4-1-4-src-Add-ARM-CCA-support-in-qemu-driver-to-lau.patch new file mode 100644 index 0000000000000000000000000000000000000000..6db2ed21cf16148a6603c77bc68b313da7de6a4a --- /dev/null +++ b/v4-1-4-src-Add-ARM-CCA-support-in-qemu-driver-to-lau.patch @@ -0,0 +1,370 @@ +From 3a3cddb270bb2e70b566b6a1133589107d2f8653 Mon Sep 17 00:00:00 2001 +From: Kazuhiro Abe +Date: Thu, 21 Aug 2025 19:19:32 +0800 +Subject: [PATCH 3/5] [v4-1-4]src: Add ARM CCA support in qemu driver to launch + VM + +bugzilla:https://gitee.com/openeuler/libvirt/issues/ICU4UF?from=project-issue +reference:https://patchew.org/Libvirt/20250612071418.2926384-1-fj1078ii@aa.jp.fujitsu.com/ + +-------------------------------- + +- Add ARM CCA support to the qemu driver for aarch64 systems. + +[XML example] + + ... + + sha256 + + ... + + +Signed-off-by: Kazuhiro Abe + +[conflicts:src/conf/domain_validate.c,src/qemu/qemu_cgroup.c,src/qemu/qemu_driver.c +src/qemu/qemu_process.c,src/qemu/qemu_firmware.c,src/security/security_dac.c +src/qemu/qemu_command.c,src/qemu/qemu_capabilities.c] +Signed-off-by: Xu Raoqing +--- + docs/formatdomain.rst | 43 ++++++++++++++++++++++++++++++++++ + src/conf/domain_capabilities.h | 6 +++++ + src/conf/domain_conf.c | 25 ++++++++++++++++++++ + src/conf/domain_conf.h | 8 +++++++ + src/conf/virconftypes.h | 2 ++ + src/qemu/qemu_capabilities.c | 4 ++++ + src/qemu/qemu_capabilities.h | 1 + + src/qemu/qemu_command.c | 28 ++++++++++++++++++++++ + src/qemu/qemu_firmware.c | 2 ++ + src/qemu/qemu_namespace.c | 2 ++ + src/qemu/qemu_process.c | 2 ++ + src/qemu/qemu_validate.c | 2 ++ + 12 files changed, 125 insertions(+) + +diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst +index 2d794cc8a2..56d94bb1ba 100644 +--- a/docs/formatdomain.rst ++++ b/docs/formatdomain.rst +@@ -8754,6 +8754,49 @@ spec `__ + session blob defined in the SEV API spec. See SEV spec LAUNCH_START section + for the session blob format. + ++The contents of the ```` element is used to create ++RealmVM using the Arm CCA feature (Confidential Compute Architecture). ++CCA :since:`Since 11.0.0` enhances the virtualization capabilities of the ++platform by separating the management of resources from access to those resources. ++This is achieved by extending the TrustZone of Cortex-A's Normal and Secure ++world concepts and adding the Realm world and the underlying Root world. ++The Secure Monitor runs in the root world and manages the transition between ++these security states. For more information see the Learn the architecture - ++Arm Confidential Compute Architecture software stack: ++``__ ++ ++:: ++ ++ ++ ... ++ ++ sha256 ++ ... ++ ++ ... ++ ++ ++The ```` element accepts the following attributes: ++ ++``measurement-algo`` ++ The optional ``measurement-algo`` element determines algorithm used to ++ describe blob hashes. ++ ++``personalization-value`` ++ The optional ``personalization-value`` element is used to configure ++ the Realm Personalization Value (RPV). The Realm Personalization ++ Value (RPV) is provided by the user to distinguish Realms that have ++ the same initial measurement. The personalization-value for libvirt ++ must be an 88-character string representing the Base64 encoding of ++ the 64-byte hexadecimal value defined in the RMM specification. ++ Ensure that you encode the 64-byte hex value from the RMM specification ++ using Base64 before providing it to libvirt. ++ ++``measurement-log`` ++ The optional ``measurement-log`` element provides a way to create ++ an event log in the format defined by the Trusted Computing Group ++ for TPM2. ++ + Example configs + =============== + +diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h +index ff363d0772..0055f27f39 100644 +--- a/src/conf/domain_capabilities.h ++++ b/src/conf/domain_capabilities.h +@@ -244,6 +244,12 @@ struct _virVIRTCCACapability { + bool enabled; + }; + ++typedef struct _virCCACapability virCCACapability; ++struct _virCCACapability { ++ size_t nCcaMeasurementAlgo; ++ char **ccaMeasurementAlgo; ++}; ++ + STATIC_ASSERT_ENUM(VIR_DOMAIN_CRYPTO_MODEL_LAST); + STATIC_ASSERT_ENUM(VIR_DOMAIN_CRYPTO_TYPE_LAST); + STATIC_ASSERT_ENUM(VIR_DOMAIN_CRYPTO_BACKEND_LAST); +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 28b2157424..84c89b597d 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -1517,6 +1517,7 @@ VIR_ENUM_IMPL(virDomainLaunchSecurity, + "sev", + "s390-pv", + "cvm", ++ "cca", + ); + + typedef enum { +@@ -3832,6 +3833,10 @@ virDomainSecDefFree(virDomainSecDef *def) + g_free(def->data.sev.secret_header); + g_free(def->data.sev.secret); + break; ++ case VIR_DOMAIN_LAUNCH_SECURITY_CCA: ++ g_free(def->data.cca.measurement_algo); ++ g_free(def->data.cca.personalization_value); ++ break; + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + case VIR_DOMAIN_LAUNCH_SECURITY_CVM: + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: +@@ -13565,6 +13570,21 @@ virDomainSEVDefParseXML(virDomainSEVDef *def, + } + + ++static int ++virDomainCCADefParseXML(virDomainCCADef *def, ++ xmlXPathContextPtr ctxt) ++{ ++ def->measurement_algo = virXPathString("string(./measurement-algo)", ctxt); ++ def->personalization_value = virXPathString("string(./personalization-value)", ctxt); ++ ++ if (virXMLPropTristateBool(ctxt->node, "measurement-log", VIR_XML_PROP_NONE, ++ &def->measurement_log) < 0) ++ return -1; ++ ++ return 0; ++} ++ ++ + static virDomainSecDef * + virDomainSecDefParseXML(xmlNodePtr lsecNode, + xmlXPathContextPtr ctxt) +@@ -13587,6 +13607,10 @@ virDomainSecDefParseXML(xmlNodePtr lsecNode, + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + case VIR_DOMAIN_LAUNCH_SECURITY_CVM: + break; ++ case VIR_DOMAIN_LAUNCH_SECURITY_CCA: ++ if (virDomainCCADefParseXML(&sec->data.cca, ctxt) < 0) ++ return NULL; ++ break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + default: +@@ -26685,6 +26709,7 @@ virDomainSecDefFormat(virBuffer *buf, virDomainSecDef *sec) + + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + case VIR_DOMAIN_LAUNCH_SECURITY_CVM: ++ case VIR_DOMAIN_LAUNCH_SECURITY_CCA: + break; + + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 180f092c06..6d2950e2ab 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -2860,6 +2860,7 @@ typedef enum { + VIR_DOMAIN_LAUNCH_SECURITY_SEV, + VIR_DOMAIN_LAUNCH_SECURITY_PV, + VIR_DOMAIN_LAUNCH_SECURITY_CVM, ++ VIR_DOMAIN_LAUNCH_SECURITY_CCA, + + VIR_DOMAIN_LAUNCH_SECURITY_LAST, + } virDomainLaunchSecurity; +@@ -2879,10 +2880,17 @@ struct _virDomainSEVDef { + char *secret; + }; + ++struct _virDomainCCADef { ++ char *measurement_algo; ++ char *personalization_value; ++ virTristateBool measurement_log; ++}; ++ + struct _virDomainSecDef { + virDomainLaunchSecurity sectype; + union { + virDomainSEVDef sev; ++ virDomainCCADef cca; + } data; + }; + +diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h +index bcdcb8b825..9eff2f014e 100644 +--- a/src/conf/virconftypes.h ++++ b/src/conf/virconftypes.h +@@ -212,6 +212,8 @@ typedef struct _virDomainResourceDef virDomainResourceDef; + + typedef struct _virDomainSEVDef virDomainSEVDef; + ++typedef struct _virDomainCCADef virDomainCCADef; ++ + typedef struct _virDomainSecDef virDomainSecDef; + + typedef struct _virDomainShmemDef virDomainShmemDef; +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index c3f57cbd49..d11b811f1e 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -700,6 +700,7 @@ VIR_ENUM_IMPL(virQEMUCaps, + "virtio-blk-vhost-vdpa", /* QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA */ + "smp-clusters", /* QEMU_CAPS_SMP_CLUSTERS */ + "tmm-guest", /* QEMU_CAPS_VIRTCCA */ ++ "rme-guest", /* QEMU_CAPS_CCA_GUEST */ + ); + + +@@ -787,6 +788,8 @@ struct _virQEMUCaps { + + virVIRTCCACapability *virtccaCapabilities; + ++ virCCACapability *ccaCapabilities; ++ + virDomainCapsFeatureHyperv *hypervCapabilities; + + /* Capabilities which may differ depending on the accelerator. */ +@@ -1391,6 +1394,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { + { "cryptodev-backend-lkcf", QEMU_CAPS_OBJECT_CRYPTO_LKCF }, + { "pvpanic-pci", QEMU_CAPS_DEVICE_PANIC_PCI }, + { "tmm-guest", QEMU_CAPS_VIRTCCA }, ++ { "rme-guest", QEMU_CAPS_CCA_GUEST }, + }; + + +diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h +index 32756ee696..0096c0bb4c 100644 +--- a/src/qemu/qemu_capabilities.h ++++ b/src/qemu/qemu_capabilities.h +@@ -679,6 +679,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ + QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA, /* virtio-blk-vhost-vdpa block driver */ + QEMU_CAPS_SMP_CLUSTERS, /* -smp clusters= */ + QEMU_CAPS_VIRTCCA, /* tmm-guest */ ++ QEMU_CAPS_CCA_GUEST, /* -object rme-guest */ + + QEMU_CAPS_LAST /* this must always be the last item */ + } virQEMUCapsFlags; +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index c6ce598e4a..cc8ecfa9fb 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -7069,6 +7069,9 @@ qemuBuildMachineCommandLine(virCommand *cmd, + case VIR_DOMAIN_LAUNCH_SECURITY_CVM: + virBufferAddLit(&buf, ",kvm-type=cvm"); + break; ++ case VIR_DOMAIN_LAUNCH_SECURITY_CCA: ++ virBufferAddLit(&buf, ",confidential-guest-support=rme0"); ++ break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + virReportEnumRangeError(virDomainLaunchSecurity, def->sec->sectype); +@@ -9865,6 +9868,29 @@ qemuBuildPVCommandLine(virDomainObj *vm, virCommand *cmd) + } + + ++static int ++qemuBuildCCACommandLine(virCommand *cmd, virDomainCCADef *cca, qemuDomainObjPrivate *priv) ++{ ++ g_autoptr(virJSONValue) props = NULL; ++ ++ VIR_DEBUG("measurement_algorithm=%s personalization_value=%s measurement_log=%d", ++ cca->measurement_algo, cca->personalization_value, ++ cca->measurement_log); ++ ++ if (qemuMonitorCreateObjectProps(&props, "rme-guest", "rme0", ++ "S:measurement-algorithm", cca->measurement_algo, ++ "S:personalization-value", cca->personalization_value, ++ "T:measurement-log", cca->measurement_log, ++ NULL) < 0) ++ return -1; ++ ++ if (qemuBuildObjectCommandlineFromJSON(cmd, props, priv->qemuCaps) < 0) ++ return -1; ++ ++ return 0; ++} ++ ++ + static int + qemuBuildSecCommandLine(virDomainObj *vm, virCommand *cmd, + virDomainSecDef *sec) +@@ -9881,6 +9907,8 @@ qemuBuildSecCommandLine(virDomainObj *vm, virCommand *cmd, + break; + case VIR_DOMAIN_LAUNCH_SECURITY_CVM: + break; ++ case VIR_DOMAIN_LAUNCH_SECURITY_CCA: ++ return qemuBuildCCACommandLine(cmd, &sec->data.cca, vm->privateData); + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + virReportEnumRangeError(virDomainLaunchSecurity, sec->sectype); +diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c +index 31ed6e881b..85f74b494c 100644 +--- a/src/qemu/qemu_firmware.c ++++ b/src/qemu/qemu_firmware.c +@@ -1376,6 +1376,8 @@ qemuFirmwareMatchDomain(const virDomainDef *def, + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + case VIR_DOMAIN_LAUNCH_SECURITY_CVM: + break; ++ case VIR_DOMAIN_LAUNCH_SECURITY_CCA: ++ break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + virReportEnumRangeError(virDomainLaunchSecurity, def->sec->sectype); +diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c +index ff314ce243..b6c8b9bb96 100644 +--- a/src/qemu/qemu_namespace.c ++++ b/src/qemu/qemu_namespace.c +@@ -659,6 +659,8 @@ qemuDomainSetupLaunchSecurity(virDomainObj *vm, + + VIR_DEBUG("Set up launch security for SEV"); + break; ++ case VIR_DOMAIN_LAUNCH_SECURITY_CCA: ++ break; + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + case VIR_DOMAIN_LAUNCH_SECURITY_CVM: + break; +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 5240fbce09..4141ea813b 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -7057,6 +7057,8 @@ qemuProcessPrepareLaunchSecurityGuestInput(virDomainObj *vm) + switch ((virDomainLaunchSecurity) sec->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: + return qemuProcessPrepareSEVGuestInput(vm); ++ case VIR_DOMAIN_LAUNCH_SECURITY_CCA: ++ return 0; + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + case VIR_DOMAIN_LAUNCH_SECURITY_CVM: + return 0; +diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c +index 5894e2bd26..e3ed00d9b0 100644 +--- a/src/qemu/qemu_validate.c ++++ b/src/qemu/qemu_validate.c +@@ -1327,6 +1327,8 @@ qemuValidateDomainDef(const virDomainDef *def, + break; + case VIR_DOMAIN_LAUNCH_SECURITY_CVM: + break; ++ case VIR_DOMAIN_LAUNCH_SECURITY_CCA: ++ break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + virReportEnumRangeError(virDomainLaunchSecurity, def->sec->sectype); +-- +2.33.0 + diff --git a/v4-2-4-src-Add-ARM-CCA-support-in-domain-capabilitie.patch b/v4-2-4-src-Add-ARM-CCA-support-in-domain-capabilitie.patch new file mode 100644 index 0000000000000000000000000000000000000000..eea47d04d291324159b90327f4583fda830a981a --- /dev/null +++ b/v4-2-4-src-Add-ARM-CCA-support-in-domain-capabilitie.patch @@ -0,0 +1,1384 @@ +From b4c2fd75a54087cb704db4aa752285e87d4422bd Mon Sep 17 00:00:00 2001 +From: Kazuhiro Abe +Date: Thu, 21 Aug 2025 19:38:21 +0800 +Subject: [PATCH 4/5] [v4-2-4]src: Add ARM CCA support in domain capabilities + command + +bugzilla:https://gitee.com/openeuler/libvirt/issues/ICU4UF?from=project-issue +reference:https://patchew.org/Libvirt/20250612071418.2926384-1-fj1078ii@aa.jp.fujitsu.com/ + +---------------------------------------- + +- Add ARM CCA support in domain capabilies XML schema. + +[Capability example] +- Execution results of 'virsh domcapability" on qemu + +... + + ... + + + + sha256 + sha512 + + + + ... + + + +Signed-off-by: Kazuhiro Abe + +[conflicts:src/conf/domain_capabilities.h,src/conf/domain_capabilities.c, +docs/formatdomaincaps.rst] +[add cca in test input xml] +Signed-off-by: Xu Raoqing +--- + docs/formatdomaincaps.rst | 39 ++++++-- + src/conf/domain_capabilities.c | 48 +++++++++ + src/conf/domain_capabilities.h | 8 +- + src/libvirt_private.syms | 1 + + src/qemu/qemu_capabilities.c | 28 ++++++ + src/qemu/qemu_monitor.c | 10 ++ + src/qemu/qemu_monitor.h | 3 + + src/qemu/qemu_monitor_json.c | 98 +++++++++++++++++++ + src/qemu/qemu_monitor_json.h | 4 + + tests/domaincapsdata/empty.xml | 1 + + .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 + + .../qemu_4.2.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 + + tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 + + .../qemu_5.0.0-tcg-virt.riscv64.xml | 1 + + .../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 + + .../qemu_5.0.0-virt.aarch64.xml | 1 + + .../qemu_5.0.0-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_5.1.0.sparc.xml | 1 + + tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 1 + + .../qemu_5.2.0-tcg-virt.riscv64.xml | 1 + + .../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 1 + + .../qemu_5.2.0-virt.aarch64.xml | 1 + + .../qemu_5.2.0-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.s390x.xml | 1 + + tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 1 + + .../qemu_6.0.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.0.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.0.0.s390x.xml | 1 + + tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 1 + + .../qemu_6.2.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 1 + + .../qemu_7.0.0-hvf.aarch64+hvf.xml | 1 + + .../domaincapsdata/qemu_7.0.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml | 1 + + .../qemu_7.0.0-virt.aarch64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0.aarch64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_7.0.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_7.1.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_7.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.1.0.ppc64.xml | 1 + + tests/domaincapsdata/qemu_7.1.0.x86_64.xml | 1 + + .../qemu_7.2.0-hvf.x86_64+hvf.xml | 1 + + .../domaincapsdata/qemu_7.2.0-q35.x86_64.xml | 1 + + .../qemu_7.2.0-tcg.x86_64+hvf.xml | 1 + + .../domaincapsdata/qemu_7.2.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_7.2.0.ppc.xml | 1 + + tests/domaincapsdata/qemu_7.2.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_8.0.0-q35.x86_64.xml | 1 + + .../qemu_8.0.0-tcg-virt.riscv64.xml | 1 + + .../domaincapsdata/qemu_8.0.0-tcg.x86_64.xml | 1 + + .../qemu_8.0.0-virt.riscv64.xml | 1 + + tests/domaincapsdata/qemu_8.0.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_8.1.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_8.1.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.1.0.s390x.xml | 1 + + tests/domaincapsdata/qemu_8.1.0.x86_64.xml | 1 + + .../domaincapsdata/qemu_8.2.0-q35.x86_64.xml | 1 + + .../domaincapsdata/qemu_8.2.0-tcg.x86_64.xml | 1 + + tests/domaincapsdata/qemu_8.2.0.x86_64.xml | 1 + + 82 files changed, 303 insertions(+), 9 deletions(-) + +diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst +index 86353a6d9a..eafb01a926 100644 +--- a/docs/formatdomaincaps.rst ++++ b/docs/formatdomaincaps.rst +@@ -663,6 +663,12 @@ capabilities. All features occur as children of the main ``features`` element. +
+ + ++ ++ ++ sha256 ++ sha512 ++ ++ + + + relaxed +@@ -784,6 +790,24 @@ document store. In order to use SGX with libvirt have a look at `SGX in domain X + ``sections`` + The sections of the SGX enclave page cache (called EPC). + ++CCA capabilities ++^^^^^^^^^^^^^^^^ ++ ++Arm Confidential Compute Architecture (CCA) capabilities are exposed under the ++``cca`` element. ++ ++Arm CCA is a system solution comprised of hardware and software components that ++maximizes the security of data on devices and in the cloud. ++CCA enhances the virtualization capabilities of the platform by separating the ++management of resources from access to those resources. ++ ++For more details on the CCA feature, please follow resources in the CCA developer's ++document store. In order to use CCA with libvirt have a look at `CCA in domain ++XML `__ ++ ++``measurement-algo`` ++ Options for the ``measurement-algo`` used to describe blob hashes. ++ + + Hyper-V Enlightenments + ^^^^^^^^^^^^^^^^^^^^^^ +@@ -798,11 +822,10 @@ missing even though QEMU does support them. This is because prior to QEMU-6.1.0 + not all features were reported by QEMU. + + Launch security +-^^^^^^^^^^^^^^^ +- +-The ``launchSecurity`` element exposes supported aspects of encrypted guests. +-The ``sectype`` enum corresponds to ``type`` attribute of ```` +-element as documented in `Launch Security +-`__. :since:`(Since 10.5.0)` For additional +-information on individual types, see sections above: `s390-pv capability`_ for +-S390 PV, `SEV capabilities`_ for AMD SEV and/or AMD SEV-SNP. ++The launchSecurity element exposes supported aspects of encrypted guests. ++The sectype enum corresponds to type attribute of ++element as documented in Launch Security. (Since 10.5.0) For additional ++information on individual types, see sections above: s390-pv capability for ++S390 PV, `SEV capabilities`_ for AMD SEV and/or AMD SEV-SNP, `CCA capabilities`_ ++for Arm CCA. ++ +diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c +index edbfc58199..5dbbe1dcd0 100644 +--- a/src/conf/domain_capabilities.c ++++ b/src/conf/domain_capabilities.c +@@ -98,6 +98,25 @@ virVIRTCCACapabilitiesFree(virVIRTCCACapability *cap) + } + + ++void ++virCCACapabilitiesFree(virCCACapability *cap) ++{ ++ size_t i; ++ ++ if (!cap) ++ return; ++ ++ if (cap->nCcaMeasurementAlgo) ++ for (i = 0; i < cap->nCcaMeasurementAlgo; i++) ++ g_free(cap->ccaMeasurementAlgo[i]); ++ ++ if (cap->ccaMeasurementAlgo) ++ g_free(cap->ccaMeasurementAlgo); ++ ++ g_free(cap); ++} ++ ++ + static void + virDomainCapsDispose(void *obj) + { +@@ -112,6 +131,7 @@ virDomainCapsDispose(void *obj) + virSEVCapabilitiesFree(caps->sev); + virSGXCapabilitiesFree(caps->sgx); + virVIRTCCACapabilitiesFree(caps->virtcca); ++ virCCACapabilitiesFree(caps->cca); + g_free(caps->hyperv); + + values = &caps->os.loader.values; +@@ -704,6 +724,33 @@ virDomainCapsFeatureSGXFormat(virBuffer *buf, + virBufferAddLit(buf, "\n"); + } + ++static void ++virDomainCapsFeatureCCAFormat(virBuffer *buf, ++ const virCCACapability *cca) ++{ ++ size_t i; ++ ++ if (!cca) { ++ virBufferAddLit(buf, "\n"); ++ return; ++ } ++ ++ virBufferAddLit(buf, "\n"); ++ virBufferAdjustIndent(buf, 2); ++ ++ virBufferAddLit(buf, "\n"); ++ virBufferAdjustIndent(buf, 2); ++ for (i = 0; i < cca->nCcaMeasurementAlgo; i++) { ++ virBufferAsprintf(buf, "%s\n", ++ cca->ccaMeasurementAlgo[i]); ++ } ++ virBufferAdjustIndent(buf, -2); ++ virBufferAddLit(buf, "\n"); ++ ++ virBufferAdjustIndent(buf, -2); ++ virBufferAddLit(buf, "\n"); ++} ++ + static void + virDomainCapsFeatureHypervFormat(virBuffer *buf, + const virDomainCapsFeatureHyperv *hyperv) +@@ -774,6 +821,7 @@ virDomainCapsFormatFeatures(const virDomainCaps *caps, + + virDomainCapsFeatureSEVFormat(&childBuf, caps->sev); + virDomainCapsFeatureSGXFormat(&childBuf, caps->sgx); ++ virDomainCapsFeatureCCAFormat(&childBuf, caps->cca); + virDomainCapsFeatureHypervFormat(&childBuf, caps->hyperv); + virDomainCapsFeatureVIRTCCAFormat(&childBuf, caps->virtcca); + virDomainCapsLaunchSecurityFormat(&childBuf, &caps->launchSecurity); +diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h +index 0055f27f39..ace823cda8 100644 +--- a/src/conf/domain_capabilities.h ++++ b/src/conf/domain_capabilities.h +@@ -302,6 +302,7 @@ struct _virDomainCaps { + virDomainCapsFeatureGIC gic; + virSEVCapability *sev; + virSGXCapability *sgx; ++ virCCACapability *cca; + virDomainCapsFeatureHyperv *hyperv; + virVIRTCCACapability *virtcca; + virDomainCapsLaunchSecurity launchSecurity; +@@ -364,4 +365,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSGXCapability, virSGXCapabilitiesFree); + void + virVIRTCCACapabilitiesFree(virVIRTCCACapability *capabilities); + +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(virVIRTCCACapability, virVIRTCCACapabilitiesFree); +\ No newline at end of file ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(virVIRTCCACapability, virVIRTCCACapabilitiesFree); ++ ++void ++virCCACapabilitiesFree(virCCACapability *capabilities); ++ ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCCACapability, virCCACapabilitiesFree); +\ No newline at end of file +diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms +index a3799a0108..4cd5f0b2f3 100644 +--- a/src/libvirt_private.syms ++++ b/src/libvirt_private.syms +@@ -206,6 +206,7 @@ virDomainAuditVcpu; + + + # conf/domain_capabilities.h ++virCCACapabilitiesFree; + virDomainCapsCPUModelsAdd; + virDomainCapsCPUModelsCopy; + virDomainCapsCPUModelsGet; +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index d11b811f1e..556a30e0ff 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -3541,6 +3541,32 @@ virQEMUCapsProbeQMPVIRTCCACapabilities(virQEMUCaps *qemuCaps, + } + + ++static int ++virQEMUCapsProbeQMPCCACapabilities(virQEMUCaps *qemuCaps, ++ qemuMonitor *mon) ++{ ++ int rc = -1; ++ virCCACapability *caps = NULL; ++ ++ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCA_GUEST)) ++ return 0; ++ ++ if ((rc = qemuMonitorGetCCACapabilities(mon, &caps)) < 0) ++ return -1; ++ ++ /* CCA isn't actually supported */ ++ if (rc == 0) { ++ virQEMUCapsClear(qemuCaps, QEMU_CAPS_CCA_GUEST); ++ return 0; ++ } ++ ++ virCCACapabilitiesFree(qemuCaps->ccaCapabilities); ++ qemuCaps->ccaCapabilities = caps; ++ return 0; ++} ++ ++ ++ + /* + * Filter for features which should never be passed to QEMU. Either because + * QEMU never supported them or they were dropped as they never did anything +@@ -5633,6 +5659,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCaps *qemuCaps, + /* Some capabilities may differ depending on KVM state */ + if (virQEMUCapsProbeQMPKVMState(qemuCaps, mon) < 0) + return -1; ++ if (virQEMUCapsProbeQMPCCACapabilities(qemuCaps, mon) < 0) ++ return -1; + + if (virQEMUCapsProbeHVF(qemuCaps)) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_HVF); +diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c +index 3fd26a0433..5cfe285d08 100644 +--- a/src/qemu/qemu_monitor.c ++++ b/src/qemu/qemu_monitor.c +@@ -3479,6 +3479,16 @@ qemuMonitorGetVIRTCCACapabilities(qemuMonitor *mon, + } + + ++int ++qemuMonitorGetCCACapabilities(qemuMonitor *mon, ++ virCCACapability **capabilities) ++{ ++ QEMU_CHECK_MONITOR(mon); ++ ++ return qemuMonitorJSONGetCCACapabilities(mon, capabilities); ++} ++ ++ + int + qemuMonitorNBDServerStart(qemuMonitor *mon, + const virStorageNetHostDef *server, +diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h +index 6c6e18da50..902f82ca65 100644 +--- a/src/qemu/qemu_monitor.h ++++ b/src/qemu/qemu_monitor.h +@@ -852,6 +852,9 @@ int qemuMonitorGetSGXCapabilities(qemuMonitor *mon, + int qemuMonitorGetVIRTCCACapabilities(qemuMonitor *mon, + virVIRTCCACapability **capabilities); + ++int qemuMonitorGetCCACapabilities(qemuMonitor *mon, ++ virCCACapability **capabilities); ++ + typedef enum { + QEMU_MONITOR_MIGRATE_RESUME = 1 << 0, /* resume failed post-copy migration */ + QEMU_MONITOR_MIGRATION_FLAGS_LAST +diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c +index 7f23d034b8..d6dccfeda6 100644 +--- a/src/qemu/qemu_monitor_json.c ++++ b/src/qemu/qemu_monitor_json.c +@@ -6184,6 +6184,104 @@ qemuMonitorJSONGetVIRTCCACapabilities(qemuMonitor *mon, + } + + ++static int ++qemuMonitorJSONGetCCAMeasurementAlgo(qemuMonitor *mon, ++ size_t *numalgo, ++ char ***malgo) ++{ ++ g_autoptr(virJSONValue) cmd = NULL; ++ g_autoptr(virJSONValue) reply = NULL; ++ virJSONValue *caps; ++ virJSONValue *malgolist = NULL; ++ g_auto(GStrv) list = NULL; ++ size_t i; ++ size_t n = 0; ++ ++ if (!(cmd = qemuMonitorJSONMakeCommand("query-cca-capabilities", ++ NULL))) ++ return -1; ++ ++ if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) ++ return -1; ++ ++ /* If the 'query-cca-capabilities' QMP command was not available ++ * we simply successfully return zero capabilities. ++ * This is the current QEMU (=9.1.91) and all non-ARM architectures */ ++ if (qemuMonitorJSONHasError(reply, "CommandNotFound")) ++ return 0; ++ ++ if (qemuMonitorJSONCheckError(cmd, reply) < 0) ++ return -1; ++ ++ caps = virJSONValueObjectGetObject(reply, "return"); ++ ++ if (!(caps = qemuMonitorJSONGetReply(cmd, reply, VIR_JSON_TYPE_OBJECT))) ++ return -1; ++ ++ if ((malgolist = virJSONValueObjectGetArray(caps, "sections"))) { ++ n = virJSONValueArraySize(malgolist); ++ ++ /* If the received array is empty, an error is returned. */ ++ if (n == 0) ++ return -1; ++ ++ list = g_new0(char *, n + 1); ++ ++ for (i = 0; i < n; i++) { ++ virJSONValue *cap = virJSONValueArrayGet(malgolist, i); ++ const char *measurement_algo = NULL; ++ ++ if (!cap || virJSONValueGetType(cap) != VIR_JSON_TYPE_OBJECT) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("missing entry in CCA capabilities list")); ++ return -1; ++ } ++ ++ if (!(measurement_algo = virJSONValueObjectGetString(cap, "measurement-algo"))) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("query-cca-capabilities reply was missing 'measurement-algo' field")); ++ return -1; ++ } ++ ++ list[i] = g_strdup(measurement_algo); ++ } ++ } ++ ++ *numalgo = n; ++ *malgo = g_steal_pointer(&list); ++ return 1; ++} ++ ++ ++/** ++ * qemuMonitorJSONGetCCACapabilities: ++ * @mon: qemu monitor object ++ * @capabilities: pointer to pointer to a CCA capability structure to be filled ++ * ++ * Returns -1 on error, 0 if CCA is not supported, and 1 if CCA is supported on ++ * the platform. ++ */ ++int ++qemuMonitorJSONGetCCACapabilities(qemuMonitor *mon, ++ virCCACapability **capabilities) ++{ ++ g_autoptr(virCCACapability) capability = NULL; ++ int ret = 0; ++ ++ *capabilities = NULL; ++ capability = g_new0(virCCACapability, 1); ++ ++ ret = qemuMonitorJSONGetCCAMeasurementAlgo(mon, ++ &capability->nCcaMeasurementAlgo, ++ &capability->ccaMeasurementAlgo); ++ ++ if (ret > 0) ++ *capabilities = g_steal_pointer(&capability); ++ ++ return ret; ++} ++ ++ + static virJSONValue * + qemuMonitorJSONBuildInetSocketAddress(const char *host, + const char *port) +diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h +index 2e0f2e2594..cdf9f5efc4 100644 +--- a/src/qemu/qemu_monitor_json.h ++++ b/src/qemu/qemu_monitor_json.h +@@ -168,6 +168,10 @@ int + qemuMonitorJSONGetSEVCapabilities(qemuMonitor *mon, + virSEVCapability **capabilities); + ++int ++qemuMonitorJSONGetCCACapabilities(qemuMonitor *mon, ++ virCCACapability **capabilities); ++ + int + qemuMonitorJSONGetVIRTCCACapabilities(qemuMonitor *mon, + virVIRTCCACapability **capabilities); +diff --git a/tests/domaincapsdata/empty.xml b/tests/domaincapsdata/empty.xml +index 387a8c3c3d..e6eda98d26 100644 +--- a/tests/domaincapsdata/empty.xml ++++ b/tests/domaincapsdata/empty.xml +@@ -14,6 +14,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +index 8c4787375e..f0d00108f7 100644 +--- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +@@ -318,6 +318,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml +index b825a24456..5296ab73ab 100644 +--- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml +@@ -264,6 +264,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml +index bd290073ee..5ec1317160 100644 +--- a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml +@@ -196,6 +196,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml +index bd290073ee..5ec1317160 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml +@@ -196,6 +196,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml +index f29ca3fb42..c0b8f956af 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml +@@ -164,6 +164,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml b/tests/domaincapsdata/qemu_4.2.0.s390x.xml +index 92e7124d52..2bd213f24a 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml +@@ -270,6 +270,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml +index 5fc8c2aabd..d6419882e4 100644 +--- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml +@@ -318,6 +318,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml +index e7ca3c32fb..4722d64e92 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml +@@ -320,6 +320,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml +index 99ec7de885..eb8d54af5a 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-tcg-virt.riscv64.xml +@@ -149,6 +149,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml +index a4b5b75165..9559330828 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml +@@ -266,6 +266,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml +index bd3cde285f..aec1db3df3 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml +@@ -209,6 +209,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml +index b4874246d8..2ce7949dff 100644 +--- a/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0-virt.riscv64.xml +@@ -152,6 +152,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml +index bd3cde285f..aec1db3df3 100644 +--- a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml +@@ -209,6 +209,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +index 210fc373b3..b7f379ebd1 100644 +--- a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +@@ -171,6 +171,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml +index 316551390c..41a6f8fb91 100644 +--- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml +@@ -320,6 +320,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml +index d285d41c6f..0dfcaf9092 100644 +--- a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml +@@ -253,6 +253,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml +index 1503574db1..6de51981f6 100644 +--- a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml +@@ -266,6 +266,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.1.0.sparc.xml b/tests/domaincapsdata/qemu_5.1.0.sparc.xml +index 8b73bb1265..0b07f4ae33 100644 +--- a/tests/domaincapsdata/qemu_5.1.0.sparc.xml ++++ b/tests/domaincapsdata/qemu_5.1.0.sparc.xml +@@ -135,6 +135,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml +index 83f5d2c6d0..594b2702cd 100644 +--- a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml +@@ -253,6 +253,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +index ce65b7734b..62c875638a 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +@@ -253,6 +253,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml +index 99ec7de885..eb8d54af5a 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-tcg-virt.riscv64.xml +@@ -149,6 +149,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +index 1dc4aa5874..b2888e4a84 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +@@ -266,6 +266,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml +index 7cfb6393f1..aa5a62154a 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml +@@ -209,6 +209,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml b/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml +index b4874246d8..2ce7949dff 100644 +--- a/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0-virt.riscv64.xml +@@ -152,6 +152,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml +index 7cfb6393f1..aa5a62154a 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml +@@ -209,6 +209,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +index 2d95357d35..7e812039f3 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +@@ -171,6 +171,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.s390x.xml b/tests/domaincapsdata/qemu_5.2.0.s390x.xml +index da56ee08f9..b2b9ca6dea 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.s390x.xml +@@ -272,6 +272,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +index 743a308079..696c26b076 100644 +--- a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +@@ -253,6 +253,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml +index 04a6a9e65b..6ceba2d1b1 100644 +--- a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml +@@ -260,6 +260,7 @@ + 450 + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml +index d4572a79ff..0cac14f6fa 100644 +--- a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml +@@ -274,6 +274,7 @@ + 450 + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml +index 20ca13bdd2..4af00969a1 100644 +--- a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml +@@ -211,6 +211,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml +index 20ca13bdd2..4af00969a1 100644 +--- a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml +@@ -211,6 +211,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.0.0.s390x.xml b/tests/domaincapsdata/qemu_6.0.0.s390x.xml +index 25ca3909ab..87da5ab98c 100644 +--- a/tests/domaincapsdata/qemu_6.0.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_6.0.0.s390x.xml +@@ -273,6 +273,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml +index 6ccc13cf33..bd71e2dece 100644 +--- a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml +@@ -260,6 +260,7 @@ + 450 + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml +index b9a541e4b0..bf9e9d0a57 100644 +--- a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml +@@ -256,6 +256,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml +index de9a53f026..8cb4bcf123 100644 +--- a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml +@@ -269,6 +269,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml +index 2d013e4a04..447db6f15c 100644 +--- a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml +@@ -256,6 +256,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml +index 05dbabfaa6..2b82dbb71d 100644 +--- a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml +@@ -256,6 +256,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml +index 22849abbe9..d3150d048d 100644 +--- a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml +@@ -271,6 +271,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml +index 6ab93b3a8e..a35de809c2 100644 +--- a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml +@@ -218,6 +218,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml +index 6ab93b3a8e..a35de809c2 100644 +--- a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml +@@ -218,6 +218,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +index 6799c988bb..ca4adb7478 100644 +--- a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +@@ -170,6 +170,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml +index 4b431ae978..7973b61852 100644 +--- a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml +@@ -256,6 +256,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml b/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml +index a69e97190b..bfbbbbce69 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-hvf.aarch64+hvf.xml +@@ -172,6 +172,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml +index 8a320eeebc..878cfbb23c 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-q35.x86_64.xml +@@ -266,6 +266,7 @@ +
+ + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml +index 21a8e69ef3..66d19e8ebb 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-tcg.x86_64.xml +@@ -281,6 +281,7 @@ +
+ + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml +index 9a9db9192e..ed9483b9f9 100644 +--- a/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0-virt.aarch64.xml +@@ -217,6 +217,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.0.0.aarch64.xml b/tests/domaincapsdata/qemu_7.0.0.aarch64.xml +index 9a9db9192e..ed9483b9f9 100644 +--- a/tests/domaincapsdata/qemu_7.0.0.aarch64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0.aarch64.xml +@@ -217,6 +217,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.0.0.ppc64.xml b/tests/domaincapsdata/qemu_7.0.0.ppc64.xml +index 857dc47344..60bff5c59b 100644 +--- a/tests/domaincapsdata/qemu_7.0.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0.ppc64.xml +@@ -175,6 +175,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.0.0.x86_64.xml b/tests/domaincapsdata/qemu_7.0.0.x86_64.xml +index 288f3aff03..50efa058b3 100644 +--- a/tests/domaincapsdata/qemu_7.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.0.0.x86_64.xml +@@ -266,6 +266,7 @@ +
+ + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml +index 66c685f7e5..30b5964ba7 100644 +--- a/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0-q35.x86_64.xml +@@ -256,6 +256,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml +index b2fb423dd0..f31dc0df4c 100644 +--- a/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0-tcg.x86_64.xml +@@ -270,6 +270,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.1.0.ppc64.xml b/tests/domaincapsdata/qemu_7.1.0.ppc64.xml +index 3b0b0b959d..0608db7f70 100644 +--- a/tests/domaincapsdata/qemu_7.1.0.ppc64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0.ppc64.xml +@@ -168,6 +168,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.1.0.x86_64.xml b/tests/domaincapsdata/qemu_7.1.0.x86_64.xml +index e7432371dd..17d54905f8 100644 +--- a/tests/domaincapsdata/qemu_7.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.1.0.x86_64.xml +@@ -256,6 +256,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml b/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml +index bd7bc17cb8..31fa321613 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-hvf.x86_64+hvf.xml +@@ -179,6 +179,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml +index a1601974b9..5807276999 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-q35.x86_64.xml +@@ -262,6 +262,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml +index 94c74962da..3f89594b78 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64+hvf.xml +@@ -260,6 +260,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml +index 94c74962da..3f89594b78 100644 +--- a/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.2.0-tcg.x86_64.xml +@@ -260,6 +260,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.2.0.ppc.xml b/tests/domaincapsdata/qemu_7.2.0.ppc.xml +index 6d6b4f3ad8..aa3fb407e7 100644 +--- a/tests/domaincapsdata/qemu_7.2.0.ppc.xml ++++ b/tests/domaincapsdata/qemu_7.2.0.ppc.xml +@@ -154,6 +154,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_7.2.0.x86_64.xml b/tests/domaincapsdata/qemu_7.2.0.x86_64.xml +index 1a24731d8c..d8ab4ff4b7 100644 +--- a/tests/domaincapsdata/qemu_7.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_7.2.0.x86_64.xml +@@ -262,6 +262,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml +index 9c0e57efb4..b52309fccf 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml +@@ -263,6 +263,7 @@ + + + ++ + + + relaxed +diff --git a/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml b/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml +index 7608db45b7..db7a9a5a41 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-tcg-virt.riscv64.xml +@@ -155,6 +155,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml +index 386b49beb7..2d240fd686 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml +@@ -265,6 +265,7 @@ + + + ++ + + + relaxed +diff --git a/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml b/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml +index a5cf95dc9d..144e851283 100644 +--- a/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0-virt.riscv64.xml +@@ -158,6 +158,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_8.0.0.x86_64.xml b/tests/domaincapsdata/qemu_8.0.0.x86_64.xml +index 5a68b9235f..c507a76cce 100644 +--- a/tests/domaincapsdata/qemu_8.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.0.0.x86_64.xml +@@ -263,6 +263,7 @@ + + + ++ + + + relaxed +diff --git a/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml +index 3d79376162..fa24e28c54 100644 +--- a/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml +@@ -265,6 +265,7 @@ + + + ++ + + + relaxed +diff --git a/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml +index b69f776874..df327c4080 100644 +--- a/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml +@@ -266,6 +266,7 @@ + + + ++ + + + relaxed +diff --git a/tests/domaincapsdata/qemu_8.1.0.s390x.xml b/tests/domaincapsdata/qemu_8.1.0.s390x.xml +index 660897f552..4ba86534b5 100644 +--- a/tests/domaincapsdata/qemu_8.1.0.s390x.xml ++++ b/tests/domaincapsdata/qemu_8.1.0.s390x.xml +@@ -280,6 +280,7 @@ + + + ++ + + + +diff --git a/tests/domaincapsdata/qemu_8.1.0.x86_64.xml b/tests/domaincapsdata/qemu_8.1.0.x86_64.xml +index d68b670b92..8db9e84bc4 100644 +--- a/tests/domaincapsdata/qemu_8.1.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.1.0.x86_64.xml +@@ -265,6 +265,7 @@ + + + ++ + + + relaxed +diff --git a/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml +index f9ed4492b8..0b295f15b7 100644 +--- a/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml +@@ -267,6 +267,7 @@ + + + ++ + + + relaxed +diff --git a/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml +index b7867cec90..1ba8f28830 100644 +--- a/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml +@@ -266,6 +266,7 @@ + + + ++ + + + relaxed +diff --git a/tests/domaincapsdata/qemu_8.2.0.x86_64.xml b/tests/domaincapsdata/qemu_8.2.0.x86_64.xml +index d8929616dc..c13d83984a 100644 +--- a/tests/domaincapsdata/qemu_8.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_8.2.0.x86_64.xml +@@ -267,6 +267,7 @@ + + + ++ + + + relaxed +-- +2.33.0 + diff --git a/v4-3-4-src-Add-ARM-CCA-support-in-domain-schema.patch b/v4-3-4-src-Add-ARM-CCA-support-in-domain-schema.patch new file mode 100644 index 0000000000000000000000000000000000000000..7f4822984515cf1c4150ef59ff3090df7df44054 --- /dev/null +++ b/v4-3-4-src-Add-ARM-CCA-support-in-domain-schema.patch @@ -0,0 +1,325 @@ +From 973ed80015aad94ddbd2a73774d92c8623bcdaa5 Mon Sep 17 00:00:00 2001 +From: Kazuhiro Abe +Date: Thu, 21 Aug 2025 21:20:01 +0800 +Subject: [PATCH 5/5] [v4-3-4]src: Add ARM CCA support in domain schema + +bugzilla:https://gitee.com/openeuler/libvirt/issues/ICU4UF?from=project-issue +reference:https://patchew.org/Libvirt/20250612071418.2926384-1-fj1078ii@aa.jp.fujitsu.com/ + +-------------------------------- + +- Add ARM CCA support in domain schema files. + +Signed-off-by: Kazuhiro Abe + +reference:https://patchew.org/Libvirt/20250612071418.2926384-1-fj1078ii@aa.jp.fujitsu.com/ +Signed-off-by: Xu Raoqing +--- + src/conf/schemas/domaincaps.rng | 36 ++++++++++ + src/conf/schemas/domaincommon.rng | 26 +++++++ + src/qemu/qemu_capabilities.c | 113 ++++++++++++++++++++++++++++++ + src/qemu/qemu_capabilities.h | 3 + + 4 files changed, 178 insertions(+) + +diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.rng +index 317c3d4e96..7b6f4e7792 100644 +--- a/src/conf/schemas/domaincaps.rng ++++ b/src/conf/schemas/domaincaps.rng +@@ -321,6 +321,9 @@ + + + ++ ++ ++ + + + +@@ -436,6 +439,39 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ measurement-algo ++ ++ ++ ++ sha256 ++ ++ ++ sha512 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng +index 1b2256fddf..ad3c221432 100644 +--- a/src/conf/schemas/domaincommon.rng ++++ b/src/conf/schemas/domaincommon.rng +@@ -1958,6 +1958,9 @@ + + + ++ ++ ++ + + + +@@ -2556,6 +2559,29 @@ + + + ++ ++ ++ ++ cca ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 556a30e0ff..90fb603adf 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -1937,6 +1937,34 @@ virQEMUCapsVIRTCCAInfoCopy(virVIRTCCACapability **dst, + } + + ++static void ++virQEMUCapsCCAInfoCopy(virCCACapability **dst, ++ virCCACapability *src) ++{ ++ g_autoptr(virCCACapability) tmp = NULL; ++ size_t i; ++ ++ if (!src) { ++ *dst = NULL; ++ return; ++ } ++ ++ tmp = g_new0(virCCACapability, 1); ++ ++ tmp->nCcaMeasurementAlgo = src->nCcaMeasurementAlgo; ++ ++ if (tmp->nCcaMeasurementAlgo != 0) { ++ tmp->ccaMeasurementAlgo = g_new0(char *, tmp->nCcaMeasurementAlgo); ++ ++ for (i = 0; i < tmp->nCcaMeasurementAlgo; i++) { ++ tmp->ccaMeasurementAlgo[i] = g_strdup(src->ccaMeasurementAlgo[i]); ++ } ++ } ++ ++ *dst = g_steal_pointer(&tmp); ++} ++ ++ + static void + virQEMUCapsAccelCopyMachineTypes(virQEMUCapsAccel *dst, + virQEMUCapsAccel *src) +@@ -2015,6 +2043,9 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTCCA)) + virQEMUCapsVIRTCCAInfoCopy(&ret->virtccaCapabilities, qemuCaps->virtccaCapabilities); + ++ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCA_GUEST)) ++ virQEMUCapsCCAInfoCopy(&ret->ccaCapabilities, qemuCaps->ccaCapabilities); ++ + ret->hypervCapabilities = g_memdup(qemuCaps->hypervCapabilities, + sizeof(virDomainCapsFeatureHyperv)); + +@@ -2602,6 +2633,13 @@ virQEMUCapsGetSGXCapabilities(virQEMUCaps *qemuCaps) + } + + ++virCCACapability * ++virQEMUCapsGetCCACapabilities(virQEMUCaps *qemuCaps) ++{ ++ return qemuCaps->ccaCapabilities; ++} ++ ++ + static int + virQEMUCapsProbeQMPObjectTypes(virQEMUCaps *qemuCaps, + qemuMonitor *mon) +@@ -4460,6 +4498,38 @@ virQEMUCapsParseVIRTCCAInfo(virQEMUCaps *qemuCaps, + } + + ++static int ++virQEMUCapsParseCCAInfo(virQEMUCaps *qemuCaps, ++ xmlXPathContextPtr ctxt) ++{ ++ g_autofree xmlNodePtr *nodes = NULL; ++ size_t i; ++ int n; ++ ++ if ((n = virXPathNodeSet("./cca", ctxt, &nodes)) < 0) ++ return -1; ++ ++ if (n > 0) { ++ g_autoptr(virCCACapability) tmp = g_new0(virCCACapability, 1); ++ tmp->ccaMeasurementAlgo = g_new0(char *, n); ++ ++ for (i = 0; i < n; i++) { ++ char *malgo = NULL; ++ if (!(malgo = virXMLPropString(nodes[i], "measurement-algo"))) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("missing CCA measurement-algo in QEMU capabilities cache")); ++ return -1; ++ } ++ ++ tmp->ccaMeasurementAlgo[i] = g_strdup(malgo); ++ } ++ tmp->nCcaMeasurementAlgo = n; ++ qemuCaps->ccaCapabilities = g_steal_pointer(&tmp); ++ } ++ return 0; ++} ++ ++ + static int + virQEMUCapsParseHypervCapabilities(virQEMUCaps *qemuCaps, + xmlXPathContextPtr ctxt) +@@ -4789,6 +4859,9 @@ virQEMUCapsLoadCache(virArch hostArch, + if (virQEMUCapsParseVIRTCCAInfo(qemuCaps, ctxt) < 0) + return -1; + ++ if (virQEMUCapsParseCCAInfo(qemuCaps, ctxt) < 0) ++ return -1; ++ + if (virQEMUCapsParseHypervCapabilities(qemuCaps, ctxt) < 0) + return -1; + +@@ -5025,6 +5098,23 @@ virQEMUCapsFormatVIRTCCAInfo(virBuffer *buf) + } + + ++static void ++virQEMUCapsFormatCCAInfo(virQEMUCaps *qemuCaps, virBuffer *buf) ++{ ++ virCCACapability *cca = virQEMUCapsGetCCACapabilities(qemuCaps); ++ size_t i; ++ size_t n; ++ ++ n = cca->nCcaMeasurementAlgo; ++ ++ if (n != 0) { ++ for (i = 0; i < n; i++) { ++ virBufferAsprintf(buf, "\n", cca->ccaMeasurementAlgo[i]); ++ } ++ } ++} ++ ++ + static void + virQEMUCapsFormatHypervCapabilities(virQEMUCaps *qemuCaps, + virBuffer *buf) +@@ -5136,6 +5226,9 @@ virQEMUCapsFormatCache(virQEMUCaps *qemuCaps) + if (qemuCaps->virtccaCapabilities) + virQEMUCapsFormatVIRTCCAInfo(&buf); + ++ if (qemuCaps->ccaCapabilities) ++ virQEMUCapsFormatCCAInfo(qemuCaps, &buf); ++ + if (qemuCaps->hypervCapabilities) + virQEMUCapsFormatHypervCapabilities(qemuCaps, &buf); + +@@ -6637,6 +6730,8 @@ virQEMUCapsFillDomainLaunchSecurity(virQEMUCaps *qemuCaps, + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT)) + VIR_DOMAIN_CAPS_ENUM_SET(launchSecurity->sectype, VIR_DOMAIN_LAUNCH_SECURITY_PV); ++ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCA_GUEST)) ++ VIR_DOMAIN_CAPS_ENUM_SET(launchSecurity->sectype, VIR_DOMAIN_LAUNCH_SECURITY_CCA); + + if (launchSecurity->sectype.values == 0) { + launchSecurity->supported = VIR_TRISTATE_BOOL_NO; +@@ -6796,6 +6891,23 @@ virQEMUCapsFillDomainFeatureSGXCaps(virQEMUCaps *qemuCaps, + } + + ++/** ++ * virQEMUCapsFillDomainFeatureCCACaps: ++ * @qemuCaps: QEMU capabilities ++ * @domCaps: domain capabilities ++ * ++ * Take the information about CCA capabilities that has been obtained ++ * using the 'query-cca-capabilities' QMP command and stored in @qemuCaps ++ * and convert it to a form suitable for @domCaps. ++ */ ++static void ++virQEMUCapsFillDomainFeatureCCACaps(virQEMUCaps *qemuCaps, ++ virDomainCaps *domCaps) ++{ ++ virQEMUCapsCCAInfoCopy(&domCaps->cca, qemuCaps->ccaCapabilities); ++} ++ ++ + static void + virQEMUCapsFillDomainFeatureHypervCaps(virQEMUCaps *qemuCaps, + virDomainCaps *domCaps) +@@ -6863,6 +6975,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, + virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps); + virQEMUCapsFillDomainFeatureS390PVCaps(qemuCaps, domCaps); + virQEMUCapsFillDomainFeatureSGXCaps(qemuCaps, domCaps); ++ virQEMUCapsFillDomainFeatureCCACaps(qemuCaps, domCaps); + virQEMUCapsFillDomainFeatureHypervCaps(qemuCaps, domCaps); + virQEMUCapsFillDomainDeviceCryptoCaps(qemuCaps, crypto); + virQEMUCapsFillDomainFeatureVIRTCCACaps(qemuCaps, domCaps); +diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h +index 0096c0bb4c..e4a97bc491 100644 +--- a/src/qemu/qemu_capabilities.h ++++ b/src/qemu/qemu_capabilities.h +@@ -885,6 +885,9 @@ virQEMUCapsGetSEVCapabilities(virQEMUCaps *qemuCaps); + virSGXCapability * + virQEMUCapsGetSGXCapabilities(virQEMUCaps *qemuCaps); + ++virCCACapability * ++virQEMUCapsGetCCACapabilities(virQEMUCaps *qemuCaps); ++ + bool + virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuCaps) G_NO_INLINE; + +-- +2.33.0 + diff --git a/virtcca-use-hugepage-disable-bind-numa.patch b/virtcca-use-hugepage-disable-bind-numa.patch new file mode 100644 index 0000000000000000000000000000000000000000..47b6e78e0f39ff0462394110352d11b9fed321f5 --- /dev/null +++ b/virtcca-use-hugepage-disable-bind-numa.patch @@ -0,0 +1,32 @@ +From af954cfd3f9eba47250081b0ba4c46ec5f434246 Mon Sep 17 00:00:00 2001 +From: liuhao365 +Date: Thu, 12 Jun 2025 10:01:09 +0800 +Subject: [PATCH] virtcca use hugepage disable bind numa + Signed-off-by:lh + +--- + src/qemu/qemu_process.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 49eaed4d6f..5240fbce09 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -2636,9 +2636,11 @@ qemuProcessSetupPid(virDomainObj *vm, + virDomainCgroupSetupCpusetCpus(cgroup, use_cpumask) < 0) + goto cleanup; + +- if (mem_mask && virCgroupSetCpusetMems(cgroup, mem_mask) < 0) +- goto cleanup; +- ++ if (!vm->def->sec || ++ vm->def->sec->sectype != VIR_DOMAIN_LAUNCH_SECURITY_CVM) { ++ if (mem_mask && virCgroupSetCpusetMems(cgroup, mem_mask) < 0) ++ goto cleanup; ++ } + } + + if (virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) +-- +2.33.0 +