So users can disable them (they're enabled by default in QEMU) Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> --- This patch may make sense, regardless if we'll apply the reversal of the default...
PVE/QemuServer.pm | 2 ++ PVE/QemuServer/Machine.pm | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 13af495d..b8ce4750 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -3975,6 +3975,8 @@ sub config_to_command { push @$machineFlags, 'accel=tcg'; } + PVE::QemuServer::Machine::check_and_set_power_state_flags($globalFlags, $machine_conf); + push @$machineFlags, 'smm=off' if should_disable_smm($conf, $vga, $machine_type); my $machine_type_min = $machine_type; diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm index ebaf2dcc..377abc8a 100644 --- a/PVE/QemuServer/Machine.pm +++ b/PVE/QemuServer/Machine.pm @@ -31,6 +31,16 @@ my $machine_fmt = { enum => ['intel', 'virtio'], optional => 1, }, + 'enable-s3' => { + type => 'boolean', + description => "Enables S3 power state. Defaults to true.", + optional => 1, + }, + 'enable-s4' => { + type => 'boolean', + description => "Enables S4 power state. Defaults to true.", + optional => 1, + }, }; PVE::JSONSchema::register_format('pve-qemu-machine-fmt', $machine_fmt); @@ -293,4 +303,34 @@ sub check_and_pin_machine_string { return print_machine($machine_conf); } +# disable s3/s4 by default for 9.2+pve1 machine types +sub check_and_set_power_state_flags { + my ($globalFlags, $machine_conf) = @_; + + my $get_flag = sub { + my ($q35, $type, $value) = @_; + + if ($q35) { + return "ICH9-LPC.disable_${type}=${value}"; + } else { + return "PIIX4_PM.disable_${type}=${value}"; + } + }; + + my $q35 = $machine_conf->{type} && ($machine_conf->{type} =~ m/q35/) ? 1 : 0; + + my $s3 = $machine_conf->{'enable-s3'} // 1; + my $s4 = $machine_conf->{'enable-s4'} // 1; + + # they're enabled by default in QEMU, so only add the flags to disable them + if (!$s3) { + push $globalFlags->@*, $get_flag->($q35, 's3', 1) + } + if (!$s4) { + push $globalFlags->@*, $get_flag->($q35, 's4', 1) + } + + return; +} + 1; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel