[pve-devel] [PATCH qemu-server] CPU flags: add spec-ctrl

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Jan 16 10:06:41 CET 2018


to allow VMs to use IBRS/IBPB on systems with patched microcode

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
for master & stable-4, but the latter needs a pve-qemu-kvm backport first

 PVE/QemuServer.pm | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 1ca3456..e44053d 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -136,6 +136,8 @@ my $cpu_vendor_list = {
     qemu64 => 'default',
 };
 
+my $cpu_flag = qr/[+-](pcid|spec-ctrl)/;
+
 my $cpu_fmt = {
     cputype => {
 	description => "Emulated CPU type.",
@@ -151,14 +153,13 @@ my $cpu_fmt = {
 	default => 0
     },
     flags => {
-	description => "Override CPU flags. Currently only the 'pcid' flag is supported."
-		     . " Use '+pcid' or '-pcid' to enable or disable."
-		     . " This takes precedence over flags coming from the cpu type or changed implicitly via the OS type.",
-	format_description => 'flaglist',
+	description => "List of additional CPU flags separated by ';'."
+		     . " Use '+FLAG' to enable, '-FLAG' to disable a flag."
+		     . " Currently supported flags: 'pcid', 'spec-ctrl'.",
+	format_description => '+FLAG[;-FLAG...]',
 	type => 'string',
-	pattern => '[+-]pcid',
+	pattern => qr/$cpu_flag(;$cpu_flag)*/,
 	optional => 1,
-	default => '',
     },
 };
 
@@ -3155,7 +3156,7 @@ sub config_to_command {
 	$kvm_off = 1 if $cpuconf->{hidden};
 
 	if (defined(my $flags = $cpuconf->{flags})) {
-	    push @$cpuFlags, $flags;
+	    push @$cpuFlags, split(";", $flags);
 	}
     }
 
-- 
2.14.2





More information about the pve-devel mailing list