Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédenteProchaine révisionLes deux révisions suivantes |
kb:linux:generalites:gpu_passthrough_avec_qemu [2019/07/06 17:27] – beu | kb:linux:generalites:gpu_passthrough_avec_qemu [2019/11/23 18:03] – [Configuration du Guest] beu |
---|
:!: ATTENTION CETTE DOCUMENTATION EST EN COURS DE REDACTION :!: | :!: ATTENTION CETTE DOCUMENTATION EST EN COURS DE REDACTION :!: |
====== GPU Passthrough avec QEMU ====== | ====== GPU Passthrough avec QEMU ====== |
| |
:!: Attention, ce sujet est bien trop complexe, impossible d'être exhaustif. | |
| |
===== Prérequis ===== | ===== Prérequis ===== |
Ensuite branchez votre Dummy plug sur votre GPU, et vos écrans sur votre iGPU. | Ensuite branchez votre Dummy plug sur votre GPU, et vos écrans sur votre iGPU. |
| |
Ensuite configurer votre GRUB en ajoutant l'option **intel_iommu=on** a votre noyaux. | Ensuite configurer votre GRUB en ajoutant l'option **intel_iommu=on** ou **amd_iommu=on** en fonction de votre CPU à votre noyaux. |
| |
Ensuite il faut demander a votre initramfs de charger les pilotes vfio en ajoutant les modules **vfio_pci**, **vfio, vfio_iommu_type1** et **vfio_virqfd** dans le fichier ///etc/mkinitcpio.conf//. | Ensuite il faut demander a votre initramfs de charger les pilotes vfio en ajoutant les modules **vfio_pci**, **vfio, vfio_iommu_type1** et **vfio_virqfd** dans le fichier ///etc/mkinitcpio.conf//. |
</code> | </code> |
| |
vous devriez optenir quelque chose comme ceci : | vous devriez obtenir quelque chose comme ceci : |
| |
<code> | <code> |
| |
<code bash> | <code bash> |
qemu-system-x86_64 -L . -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF_CODE.fd -drive if=pflash,format=raw,file=/usr/share/ovmf/x64/OVMF_VARS.fd -enable-kvm -m 8G -drive file=/dev/sda,format=raw,if=virtio -netdev type=user,id=net0,hostfwd=tcp::3389-:3389 -device virtio-net-pci,netdev=net0 -soundhw hda -cpu 'host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time,hv_vendor_id=whatever123,+kvm_pv_unhalt,+kvm_pv_eoi,kvm=off' -smp 2,sockets=1,cores=2,threads=1 -device ivshmem-plain,memdev=ivshmem -object memory-backend-file,id=ivshmem,share=on,mem-path=/dev/shm/looking-glass,size=32M -spice port=5900,addr=127.0.0.1,disable-ticketing -device virtio-serial-pci -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 -chardev spicevmc,id=spicechannel0,name=vdagent -chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 -device virtio-serial -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -monitor telnet:127.0.0.1:55555,server,nowait -device virtio-keyboard-pci -audiodev pa,id=pa1,server=/run/user/1000/pulse/native -drive file=win10.iso,index=0,media=cdrom -drive file=virtio-win-0.1.141.iso,index=1,media=cdrom -vga std -display sdl | qemu-system-x86_64 \ |
| -machine q35,accel=kvm,usb=off,vmport=off,dump-guest-core=off,kernel-irqchip=on \ |
| -cpu host,hv_time,hv_relaxed,hv_vpindex,hv_reset,hv_runtime,hv_crash,hv_synic,hv_stimer,hv_spinlocks=0x1fff,hv_vendor_id=lakeuv283713,kvm=off,l3-cache=on,-hypervisor,migratable=no,+invtsc \ |
| -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF_CODE.fd \ |
| -drive if=pflash,format=raw,file=/usr/share/ovmf/x64/OVMF_VARS.fd \ |
| -overcommit mem-lock=on \ |
| -overcommit cpu-pm=on \ |
| -pidfile /var/run/vm.Windows.pid \ |
| -monitor telnet:127.0.0.1:55555,server,nowait \ |
| -enable-kvm \ |
| -name guest=Windows,debug-threads=on \ |
| -smp 3,sockets=1,cores=3,threads=1 \ |
| -m 8G \ |
| -mem-prealloc \ |
| -global ICH9-LPC.disable_s3=1 \ |
| -global ICH9-LPC.disable_s4=1 \ |
| -no-user-config \ |
| -nodefaults \ |
| -rtc base=localtime,driftfix=slew \ |
| -global kvm-pit.lost_tick_policy=discard \ |
| -boot strict=on \ |
| -no-hpet \ |
| -netdev type=user,id=net0 \ |
| -device virtio-net-pci,netdev=net0,id=net0,bus=pcie.0 \ |
| -device ich9-intel-hda,id=sound1,bus=pcie.0 \ |
| -device hda-output \ |
| -device ioh3420,id=root_port1,chassis=0,slot=0,bus=pcie.0 \ |
| -device vfio-pci,host=01:00.0,id=hostdev1,bus=root_port1,addr=0x00,multifunction=on \ |
| -device vfio-pci,host=01:00.1,id=hostdev2,bus=root_port1,addr=0x00.1 \ |
| -drive id=disk,file=/dev/sda,format=raw,if=none,cache=none,aio=native,discard=unmap,detect-zeroes=unmap,copy-on-read=on \ |
| -device virtio-scsi-pci,id=scsi \ |
| -device scsi-hd,drive=disk,bus=scsi.0,rotation_rate=1 \ |
| -device ivshmem-plain,memdev=ivshmem,bus=pcie.0 \ |
| -object memory-backend-file,id=ivshmem,share=on,mem-path=/dev/shm/looking-glass,size=32M \ |
| -spice disable-ticketing,seamless-migration=off,port=5900,addr=127.0.0.1 \ |
| -device virtio-serial-pci \ |
| -chardev spicevmc,id=vdagent,name=vdagent \ |
| -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \ |
| -device virtio-mouse-pci,id=input1,bus=pcie.0,addr=0xb \ |
| -device virtio-keyboard-pci,id=input2,bus=pcie.0,addr=0xc \ |
| -usb \ |
| -device intel-iommu \ |
| -audiodev pa,id=pa1,server=/run/user/1000/pulse/native \ |
| -vga std -display sdl |
</code> | </code> |
| |
Installez votre Windows 10. Je vous conseille : | Installez votre Windows 10. Je vous conseille : |
* de mettre un mot de passe a votre session (Attention a bien mettre l'autologin !!!) | * de mettre un mot de passe a votre session (Attention a bien mettre l'autologin !!!) |
| * Désactiver l'extinction de l'écran pour inactivité |
* Activer RDP | * Activer RDP |
* D'installer tout les pilotes/updates disponibles | * D'installer tout les pilotes/updates disponibles |
| |
| |
Eteignez la VM et lancez la avec votre carte graphique et sans l'affichage virtuel, en ajustant les bons argument, par exemple : | Éteignez la VM et lancez la sans l'affichage virtuel, en remplaçant la dernière ligne par : |
| |
<code> | <code> |
# qemu-system-x86_64 [....] -vga none -display none -device vfio-pci,host=01:00.0,multifunction=true -device vfio-pci,host=01:00.1 | -vga none -display none |
</code> | </code> |
| |