public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server] cpu config: Add 'arch' property to cpu_fmt
Date: Mon, 16 Feb 2026 12:10:17 +0100	[thread overview]
Message-ID: <20260216111017.171196-1-a.bied-charreton@proxmox.com> (raw)

Preparatory step for adding support for configuring custom CPU types in
the PVE UI.

Add optional property 'arch' (x86_64|aarch64) to cpu_fmt to allow custom
models to indicate which architecture they belong to. 'arch' defaults to
x86_64 for backwards compatibility.

Update get_cpu_models to only return custom models that match the
arch to allow querying custom models for a given host architecture.

Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
 src/PVE/QemuServer/CPUConfig.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index 32ec4954..728c5562 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -374,6 +374,13 @@ my $cpu_fmt = {
             . " note that doing so will break live migration to CPUs with other values.",
         optional => 1,
     },
+    arch => {
+        type => 'string',
+        enum => [qw(x86_64 aarch64)],
+        default => 'x86_64',
+        description => 'The architecture the CPU model belongs to.',
+        optional => 1,
+    },
 };
 
 my $sev_fmt = {
@@ -612,9 +619,14 @@ sub get_cpu_models {
 
     my $conf = load_custom_model_conf();
     for my $custom_model (keys %{ $conf->{ids} }) {
+        my $custom_model_arch = $conf->{ids}->{$custom_model}->{'arch'};
+        $custom_model_arch //= $cpu_fmt->{'arch'}->{default};
+        next if ($custom_model_arch ne $arch);
+
         my $reported_model = $conf->{ids}->{$custom_model}->{'reported-model'};
         $reported_model //= $cpu_fmt->{'reported-model'}->{default};
         my $vendor = $all_cpu_models->{$reported_model};
+
         push @$models,
             {
                 name => "custom-$custom_model",
-- 
2.47.3




             reply	other threads:[~2026-02-16 11:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16 11:10 Arthur Bied-Charreton [this message]
2026-02-16 13:51 ` Fiona Ebner
2026-02-17  8:42   ` Arthur Bied-Charreton
2026-02-17  8:43 ` superseded: " Arthur Bied-Charreton

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=20260216111017.171196-1-a.bied-charreton@proxmox.com \
    --to=a.bied-charreton@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