|
@@ -0,0 +1,166 @@
|
|
|
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
+ <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
|
|
+ <head>
|
|
|
+ <title>Passing a GPU to a Proxmox VM with PCI Passthrough</title>
|
|
|
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
+ <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
|
|
+ <script type="text/javascript">
|
|
|
+ $(function(){
|
|
|
+ $('textarea').each(function(i,e){
|
|
|
+ theTextarea = $(this);
|
|
|
+ theTextarea.height((theTextarea[0].scrollHeight-5) +'px');
|
|
|
+ });
|
|
|
+
|
|
|
+ $('li').each(function(i,e){
|
|
|
+ if(!$(this).hasClass('noCheckbox')){
|
|
|
+ var uuid = 'li_' + Math.floor(Math.random() * Math.floor(1000000)).toString() + '_' + i.toString();
|
|
|
+ $(this).contents().wrap('<span id="'+ uuid +'"><label for="cb_'+ uuid +'"></label></span>');
|
|
|
+ $(this).prepend('<input type="checkbox" class="completeBox" id="cb_' + uuid +'" rel="'+ uuid +'" />')
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('code,div.codeBlock,textarea.codeBlock').each(function(i,e){
|
|
|
+ theElement = $(this);
|
|
|
+ var lines = theElement.html().split("\n");
|
|
|
+ theElement.empty();
|
|
|
+ for(l=0;l<lines.length;l++){
|
|
|
+ if($.trim(lines[l]) != '' && $.trim(lines[l]).substr(0,1) != '#' && $.trim(lines[l]).indexOf(' #') == -1 && lines[l].substr(0, 4).toUpperCase() != 'REM '){
|
|
|
+ theElement.append('<input type="image" src="images/clipboard.png" value="" class="copy-text" rel="copy_'+ i +'_'+ l +'" data-clipboard-text="'+ $.trim(lines[l].replace(/"/g, '"')) +'" /><span id="copy_'+ i +'_'+ l +'">'+ lines[l] +'</span>');
|
|
|
+ } else {
|
|
|
+ theElement.append(lines[l]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $(document).on('click','input.copy-text',function(){
|
|
|
+ theButton = $(this);
|
|
|
+ $('input.copy-text').attr('src','images/clipboard.png');
|
|
|
+ $('span.copy-animation,span.copy-animation-ps').removeClass('copy-animation copy-animation-ps');
|
|
|
+ try {
|
|
|
+ if($('#'+ theButton.attr('rel')).parent('div').hasClass('PS')){
|
|
|
+ $('#'+ theButton.attr('rel')).addClass('copy-animation-ps');
|
|
|
+ } else if($('#'+ theButton.attr('rel')).parent('div').hasClass('CMD')){
|
|
|
+ $('#'+ theButton.attr('rel')).addClass('copy-animation-cmd');
|
|
|
+ } else {
|
|
|
+ $('#'+ theButton.attr('rel')).addClass('copy-animation');
|
|
|
+ }
|
|
|
+ navigator.clipboard.writeText(theButton.data('clipboard-text').replace(/<[^>]*>?/gm, ''));
|
|
|
+ theButton.attr('src','images/clipboard_active.png');
|
|
|
+ } catch(err) {
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
+ $(document).on('click','input.completeBox',function(){
|
|
|
+ theBox = $(this);
|
|
|
+ $('#'+ theBox.attr('rel')).addClass('strikethrough');
|
|
|
+ theBox.prop('disabled',true);
|
|
|
+ theBox.parent('li').prevAll().each(function(i,e){
|
|
|
+ theLI = $(this);
|
|
|
+ if(theLI.find('input[type=checkbox]').not(':checked')){
|
|
|
+ $('#'+ theLI.find('input[type=checkbox]').attr('rel')).addClass('strikethrough');
|
|
|
+ theLI.find('input[type=checkbox]').prop('checked',true).prop('disabled',true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ if(window.self !== window.top){
|
|
|
+ window.parent.$('iframe.stepsFrame').height((this['scrollingElement']['scrollHeight']+20) +'px');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ <link href="css/steps.css" rel="stylesheet" type="text/css" />
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div id="gridContainer">
|
|
|
+ <div class="topMargin"></div>
|
|
|
+ <div id="listName" class="topMargin">
|
|
|
+ <h1>Passing a GPU to a Proxmox VM with PCI Passthrough</h1>
|
|
|
+ </div>
|
|
|
+ <div></div>
|
|
|
+ <div id="content">
|
|
|
+ <h2>Enabling PCI Passthrough</h2>
|
|
|
+
|
|
|
+<ol>
|
|
|
+ <li>Log into ProxMox VE either via SSH or the web based shell</li>
|
|
|
+ <li>Run the following commands
|
|
|
+ <div class="codeBlock"># edit grub configuration to enable IOMMU<br />
|
|
|
+ nano /etc/default/grub</div>
|
|
|
+ </li>
|
|
|
+ <li>Press CTRL+W and search for GRUB_CMDLINE_LINUX_DEFAULT=</li>
|
|
|
+ <li>Add the following value to GRUB_CMDLINE_LINUX_DEFAULT
|
|
|
+ <ol start="1" style="list-style-type: lower-alpha;">
|
|
|
+ <li>If running an Intel CPU, intel_iommu=on
|
|
|
+ <p>GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"</p>
|
|
|
+ </li>
|
|
|
+ <li>If running an AMD CPU, amd_iommu=on
|
|
|
+ <p>GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on"</p>
|
|
|
+ </li>
|
|
|
+ </ol>
|
|
|
+ </li>
|
|
|
+ <li>Press CTRL+O, Enter, CTRL+X to write the changes</li>
|
|
|
+ <li>Continue with the following commands
|
|
|
+ <div class="codeBlock"># update grub with config change<br />
|
|
|
+ update-grub<br />
|
|
|
+ # add vfio modules<br />
|
|
|
+ nano /etc/modules</div>
|
|
|
+ </li>
|
|
|
+ <li>Add the following to the bottom of the file
|
|
|
+ <p>vfio<br />
|
|
|
+ vfio_iommu_type1<br />
|
|
|
+ vfio_pci<br />
|
|
|
+ vfio_virqfd</p>
|
|
|
+ </li>
|
|
|
+ <li>Press CTRL+O, Enter, CTRL+X to write the changes</li>
|
|
|
+ <li>Continue with the following commands
|
|
|
+ <div class="codeBlock"># IOMMU interrupt mapping<br />
|
|
|
+ echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf<br />
|
|
|
+ echo "options kvm ignore_msrs=1" > /etc/modprobe.d/kvm.conf<br />
|
|
|
+ # blacklist drivers<br />
|
|
|
+ echo "blacklist radeon" >> /etc/modprobe.d/blacklist.conf<br />
|
|
|
+ echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf<br />
|
|
|
+ echo "blacklist nvidia" >> /etc/modprobe.d/blacklist.conf<br />
|
|
|
+ # list pci devices<br />
|
|
|
+ lspci -v</div>
|
|
|
+ </li>
|
|
|
+ <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>
|
|
|
+ <li>Continue with the following commands
|
|
|
+ <div class="codeBlock"># output the vendor ID(s) of the devices<br />
|
|
|
+ # replace the device identifier (01:00) as needed<br />
|
|
|
+ lspci -n -s 01:00</div>
|
|
|
+ </li>
|
|
|
+ <li>Make note of the vendor ID(s) output in the format abcd:1234</li>
|
|
|
+ <li>Continue with the following commands
|
|
|
+ <div class="codeBlock"># replace the vendor ids from the output of the previous step as needed<br />
|
|
|
+ echo "options vfio-pci ids=1002:6611,1002:aab0 disable_vga=1"> /etc/modprobe.d/vfio.conf<br />
|
|
|
+ # update initramfs<br />
|
|
|
+ update-initramfs -u<br />
|
|
|
+ # reboot proxmox host<br />
|
|
|
+ reboot now</div>
|
|
|
+ </li>
|
|
|
+</ol>
|
|
|
+
|
|
|
+<h2>Passing GPU to A VM</h2>
|
|
|
+
|
|
|
+<ol>
|
|
|
+ <li>Log into the ProxMox web UI</li>
|
|
|
+ <li>Expand the target node and select the target VM from the left navigation menu</li>
|
|
|
+ <li>Select Hardware from the left sub-navigation menu</li>
|
|
|
+ <li>Click Add > PCI Device</li>
|
|
|
+ <li>Select the GPU from the listing<br />
|
|
|
+ <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'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>
|
|
|
+ <li>Select Display > Set the dropdown to none (none) > Click OK</li>
|
|
|
+ <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 > USB Device > Select the USB device(s) or port(s) to pass to the VM</li>
|
|
|
+ <li>Click Start at the top right of the page</li>
|
|
|
+ <li>Watch the output of the GPU on an external display<br />
|
|
|
+ <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>
|
|
|
+ <li>Once the VM has booted and is outputting to the GPU, install drivers for the GPU as necessary</li>
|
|
|
+</ol>
|
|
|
+
|
|
|
+<p>Source: <a href="https://www.reddit.com/r/homelab/comments/b5xpua/the_ultimate_beginners_guide_to_gpu_passthrough/" target="_blank">https://www.reddit.com/r/homelab/comments/b5xpua/the_ultimate_beginners_guide_to_gpu_passthrough/</a><br />
|
|
|
+Documentation: <a href="https://pve.proxmox.com/wiki/Pci_passthrough" target="_blank">https://pve.proxmox.com/wiki/Pci_passthrough</a></p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </body>
|
|
|
+ </html>
|
|
|
+
|