Jump to content

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


514 posts in this topic

Recommended Posts

Thanks!

 

Yes it did work. I am now running OSX at 1080p.

 

Cant say anything about the network since i havent gotten around to that. I started exploring VFIO and intergrated GPUs.

I have a laptop with only intergrated graphics and that is my main work unit.

 

Conclusion being you need to have 2 gpus (I could be wrong. There was a post about it working with Xen). Will keep poking around on this.

 

Graphics preformance is sluggish at times, but then again its a virtual gpu.

 

None the less thanks again on helping me getting this to work.

Link to comment
Share on other sites

Thanks!

 

Yes it did work. I am now running OSX at 1080p.

 

Cant say anything about the network since i havent gotten around to that. I started exploring VFIO and intergrated GPUs.

I have a laptop with only intergrated graphics and that is my main work unit.

 

Conclusion being you need to have 2 gpus (I could be wrong. There was a post about it working with Xen). Will keep poking around on this.

 

Graphics preformance is sluggish at times, but then again its a virtual gpu.

 

None the less thanks again on helping me getting this to work.

Virtio drivers are not available for OS X. I have been toying with the idea of possibly creating a few as a project, but my coding needs work.

 

Essentially for any virtual machine you should have :

 

balloon

scsi/storage

QXL if using spice

 

I did see that there is a virtio network driver for OS X. I was thinking about moving towards vmxnet3 for the time being though. Has anyone used this?

 

I still have not gotten my sound card working without VoodooHD. I've been crackling on OS X so I'll possibly use Toleda's thread. Once I get that working, I'll post updates here. It will be a while, however.

Link to comment
Share on other sites

Used the virtio net driver in Mavericks, worked a treat but obviously support dropped for this from Yosemite onwards and I never found anything other than the emulated e1000-82545em device as the fall back.  I believe the is a git repo for the driver so you could stage from this, the dev still responds also I believe...caught a thread recently on this is all.

 

Regards your sound...what's your expectation...are you using the emulated sound device from qemu or passing through a physical?

Link to comment
Share on other sites

Yea it would need to be updated for El Capitan, which is what I am aiming for.

 

My expectation is to have HDMI Audio out work from my passed through Nvidia GTX970. It obviously works with VoodooHD, so most likely an issue with DSDT/SSDT and config.plist in clover.

Link to comment
Share on other sites

I've been on 10.11.3 since the beginning of my experiments.

 

Installed with El Capitan bootable iso

Performed combined update to 10.11.3

Installed nvidia drivers

Rebooted with GPU passed through

Nvidia drivers used.

 

Although the nvidia preference pane does not show the nvidia drivers being used. However, when I do select nvidia, I do not get promoted for reboot and kextstat shows web drivers.

Link to comment
Share on other sites

A bit off topic, but i cant seem to find much on this else where... since theres really not many people out there trying it.

 

OSX guest on Virtualbox vs QEMU with KVM.

 

From what i have seen in this forum GPU passthrough can be done in QEMU and pci passthrough is avaliable on virtualbox.

 

In terms of preformance which would be better?

Link to comment
Share on other sites

Couple of things too that question...are you using qemu standalone or do you have KVM enabled in the host Linux kernel and use it for Qemu acceleration?

 

My basic understanding (although some blogs, sites, post disagree on this point) is that KVM is a type 1 or bare metal Hypervisor and VB is a type 2. Read around on the differences but the summation is that type 2's require the underlying OS processes to allocate resources which costs in time and performance. Type 1's dont have this same overhead as they are managing the hardware resources direct for host and guest aka are quicker.

Link to comment
Share on other sites

Hi

 

I am using QEMU + Clover, all is ok except the time to get the Clover GUI.

After some analysis, I realized the LoadDrivers() end traces is taking around than 15s...

 

Looking at the clover code it seems to come from the BdsLibConnectAllDriversToAllControllers() function.

But not sure at 100%

As I can't rebuild easily Clover, do you have some hints to share about this?

 

Cheers

Marco

 

Some logs :

 

0:101  0:000  Clover load options size = 0 bytes
0:103  0:001  Using OEM config.plist at path: EFI\CLOVER\config.plist
0:107  0:004  EFI\CLOVER\config.plist loaded: Success
0:108  0:000  Found theme directory: embedded
0:108  0:000  Found theme directory: random
0:109  0:000  Loading early settings
0:109  0:000  timeout set to 2
0:109  0:000  Custom boot CUSTOM_BOOT_DISABLED (0x0)
0:112  0:003  Default theme: embedded
0:114  0:001  LoadDrivers() start
0:116  0:002  Loading HFSPlus.efi  status=Success
0:122  0:006   - driver needs connecting
0:124  0:001  Loading OsxFatBinaryDrv-64.efi  status=Success
0:130  0:006  Loading OsxAptioFixDrv-64.efi  status=Success
0:136  0:006  Loading DataHubDxe-64.efi  status=Success
0:156  0:019  1 drivers needs connecting ...
0:157  0:001  PlatformDriverOverrideProtocol not found. Installing ... Success
0:160  0:003  HFS+ driver loaded 
0:163  0:002  Searching for invalid DiskIo BY_DRIVER connects: not found, all ok
13:723  13:559  LoadDrivers() end
Link to comment
Share on other sites

 

Couple of things too that question...are you using qemu standalone or do you have KVM enabled in the host Linux kernel and use it for Qemu acceleration?

 

For OSX El Capitan, i am using QEMU with KVM enabled

qemu-system-x86_64 \
-enable-kvm \

I was under the impression that is all you needed to use KVM with QEMU.

 

After going through the arch wiki for qemu and kvm, i came to the conclusion that my CPU supports virtuilaziation and the arch kernel is built to support KVM as well.

Also using the "-moniter std" option and running the command "info kvm" returns "enabled" while the QEMU system is running

Link to comment
Share on other sites

So not an Arch user so difference between distros not withstanding I can't argue your logic :-) I guess the main check is that my Ubuntu kernel is built to support KVM however KVM doesn't actually get turned on until I load the modules or at least set this to be the case on boot. I've never tried running a qemu guest with the -enable-kvm option but without the KVM modules so can't say what would happen but I'd expect some kind of error output.

Link to comment
Share on other sites

@DaGr8Gatzby

 

Got my 970 yesterday...just finished getting my Windows vm working in passthrough...had some trouble with a fiddly PCIe power connector, anyway's that works a treat but I can't get OSX working as with my old GTX 650.

 

Read back through your prev post on this and added the additional kernel parameters but they haven't worked for me, I'm wondering if I've missed a trick?

 

Clover boots, kernel output displays fine and I can see the NVDA...Official lineout...however when it comes to start the GUI my vm reboots.  With my GTX 650 I didn't need any additional kext's other than for audio, this is still the same with the GTX 970?

 

From your post here (http://www.insanelymac.com/forum/topic/309087-insanely-fast-virtual-mac-qemu-ovmf-clover-and-native-graphics/page-11?do=findComment&comment=2208333) I've just taken the kernel param's...was that all you had to do i.e. no other changes to Clover, kext's, ACPI config?

 

Thanks,

 

K

 

EDIT/SOLVED:

 

Sorry still learning here so more googling gave me a lead.  Steps to update OSX to use my 970 were...

  1. Boot with the nv_disable=1 kernel parameter...this moves the rendering onto the CPU.  Note the nv_disable=1 may increase time to load desktop so be patient).  This will get you to an OSX desktop.
  2. Either manually edit the Clover config.plist file or use Clover Configuration; either way you need to add the 'nvda_drv=1' boot flag/kernel parameter.
  3. Next download and install the Nvidia Web Drivers appropriate for your OSX version, I used this link http://www.insanelymac.com/forum/topic/306535-nvidia-web-driver-updates-for-el-capitan-update-01202016/
  4. The install will put an icon for the 'NVIDIA Driver Manager' into the System Preferences, open this and under the 'Graphics Drivers' Tab select 'NVIDIA Web Driver'.  Follow the prompts and allow it to reboot.

That was it for me, simples when you know how!

 

Interestingly for me my HDMI audio fix for my GTX 650 also works with my GTX 970...no VoodooHDA just a Clover injected kext :-)

Link to comment
Share on other sites

Hi Guys

 

No hints from my previous post?

Cheers

Marco

 

Hey Marco, your problem seems a little odd...can you confirm a little more about your Clover setup i.e. is it UEFI only, what version of Clover, what drivers you configured Clover to install and use.  Also why is it difficult for you to rebuilt Clover?

Link to comment
Share on other sites

@KillerElvUK

 

Thanks for your answer!

 

Actually all is working fine at my end, just trying to optimize the boot time. 

Mac is booting in 15-20s almost but I loose 15s also on Clover side, due to LoadDrivers() end (somewhere).

 

My setup is QEMU + OVMF + Clover 3333. 

When I remove all the drivers in Drivers64UEFI/ , Clover start immediately but of course I can't see the main HDD disk to boot on.

If I add only the HFSPlus.efi driver, then the 15s lost in "LoadDrivers() end" are coming back again.

 

I can rebuild Clover now as Mac is alive. I wanted initially to build it on Linux. I can analyze more

Link to comment
Share on other sites

Finally had a chance to work on this, client work always gets in the way :-)

 

Here is my updated config.plist, with the updates suggested:

 

https://gist.github.com/gordonturner/074c7f1524130c0ae510

 

Changes:

  • Confirm `q35-acpi-dsdt.aml` in `EFI/CLOVER/BOOT/ACPI/origin/`
  • Aligned contents of `Root/ACPI` with plist segment from @KillerKelvUK

(see http://www.insanelymac.com/forum/topic/309087-insanely-fast-virtual-mac-qemu-ovmf-clover-and-native-graphics/?p=2207845)

 

I think that the Clover config is okay, but if anyone see anything else wrong please let me know?

 

Next I have been working on the qemu-system-x86_64 startup.  I am running a headless Ubuntu server with kvm/qemu, with on motherboard video, but was not planning on passing through.  I am also attempting to use a USB install image, not an iso install image.

 

 

 

My current status is that I no longer get the 'emulation failure' message, but after selecting Install OSX on the Clover GUI, I get a reboot into the OVMF EFI and then back to the Clover GUI.

 

 

Here is my current qemu-system-x86_64 call:

sudo qemu-system-x86_64 \
-m 4096 \
-enable-kvm \
-cpu core2duo,vendor=GenuineIntel \
-rtc base=localtime \
-smbios type=2 \
-machine q35,accel=kvm,usb=off,vmport=off \
-bios /vm/osx-ovmf-bios-src-build/bios.bin \
-smp 4,sockets=1,cores=2,threads=2 \
-device isa-applesmc,osk="REDACTED" \
\
-device ahci,id=hdbus,bus=pcie.0 \
-device ide-drive,bus=hdbus.0,drive=Clover \
-drive id=Clover,if=none,file=/vm/clover-usb-disk.dd,format=raw  \
-device ide-drive,bus=hdbus.1,drive=MacOSX \
-drive id=MacOSX,if=none,file=/vm/demo1-disk0.qcow2,format=raw  \
\
-usb \
-device usb-mouse \
-device usb-kbd \
-serial stdio \
-vga std \
-vnc :1

A few questions:

 

1) Any issues with the 'config.plist'?

 

2) Any suggestions (or glaring errors) in the qemu-system-x86_64 command above?

 

3) Can I install OSX without a dedicated GPU and access it over VNC?  I am doing this with an Ubuntu Desktop instance, it is slightly laggy, but useable.

 

4) Is it a good idea to install OSX without a dedicated GPU?

 

Thanks again.

 

Link to comment
Share on other sites

@That Gorod...

1) Any issues with the 'config.plist'?

 

The only ommission I can see from this is that you don't have any kernel param's i.e. -v for debug output...have you got this and just omitted them from your link?  The debug can be useful for diagnostics like in your current predicament.

 

2) Any suggestions (or glaring errors) in the qemu-system-x86_64 command above?

 

Your drive and device mappings look odd...firstly just the ordering of the statements, whilst not generally a problem typical qemu syntax has the -drive parameter first followed by the -device parameter.  Secondly I suspect your mixing old Chameleon qemu syntax as you have references like 'id=MacOSX' and 'ide-drive'.  Try something like the following in replace of your lines...

-device ahci,id=sata0,bus=pci.2,addr=0x5 \
\
-drive file=/vm/clover-usb-disk.dd,if=none,id=drive-sata0-0-2,format=raw \
-device ide-hd,bus=ide.2,drive=drive-sata0-0-2,id=sata0-0-2,bootindex=1 \
-drive file=/vm/demo1-disk0.qcow2,if=none,media=disk,id=drive-sata0-0-0,format=qcow2 \
-device ide-hd,bus=sata0.0,drive=drive-sata0-0-0,id=sata0-0-0 \

3) Can I install OSX without a dedicated GPU and access it over VNC?  I am doing this with an Ubuntu Desktop instance, it is slightly laggy, but useable.

 

Yes, no issues at all about using a qemu virtual graphics adapter...provided its qxl.  In your qemu command you have '-vga std'...this needs to change to either '-vga qxl' or something a little more complicated like '-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16'.  The differences are 2 fold...one is just that yours is the legacy qemu syntax vs. my recommendation; two the legacy syntax will only create a virtual adapter with 1mb vram, whilst my recommendation will create one with 16mb vram hence better performance.

 

The only other recommendation would be to consider switching from vnc to spice.  Yes OS X only natively supports VNC but that is created by a server running within the OS X operating system.  However if you have a qemu binary that has been build with SPICE support then using the QXL video adapter you can create a remote connection to the guest using qemu rather than the server process within the guest OS.  SPICE in this instance is a much richer protocol with better graphics support as well as usb redirection.  If you qemu binary has SPICE built in you can change your '-vnc :1' parameter to something like '-spice port=5905,disable-ticketing'...then using a spice capable client point it at 'spice://ip.address.of.your.host:5905'.  NOTE:  the IP address here is NOT the OSX IP address but that of your headless ubuntu server.  (Make sure any firewall you MAY be using is allowing connections from and to your host and client)

 

4) Is it a good idea to install OSX without a dedicated GPU?

 

Swings and roundabouts...if you are doing passthrough it can be a littler trickier depending on the hardware i.e. if your GFX hardware isn't natively supported by OSX then it can be a little more fiddly needing 'nv_disable=1'.  My first attempt was with an NVIDIA GTX 650 which as luck would have it was natively supported so just worked.  Probably simpler to get this up and running without a dedicated GPU.

Link to comment
Share on other sites

Thanks @KillerKelvUK, it appears there is a spice build of qemu-kvm for ubuntu 15.10, so that will be next to test.

 

In the mean time, updating my qemu-system-x86_64, removing `-vga std` and add `-device qxl-vga [...]` and also replacing the drive and device mappings to get:

sudo qemu-system-x86_64 \
-m 4096 \
-enable-kvm \
-cpu core2duo,vendor=GenuineIntel \
-rtc base=localtime \
-smbios type=2 \
-machine q35,accel=kvm,usb=off,vmport=off \
-bios /vm/osx-ovmf-bios-src-build/bios.bin \
-smp 4,sockets=1,cores=2,threads=2 \
-device isa-applesmc,osk="REDACTED" \
\
-device ahci,id=sata0,bus=pci.2,addr=0x5 \
\
-drive file=/vm/clover-usb-disk.dd,if=none,id=drive-sata0-0-2,format=raw \
-device ide-hd,bus=ide.2,drive=drive-sata0-0-2,id=sata0-0-2,bootindex=1 \
-drive file=/vm/demo1-disk0.qcow2,if=none,media=disk,id=drive-sata0-0-0,format=qcow2 \
-device ide-hd,bus=sata0.0,drive=drive-sata0-0-0,id=sata0-0-0 \
\
-usb \
-device usb-mouse \
-device usb-kbd \
-serial stdio \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16 \
-vnc :1

I get an error of:

qemu-system-x86_64: -device ahci,id=sata0,bus=pci.2,addr=0x5: Bus 'pci.2' not found

I have tried to cowboy it with different values from previous forum posts, but am not getting any traction.  Suggestions?

 

(I am adding the -v switch to the config.plist and copying it over now.)

Link to comment
Share on other sites

@ThatGordo, sorry yes I forgot you need to include the root pci devices that the ahci device maps back to, put the following above the '-device ahci...' line...

-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \

Have you noticed the hierarchical nature of the commands...i.e. the pci-bridge device has id=pci.2 and bus=pci.1, so then your ahci device has id=sata0 but is mapped against bus=pci.2 which is the same bus as created by the pci-bridge id=pci.2 parameter...kinda make sense?

Link to comment
Share on other sites

Thanks @KillerKelvUK, yes, that makes sense, so if I've got it right:

sudo qemu-system-x86_64 \
-m 4096 \
-enable-kvm \
-cpu core2duo,vendor=GenuineIntel \
-rtc base=localtime \
-smbios type=2 \
-machine q35,accel=kvm,usb=off,vmport=off \
-bios /vm/osx-ovmf-bios-src-build/bios.bin \
-smp 4,sockets=1,cores=2,threads=2 \
-device isa-applesmc,osk="REDACTED" \
\
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
-device ahci,id=sata0,bus=pci.2,addr=0x5 \
\
-drive file=/vm/clover-usb-disk.dd,if=none,id=drive-sata0-0-2,format=raw \
-device ide-hd,bus=ide.2,drive=drive-sata0-0-2,id=sata0-0-2,bootindex=1 \
-drive file=/vm/demo1-disk0.qcow2,if=none,media=disk,id=drive-sata0-0-0,format=qcow2 \
-device ide-hd,bus=sata0.0,drive=drive-sata0-0-0,id=sata0-0-0 \
\
-usb \
-device usb-mouse \
-device usb-kbd \
-serial stdio \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16 \
-vnc :1

Which will boot to the Clover screen with `Boot OS X Install from Install OS X El Capitan`, selecting that looks like it is starting to boot (black screen), then gets cycled back to the OVMF screen then back to the Clover screen.

 

I am copying over the USB dd image with the `-v` parameter now, I will see what that spits out.

 

EDIT: It occurs to me that in order to use the qxl-vga, I need the spice build of qemu-kvm for ubuntu 15.10.  I will install / update that and see if that makes a difference.

 

EDIT the second: It appears that my current, default, Ubuntu 15.10 kvm qemu includes spice support:

qemu-system-x86_64  -h
-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]
       [,x509-key-file=<file>][,x509-key-password=<file>]
       [,x509-cert-file=<file>][,x509-cacert-file=<file>]
       [,x509-dh-key-file=<file>][,addr=addr][,ipv4|ipv6|unix]
       [,tls-ciphers=<list>]
       [,tls-channel=[main|display|cursor|inputs|record|playback]]
       [,plaintext-channel=[main|display|cursor|inputs|record|playback]]
       [,sasl][,password=<secret>][,disable-ticketing]
       [,image-compression=[auto_glz|auto_lz|quic|glz|lz|off]]
       [,jpeg-wan-compression=[auto|never|always]]
       [,zlib-glz-wan-compression=[auto|never|always]]
       [,streaming-video=[off|all|filter]][,disable-copy-paste]
       [,disable-agent-file-xfer][,agent-mouse=[on|off]]
       [,playback-compression=[on|off]][,seamless-migration=[on|off]]
   enable spice
   at least one of {port, tls-port} is mandatory
Link to comment
Share on other sites

@KillerElvUK, Thanks!

 

Ok so we are aligned.

 

I suspect QEMU to simulate like a power off/on cycle on the fake hdd where mac os is mounted...

that could explain the 15s lost here. I will build clover and try to find a hack.

I will share the info if I find something.

 

Marco

Link to comment
Share on other sites

 Share

×
×
  • Create New...