}
my $default_filename = "virtual-guest/cpu-models.conf";
-cfs_register_file($default_filename,
- sub { PVE::QemuServer::CPUConfig->parse_config(@_); },
- sub { PVE::QemuServer::CPUConfig->write_config(@_); });
+cfs_register_file(
+ $default_filename,
+ sub { PVE::QemuServer::CPUConfig->parse_config(@_); },
+ sub { PVE::QemuServer::CPUConfig->write_config(@_); },
+);
sub load_custom_model_conf {
return cfs_read_file($default_filename);
}
+my $depreacated_cpu_map = {
+ # there never was such a client CPU, so map it to the server one for backward compat
+ 'Icelake-Client' => 'Icelake-Server',
+ 'Icelake-Client-noTSX' => 'Icelake-Server-noTSX',
+};
+
my $cpu_vendor_list = {
# Intel CPUs
486 => 'GenuineIntel',
'Cascadelake-Server' => 'GenuineIntel',
'Cascadelake-Server-noTSX' => 'GenuineIntel',
KnightsMill => 'GenuineIntel',
- 'Icelake-Client' => 'GenuineIntel',
- 'Icelake-Client-noTSX' => 'GenuineIntel',
+ 'Icelake-Client' => 'GenuineIntel', # depreacated, removed with QEMU 7.1
+ 'Icelake-Client-noTSX' => 'GenuineIntel', # depreacated, removed with QEMU 7.1
'Icelake-Server' => 'GenuineIntel',
'Icelake-Server-noTSX' => 'GenuineIntel',
EPYC => 'AuthenticAMD',
'EPYC-IBPB' => 'AuthenticAMD',
'EPYC-Rome' => 'AuthenticAMD',
+ 'EPYC-Milan' => 'AuthenticAMD',
# generic types, use vendor from host node
host => 'default',
},
'reported-model' => {
description => "CPU model and vendor to report to the guest. Must be a QEMU/KVM supported model."
- . " Only valid for custom CPU model definitions, default models will always report themselves to the guest OS.",
+ ." Only valid for custom CPU model definitions, default models will always report themselves to the guest OS.",
type => 'string',
enum => [ sort { lc("$a") cmp lc("$b") } keys %$cpu_vendor_list ],
default => 'kvm64',
optional => 1,
},
flags => {
- description => "List of additional CPU flags separated by ';'."
- . " Use '+FLAG' to enable, '-FLAG' to disable a flag."
- . " Custom CPU models can specify any flag supported by"
- . " QEMU/KVM, VM-specific flags must be from the following"
- . " set for security reasons: @{[join(', ', @supported_cpu_flags)]}.",
+ description => "List of additional CPU flags separated by ';'. Use '+FLAG' to enable,"
+ ." '-FLAG' to disable a flag. Custom CPU models can specify any flag supported by"
+ ." QEMU/KVM, VM-specific flags must be from the following set for security reasons: "
+ . join(', ', @supported_cpu_flags),
format_description => '+FLAG[;-FLAG...]',
type => 'string',
pattern => qr/$cpu_flag_any_re(;$cpu_flag_any_re)*/,
type => 'string',
format => 'pve-phys-bits',
format_description => '8-64|host',
- description => "The physical memory address bits that are reported to"
- . " the guest OS. Should be smaller or equal to the host's."
- . " Set to 'host' to use value from host CPU, but note that"
- . " doing so will break live migration to CPUs with other values.",
+ description => "The physical memory address bits that are reported to the guest OS. Should"
+ ." be smaller or equal to the host's. Set to 'host' to use value from host CPU, but"
+ ." note that doing so will break live migration to CPUs with other values.",
optional => 1,
},
};
PVE::JSONSchema::register_format('pve-cpu-conf', $cpu_fmt, \&validate_cpu_conf);
sub validate_cpu_conf {
my ($cpu) = @_;
-
- # required, but can't be forced in schema since it's encoded in section
- # header for custom models
+ # required, but can't be forced in schema since it's encoded in section header for custom models
die "CPU is missing cputype\n" if !$cpu->{cputype};
-
return $cpu;
}
PVE::JSONSchema::register_format('pve-vm-cpu-conf', $cpu_fmt, \&validate_vm_cpu_conf);
if (is_custom_model($cpu)) {
my $custom_cpu = get_custom_model($cpu);
- $cpu = $custom_cpu->{'reported-model'} //
- $cpu_fmt->{'reported-model'}->{default};
+ $cpu = $custom_cpu->{'reported-model'} // $cpu_fmt->{'reported-model'}->{default};
+ }
+ if (my $replacement_type = $depreacated_cpu_map->{$cpu}) {
+ $cpu = $replacement_type;
}
}
my $current_core = ($id - 1) % $cores;
my $current_socket = int(($id - 1 - $current_core)/$cores);
+ # FIXME: hot plugging other architectures like our unofficial arch64 support?
return "$cpu-x86_64-cpu,id=cpu$id,socket-id=$current_socket,core-id=$current_core,thread-id=0";
}
if (is_custom_model($cputype)) {
$custom_cpu = get_custom_model($cputype);
- $cputype = $custom_cpu->{'reported-model'} //
- $cpu_fmt->{'reported-model'}->{default};
- $kvm_off = $custom_cpu->{hidden}
- if defined($custom_cpu->{hidden});
+ $cputype = $custom_cpu->{'reported-model'} // $cpu_fmt->{'reported-model'}->{default};
+ $kvm_off = $custom_cpu->{hidden} if defined($custom_cpu->{hidden});
$hv_vendor_id = $custom_cpu->{'hv-vendor-id'};
}
+ if (my $replacement_type = $depreacated_cpu_map->{$cputype}) {
+ $cputype = $replacement_type;
+ }
+
# VM-specific settings override custom CPU config
- $kvm_off = $cpu->{hidden}
- if defined($cpu->{hidden});
- $hv_vendor_id = $cpu->{'hv-vendor-id'}
- if defined($cpu->{'hv-vendor-id'});
+ $kvm_off = $cpu->{hidden} if defined($cpu->{hidden});
+ $hv_vendor_id = $cpu->{'hv-vendor-id'} if defined($cpu->{'hv-vendor-id'});
}
my $pve_flags = get_pve_cpu_flags($conf, $kvm, $cputype, $arch, $machine_version);
)
: undef;
- my $custom_cputype_flags = parse_cpuflag_list($cpu_flag_any_re,
- "set by custom CPU model", $custom_cpu->{flags});
+ my $custom_cputype_flags = parse_cpuflag_list(
+ $cpu_flag_any_re, "set by custom CPU model", $custom_cpu->{flags});
- my $vm_flags = parse_cpuflag_list($cpu_flag_supported_re,
- "manually set for VM", $cpu->{flags});
+ my $vm_flags = parse_cpuflag_list(
+ $cpu_flag_supported_re, "manually set for VM", $cpu->{flags});
my $pve_forced_flags = {};
$pve_forced_flags->{'enforce'} = {
my $cpu_str = $cputype;
# will be resolved in parameter order
- $cpu_str .= resolve_cpu_flags($pve_flags, $hv_flags, $custom_cputype_flags,
- $vm_flags, $pve_forced_flags);
+ $cpu_str .= resolve_cpu_flags(
+ $pve_flags, $hv_flags, $custom_cputype_flags, $vm_flags, $pve_forced_flags);
my $phys_bits = '';
foreach my $conf ($custom_cpu, $cpu) {