mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-02-05 15:40:17 +00:00
Enable virtualization (#406)
* fix: remove accidental $ in awk command * fix: make enable-vfio fail if VENDOR_KARG is unset
This commit is contained in:
parent
67f62bf3fa
commit
af88e82be5
@ -279,21 +279,25 @@ enable-virtualization:
|
|||||||
enable-vfio:
|
enable-vfio:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
echo "Enabling VFIO..."
|
echo "Enabling VFIO..."
|
||||||
virt_test=$(rpm-ostree kargs)
|
VIRT_TEST=$(rpm-ostree kargs)
|
||||||
cpu_vendor=$(grep "vendor_id" "/proc/cpuinfo" | uniq | awk -F": " '{ $print $2 }')
|
CPU_VENDOR=$(grep "vendor_id" "/proc/cpuinfo" | uniq | awk -F": " '{ print $2 }')
|
||||||
vendor_karg="amd_iommu=on"
|
VENDOR_KARG="unset"
|
||||||
if [[ ${virt_test} == *kvm.report_ignored_msrs* ]]; then
|
if [[ ${VIRT_TEST} == *kvm.report_ignored_msrs* ]]; then
|
||||||
rpm-ostree initramfs \
|
rpm-ostree initramfs \
|
||||||
--enable \
|
--enable \
|
||||||
--arg="--add-drivers" \
|
--arg="--add-drivers" \
|
||||||
--arg="vfio vfio_iommu_type1 vfio-pci"
|
--arg="vfio vfio_iommu_type1 vfio-pci"
|
||||||
if [[ ${cpu_vendor} == "AuthenticAMD" ]]; then
|
if [[ ${CPU_VENDOR} == "AuthenticAMD" ]]; then
|
||||||
vendor_karg="amd_iommu=on"
|
VENDOR_KARG="amd_iommu=on"
|
||||||
elif [[ ${cpu_vendor} == "GenuineIntel" ]]; then
|
elif [[ ${CPU_VENDOR} == "GenuineIntel" ]]; then
|
||||||
vendor_karg="intel_iommu=on"
|
VENDOR_KARG="intel_iommu=on"
|
||||||
fi
|
fi
|
||||||
|
if [[ ${VENDOR_KARG} == "unset" ]]; then
|
||||||
|
echo "Failed to get CPU vendor, exiting..."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
rpm-ostree kargs \
|
rpm-ostree kargs \
|
||||||
--append-if-missing="${vendor_karg}" \
|
--append-if-missing="${VENDOR_KARG}" \
|
||||||
--append-if-missing="iommu=pt" \
|
--append-if-missing="iommu=pt" \
|
||||||
--append-if-missing="rd.driver.pre=vfio_pci" \
|
--append-if-missing="rd.driver.pre=vfio_pci" \
|
||||||
--append-if-missing="vfio.pci.disable_vga=1"
|
--append-if-missing="vfio.pci.disable_vga=1"
|
||||||
@ -302,6 +306,7 @@ enable-vfio:
|
|||||||
echo "To add your unused/second GPU device ids to the vfio driver by running"
|
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 '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!"
|
echo "NOTE: Your second GPU will not be usable by the host after you do this!"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Enable virtualization with just enable-virtualization before running just enable-vfio."
|
echo "Enable virtualization with just enable-virtualization before running just enable-vfio."
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user