qemu uefi virtio-gpu-gl example hi performance config
Forum rules
do not spam respect other forum members
do not spam respect other forum members
qemu uefi virtio-gpu-gl example hi performance config
https://github.com/tholin/OVMF-win7-hyp ... n7_code.fd
Use VirtIO 1.0 Devices
If your hardware and QEMU version support it, you can enable VirtIO 1.0 devices for improved performance over legacy VirtIO. These devices are typically more efficient and faster.
USB 3 controller example:
Code: Select all
qemu-system-x86_64 \
-enable-kvm \
-m 4G \
-mem-prealloc \
-mem-path /dev/hugepages \
-smp 8,sockets=1,cores=8,threads=1 \
-cpu host \
-drive file=void-linux.vdi,format=vdi,if=none,id=drive0 \
-object iothread,id=iothread0 \
-device virtio-blk-pci,drive=drive0,iothread=iothread0 \
-vga none \
-device virtio-gpu-gl-pci,max_outputs=1 \
-display sdl,gl=on \
-netdev user,id=usernet,hostfwd=tcp::2222-:22 \
-device virtio-net-pci,netdev=usernet \
-bios /usr/share/OVMF/OVMF_CODE.fd \
-boot menu=on
Use VirtIO 1.0 Devices
If your hardware and QEMU version support it, you can enable VirtIO 1.0 devices for improved performance over legacy VirtIO. These devices are typically more efficient and faster.
Code: Select all
qemu-system-x86_64 \
-enable-kvm \
-m 4G \
-mem-prealloc \
-mem-path /dev/hugepages \
-smp 8,sockets=1,cores=8,threads=1 \
-cpu host \
-drive file=void-linux.vdi,format=vdi,if=none,id=drive0 \
-object iothread,id=iothread0 \
-device virtio-blk-pci,drive=drive0,disable-modern=off,iothread=iothread0 \
-vga none \
-device virtio-gpu-gl-pci,max_outputs=1 \
-display sdl,gl=on \
-netdev user,id=usernet,hostfwd=tcp::2222-:22 \
-device virtio-net-pci,disable-modern=off,netdev=usernet \
-bios /usr/share/OVMF/OVMF_CODE.fd \
-boot menu=on
USB 3 controller example:
Code: Select all
qemu-system-x86_64 \
-enable-kvm \
-m 4G \
-mem-prealloc \
-mem-path /dev/hugepages \
-smp 8,sockets=1,cores=8,threads=1 \
-cpu host \
-drive file=void-linux.vdi,format=vdi,if=none,id=drive0 \
-object iothread,id=iothread0 \
-device virtio-blk-pci,drive=drive0,disable-modern=off,iothread=iothread0 \
-vga none \
-device virtio-gpu-gl-pci,max_outputs=1 \
-display sdl,gl=on \
-netdev user,id=usernet,hostfwd=tcp::2222-:22 \
-device virtio-net-pci,disable-modern=off,netdev=usernet \
-bios /usr/share/OVMF/OVMF_CODE.fd \
-boot menu=on \
-usb \
-device qemu-xhci,id=xhci \
-device usb-host,vendorid=0x0b05,productid=0x17cb
Re: qemu uefi virtio-gpu-gl example hi performance config
Windows config example with Qemu:
Code: Select all
qemu-system-x86_64 \
-machine q35,accel=kvm \
-cpu host \
-smp 4,sockets=1,cores=2,threads=2 \
-m 8G \
-drive if=pflash,format=raw,file=/usr/share/qemu/edk2-x86_64-code.fd,readonly=on \
-drive file=win.vdi,format=vdi,if=ide \
-cdrom virtio-win.iso \
-vga qxl \
-display sdl \
-usb -device usb-tablet -device usb-kbd \
-netdev user,id=net0 -device e1000,netdev=net0 \
-rtc base=localtime \
-device piix3-usb-uhci
Re: qemu uefi virtio-gpu-gl example hi performance config
Script that will make pci-e pass to VM and give example how can be done on Devuan linux.
# Install necessary packages
echo "[+] Installing QEMU, KVM, and supporting packages..."
apt update
apt install -y qemu-system-x86 qemu-utils qemu-block-extra virt-manager libvirt-daemon-system libvirt-clients bridge-utils ovmf
# Enable IOMMU in GRUB
echo "[+] Configuring GRUB for IOMMU..."
GRUB_CFG="/etc/default/grub"
if grep -q "intel_iommu=on" "$GRUB_CFG" || grep -q "amd_iommu=on" "$GRUB_CFG"; then
echo "IOMMU already configured in GRUB."
else
CPU_VENDOR=$(lscpu | grep -i "Vendor" | awk '{print $3}')
if [[ "$CPU_VENDOR" == "AuthenticAMD" ]]; then
sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="amd_iommu=on /' "$GRUB_CFG"
else
sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="intel_iommu=on /' "$GRUB_CFG"
fi
update-grub
fi
# Create modprobe config to bind GPU to vfio-pci
echo "[+] Configuring VFIO for the NVIDIA GT 730..."
cat > /etc/modprobe.d/vfio.conf <<EOF
options vfio-pci ids=10de:0f02,10de:0bea
EOF
# Blacklist nouveau driver
echo "[+] Blacklisting nouveau driver..."
cat > /etc/modprobe.d/blacklist-nouveau.conf <<EOF
blacklist nouveau
options nouveau modeset=0
EOF
echo vfio >> /etc/initramfs-tools/modules
echo vfio_pci >> /etc/initramfs-tools/modules
echo vfio_iommu_type1 >> /etc/initramfs-tools/modules
echo vfio_virqfd >> /etc/initramfs-tools/modules
# Update initramfs
echo "[+] Updating initramfs..."
update-initramfs -u
# Load VFIO modules at boot
echo "[+] Enabling VFIO modules..."
cat > /etc/modules-load.d/vfio.conf <<EOF
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
EOF
# Enable and start libvirtd service using SysV init
echo "[+] Starting libvirtd using SysV init..."
if [ -x /etc/init.d/libvirtd ]; then
/etc/init.d/libvirtd start
update-rc.d libvirtd defaults
else
echo "[-] libvirtd init script not found. Please check if it's installed correctly."
fi
# Final message
echo "=== All configuration complete. Rebooting is required to apply changes. ==="
read -p "Do you want to reboot now? [y/N]: " confirm
if [[ "$confirm" =~ ^[Yy]$ ]]; then
reboot
else
echo "Reboot manually to apply changes."
fi
Example for /etc/default/grub
# Install necessary packages
echo "[+] Installing QEMU, KVM, and supporting packages..."
apt update
apt install -y qemu-system-x86 qemu-utils qemu-block-extra virt-manager libvirt-daemon-system libvirt-clients bridge-utils ovmf
# Enable IOMMU in GRUB
echo "[+] Configuring GRUB for IOMMU..."
GRUB_CFG="/etc/default/grub"
if grep -q "intel_iommu=on" "$GRUB_CFG" || grep -q "amd_iommu=on" "$GRUB_CFG"; then
echo "IOMMU already configured in GRUB."
else
CPU_VENDOR=$(lscpu | grep -i "Vendor" | awk '{print $3}')
if [[ "$CPU_VENDOR" == "AuthenticAMD" ]]; then
sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="amd_iommu=on /' "$GRUB_CFG"
else
sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="intel_iommu=on /' "$GRUB_CFG"
fi
update-grub
fi
# Create modprobe config to bind GPU to vfio-pci
echo "[+] Configuring VFIO for the NVIDIA GT 730..."
cat > /etc/modprobe.d/vfio.conf <<EOF
options vfio-pci ids=10de:0f02,10de:0bea
EOF
# Blacklist nouveau driver
echo "[+] Blacklisting nouveau driver..."
cat > /etc/modprobe.d/blacklist-nouveau.conf <<EOF
blacklist nouveau
options nouveau modeset=0
EOF
echo vfio >> /etc/initramfs-tools/modules
echo vfio_pci >> /etc/initramfs-tools/modules
echo vfio_iommu_type1 >> /etc/initramfs-tools/modules
echo vfio_virqfd >> /etc/initramfs-tools/modules
# Update initramfs
echo "[+] Updating initramfs..."
update-initramfs -u
# Load VFIO modules at boot
echo "[+] Enabling VFIO modules..."
cat > /etc/modules-load.d/vfio.conf <<EOF
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
EOF
# Enable and start libvirtd service using SysV init
echo "[+] Starting libvirtd using SysV init..."
if [ -x /etc/init.d/libvirtd ]; then
/etc/init.d/libvirtd start
update-rc.d libvirtd defaults
else
echo "[-] libvirtd init script not found. Please check if it's installed correctly."
fi
# Final message
echo "=== All configuration complete. Rebooting is required to apply changes. ==="
read -p "Do you want to reboot now? [y/N]: " confirm
if [[ "$confirm" =~ ^[Yy]$ ]]; then
reboot
else
echo "Reboot manually to apply changes."
fi
Example for /etc/default/grub
Code: Select all
GRUB_CMDLINE_LINUX="amd_iommu=on iommu=pt amd_iommu=on vfio-pci.ids=1002:67ff,1002:aae0"