Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c1f11ce1c3 | ||
![]() |
0efcf4ee19 | ||
![]() |
276cfd953a | ||
![]() |
4f51fd5c5f | ||
![]() |
05afa8c543 | ||
![]() |
d1e44d94d5 | ||
![]() |
3f934351fc |
5 changed files with 20 additions and 16 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -6,4 +6,5 @@ bin/
|
|||
dist/
|
||||
main
|
||||
quickpassthrough
|
||||
debug.log
|
||||
debug.log
|
||||
quickpassthrough_debug.log
|
||||
|
|
13
README.md
13
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`.<br>
|
||||
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. <br>
|
||||
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. <br>
|
||||
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
|
||||
|
@ -64,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
|
||||
<img src="https://user-images.githubusercontent.com/2557889/156038229-4e70352f-9182-4474-8e32-d14d3ad67566.png" width="250px">
|
||||
|
|
|
@ -22,18 +22,18 @@ 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)
|
||||
|
||||
// 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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue