-
-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Update VFIO to be bootc compliant #2150
base: main
Are you sure you want to change the base?
Changes from all commits
f5fb7c8
4ee3cc6
55c3b7a
07c776c
49e071d
2c86005
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
force_drivers+=" vfio vfio_iommu_type1 vfio-pci " |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ source /usr/lib/ujust/ujust.sh | |
# Required disclaimer and where to report issues first | ||
echo "$(Urllink "https://looking-glass.io/docs/rc/ivshmem_kvmfr/#libvirt" "This module") along with $(Urllink "https://looking-glass.io" "Looking Glass") is very experimental and not recommended for production use!" | ||
echo "The ublue team packages the kvmfr module only because it has to be supplied with the system image while using an atomic desktop." | ||
echo "If you do plan to use Looking Glass, please $(Urllink "https://universal-blue.discourse.group/docs?topic=956" "follow the guide here") on how to compile it for your system." | ||
echo "If you do plan to use Looking Glass, please $(Urllink "https://docs.bazzite.gg/Advanced/looking-glass/#compiling-looking-glass-client" "follow the guide here") on how to compile it for your system." | ||
echo "To use the kvmfr module after enabling it, just add and edit the xml for libvirt from the documentation in the first link." | ||
echo "Since we package the kvmfr module please open kvmfr related issues you have on Bluefin and tag me" | ||
echo "in the $(Urllink "https://discord.gg/WEu6BdFEtp" "Universal Blue Discord") or the $(Urllink "https://github.com/ublue-os/bluefin/issues" "Bluefin Github issue tracker")." | ||
|
@@ -15,17 +15,22 @@ if [ "$CONFIRM" == "Cancel" ]; then | |
exit 0 | ||
fi | ||
|
||
# Add kvmfr to dracut so that it's modprobe file can be used | ||
echo "" | ||
# Add kvmfr modprobe file following upstream documentation | ||
echo "Setting up kvmfr module so it loads next boot" | ||
sudo bash -c 'cat << KVMFR_DRACUT > /etc/dracut.conf.d/kvmfr.conf | ||
install_items+=" /etc/modprobe.d/kvmfr.conf " | ||
KVMFR_DRACUT' | ||
if [ -f "/etc/modprobe.d/kvmfr.conf" ]; then | ||
echo "Re-creating dummy kvmfr modprobe file" | ||
sudo rm /etc/modprobe.d/kvmfr.conf | ||
fi | ||
sudo bash -c 'cat << KVMFR_MODPROBE > /etc/modprobe.d/kvmfr.conf | ||
# This is a dummy file and changing it does nothing | ||
# If you want to change the kvmfr static_size_mb | ||
# Run "rpm-ostree kargs --replace=kvmfr.static_size_mb=oldvalue=newvalue" | ||
# Default value set by us is 128 which is enough for 4k SDR | ||
# Find the current value by running "rpm-ostree kargs" | ||
KVMFR_MODPROBE' | ||
|
||
# Add kvmfr modprobe file following upstream documentation | ||
sudo bash -c "cat << KVMFR_MODPROBE > /etc/modprobe.d/kvmfr.conf | ||
options kvmfr static_size_mb=128 | ||
KVMFR_MODPROBE" | ||
# Add kvmfr static size karg | ||
rpm-ostree kargs --append-if-missing="kvmfr.static_size_mb=128" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the modprobe override here seems like what we should do with bootc, but maybe it just works? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we probably can and the looking-glass people would prefer it over using rpm-ostree kargs which is unique to fedora atomic, i am just following the change kyle did in bazzite to add the vfio modules to the image. :) |
||
|
||
# Add upstream udev rule for kvmfr, adjusted for fedora systems | ||
echo "Adding udev rule for /dev/kvmfr0" | ||
|
@@ -64,6 +69,10 @@ fi | |
if [ ! -d "$HOME/.config/selinux_te/pp" ]; then | ||
mkdir -p "$HOME/.config/selinux_te/pp" | ||
fi | ||
if [ -f "$HOME/.config/selinux_te/kvmfr.te" ]; then | ||
echo "Re-creating kvmfr selinux type enforcement rules" | ||
rm $HOME/.config/selinux_te/kvmfr.te | ||
fi | ||
bash -c "cat << KVMFR_SELINUX > $HOME/.config/selinux_te/kvmfr.te | ||
module kvmfr 1.0; | ||
require { | ||
|
@@ -73,6 +82,9 @@ require { | |
} | ||
#============= svirt_t ============== | ||
allow svirt_t device_t:chr_file { open read write map }; | ||
|
||
#============= virtqemud_t ============== | ||
allow virtqemud_t device_t:chr_file { read write }; | ||
KVMFR_SELINUX" | ||
|
||
# Tell user what type enforcement we made and how it looks like | ||
|
@@ -100,9 +112,6 @@ echo "If you need to change it to a different value" | |
echo "you can do that in /etc/modprobe.d/kvmfr.conf" | ||
echo "$(Urllink "https://looking-glass.io/docs/rc/ivshmem_kvmfr/#libvirt" "Please read official documentation for kvmfr for how to use it")" | ||
echo "" | ||
echo "Press OK to start the process of regenerating your initramfs, this will take a long time" | ||
echo "and there is no good way to track progress for it, if anything is wrong it will error out." | ||
echo "${b}NOTE: You can start using kvmfr right now without rebooting, but you will need to regenerate initramfs for it to auto load next boot.${n}" | ||
echo "${b}NOTE: You can start using kvmfr right now without rebooting.${n}" | ||
|
||
CONFIRM=$(Choose OK) | ||
rpm-ostree initramfs --enable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we still run kargs on a bootc-only system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use it in bazzite, bootc just does not like the initramfs rebuilding and layering from my understanding.
but i can remove lact from my install and double check to be 100% sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just checked, can be used with kargs, just not layers and initramfs