aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-07-15qemu-img: dd: refresh options/--helpMichael Tokarev1-14/+36
Add missing long options and --help output, reorder options for consistency. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-25-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: bitmap: refresh options/--helpMichael Tokarev1-24/+56
Add missing long options and --help output, reorder options for consistency. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-24-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: bench: refresh options/--helpMichael Tokarev1-28/+84
Add missing long options and --help output, reorder options for consistency. Add missing --object option. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-23-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: amend: refresh options/--helpMichael Tokarev2-21/+45
Add missing long options and --help output, reorder options for consistency. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-22-mjt@tls.msk.ru> [kwolf: Fixed up qemu-iotests] Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: resize: refresh options/--helpMichael Tokarev2-22/+42
Add missing long options and --help output, reorder options for consistency. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-21-mjt@tls.msk.ru> [kwolf: Fixed up qemu-iotests] Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: resize: do not always eat last argumentMichael Tokarev1-14/+27
'qemu-img resize --help' does not work, since it wants more arguments. Also -size is only recognized as a very last argument, but it is common for tools to handle other options after positional arguments too. Tell getopt_long() to return non-options together with options, and process filename and size in the loop, and check if there's an argument right after filename which looks like -N (number), and treat it as size (decrement). This way we can handle --help, and we can also have options after filename and size, and `--' will be handled fine too. The only case which is not handled right is when there's an option between filename and size, and size is given as decrement, - in this case -size will be treated as option, not as size. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-20-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: rebase: refresh options/--help (short option change)Michael Tokarev2-26/+63
Add missing long options and --help output, reorder options for consistency. Use -B for --backing-format, keep -F for backwards compatibility. Options added: --format, --cache - for the image in question --backing, --backing-format, --backing-cache, --backing-unsafe - for the new backing file (was eg CACHE vs SRC_CACHE, which is unclear). Probably should rename local variables. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-19-mjt@tls.msk.ru> [kwolf: Removed command description from the argument list] Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: snapshot: refresh options/--helpMichael Tokarev1-16/+44
Add missing long options and --help output, reorder options for consistency. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-18-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: snapshot: make -l (list) the default, simplify option handlingMichael Tokarev2-35/+19
When no -l/-a/-c/-d specified, assume -l (list). Use the same values for SNAPSHOT_LIST/etc constants as the option chars (lacd), this makes it possible to simplify option handling a lot, combining cases for 4 options into one. Also remove bdrv_oflags handling (only list can use RO mode). Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20250531171609.197078-17-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: snapshot: allow specifying -f fmtMichael Tokarev3-6/+9
For consistency with other commands, and since it already accepts --image-opts, allow specifying -f fmt too. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20250531171609.197078-16-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: map: refresh options/--helpMichael Tokarev1-21/+38
Add missing long options and --help output, reorder options for consistency. While at it, remove unused option_index variable. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250715140903.131529-1-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: info: refresh options/--helpMichael Tokarev1-19/+32
Add missing long options and --help output. Also add -b short option for --backing-chain, and remove now-unused OPTION_BACKING_CHAIN. Reorder options for consistency. While at it, remove unused option_index variable. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-14-mjt@tls.msk.ru> [kwolf: Fixed up help text formatting] Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: convert: refresh options/--help (short option change)Michael Tokarev2-73/+159
Add missing long options and --help output. Reorder options for consistency. Use -b for --backing, and recognize -B for backwards compatibility. Unfortunately we can't use -B to specify backing format. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250715140702.131321-1-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: compare: refresh options/--helpMichael Tokarev1-18/+46
Add long options, add help, reorder options for consistency. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-12-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: compare: use helper function for --objectMichael Tokarev1-14/+2
Use the same function to parse --object as used by all other qemu-img subcommands. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-11-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: commit: refresh options/--helpMichael Tokarev3-27/+55
Add missing long options and --help output, reorder options for consistency. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-10-mjt@tls.msk.ru> [kwolf: Fixed up qemu-iotests] Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: simplify --repair error messageMichael Tokarev1-2/+3
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20250531171609.197078-9-mjt@tls.msk.ru> [kwolf: Added missing comma in help text] Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: check: refresh options/--helpMichael Tokarev1-19/+41
Add missing long options and --help output, reorder options for consistency. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-8-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: factor out parse_output_format() and use it in the codeMichael Tokarev5-48/+29
Use common code and simplify error message Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20250531171609.197078-7-mjt@tls.msk.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: create: refresh options/--help (short option change)Michael Tokarev2-21/+73
Create helper function cmd_help() to display command-specific help text, and use it to print --help for 'create' subcommand. Add missing long options (eg --format) in img_create(). Recognize -B option for --backing-format, keep -F for backward compatibility, Reorder options for consistency. Remove usage of missing_argument()/unrecognized_option() in img_create(). Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-6-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: pass current cmd info into command handlersMichael Tokarev1-17/+17
This info will be used to generate --help output. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20250531171609.197078-5-mjt@tls.msk.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: global option processing and error printingMichael Tokarev1-37/+43
In order to correctly print executable name in various error messages, pass argv[0] to error_exit() function. This way, error messages will refer to actual executable name, which may be different from 'qemu-img'. For subcommands, pass original command name from the qemu-img argv[0], plus the subcommand name, as its own argv[0] element, so error messages can be more useful. Also don't require at least 3 options on the command line: it makes no sense with options before subcommand. Introduce tryhelp() function which just prints try 'command-name --help' for more info and exits. When tryhelp() is called from within a subcommand handler, the message will look like: try 'command-name subcommand --help' for more information qemu-img uses getopt_long() with ':' as the first char in optstring parameter, which means it doesn't print error messages but return ':' or '?' instead, and qemu-img uses unrecognized_option() or missing_argument() function to print error messages. But it doesn't quite work: $ ./qemu-img -xx qemu-img: unrecognized option './qemu-img' so the aim is to let getopt_long() to print regular error messages instead (removing ':' prefix from optstring) and remove handling of '?' and ':' "options" entirely. With concatenated argv[0] and the subcommand, it all finally does the right thing in all cases. This will be done in subsequent changes command by command, with main() done last. unrecognized_option() and missing_argument() functions prototypes aren't changed by this patch, since they're called from many places and will be removed a few patches later. Only artifical "qemu-img" argv0 is provided in there for now. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20250531171609.197078-4-mjt@tls.msk.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: create: convert img_size to signed, simplify handlingMichael Tokarev1-6/+3
Initializing an unsigned as -1, or using temporary sval for conversion is awkward. Since we don't allow other "negative" values anyway, use signed value and pass it to bdrv_img_create() (where it is properly converted to unsigned), simplifying code. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20250531171609.197078-3-mjt@tls.msk.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15qemu-img: measure: convert img_size to signed, simplify handlingMichael Tokarev1-12/+7
qemu_opt_set_number() expects signed int64_t. Use int64_t instead of uint64_t for img_size, use -1 as "unset" value instead of UINT64_MAX, and do not require temporary sval for conversion from string. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20250531171609.197078-2-mjt@tls.msk.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15iotests: add test for changing the 'drive' property via 'qom-set'Fiona Ebner2-0/+86
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Message-ID: <20250605100938.43133-1-f.ebner@proxmox.com> [kwolf: Fixed up pylint warnings flagged by 297] Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-07-15accel/tcg: Implement AccelClass::get_stats() handlerPhilippe Mathieu-Daudé3-2/+10
Factor tcg_get_stats() out of tcg_dump_stats(), passing the current accelerator argument to match the AccelClass::get_stats() prototype. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250715140048.84942-7-philmd@linaro.org>
2025-07-15accel/tcg: Propagate AccelState to dump_accel_info()Philippe Mathieu-Daudé4-5/+5
Declare tcg_dump_stats() in "tcg/tcg.h" so it can be used out of accel/tcg/, like by {bsd,linux}-user. Next commit will register the TCG AccelClass::get_stats handler, which expects a AccelState, so propagate it to dump_accel_info(). Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20250715140048.84942-6-philmd@linaro.org>
2025-07-15accel/system: Add 'info accel' on human monitorPhilippe Mathieu-Daudé2-0/+20
'info accel' dispatches to the AccelOpsClass::get_stats() and get_vcpu_stats() handlers. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20250715140048.84942-5-philmd@linaro.org>
2025-07-15accel/system: Introduce @x-accel-stats QMP commandPhilippe Mathieu-Daudé6-1/+59
Unstable QMP 'x-accel-stats' dispatches to the AccelOpsClass::get_stats() and get_vcpu_stats() handlers. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Message-Id: <20250715140048.84942-4-philmd@linaro.org>
2025-07-15accel/tcg: Extract statistic related code to tcg-stats.cPhilippe Mathieu-Daudé3-201/+216
Statistic code is not specific to system emulation (except cross-page checks) and can be used to analyze user-mode binaries. Extract statistic related code to its own file: tcg-stats.c, keeping the original LGPL-2.1-or-later license tag. Note, this code is not yet reachable by user-mode. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250715140048.84942-3-philmd@linaro.org>
2025-07-15Revert "accel/tcg: Unregister the RCU before exiting RR thread"Philippe Mathieu-Daudé1-2/+0
This reverts commit bc93332fe460211c2d2f4ff50e1a0e030c7b5159, which was merged prematurely, re-introducing Coverity CID 1547782 (unreachable code). Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250715104015.72663-2-philmd@linaro.org>
2025-07-15accel: Extract AccelClass definition to 'accel/accel-ops.h'Philippe Mathieu-Daudé19-39/+71
Only accelerator implementations (and the common accelator code) need to know about AccelClass internals. Move the definition out but forward declare AccelState and AccelClass. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250703173248.44995-39-philmd@linaro.org>
2025-07-15accel: Rename 'system/accel-ops.h' -> 'accel/accel-cpu-ops.h'Philippe Mathieu-Daudé12-15/+15
Unfortunately "system/accel-ops.h" handlers are not only system-specific. For example, the cpu_reset_hold() hook is part of the vCPU creation, after it is realized. Mechanical rename to drop 'system' using: $ sed -i -e s_system/accel-ops.h_accel/accel-cpu-ops.h_g \ $(git grep -l system/accel-ops.h) Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250703173248.44995-38-philmd@linaro.org>
2025-07-15accel/tcg: Do not dump NaN statisticsPhilippe Mathieu-Daudé1-7/+15
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-Id: <20250710111303.8917-1-philmd@linaro.org>
2025-07-15hw/core/machine: Display CPU model name in 'info cpus' commandPhilippe Mathieu-Daudé1-1/+3
Display the CPU model in 'info cpus'. Example before: $ qemu-system-aarch64 -M xlnx-versal-virt -S -monitor stdio QEMU 10.0.0 monitor - type 'help' for more information (qemu) info cpus * CPU #0: thread_id=42924 CPU #1: thread_id=42924 CPU #2: thread_id=42924 CPU #3: thread_id=42924 (qemu) q and after: $ qemu-system-aarch64 -M xlnx-versal-virt -S -monitor stdio QEMU 10.0.50 monitor - type 'help' for more information (qemu) info cpus * CPU #0: thread_id=42916 model=cortex-a72 CPU #1: thread_id=42916 model=cortex-a72 CPU #2: thread_id=42916 model=cortex-r5f CPU #3: thread_id=42916 model=cortex-r5f (qemu) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Tested-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Message-Id: <20250715090624.52377-3-philmd@linaro.org>
2025-07-15qapi/machine: Add @qom-type field to CpuInfoFast structurePhilippe Mathieu-Daudé2-0/+4
Knowing the QOM type name of a CPU can be useful, in particular to infer its model name. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Message-Id: <20250715090624.52377-2-philmd@linaro.org>
2025-07-15qapi/accel: Move definitions related to accelerators in their own filePhilippe Mathieu-Daudé7-29/+44
Extract KVM definitions from machine.json to accelerator.json. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Message-Id: <20250703105540.67664-29-philmd@linaro.org>
2025-07-15hw/arm/xen-pvh: Remove unnecessary 'hw/xen/arch_hvm.h' headerPhilippe Mathieu-Daudé1-1/+0
"hw/xen/arch_hvm.h" only declares the arch_handle_ioreq() and arch_xen_set_memory() prototypes, which are not used by xen-pvh.c. Remove the unnecessary header inclusion. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-Id: <20250715071528.46196-1-philmd@linaro.org>
2025-07-15hw/xen/arch_hvm: Unify x86 and ARM variantsPhilippe Mathieu-Daudé3-24/+10
As each target declares the same prototypes, we can use a single header, removing the TARGET_XXX uses. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Message-Id: <20250513171737.74386-1-philmd@linaro.org>
2025-07-15vfio/migration: Max in-flight VFIO device state buffers size limitMaciej S. Szmigiero4-2/+42
Allow capping the maximum total size of in-flight VFIO device state buffers queued at the destination, otherwise a malicious QEMU source could theoretically cause the target QEMU to allocate unlimited amounts of memory for buffers-in-flight. Since this is not expected to be a realistic threat in most of VFIO live migration use cases and the right value depends on the particular setup disable this limit by default by setting it to UINT64_MAX. Reviewed-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Avihai Horon <avihaih@nvidia.com> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Link: https://lore.kernel.org/qemu-devel/4f7cad490988288f58e36b162d7a888ed7e7fd17.1752589295.git.maciej.szmigiero@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
2025-07-15vfio/migration: Add x-migration-load-config-after-iter VFIO propertyMaciej S. Szmigiero10-1/+129
This property allows configuring whether to start the config load only after all iterables were loaded, during non-iterables loading phase. Such interlocking is required for ARM64 due to this platform VFIO dependency on interrupt controller being loaded first. The property defaults to AUTO, which means ON for ARM, OFF for other platforms. Reviewed-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Avihai Horon <avihaih@nvidia.com> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Link: https://lore.kernel.org/qemu-devel/0e03c60dbc91f9a9ba2516929574df605b7dfcb4.1752589295.git.maciej.szmigiero@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
2025-07-15vfio/pci: Introduce x-pci-class-code optionTomita Moeko3-8/+28
Introduce x-pci-class-code option to allow users to override PCI class code of a device, similar to the existing x-pci-vendor-id option. Only the lower 24 bits of this option are used, though a uint32 is used here for determining whether the value is valid and set by user. Additionally, to ensure VGA ranges are only exposed on VGA devices, pci_register_vga() is now called in vfio_pci_config_setup(), after the class code override is completed. This is mainly intended for IGD devices that expose themselves either as VGA controller (primary display) or Display controller (non-primary display). The UEFI GOP driver depends on the device reporting a VGA controller class code (0x030000). Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Link: https://lore.kernel.org/qemu-devel/20250708145211.6179-1-tomitamoeko@gmail.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
2025-07-15hw/vfio-user: fix use of uninitialized variableJohn Levon1-5/+1
Coverity reported: CID 1611805: Uninitialized variables in vfio_user_dma_map(). This can occur in the happy path when ->async_ops was not set; as this doesn't typically happen, it wasn't caught during testing. Align both map and unmap implementations to initialize ret the same way to resolve this. Resolves: Coverity CID 1611805 Fixes: 18e899e6 ("vfio-user: implement VFIO_USER_DMA_MAP/UNMAP") Reported-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Link: https://lore.kernel.org/qemu-devel/20250715115954.515819-5-john.levon@nutanix.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
2025-07-15hw/vfio-user: wait for proxy close correctlyJohn Levon1-4/+6
Coverity reported: CID 1611806: Concurrent data access violations (BAD_CHECK_OF_WAIT_COND) A wait is performed without a loop. If there is a spurious wakeup, the condition may not be satisfied. Fix this by checking ->state for VFIO_PROXY_CLOSED in a loop. Also rename the callback for clarity. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Mark Cave-Ayland <markcaveayland@nutanix.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/qemu-devel/20250715115954.515819-4-john.levon@nutanix.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
2025-07-15hw/vfio: fix region fd initializationJohn Levon1-1/+5
We were not initializing the region fd array to -1, so we would accidentally try to close(0) on cleanup for any region that is not referenced. Fixes: 95cdb024 ("vfio: add region info cache") Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/qemu-devel/20250715115954.515819-3-john.levon@nutanix.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
2025-07-15hw/vfio-user: add Cédric Le Goater as a maintainerJohn Levon1-0/+1
Signed-off-by: John Levon <john.levon@nutanix.com> Acked-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Link: https://lore.kernel.org/qemu-devel/20250715115954.515819-2-john.levon@nutanix.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
2025-07-15hw/cxl: mailbox-utils: 0x5605 - FMAPI Initiate DC ReleaseAnisa Su1-0/+88
FM DCD Management command 0x5605 implemented per CXL r3.2 Spec Section 7.6.7.6.6 Reviewed-by: Fan Ni <fan.ni@samsung.com> Signed-off-by: Anisa Su <anisa.su@samsung.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Message-Id: <20250714174509.1984430-12-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2025-07-15hw/cxl: mailbox-utils: 0x5604 - FMAPI Initiate DC AddAnisa Su3-4/+117
FM DCD Management command 0x5604 implemented per CXL r3.2 Spec Section 7.6.7.6.5 Reviewed-by: Fan Ni <fan.ni@samsung.com> Signed-off-by: Anisa Su <anisa.su@samsung.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Message-Id: <20250714174509.1984430-11-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2025-07-15hw/cxl: Create helper function to create DC Event Records from extentsAnisa Su5-37/+44
Prepatory patch for following FMAPI Add/Release Patches. Refactors part of qmp_cxl_process_dynamic_capacity_prescriptive() into a helper function to create DC Event Records and insert in the event log. Moves definition for CXL_NUM_EXTENTS_SUPPORTED to cxl.h so it can be accessed by cxl-mailbox-utils.c and cxl-events.c, where the helper function is defined. Reviewed-by: Fan Ni <fan.ni@samsung.com> Signed-off-by: Anisa Su <anisa.su@samsung.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Message-Id: <20250714174509.1984430-10-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2025-07-15hw/cxl: mailbox-utils: 0x5603 - FMAPI Get DC Region Extent ListsAnisa Su1-0/+76
FM DCD Management command 0x5603 implemented per CXL r3.2 Spec Section 7.6.7.6.4 Very similar to previously implemented command 0x4801. Reviewed-by: Fan Ni <fan.ni@samsung.com> Signed-off-by: Anisa Su <anisa.su@samsung.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Message-Id: <20250714174509.1984430-9-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>