mirror of
https://github.com/qemu/qemu.git
synced 2026-04-14 02:02:21 +00:00
hw/machine: introduce machine specific option 'x-change-vmfd-on-reset'
A new machine specific option 'x-change-vmfd-on-reset' is introduced for debugging and testing only (hence the 'x-' prefix). This option when enabled will force KVM VM file descriptor to be changed upon guest reset like in the case of confidential guests. This can be used to exercise the code changes that are specific for confidential guests on non-confidential guests as well (except changes that require hardware support for confidential guests). A new functional test has been added in the next patch that uses this new parameter to test the VM file descriptor changes. Signed-off-by: Ani Sinha <anisinha@redhat.com> Link: https://lore.kernel.org/r/20260225035000.385950-33-anisinha@redhat.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
@@ -435,6 +435,21 @@ static void machine_set_dump_guest_core(Object *obj, bool value, Error **errp)
|
||||
ms->dump_guest_core = value;
|
||||
}
|
||||
|
||||
static bool machine_get_new_accel_vmfd_on_reset(Object *obj, Error **errp)
|
||||
{
|
||||
MachineState *ms = MACHINE(obj);
|
||||
|
||||
return ms->new_accel_vmfd_on_reset;
|
||||
}
|
||||
|
||||
static void machine_set_new_accel_vmfd_on_reset(Object *obj,
|
||||
bool value, Error **errp)
|
||||
{
|
||||
MachineState *ms = MACHINE(obj);
|
||||
|
||||
ms->new_accel_vmfd_on_reset = value;
|
||||
}
|
||||
|
||||
static bool machine_get_mem_merge(Object *obj, Error **errp)
|
||||
{
|
||||
MachineState *ms = MACHINE(obj);
|
||||
@@ -1183,6 +1198,13 @@ static void machine_class_init(ObjectClass *oc, const void *data)
|
||||
object_class_property_set_description(oc, "dump-guest-core",
|
||||
"Include guest memory in a core dump");
|
||||
|
||||
object_class_property_add_bool(oc, "x-change-vmfd-on-reset",
|
||||
machine_get_new_accel_vmfd_on_reset,
|
||||
machine_set_new_accel_vmfd_on_reset);
|
||||
object_class_property_set_description(oc, "x-change-vmfd-on-reset",
|
||||
"Set on/off to enable/disable generating new accelerator guest handle "
|
||||
"on guest reset. Default: off (used only for testing/debugging).");
|
||||
|
||||
object_class_property_add_bool(oc, "mem-merge",
|
||||
machine_get_mem_merge, machine_set_mem_merge);
|
||||
object_class_property_set_description(oc, "mem-merge",
|
||||
|
||||
@@ -448,6 +448,12 @@ struct MachineState {
|
||||
struct NVDIMMState *nvdimms_state;
|
||||
struct NumaState *numa_state;
|
||||
bool acpi_spcr_enabled;
|
||||
/*
|
||||
* Whether to change virtual machine accelerator handle upon
|
||||
* reset or not. Used only for debugging and testing purpose.
|
||||
* Set to false by default for all regular use.
|
||||
*/
|
||||
bool new_accel_vmfd_on_reset;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -526,9 +526,9 @@ void qemu_system_reset(ShutdownCause reason)
|
||||
type = RESET_TYPE_COLD;
|
||||
}
|
||||
|
||||
if (!cpus_are_resettable() &&
|
||||
(reason == SHUTDOWN_CAUSE_GUEST_RESET ||
|
||||
reason == SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET)) {
|
||||
if ((reason == SHUTDOWN_CAUSE_GUEST_RESET ||
|
||||
reason == SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET) &&
|
||||
(current_machine->new_accel_vmfd_on_reset || !cpus_are_resettable())) {
|
||||
if (ac->rebuild_guest) {
|
||||
ret = ac->rebuild_guest(current_machine);
|
||||
if (ret < 0) {
|
||||
|
||||
Reference in New Issue
Block a user