#### Launch ***virt-manager*** and create a new virtual machine. Select ***Customize before install*** on Final Step.
#### In ***Overview*** section, set ***Chipset*** to ***Q35***, and ***Firmware*** to ***UEFI***
#### In ***CPUs*** section, set ***CPU model*** to ***host-passthrough***, and ***CPU Topology*** to whatever fits your system.
#### For ***SATA*** disk of VM, set ***Disk Bus*** to ***virtio***.
#### In ***NIC*** section, set ***Device Model*** to ***virtio***
#### Add Hardware > CDROM: virtio-win.iso
#### Now, ***Begin Installation***. Windows can't detect the ***virtio disk***, so you need to ***Load Driver*** and select ***virtio-iso/amd64/win10*** when prompted.
#### After successful installation of Windows, install virtio drivers from virtio CDROM.
***NOTE: You should replace win10 with your VM's name where applicable*** \
Launch ***virt-manager*** and create a new virtual machine. Select ***Customize before install*** on Final Step. \
In ***Overview*** section, set ***Chipset*** to ***Q35***, and ***Firmware*** to ***UEFI*** \
In ***CPUs*** section, set ***CPU model*** to ***host-passthrough***, and ***CPU Topology*** to whatever fits your system. \
For ***SATA*** disk of VM, set ***Disk Bus*** to ***virtio***. \
In ***NIC*** section, set ***Device Model*** to ***virtio*** \
Add Hardware > CDROM: virtio-win.iso \
Now, ***Begin Installation***. Windows can't detect the ***virtio disk***, so you need to ***Load Driver*** and select ***virtio-iso/amd64/win10*** when prompted. \
After successful installation of Windows, install virtio drivers from virtio CDROM.
### **Attaching PCI devices**
#### Remove Channel Spice, Display Spice, Video XQL, Sound ich* and other unnecessary devices.
#### Now, click on ***Add Hardware***, select ***PCI Devices*** and add the PCI Host devices for your GPU's VGA and HDMI Audio
#### Some GPU vBIOS needs to be patched for UEFI Support.
----- TODO: vBIOS patching ------
#### To use patched vBIOS, edit VM's configuration
```sh
virsh edit win10
```
```xml
Remove Channel Spice, Display Spice, Video XQL, Sound ich* and other unnecessary devices. \
Now, click on ***Add Hardware***, select ***PCI Devices*** and add the PCI Host devices for your GPU's VGA and HDMI Audio \
Some GPU vBIOS needs to be patched for UEFI Support. \
----- TODO: vBIOS patching ------ \
To use patched vBIOS, edit VM's configuration to include patched vBIOS inside ***hostdev*** block of VGA
```sh
mkdir /etc/libvirt/hooks
touch /etc/libvirt/hooks/qemu
chmod +x /etc/libvirt/hooks/qemu
```
<table>
<tr>
<th>
virsh edit win10
</th>
</tr>
<tr>
<td>
```xml
...
<hostdevmode='subsystem'type='pci'managed='yes'>
<source>
@ -98,12 +111,162 @@ virsh edit win10
...
</hostdev>
...
```
```
</td>
</tr>
</table>
### Libvirt Hooks
#### TODO
Libvirt hooks automate the process of running specific tasks during VM state change. \
More info at: [PassthroughPost](https://passthroughpo.st/simple-per-vm-libvirt-hooks-with-the-vfio-tools-hook-helper/)