Hello, guys. Thanks for sharing the information.
Sorry to feed the thread two months later, but I would like to share some comments to help other people. It took me hours to notice that one line of the patch was rejected.
I also spent time with many tests and configurations.
I'm running 12.1-RELEASE .
Patching
I downloaded a raw diff from
https://reviews.freebsd.org/D12419 (attached here).
Bash:
cd /usr/src/usr.sbin/bhyve && svn info
URL: svn://svn.freebsd.org/base/release/12.1.0/usr.sbin/bhyve
Relative URL: ^/release/12.1.0/usr.sbin/bhyve
Revision: 360835
patch < /path/to/raw/diff/downloaded/from/reviews.freebsd.org
If you have the same revision as mine, and probably will if you compiled 12.1-RELEASE, make sure Makefile has these entries ( hda_codec.c was rejected, so I manually added):
Bash:
svn diff
Index: Makefile
===================================================================
--- Makefile (revision 360835)
+++ Makefile (working copy)
@@ -16,6 +16,7 @@
SRCS= \
atkbdc.c \
acpi.c \
+ audio.c \
bhyvegc.c \
bhyverun.c \
block_if.c \
@@ -27,6 +28,7 @@
dbgport.c \
fwctl.c \
gdb.c \
+ hda_codec.c \
inout.c \
ioapic.c \
mem.c \
@@ -37,6 +39,7 @@
pci_ahci.c \
pci_e82545.c \
pci_emul.c \
+ pci_hda.c \
pci_fbuf.c \
pci_hostbridge.c \
pci_irq.c \
I cleaned and compiled bhyve again:
Bash:
cd /usr/src/usr.sbin/bhyve
make clean install
Running the VM
My guest is Windows 7 SP1.
TIP: If you need networking, remember to add tap0 and a physical NIC to the same bridge device. It took me some time... I'm lazy, I usally use vm-bhyve script, so I zeroed my mind on this subject.
I mean this (for more info, look for help on the forums or read the Handbook):
Bash:
ifconfig tap0 create
ifconfig bridge0 addm tap0 addm re0
Another problem I had was setting the dsp device (see below). I don't know if this HDA patch has incomplete validation or what, but if added a numbered device, bhyve exited with assert error on function hda_init . So, the tip is: use /dev/dsp . If you have many audio devices, select one with sysctl:
Example:
Bash:
sysctl hw.snd.default_unit=3
Then run bhyve:
Bash:
bhyve -c 2 -m 4G -Hwl bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
-U a7fd1b43-51d2-11e9-9fe5-54bf64f6fd48 \
-u \
-s 0,hostbridge \
-s 31,lpc \
-s 4:0,ahci-hd,/arquivo/virtual-machines/win7/vm-win7.img \
-s 10:0,virtio-net,tap0,mac=00:A0:98:22:92:FA \
-s 6:0,fbuf,tcp=0.0.0.0:5900,w=640,h=480 \
-s 7:0,xhci, \
-s 15:0,hda,play=/dev/dsp,rec=/dev/dsp \
-s 3:0,ahci-cd,/arquivo/virtual-machines/.config/null.iso \
win7
Audio Devices
Bash:
cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC256 (Internal Analog)> (play/rec)
pcm1: <Realtek ALC256 (Front Analog Headphones)> (play)
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> (play)
pcm3: <USB audio> (play/rec) default
No devices installed from userspace.
Results
Device 3, M-AUDIO Fast Track Pro, USB audio :
- play: OK
- rec: FAILED. Windows did not found a device
Then I changed to builtin audio:
Bash:
sysctl hw.snd.default_unit=0
Ran bhyve again:
Device 0 (laptop builtin speakers):
I rather connect using net/tsclient (Remote Desktop).