mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-28 14:53:58 +00:00
feat(desktop): Add option to enable virtualization and vfio
This commit is contained in:
parent
cf7dd2107f
commit
d9f7aafe07
@ -266,3 +266,42 @@ add-user-to-input-group:
|
||||
sudo bash -c 'grep "input" /lib/group >> /etc/group'
|
||||
fi
|
||||
sudo usermod -a -G input $USER
|
||||
|
||||
# Enable Virtualization and add workaround for a specific windows VM crash
|
||||
enable-virtualization:
|
||||
echo "Installing QEMU and virt-manager..."
|
||||
rpm-ostree install virt-manager edk2-ovmf qemu
|
||||
rpm-ostree kargs \
|
||||
--append-if-missing="kvm.ignore_msrs=1" \
|
||||
--append-if-missing="kvm.report_ignored_msrs=0"
|
||||
|
||||
# Enable VFIO on the system if virtualization is enabled
|
||||
enable-vfio:
|
||||
#!/usr/bin/env bash
|
||||
echo "Enabling VFIO..."
|
||||
virt_test=$(rpm-ostree kargs)
|
||||
cpu_vendor=$(grep "vendor_id" "/proc/cpuinfo" | uniq | awk -F": " '{ $print $2 }')
|
||||
vendor_karg="amd_iommu=on"
|
||||
if [[ ${virt_test} == *kvm.report_ignored_msrs* ]]; then
|
||||
rpm-ostree initramfs \
|
||||
--enable \
|
||||
--arg="--add-drivers" \
|
||||
--arg="vfio vfio_iommu_type1 vfio-pci"
|
||||
if [[ ${cpu_vendor} == "AuthenticAMD" ]]; then
|
||||
vendor_karg="amd_iommu=on"
|
||||
elif [[ ${cpu_vendor} == "GenuineIntel" ]]; then
|
||||
vendor_karg="intel_iommu=on"
|
||||
fi
|
||||
rpm-ostree kargs \
|
||||
--append-if-missing="${vendor_karg}" \
|
||||
--append-if-missing="iommu=pt" \
|
||||
--append-if-missing="rd.driver.pre=vfio_pci" \
|
||||
--append-if-missing="vfio.pci.disable_vga=1"
|
||||
echo "VFIO enabled, make sure you enable IOMMU, VT-d or AMD-v in your BIOS!"
|
||||
echo "Please understand that since this is such a niche use case, support will be very limited!"
|
||||
echo "To add your unused/second GPU device ids to the vfio driver by running"
|
||||
echo 'rpm-ostree kargs --append-if-missing="vfio-pci.ids=xxxx:yyyy,xxxx:yyzz"'
|
||||
echo "NOTE: Your second GPU will not be usable by the host after you do this!"
|
||||
else
|
||||
echo "Enable virtualization with just enable-virtualization before running just enable-vfio."
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user