Jump to content

Insanely fast virtual Mac (QEMU, OVMF, Clover and native graphics)


514 posts in this topic

Recommended Posts

I tried andonuts version. I tried the github version before and had the same result.

My version is just the GitHub source code compiled with the 10.11 SDK. It was a shot in the dark attempt to see if I could get VirtIO networking working on El Capitan.

 

Hopefully the developer will eventually update the source code, but the project hasn't been active for quite some time: "Latest commit 31b4f8e on Dec 27, 2013".

 

That being said, he still responded to this issue that I raised earlier this year.

Link to comment
Share on other sites

I have successfully installed and updated El Capitan to 10.11.1 using waschbenzin's clover image in QEMU KVM on Linux. I'm still encountering issues though. This is my first Hackintosh, so please bear with me. :rolleyes:

  1. I think I can passthrough my USB 3.0 card since I can type the keyboard attached to it when on Clover boot menu, but when El Capitan displays login screen I can't type the keyboard (my mouse didn't seem to respond on both time though). Something disables it on the process.
  2. How can I passthrough my GPU (NVIDIA GTX 980)? I have tried using boot args nv_disable=1 for installing the NVIDIA Web Driver and nvda_drv=1 after enabling it. But it only results in a freeze wallpaper of El Capitan (I couldn't see the login screen).
  3. Any hints on enabling the host audio for the El Capitan VM? Such that I can hear the sound from both my host and the VM without disabling the other.
  4. Is there any way that I can enlarge the display resolution at least on QEMU display? I couldn't modify configuration using Clover Configurator since the display is too small. :(

I have done passing through both that same GPU and USB card to my Windows 10 (UEFI) VM without issues. So it's probably El Capitan specific configuration that needs to be addressed.

 

Here's my QEMU KVM script:

#!/bin/bash

export QEMU_AUDIO_DRV=alsa

sudo echo "Starting osx-elcapitan machine"

# Disable Dell U2312HM display
xrandr --output HDMI1 --off --output HDMI3 --mode 1920x1080 --pos 0x0 --rotate normal

qemu-system-x86_64 \
-m size=16G \
-mem-path /dev/hugepages \
-mem-prealloc \
-balloon none \
-enable-kvm \
-cpu core2duo,kvm=off,vendor=GenuineIntel \
-smp cpus=2,cores=2,threads=1,sockets=1 \
-M q35 \
-rtc clock=host,base=utc \
-k en-us \
-bios ovmf/OVMF-pure-efi.fd \
-device ahci,id=hdbus,bus=pcie.0 \
-device ide-drive,bus=hdbus.0,drive=Clover \
-drive id=Clover,if=none,file=disks/clover-debug-test.dd,format=raw  \
-device ide-drive,bus=hdbus.1,drive=MacOSX \
-drive id=MacOSX,if=none,file=/data/machines/osx-elcapitan/disks/disk0-system.img,format=raw  \
-device isa-applesmc,osk="you-need-to-own-a-Mac" \
-device piix4-usb-uhci,id=usbbus \
-usb -device usb-kbd -device usb-mouse \
-netdev tap,vhost=on,id=brlan \
-device e1000-82545em,mac=$(/usr/local/bin/qemu-mac-hasher osx-elcapitan),netdev=brlan \
-device AC97 \
-monitor stdio \
-smbios type=2 \
-device vfio-pci,host=03:00.0 \
-device vfio-pci,host=01:00.0,multifunction=on \
-device vfio-pci,host=01:00.1 \
-vga none -serial null -parallel null -display none

# Restore Dell U2312HM display
xrandr --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal

Link to comment
Share on other sites

this works for me to passtrough a GPU

 

lspci 

04:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cedar [Radeon HD 5000/6000/7350/8350 Series]
04:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cedar HDMI Audio [Radeon HD 5400/6300 Series]

-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
    -device vfio-pci,host=04:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
    -device vfio-pci,host=04:00.1,bus=root.1,addr=00.1 \

Link to comment
Share on other sites

I have successfully installed and updated El Capitan to 10.11.1 using waschbenzin's clover image in QEMU KVM on Linux. I'm still encountering issues though. This is my first Hackintosh, so please bear with me. :rolleyes:

  1. I think I can passthrough my USB 3.0 card since I can type the keyboard attached to it when on Clover boot menu, but when El Capitan displays login screen I can't type the keyboard (my mouse didn't seem to respond on both time though). Something disables it on the process.
  2. How can I passthrough my GPU (NVIDIA GTX 980)? I have tried using boot args nv_disable=1 for installing the NVIDIA Web Driver and nvda_drv=1 after enabling it. But it only results in a freeze wallpaper of El Capitan (I couldn't see the login screen).
  3. Any hints on enabling the host audio for the El Capitan VM? Such that I can hear the sound from both my host and the VM without disabling the other.
  4. Is there any way that I can enlarge the display resolution at least on QEMU display? I couldn't modify configuration using Clover Configurator since the display is too small. :(

 

Congratulations so far, since you are not complaining about any speed issues I'll think that part is OK :).

 

1. When I start the VM all my USB-devices turn off for a second, than they are reenabled by OVMF, so I can use them in Clover. After selecting to boot Mac OSX, they all turn off again, and are reactivated during Mac OSX startup. Conclusion: You USB controller needs to be supported by both OVMF and Mac OSX. Being able to use your keyboard in Clover is no indication whether its working in OSX. Have a look at the debug files and see if OSX really sees your USB-devices. You may also try to use single user mode.

2. I think seeing the wallpaper at all is already a good start :), but you have to ask other people with this card (probably on a non-virtual hackintosh, since the active group of QEMU-based-virtual-hackintosh-users is quite small). You can try to install the nvidia web driver, but that is pure guessing on my end. May also be, that everything is working fine except that Mac OSX is thinking there is another display and showing the login-screen there. Without a working mouse you will probably not find out if that is the case. You could try to access your Mac over the network.

3. You would have to use one of QEMUs emulated sound devices. All I have read so far is that the virtual usb-audio might work, but its buggy (may be completely wrong here). 

4. I only had troubles with resolutions higher than 800x600. This might be related to using a MacPro2,1, but I'm not sure at all. Maybe you can use VNC to access your machine, when using a higher resolution

 

I think you are trying to go three steps at a time. You can try to pass only your USB through and confirm its working. You can try to just add the 980 and see if your mac really freezes (is it still available on network? try remote login after enabling it without USB/VGA/Sound). If you do it all at once you don't know whats wrong. Maybe QEMU is hanging because the sound card or USB initialization failed, while your graphics card is working just fine...

Link to comment
Share on other sites

Anyone having success with a libvirt VM?

 

For me, if I run it under libvirt OS X won't go further than either showing a busy cursor on top of the verbose mode output (10.9) or not going past the boot screen at all (10.11).

 

However, the odd thing is that when I grab the qemu command that libvirt is running and run it myself, this issue doesn't occur. This is the case for both using virtualised graphics and a real graphics card. I'm really not sure what difference that would make, but apparently it's enough to screw up OS X.

Link to comment
Share on other sites

 

this works for me to passtrough a GPU

 

lspci 

04:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cedar [Radeon HD 5000/6000/7350/8350 Series]
04:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cedar HDMI Audio [Radeon HD 5400/6300 Series]

-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
    -device vfio-pci,host=04:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
    -device vfio-pci,host=04:00.1,bus=root.1,addr=00.1 \

 

Hi Peter_sm,

 

Tried your suggestion in adding ioh3420 thingy, I totally forgot about this flag in Q35. Looks like it worked for the GPU, though it still using the default OS X NVIDIA not the retail one. I don't know is it good or not. At least it detected correctly in About This Mac.  :lol: I have both screen using the passed through GPU. 

 

Congratulations so far, since you are not complaining about any speed issues I'll think that part is OK :).

 

1. When I start the VM all my USB-devices turn off for a second, than they are reenabled by OVMF, so I can use them in Clover. After selecting to boot Mac OSX, they all turn off again, and are reactivated during Mac OSX startup. Conclusion: You USB controller needs to be supported by both OVMF and Mac OSX. Being able to use your keyboard in Clover is no indication whether its working in OSX. Have a look at the debug files and see if OSX really sees your USB-devices. You may also try to use single user mode.

2. I think seeing the wallpaper at all is already a good start :), but you have to ask other people with this card (probably on a non-virtual hackintosh, since the active group of QEMU-based-virtual-hackintosh-users is quite small). You can try to install the nvidia web driver, but that is pure guessing on my end. May also be, that everything is working fine except that Mac OSX is thinking there is another display and showing the login-screen there. Without a working mouse you will probably not find out if that is the case. You could try to access your Mac over the network.

3. You would have to use one of QEMUs emulated sound devices. All I have read so far is that the virtual usb-audio might work, but its buggy (may be completely wrong here). 

4. I only had troubles with resolutions higher than 800x600. This might be related to using a MacPro2,1, but I'm not sure at all. Maybe you can use VNC to access your machine, when using a higher resolution

 

I think you are trying to go three steps at a time. You can try to pass only your USB through and confirm its working. You can try to just add the 980 and see if your mac really freezes (is it still available on network? try remote login after enabling it without USB/VGA/Sound). If you do it all at once you don't know whats wrong. Maybe QEMU is hanging because the sound card or USB initialization failed, while your graphics card is working just fine...

 

You gave me an idea. I enabled autologin for my admin user and setup Synergy and restart with passed through GPU using nvda_drv=1 kernel boot param. I can now enter my El Capitan desktop with full fledged 1080p resolution under NVIDIA GTX 980 :D . Now I can open and see what Clover Configurator can do to me. Hmm, if I understand it correctly, can I use the Clover Configurator to persist nvda_drv=1 kernel boot params? And SMBIOS? What about the drivers like AC97 audio? I think I saw it when in the Clover installer. 

Link to comment
Share on other sites

Sure you can use Clover Configurator to change the boot options, SMBIOS and add kexts to the EFI partition. (Reminder: Clover Configurator kills the QEMU setting, so remember to manually add it to EFI/CLOVER/config.plist)

 

My system is working fine without ioh3420, thought I read about it not being recommended anymore, could be wrong though. 

 

Has anyone managed running OSX on a split bios (OVMF_CODE + OVMF_VARS)? Or running with -pflash instead of -bios? This would allow to change UEFI settings and to raise resolution to something higher than 800x600 while booting (or when running without VGA passthrough). 

Link to comment
Share on other sites

What does that QEMU settings actually do? I have saved and rebooted Clover Configurator many times without applying the QEMU that you mentioned. Currently my SMBIOS uses iMac14,2 since I think that's the most compatible one. Still I couldn't change -cpu other than core2duo. Changing it to IvyBridge makes it to reboot to Clover menu again and again. 

 

You're correct, I tried omitting the ioh3420 but the GPU still passed through. No matter what I do, I couldn't get the NVIDIA Web driver to be enabled. But the default ones, are actually pretty stable. I haven't tried it using Steam games though.  :P

 

If I look at the System Report, my USB devices attached to Renesas USB 3.0 card detected. Even my mouse' LED is  on after a while. I think the issue of my USB related to this 

http://www.insanelymac.com/forum/topic/306777-guide-usb-fix-el-capitan-1011/Still working to understand on it :D

 

As for the audio, still a deadend. :/

 

I tried splitting the OVMF image copying the command from my Windows 10 VM, but it got stuck just after Clover boot, exactly after those dots forming a single line at the beginning of he the boot.

Link to comment
Share on other sites

The QEMU setting should adjust your clock speed, so you don't end up with an insanely fast OS X running at 10x speed. 

 

I haven't had much luck with the nvidia driver either. My card isn't official supported, so I thought that might be the reason...

 

I also had an Renesas USB card. It gave me too many headaches (didn't reset correctly after vm shutdown, host boot problems...) and so I'm now using just the integrated USB controller which I can pass through to the vm :-).

Link to comment
Share on other sites

Hmm, I never experienced such insanely fast OS X as you do, I think your Clover boot image solved that, even though I export/save the Clover Configurator several times, the speed is quite normal.

 

Did your GPU detected correctly on About This Mac/System Report?

 

For now using Synergy for mouse and keyboard is a good enough workaround for me.

 

As for audio, probably I can run a screen sharing session from the Mac to Linux host and hope that the audio is replayed on the host side. xD

Link to comment
Share on other sites

After removing the USB devices from QEMU command line (used when installing stage), the mouse has detected! Although with an insanely slow input lag. Keyboard still not detected when it plugs into a USB switch (needed to plug on both host and VM), but when I try to plug another keyboard directly on the Renesas USB 3.0 card, it was detected but still at an insanely slow input lag.

 

Here's my compete QEMU command line so far, I've tidy it up a bit.

http://pastebin.com/DgWCzp5L

Link to comment
Share on other sites

Anyone having success with a libvirt VM?

 

For me, if I run it under libvirt OS X won't go further than either showing a busy cursor on top of the verbose mode output (10.9) or not going past the boot screen at all (10.11).

 

However, the odd thing is that when I grab the qemu command that libvirt is running and run it myself, this issue doesn't occur. This is the case for both using virtualised graphics and a real graphics card. I'm really not sure what difference that would make, but apparently it's enough to screw up OS X.

 

https://macosxvirtualmachinekvm.wordpress.com/guide-mac-os-x-10-11-el-capitan-vm-on-unraid/

My version is just the GitHub source code compiled with the 10.11 SDK. It was a shot in the dark attempt to see if I could get VirtIO networking working on El Capitan.

 

Hopefully the developer will eventually update the source code, but the project hasn't been active for quite some time: "Latest commit 31b4f8e on Dec 27, 2013".

 

That being said, he still responded to this issue that I raised earlier this year.

 

I am not holding my breath. I asked him this past September and his response was "Nope, sorry. No technical reasons, just life and priorities, basically. Paid work takes precedence, and spare time when I also have the energy to do this is rare at the moment for various reasons."

https://github.com/pmj/virtio-net-osx/issues/3#issuecomment-138924479

Link to comment
Share on other sites

@archedraft: I managed to get it working. The way libvirt handled the applesmc stuff messed up the OSK. It's fine now.

 

For anyone who needs better network connectivity for their OS X VM, you can always assign a secondary PCI Ethernet NIC, install the required kext (if any) and use that. I use a TP-LINK TG-3468 with this kext (compile it with the 10.11 SDK in Xcode) and it works perfectly.

 

Also, looks like I won't be trying to get GPU passthrough going on an OS X VM. I've tried it, and it really doesn't work well on my system (works perfect for the first boot, doesn't work at all the next). I can't really blame anything other than OS X, since GPU passthrough works fine on my Windows 8.1 VM.

 

EDIT: For those using libvirt, does using the "Shut down" option in virt-manager (or virsh shutdown osx-vm) to send a ACPI shutdown signal actually work with OS X? I find that my VM doesn't respond to this, and I really need to be able to forcibly but cleanly shut down the VM (such as when the battery of my UPS drains down during a power failure or I shut down the host for hardware maintenance).

Link to comment
Share on other sites

According to the changelog ( http://mackie100projects.altervista.org/changelog-version-4-25-0/) Clover Configurator now supports the QEMU flag. Thanks @evilsephiroth.

 

 

Did your GPU detected correctly on About This Mac/System Report?

 

Yes, it's detected correctly.

 

 

Here's my compete QEMU command line so far, I've tidy it up a bit.

http://pastebin.com/DgWCzp5L

 

Thanks for sharing. Nice cleanup :)

 

 

 

Also, looks like I won't be trying to get GPU passthrough going on an OS X VM. I've tried it, and it really doesn't work well on my system (works perfect for the first boot, doesn't work at all the next). I can't really blame anything other than OS X, since GPU passthrough works fine on my Windows 8.1 VM.

 

I always rebind my gpu to the vfio driver before startup. Maybe that helps:

echo "10de 1184" > /sys/bus/pci/drivers/vfio-pci/new_id 
echo 0000:01:00.0 > /sys/bus/pci/devices/0000\:01\:00.0/driver/unbind 
echo 0000:01:00.0 > /sys/bus/pci/drivers/vfio-pci/bind

echo "10de 0e0a" > /sys/bus/pci/drivers/vfio-pci/new_id 
echo 0000:01:00.1 > /sys/bus/pci/devices/0000\:01\:00.1/driver/unbind 
echo 0000:01:00.1 > /sys/bus/pci/drivers/vfio-pci/bind

 

EDIT: For those using libvirt, does using the "Shut down" option in virt-manager (or virsh shutdown osx-vm) to send a ACPI shutdown signal actually work with OS X? I find that my VM doesn't respond to this, and I really need to be able to forcibly but cleanly shut down the VM (such as when the battery of my UPS drains down during a power failure or I shut down the host for hardware maintenance).

 

Workaround: Enable ssh on OS X, generate a key pair, place public on OS X, place private in linux

When shutting down, just ssh into OS X and issue a shutdown command...

Link to comment
Share on other sites

According to the changelog ( http://mackie100projects.altervista.org/changelog-version-4-25-0/) Clover Configurator now supports the QEMU flag. Thanks @evilsephiroth.

 

 

Yes, it's detected correctly.

 

 

 

Thanks for sharing. Nice cleanup :)

 

 

I always rebind my gpu to the vfio driver before startup. Maybe that helps:

echo "10de 1184" > /sys/bus/pci/drivers/vfio-pci/new_id 
echo 0000:01:00.0 > /sys/bus/pci/devices/0000\:01\:00.0/driver/unbind 
echo 0000:01:00.0 > /sys/bus/pci/drivers/vfio-pci/bind

echo "10de 0e0a" > /sys/bus/pci/drivers/vfio-pci/new_id 
echo 0000:01:00.1 > /sys/bus/pci/devices/0000\:01\:00.1/driver/unbind 
echo 0000:01:00.1 > /sys/bus/pci/drivers/vfio-pci/bind

Workaround: Enable ssh on OS X, generate a key pair, place public on OS X, place private in linux

When shutting down, just ssh into OS X and issue a shutdown command...

can you post the link for hdmiaudio kext? I tried the kext from here (http://forums.macrumors.com/threads/guide-hdmi-audio.1499797/page-15) but no sound from monitor. Sip disabled though...

pasted kext in Clover/Kext/10.11..

Link to comment
Share on other sites

I always rebind my gpu to the vfio driver before startup. Maybe that helps:

echo "10de 1184" > /sys/bus/pci/drivers/vfio-pci/new_id 
echo 0000:01:00.0 > /sys/bus/pci/devices/0000\:01\:00.0/driver/unbind 
echo 0000:01:00.0 > /sys/bus/pci/drivers/vfio-pci/bind

echo "10de 0e0a" > /sys/bus/pci/drivers/vfio-pci/new_id 
echo 0000:01:00.1 > /sys/bus/pci/devices/0000\:01\:00.1/driver/unbind 
echo 0000:01:00.1 > /sys/bus/pci/drivers/vfio-pci/bind

Workaround: Enable ssh on OS X, generate a key pair, place public on OS X, place private in linux

When shutting down, just ssh into OS X and issue a shutdown command...

I might give the rebind suggestion a try, but I don't have that much hope.

 

As for the power workaround, that won't work for automated shutdowns and is an extra step for manual shutdowns. I've configured libvirt (specfically: libvirt-guests.service) to send the ACPI shutdown signal to all VMs as part of the host shutdown process.

Link to comment
Share on other sites

OK, I finally found a workaround for bypassing audio input and output.

I'm using NoMachine, no latency whatsoever, I even get to have my microphone on the host passed also.

Plus another method to connect to the VM remotely.

Big win.  :D

 

EDIT: Hmm, microphone still has the lag, but audio output (playing YouTube videos) has no issues.

Link to comment
Share on other sites

EDIT: For those using libvirt, does using the "Shut down" option in virt-manager (or virsh shutdown osx-vm) to send a ACPI shutdown signal actually work with OS X? I find that my VM doesn't respond to this, and I really need to be able to forcibly but cleanly shut down the VM (such as when the battery of my UPS drains down during a power failure or I shut down the host for hardware maintenance).

 

No, "virsh shutdown osx-vm" does not work with OS X (at least I have not been able to figure out how to get it working). I leave my OS X VM running 24/7 so it doesn't really matter too much. If I need to restart my server I have a script that will send "virsh destroy osx-vm". I was worried about file / os corruption but OS X seems to handle sudden shutdown very well.

Link to comment
Share on other sites

  • 2 weeks later...

OK, I finally found a workaround for bypassing audio input and output.

I'm using NoMachine, no latency whatsoever, I even get to have my microphone on the host passed also.

Plus another method to connect to the VM remotely.

Big win.  :D

 

EDIT: Hmm, microphone still has the lag, but audio output (playing YouTube videos) has no issues.

 

Hey ohetfi.

 

Did you manage to get the nvidia web drivers to load? I'm in the same situation where after I install the web driver, only the OSX driver loads.

 

Thanks.

Link to comment
Share on other sites

Hi nate911,

 

No, the System Preferences still points to the default driver.

Is it just only cosmetic aspect that actually the kext driver for the Web driver is actually loaded?

How can I check it?

 

Thanks ohetfi.

 

I managed to get the driver to load, similar to you by using nvda_drv=1 in clover.

 

I'm trying to get the USB ports to passthrough now, and I'm having the same issues as you lol.

 

I can passthrough single devices, but when I try to pass through the controller it won't boot, clover crashes with:

 "unable to find driver for this platform: \"ACPI\".../IOPlatformExpert.cpp:1665"

 

Have you manged to get the USB controller to passthrough?

 

Cheers.

Link to comment
Share on other sites

No, I still failed to get my USB 3.0 controller to passthrough. I can type from my keyboard which is attached to the USB controller on Clover menu, but as soon as OS X El Capitan boots it completely disables it. I even can see my USB tree on the System Profiler (even my Logitech F510 gamepad is detected) but somehow it doesn't work. Probably we need to make OS X thinks that it is an Intel USB controller not a Renesas (mine at least). I workaround it by using Synergy for mouse+keyboard and NoMachine Audio adapter for the audio.

Link to comment
Share on other sites

 Share

×
×
  • Create New...