From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 13D361FF137 for ; Tue, 17 Feb 2026 09:41:53 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A2DDA1F63A; Tue, 17 Feb 2026 09:42:43 +0100 (CET) Date: Tue, 17 Feb 2026 09:42:38 +0100 From: Arthur Bied-Charreton To: Fiona Ebner Subject: Re: [PATCH qemu-server] cpu config: Add 'arch' property to cpu_fmt Message-ID: References: <20260216111017.171196-1-a.bied-charreton@proxmox.com> <7179f1a9-3f24-4d33-8d0d-471f5549e935@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7179f1a9-3f24-4d33-8d0d-471f5549e935@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1771317752913 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.821 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: JXNDEU2NEQOVIS4JJ3ZDWAYGBNKNO6SK X-Message-ID-Hash: JXNDEU2NEQOVIS4JJ3ZDWAYGBNKNO6SK X-MailFrom: a.bied-charreton@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, Feb 16, 2026 at 02:51:10PM +0100, Fiona Ebner wrote: > Am 16.02.26 um 12:10 PM schrieb Arthur Bied-Charreton: > > 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. > > > > Please also add a check in validate_cpu_conf() that the 'reported-model' > is available for the configured architecture. It's nicer UX if this > fails early when configuring rather than only later when using. > > get_cpu_options() could also get a check that the arch of the custom > model matches the VM arch. > > > Signed-off-by: Arthur Bied-Charreton > > --- > > 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 => { > > To avoid getting out of sync, you could re-use the existing > 'pve-qm-cpu-arch' standard option, overwriting the 'description', > 'default' and 'optional' properties. > > > + 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}; > > Style nit: we usually avoid single quotes when not needed for hash keys. > Note that you are not doing it for 'default' either. It's easier to read > if consistent with the other code in the module. > > > + next if ($custom_model_arch ne $arch); > > Style nit: no need for parentheses for post-if expression > > > + > > 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", > Hey Fiona, thanks a lot for the feedback, addressed in v2: https://lore.proxmox.com/pve-devel/20260217084105.72579-1-a.bied-charreton@proxmox.com/T/#t