Guest User

OP-post BETA

a guest
Aug 6th, 2015
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. Since 2013 and kernel version 3.9, it is now possible to passthrough a physical GPU to the QEMU VM.
  3. This thread is aimed to provide a short reference on how to make it all work and a place to discuss problems about making it work.
  5. ===
  6. Please note, there was an archlinux bbs thread with 200+ pages, which you've probably found by using some web search engine. But the archlinux BBS is dedicated to providing support for arch distribution only. And the OP-post(and all derived guides and wiki pages) are now outdated.
  7. This thread is one of the group of threads about GPU passthrough. There are threads for:
  8. Arch <==LINK
  9. Ubuntu <==LINK
  10. Debian <==LINK
  11. Gentoo <==LINK
  12. Most of these forums have a "$distribution-only rule", and if your distro doesn't have a thread for you - feel free to create it.
  13. ===
  15. The main working component is a kernel module called vfio-pci, written by Alex Williamson. He has a pretty good and in-depth guide written on his blog(URL).
  17. Below is a short compilation of code snippets and instructions to make it work quickly.
  19. Known issues:
  21. Notebooks:
  22. I haven't personally observed anyone doing this on a laptop. There was people who tried, but failed.
  24. CPUs:
  25. First of all, your CPU should have IOMMU support.
  26. Most AMD platforms have a BIOS/UEFI setup option, some intel platforms need to be checked on For example, there's i7-4770K, which doesn't support Intel VT-d, but i7-4770 does.
  27. Intel CPUs and chipsets sometimes have bad IOMMU groups, this can be worked around by ACS override patch( Read about IOMMU grouping and ACS in detail on aw's blog.
  28. AMD FX CPUs generally show good support, however there are (mostly ASUS) motherboards present with the broken ACPI IVRS table. If your table is broken - you will be warned about this in dmesg when loading the amd_iommu kernel module. You might have a chance to fix it by kernel command line parameters, but i haven't observed anyone successfully doing that.
  29. AMD FM2 socket APUs and CPUs aren't used often, but the issues are:
  30. Broken VGA(needs testing)
  31. Broken hugepages.
  32. General instability.
  34. GPUs:
  35. AMD:
  36. Some HD7XXX-series cards have problems with UEFI support, even if there's a driver in the ROM, it may be broken. It is possible to try and combine as originally described there( Please note that the EFIRom tool is a part of EDK2-tools.
  37. Some cards had device reset problems, as you couldn't launch a VM twice. This issue was resolved previously( and the patch should be in fresh upstream QEMU and kernel.
  39. NVIDIA:
  40. The Code 43 problem.( Most nvidia drivers set the card offline when the VM is detected. This is mostly related to KVM CPUID signature and Hyper-V enlightenments.
  41. If you've been struck with Code 43 error, you can try disabling those features:
  42. QEMU Commandline:
  43. [code]
  44. -cpu ...,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time
  45. [/code]
  46. Add those options to enable Hyper-V. Delete them and add kvm=off to hide the KVM signature and Hyper-V features.
  47. Libvirt:
  48. Those lines enable the Hyper-V. Remove them to disable.
  49. [code]
  50. <features>
  51. <hyperv>
  52. <relaxed state='on'/>
  53. <vapic state='on'/>
  54. <spinlocks state='on' retries='8191'/>
  55. </hyperv>
  56. <features/>
  58. <clock ...>
  59. <timer name='hypervclock' present='yes'/>
  60. </clock>
  61. [/code]
  62. CPUID signature hiding:
  63. [code]
  64. <kvm>
  65. <hidden state='on'/>
  66. </kvm>
  67. [/code]
  68. The Hyper-V enlightenment doesn't give a huge performance boost, so don't worry much about it. Usually performance hit is neglected by the use of new drivers for the GPU.
Add Comment
Please, Sign In to add comment