[pve-devel] [PATCH v3 qemu-server 3/7] cpumodel: compute qemu supported flags
Alexandre Derumier
aderumier at odiso.com
Mon May 22 12:25:24 CEST 2023
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/QemuServer/CPUConfig.pm | 2 +-
PVE/QemuServer/CPUModels.pm | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
index 758f93f..64be1f4 100644
--- a/PVE/QemuServer/CPUConfig.pm
+++ b/PVE/QemuServer/CPUConfig.pm
@@ -57,7 +57,7 @@ my $depreacated_cpu_map = {
'Icelake-Client-noTSX' => 'Icelake-Server-noTSX',
};
-my $qemu_cpu_models = get_default_cpu_models();
+my ($qemu_cpu_models, $qemu_supported_flags) = get_default_cpu_models();
my @supported_cpu_flags = (
'pcid',
diff --git a/PVE/QemuServer/CPUModels.pm b/PVE/QemuServer/CPUModels.pm
index 20aacb1..e838b0c 100644
--- a/PVE/QemuServer/CPUModels.pm
+++ b/PVE/QemuServer/CPUModels.pm
@@ -4205,7 +4205,17 @@ my $cpumodels = {
sub get_default_cpu_models {
- return $cpumodels;
+ my $supported_flags = {};
+
+ foreach my $model (keys %$cpumodels) {
+ my $flags = $cpumodels->{$model}->{flags};
+ next if !$flags;
+ foreach my $flag (keys %$flags) {
+ $supported_flags->{$flag} = 1;
+ }
+ }
+
+ return ($cpumodels, $supported_flags);
}
1;
\ No newline at end of file
--
2.30.2
More information about the pve-devel
mailing list