Kvm Qemu MacOsX

Hello Great community,

i know there isnt' a support for this kind of issue, but i will make i try.

I need a virtual machine with macosx cuz some files i need for work, unfortunally is on software i had use on mac os x, so for avoid any problem i had decide to install a kvm.

I had use this guide Don't Dual Boot, Do this instead | MacOS Big Sur and Windows 10 KVM SINGLE GPU OVMF Passthrough - YouTube because i need a gpu Passthrough (i have some video editing to do). It works, but when i shutdown the vm the screen turns black and i must reboot manually.

This is my configuration file:

<domain xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="kvm">
  <name>macOS</name>
  <uuid>2aca0dd6-cec9-4717-9ab2-0b7b13d111c3</uuid>
  <title>macOS</title>
  <memory unit="KiB">16384000</memory>
  <currentMemory unit="KiB">16384000</currentMemory>
  <vcpu placement="static">8</vcpu>
  <os>
    <type arch="x86_64" machine="pc-q35-4.2">hvm</type>
    <loader readonly="yes" type="pflash">/home/simone/BigDoge/OVMF_CODE.fd</loader>
    <nvram>/home/simone/BigDoge/OVMF_VARS-1024x768.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode="custom" match="exact" check="none">
    <model fallback="forbid">qemu64</model>
    <topology sockets="1" dies="1" cores="2" threads="4"/>
  </cpu>
  <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2" cache="writeback" io="threads"/>
      <source file="/home/simone/BigDoge/OpenCore/OpenCore.qcow2"/>
      <target dev="sda" bus="sata"/>
      <boot order="2"/>
      <address type="drive" controller="0" bus="0" target="0" unit="0"/>
    </disk>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2" cache="writeback" io="threads"/>
      <source file="/home/simone/BigDoge/mac_hdd_ng.img"/>
      <target dev="sdb" bus="sata"/>
      <boot order="1"/>
      <address type="drive" controller="0" bus="0" target="0" unit="1"/>
    </disk>
    <disk type="file" device="disk">
      <driver name="qemu" type="raw" cache="writeback"/>
      <source file="/home/simone/BigDoge/BaseSystem.img"/>
      <target dev="sdc" bus="sata"/>
      <boot order="3"/>
      <address type="drive" controller="0" bus="0" target="0" unit="2"/>
    </disk>
    <controller type="sata" index="0">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/>
    </controller>
    <controller type="pci" index="0" model="pcie-root"/>
    <controller type="pci" index="1" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="1" port="0x8"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0" multifunction="on"/>
    </controller>
    <controller type="pci" index="2" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="2" port="0x9"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x1"/>
    </controller>
    <controller type="pci" index="3" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="3" port="0xa"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x2"/>
    </controller>
    <controller type="pci" index="4" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="4" port="0xb"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x3"/>
    </controller>
    <controller type="pci" index="5" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="5" port="0xc"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x4"/>
    </controller>
    <controller type="pci" index="6" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="6" port="0xd"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x5"/>
    </controller>
    <controller type="pci" index="7" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="7" port="0xe"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x6"/>
    </controller>
    <controller type="pci" index="8" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="8" port="0xf"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x7"/>
    </controller>
    <controller type="pci" index="9" model="pcie-to-pci-bridge">
      <model name="pcie-pci-bridge"/>
      <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
    </controller>
    <controller type="virtio-serial" index="0">
      <address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
    </controller>
    <controller type="usb" index="0" model="ich9-ehci1">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x7"/>
    </controller>
    <controller type="usb" index="0" model="ich9-uhci1">
      <master startport="0"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x0" multifunction="on"/>
    </controller>
    <controller type="usb" index="0" model="ich9-uhci2">
      <master startport="2"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x1"/>
    </controller>
    <controller type="usb" index="0" model="ich9-uhci3">
      <master startport="4"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x2"/>
    </controller>
    <interface type="network">
      <mac address="52:54:00:e6:85:40"/>
      <source network="default"/>
      <model type="vmxnet3"/>
      <address type="pci" domain="0x0000" bus="0x09" slot="0x02" function="0x0"/>
    </interface>
    <input type="mouse" bus="ps2"/>
    <input type="keyboard" bus="ps2"/>
    <audio id="1" type="spice"/>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x2b" slot="0x00" function="0x1"/>
      </source>
      <rom file="/var/lib/libvirt/vbios/GPU.rom"/>
      <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
    </hostdev>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x2b" slot="0x00" function="0x0"/>
      </source>
      <rom file="/var/lib/libvirt/vbios/GPU.rom"/>
      <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
    </hostdev>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x2d" slot="0x00" function="0x3"/>
      </source>
      <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
    </hostdev>
    <memballoon model="none"/>
  </devices>
  <qemu:commandline>
    <qemu:arg value="-device"/>
    <qemu:arg value="isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"/>
    <qemu:arg value="-smbios"/>
    <qemu:arg value="type=2"/>
    <qemu:arg value="-device"/>
    <qemu:arg value="usb-tablet"/>
    <qemu:arg value="-device"/>
    <qemu:arg value="usb-kbd"/>
    <qemu:arg value="-cpu"/>
    <qemu:arg value="Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check"/>
  </qemu:commandline>
</domain>

I have try to install a vender reset (GitHub - gnif/vendor-reset: Linux kernel vendor specific hardware reset module for sequences that are too complex/complicated to land in pci_quirks.c) but when i install it the virtual machines doesn't boot anymore (thanks to snapshot i can rollback).

Any tips? I have a Radeon RX 580 Sapphire pulse.

Thanks!

may wanna pop ya inxi -Faz on there too, just in case there's something someone spots :woman_shrugging:

1 Like

Sure!

System:    Kernel: 5.15.4-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen root=UUID=63cc00cb-f128-46ee-baa6-c38d21ebbfd2
rw [email protected] quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
systemd.unified_cgroup_hierarchy=1 loglevel=3 amd_iommu=on iommu=pt
Desktop: KDE Plasma 5.23.3 tk: Qt 5.15.2 info: latte-dock wm: kwin_x11 vt: 1 dm: SDDM
Distro: Garuda Linux base: Arch Linux
Machine:   Type: Desktop System: Micro-Star product: MS-7C90 v: 1.0 serial: <filter>
Mobo: Micro-Star model: MPG B550 GAMING CARBON WIFI (MS-7C90) v: 1.0 serial: <filter>
UEFI: American Megatrends LLC. v: 1.83 date: 09/24/2021
Battery:   Device-1: hidpp_battery_0 model: Logitech MX Keys Wireless Keyboard serial: <filter>
charge: 55% (should be ignored) rechargeable: yes status: Discharging
Device-2: hidpp_battery_1 model: Logitech Wireless Mouse MX Master serial: <filter>
charge: 100% (should be ignored) rechargeable: yes status: Discharging
CPU:       Info: 12-Core model: AMD Ryzen 9 5900X bits: 64 type: MT MCP arch: Zen 3 family: 19 (25)
model-id: 21 (33) stepping: 0 microcode: A201016 cache: L2: 6 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 177610
Speed: 3599 MHz min/max: 2200/3700 MHz boost: enabled Core speeds (MHz): 1: 3599 2: 3594
3: 3597 4: 3591 5: 3597 6: 3591 7: 3594 8: 3596 9: 3596 10: 3594 11: 3597 12: 3600 13: 3597
14: 3592 15: 4701 16: 3593 17: 4447 18: 3597 19: 3718 20: 3599 21: 3728 22: 3599 23: 3594
24: 3596
Vulnerabilities: Type: itlb_multihit status: Not affected
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2
mitigation: Full AMD retpoline, IBPB: conditional, IBRS_FW, STIBP: always-on, RSB filling
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Graphics:  Device-1: AMD Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] vendor: Sapphire Limited
driver: amdgpu v: kernel bus-ID: 2b:00.0 chip-ID: 1002:67df class-ID: 0300
Device-2: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo bus-ID: 3-3.1.3:5
chip-ID: 046d:0825 class-ID: 0102 serial: <filter>
Display: x11 server: X.Org 1.21.1.1 compositor: kwin_x11 driver: loaded: amdgpu,ati
unloaded: modesetting alternate: fbdev,vesa display-ID: :0 screens: 1
Screen-1: 0 s-res: 4480x1440 s-dpi: 96 s-size: 1185x381mm (46.7x15.0") s-diag: 1245mm (49")
Monitor-1: DisplayPort-1 res: 2560x1440 hz: 144 dpi: 93 size: 697x392mm (27.4x15.4")
diag: 800mm (31.5")
Monitor-2: HDMI-A-1 res: 1920x1080 hz: 60 dpi: 82 size: 598x336mm (23.5x13.2")
diag: 686mm (27")
OpenGL: renderer: AMD Radeon RX 580 Series (POLARIS10 DRM 3.42.0 5.15.4-zen1-1-zen LLVM 13.0.0)
v: 4.6 Mesa 21.2.5 direct render: Yes
Audio:     Device-1: AMD Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] vendor: Sapphire Limited
driver: snd_hda_intel v: kernel bus-ID: 2b:00.1 chip-ID: 1002:aaf0 class-ID: 0403
Device-2: AMD Starship/Matisse HD Audio vendor: Micro-Star MSI driver: snd_hda_intel v: kernel
bus-ID: 2d:00.4 chip-ID: 1022:1487 class-ID: 0403
Device-3: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo bus-ID: 3-3.1.3:5
chip-ID: 046d:0825 class-ID: 0102 serial: <filter>
Sound Server-1: ALSA v: k5.15.4-zen1-1-zen running: yes
Sound Server-2: sndio v: N/A running: no
Sound Server-3: JACK v: 1.9.19 running: no
Sound Server-4: PulseAudio v: 15.0 running: no
Sound Server-5: PipeWire v: 0.3.40 running: yes
Network:   Device-1: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel bus-ID: 29:00.0 chip-ID: 8086:2723
class-ID: 0280
IF: wlo1 state: up mac: <filter>
Device-2: Realtek RTL8125 2.5GbE vendor: Micro-Star MSI driver: r8169 v: kernel port: f000
bus-ID: 2a:00.0 chip-ID: 10ec:8125 class-ID: 0200
IF: enp42s0 state: down mac: <filter>
IF-ID-1: virbr0 state: down mac: <filter>
Drives:    Local Storage: total: 1.82 TiB used: 169.35 GiB (9.1%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital model: WDS100T1X0E-00AFY0
size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s lanes: 4 type: SSD
serial: <filter> rev: 614600WD temp: 39.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: SanDisk model: SDSSDH3 1T00 size: 931.51 GiB block-size:
physical: 512 B logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter> rev: 00RL scheme: GPT
Partition: ID-1: / raw-size: 931.26 GiB size: 931.26 GiB (100.00%) used: 169.32 GiB (18.2%) fs: btrfs
dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 260 MiB size: 256 MiB (98.46%) used: 25.4 MiB (9.9%) fs: vfat
dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 931.26 GiB size: 931.26 GiB (100.00%) used: 169.32 GiB (18.2%) fs: btrfs
dev: /dev/nvme0n1p2 maj-min: 259:2
ID-4: /var/log raw-size: 931.26 GiB size: 931.26 GiB (100.00%) used: 169.32 GiB (18.2%)
fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 931.26 GiB size: 931.26 GiB (100.00%) used: 169.32 GiB (18.2%)
fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:      Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 31.27 GiB used: 1024 KiB (0.0%) priority: 100 dev: /dev/zram0
Sensors:   Message: No sensor data found. Is lm-sensors configured?
Info:      Processes: 473 Uptime: 21m wakeups: 7 Memory: 31.27 GiB used: 4.4 GiB (14.1%) Init: systemd
v: 249 tool: systemctl Compilers: gcc: 11.1.0 clang: 13.0.0 Packages: note: see --pkg
pacman: 1403 lib: 378 Shell: fish v: 3.3.1 default: Bash v: 5.1.8 running-in: konsole
inxi: 3.3.08

Have you looked at the level1techs forums? I know Wendell's been beating his head against KVM stuff and broken through the wall a few times. I recall him mentioning a very similar issue that he'd found a workaround for, though my quick look was for multiple GPUs for multiple KVMs.
I'm a VM newb, so I don't really know what I'm looking at, let alone searching for.

1 Like

Never hear about that forum, i will give it a try! Thanks!