You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3.6 KiB
3.6 KiB
- Set up IOMMU
- Set up VM
- Installation
- Starting services
- Start default network
- Setup Guest OS
- Launch virt-manager, and start creating guest. On final step, check "Customize before install".
- > In the "Overview" section, set Chipset to "Q35" and firmware to "UEFI".
- > In the "CPUs" section, change CPU model to "host-passthrough". You need to type it manually. According to Arch Wiki, this makes sure that the CPU is detected properly. Without it, some applications may complain about your CPU being of an unknown model.
- > Set Disk Bus of Storage to "virtio".
- > Set NIC Device Model to "virtio".
- Now, you can Begin Installation. You can continue installing Windows right now or after setting up Passthrough.
- Attach PCI devices
- NVIDIA GPU Patching
- Keyboard/mouse Passthrough
Set up IOMMU
Enable IOMMU
Load /etc/default/grub and append "intel_iommu=on" or "amd_iommu=on" to GRUB_CMDLINE_LINUX_DEFAULT. Also, "iommu=pt".
Update grub configuration.
grub-mkconfig -o /boot/grub/grub.cfg
Verify IOMMU is enabled successfully
You should see "IOMMU enabled" in output.
dmesg | grep -i -e DMAR -e IOMMU | grep enabled
Set up VM
Installation
Install the required packages.
sudo pacman -S qemu libvirt edk2-ovmf virt-manager dnsmasq ebtables iptables
Starting services
Enable and start libvirt service
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
Start default network
This may not be needed. If default network isn't started by default for you, start the network manually.
sudo virsh net-start default
sudo virsh net-autostart default
Setup Guest OS
Launch virt-manager, and start creating guest. On final step, check "Customize before install".
> In the "Overview" section, set Chipset to "Q35" and firmware to "UEFI".
> In the "CPUs" section, change CPU model to "host-passthrough". You need to type it manually. According to Arch Wiki, this makes sure that the CPU is detected properly. Without it, some applications may complain about your CPU being of an unknown model.
> Set Disk Bus of Storage to "virtio".
> Set NIC Device Model to "virtio".
Now, you can Begin Installation. You can continue installing Windows right now or after setting up Passthrough.
Attach PCI devices
Remove devices such as Spice Channel, XQL video adaper, USB tablet, etc.
Click on "Add Hardware" and add PCI devices for GPU and HDMI Audio. For NVIDIA GPU, GPU ROM should be patched. See next section.
NVIDIA GPU Patching
Dump GPU VBIOS
Using GPU-Z in Windows is the easiest method of dumping VBIOS. The following command didn't work for me but it's worth trying.
su
echo 1 > /sys/bus/pci/devices/0000:01:00.0/rom
cat /sys/bus/pci/devices/0000:01:00.0/rom > vbios.rom
echo 0 > /sys/bus/pci/devices/0000:01:00.0/rom
Patch VBIOS file
Use Hex Editor and search string "VIDEO", and remove everything before HEX value 55. There are bunch of 0s or fs usually..
Using Patched VBIOS file
You need to edit configution file of VM.
sudo virsh edit win10
Search for hostdev. Add
<rom file="path/to/your/patched_vbios.rom"/>
before address tag.
Keyboard/mouse Passthrough
You need to modify libvirt configuration.
sudo virsh edit win10
Modify first line
<domain type='kvm'>
to
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
Find your keyboard and mouse devices. Use the devices having event in their name.
ls /dev/input/by-id/
Verify you selected the right device by using following command. You should see output on terminal when using that device..
cat /dev/input/by-id/your_device
Add devices to the configuration. Replace MOUSE_NAME and KEYBOARD_NAME with your device id.
virsh edit win10
<qemu:commandline>
<qemu:arg value='-object'/>
<qemu:arg value='input-linux,id=mouse1,evdev=/dev/input/by-id/MOUSE_NAME'/>
<qemu:arg value='-object'/>
<qemu:arg value='input-linux,id=kbd1,evdev=/dev/input/by-id/KEYBOARD_NAME,grab_all=on,repeat=on'/>
</qemu:commandline>