GRUB_CMDLINE_LINUX_DEFAULT = "quiet splash amd_iommu = on"
or
GRUB_CMDLINE_LINUX_DEFAULT = "quiet splash intel_iommu = on"
sudo update-grub
.04: 00.0 VGA compatible controller [0300]: NVIDIA Corporation GT218 [GeForce 210] [ 10de: 0a65 ] (rev a2)
Kernel driver in use: nouveau
Kernel modules: nvidiafb, nouveau
04: 00.1 Audio device [0403]: NVIDIA Corporation High Definition Audio Controller [ 10de: 0be3 ] (rev a1)
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
options vfio-pci ids = 10de: 0a65,10de: 0be3
blacklist nouveau
DMAR: Intel® Virtualization Technology for Directed I / O
or
AMD-Vi: Found IOMMU at 0000: 00: 00.2 cap 0x40
AMD-Vi: Interrupt remapping enabled
AMD-Vi: Lazy IO / TLB flushing enabled
/sys/kernel/iommu_groups/15/devices/0000:01:00.0
/sys/kernel/iommu_groups/15/devices/0000:01:00.1
/sys/kernel/iommu_groups/16/devices/0000:02:00.0
/sys/kernel/iommu_groups/17/devices/0000:03:00.0
/sys/kernel/iommu_groups/18/devices/0000:04:00.0
/sys/kernel/iommu_groups/18/devices/0000:04:00.1
kvm_amd 94208 0 ccp 90112 1 kvm_amd kvm 622592 1 kvm_amd vfio_pci 45056 0 vfio_virqfd 16384 1 vfio_pci irqbypass 16384 2 vfio_pci, kvm vfio_iommu_type1 24576 0 vfio 28672 2 vfio_iommu_type1, vfio_pci
04: 00.0 VGA compatible controller [0300]: NVIDIA Corporation GT218 [GeForce 210] [ 10de: 0a65 ] (rev a2)
Kernel driver in use: vfio-pci
Kernel modules: nvidiafb, nouveau
04: 00.1 Audio device [0403]: NVIDIA Corporation High Definition Audio Controller [ 10de: 0be3 ] (rev a1)
Kernel driver in use: vfio-pci
Kernel modules: snd_hda_intel
sudo apt install qemu-kvm qemu-utils seabios ovmf virt-viewer
qemu-img create -f raw -o preallocation = full guest.img 50G
or
fallocate -l 50G guest.img
#! / bin / bash
remote-viewer spice: //127.0.0.1: 5900 &
sudo qemu-system-x86_64 \
-machine q35, accel = kvm \
-enable-kvm \
-cpu host, kvm = off, check \
-smp cpus = 2, sockets = 1, cores = 2, threads = 1 \
-m 6G \
-rtc base = localtime, clock = host \
-device piix3-usb-uhci \
-device usb-tablet \
-drive if = pflash, format = raw, readonly, file = / usr / share / OVMF / OVMF_CODE.fd \
-drive file = 'w10.iso', if = ide, format = raw, index = 2, media = cdrom, cache = none \
-drive file = 'virtio-win-0.1.141_st.iso', if = ide, format = raw, index = 3, media = cdrom, cache = none \
-drive file = 'guest.img', if = ide, format = raw, index = 4, media = disk, cache = writeback \
-vga qxl \
-spice port = 5900, addr = 127.0.0.1, disable-ticketing \
-monitor stdio \
-netdev user, id = n1, ipv6 = off, smb = "/ media / user / data" \
-device e1000, netdev = n1, mac = 67: 77: 78: 88: 89: 99 \
"$ @"
#! / bin / bash
remote-viewer spice: //127.0.0.1: 5900 &
sudo qemu-system-x86_64 \
-machine q35, accel = kvm \
-enable-kvm \
-cpu host, kvm = off, check \
-smp cpus = 2, sockets = 1, cores = 2, threads = 1 \
-m 6G \
-rtc base = localtime, clock = host \
-device piix3-usb-uhci \
-device usb-tablet \
-drive if = pflash, format = raw, readonly, file = / usr / share / OVMF / OVMF_CODE.fd \
-drive file = 'virtio-win-0.1.141_st.iso', if = ide, format = raw, index = 3, media = cdrom, cache = none \
-drive file = 'guest.img', if = ide, format = raw, index = 4, media = disk, cache = writeback \
-vga qxl \
-spice port = 5900, addr = 127.0.0.1, disable-ticketing \
-device ioh3420, bus = pcie.0, addr = 1c.0, multifunction = on, port = 1, chassis = 1, id = root \
-device vfio-pci, host = 04: 00.0, bus = root, addr = 00.0, multifunction = on \
-device vfio-pci, host = 04: 00.1, bus = root, addr = 00.1 \
-monitor stdio \
-netdev user, id = n1, ipv6 = off, smb = "/ media / user / data" \
-device e1000, netdev = n1, mac = 67: 77: 78: 88: 89: 99 \
"$ @"
#! / bin / bash
sudo qemu-system-x86_64 \
-machine q35, accel = kvm \
-enable-kvm \
-cpu host, kvm = off, check \
-smp cpus = 2, sockets = 1, cores = 2, threads = 1 \
-m 6G \
-rtc base = localtime, clock = host \
-device piix3-usb-uhci \
-device usb-tablet \
-drive if = pflash, format = raw, readonly, file = / usr / share / OVMF / OVMF_CODE.fd \
-drive file = 'virtio-win-0.1.141_st.iso', if = ide, format = raw, index = 3, media = cdrom, cache = none \
-drive file = 'guest.img', if = ide, format = raw, index = 4, media = disk, cache = writeback \
-vga none \
-device ioh3420, bus = pcie.0, addr = 1c.0, multifunction = on, port = 1, chassis = 1, id = root \
-device vfio-pci, host = 04: 00.0, bus = root, addr = 00.0, multifunction = on \
-device vfio-pci, host = 04: 00.1, bus = root, addr = 00.1 \
-monitor stdio \
-netdev user, id = n1, ipv6 = off, smb = "/ media / user / data" \
-device e1000, netdev = n1, mac = 67: 77: 78: 88: 89: 99 \
"$ @"
gt210.rom
, patch and at the output we have gt210_uefi.rom
. This is what you need to slip the video card when booting the virtual machine.#! / bin / bash
sudo qemu-system-x86_64 \
-machine q35, accel = kvm \
-enable-kvm \
-cpu host, kvm = off, check \
-smp cpus = 2, sockets = 1, cores = 2, threads = 1 \
-m 6G \
-rtc base = localtime, clock = host \
-device piix3-usb-uhci \
-device usb-tablet \
-drive if = pflash, format = raw, readonly, file = / usr / share / OVMF / OVMF_CODE.fd \
-drive file = 'virtio-win-0.1.141_st.iso', if = ide, format = raw, index = 3, media = cdrom, cache = none \
-drive file = 'guest.img', if = ide, format = raw, index = 4, media = disk, cache = writeback \
-vga none \
-device ioh3420, bus = pcie.0, addr = 1c.0, multifunction = on, port = 1, chassis = 1, id = root \
-device vfio-pci, host = 04: 00.0, bus = root, addr = 00.0, multifunction = on, romfile = gt210_uefi.rom \
-device vfio-pci, host = 04: 00.1, bus = root, addr = 00.1 \
-monitor stdio \
-netdev user, id = n1, ipv6 = off, smb = "/ media / user / data" \
-device e1000, netdev = n1, mac = 67: 77: 78: 88: 89: 99 \
"$ @"
vga_qxl.sh
. We look at the previous launch. And there everything is fine, except that the food dramatically pulled. It turns out that it works, although it does not work. The first idea was to connect via RDP and see what was happening there, but still it is better to use VNC for this, for example tightvnc [4] . Install VNC, configure port 5600
and push this port for access from the host.#! / bin / bash
sudo qemu-system-x86_64 \
-machine q35, accel = kvm \
-enable-kvm \
-cpu host, kvm = off, check \
-smp cpus = 2, sockets = 1, cores = 2, threads = 1 \
-m 6G \
-rtc base = localtime, clock = host \
-device piix3-usb-uhci \
-device usb-tablet \
-drive if = pflash, format = raw, readonly, file = / usr / share / OVMF / OVMF_CODE.fd \
-drive file = 'virtio-win-0.1.141_st.iso', if = ide, format = raw, index = 3, media = cdrom, cache = none \
-drive file = 'guest.img', if = ide, format = raw, index = 4, media = disk, cache = writeback \
-vga none \
-device ioh3420, bus = pcie.0, addr = 1c.0, multifunction = on, port = 1, chassis = 1, id = root \
-device vfio-pci, host = 04: 00.0, bus = root, addr = 00.0, multifunction = on, romfile = gt210_uefi.rom \
-device vfio-pci, host = 04: 00.1, bus = root, addr = 00.1 \
-monitor stdio \
-netdev user, id = n1, hostfwd = tcp: 127.0.0.1: 5600-: 5600, ipv6 = off, smb = "/ media / user / data" \
-device e1000, netdev = n1, mac = 67: 77: 78: 88: 89: 99 \
"$ @"
#! / bin / bash
sudo apt-get install cmake libsdl2-dev libsdl2-ttf-dev nettle-dev libspice-protocol-dev libfontconfig1-dev libx11-dev fonts-freefont-ttf libconfig-dev
wget github.com/gnif/LookingGlass/archive/a12.tar.gz
tar -xf a12.tar.gz
cd lookingglass-a12
mkdir client / build
cd client / build
cmake ../
make
#! / bin / bash
if [! -f / dev / shm / looking-glass]; then
touch / dev / shm / looking-glass
chown `whoami`: kvm / dev / shm / looking-glass
chmod 660 / dev / shm / looking-glass
fi
sudo qemu-system-x86_64 \
-machine q35, accel = kvm \
-enable-kvm \
-cpu host, kvm = off, check \
-smp cpus = 2, sockets = 1, cores = 2, threads = 1 \
-m 6G \
-rtc base = localtime, clock = host \
-device piix3-usb-uhci \
-device usb-tablet \
-drive if = pflash, format = raw, readonly, file = / usr / share / OVMF / OVMF_CODE.fd \
-drive file = 'virtio-win-0.1.141_st.iso', if = ide, format = raw, index = 3, media = cdrom, cache = none \
-drive file = 'guest.img', if = ide, format = raw, index = 4, media = disk, cache = writeback \
-vga none \
-device ioh3420, bus = pcie.0, addr = 1c.0, multifunction = on, port = 1, chassis = 1, id = root \
-device vfio-pci, host = 04: 00.0, bus = root, addr = 00.0, multifunction = on, romfile = gt210_uefi.rom \
-device vfio-pci, host = 04: 00.1, bus = root, addr = 00.1 \
-device ivshmem-plain, memdev = ivshmem, bus = pcie.0 \
-object memory-backend-file, id = ivshmem, share = on, mem-path = / dev / shm / looking-glass, size = 32M \
-monitor stdio \
-netdev user, id = n1, hostfwd = tcp: 127.0.0.1: 5600-: 5600, ipv6 = off, smb = "/ media / user / data" \
-device e1000, netdev = n1, mac = 67: 77: 78: 88: 89: 99 \
"$ @"
./LookingGlass-a12/client/build/looking-glass-client
.Source: https://habr.com/ru/post/433878/
All Articles