vmm: set highest cpuid feature leaf based on host cpu.
authordv <dv@openbsd.org>
Wed, 4 Sep 2024 16:12:40 +0000 (16:12 +0000)
committerdv <dv@openbsd.org>
Wed, 4 Sep 2024 16:12:40 +0000 (16:12 +0000)
Fixes Linux guests on older Intel hardware. vmm was reporting a
value that doesn't match the host. Cap it at the highest value vmm
currently emulates.

ok bluhm@, ratchov@

sys/arch/amd64/amd64/vmm_machdep.c

index 0e8e2a5..04944d5 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm_machdep.c,v 1.35 2024/09/04 07:54:51 mglocker Exp $ */
+/* $OpenBSD: vmm_machdep.c,v 1.36 2024/09/04 16:12:40 dv Exp $ */
 /*
  * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
  *
@@ -6282,7 +6282,8 @@ vmm_handle_cpuid(struct vcpu *vcpu)
                *rdx = 0;
                break;
        case 0x80000000:        /* Extended function level */
-               *rax = 0x8000001f; /* curcpu()->ci_pnfeatset */
+               /* We don't emulate past 0x8000001f currently. */
+               *rax = min(curcpu()->ci_pnfeatset, 0x8000001f);
                *rbx = 0;
                *rcx = 0;
                *rdx = 0;