CPU flags: add spec-ctrl

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

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2018-01-16 10:06:41 +01:00 committed by Wolfgang Bumiller
parent a446dbf46b
commit 049fc9ebe7

View File

@ -148,6 +148,8 @@ my $cpu_vendor_list = {
max => 'default', max => 'default',
}; };
my $cpu_flag = qr/[+-](pcid|spec-ctrl)/;
my $cpu_fmt = { my $cpu_fmt = {
cputype => { cputype => {
description => "Emulated CPU type.", description => "Emulated CPU type.",
@ -163,14 +165,13 @@ my $cpu_fmt = {
default => 0 default => 0
}, },
flags => { flags => {
description => "Override CPU flags. Currently only the 'pcid' flag is supported." description => "List of additional CPU flags separated by ';'."
. " Use '+pcid' or '-pcid' to enable or disable." . " Use '+FLAG' to enable, '-FLAG' to disable a flag."
. " This takes precedence over flags coming from the cpu type or changed implicitly via the OS type.", . " Currently supported flags: 'pcid', 'spec-ctrl'.",
format_description => 'flaglist', format_description => '+FLAG[;-FLAG...]',
type => 'string', type => 'string',
pattern => '[+-]pcid', pattern => qr/$cpu_flag(;$cpu_flag)*/,
optional => 1, optional => 1,
default => '',
}, },
}; };
@ -3167,7 +3168,7 @@ sub config_to_command {
$kvm_off = 1 if $cpuconf->{hidden}; $kvm_off = 1 if $cpuconf->{hidden};
if (defined(my $flags = $cpuconf->{flags})) { if (defined(my $flags = $cpuconf->{flags})) {
push @$cpuFlags, $flags; push @$cpuFlags, split(";", $flags);
} }
} }