On 5/20/25 13:50, Daniel P. Berrangé wrote:
+if get_option('mshv').allowed() and host_os == 'linux'
+  if get_option('mshv').enabled() and host_machine.cpu() != 'x86_64'
+    error('mshv accelerator requires x64_64 host')
+  endif
+  accelerators += 'CONFIG_MSHV'

This enables MSHV for non-x86 when the option is left on 'auto'.

This is similar to what other accelerators do. The idea is that --enable-kvm will give an error on Windows, but not (say) on SPARC/Linux. It was done this way to simplify packaging and let distros use --enable-kvm unconditionally; and now --enable-mshv should probably behave the same way.

The "requires x86_64 host" was copied from whpx, but is really unnecessary there because above you have

elif cpu == 'x86_64'
  accelerator_targets += {
    'CONFIG_HVF': ['x86_64-softmmu'],
    'CONFIG_NVMM': ['i386-softmmu', 'x86_64-softmmu'],
    'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
  }
endif

So the patch is mostly okay, however I'd replace:

+if cpu == 'x86_64'
+  mshv_targets = ['x86_64-softmmu']
+else
+  mshv_targets = []
+endif
+accelerator_targets += { 'CONFIG_MSHV': mshv_targets }
+

with the simpler

 elif cpu == 'x86_64'
    accelerator_targets += {
      'CONFIG_HVF': ['x86_64-softmmu'],
      'CONFIG_NVMM': ['i386-softmmu', 'x86_64-softmmu'],
      'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
+     'CONFIG_MSHV': ['x86_64-softmmu'],
    }
 endif

Thanks,

Paolo


Reply via email to