diff --git a/kvm-block-Expose-block-limits-for-images-in-QMP.patch b/kvm-block-Expose-block-limits-for-images-in-QMP.patch new file mode 100644 index 0000000..4c67a90 --- /dev/null +++ b/kvm-block-Expose-block-limits-for-images-in-QMP.patch @@ -0,0 +1,255 @@ +From c8b07a9c5c6926a63c2db56c3de8046b2160417d Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Fri, 24 Oct 2025 14:30:38 +0200 +Subject: [PATCH 3/6] block: Expose block limits for images in QMP + +RH-Author: Kevin Wolf +RH-MergeRequest: 439: block: Expose block limits in monitor and qemu-img info +RH-Jira: RHEL-110003 +RH-Acked-by: Hanna Czenczek +RH-Acked-by: Miroslav Rezanina +RH-Commit: [2/4] a2d45f05abd5bedbad2f10ae4dc7a5cce909a2fe (kmwolf/centos-qemu-kvm) + +This information can be useful both for debugging and for management +tools trying to configure guest devices with the optimal limits +(possibly across multiple hosts). There is no reason not to make it +available, so just add it to BlockNodeInfo. + +Signed-off-by: Kevin Wolf +Reviewed-by: Eric Blake +Reviewed-by: Hanna Czenczek +Message-ID: <20251024123041.51254-3-kwolf@redhat.com> +Signed-off-by: Kevin Wolf +(cherry picked from commit d2634e18286a5772f04cc724e64f8b16a2124587) +Signed-off-by: Kevin Wolf +--- + block/qapi.c | 34 ++++++++++++++-- + qapi/block-core.json | 66 ++++++++++++++++++++++++++++++++ + tests/qemu-iotests/184 | 5 ++- + tests/qemu-iotests/184.out | 8 ---- + tests/qemu-iotests/common.filter | 3 +- + 5 files changed, 102 insertions(+), 14 deletions(-) + +diff --git a/block/qapi.c b/block/qapi.c +index 12fbf8d1b7..54521d0a68 100644 +--- a/block/qapi.c ++++ b/block/qapi.c +@@ -235,7 +235,8 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs, + * in @info, setting @errp on error. + */ + static void GRAPH_RDLOCK +-bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp) ++bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, bool limits, ++ Error **errp) + { + int64_t size; + const char *backing_filename; +@@ -269,6 +270,33 @@ bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp) + info->dirty_flag = bdi.is_dirty; + info->has_dirty_flag = true; + } ++ ++ if (limits) { ++ info->limits = g_new(BlockLimitsInfo, 1); ++ *info->limits = (BlockLimitsInfo) { ++ .request_alignment = bs->bl.request_alignment, ++ .has_max_discard = bs->bl.max_pdiscard != 0, ++ .max_discard = bs->bl.max_pdiscard, ++ .has_discard_alignment = bs->bl.pdiscard_alignment != 0, ++ .discard_alignment = bs->bl.pdiscard_alignment, ++ .has_max_write_zeroes = bs->bl.max_pwrite_zeroes != 0, ++ .max_write_zeroes = bs->bl.max_pwrite_zeroes, ++ .has_write_zeroes_alignment = bs->bl.pwrite_zeroes_alignment != 0, ++ .write_zeroes_alignment = bs->bl.pwrite_zeroes_alignment, ++ .has_opt_transfer = bs->bl.opt_transfer != 0, ++ .opt_transfer = bs->bl.opt_transfer, ++ .has_max_transfer = bs->bl.max_transfer != 0, ++ .max_transfer = bs->bl.max_transfer, ++ .has_max_hw_transfer = bs->bl.max_hw_transfer != 0, ++ .max_hw_transfer = bs->bl.max_hw_transfer, ++ .max_iov = bs->bl.max_iov, ++ .has_max_hw_iov = bs->bl.max_hw_iov != 0, ++ .max_hw_iov = bs->bl.max_hw_iov, ++ .min_mem_alignment = bs->bl.min_mem_alignment, ++ .opt_mem_alignment = bs->bl.opt_mem_alignment, ++ }; ++ } ++ + info->format_specific = bdrv_get_specific_info(bs, &err); + if (err) { + error_propagate(errp, err); +@@ -343,7 +371,7 @@ void bdrv_query_image_info(BlockDriverState *bs, + ImageInfo *info; + + info = g_new0(ImageInfo, 1); +- bdrv_do_query_node_info(bs, qapi_ImageInfo_base(info), errp); ++ bdrv_do_query_node_info(bs, qapi_ImageInfo_base(info), true, errp); + if (*errp) { + goto fail; + } +@@ -397,7 +425,7 @@ void bdrv_query_block_graph_info(BlockDriverState *bs, + BdrvChild *c; + + info = g_new0(BlockGraphInfo, 1); +- bdrv_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), errp); ++ bdrv_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), false, errp); + if (*errp) { + goto fail; + } +diff --git a/qapi/block-core.json b/qapi/block-core.json +index dc6eb4ae23..2c037183f0 100644 +--- a/qapi/block-core.json ++++ b/qapi/block-core.json +@@ -275,6 +275,69 @@ + 'file': 'ImageInfoSpecificFileWrapper' + } } + ++## ++# @BlockLimitsInfo: ++# ++# @request-alignment: Alignment requirement, in bytes, for ++# offset/length of I/O requests. ++# ++# @max-discard: Maximum number of bytes that can be discarded at once. ++# If not present, there is no specific maximum. ++# ++# @discard-alignment: Optimal alignment for discard requests in bytes. ++# Note that this doesn't have to be a power of two. If not ++# present, discards don't have a alignment requirement different ++# from @request-alignment. ++# ++# @max-write-zeroes: Maximum number of bytes that can be zeroed out at ++# once. If not present, there is no specific maximum. ++# ++# @write-zeroes-alignment: Optimal alignment for write zeroes requests ++# in bytes. Note that this doesn't have to be a power of two. If ++# not present, write_zeroes doesn't have a alignment requirement ++# different from @request-alignment. ++# ++# @opt-transfer: Optimal transfer length in bytes. If not present, ++# there is no preferred size. ++# ++# @max-transfer: Maximal transfer length in bytes. If not present, ++# there is no specific maximum. ++# ++# @max-hw-transfer: Maximal hardware transfer length in bytes. ++# Applies whenever transfers to the device bypass the kernel I/O ++# scheduler, for example with SG_IO. If not present, there is no ++# specific maximum. ++# ++# @max-iov: Maximum number of scatter/gather elements ++# ++# @max-hw-iov: Maximum number of scatter/gather elements allowed by ++# the hardware. Applies whenever transfers to the device bypass ++# the kernel I/O scheduler, for example with SG_IO. If not ++# present, the hardware limits is unknown and @max-iov is always ++# used. ++# ++# @min-mem-alignment: Minimal required memory alignment in bytes for ++# zero-copy I/O to succeed. For unaligned requests, a bounce ++# buffer will be used. ++# ++# @opt-mem-alignment: Optimal memory alignment in bytes. This is the ++# alignment used for any buffer allocations QEMU performs ++# internally. ++## ++{ 'struct': 'BlockLimitsInfo', ++ 'data': { 'request-alignment': 'uint32', ++ '*max-discard': 'uint64', ++ '*discard-alignment': 'uint32', ++ '*max-write-zeroes': 'uint64', ++ '*write-zeroes-alignment': 'uint32', ++ '*opt-transfer': 'uint32', ++ '*max-transfer': 'uint32', ++ '*max-hw-transfer': 'uint32', ++ 'max-iov': 'int', ++ '*max-hw-iov': 'int', ++ 'min-mem-alignment': 'size', ++ 'opt-mem-alignment': 'size' } } ++ + ## + # @BlockNodeInfo: + # +@@ -304,6 +367,8 @@ + # + # @snapshots: list of VM snapshots + # ++# @limits: block limits that are used for I/O on the node (Since 10.2) ++# + # @format-specific: structure supplying additional format-specific + # information (since 1.7) + # +@@ -315,6 +380,7 @@ + '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool', + '*backing-filename': 'str', '*full-backing-filename': 'str', + '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'], ++ '*limits': 'BlockLimitsInfo', + '*format-specific': 'ImageInfoSpecific' } } + + ## +diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184 +index e4cbcd8634..6d0afe9d38 100755 +--- a/tests/qemu-iotests/184 ++++ b/tests/qemu-iotests/184 +@@ -45,8 +45,9 @@ do_run_qemu() + + run_qemu() + { +- do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\ +- | _filter_qemu_io | _filter_generated_node_ids ++ do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp \ ++ | _filter_qemu_io | _filter_generated_node_ids \ ++ | _filter_img_info + } + + test_throttle=$($QEMU_IMG --help|grep throttle) +diff --git a/tests/qemu-iotests/184.out b/tests/qemu-iotests/184.out +index ef99bb2e9a..52692b6b3b 100644 +--- a/tests/qemu-iotests/184.out ++++ b/tests/qemu-iotests/184.out +@@ -41,12 +41,6 @@ Testing: + }, + "iops_wr": 0, + "ro": false, +- "children": [ +- { +- "node-name": "disk0", +- "child": "file" +- } +- ], + "node-name": "throttle0", + "backing_file_depth": 1, + "drv": "throttle", +@@ -75,8 +69,6 @@ Testing: + }, + "iops_wr": 0, + "ro": false, +- "children": [ +- ], + "node-name": "disk0", + "backing_file_depth": 0, + "drv": "null-co", +diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter +index 35c0fc0d20..cd8b506dba 100644 +--- a/tests/qemu-iotests/common.filter ++++ b/tests/qemu-iotests/common.filter +@@ -230,6 +230,7 @@ _filter_img_info() + discard=0 + regex_json_spec_start='^ *"format-specific": \{' + regex_json_child_start='^ *"children": \[' ++ regex_json_limit_start='^ *"limits": \{' + gsed -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \ + -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \ + -e "s#$TEST_DIR#TEST_DIR#g" \ +@@ -262,7 +263,7 @@ _filter_img_info() + discard=1 + elif [[ $line =~ "Child node '/" ]]; then + discard=1 +- elif [[ $line =~ $regex_json_spec_start ]]; then ++ elif [[ $line =~ $regex_json_spec_start || $line =~ $regex_json_limit_start ]]; then + discard=2 + regex_json_end="^${line%%[^ ]*}\\},? *$" + elif [[ $line =~ $regex_json_child_start ]]; then +-- +2.47.3 + diff --git a/kvm-block-Improve-comments-in-BlockLimits.patch b/kvm-block-Improve-comments-in-BlockLimits.patch new file mode 100644 index 0000000..1e2aeda --- /dev/null +++ b/kvm-block-Improve-comments-in-BlockLimits.patch @@ -0,0 +1,98 @@ +From e5745092ebc473f359cb2eef67ff375a1e942a74 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Fri, 24 Oct 2025 14:30:37 +0200 +Subject: [PATCH 2/6] block: Improve comments in BlockLimits + +RH-Author: Kevin Wolf +RH-MergeRequest: 439: block: Expose block limits in monitor and qemu-img info +RH-Jira: RHEL-110003 +RH-Acked-by: Hanna Czenczek +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/4] 06c55e52ff339d2bc4559b109b0a6dd625caa7f0 (kmwolf/centos-qemu-kvm) + +Patches to expose the limits in QAPI have made clear that the existing +documentation of BlockLimits could be improved: The meaning of +min_mem_alignment and opt_mem_alignment could be clearer, and talking +about better alignment values isn't helpful when we only detect these +values and never choose them. + +Make the changes in the BlockLimits documentation now, so that the +patches exposing the fields in QAPI can use descriptions consistent with +it. + +Signed-off-by: Kevin Wolf +Message-ID: <20251024123041.51254-2-kwolf@redhat.com> +Reviewed-by: Eric Blake +Signed-off-by: Kevin Wolf +(cherry picked from commit 46dd683d56b1328cb2bc923914bfd7ac590064f7) +Signed-off-by: Kevin Wolf +--- + include/block/block_int-common.h | 30 +++++++++++++++++------------- + 1 file changed, 17 insertions(+), 13 deletions(-) + +diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h +index 034c0634c8..5206f32d53 100644 +--- a/include/block/block_int-common.h ++++ b/include/block/block_int-common.h +@@ -817,10 +817,10 @@ typedef struct BlockLimits { + int64_t max_pdiscard; + + /* +- * Optimal alignment for discard requests in bytes. A power of 2 +- * is best but not mandatory. Must be a multiple of +- * bl.request_alignment, and must be less than max_pdiscard if +- * that is set. May be 0 if bl.request_alignment is good enough ++ * Optimal alignment for discard requests in bytes. Note that this doesn't ++ * have to be a power of two. Must be a multiple of bl.request_alignment, ++ * and must be less than max_pdiscard if that is set. May be 0 if ++ * bl.request_alignment is good enough. + */ + uint32_t pdiscard_alignment; + +@@ -831,11 +831,10 @@ typedef struct BlockLimits { + int64_t max_pwrite_zeroes; + + /* +- * Optimal alignment for write zeroes requests in bytes. A power +- * of 2 is best but not mandatory. Must be a multiple of +- * bl.request_alignment, and must be less than max_pwrite_zeroes +- * if that is set. May be 0 if bl.request_alignment is good +- * enough ++ * Optimal alignment for write zeroes requests in bytes. Note that this ++ * doesn't have to be a power of two. Must be a multiple of ++ * bl.request_alignment, and must be less than max_pwrite_zeroes if that is ++ * set. May be 0 if bl.request_alignment is good enough. + */ + uint32_t pwrite_zeroes_alignment; + +@@ -863,18 +862,23 @@ typedef struct BlockLimits { + uint64_t max_hw_transfer; + + /* +- * Maximal number of scatter/gather elements allowed by the hardware. ++ * Maximum number of scatter/gather elements allowed by the hardware. + * Applies whenever transfers to the device bypass the kernel I/O + * scheduler, for example with SG_IO. If larger than max_iov + * or if zero, blk_get_max_hw_iov will fall back to max_iov. + */ + int max_hw_iov; + +- +- /* memory alignment, in bytes so that no bounce buffer is needed */ ++ /* ++ * Minimal required memory alignment in bytes for zero-copy I/O to succeed. ++ * For unaligned requests, a bounce buffer will be used. ++ */ + size_t min_mem_alignment; + +- /* memory alignment, in bytes, for bounce buffer */ ++ /* ++ * Optimal memory alignment in bytes. This is the alignment used for any ++ * buffer allocations QEMU performs internally. ++ */ + size_t opt_mem_alignment; + + /* maximum number of iovec elements */ +-- +2.47.3 + diff --git a/kvm-monitor-generalize-query-mshv-info-mshv-to-query-acc.patch b/kvm-monitor-generalize-query-mshv-info-mshv-to-query-acc.patch new file mode 100644 index 0000000..3f8cbf7 --- /dev/null +++ b/kvm-monitor-generalize-query-mshv-info-mshv-to-query-acc.patch @@ -0,0 +1,235 @@ +From afb70cb5eea1e9dad7b5414713d2394ef2c88329 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Mon, 13 Oct 2025 12:49:04 +0200 +Subject: [PATCH 1/6] monitor: generalize query-mshv/"info mshv" to + query-accelerators/"info accelerators" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Igor Mammedov +RH-MergeRequest: 443: [REHL10.2] L1HV: monitor: generalize query-mshv/"info mshv" to query-accelerators/"info accelerators" +RH-Jira: RHEL-134212 +RH-Acked-by: MST +RH-Acked-by: Paolo Bonzini +RH-Commit: [1/1] af946c572c3dab34cee6399bf4438e2722dd7e44 (imammedo/qemu-kvm-cs) + +The recently-introduced query-mshv command is a duplicate of query-kvm, +and neither provides a full view of which accelerators are supported +by a particular binary of QEMU and which is in use. + +KVM was the first accelerator added to QEMU, predating QOM and TYPE_ACCEL, +so it got a pass. But now, instead of adding a badly designed copy, solve +the problem completely for all accelerators with a command that provides +the whole picture: + + >> {"execute": "query-accelerators"} + << {"return": {"enabled": "tcg", "present": ["kvm", "mshv", "qtest", "tcg", "xen"]}} + +Cc: Praveen K Paladugu +Cc: Magnus Kulke +Suggested-by: Markus Armbruster +Reviewed-by: Daniel P. Berrangé +Signed-off-by: Paolo Bonzini +(cherry picked from commit 71d5babbd6fffc7def1ecbf29f9753e3a2807761) +Signed-off-by: Igor Mammedov +--- + hmp-commands-info.hx | 15 ++++++++---- + hw/core/machine-hmp-cmds.c | 23 +++++++++++-------- + hw/core/machine-qmp-cmds.c | 24 +++++++++++++------ + include/monitor/hmp.h | 2 +- + qapi/accelerator.json | 47 +++++++++++++++++++++++++++++--------- + 5 files changed, 77 insertions(+), 34 deletions(-) + +diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx +index eaaa880c1b..3ed636e4e8 100644 +--- a/hmp-commands-info.hx ++++ b/hmp-commands-info.hx +@@ -308,16 +308,21 @@ SRST + ERST + + { +- .name = "mshv", ++ .name = "accelerators", + .args_type = "", + .params = "", +- .help = "show MSHV information", +- .cmd = hmp_info_mshv, ++ .help = "show present and enabled information", ++ .cmd = hmp_info_accelerators, + }, + + SRST +- ``info mshv`` +- Show MSHV information. ++ ``info accelerators`` ++ Show which accelerators are compiled into a QEMU binary, and what accelerator ++ is in use. For example:: ++ ++ kvm qtest [tcg] ++ ++ indicates that TCG in use, and that KVM and qtest are also available. + ERST + + { +diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c +index 682ed9f49b..74a56600be 100644 +--- a/hw/core/machine-hmp-cmds.c ++++ b/hw/core/machine-hmp-cmds.c +@@ -163,19 +163,22 @@ void hmp_info_kvm(Monitor *mon, const QDict *qdict) + qapi_free_KvmInfo(info); + } + +-void hmp_info_mshv(Monitor *mon, const QDict *qdict) ++void hmp_info_accelerators(Monitor *mon, const QDict *qdict) + { +- MshvInfo *info; +- +- info = qmp_query_mshv(NULL); +- monitor_printf(mon, "mshv support: "); +- if (info->present) { +- monitor_printf(mon, "%s\n", info->enabled ? "enabled" : "disabled"); +- } else { +- monitor_printf(mon, "not compiled\n"); ++ AcceleratorInfo *info; ++ AcceleratorList *accel; ++ ++ info = qmp_query_accelerators(NULL); ++ for (accel = info->present; accel; accel = accel->next) { ++ char trail = accel->next ? ' ' : '\n'; ++ if (info->enabled == accel->value) { ++ monitor_printf(mon, "[%s]%c", Accelerator_str(accel->value), trail); ++ } else { ++ monitor_printf(mon, "%s%c", Accelerator_str(accel->value), trail); ++ } + } + +- qapi_free_MshvInfo(info); ++ qapi_free_AcceleratorInfo(info); + } + + void hmp_info_uuid(Monitor *mon, const QDict *qdict) +diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c +index e24bf0d97b..51d5c230f7 100644 +--- a/hw/core/machine-qmp-cmds.c ++++ b/hw/core/machine-qmp-cmds.c +@@ -31,15 +31,25 @@ + #include + + /* +- * QMP query for MSHV ++ * QMP query for enabled and present accelerators + */ +-MshvInfo *qmp_query_mshv(Error **errp) ++AcceleratorInfo *qmp_query_accelerators(Error **errp) + { +- MshvInfo *info = g_malloc0(sizeof(*info)); +- +- info->enabled = mshv_enabled(); +- info->present = accel_find("mshv"); +- ++ AcceleratorInfo *info = g_malloc0(sizeof(*info)); ++ AccelClass *current_class = ACCEL_GET_CLASS(current_accel()); ++ int i; ++ ++ for (i = ACCELERATOR__MAX; i-- > 0; ) { ++ const char *s = Accelerator_str(i); ++ AccelClass *this_class = accel_find(s); ++ ++ if (this_class) { ++ QAPI_LIST_PREPEND(info->present, i); ++ if (this_class == current_class) { ++ info->enabled = i; ++ } ++ } ++ } + return info; + } + +diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h +index 31bd812e5f..897dfaa2b6 100644 +--- a/include/monitor/hmp.h ++++ b/include/monitor/hmp.h +@@ -24,7 +24,7 @@ strList *hmp_split_at_comma(const char *str); + void hmp_info_name(Monitor *mon, const QDict *qdict); + void hmp_info_version(Monitor *mon, const QDict *qdict); + void hmp_info_kvm(Monitor *mon, const QDict *qdict); +-void hmp_info_mshv(Monitor *mon, const QDict *qdict); ++void hmp_info_accelerators(Monitor *mon, const QDict *qdict); + void hmp_info_status(Monitor *mon, const QDict *qdict); + void hmp_info_uuid(Monitor *mon, const QDict *qdict); + void hmp_info_chardev(Monitor *mon, const QDict *qdict); +diff --git a/qapi/accelerator.json b/qapi/accelerator.json +index 664e027246..2b92060884 100644 +--- a/qapi/accelerator.json ++++ b/qapi/accelerator.json +@@ -56,30 +56,55 @@ + 'features': [ 'unstable' ] } + + ## +-# @MshvInfo: ++# @Accelerator: + # + # Information about support for MSHV acceleration + # +-# @enabled: true if MSHV acceleration is active ++# @hvf: Apple Hypervisor.framework + # +-# @present: true if MSHV acceleration is built into this executable ++# @kvm: KVM ++# ++# @mshv: Hyper-V ++# ++# @nvmm: NetBSD NVMM ++# ++# @qtest: QTest (dummy accelerator) ++# ++# @tcg: TCG (dynamic translation) ++# ++# @whpx: Windows Hypervisor Platform ++# ++# @xen: Xen ++# ++# Since: 10.2.0 ++## ++{ 'enum': 'Accelerator', 'data': ['hvf', 'kvm', 'mshv', 'nvmm', 'qtest', 'tcg', 'whpx', 'xen'] } ++ ++## ++# @AcceleratorInfo: ++# ++# Information about support for various accelerators ++# ++# @enabled: the accelerator that is in use ++# ++# @present: the list of accelerators that are built into this executable + # + # Since: 10.2.0 + ## +-{ 'struct': 'MshvInfo', 'data': {'enabled': 'bool', 'present': 'bool'} } ++{ 'struct': 'AcceleratorInfo', 'data': {'enabled': 'Accelerator', 'present': ['Accelerator']} } + + ## +-# @query-mshv: ++# @query-accelerators: + # +-# Return information about MSHV acceleration ++# Return information about accelerators + # +-# Returns: @MshvInfo ++# Returns: @AcceleratorInfo + # +-# Since: 10.0.92 ++# Since: 10.2.0 + # + # .. qmp-example:: + # +-# -> { "execute": "query-mshv" } +-# <- { "return": { "enabled": true, "present": true } } ++# -> { "execute": "query-accelerators" } ++# <- { "return": { "enabled": "mshv", "present": ["kvm", "mshv", "qtest", "tcg"] } } + ## +-{ 'command': 'query-mshv', 'returns': 'MshvInfo' } ++{ 'command': 'query-accelerators', 'returns': 'AcceleratorInfo' } +-- +2.47.3 + diff --git a/kvm-qemu-img-info-Add-cache-mode-option.patch b/kvm-qemu-img-info-Add-cache-mode-option.patch new file mode 100644 index 0000000..c685595 --- /dev/null +++ b/kvm-qemu-img-info-Add-cache-mode-option.patch @@ -0,0 +1,153 @@ +From 67461afaa7e25c6a41cb542ecc1a2b8696d5489d Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Fri, 24 Oct 2025 14:30:40 +0200 +Subject: [PATCH 5/6] qemu-img info: Add cache mode option + +RH-Author: Kevin Wolf +RH-MergeRequest: 439: block: Expose block limits in monitor and qemu-img info +RH-Jira: RHEL-110003 +RH-Acked-by: Hanna Czenczek +RH-Acked-by: Miroslav Rezanina +RH-Commit: [4/4] 1d7c278d70f37528be71b31fe121cc531a13dde5 (kmwolf/centos-qemu-kvm) + +When querying block limits, different cache modes (in particular +O_DIRECT or not) can result in different limits. Add an option to +'qemu-img info' that allows the user to specify a cache mode, so that +they can get the block limits for the cache mode they intend to use with +their VM. + +Signed-off-by: Kevin Wolf +Message-ID: <20251024123041.51254-5-kwolf@redhat.com> +Reviewed-by: Eric Blake +Signed-off-by: Kevin Wolf +(cherry picked from commit 911992fd6ec7a84c7cc82831b4bcd8a2ca5ccc76) +Signed-off-by: Kevin Wolf +--- + docs/tools/qemu-img.rst | 2 +- + qemu-img-cmds.hx | 4 ++-- + qemu-img.c | 25 +++++++++++++++++++++---- + 3 files changed, 24 insertions(+), 7 deletions(-) + +diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst +index fdc9ea9cf2..558b0eb84d 100644 +--- a/docs/tools/qemu-img.rst ++++ b/docs/tools/qemu-img.rst +@@ -503,7 +503,7 @@ Command description: + + The size syntax is similar to :manpage:`dd(1)`'s size syntax. + +-.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-U] FILENAME ++.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-t CACHE] [-U] FILENAME + + Give information about the disk image *FILENAME*. Use it in + particular to know the size reserved on disk which can be different +diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx +index 74b66f9d42..6bc8265cfb 100644 +--- a/qemu-img-cmds.hx ++++ b/qemu-img-cmds.hx +@@ -66,9 +66,9 @@ SRST + ERST + + DEF("info", img_info, +- "info [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [--backing-chain] [--limits] [-U] filename") ++ "info [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [--backing-chain] [--limits] [-t CACHE] [-U] filename") + SRST +-.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-U] FILENAME ++.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-t CACHE] [-U] FILENAME + ERST + + DEF("map", img_map, +diff --git a/qemu-img.c b/qemu-img.c +index 5cdbeda969..a7791896c1 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -3003,6 +3003,7 @@ static gboolean str_equal_func(gconstpointer a, gconstpointer b) + static BlockGraphInfoList *collect_image_info_list(bool image_opts, + const char *filename, + const char *fmt, ++ const char *cache, + bool chain, bool limits, + bool force_share) + { +@@ -3010,6 +3011,15 @@ static BlockGraphInfoList *collect_image_info_list(bool image_opts, + BlockGraphInfoList **tail = &head; + GHashTable *filenames; + Error *err = NULL; ++ int cache_flags = 0; ++ bool writethrough = false; ++ int ret; ++ ++ ret = bdrv_parse_cache_mode(cache, &cache_flags, &writethrough); ++ if (ret < 0) { ++ error_report("Invalid cache option: %s", cache); ++ return NULL; ++ } + + filenames = g_hash_table_new_full(g_str_hash, str_equal_func, NULL, NULL); + +@@ -3026,8 +3036,8 @@ static BlockGraphInfoList *collect_image_info_list(bool image_opts, + g_hash_table_insert(filenames, (gpointer)filename, NULL); + + blk = img_open(image_opts, filename, fmt, +- BDRV_O_NO_BACKING | BDRV_O_NO_IO, false, false, +- force_share); ++ BDRV_O_NO_BACKING | BDRV_O_NO_IO | cache_flags, ++ writethrough, false, force_share); + if (!blk) { + goto err; + } +@@ -3087,6 +3097,7 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv) + OutputFormat output_format = OFORMAT_HUMAN; + bool chain = false; + const char *filename, *fmt; ++ const char *cache = BDRV_DEFAULT_CACHE; + BlockGraphInfoList *list; + bool image_opts = false; + bool force_share = false; +@@ -3099,13 +3110,14 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv) + {"format", required_argument, 0, 'f'}, + {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS}, + {"backing-chain", no_argument, 0, OPTION_BACKING_CHAIN}, ++ {"cache", required_argument, 0, 't'}, + {"force-share", no_argument, 0, 'U'}, + {"limits", no_argument, 0, OPTION_LIMITS}, + {"output", required_argument, 0, OPTION_OUTPUT}, + {"object", required_argument, 0, OPTION_OBJECT}, + {0, 0, 0, 0} + }; +- c = getopt_long(argc, argv, "hf:U", long_options, NULL); ++ c = getopt_long(argc, argv, "hf:t:U", long_options, NULL); + if (c == -1) { + break; + } +@@ -3121,6 +3133,8 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv) + " (incompatible with -f|--format)\n" + " --backing-chain\n" + " display information about the backing chain for copy-on-write overlays\n" ++" -t, --cache CACHE\n" ++" cache mode for FILE (default: " BDRV_DEFAULT_CACHE ")\n" + " -U, --force-share\n" + " open image in shared mode for concurrent access\n" + " --limits\n" +@@ -3143,6 +3157,9 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv) + case OPTION_BACKING_CHAIN: + chain = true; + break; ++ case 't': ++ cache = optarg; ++ break; + case 'U': + force_share = true; + break; +@@ -3164,7 +3181,7 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv) + } + filename = argv[optind++]; + +- list = collect_image_info_list(image_opts, filename, fmt, chain, ++ list = collect_image_info_list(image_opts, filename, fmt, cache, chain, + limits, force_share); + if (!list) { + return 1; +-- +2.47.3 + diff --git a/kvm-qemu-img-info-Optionally-show-block-limits.patch b/kvm-qemu-img-info-Optionally-show-block-limits.patch new file mode 100644 index 0000000..c528e64 --- /dev/null +++ b/kvm-qemu-img-info-Optionally-show-block-limits.patch @@ -0,0 +1,240 @@ +From 264e2c0bff1ae09ef89757eac655401dbdf10d90 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Fri, 24 Oct 2025 14:30:39 +0200 +Subject: [PATCH 4/6] qemu-img info: Optionally show block limits + +RH-Author: Kevin Wolf +RH-MergeRequest: 439: block: Expose block limits in monitor and qemu-img info +RH-Jira: RHEL-110003 +RH-Acked-by: Hanna Czenczek +RH-Acked-by: Miroslav Rezanina +RH-Commit: [3/4] 688d6d1617c4d5916b299f08fad0e928341c73f7 (kmwolf/centos-qemu-kvm) + +Add a new --limits option to 'qemu-img info' that displays the block +limits for the image and all of its children, making the information +more accessible for human users than in QMP. This option is not enabled +by default because it can be a lot of output that isn't usually relevant +if you're not specifically trying to diagnose some I/O problem. + +This makes the same information automatically also available in HMP +'info block -v'. + +Signed-off-by: Kevin Wolf +Reviewed-by: Eric Blake +Reviewed-by: Hanna Czenczek +Message-ID: <20251024123041.51254-4-kwolf@redhat.com> +Signed-off-by: Kevin Wolf +(cherry picked from commit 5b4b3bfdfc28d2398f34194d260d6eef9a9048b4) +Signed-off-by: Kevin Wolf +--- + block/qapi.c | 34 ++++++++++++++++++++++++++++++++-- + docs/tools/qemu-img.rst | 6 +++++- + include/block/qapi.h | 2 +- + qemu-img-cmds.hx | 4 ++-- + qemu-img.c | 15 ++++++++++++--- + 5 files changed, 52 insertions(+), 9 deletions(-) + +diff --git a/block/qapi.c b/block/qapi.c +index 54521d0a68..9f5771e019 100644 +--- a/block/qapi.c ++++ b/block/qapi.c +@@ -417,6 +417,7 @@ fail: + */ + void bdrv_query_block_graph_info(BlockDriverState *bs, + BlockGraphInfo **p_info, ++ bool limits, + Error **errp) + { + ERRP_GUARD(); +@@ -425,7 +426,7 @@ void bdrv_query_block_graph_info(BlockDriverState *bs, + BdrvChild *c; + + info = g_new0(BlockGraphInfo, 1); +- bdrv_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), false, errp); ++ bdrv_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), limits, errp); + if (*errp) { + goto fail; + } +@@ -439,7 +440,7 @@ void bdrv_query_block_graph_info(BlockDriverState *bs, + QAPI_LIST_APPEND(children_list_tail, c_info); + + c_info->name = g_strdup(c->name); +- bdrv_query_block_graph_info(c->bs, &c_info->info, errp); ++ bdrv_query_block_graph_info(c->bs, &c_info->info, limits, errp); + if (*errp) { + goto fail; + } +@@ -936,6 +937,29 @@ void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec, + visit_free(v); + } + ++/** ++ * Dumps the given BlockLimitsInfo object in a human-readable form, ++ * prepending an optional prefix if the dump is not empty. ++ */ ++static void bdrv_image_info_limits_dump(BlockLimitsInfo *limits, ++ const char *prefix, ++ int indentation) ++{ ++ QObject *obj; ++ Visitor *v = qobject_output_visitor_new(&obj); ++ ++ visit_type_BlockLimitsInfo(v, NULL, &limits, &error_abort); ++ visit_complete(v, &obj); ++ if (!qobject_is_empty_dump(obj)) { ++ if (prefix) { ++ qemu_printf("%*s%s", indentation * 4, "", prefix); ++ } ++ dump_qobject(indentation + 1, obj); ++ } ++ qobject_unref(obj); ++ visit_free(v); ++} ++ + /** + * Print the given @info object in human-readable form. Every field is indented + * using the given @indentation (four spaces per indentation level). +@@ -1011,6 +1035,12 @@ void bdrv_node_info_dump(BlockNodeInfo *info, int indentation, bool protocol) + } + } + ++ if (info->limits) { ++ bdrv_image_info_limits_dump(info->limits, ++ "Block limits:\n", ++ indentation); ++ } ++ + if (info->has_snapshots) { + SnapshotInfoList *elem; + +diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst +index 5e7b85079d..fdc9ea9cf2 100644 +--- a/docs/tools/qemu-img.rst ++++ b/docs/tools/qemu-img.rst +@@ -503,7 +503,7 @@ Command description: + + The size syntax is similar to :manpage:`dd(1)`'s size syntax. + +-.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [-U] FILENAME ++.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-U] FILENAME + + Give information about the disk image *FILENAME*. Use it in + particular to know the size reserved on disk which can be different +@@ -571,6 +571,10 @@ Command description: + ``ImageInfoSpecific*`` QAPI object (e.g. ``ImageInfoSpecificQCow2`` + for qcow2 images). + ++ *Block limits* ++ The block limits for I/O that QEMU detected for the image. ++ This information is only shown if the ``--limits`` option was specified. ++ + .. option:: map [--object OBJECTDEF] [--image-opts] [-f FMT] [--start-offset=OFFSET] [--max-length=LEN] [--output=OFMT] [-U] FILENAME + + Dump the metadata of image *FILENAME* and its backing file chain. +diff --git a/include/block/qapi.h b/include/block/qapi.h +index 54c48de26a..be554e53dc 100644 +--- a/include/block/qapi.h ++++ b/include/block/qapi.h +@@ -42,7 +42,7 @@ bdrv_query_image_info(BlockDriverState *bs, ImageInfo **p_info, bool flat, + bool skip_implicit_filters, Error **errp); + void GRAPH_RDLOCK + bdrv_query_block_graph_info(BlockDriverState *bs, BlockGraphInfo **p_info, +- Error **errp); ++ bool limits, Error **errp); + + void bdrv_snapshot_dump(QEMUSnapshotInfo *sn); + void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec, +diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx +index 2c5a8a28f9..74b66f9d42 100644 +--- a/qemu-img-cmds.hx ++++ b/qemu-img-cmds.hx +@@ -66,9 +66,9 @@ SRST + ERST + + DEF("info", img_info, +- "info [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [--backing-chain] [-U] filename") ++ "info [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [--backing-chain] [--limits] [-U] filename") + SRST +-.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [-U] FILENAME ++.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-U] FILENAME + ERST + + DEF("map", img_map, +diff --git a/qemu-img.c b/qemu-img.c +index 7a162fdc08..5cdbeda969 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -86,6 +86,7 @@ enum { + OPTION_BITMAPS = 275, + OPTION_FORCE = 276, + OPTION_SKIP_BROKEN = 277, ++ OPTION_LIMITS = 278, + }; + + typedef enum OutputFormat { +@@ -3002,7 +3003,8 @@ static gboolean str_equal_func(gconstpointer a, gconstpointer b) + static BlockGraphInfoList *collect_image_info_list(bool image_opts, + const char *filename, + const char *fmt, +- bool chain, bool force_share) ++ bool chain, bool limits, ++ bool force_share) + { + BlockGraphInfoList *head = NULL; + BlockGraphInfoList **tail = &head; +@@ -3039,7 +3041,7 @@ static BlockGraphInfoList *collect_image_info_list(bool image_opts, + * the chain manually here. + */ + bdrv_graph_rdlock_main_loop(); +- bdrv_query_block_graph_info(bs, &info, &err); ++ bdrv_query_block_graph_info(bs, &info, limits, &err); + bdrv_graph_rdunlock_main_loop(); + + if (err) { +@@ -3088,6 +3090,7 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv) + BlockGraphInfoList *list; + bool image_opts = false; + bool force_share = false; ++ bool limits = false; + + fmt = NULL; + for(;;) { +@@ -3097,6 +3100,7 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv) + {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS}, + {"backing-chain", no_argument, 0, OPTION_BACKING_CHAIN}, + {"force-share", no_argument, 0, 'U'}, ++ {"limits", no_argument, 0, OPTION_LIMITS}, + {"output", required_argument, 0, OPTION_OUTPUT}, + {"object", required_argument, 0, OPTION_OBJECT}, + {0, 0, 0, 0} +@@ -3119,6 +3123,8 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv) + " display information about the backing chain for copy-on-write overlays\n" + " -U, --force-share\n" + " open image in shared mode for concurrent access\n" ++" --limits\n" ++" show detected block limits (may depend on options, e.g. cache mode)\n" + " --output human|json\n" + " specify output format (default: human)\n" + " --object OBJDEF\n" +@@ -3140,6 +3146,9 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv) + case 'U': + force_share = true; + break; ++ case OPTION_LIMITS: ++ limits = true; ++ break; + case OPTION_OUTPUT: + output_format = parse_output_format(argv[0], optarg); + break; +@@ -3156,7 +3165,7 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv) + filename = argv[optind++]; + + list = collect_image_info_list(image_opts, filename, fmt, chain, +- force_share); ++ limits, force_share); + if (!list) { + return 1; + } +-- +2.47.3 + diff --git a/kvm-rh-configs-enable-CONFIG_TDX-for-x86_64.patch b/kvm-rh-configs-enable-CONFIG_TDX-for-x86_64.patch new file mode 100644 index 0000000..68bc045 --- /dev/null +++ b/kvm-rh-configs-enable-CONFIG_TDX-for-x86_64.patch @@ -0,0 +1,37 @@ +From 94e93fc7673af3236dc13cd8cfe90953c48bc813 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 12 Dec 2025 12:30:30 +0100 +Subject: [PATCH 6/6] rh: configs: enable CONFIG_TDX for x86_64 + +RH-Author: Paolo Bonzini +RH-MergeRequest: 445: rh: configs: enable CONFIG_TDX for x86_64 +RH-Jira: RHEL-111853 +RH-Acked-by: Igor Mammedov +RH-Acked-by: Stefano Garzarella +RH-Commit: [1/1] 282972aa9e4f94097c68b046f6bb09c4b03705fc (bonzini/qemu-kvm-centos) + +JIRA: https://issues.redhat.com/browse/RHEL-111853 + +TDX support is included in 10.1 but we still need to enable it, +because RHEL is built --without-default-devices. + +Signed-off-by: Paolo Bonzini +--- + configs/devices/x86_64-softmmu/x86_64-rh-devices.mak | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak +index 1f244f766d..9063ae1b53 100644 +--- a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak ++++ b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak +@@ -74,6 +74,7 @@ CONFIG_SERIAL_PCI=y + CONFIG_SEV=y + CONFIG_SMBIOS=y + CONFIG_SMBUS_EEPROM=y ++CONFIG_TDX=y + CONFIG_TEST_DEVICES=y + CONFIG_USB=y + CONFIG_USB_EHCI=y +-- +2.47.3 + diff --git a/qemu-kvm.spec b/qemu-kvm.spec index 4efd29a..00b3732 100644 --- a/qemu-kvm.spec +++ b/qemu-kvm.spec @@ -143,7 +143,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version} \ Summary: QEMU is a machine emulator and virtualizer Name: qemu-kvm Version: 10.1.0 -Release: 8%{?rcrel}%{?dist}%{?cc_suffix} +Release: 9%{?rcrel}%{?dist}%{?cc_suffix} # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped # Epoch 15 used for RHEL 8 # Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5) @@ -333,6 +333,18 @@ Patch88: kvm-MAINTAINERS-Add-maintainers-for-mshv-accelerator.patch Patch89: kvm-accel-mshv-initialize-thread-name.patch # For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2 Patch90: kvm-accel-mshv-use-return-value-of-handle_pio_str_read.patch +# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2 +Patch91: kvm-monitor-generalize-query-mshv-info-mshv-to-query-acc.patch +# For RHEL-110003 - Expose block limits of block nodes in QMP and qemu-img +Patch92: kvm-block-Improve-comments-in-BlockLimits.patch +# For RHEL-110003 - Expose block limits of block nodes in QMP and qemu-img +Patch93: kvm-block-Expose-block-limits-for-images-in-QMP.patch +# For RHEL-110003 - Expose block limits of block nodes in QMP and qemu-img +Patch94: kvm-qemu-img-info-Optionally-show-block-limits.patch +# For RHEL-110003 - Expose block limits of block nodes in QMP and qemu-img +Patch95: kvm-qemu-img-info-Add-cache-mode-option.patch +# For RHEL-111853 - [Intel 10.0 FEAT] [SPR] TDX: Virt-QEMU: QEMU Support [rhel-10] +Patch96: kvm-rh-configs-enable-CONFIG_TDX-for-x86_64.patch %if %{have_clang} BuildRequires: clang @@ -1412,6 +1424,20 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %endif %changelog +* Mon Dec 15 2025 Miroslav Rezanina - 10.1.0-9 +- kvm-monitor-generalize-query-mshv-info-mshv-to-query-acc.patch [RHEL-134212] +- kvm-block-Improve-comments-in-BlockLimits.patch [RHEL-110003] +- kvm-block-Expose-block-limits-for-images-in-QMP.patch [RHEL-110003] +- kvm-qemu-img-info-Optionally-show-block-limits.patch [RHEL-110003] +- kvm-qemu-img-info-Add-cache-mode-option.patch [RHEL-110003] +- kvm-rh-configs-enable-CONFIG_TDX-for-x86_64.patch [RHEL-111853] +- Resolves: RHEL-134212 + ([RHEL10.2] L1VH qemu downstream initial merge RHEL10.2) +- Resolves: RHEL-110003 + (Expose block limits of block nodes in QMP and qemu-img) +- Resolves: RHEL-111853 + ([Intel 10.0 FEAT] [SPR] TDX: Virt-QEMU: QEMU Support [rhel-10]) + * Tue Dec 09 2025 Miroslav Rezanina - 10.1.0-8 - kvm-block-backend-Fix-race-when-resuming-queued-requests.patch [RHEL-129540] - kvm-file-posix-Handle-suspended-dm-multipath-better-for-.patch [RHEL-121543]