#### Launch ***virt-manager*** and create a new virtual machine. Select ***Customize before install*** on Final Step.
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 ***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.
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***.
For ***SATA*** disk of VM, set ***Disk Bus*** to ***virtio***. \
#### In ***NIC*** section, set ***Device Model*** to ***virtio***
In ***NIC*** section, set ***Device Model*** to ***virtio*** \
#### Add Hardware > CDROM: virtio-win.iso
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.
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.
After successful installation of Windows, install virtio drivers from virtio CDROM.
### **Attaching PCI devices**
### **Attaching PCI devices**
#### Remove Channel Spice, Display Spice, Video XQL, Sound ich* and other unnecessary 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
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.
Some GPU vBIOS needs to be patched for UEFI Support. \
----- TODO: vBIOS patching ------
----- TODO: vBIOS patching ------ \
#### To use patched vBIOS, edit VM's configuration
To use patched vBIOS, edit VM's configuration to include patched vBIOS inside ***hostdev*** block of VGA
```sh
virsh edit win10
```sh
```
mkdir /etc/libvirt/hooks
```xml
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'>
<hostdevmode='subsystem'type='pci'managed='yes'>
<source>
<source>
@ -98,12 +111,162 @@ virsh edit win10
...
...
</hostdev>
</hostdev>
...
...
```
```
</td>
</tr>
</table>
### Libvirt Hooks
### 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/)