From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 6CE34BBB73 for ; Tue, 19 Dec 2023 10:41:00 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3D309351A5 for ; Tue, 19 Dec 2023 10:40:30 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 19 Dec 2023 10:40:29 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id C2C7E4855B for ; Tue, 19 Dec 2023 10:40:28 +0100 (CET) From: Filip Schauer To: pve-devel@lists.proxmox.com Date: Tue, 19 Dec 2023 10:40:20 +0100 Message-Id: <20231219094023.25726-3-f.schauer@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219094023.25726-1-f.schauer@proxmox.com> References: <20231219094023.25726-1-f.schauer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.147 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [helpers.pm, cpuconfig.pm] Subject: [pve-devel] [PATCH qemu-server 1/4] cpu config: Add helper to get the default CPU type X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Dec 2023 09:41:00 -0000 Signed-off-by: Filip Schauer --- PVE/QemuServer/CPUConfig.pm | 9 +++------ PVE/QemuServer/Helpers.pm | 10 ++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm index ca2946b..c25c2c8 100644 --- a/PVE/QemuServer/CPUConfig.pm +++ b/PVE/QemuServer/CPUConfig.pm @@ -5,7 +5,7 @@ use warnings; use PVE::JSONSchema; use PVE::Cluster qw(cfs_register_file cfs_read_file); -use PVE::QemuServer::Helpers qw(min_version); +use PVE::QemuServer::Helpers qw(get_default_cpu_type min_version); use base qw(PVE::SectionConfig Exporter); @@ -405,7 +405,7 @@ sub print_cpu_device { my ($conf, $id) = @_; my $kvm = $conf->{kvm} // 1; - my $cpu = $kvm ? "kvm64" : "qemu64"; + my $cpu = get_default_cpu_type('x86_64', $kvm); if (my $cputype = $conf->{cpu}) { my $cpuconf = PVE::JSONSchema::parse_property_string('pve-vm-cpu-conf', $cputype) or die "Cannot parse cpu description: $cputype\n"; @@ -515,10 +515,7 @@ sub parse_cpuflag_list { sub get_cpu_options { my ($conf, $arch, $kvm, $kvm_off, $machine_version, $winversion, $gpu_passthrough) = @_; - my $cputype = $kvm ? "kvm64" : "qemu64"; - if ($arch eq 'aarch64') { - $cputype = 'cortex-a57'; - } + my $cputype = get_default_cpu_type($arch, $kvm); my $cpu = {}; my $custom_cpu; diff --git a/PVE/QemuServer/Helpers.pm b/PVE/QemuServer/Helpers.pm index 0afb631..77052ad 100644 --- a/PVE/QemuServer/Helpers.pm +++ b/PVE/QemuServer/Helpers.pm @@ -15,6 +15,7 @@ min_version config_aware_timeout parse_number_sets windows_version +get_default_cpu_type ); my $nodename = PVE::INotify::nodename(); @@ -225,4 +226,13 @@ sub windows_version { return $winversion; } +sub get_default_cpu_type { + my ($arch, $kvm) = @_; + + my $cputype = $kvm ? 'kvm64' : 'qemu64'; + $cputype = 'cortex-a57' if $arch eq 'aarch64'; + + return $cputype; +} + 1; -- 2.39.2