grep -E “vmx|svm” /proc/cpuinfo
, 或 lscpu | grep -E “vmx|svm”
virsh list --all
/etc/libvirt/qemu/
virt-xml-validate /path/to/XML/file
virsh define /etc/libvirt/qemu/your-xml-name.xml
root@Default:~# uname -a Linux troila-Default-string 5.3.0-53-generic #47~18.04.1-Ubuntu SMP Thu May 7 13:10:50 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
root@troila-Default-string:~# lspci 00:02.0 VGA compatible controller: Intel Corporation Skylake GT2 [HD Graphics 520] (rev 07)
root@Default:~# lspci -n 00:02.0 0300: 8086:1916 (rev 07)
systemctl restart getty@tty1.service #停止gdm sleep 1 echo "8086 1916" > /sys/bus/pci/drivers/vfio-pci/new_id #创建虚拟机所用驱动id echo "0000:00:02.0" > /sys/bus/pci/devices/0000\:00\:02.0/driver/unbind #解绑i915驱动与显卡设备 echo "0000:00:02.0" > /sys/bus/pci/drivers/vfio-pci/bind #绑定vfio驱动到显卡 echo "8086 1916" > /sys/bus/pci/drivers/vfio-pci/remove_id #移动id
注:执行后,依赖gnome的进程(包括隐藏窗口的进程)都会变成僵尸进程
echo -n "0000:00:02.0" > /sys/bus/pci/devices/0000\:00\:02.0/driver/unbind #解绑vfio与显卡设备 echo -n "0000:00:02.0" > /sys/bus/pci/drivers/i915/bind #i915驱动绑定到显卡上 systemctl restart display-manager #重启gdm