Jump to content
waschbenzin

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

512 posts in this topic

Recommended Posts

Hi, could someone test something for me?

 

Load up about 5 programs in your macos VM and then "save" the vm... I want to know about how fast it is.

 

Also do the same with resuming.

 

I would greatly appreciate it.

 

I'm trying to find out how fast I can switch from work to gaming and back.

If you are using GPU PCI-E passthrough you cant save the VM state you will have to shutdown OSX then start windows. I'm assuming you are doing that sense you are talking about gaming...

 

However if you are not doing GPU passthough then. The speed of how fast you can save state a VM will depend on how much ram you allocate to it and how fast your drives are it's copying the ram to. All of witch we wont be able to tell you.

Share this post


Link to post
Share on other sites
Advertisement

If you are using GPU PCI-E passthrough you cant save the VM state you will have to shutdown OSX then start windows. I'm assuming you are doing that sense you are talking about gaming...

 

However if you are not doing GPU passthough then. The speed of how fast you can save state a VM will depend on how much ram you allocate to it and how fast your drives are it's copying the ram to. All of witch we wont be able to tell you.

 

What if I had two GPUs?

Share this post


Link to post
Share on other sites

What if I had two GPUs?

Then you could pass 1 to osx and 1 to windows. So you dont  need to shutdown either OS you could have them running at the same time. So your original question would be pointless at that point...

Share this post


Link to post
Share on other sites

Then you could pass 1 to osx and 1 to windows. So you dont  need to shutdown either OS you could have them running at the same time. So your original question would be pointless at that point...

 

No because I would want as much cpu power for the win10 gaming vm. Closing the macos vm would free up resources for gaming. Maybe I could use both GPUs for the gaming vm too?

Share this post


Link to post
Share on other sites

No because I would want as much cpu power for the win10 gaming vm. Closing the macos vm would free up resources for gaming. Maybe I could use both GPUs for the gaming vm too?

same rules apply then you would have to shutdown osx before windows could take over using the cards. I don't know how to me more clear. You cant suspend a VM that is using PCI pass-through it must be shutdown.

Share this post


Link to post
Share on other sites

same rules apply then you would have to shutdown osx before windows could take over using the cards. I don't know how to me more clear. You cant suspend a VM that is using PCI pass-through it must be shutdown.

 

You are being clear. But what isnt is why this is the case. It seems like you should be able to "release" a gpu which a saved VM was using.

Share this post


Link to post
Share on other sites

You are being clear. But what isnt is why this is the case. It seems like you should be able to "release" a gpu which a saved VM was using.

Can you unplug a gpu from a running machine and it be happy? no you cant. PCI is not a hot swap-able device standard. So you start the VM it initializes the GPU talks to it's firmware loads the drivers ect. Then you save the VM's state. At this point you have a copy of the VM's ram saved to disk but not it's Vram. Now you load up windows it initialized the GPU and erased the OS X data from it's VRAM. When you try to relaunch the VM of OS X in the saved state it will not re-initalize the GPU it will asume it was still plugged in because from it's view it was never actually shut down the memory of the VM was just staved for later. This is why you need to start up the VM and cant save it's state.

Share this post


Link to post
Share on other sites

The previously patched clover in this thread works for me. Don't know whats wrong with the newer patched clover? But there was one more with same issue that I have with choppy sound for newer patched clover.

I too am running on unRAID and was experiencing audio stuttering on a number of VMs but not macOS using the patched Clover 3578.  After installing email4nickp's patched Clover 3923 my unRAID Sierra VM started to experience audio issues similar to what Peter_sm is experiencing.  The solution that worked for me was to isolate and assign CPUs to the VM.  Alter your syslinux configuration to include the cpus you'd like to isolate

  append isolcpus=2,3 initrd=/bzroot

and add an emulator pin to you're VM configuration

  <cputune>
    <vcpupin vcpu='0' cpuset='2'/>
    <vcpupin vcpu='1' cpuset='3'/>
    <emulatorpin cpuset='0'/>
  </cputune>

More information can be found here:

https://lime-technology.com/forum/index.php?topic=49051.0

 

Currently running patched Clover 3923 without issue after applying the above.

Share this post


Link to post
Share on other sites

I too am running on unRAID and was experiencing audio stuttering on a number of VMs but not macOS using the patched Clover 3578.  After installing email4nickp's patched Clover 3923 my unRAID Sierra VM started to experience audio issues similar to what Peter_sm is experiencing.  The solution that worked for me was to isolate and assign CPUs to the VM.  Alter your syslinux configuration to include the cpus you'd like to isolate

  append isolcpus=2,3 initrd=/bzroot

and add an emulator pin to you're VM configuration

  <cputune>
    <vcpupin vcpu='0' cpuset='2'/>
    <vcpupin vcpu='1' cpuset='3'/>
    <emulatorpin cpuset='0'/>
  </cputune>

More information can be found here:

https://lime-technology.com/forum/index.php?topic=49051.0

 

Currently running patched Clover 3923 without issue after applying the above.

Hi, Thanks, it seems to work!

I have these settings in unRAID

cpu 0 / 8	
cpu 1 / 9	
cpu 2 / 10	
cpu 3 / 11	
cpu 4 / 12	
cpu 5 / 13	
cpu 6 / 14	
cpu 7 / 15
 append isolcpus=4-6,12-14 vfio.pci.ids=10de:11c0,10de:0e0b,1002:6779,1002:aa98,8086:3c08 initrd=/bzroot
  <vcpu placement='static'>6</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='4'/>
    <vcpupin vcpu='1' cpuset='5'/>
    <vcpupin vcpu='2' cpuset='6'/>
    <vcpupin vcpu='3' cpuset='12'/>
    <vcpupin vcpu='4' cpuset='13'/>
    <vcpupin vcpu='5' cpuset='14'/>
  </cputune>

but what should I set for this line ?

<emulatorpin cpuset='?'/>

Share this post


Link to post
Share on other sites

With the pinning and updated syslinux with isolcpus I don't need a patched Clover :-) all is working find including HDMI sound :-) :-) running Clover_v2.3k_r3969

 

//Peter

Share this post


Link to post
Share on other sites

With the pinning and updated syslinux with isolcpus I don't need a patched Clover :-) all is working find including HDMI sound :-) :-) running Clover_v2.3k_r3969

 

//Peter

Peter, I'm still having issues with CPU speed on stock Clover r3961 installed. Was previous using gridrunner's EFI from his YouTube guide for UnRAID which worked fine, but would really like to update Clover with the hope FileVault2 will run. isolcpus + pinning (vcpu and emulatorpin) still has the same result with Clover's QEMU flag disabled (superspeed) and QEMU flag enabled (1/4 speed).

 

Where did you get r3969? I can't find it anywhere.

 

Would you be willing to share your domain.xml, syslinux, and/or config.plist? Are you still on r3969? Thanks a ton.

Share this post


Link to post
Share on other sites

Hi , Here are some input what I have. I'm running clover -- Clover_v2.3k_r3974

config.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>ACPI</key>
        <dict>
                <key>DSDT</key>
                <dict>
                        <key>Debug</key>
                        <false/>
                        <key>DropOEM_DSM</key>
                        <false/>
                        <key>Fixes</key>
                        <dict>
                                <key>AddHDMI_8000000</key>
                                <true/>
                                <key>AddPNLF_1000000</key>
                                <true/>
                                <key>DeleteUnused_400000</key>
                                <true/>
                                <key>FIX_ACST_4000000</key>
                                <true/>
                                <key>FIX_ADP1_800000</key>
                                <true/>
                                <key>FIX_RTC_20000</key>
                                <true/>
                                <key>FIX_S3D_2000000</key>
                                <true/>
                                <key>FIX_TMR_40000</key>
                                <true/>
                                <key>FixRegions_10000000</key>
                                <true/>
                                <key>NewWay_80000000</key>
                                <true/>
                        </dict>
                        <key>Name</key>
                        <string>q35-acpi-dsdt.aml</string>
                        <key>ReuseFFFF</key>
                        <false/>
                </dict>
                <key>HaltEnabler</key>
                <true/>
                <key>SSDT</key>
                <dict>
                        <key>DropOem</key>
                        <false/>
                        <key>Generate</key>
                        <false/>
                </dict>
        </dict>
        <key>Boot</key>
        <dict>
                <key>Arguments</key>
                <string>nvda_drv=1</string>
                <key>Debug</key>
                <false/>
                <key>DefaultLoader</key>
                <string>boot.efi</string>
                <key>DefaultVolume</key>
                <string>MAC</string>
                <key>Legacy</key>
                <string>PBR</string>
                <key>Secure</key>
                <false/>
                <key>Timeout</key>
                <integer>5</integer>
                <key>XMPDetection</key>
                <string>Yes</string>
        </dict>
        <key>CPU</key>
        <dict>
                <key>QEMU</key>
                <true/>
                <key>UseARTFrequency</key>
                <false/>
        </dict>
        <key>Devices</key>
        <dict>
                <key>USB</key>
                <dict>
                        <key>FixOwnership</key>
                        <false/>
                        <key>Inject</key>
                        <false/>
                </dict>
        </dict>
        <key>GUI</key>
        <dict>
                <key>Mouse</key>
                <dict>
                        <key>DoubleClick</key>
                        <integer>500</integer>
                        <key>Enabled</key>
                        <false/>
                        <key>Mirror</key>
                        <false/>
                        <key>Speed</key>
                        <integer>8</integer>
                </dict>
                <key>Scan</key>
                <true/>
                <key>ScreenResolution</key>
                <string>1920x1080</string>
                <key>Theme</key>
                <string>iclover</string>
        </dict>
        <key>Graphics</key>
        <dict>
                <key>Inject</key>
                <false/>
                <key>NvidiaSingle</key>
                <false/>
        </dict>
        <key>KernelAndKextPatches</key>
        <dict>
                <key>AppleRTC</key>
                <false/>
                <key>AsusAICPUPM</key>
                <false/>
                <key>Debug</key>
                <false/>
                <key>KernelCpu</key>
                <false/>
                <key>KernelHaswellE</key>
                <false/>
                <key>KernelLapic</key>
                <false/>
                <key>KernelPm</key>
                <false/>
        </dict>
        <key>RtVariables</key>
        <dict>
                <key>BooterConfig</key>
                <string>0x28</string>
                <key>CsrActiveConfig</key>
                <string>0x67</string>
                <key>ROM</key>
                <string>UseMacAddr0</string>
        </dict>
        <key>SMBIOS</key>
        <dict>
                <key>BiosReleaseDate</key>
                <string>09/03/2013</string>
                <key>BiosVendor</key>
                <string>Apple Inc.</string>
                <key>BiosVersion</key>
                <string>IM142.88Z.0118.B00.1qwerty</string>
                <key>Board-ID</key>
                <string>Mac-ccccccccccc</string>
                <key>BoardManufacturer</key>
                <string>Apple Inc.</string>
                <key>BoardSerialNumber</key>
                <string>wwwwwwwwwwww</string>
                <key>BoardType</key>
                <integer>10</integer>
                <key>ChassisAssetTag</key>
                <string>iMac-Aluminum</string>
                <key>ChassisManufacturer</key>
                <string>Apple Inc.</string>
                <key>ChassisType</key>
                <string>13</string>
                <key>Family</key>
                <string>iMac</string>
                <key>Manufacturer</key>
                <string>Apple Inc.</string>
                <key>ProductName</key>
                <string>iMac14,2</string>
                <key>SerialNumber</key>
                <string>yyyyyyyyyyy</string>
                <key>SmUUID</key>
                <string>xxxxxxxx</string>
                <key>Trust</key>
                <false/>
                <key>Version</key>
                <string>1.0</string>
        </dict>
        <key>SystemParameters</key>
        <dict>
                <key>InjectKexts</key>
                <string>Detect</string>
                <key>InjectSystemID</key>
                <true/>
        </dict>
</dict>
</plist>

syslinyx

  append isolcpus=4-6,12-14 vfio.pci.ids=10de:11c0,10de:0e0b,1002:6779,1002:aa98,8086:3c08 initrd=/bzroot

domain

<domain type='kvm' id='7' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>macOS-Sierra</name>
  <uuid>43ec82e1-22ff-2814-5118-ea8a3c8a8edf</uuid>
  <description>OSX Sierran</description>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="macos-Sierra.png" os="osx"/>
  </metadata>
  <memory unit='KiB'>33554432</memory>
  <currentMemory unit='KiB'>33554432</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>6</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='4'/>
    <vcpupin vcpu='1' cpuset='5'/>
    <vcpupin vcpu='2' cpuset='6'/>
    <vcpupin vcpu='3' cpuset='12'/>
    <vcpupin vcpu='4' cpuset='13'/>
    <vcpupin vcpu='5' cpuset='14'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-2.7'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/43ec82e1-22ff-2814-5118-ea8a3c8a8edf_VARS-pure-efi.fd</nvram>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='forbid'>Penryn</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/vg_virtual_machines/lv_Sierra'/>
      <backingStore/>
      <target dev='vda' bus='sata'/>
      <alias name='sata0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='piix3-uhci'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <model name='i82801b11-bridge'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <model name='pci-bridge'/>
      <target chassisNr='2'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:00:20:30'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='e1000-82545em'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
    </interface>
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <rom bar='on' file='/mnt/appdata/vbios-VIDIA-GeForce-GTX-660/vbios.rom'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x06' slot='0x00' function='0x1'/>
      </source>
      <alias name='hostdev1'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc52b'/>
        <address bus='3' device='3'/>
      </source>
      <alias name='hostdev2'/>
      <address type='usb' bus='0' port='1'/>
    </hostdev>
    <memballoon model='none'>
      <alias name='balloon0'/>
    </memballoon>
  </devices>
  <seclabel type='none' model='none'/>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+0:+100</label>
    <imagelabel>+0:+100</imagelabel>
  </seclabel>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=xxxxxxxxx'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='Penryn,vendor=GenuineIntel'/>
  </qemu:commandline>
</domain>

Share this post


Link to post
Share on other sites

Hey guys I'm running two copies of OS X on my computer. One is running OS X server and the other is using PCI passthrough as a desktop workstation. Anyways when playing with with OS X server I figured out that you don't need the flags

-device usb-kbd -device usb-mouse

Instead use 

QemuUSBTablet1011.kext

VoodooPS2Controller.kext

 

This way you can use the native KVM keyboard and mouse. I just dropped the kexts into my clover folder.

 

mouse&keyboard.zip

Share this post


Link to post
Share on other sites

Checking in after a few months. I attempted to upgrade to Sierra by performing a clean install in the same manner I did for El Capitan. Clover latest has fixed issue with Penryn CPU type. However, I did experience the GUI slowdown with Qemu CPU choice in Clover. The patched clover that was posted from the mega link worked for me. Will update the post with my specs in a bit.

 

 

Sent from my iPhone using Tapatalk

Share this post


Link to post
Share on other sites

Checking in after a few months. I attempted to upgrade to Sierra by performing a clean install in the same manner I did for El Capitan. Clover latest has fixed issue with Penryn CPU type. However, I did experience the GUI slowdown with Qemu CPU choice in Clover. The patched clover that was posted from the mega link worked for me. Will update the post with my specs in a bit.

 

 

Sent from my iPhone using Tapatalk

 

Are you able to use host CPU settings with the latest clover build? I've been putting off updating for a while now!

Share this post


Link to post
Share on other sites

Are you able to use host CPU settings with the latest clover build? I've been putting off updating for a while now!

I'm still not able to use host setting. Out of curiosity why do you care? I don't think it even makes a difference for performance of OSX. 

Share this post


Link to post
Share on other sites

I'm still not able to use host setting. Out of curiosity why do you care? I don't think it even makes a difference for performance of OSX. 

 

I'd like to get it running as natively as possible. More to satisfy my OCD than anything else! I can't help but feel using a bodged version of clover with an antiquated guest CPU type is a bit hackish. 

Share this post


Link to post
Share on other sites

I'd like to get it running as natively as possible. More to satisfy my OCD than anything else! I can't help but feel using a bodged version of clover with an antiquated guest CPU type is a bit hackish. 

 

Run the following:

 

sysctl -a | grep machdep.features

 

Compare to your host CPU and let me know if there is a difference. 

Share this post


Link to post
Share on other sites

Run the following:

 

sysctl -a | grep machdep.features

 

Compare to your host CPU and let me know if there is a difference. 

 

Host:

root@JackBox:~# cat /proc/cpuinfo | grep flags
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves dtherm arat pln pts hwp hwp_notify hwp_act_window hwp_epp

Guest:

Jacks-Mac-Pro:~ jackhadrill$ sysctl -a | grep machdep.cpu.features
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH MMX FXSR SSE SSE2 HTT SSE3 SSSE3 CX16 SSE4.1 x2APIC VMM

Share this post


Link to post
Share on other sites

Hey guys. It's been a while. Other reported that Qemu-CPus are fixed with current Clover... well at least not for me :/

 

However you can achieve nice benchmark scores with it :)https://browser.geekbench.com/v4/cpu/compare/1546170?baseline=1546422

 

So i applied the patches again (since nobody @ the source forge ticket reacted and clover is too big of a mess so i won't maintain a for myself):

 

https://p-sol.de/claudia/index.php/s/ZPsZsJVi8N8ro64

 

Works fine for me, however only with Penryn vCPU. While my last fix worked for Westmere / Sandybridge / etc as well this one for me only works with Penryn (and core2duo, etc of course, but who wants that ?? ;) )

 

If i find the time i might again dig deeper into it and try to get it fixed without workaround :P

 

 

tested on X58 + X5650 and C602 + e5 2660

Share this post


Link to post
Share on other sites

Revisiting this thread. Currently this is STILL my day to day workstation. I use it as I would use my Apple laptop. Experience has been optimal. Recently I updated to Sierra and had a problem with sound. I did the following:

 

Success: 

 

1. Updated Arch Kernel. I noticed that the ALS downstream flag was not supported in my kernel. I then went to AUR and grabbed the vfio kernel and installed from there. Once complete, I noticed all IOMMU groups were seperated for the most part.

2. Updated virtual machine command to use ONLY vfio. This is now solid.

3. Updated to latest sierra. GTX 970 still working like a champ. 

 

Pending:

 

1. Sound is currently broken. I have a USB DAC so this isn;'t really a problem, but I would like to get optical out working for my ALC1150 chipset. Any pointers would be appreciated. 

 

This is an extremely good setup. My clover version from SVN is still working flawlessly.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×