public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v2 4/8] cpu config: introduce module-wide $host_arch variable
Date: Thu, 29 Jan 2026 14:10:01 +0100	[thread overview]
Message-ID: <20260129131021.118199-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260129131021.118199-1-f.ebner@proxmox.com>

It cannot change while the module is loaded. Also, commit "cpu config:
support aarch64 CPU models" will use the host arch as a hash key,
which is cleaner if no additional function call is required.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuServer/CPUConfig.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index 825e691a..2825da46 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -9,7 +9,7 @@ use PVE::JSONSchema qw(json_bool);
 use PVE::Cluster qw(cfs_register_file cfs_read_file);
 use PVE::ProcFSTools;
 use PVE::RESTEnvironment qw(log_warn);
-use PVE::Tools qw(run_command get_host_arch);
+use PVE::Tools qw(run_command);
 
 use PVE::QemuServer::Helpers qw(min_version);
 
@@ -25,6 +25,8 @@ our @EXPORT_OK = qw(
     get_cvm_type
 );
 
+my $host_arch = PVE::Tools::get_host_arch();
+
 my $arch_desc = {
     description => "Virtual processor architecture. Defaults to the host architecture.",
     type => 'string',
@@ -1016,13 +1018,13 @@ sub get_default_cpu_type {
 
 sub is_native_arch($) {
     my ($arch) = @_;
-    return get_host_arch() eq $arch;
+    return $host_arch eq $arch;
 }
 
 sub get_cpu_bitness {
     my ($cpu_prop_str, $arch) = @_;
 
-    $arch //= get_host_arch();
+    $arch //= $host_arch;
 
     my $cputype = get_default_cpu_type($arch, 0);
 
-- 
2.47.3





  parent reply	other threads:[~2026-01-29 13:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 13:09 [PATCH-SERIES qemu-server v2 0/8] cpu config: support aarch64 CPU models Fiona Ebner
2026-01-29 13:09 ` [PATCH qemu-server v2 1/8] cpu config: introduce pve-qm-cpu-arch standard option for virtual CPU architecture Fiona Ebner
2026-01-29 13:09 ` [PATCH qemu-server v2 2/8] cpu config: guard adding hyperv enlightenments by arch Fiona Ebner
2026-01-29 13:10 ` [PATCH qemu-server v2 3/8] cpu config: 'hidden' option only applies to vCPUs with x86_64 arch Fiona Ebner
2026-01-29 13:10 ` Fiona Ebner [this message]
2026-01-29 13:10 ` [PATCH qemu-server v2 5/8] cpu config: support aarch64 CPU models Fiona Ebner
2026-01-29 13:10 ` [PATCH qemu-server v2 6/8] api: cpu: allow querying CPU models for a given architecture Fiona Ebner
2026-01-29 13:10 ` [PATCH qemu-server v2 7/8] cpu config: support aarch64 CPU flags Fiona Ebner
2026-01-29 13:10 ` [PATCH qemu-server v2 8/8] api: cpu flags: allow querying CPU flags for a given architecture Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260129131021.118199-5-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal