Skip to content

Instantly share code, notes, and snippets.

@fredmajor
Created November 26, 2017 22:21
Show Gist options
  • Save fredmajor/5a483ac96f7ce46cd3e465b0230bbc02 to your computer and use it in GitHub Desktop.
Save fredmajor/5a483ac96f7ce46cd3e465b0230bbc02 to your computer and use it in GitHub Desktop.
#!/bin/bash
# this starts an OSX High Sierra VM. Highly optimized setup with GPU and USB controller passthrough.
# Everything works great except the sound.
#virsh nodedev-list | grep pci
virsh nodedev-detach pci_0000_00_14_0
MY_OPTIONS="+aes,+xsave,+avx,+xsaveopt,avx2,+smep"
taskset -c 0-3 qemu-system-x86_64\
-enable-kvm\
-m 8G\
-mem-path /dev/hugepages\
-mem-prealloc\
-balloon none\
-cpu Penryn,kvm=off,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,$MY_OPTIONS,hv_vendor_id=123456789ab \
-machine pc-q35-2.10 \
-boot order=c\
-smp 4,cores=2 \
-vcpu vcpunum=0,affinity=1 -vcpu vcpunum=1,affinity=5\
-vcpu vcpunum=2,affinity=2 -vcpu vcpunum=3,affinity=6\
-drive if=pflash,format=raw,readonly,file=OVMF_CODE-pure-efi.fd \
-drive if=pflash,format=raw,file=OVMF_VARS-pure-efi-1024x768.fd \
-device vfio-pci,host=01:00.0,bus=pcie.0,multifunction=on \
-device vfio-pci,host=01:00.1,bus=pcie.0 \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e\
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0\
-device vfio-pci,host=00:14.0,id=hostdev0,bus=pci.2,addr=0x3\
-usb -device usb-kbd -device usb-tablet \
-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \
-smbios type=2 \
-device ide-drive,bus=ide.2,drive=MacHDD \
-drive id=MacHDD,if=none,file=./hdd.img,format=qcow2 \
-device ide-drive,bus=ide.1,drive=Clover \
-drive id=Clover,if=none,snapshot=on,format=qcow2,file=./'Clover.qcow2' \
-netdev bridge,id=net0,br=br_vms,"helper=/usr/lib/qemu/qemu-bridge-helper"\
-device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \
-monitor stdio
virsh nodedev-reattach pci_0000_00_14_0
#-rtc clock=host,base=utc,driftfix=none\
#-usb \
#-device usb-host,bus=usb-bus.0,vendorid=0x2516,productid=0x001a\
#-device usb-host,bus=usb-bus.0,vendorid=0x046d,productid=0xc24a\
#-device usb-ehci,id=ehci\
#-device usb-host,bus=ehci.0,vendorid=0x194f,productid=0x0101\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment