0865.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Passing a Physical GPU to a MacOS Proxmox VM with PCI Passthrough</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="Proxmox How To,GPU Passthrough,Graphics Card,GPU Pass Through,Proxmox VE,Proxmox Video Card Passthrough,Home Lab,Home Lab Ideas,Debian,GPU,Hypervisor,Linux,PCI,PCIe,Passthrough,Proxmox,Proxmox Add Physical GPU,Proxmox Add Physical Graphics Card,Proxmox Step By Step,Proxmox Tutorial,VM,Virtual Machine,MacOS,Mac OS,IOMMU,VFIO,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Passing a Physical GPU to a MacOS Proxmox VM with PCI Passthrough">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="12/22/2022 07:06:27 AM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>Passing a Physical GPU to a MacOS Proxmox VM with PCI Passthrough</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>Things You Will Need</h2>
  26. <ul>
  27. <li class="noCheckbox">A MacOS Proxmox VM <a href="https://www.youtube.com/@i12bretro/search?query=macos%20proxmox" target="_blank">Catalina | Big Sur | Monterey | Ventura</a></li>
  28. <li class="noCheckbox">A supported GPU for the target version of Mac OS<br />
  29. Use the charts at <a href="https://dortania.github.io/OpenCore-Install-Guide/macos-limits.html#gpu-support" target="_blank">https://dortania.github.io/OpenCore-Install-Guide/macos-limits.html#gpu-support</a> to determine GPU support</li>
  30. </ul>
  31. <h2>Enabling PCI Passthrough</h2>
  32. <ol>
  33. <li>Log into Proxmox VE either via SSH or the web based shell</li>
  34. <li>Run the following commands
  35. <div class="codeBlock"># edit grub configuration to enable IOMMU<br />
  36. nano /etc/default/grub</div>
  37. </li>
  38. <li>Press CTRL+W and search for GRUB_CMDLINE_LINUX_DEFAULT=</li>
  39. <li>Add the following value to GRUB_CMDLINE_LINUX_DEFAULT
  40. <ol start="1" style="list-style-type: lower-alpha;">
  41. <li>If running an Intel CPU, intel_iommu=on
  42. <p>GRUB_CMDLINE_LINUX_DEFAULT=&quot;quiet intel_iommu=on&quot;</p>
  43. </li>
  44. <li>If running an AMD CPU, amd_iommu=on
  45. <p>GRUB_CMDLINE_LINUX_DEFAULT=&quot;quiet amd_iommu=on&quot;</p>
  46. </li>
  47. </ol>
  48. </li>
  49. <li>Press CTRL+O, Enter, CTRL+X to write the changes</li>
  50. <li>Continue with the following commands
  51. <div class="codeBlock"># update grub with config change<br />
  52. update-grub<br />
  53. # add vfio modules<br />
  54. nano /etc/modules</div>
  55. </li>
  56. <li>Add the following to the bottom of the file
  57. <p>vfio<br />
  58. vfio_iommu_type1<br />
  59. vfio_pci<br />
  60. vfio_virqfd</p>
  61. </li>
  62. <li>Press CTRL+O, Enter, CTRL+X to write the changes</li>
  63. <li>Continue with the following commands
  64. <div class="codeBlock"># IOMMU interrupt mapping<br />
  65. echo &quot;options vfio_iommu_type1 allow_unsafe_interrupts=1&quot; &gt; /etc/modprobe.d/iommu_unsafe_interrupts.conf<br />
  66. echo &quot;options kvm ignore_msrs=1&quot; &gt; /etc/modprobe.d/kvm.conf<br />
  67. # blacklist drivers<br />
  68. echo &quot;blacklist radeon&quot; &gt;&gt; /etc/modprobe.d/blacklist.conf<br />
  69. echo &quot;blacklist nouveau&quot; &gt;&gt; /etc/modprobe.d/blacklist.conf<br />
  70. echo &quot;blacklist nvidia&quot; &gt;&gt; /etc/modprobe.d/blacklist.conf<br />
  71. # list pci devices<br />
  72. lspci -v</div>
  73. </li>
  74. <li>Scroll through the output and find the GPU (usually a video and audio device associated with it) and make note of the device identifier (ex 01:00.0, 01:00.1)</li>
  75. <li>Continue with the following commands
  76. <div class="codeBlock"># output the vendor ID(s) of the devices<br />
  77. # replace the device identifier (01:00) as needed<br />
  78. lspci -n -s 01:00</div>
  79. </li>
  80. <li>Make note of the vendor ID(s) output in the format abcd:1234</li>
  81. <li>Continue with the following commands
  82. <div class="codeBlock"># replace the vendor ids from the output of the previous step as needed<br />
  83. echo &quot;options vfio-pci ids=1002:679a,1002:aaa0 disable_vga=1&quot; &gt; /etc/modprobe.d/vfio.conf<br />
  84. # update initramfs<br />
  85. update-initramfs -u<br />
  86. # reboot proxmox host<br />
  87. reboot now</div>
  88. </li>
  89. <li>After the system reboot, log back in and run the following command to verify the GPU is now using the vfio-pci driver
  90. <div class="codeBlock"># replace the device identifier (01:00) as needed<br />
  91. lspci -knn -s 01:00</div>
  92. </li>
  93. </ol>
  94. <h2>Passing GPU to a MacOS VM</h2>
  95. <ol>
  96. <li>Log into the Proxmox web UI</li>
  97. <li>Expand the target node and select the target MacOS VM from the left navigation menu</li>
  98. <li>Select Hardware from the left sub-navigation menu</li>
  99. <li>Click Add &gt; PCI Device</li>
  100. <li>Select the GPU from the listing<br />
  101. <span style="font-size:14px;"><em>NOTE: I have found that there is some trial and error required to get the GPU to work properly depending on the guest operating system. If you find that the GPU isn&#39;t working with all options checked, stop the VM, and edit the PCI hardware, unchecking one option at a time to see if you can find a working combination</em></span></li>
  102. <li>Select Display &gt; Set the dropdown to none (none) &gt; Click OK</li>
  103. <li>If you intend to use the VM at the console (not via RDP or VNC), you will need to passthrough a USB keyboard and mouse by clicking Add &gt; USB Device &gt; Select the USB device(s) or port(s) to pass to the VM</li>
  104. <li>Click Start at the top right of the page</li>
  105. <li>Watch the output of the GPU on an external display<br />
  106. <span style="font-size:14px;"><em>If there is no output from the GPU, stop the VM and adjust the PCI hardware options as noted above</em></span></li>
  107. </ol>
  108. <p>Documentation: <a href="https://pve.proxmox.com/wiki/Pci_passthrough" target="_blank">https://pve.proxmox.com/wiki/Pci_passthrough</a></p> </div>
  109. </div>
  110. </body>
  111. </html>