Pavo-IM / KVM-Opencore

Opencore Configuration of KVM Hackintosh with tweaks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KVM-Opencore

Opencore Configuration of KVM Hackintosh with tweaks.

We propose best practice for KVM users.

Status

  • OS: tested in Catalina 10.15.x
  • Opencore: 0.5.6
    • NVRAM: native
    • AppleHotKey: works
    • FileVault: un-tested
    • Boot-Audio: works with onboard audio passthrough
    • OVMF: you can use latest version other than the old way(patched one). see issues.
  • SMBIOS: iMacPro1,1
  • NIC: vmxnet3/e1000-82545em/passthrough
  • CPU:
    • Intel Host-Passthrough: works
    • AMD Host-PassThrough: works
  • GPU Passthrough: works
    • HDMI/DP Audio: works
    • Metal Support: works
    • H264 Hardware Decoding: works
    • H265 Hardware Decoding: works
  • Handoff: works with specific Wifi/Bluetooth
  • USB(Passthrough): works
  • Power Manages
    • Sleep: works, see details below.
    • EC: faked one
    • USB Power: works even with USB3 passthrough
    • CPU AGPM: wo don't need CPU AGPM because hypervisor handled it well, this is for GPU AGPM
    • GPU AGPM: works

Usage

  1. Download the repository and put the EFI under your EFI disk

Manual

Libvirt XML

See more in libvirt.xml.

SMBios

Comparing with normal hackintosh setup, we have only limited choices here(because we don't have an iGPU).

  • iMacPro1,1(Prefer)
  • MacPro7,1

CPU

Models Selection

You have two options to choose: Passthrough, Emulating Model.

Passthrough

Intel

If you are using most recent generation Intel CPU(newer than Penryn), then you can just passthrough your cpu type with mode='host-passthrough'.

AMD

You can passthrough amd processer also, but OpenCore will emulate a Xeon processor.

Other Notes about CPU

Irregular Topology

If you wanna assign an irregular topology (like 3-cores/6-threads or 5-cores/5-threads), you should fake a topology, otherwise you will get a kernel panic. Details can be found here.

<!-- Example cpu topology defination with 3-cores/6-threads -->
<vcpu placement='static' current='6'>8</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
    <vcpu id='1' enabled='yes' hotpluggable='yes' order='2'/>
    <vcpu id='2' enabled='yes' hotpluggable='yes' order='3'/>
    <vcpu id='3' enabled='yes' hotpluggable='yes' order='4'/>
    <vcpu id='4' enabled='yes' hotpluggable='yes' order='5'/>
    <vcpu id='5' enabled='yes' hotpluggable='yes' order='6'/>
    <!-- Fake two cores but disabled. -->
    <vcpu id='6' enabled='no' hotpluggable='yes'/>
    <vcpu id='7' enabled='no' hotpluggable='yes'/>
  </vcpus>
  <cputune>
    <vcpupin vcpu='0' cpuset='6'/>
    <vcpupin vcpu='1' cpuset='14'/>
    <vcpupin vcpu='2' cpuset='7'/>
    <vcpupin vcpu='3' cpuset='15'/>
    <vcpupin vcpu='4' cpuset='5'/>
    <vcpupin vcpu='5' cpuset='13'/>
  </cputune>
  <cpu mode='host-passthrough' check='none'>
    <topology sockets='1' cores='4' threads='2'/>
  </cpu>

Unknown CPU Name

If you find unknown cpu model in you system info, you can change it by specify the ProcessorType in SMBios Section of config.plist. Choices can be found in here.

Example, if you have or emulate a skylake-server processor, you can use 0x0F01(Xeon-W):

// <0F01> 08 cores  Intel Xeon W                   Intel Xeon W
// <0F01> 10 cores  Intel Xeon W                   Intel Xeon W
// <0F01> 14 cores  Intel Xeon W                   Intel Xeon W
// <0F01> 18 cores  Intel Xeon W                   Intel Xeon W

Notes, the cores should be matched too, or you can fake some disable cores to match the topology. Then you can specify 3841(0x0F01 in decimal) in ProcessorType section.

GPU

GPU passthrough is a good way to gain smooth experience in MacOS.If you do so, make sure you doing things right. You have to make sure you put the gfx and graphic audio in the same bus but different function, otherwise DP/HDMI audio, Metal Support, HW Accuration won't work.

<!-- Assume we have a graphic(gfx(0x2d/0x0) and audio(0x2d/0x1)) -->
<hostdev mode='subsystem' type='pci' managed='yes'>
    <driver name='vfio'/>
    <source>
        <address domain='0x0000' bus='0x2d' slot='0x00' function='0x0'/>
    </source>
<!-- we put gfx under bus 0x01 and function 0x0, also with multifunction on. -->
    <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0' multifunction='on'/>
</hostdev>
<hostdev mode='subsystem' type='pci' managed='yes'>
    <driver name='vfio'/>
    <source>
        <address domain='0x0000' bus='0x2d' slot='0x00' function='0x1'/>
    </source>
<!-- we put graphic audio under the same bus 0x01 with gfx but different function 0x1-->
    <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
</hostdev>

If you did it right, then there is no much differeces between VM and normal setup procedure, just adding Lilu/WEG/AppleALC then the Metal/H264/H265 HW/HDMI Audio will work well in most case.

USB

XHCI(nec/qemu) can be used by MacOS, but you it is limited to 7 emulated USB ports. USB port mapping(EHC) and USB Power injection(with fake EC ioreg) are already included in config.plist.

Known Problems/Help

see issues.

About

Opencore Configuration of KVM Hackintosh with tweaks

License:GNU General Public License v3.0