[Bug 203643] [bhyve] NetBSD causes bhyve to exit on AMD processors

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 08 Apr 2025 16:51:09 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203643

Keith White <kwhite.uottawa@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kwhite.uottawa@gmail.com

--- Comment #13 from Keith White <kwhite.uottawa@gmail.com> ---
A "me too" on this.

I'm using a quite old Lenovo Ideapad Z575 and vm-bhyve.  The SVM error is
slightly different, it looks like EDK2 is trying to access 0x511 (Firmware
port?). I used a different workaround: update bhyve(8) to log and ignore SVM
errors if environment variable "_BHYVE_AMD_A8_ENABLE_" is set.

==== head /var/run/dmesg.boot =====
Copyright (c) 1992-2025 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 15.0-CURRENT #4 main-n276261-297473069610-dirty: Mon Apr  7 12:16:25
EDT 2025
    root@dell7390:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64
FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git
llvmorg-19.1.7-0-gcd708029e0b2)
VT(vga): resolution 640x480
CPU: AMD A8-3500M APU with Radeon(tm) HD Graphics (1497.33-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0x300f10  Family=0x12  Model=0x1  Stepping=0
 
Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802009<SSE3,MON,CX16,POPCNT>
  AMD
Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3DNow!>
  AMD
Features2=0x37ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,SKINIT,WDT>
  SVM: NP,NRIP,NAsids=64
  TSC: P-state invariant, performance statistics

===== bhyve.log =====
vm exit[0]
        reason          SVM
        rip             0x000000007fa6e480
        inst_length     2
        exitcode        0x7b
        exitinfo1       0x511021d
        exitinfo2       0x7fa6e482


==== usr.sbin/bhyve/amd64/vmexit.c patch ====
diff --git a/usr.sbin/bhyve/amd64/vmexit.c b/usr.sbin/bhyve/amd64/vmexit.c
index 944f5de34645..94dde19eb931 100644
--- a/usr.sbin/bhyve/amd64/vmexit.c
+++ b/usr.sbin/bhyve/amd64/vmexit.c
@@ -288,6 +288,10 @@ vmexit_svm(struct vmctx *ctx __unused, struct vcpu *vcpu,
struct vm_run *vmrun)
        EPRINTLN("\texitcode\t%#lx", vme->u.svm.exitcode);
        EPRINTLN("\texitinfo1\t%#lx", vme->u.svm.exitinfo1);
        EPRINTLN("\texitinfo2\t%#lx", vme->u.svm.exitinfo2);
+       if (getenv("_BHYVE_AMD_A8_ENABLE_")) { /* workaround for Lenovo Ideapad
Z575 */
+               EPRINTLN("\tignoring\t_BHYVE_AMD_A8_ENABLE_ defined");
+               return (VMEXIT_CONTINUE);
+       }
        return (VMEXIT_ABORT);
 }

-- 
You are receiving this mail because:
You are the assignee for the bug.