Complete manual

pull/15/head
QaidVoid 3 years ago
parent 5b268feabd
commit 8f40417d4e

@ -117,7 +117,7 @@ To use patched vBIOS, edit VM's configuration to include patched vBIOS inside **
</tr>
</table>
### Libvirt Hooks
### **Libvirt Hooks**
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/)
<details>
@ -266,7 +266,7 @@ systemctl start display-manager
</table>
</details>
### Keyboard/Mouse Passthrough
### **Keyboard/Mouse Passthrough**
Modify libvirt configuration of your VM. Change first line to:
<table>
@ -404,7 +404,7 @@ virsh edit win10
</tr>
</table>
### Video card driver virtualisation detection
### **Video card driver virtualisation detection**
Video Card drivers refuse to run in Virtual Machine, so you need to spoof Hyper-V Vendor ID.
<table>
<tr>
@ -434,7 +434,7 @@ virsh edit win10
</tr>
</table>
Nvidia guest drivers also require hiding the KVM CPU leaf:
NVIDIA guest drivers also require hiding the KVM CPU leaf:
<table>
<tr>
<th>
@ -461,8 +461,8 @@ virsh edit win10
</tr>
</table>
### User Groups
You should add your user to ***input***, ***kvm***, and ***libvirt*** groups.
### **User Groups**
You should add your user to ***input***, ***kvm***, and ***libvirt*** groups to be able to run VM without root.
```sh
usermod -aG kvm,input,libvirt username
```

@ -1,19 +0,0 @@
#!/bin/bash
GUEST_NAME="$1"
HOOK_NAME="$2"
STATE_NAME="$3"
MISC="${@:4}"
BASEDIR="$(dirname $0)"
HOOKPATH="$BASEDIR/qemu.d/$GUEST_NAME/$HOOK_NAME/$STATE_NAME"
set -e # If a script exits with an error, we should as well.
if [ -f "$HOOKPATH" ]; then
eval \""$HOOKPATH"\" "$@"
elif [ -d "$HOOKPATH" ]; then
while read file; do
eval \""$file"\" "$@"
done <<< "$(find -L "$HOOKPATH" -maxdepth 1 -type f -executable -print;)"
fi

@ -1,22 +0,0 @@
#!/bin/bash
set -x
# Stop display manager
systemctl stop display-manager
# Unbind EFI Framebuffer
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
# Unload NVIDIA kernel modules
modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia
# Unload AMD kernel module
# modprobe -r amdgpu
# Detach GPU devices from host
# Use your GPU and HDMI Audio PCI host device
virsh nodedev-detach pci_0000_01_00_0
virsh nodedev-detach pci_0000_01_00_1
# Load vfio module
modprobe vfio-pci

@ -1,25 +0,0 @@
#!/bin/bash
set -x
# Unload vfio module
modprobe -r vfio-pci
# Attach GPU devices to host
# Use your GPU and HDMI Audio PCI host device
virsh nodedev-reattach pci_0000_01_00_0
virsh nodedev-reattach pci_0000_01_00_1
# Rebind framebuffer to host
echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind
# Load NVIDIA kernel modules
modprobe nvidia_drm
modprobe nvidia_modeset
modprobe nvidia_uvm
modprobe nvidia
# Load AMD kernel module
# modprobe amdgpu
# Restart Display Manager
systemctl start display-manager

@ -1,33 +0,0 @@
if [[ -z lspcu | grep Virtualization ]]; then
echo "ERROR: Virtualization isn't supported in this system"
exit 1
fi
if [[ -z dmesg | grep 'IOMMU enabled' ]]; then
echo "IOMMU isn't enabled. Enabling IOMMU... "
if [[ -f /boot/grub/grub.cfg ]]; then
echo "Loading GRUB configuration.. "
config=/etc/default/grub
if [[ lscpu | grep GenuineIntel ]]; then
if [[ -z sed -n 's/^GRUB_CMDLINE_LINUX_DEFAULT=//p' $config | grep intel_iommu=on ]]; then
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="\(.*\)"/GRUB_CMDLINE_LINUX_DEFAULT="\1 intel_iommu=on"/' $config
fi
else
if [[ -z sed -n 's/^GRUB_CMDLINE_LINUX_DEFAULT=//p' $config | grep amd_iommu=on ]]; then
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="\(.*\)"/GRUB_CMDLINE_LINUX_DEFAULT="\1 amd_iommu=on"/' $config
fi
elif [[ -f /boot/loader/loader.conf ]]; then
echo "Loading systemd-boot configuration... "
echo "Add intel_iommu=on or amd_iommu=on depending on your CPU to options in boot entry.."
# TODO
fi
echo "IOMMU enabled.."
echo "Please reboot your system to continue.."
exit 1
fi
echo "COPYING LIBVIRT SCRIPTS"
cp scripts/* /etc/libvirt/hooks/
echo "CONFIGURATION FINISHED.."
# TODO MORE OPTIONS
Loading…
Cancel
Save