diff --git a/.gitignore b/.gitignore index 75dd19b..fc71b27 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -libvirt-11.5.0.tar.xz +libvirt-11.10.0.tar.xz diff --git a/libvirt-Expose-latency-histograms-via-virConnectGetAllDomainStats.patch b/libvirt-Expose-latency-histograms-via-virConnectGetAllDomainStats.patch new file mode 100644 index 0000000..fd28497 --- /dev/null +++ b/libvirt-Expose-latency-histograms-via-virConnectGetAllDomainStats.patch @@ -0,0 +1,248 @@ +From 48f5933f6cd6f53997823cfe2a277b822b00264f Mon Sep 17 00:00:00 2001 +Message-ID: <48f5933f6cd6f53997823cfe2a277b822b00264f.1771336681.git.jdenemar@redhat.com> +From: Peter Krempa +Date: Thu, 29 Jan 2026 18:10:26 +0100 +Subject: [PATCH] Expose latency histograms via 'virConnectGetAllDomainStats' + +Add documentation and constants for constructing the stats field names +for latency histograms and expose them in the qemu driver: + +Example: + + block.1.latency_histogram.read.bin.count=9 + block.1.latency_histogram.read.bin.0.start=0 + block.1.latency_histogram.read.bin.0.value=0 + block.1.latency_histogram.read.bin.1.start=10 + block.1.latency_histogram.read.bin.1.value=0 + block.1.latency_histogram.read.bin.2.start=100 + block.1.latency_histogram.read.bin.2.value=0 + block.1.latency_histogram.read.bin.3.start=1000 + block.1.latency_histogram.read.bin.3.value=1047 + block.1.latency_histogram.read.bin.4.start=10000 + block.1.latency_histogram.read.bin.4.value=2131 + block.1.latency_histogram.read.bin.5.start=100000 + block.1.latency_histogram.read.bin.5.value=0 + block.1.latency_histogram.read.bin.6.start=1000000 + block.1.latency_histogram.read.bin.6.value=0 + block.1.latency_histogram.read.bin.7.start=10000000 + block.1.latency_histogram.read.bin.7.value=0 + block.1.latency_histogram.read.bin.8.start=100000000 + block.1.latency_histogram.read.bin.8.value=0 + +Signed-off-by: Peter Krempa +Reviewed-by: Michal Privoznik +(cherry picked from commit 237e49127a9390f054e33e689ba9db1587cdc9f1) + +https://issues.redhat.com/browse/RHEL-147866 [rhel-9.8] +https://issues.redhat.com/browse/RHEL-131335 [rhel-10.2] +--- + docs/manpages/virsh.rst | 7 ++ + include/libvirt/libvirt-domain.h | 113 +++++++++++++++++++++++++++++++ + src/qemu/qemu_driver.c | 43 ++++++++++++ + 3 files changed, 163 insertions(+) + +diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst +index a9d691824e..ff0cf1a715 100644 +--- a/docs/manpages/virsh.rst ++++ b/docs/manpages/virsh.rst +@@ -2811,6 +2811,13 @@ Information listed includes: + pending write operations in the defined interval + * ``block..timed_group..zone_append_queue_depth_avg`` - average number + of pending zone append operations in the defined interval ++* ``block..latency_histogram..bin.count`` - number of bins in ++ latency histogram. is one of ``read``, ``write``, ``zone_append``, or ++ ``flush`` ++* ``block..latency_histogram..bin..start`` start boundary of ++ a latency histogram bin in nanoseconds of given operation duration ++* ``block..latency_histogram..bin..value`` current number of ++ events corresponding to the given bin and type + + + *--iothread* returns information about IOThreads on the running guest +diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h +index 16fac6b085..8e62bd23d4 100644 +--- a/include/libvirt/libvirt-domain.h ++++ b/include/libvirt/libvirt-domain.h +@@ -3815,6 +3815,119 @@ struct _virDomainStatsRecord { + */ + # define VIR_DOMAIN_STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_ZONE_APPEND_QUEUE_DEPTH_AVG ".zone_append_queue_depth_avg" + ++/** ++ * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIX: ++ * ++ * The parameter name prefix to access 'read' latency histograms. Concatenate ++ * the prefix with either: ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT ++ * to get the number of bins in given histogram ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX and ++ * entry number formatted as an unsigned integer and one of the latency ++ * histogram suffix parameters to compelte a full bin parameter name ++ * ++ * Since: 12.1.0 ++ */ ++# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIX ".latency_histogram.read." ++ ++/** ++ * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIX: ++ * ++ * The parameter name prefix to access 'write' latency histograms. Concatenate ++ * the prefix with either: ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT ++ * to get the number of bins in given histogram ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX and ++ * entry number formatted as an unsigned integer and one of the latency ++ * histogram suffix parameters to compelte a full bin parameter name ++ * ++ * Since: 12.1.0 ++ */ ++# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIX ".latency_histogram.write." ++ ++/** ++ * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFIX: ++ * ++ * The parameter name prefix to access 'zone_append' latency histograms. Concatenate ++ * the prefix with either: ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT ++ * to get the number of bins in given histogram ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX and ++ * entry number formatted as an unsigned integer and one of the latency ++ * histogram suffix parameters to compelte a full bin parameter name ++ * ++ * Since: 12.1.0 ++ */ ++# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFIX ".latency_histogram.zone_append." ++ ++/** ++ * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIX: ++ * ++ * The parameter name prefix to access 'flush' latency histograms. Concatenate ++ * the prefix with either: ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT ++ * to get the number of bins in given histogram ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX and ++ * entry number formatted as an unsigned integer and one of the latency ++ * histogram suffix parameters to compelte a full bin parameter name ++ * ++ * Since: 12.1.0 ++ */ ++# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIX ".latency_histogram.flush." ++ ++/** ++ * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT: ++ * ++ * The parameter name suffix to access number of bins in one of the following ++ * latency histogram types: ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIX ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIX ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFIX ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIX ++ * ++ * Number of bins in latency histogram as unsigned long long. ++ * ++ * Since: 12.1.0 ++ */ ++# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT "bin.count" ++ ++/** ++ * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX: ++ * ++ * The parameter name suffix to access a latency histogram bin in one of the ++ * following latency histogram types: ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIX ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIX ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFIX ++ * - VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIX ++ * ++ * Concatenate with a bin number as unsigned int and one of the other field ++ * suffixes to access bin parameters. ++ * ++ * Since: 12.1.0 ++ */ ++# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX "bin." ++ ++/** ++ * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX_START: ++ * ++ * Start of the current latency histogram bin in nanoseconds as unsigned long long. ++ * ++ * Since: 12.1.0 ++ */ ++# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX_START ".start" ++ ++/** ++ * VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX_VALUE: ++ * ++ * Current value of the number of occurences of the latency within this bin ++ * as unsigned long long. ++ * ++ * Since: 12.1.0 ++ */ ++# define VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX_VALUE ".value" ++ ++ + /** + * VIR_DOMAIN_STATS_PERF_CMT: + * +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 08a547c546..f3e7410f9e 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -17597,6 +17597,36 @@ qemuDomainGetStatsBlockExportBackendStorage(const char *entryname, + } + + ++static void ++qemuDomainGetStatsBlockExportFrontendLatencyHistogram(struct qemuBlockStatsLatencyHistogram *h, ++ size_t disk_idx, ++ const char *prefix_hist, ++ virTypedParamList *par) ++{ ++ size_t i; ++ ++ if (!h) ++ return; ++ ++ virTypedParamListAddULLong(par, h->nbins, ++ VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu%s" VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNT, ++ disk_idx, prefix_hist); ++ ++ for (i = 0; i < h->nbins; i++) { ++ virTypedParamListAddULLong(par, h->bins[i].start, ++ VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu%s" ++ VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX "%zu" ++ VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX_START, ++ disk_idx, prefix_hist, i); ++ virTypedParamListAddULLong(par, h->bins[i].value, ++ VIR_DOMAIN_STATS_BLOCK_PREFIX "%zu%s" ++ VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIX "%zu" ++ VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX_VALUE, ++ disk_idx, prefix_hist, i); ++ } ++} ++ ++ + static void + qemuDomainGetStatsBlockExportFrontend(const char *frontendname, + GHashTable *stats, +@@ -17721,6 +17751,19 @@ qemuDomainGetStatsBlockExportFrontend(const char *frontendname, + idx, i); + } + } ++ ++ qemuDomainGetStatsBlockExportFrontendLatencyHistogram(en->histogram_read, idx, ++ VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIX, ++ par); ++ qemuDomainGetStatsBlockExportFrontendLatencyHistogram(en->histogram_write, idx, ++ VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIX, ++ par); ++ qemuDomainGetStatsBlockExportFrontendLatencyHistogram(en->histogram_zone, idx, ++ VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFIX, ++ par); ++ qemuDomainGetStatsBlockExportFrontendLatencyHistogram(en->histogram_flush, idx, ++ VIR_DOMAIN_STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIX, ++ par); + } + + +-- +2.53.0 diff --git a/libvirt-Fix-documentation-of-VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES.patch b/libvirt-Fix-documentation-of-VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES.patch new file mode 100644 index 0000000..c4c11df --- /dev/null +++ b/libvirt-Fix-documentation-of-VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES.patch @@ -0,0 +1,73 @@ +From d3c5e531b0798c384c944896194548d89f130452 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Jiri Denemark +Date: Tue, 26 May 2026 15:38:59 +0200 +Subject: [PATCH] Fix documentation of + VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES + +The flag is designed for expanding the CPU model used by host-model. But +the documentation was sometimes describing it as showing all CPU +features supported on the host, which is wrong as the host may support +features that would not be enabled in host-model. + +Signed-off-by: Jiri Denemark +Reviewed-by: Peter Krempa +(cherry picked from commit 090183a7dc4a64cca83937eff9a4e93a45b4d712) + +https://redhat.atlassian.net/browse/RHEL-180449 + +Signed-off-by: Jiri Denemark +--- + docs/manpages/virsh.rst | 5 +++-- + src/libvirt-domain.c | 6 +++--- + tools/virsh-host.c | 2 +- + 3 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst +index 591c47a7ce..cd26425212 100644 +--- a/docs/manpages/virsh.rst ++++ b/docs/manpages/virsh.rst +@@ -640,8 +640,9 @@ flagged as deprecated for the CPU model by the hypervisor. These + features will be paired with the "disable" policy. + + The **--expand-cpu-features** option will cause the host-model CPU definition +-to contain all CPU features supported on the host including those implicitly +-enabled by the selected CPU model. ++to contain all required CPU features including those implicitly enabled by the ++selected CPU model. Without this flag features that are part of the CPU model ++itself will not be listed. + + + pool-capabilities +diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c +index 034f126dd5..e146fa7e82 100644 +--- a/src/libvirt-domain.c ++++ b/src/libvirt-domain.c +@@ -12331,9 +12331,9 @@ virDomainSetUserPassword(virDomainPtr dom, + * passthrough and so on. + * + * If @flags includes VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES, +- * libvirt will explicitly list all CPU features (in host-model CPU definition) +- * that are supported on the host. Without this flag features that are part of +- * the CPU model itself will not be listed. ++ * libvirt will explicitly list all CPU features that will be enabled for ++ * host-model CPU mode. Without this flag features that are part of the CPU ++ * model itself will not be listed. + * + * Returns NULL in case of error or an XML string + * defining the capabilities. +diff --git a/tools/virsh-host.c b/tools/virsh-host.c +index dd98917fa8..5dbeb54ae5 100644 +--- a/tools/virsh-host.c ++++ b/tools/virsh-host.c +@@ -120,7 +120,7 @@ static const vshCmdOptDef opts_domcapabilities[] = { + }, + {.name = "expand-cpu-features", + .type = VSH_OT_BOOL, +- .help = N_("show all features in host CPU model"), ++ .help = N_("expand 'host-model' CPU to also show features enabled by the CPU model"), + }, + {.name = NULL} + }; +-- +2.54.0 diff --git a/libvirt-Introduce-EXPAND_CPU_FEATURES-flag-for-domain-capabilities.patch b/libvirt-Introduce-EXPAND_CPU_FEATURES-flag-for-domain-capabilities.patch new file mode 100644 index 0000000..34cf447 --- /dev/null +++ b/libvirt-Introduce-EXPAND_CPU_FEATURES-flag-for-domain-capabilities.patch @@ -0,0 +1,54 @@ +From 0b61675df4b585e61f911ed953bbbac76c5cfc73 Mon Sep 17 00:00:00 2001 +Message-ID: <0b61675df4b585e61f911ed953bbbac76c5cfc73.1774618368.git.jdenemar@redhat.com> +From: Jiri Denemark +Date: Wed, 11 Mar 2026 11:31:06 +0100 +Subject: [PATCH] Introduce EXPAND_CPU_FEATURES flag for domain capabilities + +The new VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES flag for +virConnectGetDomainCapabilities can be used to request the host-model +CPU definition to include all supported features (normally only extra +features relative to the selected CPU model are listed). + +Signed-off-by: Jiri Denemark +Reviewed-by: Peter Krempa +(cherry picked from commit 8aa13d1b16b08feea37ecacc85540671e7995bb8) + +https://issues.redhat.com/browse/RHEL-154553 + +Signed-off-by: Jiri Denemark +--- + include/libvirt/libvirt-domain.h | 2 ++ + src/libvirt-domain.c | 5 +++++ + 2 files changed, 7 insertions(+) + +diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h +index 221e22443e..0da0a399fe 100644 +--- a/include/libvirt/libvirt-domain.h ++++ b/include/libvirt/libvirt-domain.h +@@ -1517,6 +1517,8 @@ int virDomainMigrateStartPostCopy(virDomainPtr domain, + typedef enum { + /* Report host model with deprecated features disabled. (Since: 11.0.0) */ + VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES = (1 << 0), ++ /* Report all host model CPU features. (Since: 12.2.0) */ ++ VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES = (1 << 1), + } virConnectGetDomainCapabilitiesFlags; + + char * virConnectGetDomainCapabilities(virConnectPtr conn, +diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c +index c7451fee05..034f126dd5 100644 +--- a/src/libvirt-domain.c ++++ b/src/libvirt-domain.c +@@ -12330,6 +12330,11 @@ virDomainSetUserPassword(virDomainPtr dom, + * instance, if host, libvirt and qemu is capable of VFIO + * passthrough and so on. + * ++ * If @flags includes VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES, ++ * libvirt will explicitly list all CPU features (in host-model CPU definition) ++ * that are supported on the host. Without this flag features that are part of ++ * the CPU model itself will not be listed. ++ * + * Returns NULL in case of error or an XML string + * defining the capabilities. + * +-- +2.53.0 diff --git a/libvirt-Introduce-VIR_CONNECT_GET_DOMAIN_CAPABILITIES_SUPPORTED_CPU_FEATURES-flag.patch b/libvirt-Introduce-VIR_CONNECT_GET_DOMAIN_CAPABILITIES_SUPPORTED_CPU_FEATURES-flag.patch new file mode 100644 index 0000000..c51840b --- /dev/null +++ b/libvirt-Introduce-VIR_CONNECT_GET_DOMAIN_CAPABILITIES_SUPPORTED_CPU_FEATURES-flag.patch @@ -0,0 +1,59 @@ +From 2ad60e82218ad8cb7cb333482e143441591b8b4f Mon Sep 17 00:00:00 2001 +Message-ID: <2ad60e82218ad8cb7cb333482e143441591b8b4f.1781277506.git.jdenemar@redhat.com> +From: Jiri Denemark +Date: Fri, 29 May 2026 12:52:39 +0200 +Subject: [PATCH] Introduce + VIR_CONNECT_GET_DOMAIN_CAPABILITIES_SUPPORTED_CPU_FEATURES flag + +Some CPU features may be enabled explicitly, but should not +automatically become part of a host-model CPU. Users can now request +such features to be shown in the host-model CPU in domain capabilities +by VIR_CONNECT_GET_DOMAIN_CAPABILITIES_SUPPORTED_CPU_FEATURES flag. + +Signed-off-by: Jiri Denemark +Reviewed-by: Peter Krempa +(cherry picked from commit e1efd79e837456d209115c536fc7e5f14abcbc63) + +https://redhat.atlassian.net/browse/RHEL-180449 + +Signed-off-by: Jiri Denemark +--- + include/libvirt/libvirt-domain.h | 3 +++ + src/libvirt-domain.c | 8 ++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h +index 0da0a399fe..7f02a48021 100644 +--- a/include/libvirt/libvirt-domain.h ++++ b/include/libvirt/libvirt-domain.h +@@ -1519,6 +1519,9 @@ typedef enum { + VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES = (1 << 0), + /* Report all host model CPU features. (Since: 12.2.0) */ + VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES = (1 << 1), ++ /* Report all CPU features supported on the host, even those that will not ++ * be enabled by host-model CPU mode. (Since: 12.5.0) */ ++ VIR_CONNECT_GET_DOMAIN_CAPABILITIES_SUPPORTED_CPU_FEATURES = (1 << 2), + } virConnectGetDomainCapabilitiesFlags; + + char * virConnectGetDomainCapabilities(virConnectPtr conn, +diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c +index e146fa7e82..0ae48654df 100644 +--- a/src/libvirt-domain.c ++++ b/src/libvirt-domain.c +@@ -12335,6 +12335,14 @@ virDomainSetUserPassword(virDomainPtr dom, + * host-model CPU mode. Without this flag features that are part of the CPU + * model itself will not be listed. + * ++ * Adding VIR_CONNECT_GET_DOMAIN_CAPABILITIES_SUPPORTED_CPU_FEATURES to @flags ++ * tells libvirt to update the host-model CPU definition with features that are ++ * supported on the host, but will not be enabled by default when starting a ++ * domain with host-model CPU. Use both ++ * VIR_CONNECT_GET_DOMAIN_CAPABILITIES_SUPPORTED_CPU_FEATURES and ++ * VIR_CONNECT_GET_DOMAIN_CAPABILITIES_EXPAND_CPU_FEATURES flags to get a ++ * complete list of features that can be enabled on the host. ++ * + * Returns NULL in case of error or an XML string + * defining the capabilities. + * +-- +2.54.0 diff --git a/libvirt-Introduce-support-for-disk-operation-latency-histogram-collection.patch b/libvirt-Introduce-support-for-disk-operation-latency-histogram-collection.patch new file mode 100644 index 0000000..c417f58 --- /dev/null +++ b/libvirt-Introduce-support-for-disk-operation-latency-histogram-collection.patch @@ -0,0 +1,422 @@ +From 8fbea435edb1635ec98c9419e9249223e5c3b2b6 Mon Sep 17 00:00:00 2001 +Message-ID: <8fbea435edb1635ec98c9419e9249223e5c3b2b6.1771336682.git.jdenemar@redhat.com> +From: Peter Krempa +Date: Fri, 23 Jan 2026 17:09:27 +0100 +Subject: [PATCH] Introduce support for disk operation latency histogram + collection + +Add config and docs allowing enabling latency histogram collection for +block device operations. + +This patch sets up the docs, schema and XML infrastructure. + +Signed-off-by: Peter Krempa +Reviewed-by: Michal Privoznik +(cherry picked from commit b874c944bd8c4ffa6c51394557587c8c203f1656) + +https://issues.redhat.com/browse/RHEL-147866 [rhel-9.8] +https://issues.redhat.com/browse/RHEL-131335 [rhel-10.2] +--- + docs/formatdomain.rst | 41 ++++++ + src/conf/domain_conf.c | 133 +++++++++++++++++- + src/conf/domain_conf.h | 7 + + src/conf/schemas/domaincommon.rng | 37 ++++- + ...isk-statistics-intervals.x86_64-latest.xml | 29 ++++ + .../disk-statistics-intervals.xml | 25 ++++ + 6 files changed, 262 insertions(+), 10 deletions(-) + +diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst +index 70882c6820..31232deb3c 100644 +--- a/docs/formatdomain.rst ++++ b/docs/formatdomain.rst +@@ -3628,6 +3628,47 @@ paravirtualized driver is specified via the ``disk`` element. + + :since:`Since 11.9.0 (QEMU 10.2, virtio, ide, scsi disks only)`. + ++ Block operation latency histogram collection can be configured using ++ ```` sub-element. The histogram is collected for ++ the whole runtime of the VM, but can be re-started or reconfigured using ++ the `virDomainUpdateDeviceFlags `__ ++ API. Using the same config re-starts histogram collection. ++ ++ The optional ``type`` attribute configures specific operation to collect ++ the histogram for. Supported types are ``read``, ``write``, ``zone``, and ++ ``flush``. If the ``type`` attribute is omitted the histogram collection ++ bins bins apply to all of the aforementioned types, which can be overriden ++ with specific config. ++ ++ The ```` has multiple mandatory ```` sub-elements ++ with mandatory ``start`` attribute configuring the starting boundary of ++ the histogram bin configured in nanosecods of the operation duration and ++ the intervals must be properly ordered and non-duplicate. ++ ++ Example:: ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ [or for specific operation types] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ :since:`Since 12.1.0`. ++ + - The optional ``queues`` attribute specifies the number of virt queues for + virtio-blk ( :since:`Since 3.9.0` ) or vhost-user-blk + ( :since:`Since 7.1.0` ) +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index f5c4d135a9..83c58ab5ff 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -2445,6 +2445,11 @@ virDomainDiskDefFree(virDomainDiskDef *def) + virObjectUnref(def->privateData); + g_slist_free_full(def->iothreads, (GDestroyNotify) virDomainIothreadMappingDefFree); + g_free(def->statistics); ++ g_free(def->histogram_boundaries); ++ g_free(def->histogram_boundaries_read); ++ g_free(def->histogram_boundaries_write); ++ g_free(def->histogram_boundaries_zone); ++ g_free(def->histogram_boundaries_flush); + + if (def->throttlefilters) { + size_t i; +@@ -8307,6 +8312,91 @@ virDomainIothreadMappingDefParse(xmlNodePtr driverNode, + } + + ++static int ++virDomainDiskDefDriverParseXMLHistogramOne(virDomainDiskDef *def, ++ xmlNodePtr cur) ++{ ++ g_autofree char *histogram_type = NULL; ++ unsigned int **histogram_config = NULL; ++ g_autoptr(GPtrArray) binNodes = virXMLNodeGetSubelementList(cur, "bin"); ++ size_t nbins = 0; ++ size_t i; ++ ++ if ((histogram_type = virXMLPropString(cur, "type"))) { ++ if (STREQ(histogram_type, "read")) { ++ histogram_config = &def->histogram_boundaries_read; ++ } else if (STREQ(histogram_type, "write")) { ++ histogram_config = &def->histogram_boundaries_write; ++ } else if (STREQ(histogram_type, "zone")) { ++ histogram_config = &def->histogram_boundaries_zone; ++ } else if (STREQ(histogram_type, "flush")) { ++ histogram_config = &def->histogram_boundaries_flush; ++ } else { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("unknown latency_histogram type '%1$s'"), ++ histogram_type); ++ return -1; ++ } ++ } else { ++ histogram_config = &def->histogram_boundaries; ++ } ++ ++ if (*histogram_config) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("only one latency-histogram of a given type is supported")); ++ return -1; ++ } ++ ++ if (binNodes->len == 0) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("missing 'bin' elements for 'latency-histogram'")); ++ return -1; ++ } ++ ++ *histogram_config = g_new0(unsigned int, binNodes->len + 1); ++ ++ for (i = 0; i < binNodes->len; i++) { ++ unsigned int val; ++ ++ if (virXMLPropUInt(g_ptr_array_index(binNodes, i), ++ "start", 10, ++ VIR_XML_PROP_REQUIRED, ++ &val) < 0) ++ return -1; ++ ++ if (nbins > 0 && ++ (val == 0 || ++ val <= (*histogram_config)[nbins-1])) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("the values of 'start' attribute of a 'latency-histogram' 'bin' configuration must be sorted and non-overlapping")); ++ return -1; ++ } ++ ++ if (val > 0) ++ (*histogram_config)[nbins++] = val; ++ } ++ ++ return 0; ++} ++ ++ ++static int ++virDomainDiskDefDriverParseXMLHistograms(virDomainDiskDef *def, ++ xmlNodePtr cur) ++{ ++ g_autoptr(GPtrArray) histogramNodes = virXMLNodeGetSubelementList(cur, "latency-histogram"); ++ size_t i; ++ ++ for (i = 0; i < histogramNodes->len; i++) { ++ if (virDomainDiskDefDriverParseXMLHistogramOne(def, ++ g_ptr_array_index(histogramNodes, i)) < 0) ++ return -1; ++ } ++ ++ return 0; ++} ++ ++ + static int + virDomainDiskDefDriverParseXML(virDomainDiskDef *def, + xmlNodePtr cur) +@@ -8380,6 +8470,9 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, + return -1; + } + } ++ ++ if (virDomainDiskDefDriverParseXMLHistograms(def, statisticsNode) < 0) ++ return -1; + } + + if (virXMLPropEnum(cur, "detect_zeroes", +@@ -23961,12 +24054,37 @@ virDomainDiskDefFormatThrottleFilters(virBuffer *buf, + } + + ++static void ++virDomainDiskDefFormatDriverHistogram(virBuffer *buf, ++ const char *type, ++ unsigned int *bins) ++{ ++ g_auto(virBuffer) histogramAttrBuf = VIR_BUFFER_INITIALIZER; ++ g_auto(virBuffer) histogramChildBuf = VIR_BUFFER_INIT_CHILD(buf); ++ ++ if (!bins || bins[0] == 0) ++ return; ++ ++ if (type) ++ virBufferAsprintf(&histogramAttrBuf, " type='%s'", type); ++ ++ /* we dont store the start boundary of the first bin but it's always there */ ++ virBufferAddLit(&histogramChildBuf, "\n"); ++ ++ for (; *bins > 0; bins++) ++ virBufferAsprintf(&histogramChildBuf, "\n", *bins); ++ ++ virXMLFormatElement(buf, "latency-histogram", &histogramAttrBuf, &histogramChildBuf); ++} ++ ++ + static void + virDomainDiskDefFormatDriver(virBuffer *buf, + virDomainDiskDef *disk) + { + g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf); ++ g_auto(virBuffer) statisticsChildBuf = VIR_BUFFER_INIT_CHILD(&childBuf); + + virBufferEscapeString(&attrBuf, " name='%s'", virDomainDiskGetDriver(disk)); + +@@ -24038,16 +24156,25 @@ virDomainDiskDefFormatDriver(virBuffer *buf, + virDomainIothreadMappingDefFormat(&childBuf, disk->iothreads); + + if (disk->statistics) { +- g_auto(virBuffer) statisticsChildBuf = VIR_BUFFER_INIT_CHILD(&childBuf); + size_t i; + + for (i = 0; disk->statistics[i] > 0; i++) + virBufferAsprintf(&statisticsChildBuf, "\n", + disk->statistics[i]); +- +- virXMLFormatElement(&childBuf, "statistics", NULL, &statisticsChildBuf); + } + ++ virDomainDiskDefFormatDriverHistogram(&statisticsChildBuf, NULL, ++ disk->histogram_boundaries); ++ virDomainDiskDefFormatDriverHistogram(&statisticsChildBuf, "read", ++ disk->histogram_boundaries_read); ++ virDomainDiskDefFormatDriverHistogram(&statisticsChildBuf, "write", ++ disk->histogram_boundaries_write); ++ virDomainDiskDefFormatDriverHistogram(&statisticsChildBuf, "zone", ++ disk->histogram_boundaries_zone); ++ virDomainDiskDefFormatDriverHistogram(&statisticsChildBuf, "flush", ++ disk->histogram_boundaries_flush); ++ ++ virXMLFormatElement(&childBuf, "statistics", NULL, &statisticsChildBuf); + + virXMLFormatElement(buf, "driver", &attrBuf, &childBuf); + } +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 8f53ed96c0..b120d4a68e 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -596,6 +596,13 @@ struct _virDomainDiskDef { + GSList *iothreads; /* List of virDomainIothreadMappingDef */ + unsigned int *statistics; /* Optional, zero terminated list of intervals to + collect statistics for */ ++ /* optional zero terminated lists of bin boundaries for latency histograms */ ++ unsigned int *histogram_boundaries; ++ unsigned int *histogram_boundaries_read; ++ unsigned int *histogram_boundaries_write; ++ unsigned int *histogram_boundaries_zone; ++ unsigned int *histogram_boundaries_flush; ++ + virDomainDiskDetectZeroes detect_zeroes; + virTristateSwitch discard_no_unref; + char *domain_name; /* backend domain name */ +diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng +index 1f9ac102a0..441328a08e 100644 +--- a/src/conf/schemas/domaincommon.rng ++++ b/src/conf/schemas/domaincommon.rng +@@ -2728,13 +2728,36 @@ + + + +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ read ++ write ++ zone ++ flush ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +diff --git a/tests/qemuxmlconfdata/disk-statistics-intervals.x86_64-latest.xml b/tests/qemuxmlconfdata/disk-statistics-intervals.x86_64-latest.xml +index 4c55c50ef5..d02f954073 100644 +--- a/tests/qemuxmlconfdata/disk-statistics-intervals.x86_64-latest.xml ++++ b/tests/qemuxmlconfdata/disk-statistics-intervals.x86_64-latest.xml +@@ -22,6 +22,11 @@ + + + ++ ++ ++ ++ ++ + + + +@@ -33,6 +38,30 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +diff --git a/tests/qemuxmlconfdata/disk-statistics-intervals.xml b/tests/qemuxmlconfdata/disk-statistics-intervals.xml +index f5e801f5a8..5f9e9470d7 100644 +--- a/tests/qemuxmlconfdata/disk-statistics-intervals.xml ++++ b/tests/qemuxmlconfdata/disk-statistics-intervals.xml +@@ -19,6 +19,11 @@ + + + ++ ++ ++ ++ ++ + + + +@@ -29,6 +34,26 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +-- +2.53.0 diff --git a/libvirt-RHEL-ONLY-backport-test-data-for-migrate-pr-capability-of-scsi-block.patch b/libvirt-RHEL-ONLY-backport-test-data-for-migrate-pr-capability-of-scsi-block.patch new file mode 100644 index 0000000..de4bb90 --- /dev/null +++ b/libvirt-RHEL-ONLY-backport-test-data-for-migrate-pr-capability-of-scsi-block.patch @@ -0,0 +1,125 @@ +From c2eb6d70891d9be5ce13f07946841239a81c3ed9 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Peter Krempa +Date: Mon, 16 Feb 2026 15:08:54 +0100 +Subject: [PATCH] RHEL-ONLY: backport test data for 'migrate-pr' capability of + 'scsi-block' + +In upstream qemu the capability is present starting with qemu-11.0. We +don't have the test data downstream and backporting them would be too +invasive. Backport the relevant capability detection as a +downstream-only fix. + +https://issues.redhat.com/browse/RHEL-140614 [rhel-9.8] +https://issues.redhat.com/browse/RHEL-135115 [rhel-10.2] + +Signed-off-by: Peter Krempa +--- + .../caps_10.2.0_x86_64.replies | 79 ++++++++++++++++++- + .../caps_10.2.0_x86_64.xml | 1 + + 2 files changed, 76 insertions(+), 4 deletions(-) + +diff --git a/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.replies b/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.replies +index cb4abb4533..10db9baca1 100644 +--- a/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.replies ++++ b/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.replies +@@ -33081,10 +33081,81 @@ + } + + { +- "error": { +- "class": "DeviceNotFound", +- "desc": "The libvirt device dump was not collected for this version+device tuple" +- }, ++ "return": [ ++ { ++ "default-value": 4294967295, ++ "name": "scsi-id", ++ "type": "uint32" ++ }, ++ { ++ "default-value": 4294967295, ++ "name": "lun", ++ "type": "uint32" ++ }, ++ { ++ "default-value": 0, ++ "name": "channel", ++ "type": "uint32" ++ }, ++ { ++ "default-value": "auto", ++ "name": "rerror", ++ "description": "Error handling policy (report/ignore/enospc/stop/auto)", ++ "type": "BlockdevOnError" ++ }, ++ { ++ "default-value": 2147483647, ++ "name": "max_io_size", ++ "type": "uint64" ++ }, ++ { ++ "default-value": false, ++ "name": "share-rw", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": true, ++ "name": "migrate-pr", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": "auto", ++ "name": "werror", ++ "description": "Error handling policy (report/ignore/enospc/stop/auto)", ++ "type": "BlockdevOnError" ++ }, ++ { ++ "default-value": 1073741824, ++ "name": "max_unmap_size", ++ "type": "uint64" ++ }, ++ { ++ "default-value": -1, ++ "name": "scsi_version", ++ "type": "int32" ++ }, ++ { ++ "default-value": 0, ++ "name": "rotation_rate", ++ "type": "uint16" ++ }, ++ { ++ "name": "drive", ++ "description": "Node name or ID of a block device to use as a backend", ++ "type": "str" ++ }, ++ { ++ "default-value": 30, ++ "name": "io_timeout", ++ "type": "uint32" ++ }, ++ { ++ "name": "bootindex", ++ "type": "int32" ++ } ++ ], + "id": "libvirt-37" + } + +diff --git a/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.xml +index 7cff2c2291..7d5a75ce88 100644 +--- a/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.xml +@@ -215,6 +215,7 @@ + + + ++ + 10001091 + 43100287 + v10.2.0-rc1-38-gfb241d0a1f +-- +2.53.0 diff --git a/libvirt-cgroup-Plumb-the-daemonDomainShutdown-parameter-of-virSystemdCreateMachine-to-drivers.patch b/libvirt-cgroup-Plumb-the-daemonDomainShutdown-parameter-of-virSystemdCreateMachine-to-drivers.patch deleted file mode 100644 index 4a31b99..0000000 --- a/libvirt-cgroup-Plumb-the-daemonDomainShutdown-parameter-of-virSystemdCreateMachine-to-drivers.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 5ef229b0035c34fd9b67183d6f0a2b810cc47907 Mon Sep 17 00:00:00 2001 -Message-ID: <5ef229b0035c34fd9b67183d6f0a2b810cc47907.1752837271.git.jdenemar@redhat.com> -From: Peter Krempa -Date: Fri, 27 Jun 2025 14:47:10 +0200 -Subject: [PATCH] cgroup: Plumb the 'daemonDomainShutdown' parameter of - 'virSystemdCreateMachine' to drivers - -Plumb the new argument across the cgroup helpers up to the domain driver -code. - -Signed-off-by: Peter Krempa -Reviewed-by: Pavel Hrdina -(cherry picked from commit fe57a6deaa8ab83ffdb8ed73104196e4b1421893) - -https://issues.redhat.com/browse/RHEL-95361 ---- - src/ch/ch_process.c | 2 ++ - src/hypervisor/domain_cgroup.c | 4 ++++ - src/hypervisor/domain_cgroup.h | 1 + - src/lxc/lxc_cgroup.c | 1 + - src/qemu/qemu_cgroup.c | 1 + - src/util/vircgroup.c | 6 +++++- - src/util/vircgroup.h | 1 + - 7 files changed, 15 insertions(+), 1 deletion(-) - -diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c -index 95c808cb41..cc84823fdc 100644 ---- a/src/ch/ch_process.c -+++ b/src/ch/ch_process.c -@@ -973,6 +973,7 @@ virCHProcessStart(virCHDriver *driver, - cfg->cgroupControllers, - 0, /*maxThreadsPerProc*/ - priv->driver->privileged, -+ false, - priv->machineName) < 0) - goto cleanup; - -@@ -1147,6 +1148,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDomainObj *vm, const char *from - cfg->cgroupControllers, - 0, /*maxThreadsPerProc*/ - priv->driver->privileged, -+ false, - priv->machineName) < 0) - goto cleanup; - -diff --git a/src/hypervisor/domain_cgroup.c b/src/hypervisor/domain_cgroup.c -index fecc0f7966..8787165f48 100644 ---- a/src/hypervisor/domain_cgroup.c -+++ b/src/hypervisor/domain_cgroup.c -@@ -351,6 +351,7 @@ virDomainCgroupInitCgroup(const char *prefix, - int cgroupControllers, - unsigned int maxThreadsPerProc, - bool privileged, -+ bool daemonDomainShutdown, - char *machineName) - { - if (!privileged) -@@ -384,6 +385,7 @@ virDomainCgroupInitCgroup(const char *prefix, - vm->def->resource->partition, - cgroupControllers, - maxThreadsPerProc, -+ daemonDomainShutdown, - cgroup) < 0) { - if (virCgroupNewIgnoreError()) - return 0; -@@ -513,6 +515,7 @@ virDomainCgroupSetupCgroup(const char *prefix, - int cgroupControllers, - unsigned int maxThreadsPerProc, - bool privileged, -+ bool daemonDomainShutdown, - char *machineName) - { - if (vm->pid == 0) { -@@ -529,6 +532,7 @@ virDomainCgroupSetupCgroup(const char *prefix, - cgroupControllers, - maxThreadsPerProc, - privileged, -+ daemonDomainShutdown, - machineName) < 0) - return -1; - -diff --git a/src/hypervisor/domain_cgroup.h b/src/hypervisor/domain_cgroup.h -index 6e5c98004e..7769572a2c 100644 ---- a/src/hypervisor/domain_cgroup.h -+++ b/src/hypervisor/domain_cgroup.h -@@ -71,6 +71,7 @@ virDomainCgroupSetupCgroup(const char *prefix, - int cgroupControllers, - unsigned int maxThreadsPerProc, - bool privileged, -+ bool daemonDomainShutdown, - char *machineName); - void - virDomainCgroupEmulatorAllNodesDataFree(virCgroupEmulatorAllNodesData *data); -diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c -index 7c889667ba..f566a5468e 100644 ---- a/src/lxc/lxc_cgroup.c -+++ b/src/lxc/lxc_cgroup.c -@@ -400,6 +400,7 @@ virCgroup *virLXCCgroupCreate(virDomainDef *def, - def->resource->partition, - -1, - 0, -+ false, - &cgroup) < 0) - return NULL; - -diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c -index 48af467bf9..04d6370011 100644 ---- a/src/qemu/qemu_cgroup.c -+++ b/src/qemu/qemu_cgroup.c -@@ -919,6 +919,7 @@ qemuSetupCgroup(virDomainObj *vm, - cfg->cgroupControllers, - cfg->maxThreadsPerProc, - priv->driver->privileged, -+ false, - priv->machineName) < 0) - - return -1; -diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c -index fc5dca4858..532a7e5690 100644 ---- a/src/util/vircgroup.c -+++ b/src/util/vircgroup.c -@@ -1274,6 +1274,7 @@ virCgroupNewMachineSystemd(const char *name, - const char *partition, - int controllers, - unsigned int maxthreads, -+ bool daemonDomainShutdown, - virCgroup **group) - { - int rv; -@@ -1294,7 +1295,7 @@ virCgroupNewMachineSystemd(const char *name, - nicindexes, - partition, - maxthreads, -- false)) < 0) -+ daemonDomainShutdown)) < 0) - return rv; - - if (controllers != -1) -@@ -1407,6 +1408,7 @@ virCgroupNewMachine(const char *name, - const char *partition, - int controllers, - unsigned int maxthreads, -+ bool daemonDomainShutdown, - virCgroup **group) - { - int rv; -@@ -1424,6 +1426,7 @@ virCgroupNewMachine(const char *name, - partition, - controllers, - maxthreads, -+ daemonDomainShutdown, - group)) == 0) - return 0; - -@@ -3144,6 +3147,7 @@ virCgroupNewMachine(const char *name G_GNUC_UNUSED, - const char *partition G_GNUC_UNUSED, - int controllers G_GNUC_UNUSED, - unsigned int maxthreads G_GNUC_UNUSED, -+ bool daemonDomainShutdown G_GNUC_UNUSED, - virCgroup **group G_GNUC_UNUSED) - { - virReportSystemError(ENXIO, "%s", -diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h -index adf3850b22..2a7aa3306c 100644 ---- a/src/util/vircgroup.h -+++ b/src/util/vircgroup.h -@@ -101,6 +101,7 @@ int virCgroupNewMachine(const char *name, - const char *partition, - int controllers, - unsigned int maxthreads, -+ bool daemonDomainShutdown, - virCgroup **group) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) - ATTRIBUTE_NONNULL(3); --- -2.50.1 diff --git a/libvirt-cgroup-Unexport-virDomainCgroupInitCgroup.patch b/libvirt-cgroup-Unexport-virDomainCgroupInitCgroup.patch deleted file mode 100644 index 9be80de..0000000 --- a/libvirt-cgroup-Unexport-virDomainCgroupInitCgroup.patch +++ /dev/null @@ -1,68 +0,0 @@ -From c7889487359bff14c6d4b236055acfee68da66ae Mon Sep 17 00:00:00 2001 -Message-ID: -From: Peter Krempa -Date: Thu, 26 Jun 2025 18:24:06 +0200 -Subject: [PATCH] cgroup: Unexport 'virDomainCgroupInitCgroup' - -The function is called just from one place within the module where it's -defined. - -Signed-off-by: Peter Krempa -Reviewed-by: Pavel Hrdina -(cherry picked from commit 3e0859566a164f640e75889d08241844b5e61bf8) - -https://issues.redhat.com/browse/RHEL-95361 ---- - src/hypervisor/domain_cgroup.c | 2 +- - src/hypervisor/domain_cgroup.h | 10 ---------- - src/libvirt_private.syms | 1 - - 3 files changed, 1 insertion(+), 12 deletions(-) - -diff --git a/src/hypervisor/domain_cgroup.c b/src/hypervisor/domain_cgroup.c -index fda495faf5..fecc0f7966 100644 ---- a/src/hypervisor/domain_cgroup.c -+++ b/src/hypervisor/domain_cgroup.c -@@ -342,7 +342,7 @@ virDomainCgroupSetupCpuCgroup(virDomainObj *vm, - } - - --int -+static int - virDomainCgroupInitCgroup(const char *prefix, - virDomainObj *vm, - size_t nnicindexes, -diff --git a/src/hypervisor/domain_cgroup.h b/src/hypervisor/domain_cgroup.h -index f8d261a080..6e5c98004e 100644 ---- a/src/hypervisor/domain_cgroup.h -+++ b/src/hypervisor/domain_cgroup.h -@@ -52,16 +52,6 @@ virDomainCgroupSetupCpusetCgroup(virCgroup *cgroup); - int - virDomainCgroupSetupCpuCgroup(virDomainObj *vm, - virCgroup *cgroup); --int --virDomainCgroupInitCgroup(const char *prefix, -- virDomainObj *vm, -- size_t nnicindexes, -- int *nicindexes, -- virCgroup **cgroup, -- int cgroupControllers, -- unsigned int maxThreadsPerProc, -- bool privileged, -- char *machineName); - void - virDomainCgroupRestoreCgroupState(virDomainObj *vm, - virCgroup *cgroup); -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index a8ebf9efd8..8f1489ecc8 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -1641,7 +1641,6 @@ virSetConnectStorage; - virDomainCgroupConnectCgroup; - virDomainCgroupEmulatorAllNodesAllow; - virDomainCgroupEmulatorAllNodesRestore; --virDomainCgroupInitCgroup; - virDomainCgroupRemoveCgroup; - virDomainCgroupSetMemoryLimitParameters; - virDomainCgroupSetupBlkio; --- -2.50.1 diff --git a/libvirt-conf-Add-Intel-TDX-Quote-Generation-Service-QGS-support.patch b/libvirt-conf-Add-Intel-TDX-Quote-Generation-Service-QGS-support.patch deleted file mode 100644 index d222d43..0000000 --- a/libvirt-conf-Add-Intel-TDX-Quote-Generation-Service-QGS-support.patch +++ /dev/null @@ -1,141 +0,0 @@ -From 19ca835c960b1b391d7926a5c860b73d2751a555 Mon Sep 17 00:00:00 2001 -Message-ID: <19ca835c960b1b391d7926a5c860b73d2751a555.1759908360.git.jdenemar@redhat.com> -From: Zhenzhong Duan -Date: Thu, 10 Jul 2025 03:21:16 -0400 -Subject: [PATCH] conf: Add Intel TDX Quote Generation Service(QGS) support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add element "quoteGenerationService" to tdx launch security type. -It contains only an optional unix socket address attribute, -when omitted, libvirt will use default QGS server address -"/var/run/tdx-qgs/qgs.socket". - -UNIX sockets offer the required functionality with greater -security than vsock, so libvirt only provides support for unix -socket. - -XML example: - - - 0x10000001 - xxx - xxx - xxx - - - -Reviewed-by: Daniel P. Berrangé -Signed-off-by: Zhenzhong Duan -(cherry picked from commit 8214980432191138f052c2e32d12ae284597c8b8) -Resolves: https://issues.redhat.com/browse/RHEL-111863 -Signed-off-by: Paolo Bonzini ---- - src/conf/domain_conf.c | 35 ++++++++++++++++++++++++++++++- - src/conf/domain_conf.h | 2 ++ - src/conf/schemas/domaincommon.rng | 9 ++++++++ - 3 files changed, 45 insertions(+), 1 deletion(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index d2f01a9397..3eb3ab35f1 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -3963,6 +3963,7 @@ virDomainSecDefFree(virDomainSecDef *def) - g_free(def->data.tdx.mrconfigid); - g_free(def->data.tdx.mrowner); - g_free(def->data.tdx.mrownerconfig); -+ g_free(def->data.tdx.qgs_unix_path); - break; - case VIR_DOMAIN_LAUNCH_SECURITY_PV: - case VIR_DOMAIN_LAUNCH_SECURITY_NONE: -@@ -14210,6 +14211,33 @@ virDomainSEVSNPDefParseXML(virDomainSEVSNPDef *def, - } - - -+static int -+virDomainTDXQGSDefParseXML(virDomainTDXDef *def, xmlXPathContextPtr ctxt) -+{ -+ g_autofree xmlNodePtr *nodes = NULL; -+ xmlNodePtr node; -+ int n; -+ -+ if ((n = virXPathNodeSet("./quoteGenerationService", ctxt, &nodes)) < 0) -+ return -1; -+ -+ if (!n) -+ return 0; -+ -+ if (n > 1) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("only a single QGS element is supported")); -+ return -1; -+ } -+ node = nodes[0]; -+ -+ def->haveQGS = true; -+ def->qgs_unix_path = virXMLPropString(node, "path"); -+ -+ return 0; -+} -+ -+ - static int - virDomainTDXDefParseXML(virDomainTDXDef *def, - xmlXPathContextPtr ctxt) -@@ -14229,7 +14257,7 @@ virDomainTDXDefParseXML(virDomainTDXDef *def, - def->mrowner = virXPathString("string(./mrOwner)", ctxt); - def->mrownerconfig = virXPathString("string(./mrOwnerConfig)", ctxt); - -- return 0; -+ return virDomainTDXQGSDefParseXML(def, ctxt); - } - - -@@ -27746,6 +27774,11 @@ virDomainTDXDefFormat(virBuffer *childBuf, virDomainTDXDef *def) - virBufferEscapeString(childBuf, "%s\n", def->mrconfigid); - virBufferEscapeString(childBuf, "%s\n", def->mrowner); - virBufferEscapeString(childBuf, "%s\n", def->mrownerconfig); -+ if (def->haveQGS) { -+ virBufferAddLit(childBuf, "qgs_unix_path); -+ virBufferAddLit(childBuf, "/>\n"); -+ } - } - - -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 51c05a3f18..cf5437f642 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -3005,6 +3005,8 @@ struct _virDomainTDXDef { - char *mrconfigid; - char *mrowner; - char *mrownerconfig; -+ bool haveQGS; -+ char *qgs_unix_path; - }; - - -diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng -index 56dbddcb43..0e13f79e99 100644 ---- a/src/conf/schemas/domaincommon.rng -+++ b/src/conf/schemas/domaincommon.rng -@@ -673,6 +673,15 @@ - - - -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - --- -2.51.0 diff --git a/libvirt-conf-Add-firmwareFeatures-element-for-domaincaps.patch b/libvirt-conf-Add-firmwareFeatures-element-for-domaincaps.patch new file mode 100644 index 0000000..8896e29 --- /dev/null +++ b/libvirt-conf-Add-firmwareFeatures-element-for-domaincaps.patch @@ -0,0 +1,85 @@ +From 271cfe0d7954d5398af307b24fc5b601977975b8 Mon Sep 17 00:00:00 2001 +Message-ID: <271cfe0d7954d5398af307b24fc5b601977975b8.1772815313.git.jdenemar@redhat.com> +From: Andrea Bolognani +Date: Mon, 9 Feb 2026 21:28:50 +0100 +Subject: [PATCH] conf: Add firmwareFeatures element for domaincaps + +Signed-off-by: Andrea Bolognani +Reviewed-by: Michal Privoznik +(cherry picked from commit 928bdc3e67b29ff2314ff538905703e299b1e47e) + +https://issues.redhat.com/browse/RHEL-82645 + +Signed-off-by: Andrea Bolognani +--- + src/conf/domain_capabilities.c | 15 +++++++++++++++ + src/conf/domain_capabilities.h | 8 ++++++++ + 2 files changed, 23 insertions(+) + +diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c +index 49179b97ab..9b3577cd08 100644 +--- a/src/conf/domain_capabilities.c ++++ b/src/conf/domain_capabilities.c +@@ -422,6 +422,19 @@ virDomainCapsFeatureFormatSimple(virBuffer *buf, + } + + ++static void ++virDomainCapsFirmwareFeaturesFormat(virBuffer *buf, ++ const virDomainCapsFirmwareFeatures *firmwareFeatures) ++{ ++ FORMAT_PROLOGUE(firmwareFeatures); ++ ++ ENUM_PROCESS(firmwareFeatures, secureBoot, virTristateBoolTypeToString); ++ ENUM_PROCESS(firmwareFeatures, enrolledKeys, virTristateBoolTypeToString); ++ ++ FORMAT_EPILOGUE(firmwareFeatures); ++} ++ ++ + static void + virDomainCapsLoaderFormat(virBuffer *buf, + const virDomainCapsLoader *loader) +@@ -440,12 +453,14 @@ static void + virDomainCapsOSFormat(virBuffer *buf, + const virDomainCapsOS *os) + { ++ const virDomainCapsFirmwareFeatures *firmwareFeatures = &os->firmwareFeatures; + const virDomainCapsLoader *loader = &os->loader; + + FORMAT_PROLOGUE(os); + + ENUM_PROCESS(os, firmware, virDomainOsDefFirmwareTypeToString); + ++ virDomainCapsFirmwareFeaturesFormat(&childBuf, firmwareFeatures); + virDomainCapsLoaderFormat(&childBuf, loader); + + FORMAT_EPILOGUE(os); +diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h +index b10370db8f..a68fafe235 100644 +--- a/src/conf/domain_capabilities.h ++++ b/src/conf/domain_capabilities.h +@@ -43,6 +43,13 @@ struct _virDomainCapsStringValues { + size_t nvalues; /* number of strings */ + }; + ++typedef struct _virDomainCapsFirmwareFeatures virDomainCapsFirmwareFeatures; ++struct _virDomainCapsFirmwareFeatures { ++ virTristateBool supported; ++ virDomainCapsEnum secureBoot; ++ virDomainCapsEnum enrolledKeys; ++}; ++ + STATIC_ASSERT_ENUM(VIR_DOMAIN_LOADER_TYPE_LAST); + STATIC_ASSERT_ENUM(VIR_TRISTATE_BOOL_LAST); + typedef struct _virDomainCapsLoader virDomainCapsLoader; +@@ -59,6 +66,7 @@ typedef struct _virDomainCapsOS virDomainCapsOS; + struct _virDomainCapsOS { + virTristateBool supported; + virDomainCapsEnum firmware; /* Info about virDomainOsDefFirmware */ ++ virDomainCapsFirmwareFeatures firmwareFeatures; + virDomainCapsLoader loader; /* Info about virDomainLoaderDef */ + }; + +-- +2.53.0 diff --git a/libvirt-conf-Add-iommufd-fdgroup-support.patch b/libvirt-conf-Add-iommufd-fdgroup-support.patch new file mode 100644 index 0000000..5218f71 --- /dev/null +++ b/libvirt-conf-Add-iommufd-fdgroup-support.patch @@ -0,0 +1,160 @@ +From e16fe9c7fa885a36df0be1967d248808a5bc1fb5 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Pavel Hrdina +Date: Fri, 13 Mar 2026 15:28:17 +0100 +Subject: [PATCH] conf: Add iommufd fdgroup support + +This will allow management applications running libvirt without +necessary permissions to pass FD for /dev/iommu with per-process +locked memory accounting enabled. + +Kernel uses per-user locked memory accounting by default which may +cause error while starting multiple VMs with host devices using IOMMUFD. + +Signed-off-by: Pavel Hrdina +Reviewed-by: Peter Krempa +(cherry picked from commit 58875a6df679c5272f61028d33bf1380c51b0d5b) + +Resolves: https://redhat.atlassian.net/browse/RHEL-159175 +Signed-off-by: Pavel Hrdina +--- + docs/formatdomain.rst | 8 +++++++- + src/conf/domain_conf.c | 6 ++++++ + src/conf/domain_conf.h | 1 + + src/conf/domain_validate.c | 16 ++++++++++++++++ + src/conf/schemas/domaincommon.rng | 3 +++ + tests/genericxml2xmlindata/iommufd.xml | 2 +- + 6 files changed, 34 insertions(+), 2 deletions(-) + +diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst +index 20ea10bd35..cdcf164253 100644 +--- a/docs/formatdomain.rst ++++ b/docs/formatdomain.rst +@@ -1389,7 +1389,7 @@ Host Device IOMMUFD + + + ... +- ++ + ... + + +@@ -1403,6 +1403,12 @@ Host Device IOMMUFD + This controls IOMMUFD usage for all host devices, each device can change this + global default by setting ``iommufd`` attribute for ``driver`` element. + ++ Optional ``fdgroup`` attribute can be used together with ++ `virDomainFDAssociate `__ ++ to pass /dev/iommu FD instead of letting libvirt to open it. Caller is ++ responsible for setting per-process locked memory accounting otherwise ++ starting multiple VMs with host devices using IOMMUFD may fail. ++ + Resource partitioning + --------------------- + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 59908d9da6..452985c9ba 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -4214,6 +4214,8 @@ void virDomainDefFree(virDomainDef *def) + g_free(def->kvm_features); + g_free(def->tcg_features); + ++ g_free(def->iommufd_fdgroup); ++ + virBlkioDeviceArrayClear(def->blkio.devices, + def->blkio.ndevices); + g_free(def->blkio.devices); +@@ -19795,6 +19797,8 @@ virDomainDefIommufdParse(virDomainDef *def, + if (virXMLPropTristateBool(nodes[0], "enabled", VIR_XML_PROP_REQUIRED, &def->iommufd) < 0) + return -1; + ++ def->iommufd_fdgroup = virXMLPropString(nodes[0], "fdgroup"); ++ + return 0; + } + +@@ -28028,6 +28032,8 @@ virDomainDefIommufdFormat(virBuffer *buf, + virBufferAsprintf(&attrBuf, " enabled='%s'", + virTristateBoolTypeToString(def->iommufd)); + ++ virBufferEscapeString(&attrBuf, " fdgroup='%s'", def->iommufd_fdgroup); ++ + virXMLFormatElement(buf, "iommufd", &attrBuf, NULL); + } + +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 145084e4fd..ba22fc347d 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -3241,6 +3241,7 @@ struct _virDomainDef { + virDomainFeatureTCG *tcg_features; + + virTristateBool iommufd; ++ char *iommufd_fdgroup; + + bool tseg_specified; + unsigned long long tseg_size; +diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c +index 163095d55c..e400f80da3 100644 +--- a/src/conf/domain_validate.c ++++ b/src/conf/domain_validate.c +@@ -2003,6 +2003,19 @@ virDomainDefValidateThrottleGroups(const virDomainDef *def) + } + + ++static int ++virDomainDefValidateIommufd(const virDomainDef *def) ++{ ++ if (def->iommufd == VIR_TRISTATE_BOOL_NO && def->iommufd_fdgroup) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("Setting 'fdgroup' when 'iommufd' is disabled is not supported.")); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++ + static int + virDomainDefValidateInternal(const virDomainDef *def, + virDomainXMLOption *xmlopt) +@@ -2064,6 +2077,9 @@ virDomainDefValidateInternal(const virDomainDef *def, + if (virDomainDefValidateThrottleGroups(def) < 0) + return -1; + ++ if (virDomainDefValidateIommufd(def) < 0) ++ return -1; ++ + return 0; + } + +diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng +index de505e6c49..3c3013baec 100644 +--- a/src/conf/schemas/domaincommon.rng ++++ b/src/conf/schemas/domaincommon.rng +@@ -1377,6 +1377,9 @@ + + + ++ ++ ++ + + + +diff --git a/tests/genericxml2xmlindata/iommufd.xml b/tests/genericxml2xmlindata/iommufd.xml +index 63ea839383..10d59ca548 100644 +--- a/tests/genericxml2xmlindata/iommufd.xml ++++ b/tests/genericxml2xmlindata/iommufd.xml +@@ -4,7 +4,7 @@ + 219136 + 219136 + 1 +- ++ + + hvm + +-- +2.53.0 diff --git a/libvirt-conf-Add-tdx-as-launch-security-type.patch b/libvirt-conf-Add-tdx-as-launch-security-type.patch deleted file mode 100644 index 4865969..0000000 --- a/libvirt-conf-Add-tdx-as-launch-security-type.patch +++ /dev/null @@ -1,376 +0,0 @@ -From c7f940ba807d0d4883adb9a110839bea704278e2 Mon Sep 17 00:00:00 2001 -Message-ID: -From: Zhenzhong Duan -Date: Thu, 10 Jul 2025 03:21:09 -0400 -Subject: [PATCH] conf: Add tdx as launch security type -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When 'tdx' is used, the VM will be launched with Intel TDX feature enabled. -TDX feature supports running encrypted VM (Trust Domain, TD) under the -control of KVM. A TD runs in a CPU model which protects the confidentiality -of its memory and its CPU state from other software. - -There are four optional child elements. Element policy is 64bit hex, bit 0 -is set to enable TDX debug, bit 28 is set to enable sept-ve-disable, other -bits are reserved currently. When policy isn't specified, QEMU will use its -own default value 0x10000000. mrConfigId, mrOwner and mrOwnerConfig are -base64 encoded SHA384 digest string. - -For example: - - - 0x10000001 - xxx - xxx - xxx - - -Signed-off-by: Zhenzhong Duan -Reviewed-by: Daniel P. Berrangé -(cherry picked from commit e919a4dd374535511d962bee2cd64f22f1ac3fa1) -Resolves: https://issues.redhat.com/browse/RHEL-111863 -Signed-off-by: Paolo Bonzini ---- - src/conf/domain_conf.c | 49 +++++++++++++++++++++++++++++++ - src/conf/domain_conf.h | 11 +++++++ - src/conf/domain_validate.c | 1 + - src/conf/schemas/domaincommon.rng | 32 ++++++++++++++++++++ - src/conf/virconftypes.h | 2 ++ - src/qemu/qemu_cgroup.c | 1 + - src/qemu/qemu_command.c | 2 ++ - src/qemu/qemu_driver.c | 1 + - src/qemu/qemu_firmware.c | 1 + - src/qemu/qemu_namespace.c | 1 + - src/qemu/qemu_process.c | 2 ++ - src/qemu/qemu_validate.c | 1 + - src/security/security_dac.c | 2 ++ - 13 files changed, 106 insertions(+) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 1e24e41a48..d2f01a9397 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -1543,6 +1543,7 @@ VIR_ENUM_IMPL(virDomainLaunchSecurity, - "sev", - "sev-snp", - "s390-pv", -+ "tdx", - ); - - VIR_ENUM_IMPL(virDomainPstoreBackend, -@@ -3958,6 +3959,11 @@ virDomainSecDefFree(virDomainSecDef *def) - g_free(def->data.sev_snp.id_auth); - g_free(def->data.sev_snp.host_data); - break; -+ case VIR_DOMAIN_LAUNCH_SECURITY_TDX: -+ g_free(def->data.tdx.mrconfigid); -+ g_free(def->data.tdx.mrowner); -+ g_free(def->data.tdx.mrownerconfig); -+ break; - case VIR_DOMAIN_LAUNCH_SECURITY_PV: - case VIR_DOMAIN_LAUNCH_SECURITY_NONE: - case VIR_DOMAIN_LAUNCH_SECURITY_LAST: -@@ -14204,6 +14210,29 @@ virDomainSEVSNPDefParseXML(virDomainSEVSNPDef *def, - } - - -+static int -+virDomainTDXDefParseXML(virDomainTDXDef *def, -+ xmlXPathContextPtr ctxt) -+{ -+ int rc; -+ -+ rc = virXPathULongLongBase("string(./policy)", ctxt, 16, &def->policy); -+ if (rc == 0) { -+ def->havePolicy = true; -+ } else if (rc == -2) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("failed to get launch security policy for launch security type TDX")); -+ return -1; -+ } -+ -+ def->mrconfigid = virXPathString("string(./mrConfigId)", ctxt); -+ def->mrowner = virXPathString("string(./mrOwner)", ctxt); -+ def->mrownerconfig = virXPathString("string(./mrOwnerConfig)", ctxt); -+ -+ return 0; -+} -+ -+ - static virDomainSecDef * - virDomainSecDefParseXML(xmlNodePtr lsecNode, - xmlXPathContextPtr ctxt) -@@ -14227,6 +14256,10 @@ virDomainSecDefParseXML(xmlNodePtr lsecNode, - if (virDomainSEVSNPDefParseXML(&sec->data.sev_snp, ctxt) < 0) - return NULL; - break; -+ case VIR_DOMAIN_LAUNCH_SECURITY_TDX: -+ if (virDomainTDXDefParseXML(&sec->data.tdx, ctxt) < 0) -+ return NULL; -+ break; - case VIR_DOMAIN_LAUNCH_SECURITY_PV: - break; - case VIR_DOMAIN_LAUNCH_SECURITY_NONE: -@@ -27704,6 +27737,18 @@ virDomainSEVSNPDefFormat(virBuffer *attrBuf, - } - - -+static void -+virDomainTDXDefFormat(virBuffer *childBuf, virDomainTDXDef *def) -+{ -+ if (def->havePolicy) -+ virBufferAsprintf(childBuf, "0x%llx\n", def->policy); -+ -+ virBufferEscapeString(childBuf, "%s\n", def->mrconfigid); -+ virBufferEscapeString(childBuf, "%s\n", def->mrowner); -+ virBufferEscapeString(childBuf, "%s\n", def->mrownerconfig); -+} -+ -+ - static void - virDomainSecDefFormat(virBuffer *buf, virDomainSecDef *sec) - { -@@ -27725,6 +27770,10 @@ virDomainSecDefFormat(virBuffer *buf, virDomainSecDef *sec) - virDomainSEVSNPDefFormat(&attrBuf, &childBuf, &sec->data.sev_snp); - break; - -+ case VIR_DOMAIN_LAUNCH_SECURITY_TDX: -+ virDomainTDXDefFormat(&childBuf, &sec->data.tdx); -+ break; -+ - case VIR_DOMAIN_LAUNCH_SECURITY_PV: - break; - -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 6997cf7c09..e216c63018 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -2964,6 +2964,7 @@ typedef enum { - VIR_DOMAIN_LAUNCH_SECURITY_SEV, - VIR_DOMAIN_LAUNCH_SECURITY_SEV_SNP, - VIR_DOMAIN_LAUNCH_SECURITY_PV, -+ VIR_DOMAIN_LAUNCH_SECURITY_TDX, - - VIR_DOMAIN_LAUNCH_SECURITY_LAST, - } virDomainLaunchSecurity; -@@ -2998,11 +2999,21 @@ struct _virDomainSEVSNPDef { - }; - - -+struct _virDomainTDXDef { -+ bool havePolicy; -+ unsigned long long policy; -+ char *mrconfigid; -+ char *mrowner; -+ char *mrownerconfig; -+}; -+ -+ - struct _virDomainSecDef { - virDomainLaunchSecurity sectype; - union { - virDomainSEVDef sev; - virDomainSEVSNPDef sev_snp; -+ virDomainTDXDef tdx; - } data; - }; - -diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c -index b28af7fa56..7d68ea2478 100644 ---- a/src/conf/domain_validate.c -+++ b/src/conf/domain_validate.c -@@ -1936,6 +1936,7 @@ virDomainDefLaunchSecurityValidate(const virDomainDef *def) - case VIR_DOMAIN_LAUNCH_SECURITY_NONE: - case VIR_DOMAIN_LAUNCH_SECURITY_SEV: - case VIR_DOMAIN_LAUNCH_SECURITY_PV: -+ case VIR_DOMAIN_LAUNCH_SECURITY_TDX: - case VIR_DOMAIN_LAUNCH_SECURITY_LAST: - break; - } -diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng -index 183dd5db5e..56dbddcb43 100644 ---- a/src/conf/schemas/domaincommon.rng -+++ b/src/conf/schemas/domaincommon.rng -@@ -549,6 +549,9 @@ - s390-pv - - -+ -+ -+ - - - -@@ -644,6 +647,35 @@ - - - -+ -+ -+ -+ tdx -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -