Jump to content

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


514 posts in this topic

Recommended Posts

Hello Everyone,

 

Some updates from over the weekend:

 

1. I got sound working by passing through my mainboard's audio (Intel HD Audio - Realtek ALC887) to my VM. There are a few things I learned:

  • Make sure that the passthrough device has the same address on the guest as on the host: for my case (address 0x1b), the vfio-pci line is:
-device vfio-pci,host=00:1b.0,id=sound-device,bus=pcie.0,addr=0x1b
  • Even then, Clover still needs to tell the virtual mac where to look for the sound hardware. read this document on github.
  • Once sound hardware is detected in ioreg, you can install the driver from this page. I chose the clover_ALC version.

2. It seems like the OS X install problem we encountered a few days earlier might be a temporary problem from Apple's server? Now the problem seems to be gone.

  • Like 1
Link to comment
Share on other sites

Hello Everyone,

 

Some updates from over the weekend:

 

1. I got sound working by passing through my mainboard's audio (Intel HD Audio - Realtek ALC887) to my VM. There are a few things I learned:

  • Make sure that the passthrough device has the same address on the guest as on the host: for my case (address 0x1b), the vfio-pci line is:
-device vfio-pci,host=00:1b.0,id=sound-device,bus=pcie.0,addr=0x1b
  • Even then, Clover still needs to tell the virtual mac where to look for the sound hardware. read this document on github.
  • Once sound hardware is detected in ioreg, you can install the driver from this page. I chose the clover_ALC version.

2. It seems like the OS X install problem we encountered a few days earlier might be a temporary problem from Apple's server? Now the problem seems to be gone.

^ THIS!! good job man.

 

I had this same problem. I had to edit the ALC script though to find HDEF4 instead of HDEF1. The scripts are really not that good at detection.

Link to comment
Share on other sites

FYI, the next release of qemu will likely not include the `q35-acpi-dsdt.aml`, as it has been removed from the project.

 

 

Here is the commit log entry:

 

q35: Remove unused q35-acpi-dsdt.aml file

The file was used only by older machine-types, and it is not
needed anymore.

https://github.com/qemu/qemu/commit/75fb3d286eae1b0f7a93897be2d67f42dc466e8e

 

 

If anyone wants to access the file directly, the last version of it is here:

 

https://github.com/qemu/qemu/blob/4f7ab0cdbccfc1d0a3a6d0a7c9a22d8a90d9e2f0/pc-bios/q35-acpi-dsdt.aml

 

 

Which brings me to my question,

 

If `q35-acpi-dsdt.aml` is removed / depreciated, what should we be using in it's place?

Link to comment
Share on other sites

FYI, the next release of qemu will likely not include the `q35-acpi-dsdt.aml`, as it has been removed from the project.

 

 

Here is the commit log entry:

 

q35: Remove unused q35-acpi-dsdt.aml file

The file was used only by older machine-types, and it is not

needed anymore.

https://github.com/qemu/qemu/commit/75fb3d286eae1b0f7a93897be2d67f42dc466e8e

 

 

If anyone wants to access the file directly, the last version of it is here:

 

https://github.com/qemu/qemu/blob/4f7ab0cdbccfc1d0a3a6d0a7c9a22d8a90d9e2f0/pc-bios/q35-acpi-dsdt.aml

 

 

Which brings me to my question,

 

If `q35-acpi-dsdt.aml` is removed / depreciated, what should we be using in it's place?

The real question is, if QEMU supports any other machine types. You can extract those DSDT's from every firmware/bios files...

Link to comment
Share on other sites

Hello,

 

Is possible to "translate" to a xml file the command line to launch the virtual machine in virt-manager gui?

 

Regards

If you're using virt-manager then you will have libvirt and virsh installed...virsh is the command line alternative to virt-manager...basically you just need to issue 'virsh start nameofyourvm'.

Link to comment
Share on other sites

Haha. So that's why our El Capitan installers were balking earlier. :lol:

 

More updates on my Mac OS X VM running on Ubuntu Server:

 

I clean installed new daily build of Ubuntu 16.04. Now kernel is at 4.4.0-9, qemu is at 2.5.0. This fixed the problem of passing through the entire USB controller I encountered earlier. virt-manager (GUI for virsh) is also updated to 1.3.2.

 

Overall, I'm happy with qemu 2.5.0. It actually improved things. If you are running an earlier version, I highly recommend an update. There were problems that I was pulling my hair out trying to fix that 2.5.0 fixed for me.

 

I haven't yet tried HDMI audio on my nvidia card yet (happy with on board sound).

 

Is it possible to use hugepages and CPU pinning for qemu without using libvirt? I think it should be possible for hugepages, but maybe not for CPU pinning. libvirt's XML makes me uncomfortable. :no: I don't like it when XML gets translated into command line stuff. Many possibilities of things to go wrong.

 

Here's my latest script. It's working ok. Minimal possible hardware on qemu q35 machine:

#!/bin/bash
# need the following echo for Mac OS X guest
sudo sh -c 'echo 1 > /sys/module/kvm/parameters/ignore_msrs'

echo "--claiming passthrough resources (if any)---"
sudo ./vfio-group 1  # GPU
sudo ./vfio-group 5  # USB controller
sudo ./vfio-group 6  # sound

sudo qemu-system-x86_64 \
-m 8192 \
-enable-kvm \
-cpu core2duo,kvm=off,vendor=GenuineIntel \
-smp 2,sockets=1,cores=2,threads=1 \
-M q35,accel=kvm,usb=on,vmport=off \
-bios OVMF-pure-efi.fd \
-nodefaults \
\
-device i82801b11-bridge,id=pci.0,bus=pcie.0,addr=0x1e \
\
-device ide-hd,bus=ide.0,drive=sata0-0,bootindex=1 \
-drive id=sata0-0,if=none,file=diskYsnap.img,format=qcow2  \
\
-netdev tap,id=hostnet0 \
-device e1000-82545em,netdev=hostnet0,id=net0,mac=52:54:00:1d:3a:25,bus=pci.0,addr=5 \
\
-device isa-applesmc,osk="ohlalala" \
\
-nographic \
-device vfio-pci,host=01:00.0,id=host-video,bus=pcie.0,multifunction=on \
-device vfio-pci,host=00:1b.0,id=host-sound,bus=pcie.0,addr=0x1b \
\
-device vfio-pci,host=00:1a.0,id=host-usbhub,bus=pcie.0,addr=0x1a \
\
-serial stdio \

echo "---return passthrough resources---"
sudo ./vfio-ungroup 1  # GPU
sudo ./vfio-ungroup 5  # USB controller
sudo ./vfio-ungroup 6  # sound
echo "---shutdown successful---"
Link to comment
Share on other sites

With regards to the expired certs and the error message,

 

If you add the following to the install (not needed after installation):

-rtc clock=vm,base=2016-01-01T16:00:00 \

And remove any network card like (again, restore after installation):

-device e1000-82545em,netdev=Mac,mac=52:54:00:00:00:02 -netdev tap,id=Mac \

This is b/c the installer appears to use ntp to get the right time.  I suppose you could also be clever and block the ntp traffic as an alternative.

 

Obviously this will impact any network activities during Installation.

 

Validating this right now.

Link to comment
Share on other sites

  • 2 weeks later...

Hi All,

Thanks for all the info and efforts of the community. For what it's worth, I just wanted to report that El Capitan using roughly waschbenzin's guidance works like a charm even on a virtual linux (Ubuntu 16.04 preferably that has latest qemu 2.5) running via Parallels on my Macbook Pro laptop as long as "Enable Nested Virtualisation" is ticked... Don't ask me why I did it - just to see if it works I guess ... ;-)

Link to comment
Share on other sites

What is the step to create a image and install clover on? Will try this on my unRAID machine.

 

Hi Peter,

 

You can check this link and use waschbenzin's ready-made clover disk. It works well. After that, you can customize/build your own.

 

Hope this helps.

Link to comment
Share on other sites

So, has anyone got the OSX vm to boot with the cpu host setting?

 

At the moment the core2duo setting is working fine, but I'd like to use my host cpu as cpu model, since this should get better performance.

What kind of problem did you have, when you've tried it?

Link to comment
Share on other sites

What kind of problem did you have, when you've tried it?

 

Well, when Clover starts to boot from my OSX partition it just resets my VM, no errors, nothing, it just resets.

 

I know everyone is using -cpu core2duo, but I wanna know why host doesn't work. I know that -cpu host enables every cpu feature even if the CPU doesn't even support one of the particular features.

Sadly qemu has no implementation of a host cpu model that enables only the ones that match with my cpu, only libvirt can do that, but since I'm using Proxmox for virtualization, which doesn't use libvirt, there is no way I can use libvirt. But I'm also not sure if this would fix this problem.

Link to comment
Share on other sites

Well, when Clover starts to boot from my OSX partition it just resets my VM, no errors, nothing, it just resets.

 

I know everyone is using -cpu core2duo, but I wanna know why host doesn't work. I know that -cpu host enables every cpu feature even if the CPU doesn't even support one of the particular features.

Sadly qemu has no implementation of a host cpu model that enables only the ones that match with my cpu, only libvirt can do that, but since I'm using Proxmox for virtualization, which doesn't use libvirt, there is no way I can use libvirt. But I'm also not sure if this would fix this problem.

I have no performance slowdown passing core2duo. My VM seems to know I have a xeon. I have tested it with geekbench against my Haswell 2013 and I am consistently getting better numbers in the vM despite the chip being made a quarter before.

 

Getting host to work would be amazing as it would definitely help in standardizing my scripts.

Link to comment
Share on other sites

Well, when Clover starts to boot from my OSX partition it just resets my VM, no errors, nothing, it just resets.

 

I know everyone is using -cpu core2duo, but I wanna know why host doesn't work. I know that -cpu host enables every cpu feature even if the CPU doesn't even support one of the particular features.

Sadly qemu has no implementation of a host cpu model that enables only the ones that match with my cpu, only libvirt can do that, but since I'm using Proxmox for virtualization, which doesn't use libvirt, there is no way I can use libvirt. But I'm also not sure if this would fix this problem.

Try to enable debugging in clover and post the logs (see clover wiki for more information).

Link to comment
Share on other sites

Try to enable debugging in clover and post the logs (see clover wiki for more information).

 
So I compared the log to a log where it booted successful and they are pretty much similar, but then I looked at line 39:219 normally the FSB is a positive number but with the host cpu setting it is negative, I don't know, but it seems like that could be the problem. But the question is, how do I fix it?
I already tried manually setting frequency in mhz and the bus speed in khz but the problem still persists. And as you can see in the beginning of the log, Clover seems to recognize the correct values anyway.
 
Here is the log: http://pastebin.com/2VaTrFcP
Link to comment
Share on other sites

 

 
So I compared the log to a log where it booted successful and they are pretty much similar, but then I looked at line 39:219 normally the FSB is a positive number but with the host cpu setting it is negative, I don't know, but it seems like that could be the problem. But the question is, how do I fix it?
I already tried manually setting frequency in mhz and the bus speed in khz but the problem still persists. And as you can see in the beginning of the log, Clover seems to recognize the correct values anyway.
 
Here is the log: http://pastebin.com/2VaTrFcP

 

It appears to be a bug in clover. Maybe it is fixed with the recent updates.

Try to contact Slice about it.

Link to comment
Share on other sites

It is just a display bug. I provided the patch and being the C noob I am, I used %d to display the speed of the FSB. Correct would be %lu since it is a 64-bit wide unsigned integer. 

 

Well, then that means my problem happens after Clover boots OSX.. You think OSX can't handle a Xeon E3-1230v3 and I should change my CPUID?

Link to comment
Share on other sites

  • 4 weeks later...

Hi,

 

I am trying to add a network connection to my VM.

 

I tried using a bridge, but every time i try to bridge the wifi interface with the br0 interface, it says operation not supported.

 

I was trying to get it working with the scripts posted here in the zip file.

http://www.insanelymac.com/forum/topic/309087-insanely-fast-virtual-mac-qemu-ovmf-clover-and-native-graphics/page-12?do=findComment&comment=2209633

 

But the thing with the scripts in there, is that it assumes there is a bridge set up with the name br0. I am having trouble setting up that bridge.

 

Also how would it configured in the OSX 10.11?

 

Note: I am on wifi, since i am on a laptop.

Link to comment
Share on other sites

Hey mac, are you attempting to create the bridge after your laptop has booted or have you updated the network scripts to get them to create the bridge during boot? Either way please can you post some config and actual errors?

 

I see no reason why you can't bridge a wifi adapter although I don't ever recall attempting this in Linux myself. If it's any reassurance in Parallels for Mac you can bridge any of the adapters with a VM, I've bridged the wifi and the thunderbolt and both worked.

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

Hi KillerKelvUK,

 

I am trying to create a bridge after the laptop is booted. I have a simple script that does this for me which i execute before the VM starts. 

Even though manually executing scripts can be a pain, i would like to keep it this way. 

 

The script is as follows.

brctl addbr br0
brctl addif br0 wlp2s0 

Error -> can't add wlp2s0 to bridge br0: Operation not supported

Note: wlp2s0 is the name of my wifi interface.

 

Attaching it to the VM like this. 

-netdev tap,id=hostnet0,ifname=tap0,script=./qemu_br0_ifup.sh,downscript=./qemu_br0_ifdown.sh \
-device e1000-82545em,netdev=hostnet0,id=tap0,mac=`source ./genmac.sh` \

The scripts are taken directly from 

http://www.insanelymac.com/forum/topic/309087-insanely-fast-virtual-mac-qemu-ovmf-clover-and-native-graphics/page-12?do=findComment&comment=2209633

 

I edited the scripts to changed the IP form 0.0.0.0 to something i prefer.

Link to comment
Share on other sites

 Share

×
×
  • Create New...