On Mon, 16 Nov 2026 at 03:38, Andrew Nguyen <[email protected]> wrote:
>
> Included the mention of WHPX when the option -cpu host doesn't have
> an accelerator option.
>
> Signed-off-by: Andrew Nguyen <[email protected]>
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4836
> ---
> This is a resolution for issue #4836: 
> https://gitlab.com/qemu-project/qemu/-/work_items/4836.
> "-cpu host" by itself is not permitted; an accelerator must be specified as 
> well. For Linux,
> it is KVM. macOS is HVF and Windows is WHPX.
>
> Previously, QEMU would only tell the user to use either KVM or HVF, 
> essentially excluding
> Windows users. This patch adds WHPX to the error message. A similar patch was 
> made seven
> months ago in target/arm/cpu.c:1861.
>
> Signed-off-by: Andrew Nguyen <[email protected]>
> ---
> Changes:
> - cpu.c:10229: added WHPX to the error message when "-cpu host" doesn't 
> include an accelerator
> ---
>  target/i386/cpu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index eab0d5a4d4..7dd5535f80 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -10229,7 +10229,8 @@ static void x86_cpu_realizefn(DeviceState *dev, Error 
> **errp)
>
>      if (xcc->host_cpuid_required && !accel_uses_host_cpuid()) {
>          g_autofree char *name = x86_cpu_class_get_model_name(xcc);
> -        error_setg(&local_err, "CPU model '%s' requires KVM or HVF", name);
> +        error_setg(&local_err, "The '%s' CPU type can only be used with KVM,
> +            HVF or WHPX", name);
>          goto out;
>      }

The code isn't checking "is this KVM, HVF or WHPX", though.
accel_uses_host_cpuid() is checking "not TCG" (also "not qtest" but as
that's a test facility we don't need to mention it here). Listing
an explicit set of accelerators means it gets out of date whenever
a new one is added (as has already happened here once when the
WHPX accelerator was added and the message not updated).

thanks
-- PMM

Reply via email to