+sub get_cpu_bitness {
+ my ($cpu_prop_str, $arch) = @_;
+
+ $arch //= get_host_arch();
+
+ my $cputype = get_default_cpu_type($arch, 0);
+
+ if ($cpu_prop_str) {
+ my $cpu = PVE::JSONSchema::parse_property_string('pve-vm-cpu-conf', $cpu_prop_str)
+ or die "Cannot parse cpu description: $cpu_prop_str\n";
+
+ my $cputype = $cpu->{cputype};
+
+ if (my $model = $builtin_models->{$cputype}) {
+ $cputype = $model->{'reported-model'};
+ } elsif (is_custom_model($cputype)) {
+ my $custom_cpu = get_custom_model($cputype);
+ $cputype = $custom_cpu->{'reported-model'} // $cpu_fmt->{'reported-model'}->{default};
+ }
+ }
+
+ return $cputypes_32bit->{$cputype} ? 32 : 64 if $arch eq 'x86_64';
+ return 64 if $arch eq 'aarch64';
+
+ die "unsupported architecture '$arch'\n";
+}
+