Gpu Passthrough

sudo apt install qemu-kvm qemu-utils libvirt-daemon-system libvirt-clients bridge-utils virt-manager ovmf

Identify iommu group,

#!/bin/bash
# change the 999 if needed
shopt -s nullglob
for d in /sys/kernel/iommu_groups/{0..999}/devices/*; do
	n=${d#*/iommu_groups/*}; n=${n%%/*}
	printf 'IOMMU Group %s ' "$n"
	lspci -nns "${d##*/}"
done
sudo vi /etc/default/grub
	GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on iommu=pt vfio-pci.ids=10de:24e0,10de:228b"

sudo update-grub

After NVidia driver is installed in guest win10, remember to disable "Red Hat QXL Controller" display adapter before reboot.

Setup up shared folder:

VM Settings -> Memory -> Enable shared memory

Add Hardware -> Filesystem -> virtiofs -> Source path: /host/path/to/share -> Target path: \\share

After boot up gust win10, drop winfsp-2.0.23075.msi in it and install the msi using default package.

Then start service "VirtIO-FS Service (VirtioFsSvc)".

In address bar of Windows Explorer, type z: to access shared folder.

Convert vmdk to qcow2,

qemu-img convert -f vmdk -O qcow2 /mnt/E/vmimg/win10new/win10.vmdk win10.qcow2

refer to:
https://mathiashueber.com/passthrough-windows-11-vm-ubuntu-22-04/
https://mathiashueber.com/pci-passthrough-ubuntu-2004-virtual-machine/
https://askubuntu.com/questions/1406888/ubuntu-22-04-gpu-passthrough-qemu
https://blog.hwaryong.com/kvm-gpu-passthrough-on-ubuntu-2004
https://www.debugpoint.com/kvm-share-folder-windows-guest/
https://docs.openstack.org/image-guide/convert-images.html

https://github.com/winfsp/winfsp/releases/
https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/