From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server v2 5/8] machine: add S3/S4 power state properties
Date: Fri, 7 Mar 2025 15:44:32 +0100 [thread overview]
Message-ID: <20250307144436.122621-6-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250307144436.122621-1-d.csapak@proxmox.com>
So users can disable them (they're enabled by default in QEMU)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* rework the method with suggestions from fiona
* change way we add flags because we don't have globalflags anymore
PVE/QemuServer.pm | 4 ++++
PVE/QemuServer/Machine.pm | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 1da7e9a1..1aaee8d0 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3975,6 +3975,10 @@ sub config_to_command {
push @$machineFlags, 'accel=tcg';
}
+ if (my $options = PVE::QemuServer::Machine::check_and_set_power_state_flags($machine_conf)) {
+ push $cmd->@*, $options->@*;
+ }
+
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 a5962443..d2349d4d 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);
@@ -284,4 +294,31 @@ sub check_and_pin_machine_string {
return print_machine($machine_conf);
}
+# disable s3/s4 by default for 9.2+pve1 machine types
+# returns a list of cmdline options for qemu or undef
+sub check_and_set_power_state_flags {
+ my ($machine_conf) = @_;
+
+ my $object = $machine_conf->{type} && ($machine_conf->{type} =~ m/q35/) ? "ICH9-LPC" : "PIIX4_PM";
+
+ my $s3 = $machine_conf->{'enable-s3'} // 1;
+ my $s4 = $machine_conf->{'enable-s4'} // 1;
+
+ my $options = [];
+
+ # they're enabled by default in QEMU, so only add the flags to disable them
+ if (!$s3) {
+ push $options->@*, '-global', "${object}.disable_s3=1";
+ }
+ if (!$s4) {
+ push $options->@*, '-global', "${object}.disable_s4=1";
+ }
+
+ if (scalar($options->@*)) {
+ return $options;
+ }
+
+ return;
+}
+
1;
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-03-07 14:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 14:44 [pve-devel] [PATCH qemu-server/docs v2] disable S3/S4 power states by default Dominik Csapak
2025-03-07 14:44 ` [pve-devel] [PATCH qemu-server v2 1/8] tests: cfg2cmd: add test for windows machine pinning from meta info Dominik Csapak
2025-03-07 14:44 ` [pve-devel] [PATCH qemu-server v2 2/8] config to command: get rid of globalFlags Dominik Csapak
2025-03-07 14:44 ` [pve-devel] [PATCH qemu-server v2 3/8] machine: correctly select pve machine version for non pinned windows guests Dominik Csapak
2025-03-07 14:44 ` [pve-devel] [PATCH qemu-server v2 4/8] machine: incorporate pve machine version when pinning " Dominik Csapak
2025-03-07 14:44 ` Dominik Csapak [this message]
2025-04-04 11:53 ` [pve-devel] [PATCH qemu-server v2 5/8] machine: add S3/S4 power state properties Fiona Ebner
2025-03-07 14:44 ` [pve-devel] [PATCH qemu-server v2 6/8] machine: bump pve machine version and reverse the s3/s4 defaults Dominik Csapak
2025-04-04 11:54 ` Fiona Ebner
2025-03-07 14:44 ` [pve-devel] [PATCH qemu-server v2 7/8] api: qemu machine capabilities: add custom pveX versions too Dominik Csapak
2025-04-04 12:02 ` Fiona Ebner
2025-03-07 14:44 ` [pve-devel] [PATCH qemu-server v2 8/8] api: qemu machine capabilities: add description for pveX variants Dominik Csapak
2025-04-04 12:04 ` Fiona Ebner
2025-04-04 12:24 ` Fiona Ebner
2025-03-07 14:44 ` [pve-devel] [PATCH docs v2 1/1] qm: pve machine version: add section to explain +pveX versions Dominik Csapak
2025-04-04 12:20 ` Fiona Ebner
2025-04-01 9:17 ` [pve-devel] [PATCH qemu-server/docs v2] disable S3/S4 power states by default Dominik Csapak
2025-04-04 12:22 ` Fiona Ebner
2025-04-04 13:23 ` Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250307144436.122621-6-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal