diff --git a/.gitignore b/.gitignore index 37f130d..27d2581 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ mac_hdd_ng.img *.smd *.dmg OVMF_VARS-1024x768.fd +OVMF_VARS*.fd +OpenCore-Catalina/EFI/OC/Resources/ diff --git a/OpenCore-Catalina/OpenCore-Passthrough.qcow2 b/OpenCore-Catalina/OpenCore-Passthrough.qcow2 deleted file mode 100644 index 079c71f..0000000 Binary files a/OpenCore-Catalina/OpenCore-Passthrough.qcow2 and /dev/null differ diff --git a/OpenCore-Catalina/OpenCore-nopicker.qcow2 b/OpenCore-Catalina/OpenCore-nopicker.qcow2 index fa8ed06..ae988ee 100644 Binary files a/OpenCore-Catalina/OpenCore-nopicker.qcow2 and b/OpenCore-Catalina/OpenCore-nopicker.qcow2 differ diff --git a/OpenCore-Catalina/OpenCore.qcow2 b/OpenCore-Catalina/OpenCore.qcow2 index b2adc1d..2465522 100644 Binary files a/OpenCore-Catalina/OpenCore.qcow2 and b/OpenCore-Catalina/OpenCore.qcow2 differ diff --git a/OpenCore-Catalina/config-nopicker.plist b/OpenCore-Catalina/config-nopicker.plist index de7edff..c39e8bb 100644 --- a/OpenCore-Catalina/config-nopicker.plist +++ b/OpenCore-Catalina/config-nopicker.plist @@ -442,7 +442,7 @@ /////wAAAP///wA= MaxKernel - 20.99.99 + 20.3.99 MinKernel 17.0.0 Replace @@ -455,6 +455,43 @@ Skip 0 + + Arch + Any + Base + + Comment + algrey - thenickdude - cpuid_set_cpufamily - force CPUFAMILY_INTEL_PENRYN (Big Sur 11.3 and newer) + Count + 1 + Enabled + + Find + + MdKzAYA9AAAAAAZ1 + + Identifier + kernel + Limit + 0 + Mask + + ////////AAAAAP// + + MaxKernel + 20.99.99 + MinKernel + 20.4.0 + Replace + + urxP6nizAJCQkJDr + + ReplaceMask + + + Skip + 0 + Quirks diff --git a/OpenCore-Catalina/config-pt.plist b/OpenCore-Catalina/config-pt.plist deleted file mode 100644 index 984ea73..0000000 --- a/OpenCore-Catalina/config-pt.plist +++ /dev/null @@ -1,886 +0,0 @@ - - - - - ACPI - - Add - - - Comment - add DTGP method - Enabled - - Path - SSDT-DTGP.aml - - - Comment - Fake EC and USBX Power - Enabled - - Path - SSDT-EC.aml - - - Comment - USB 2.0 Injection - Enabled - - Path - SSDT-EHCI.aml - - - Comment - CPU AGPM Plugin=1 - Enabled - - Path - SSDT-PLUG.aml - - - Delete - - - All - - Comment - Delete CpuPm - Enabled - - OemTableId - Q3B1UG0AAAA= - TableLength - 0 - TableSignature - U1NEVA== - - - All - - Comment - Delete Cpu0Ist - Enabled - - OemTableId - Q3B1MElzdAA= - TableLength - 0 - TableSignature - U1NEVA== - - - Patch - - - Comment - _Q11 to XQ11 - Count - 1 - Enabled - - Find - X1ExMQ== - Limit - 0 - Mask - - OemTableId - - Replace - WFExMQ== - ReplaceMask - - Skip - 0 - TableLength - 0 - TableSignature - - - - Comment - _Q12 to XQ12 - Count - 1 - Enabled - - Find - X1ExMg== - Limit - 0 - Mask - - OemTableId - - Replace - WFExMg== - ReplaceMask - - Skip - 0 - TableLength - 0 - TableSignature - - - - Quirks - - FadtEnableReset - - NormalizeHeaders - - RebaseRegions - - ResetHwSig - - ResetLogoStatus - - - - Booter - - MmioWhitelist - - Quirks - - AvoidRuntimeDefrag - - DevirtualiseMmio - - DisableSingleUser - - DisableVariableWrite - - DiscardHibernateMap - - EnableSafeModeSlide - - EnableWriteUnprotector - - ForceExitBootServices - - ProtectMemoryRegions - - ProtectSecureBoot - - ProtectUefiServices - - ProvideCustomSlide - - ProvideMaxSlide - 0 - RebuildAppleMemoryMap - - SetupVirtualMap - - SignalAppleOS - - SyncRuntimePermissions - - - - DeviceProperties - - Add - - PciRoot(0x1)/Pci(0x1F,0x0) - - compatible - pci8086,2916 - device-id - - FikA - - name - pci8086,2916 - - - Delete - - PciRoot(0x0)/Pci(0x1b,0x0) - - MaximumBootBeepVolume - - - - Kernel - - Add - - - BundlePath - mXHCD.kext - Comment - Hello There - Enabled - - ExecutablePath - Contents/MacOS/mXHCD - MaxKernel - - MinKernel - - PlistPath - Contents/Info.plist - - - BundlePath - Lilu.kext - Comment - Patch engine - Enabled - - ExecutablePath - Contents/MacOS/Lilu - MaxKernel - - MinKernel - - PlistPath - Contents/Info.plist - - - BundlePath - VirtualSMC.kext - Comment - SMC emulator - Enabled - - ExecutablePath - Contents/MacOS/VirtualSMC - MaxKernel - - MinKernel - - PlistPath - Contents/Info.plist - - - BundlePath - WhateverGreen.kext - Comment - Video patches - Enabled - - ExecutablePath - Contents/MacOS/WhateverGreen - MaxKernel - - MinKernel - - PlistPath - Contents/Info.plist - - - BundlePath - AppleALC.kext - Comment - Audio patches - Enabled - - ExecutablePath - Contents/MacOS/AppleALC - MaxKernel - - MinKernel - - PlistPath - Contents/Info.plist - - - BundlePath - AGPMInjector.kext - Comment - - Enabled - - ExecutablePath - - MaxKernel - - MinKernel - - PlistPath - Contents/Info.plist - - - BundlePath - USBPorts.kext - Comment - - Enabled - - ExecutablePath - - MaxKernel - - MinKernel - - PlistPath - Contents/Info.plist - - - BundlePath - MCEReporterDisabler.kext - Comment - - Enabled - - ExecutablePath - - MaxKernel - - MinKernel - - PlistPath - Contents/Info.plist - - - Block - - - Comment - - Enabled - - Identifier - com.apple.driver.AppleTyMCEDriver - MaxKernel - - MinKernel - - - - Emulate - - Cpuid1Data - VwYFAAAAAAAAAAAAAAAAAA== - Cpuid1Mask - /////wAAAAAAAAAAAAAAAA== - - Patch - - - Base - - Comment - algrey - cpuid_set_generic_info - disable check to allow leaf7 - Count - 1 - Enabled - - Find - ADoPgg== - Identifier - kernel - Limit - 0 - Mask - - MaxKernel - 19.99.99 - MinKernel - 17.0.0 - Replace - AAAPgg== - ReplaceMask - - Skip - 0 - - - Base - _cpu_topology_sort - Comment - algrey - cpu_topology_sort -disable _x86_validate_topology - Count - 1 - Enabled - - Find - 6AAA//8= - Identifier - kernel - Limit - 0 - Mask - /wAA//8= - MaxKernel - 19.99.99 - MinKernel - 17.0.0 - Replace - Dx9EAAA= - ReplaceMask - - Skip - 0 - - - Base - - Comment - algrey - cpuid_set_cpufamily - force CPUFAMILY_INTEL_PENRYN - Count - 1 - Enabled - - Find - MduAPQAAAAAGdQA= - Identifier - kernel - Limit - 0 - Mask - /////wAAAP///wA= - MaxKernel - 19.99.99 - MinKernel - 17.0.0 - Replace - u7xP6njpXQAAAJA= - ReplaceMask - - Skip - 0 - - - Base - - Comment - algrey - - skip cpuid_cores_per_package test -10.15 - Count - 0 - Enabled - - Find - gz0AAAAAAA8AAAAAAItdvA== - Identifier - kernel - Limit - 0 - Mask - //8AAAD///8AAAAA/////w== - MaxKernel - 19.99.99 - MinKernel - 19.0.0 - Replace - AAAAAAAAAQAAAAAAAAAAAA== - ReplaceMask - AAAAAAAADwAAAAAAAAAAAA== - Skip - 0 - - - Base - - Comment - algrey - - skip cpuid_cores_per_package test - Count - 0 - Enabled - - Find - gz0AAAAAAHQAi128 - Identifier - kernel - Limit - 0 - Mask - //8AAAD///8A//// - MaxKernel - 18.99.99 - MinKernel - 17.0.0 - Replace - AAAAAAAAAQAAAAAA - ReplaceMask - AAAAAAAADwAAAAAA - Skip - 0 - - - Quirks - - AppleCpuPmCfgLock - - AppleXcpmCfgLock - - AppleXcpmExtraMsrs - - AppleXcpmForceBoost - - CustomSMBIOSGuid - - DisableIoMapper - - DisableRtcChecksum - - DummyPowerManagement - - ExternalDiskIcons - - IncreasePciBarSize - - LapicKernelPanic - - PanicNoKextDump - - PowerTimeoutKernelPanic - - ThirdPartyDrives - - XhciPortLimit - - - - Misc - - BlessOverride - - Boot - - ConsoleAttributes - 0 - HibernateMode - Auto - HideAuxiliary - - PickerAttributes - 1 - PickerAudioAssist - - PickerMode - External - PollAppleHotKeys - - ShowPicker - - TakeoffDelay - 0 - Timeout - 0 - - Debug - - AppleDebug - - ApplePanic - - DisableWatchDog - - DisplayDelay - 0 - DisplayLevel - 2147483650 - SysReport - - Target - 3 - - Entries - - Security - - AllowNvramReset - - AllowSetDefault - - AuthRestart - - BootProtect - None - ExposeSensitiveData - 6 - HaltLevel - 2147483648 - ScanPolicy - 0 - Vault - Optional - - Tools - - - Arguments - - Auxiliary - - Comment - Not signed for security reasons - Enabled - - Name - UEFI Shell - Path - OpenShell.efi - - - Arguments - Shutdown - Auxiliary - - Comment - Perform shutdown - Enabled - - Name - Shutdown - Path - ResetSystem.efi - - - - NVRAM - - Add - - 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14 - - DefaultBackgroundColor - AAAAAA== - UIScale - AQ== - - 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102 - - rtc-blacklist - - - 7C436110-AB2A-4BBB-A880-FE41995C9F82 - - SystemAudioVolume - Rg== - boot-args - -v keepsyms=1 - run-efi-updater - No - csr-active-config - AAAAAA== - prev-lang:kbd - ZW4tVVM6MA== - - - Delete - - 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14 - - UIScale - DefaultBackgroundColor - - 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102 - - rtc-blacklist - - 7C436110-AB2A-4BBB-A880-FE41995C9F82 - - boot-args - - - LegacyEnable - - LegacyOverwrite - - LegacySchema - - 7C436110-AB2A-4BBB-A880-FE41995C9F82 - - EFILoginHiDPI - EFIBluetoothDelay - LocationServicesEnabled - SystemAudioVolume - SystemAudioVolumeDB - SystemAudioVolumeSaved - bluetoothActiveControllerInfo - bluetoothInternalControllerInfo - flagstate - fmm-computer-name - nvda_drv - prev-lang:kbd - - 8BE4DF61-93CA-11D2-AA0D-00E098032B8C - - Boot0080 - Boot0081 - Boot0082 - BootNext - BootOrder - - - WriteFlash - - - PlatformInfo - - Automatic - - Generic - - AdviseWindows - - MLB - C02717306J9JG361M - ROM - - m7zhIYfl - - SpoofVendor - - SystemProductName - iMacPro1,1 - SystemSerialNumber - C02TM2ZBHX87 - SystemUUID - 007076A6-F2A2-4461-BBE5-BAD019F8025A - - UpdateDataHub - - UpdateNVRAM - - UpdateSMBIOS - - UpdateSMBIOSMode - Create - - UEFI - - APFS - - EnableJumpstart - - GlobalConnect - - HideVerbose - - JumpstartHotPlug - - MinDate - -1 - MinVersion - -1 - - Audio - - AudioCodec - 0 - AudioDevice - PciRoot(0x1)/Pci(0x1,0x0)/Pci(0x0,0x1) - AudioOut - 0 - AudioSupport - - MinimumVolume - 20 - PlayChime - - VolumeAmplifier - 0 - - ConnectDrivers - - Drivers - - OpenRuntime.efi - VBoxHfs.efi - OpenCanopy.efi - - Input - - KeyFiltering - - KeyForgetThreshold - 5 - KeyMergeThreshold - 2 - KeySupport - - KeySupportMode - Auto - KeySwap - - PointerSupport - - PointerSupportMode - ASUS - TimerResolution - 50000 - - Output - - ClearScreenOnModeSwitch - - ConsoleMode - - DirectGopRendering - - IgnoreTextInGraphics - - ProvideConsoleGop - - ReconnectOnResChange - - ReplaceTabWithSpace - - Resolution - 1920x1080@32 - SanitiseClearScreen - - TextRenderer - BuiltinGraphics - - ProtocolOverrides - - AppleAudio - - AppleBootPolicy - - AppleDebugLog - - AppleEvent - - AppleImageConversion - - AppleKeyMap - - AppleRtcRam - - AppleSmcIo - - AppleUserInterfaceTheme - - DataHub - - DeviceProperties - - FirmwareVolume - - HashServices - - OSInfo - - UnicodeCollation - - - Quirks - - DeduplicateBootOrder - - ExitBootServicesDelay - 0 - IgnoreInvalidFlexRatio - - ReleaseUsbOwnership - - RequestBootVarRouting - - TscSyncTimeout - 0 - UnblockFsConnect - - - - - diff --git a/OpenCore-Catalina/config.plist b/OpenCore-Catalina/config.plist index 08210ae..1473446 100644 --- a/OpenCore-Catalina/config.plist +++ b/OpenCore-Catalina/config.plist @@ -442,7 +442,7 @@ /////wAAAP///wA= MaxKernel - 20.99.99 + 20.3.99 MinKernel 17.0.0 Replace @@ -455,6 +455,43 @@ Skip 0 + + Arch + Any + Base + + Comment + algrey - thenickdude - cpuid_set_cpufamily - force CPUFAMILY_INTEL_PENRYN (Big Sur 11.3 and newer) + Count + 1 + Enabled + + Find + + MdKzAYA9AAAAAAZ1 + + Identifier + kernel + Limit + 0 + Mask + + ////////AAAAAP// + + MaxKernel + 20.99.99 + MinKernel + 20.4.0 + Replace + + urxP6nizAJCQkJDr + + ReplaceMask + + + Skip + 0 + Quirks diff --git a/README.md b/README.md index 0d1ccf4..dee4d6f 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,12 @@ Phenom II X3 720 does not. Ryzen processors work just fine. This step may need to be adapted for your Linux distribution. +* Add user to the `kvm` group (might be needed). + + ``` + sudo usermod -aG kvm $(whoami) + ``` + * Clone this repository on your QEMU system. Files from this repository are used in the following steps. @@ -211,13 +217,15 @@ work, patience, and a bit of luck (perhaps?). This has been enough for me so far. - Note: You may need to [enable the `rc.local` functionality manually on modern Ubuntu versions](https://linuxmedium.com/how-to-enable-etc-rc-local-with-systemd-on-ubuntu-20-04/). + Note: You may need to enable the `rc.local` functionality manually on modern + Ubuntu versions. Check out the [notes](notes.md) included in this repository + for details. * To passthrough GPUs and other devices, see [these notes](notes.md). * Need a different resolution? Check out the [notes](notes.md) included in this repository. -* To generate your own SMBIOS, use [GenSMBIOS](https://github.com/corpnewt/GenSMBIOS). +* Trouble with iMessage? Check out the [notes](notes.md) included in this repository. ### Is This Legal? diff --git a/boot-passthrough.sh b/boot-passthrough.sh index 7367974..1714f7b 100755 --- a/boot-passthrough.sh +++ b/boot-passthrough.sh @@ -23,7 +23,7 @@ CPU_SOCKETS="1" CPU_CORES="2" CPU_THREADS="4" -REPO_PATH="./" +REPO_PATH="." OVMF_DIR="." # Note: This script assumes that you are doing CPU + GPU passthrough. This @@ -35,23 +35,29 @@ OVMF_DIR="." # shellcheck disable=SC2054 args=( - -enable-kvm -m "$ALLOCATED_RAM" -cpu host,vendor=GenuineIntel,kvm=on,vmware-cpuid-freq=on,+invtsc,+hypervisor - -machine pc-q35-2.9 - -smp "$CPU_THREADS",cores="$CPU_CORES",sockets="$CPU_SOCKETS" - -vga none - -device pcie-root-port,bus=pcie.0,multifunction=on,port=1,chassis=1,id=port.1 - -device vfio-pci,host=01:00.0,bus=port.1,multifunction=on - -device vfio-pci,host=01:00.1,bus=port.1 + -enable-kvm -m "$ALLOCATED_RAM" -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,"$MY_OPTIONS" + -machine q35 -usb -device usb-kbd -device usb-tablet + -smp "$CPU_THREADS",cores="$CPU_CORES",sockets="$CPU_SOCKETS" + -device usb-ehci,id=ehci + -vga none + -device vfio-pci,host=01:00.0,multifunction=on + -device vfio-pci,host=01:00.1 -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" -drive if=pflash,format=raw,readonly,file="$REPO_PATH/$OVMF_DIR/OVMF_CODE.fd" -drive if=pflash,format=raw,file="$REPO_PATH/$OVMF_DIR/OVMF_VARS-1024x768.fd" -smbios type=2 - -drive id=MacHDD,if=none,file=./mac_hdd_ng.img - -device ide-drive,bus=sata.2,drive=MacHDD - -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore-Catalina/OpenCore-Passthrough.qcow2" - -device ide-hd,bus=sata.3,drive=OpenCoreBoot - -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27 + -device ich9-intel-hda -device hda-duplex + -device ich9-ahci,id=sata + -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore-Catalina/OpenCore-nopicker.qcow2" + # -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore-Catalina/OpenCore.qcow2" + -device ide-hd,bus=sata.2,drive=OpenCoreBoot + -device ide-hd,bus=sata.3,drive=InstallMedia + -drive id=InstallMedia,if=none,file="$REPO_PATH/BaseSystem.img",format=raw + -drive id=MacHDD,if=none,file="$REPO_PATH/mac_hdd_ng.img",format=qcow2 + -device ide-hd,bus=sata.4,drive=MacHDD + # -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27 + -netdev user,id=net0 -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27 -monitor stdio -display none ) diff --git a/notes.md b/notes.md index c1d8d5e..b8de5e6 100644 --- a/notes.md +++ b/notes.md @@ -48,89 +48,126 @@ option easily. ### GPU passthrough notes These steps will need to be adapted for your particular setup. A host machine -with IOMMU support is required. Consult the Arch Wiki article linked to at the -bottom of this file for exact requirements and other details. +with IOMMU support is required. Consult [this Arch Wiki article](https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF) +for general-purpose guidance and details. -I am running Ubuntu 17.04 on Intel i5-6500 + ASUS Z170-AR motherboard + NVIDIA -1050 Ti. +I am running Ubuntu 20.04.2 LTS on Intel i5-6500 + ASUS Z170-AR motherboard + +AMD RX 570 GPU (May 2021). -Tip: Use https://github.com/Benjamin-Dobell/nvidia-update to install nVidia -drivers on macOS. - -* Enable IOMMU support on the host machine. - - Append the given line to `GRUB_CMDLINE_LINUX_DEFAULT` in `/etc/default/grub`. - - ##### Intel Systems - - `iommu=pt intel_iommu=on rd.driver.pre=vfio-pci video=vesafb:off,efifb:off` - - ##### AMD Systems - - `iommu=pt amd_iommu=on rd.driver.pre=vfio-pci video=vesafb:off,efifb:off` - -* Uninstall NVIDIA drivers from the host machine and blacklist the required modules. +* Blacklist the required kernel modules. ``` $ cat /etc/modprobe.d/blacklist.conf ... + blacklist amdgpu blacklist radeon - blacklist nouveau - blacklist nvidia ``` -* Enable the required kernel modules. +* Find details of the PCIe devices to passthrough. ``` - # echo "vfio" >> /etc/modules - # echo "vfio_iommu_type1" >> /etc/modules - # echo "vfio_pci" >> /etc/modules - # echo "vfio_virqfd" >> /etc/modules + $ lspci -nnk | grep AMD + 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] [1002:67df] (rev ef) + 01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] [1002:aaf0] ``` -* Isolate the passthrough PCIe devices with vfio-pci, with the help of `lspci - -nnk` command. Adapt these commands to suit your hardware setup. +* Enable IOMMU support and configure VFIO. + + Append the given line to `GRUB_CMDLINE_LINUX_DEFAULT` in `/etc/default/grub`. + + ##### Intel CPU Systems + + `iommu=pt intel_iommu=on vfio-pci.ids=1002:67df,1002:aaf0 kvm.ignore_msrs=1 video=vesafb:off,efifb:off` + + ##### AMD CPU Systems + + `iommu=pt amd_iommu=on ` + +* Tweak module configuration a bit according to the following output (thanks to Mathias Hueber). ``` - $ lspci -nn - ... - 01:00.0 ... NVIDIA Corporation [GeForce GTX 1050 Ti] [10de:1c82] - 01:00.1 Audio device: NVIDIA Corporation Device [10de:0fb9] - 03:00.0 USB controller: ASMedia ASM1142 USB 3.1 Host Controller [1b21:1242] + $ cat /etc/modprobe.d/vfio.conf + options vfio-pci ids=1002:67df,1002:aaf0 disable_vga=1 + softdep radeon pre: vfio-pci + softdep amdgpu pre: vfio-pci + softdep nouveau pre: vfio-pci + softdep drm pre: vfio-pci ``` - ``` - # echo "options vfio-pci ids=10de:1c82,10de:0fb9 disable_vga=1" > /etc/modprobe.d/vfio.conf - ``` - -* Update initramfs, GRUB and then reboot. +* Update GRUB, initramfs, and then reboot. ``` $ sudo update-grub2 $ sudo update-initramfs -k all -u ``` -* Verify that the IOMMU is enabled, and vfio_pci is working as expected. - Consult Arch Wiki again for help on this. (Often running `lspci -vvv` and - verifying that the expected devices are using `vfio-pci` as their `Kernel driver in use` is sufficient) +* In the BIOS setup, set the `Primary Display` to `IGFX` (onboard graphics). -* On the macOS VM, install a NVIDIA Web Driver version which is appropriate for - the macOS version. Consult http://www.macvidcards.com/drivers.html for more - information. +* Verify that the IOMMU is enabled, and `vfio-pci` is working as expected. + Verify that the expected devices are using `vfio-pci` as their kernel driver - For example, macOS 10.12.5 requires version `378.05.05.15f01` whereas macOS - 10.12.6 requires version `378.05.05.25f01`. + ``` + $ dmesg | grep -i iommu + [ 0.076879] DMAR: IOMMU enabled + [ 0.183732] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1 + [ 0.330654] iommu: Default domain type: Passthrough (set via kernel command line) + [ 0.489615] pci 0000:00:00.0: Adding to iommu group 0 + [ 0.489627] pci 0000:00:01.0: Adding to iommu group 1 + [ 0.489634] pci 0000:00:02.0: Adding to iommu group 2 + [ 0.489643] pci 0000:00:14.0: Adding to iommu group 3 + ``` -* Updating SMBIOS for the macOS to `iMac14,2` might be required. I did not do - so myself. + ``` + $ dmesg | grep vfio + [ 0.526198] vfio-pci 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=io+mem + [ 0.543768] vfio_pci: add [1002:67df[ffffffff:ffffffff]] class 0x000000/00000000 + [ 0.563765] vfio_pci: add [1002:aaf0[ffffffff:ffffffff]] class 0x000000/00000000 + [ 3.384597] vfio-pci 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=io+mem + ``` + + ``` + $ lspci -nkk -d 1002:67df + 01:00.0 0300: 1002:67df (rev ef) + Subsystem: 1da2:e366 + Kernel driver in use: vfio-pci + Kernel modules: amdgpu + ``` + + ``` + $ ./scripts/list_iommu_groups.sh + IOMMU Group 0: + 00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers [8086:191f] (rev 07) + IOMMU Group 1: + 00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) [8086:1901] (rev 07) + 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] [1002:67df] (rev ff) + 01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] [1002:aaf0] (rev ff) + ``` + +* Fix permisions for the `/dev/vfio/1` device (modify as needed): + + ``` + sudo cp vfio-kvm.rules /etc/udev/rules.d/vfio-kvm.rules + + sudo udevadm control --reload + sudo udevadm trigger + ``` + +* Open `/etc/security/limits.conf` file and add the following lines: + + ``` + @kvm soft memlock unlimited + @kvm hard memlock unlimited + ``` + + Thanks to `Heiko Sieger` for this solution. + +* Confirm the contents of `boot-passthrough.sh` and run it to boot macOS with + GPU passthrough. * To reuse the keyboard and mouse devices from the host, setup "Automatic login" in System Preferences in macOS and configure Synergy software. -Note: Many AMD GPU devices (e.g. AMD RX 480 & RX 580) should be natively -supported in macOS High Sierra. - ### USB passthrough notes @@ -140,14 +177,13 @@ These steps will need to be adapted for your particular setup. -nnk` command. ``` - $ lspci -nn + $ lspci -nnk ... - 01:00.0 ... NVIDIA Corporation [GeForce GTX 1050 Ti] [10de:1c82] - 01:00.1 Audio device: NVIDIA Corporation Device [10de:0fb9] 03:00.0 USB controller: ASMedia ASM1142 USB 3.1 Host Controller [1b21:1242] ``` - Add `1b21:1242` to `/etc/modprobe.d/vfio.conf` file in the required format. + Add `1b21:1242` to `GRUB_CMDLINE_LINUX_DEFAULT` in `/etc/default/grub` file + in the required format. See `GPU passthrough notes` (above) for details. * Update initramfs, and then reboot. @@ -195,18 +231,6 @@ These steps will need to be adapted for your particular setup. * The included `.synergy.conf` will need to be adapted according to your setup. -### Accelerated Graphics - -See `UEFI/README.md` for GPU passthrough notes. - -Note: There is no working QXL driver for macOS so far. - -Links: - -- https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/ -- https://www.kraxel.org/blog/2019/06/macos-qemu-guest/ - - ### Virtual Sound Device *Warning: The OpenCore distribution that comes with OSX-KVM already has @@ -596,3 +620,54 @@ The `-smp line` should read something like the following: ``` -smp "$CPU_TOTAL",cores="$CPU_CORES",sockets="$CPU_SOCKETS",threads="$CPU_THREADS",maxcpus="$CPU_TOTAL" ``` + + +### Trouble with iMessage? + +Check out [this Dortania article on this topic](https://dortania.github.io/OpenCore-Post-Install/universal/iservices.html#using-gensmbios). + + +### Enable rc.local functionality on moden Ubuntu versions + +Create `/etc/rc.local` file with the following content, if it doesn't exist: + +``` +#!/bin/bash + +echo "Hello! :)" + +exit 0 +``` + +Make this file executable, if required: + +``` +sudo chmod +x /etc/rc.local +``` + +Create `/etc/systemd/system/rc-local.service` with the following content, if +it doesn't exist: + +``` +[Unit] +Description=enable /etc/rc.local +ConditionPathExists=/etc/rc.local + +[Service] +ExecStart=/etc/rc.local start +TimeoutSec=0 +StandardOutput=tty +RemainAfterExit=yes +SysVStartPriority=99 + +[Install] +WantedBy=multi-user.target +``` + +Enable `rc.local` systemd service: + +``` +sudo systemctl enable rc-local +``` + +These notes are borrowed from various multiple internet resources. diff --git a/scripts/list_iommu_groups.sh b/scripts/list_iommu_groups.sh new file mode 100755 index 0000000..abd8a4f --- /dev/null +++ b/scripts/list_iommu_groups.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Source: https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF + +shopt -s nullglob +for g in `find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V`; do + echo "IOMMU Group ${g##*/}:" + for d in $g/devices/*; do + echo -e "\t$(lspci -nns ${d##*/})" + done; +done; diff --git a/vfio-kvm.rules b/vfio-kvm.rules new file mode 100644 index 0000000..c7cbb29 --- /dev/null +++ b/vfio-kvm.rules @@ -0,0 +1 @@ +SUBSYSTEM=="vfio", OWNER="root", GROUP="kvm"