From 3f934351fc919e90342f7978efe195307cd1e06f Mon Sep 17 00:00:00 2001
From: HikariKnight <2557889+HikariKnight@users.noreply.github.com>
Date: Sat, 10 Aug 2024 08:57:54 +0200
Subject: [PATCH 1/7] fix: correctly detect kernel 6.10 and newer as a newer
kernel
---
internal/configs/configs.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/internal/configs/configs.go b/internal/configs/configs.go
index 4b1da82..c9b851b 100644
--- a/internal/configs/configs.go
+++ b/internal/configs/configs.go
@@ -221,7 +221,7 @@ func vfio_modules() []string {
// If we are on a kernel older than 6.2
sysinfo := uname.New()
- kernel_re := regexp.MustCompile(`^(6\.1|6\.0|[1-5]\.)`)
+ kernel_re := regexp.MustCompile(`^(6\.1|6\.0|[1-5]\.\d{1,2})\.`)
if kernel_re.MatchString(sysinfo.Kernel) {
// Write to the debug log
logger.Printf("Linux kernel version %s detected!\nIncluding vfio_virqfd module\n", sysinfo.Kernel)
From d1e44d94d593f29ab42c29c00b6683a9f8952181 Mon Sep 17 00:00:00 2001
From: HikariKnight <2557889+HikariKnight@users.noreply.github.com>
Date: Sat, 10 Aug 2024 09:02:49 +0200
Subject: [PATCH 2/7] chore: add quickpassthrough_debug.log to gitignore
---
.gitignore | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index f0eea18..1313c71 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,5 @@ bin/
dist/
main
quickpassthrough
-debug.log
\ No newline at end of file
+debug.log
+quickpassthrough_debug.log
From 05afa8c543c76b18169a89e71c96cbe0f1c2c892 Mon Sep 17 00:00:00 2001
From: HikariKnight <2557889+HikariKnight@users.noreply.github.com>
Date: Sat, 10 Aug 2024 09:11:03 +0200
Subject: [PATCH 3/7] chore: cleanup the readme
---
README.md | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 78b893e..46bfbaf 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ A project to simplify setting up GPU passthrough on your Linux host for libvirt/
You can use it by simply downloading the latest [release](https://github.com/HikariKnight/quickpassthrough/releases/) and run it inside a terminal or by downloading and compiling it yourself with the commands below.
-This project is aimed at **desktops with 2 GPUs** and **headless servers**, where the only GPU is not needed.
+This project is aimed at **systems with 2 GPUs** and **headless servers**, where the only GPU is not needed.
**Note:** Quickpassthrough is not designed to be installed by a package manager! As you would usually have to only run it once, unless you change the GPU.
@@ -47,16 +47,18 @@ go get -u ./cmd
CGO_ENABLED=0 go build -ldflags="-X github.com/HikariKnight/quickpassthrough/internal/version.Version=$(git rev-parse --short HEAD)" -o quickpassthrough cmd/main.go
```
-## Does this work on immutable systems?
-Currently no, however [Bazzite](https://bazzite.gg) has an `ujust` command that does a very similar job.
-In Bazzite you run `ujust setup-virtualization` and follow the prompts to `Enable Virtualization` and `Enable VFIO drivers`.
+## Does this work on atomic or immutable systems?
+Currently no, however [Bazzite](https://bazzite.gg), [Bluefin](https://projectbluefin.io) and [Aurora](https://getaurora.dev) has an `ujust` command that does a very similar job.
+
+In Bazzite you run `ujust setup-virtualization` and follow the prompts to `Enable Virtualization` and `Enable VFIO drivers`.
+In Bluefin and Aurora you run `ujust setup-vfio` and follow the prompts.
## How do I undo the changes?
There is a `backup/` folder generated on the first run that will have a copy of all your files (and their paths) from before we edited anything.
Compare that folder with the `config/` folder to see which files you need to delete in addition to copying the files from `backup/` to your system before rebuilding your initramfs and updating your bootloader config.
## How do I just disable vfio for 1 boot?
-Remove the vfio kernel arguments from your bootloader by pressing E on the boot menu. The kernel arguments added to the bootloader can be found in the config/kernel_args file.
+Remove the vfio kernel arguments from your bootloader by pressing E on the boot menu. The kernel arguments added to the bootloader can be found in the `config/kernel_args` file.
NOTE: You can also just remove them from your bootloader permanently and update your bootloader if you want to keep the config files on your system.
## What this project does NOT do
From 4f51fd5c5f0094b45d3d05589c62b7bd3bb46358 Mon Sep 17 00:00:00 2001
From: HikariKnight <2557889+HikariKnight@users.noreply.github.com>
Date: Sun, 8 Sep 2024 02:08:09 +0200
Subject: [PATCH 4/7] chore: remove outdated info from readme
---
README.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/README.md b/README.md
index 46bfbaf..e75085d 100644
--- a/README.md
+++ b/README.md
@@ -66,7 +66,6 @@ NOTE: You can also just remove them from your bootloader permanently and update
* Optimize your Virtual Machine for Passthrough (again this is your job)
* Optimize your host machine for Passthrough or Virtualization (out of this projects scope)
* Setup and configure GPU Passthrough on systems with 1 graphic card (iGPU counts as 1 Graphic Card by itself, so iGPU with another GPU will work)
-* Does not configure passthrough of 3D controllers, [as it will not work](https://lantian.pub/en/article/modify-computer/laptop-intel-nvidia-optimus-passthrough.lantian/) (this is most gaming laptops so do not even think about it). If you try run this on a laptop with a 3D controller, the "2nd GPU" will not show up.
## Contributing
From 276cfd953aad7a4f8f231e8fc17031195997d35b Mon Sep 17 00:00:00 2001
From: HikariKnight <2557889+HikariKnight@users.noreply.github.com>
Date: Sun, 29 Dec 2024 05:34:03 +0100
Subject: [PATCH 5/7] fix: correct vfio_pci to vfio-pci in rd.driver.pre for
dracut
---
internal/configs/config_dracut.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/internal/configs/config_dracut.go b/internal/configs/config_dracut.go
index 70f837e..1aa0f23 100644
--- a/internal/configs/config_dracut.go
+++ b/internal/configs/config_dracut.go
@@ -31,9 +31,9 @@ func Set_Dracut() {
kernel_args := fileio.ReadFile(config.Path.CMDLINE)
// If the kernel argument is not already in the file
- if !strings.Contains(kernel_args, "rd.driver.pre=vfio_pci") {
+ if !strings.Contains(kernel_args, "rd.driver.pre=vfio-pci") {
// Add to our kernel arguments file that vfio_pci should load early (dracut does this using kernel arguments)
- fileio.AppendContent(" rd.driver.pre=vfio_pci", config.Path.CMDLINE)
+ fileio.AppendContent(" rd.driver.pre=vfio-pci", config.Path.CMDLINE)
}
// Make a backup of dracutConf if there is one there
From 0efcf4ee19446bff0d3a5358244d5763ffc84980 Mon Sep 17 00:00:00 2001
From: HikariKnight <2557889+HikariKnight@users.noreply.github.com>
Date: Mon, 6 Jan 2025 14:15:45 +0100
Subject: [PATCH 6/7] fix(dracut): force load vfio modules earlier this should
make them load before any gpu drivers
---
internal/configs/config_dracut.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/internal/configs/config_dracut.go b/internal/configs/config_dracut.go
index 1aa0f23..bc0b503 100644
--- a/internal/configs/config_dracut.go
+++ b/internal/configs/config_dracut.go
@@ -22,10 +22,10 @@ func Set_Dracut() {
}
// Write to logger
- logger.Printf("Writing to %s:\nadd_drivers+=\" %s \"\n", dracutConf, strings.Join(vfio_modules(), " "))
+ logger.Printf("Writing to %s:\nforce_drivers+=\" %s \"\n", dracutConf, strings.Join(vfio_modules(), " "))
// Write the dracut config file
- fileio.AppendContent(fmt.Sprintf("add_drivers+=\" %s \"\n", strings.Join(vfio_modules(), " ")), dracutConf)
+ fileio.AppendContent(fmt.Sprintf("force_drivers+=\" %s \"\n", strings.Join(vfio_modules(), " ")), dracutConf)
// Get the current kernel arguments we have generated
kernel_args := fileio.ReadFile(config.Path.CMDLINE)
From c1f11ce1c3a656667c91913c7c97a279d958adbf Mon Sep 17 00:00:00 2001
From: jedrw
Date: Sun, 29 Dec 2024 18:54:20 +0000
Subject: [PATCH 7/7] fix: avoid potential index out of range error if ls-iommu
cannot find a vbios path
Signed-off-by: HikariKnight <2557889+HikariKnight@users.noreply.github.com>
---
internal/pages/03_vbios_extract.go | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/internal/pages/03_vbios_extract.go b/internal/pages/03_vbios_extract.go
index 598b584..44dcc04 100644
--- a/internal/pages/03_vbios_extract.go
+++ b/internal/pages/03_vbios_extract.go
@@ -26,9 +26,11 @@ func genVBIOS_dumper(config *configs.Config) {
scriptdir, _ = os.Getwd()
}
- // Get the vbios path and generate the vbios dumping script
- vbios_path := lsiommu.GetIOMMU("-g", "-i", config.Gpu_Group, "--rom")[0]
- configs.GenerateVBIOSDumper(vbios_path)
+ // Search for a vbios path and generate the vbios dumping script if found
+ vbios_paths := lsiommu.GetIOMMU("-g", "-i", config.Gpu_Group, "--rom")
+ if len(vbios_paths) != 0 {
+ configs.GenerateVBIOSDumper(vbios_paths[0])
+ }
// Make the qemu config folder
os.Mkdir(fmt.Sprintf("%s/%s", scriptdir, config.Path.QEMU), os.ModePerm)
@@ -51,7 +53,7 @@ func genVBIOS_dumper(config *configs.Config) {
"rom to the VM along with the card in order to get a functional passthrough.\n",
"In many cases you can find your vbios at https://www.techpowerup.com/vgabios/\n",
"\n",
- "You can also attempt to dump your own vbios from TTY using the script in\n",
+ "If we found a romfile for your GPU you can also attempt to dump your own vbios from TTY using the script in\n",
fmt.Sprintf("%s/utils/dump_vbios.sh\n", scriptdir),
"\n",
)