/ppg/ - PCI Passthrough General

Thread died before I could ask my question edition

PROBLEM: You enjoy a nice spot of vidya every now and then, but Linux and vidya is like Apple and being straight.

SOLUTION: PCI Passthrough! Modern linux kernels have builtin drivers and virtualization tools that allow you to give a Windows VM raw access to your hardware, giving you near-native performance while isolating the Windows botnet to a locked-down VM that you only use for vidya.

>Guide
wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF

>Tl;dr what you need
* A reasonably new motherboard and CPU. The motherboard and CPU both must be aware of Intel VT-D or AMD-Vi depending on who you'd rather give your shekels to. LOOK UP YOUR HARDWARE FIRST. Don't guess.

* A modern Linux. Arch works, Fedora works, Ubuntu works. Others may work, but the more you try to be a neckbeard with your OS selection, the more trouble you're going to have setting this up.

* A copy of Windows

* A few hours to kill on a weekend

* No fear of the command line

Ask any questions or report any problems here.

Previous thread

Other urls found in this thread:

amazon.com/gp/product/B0042G49XM/ref=s9_acsd_newrz_hd_bw_bwfoh_c_x_w/146-1640436-3841933?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=merchandised-search-3&pf_rd_r=WDNX9D6QD076623PQR0S&pf_rd_t=101&pf_rd_p=fcae4663-1ca7-5bc2-8e46-f2317481a72c&pf_rd_i=13983771
twitter.com/NSFWRedditImage

Will follow this thread.
Any thinkpadfags who tried this?

So, does this method allow the use of a VM manager like VmWare or Virtualbox? Or do you have to manage this shit from the commandline? By manage, I mean configure the VM, launch, etc.

>near-native performance
so, why do this instead of a dualboot for the full performance without having to have a second gpu?

>oh no i have to reboot
takes like 15 seconds max with an ssd

>windows malware will fuck my system/spy on me
windows can't even read your ext4 partition

the only thing i can think of is that you don't have to interrupt your work by rebooting. don't get me wrong, it's cool that this works and everything, but i don't see any major benefits that justify the time spent to set this up. in the end you're still using windows.

>but Linux and vidya is like Apple and being straight.
kek

You can use virt-manager as a front end honestly the "no fear of the command line" is kinda bs for the most part your just copy pasting commands from the arch wiki. If you don't want to install Arch Antergros is almost the same thing as Arch with a GUI installer.

>so, why do this instead of a dualboot
One immediately obvious benefit is the ability to clone your system.Which is great for portability, as well as backing up.

>* A reasonably new motherboard and CPU. The motherboard and CPU both must be aware of Intel VT-D or AMD-Vi depending on who you'd rather give your shekels to. LOOK UP YOUR HARDWARE FIRST. Don't guess.
What does "reasonably modern" mean? My 2008 X58 CPU has VT-d.

On Antergos after setting up /etc/modprobe.d/vfio.conf and /etc/mkinitcpio.conf and regenerating the initramfs by running mkinitcpio rhen rebooting $ dmesg | grep -i vfio returns nothing and lspci -nnk -d dosen't renturn the vfio drivers I made sure iommu and virtulazation is enabled as well as make vfio is installed

I'm following the Arch wiki guide btw

You have to check if your cpu mobo and gpu rom support virtulzaton, IOMMU, and UEFI resepectvley any GPU past 2012 should support UEFI and I'm sure others before that also support it just look up your hardware and make sure you have all the reguirments

Does this work in a plausible fashion with SLI (i.e. no huge issues, very similar performance and no major annoyances)? Does it have any drawbacks for VR, such as increased latency or other performance issues? With what granularity and performance can you pass USB 3.0 ports through if the mobo only has 1 controller? Will I be able to give Windows like 8 ports (4 for Rift, mouse/kb, DAC, monitor USB hub) and keep the rest for Linux? Has anyone tested USB 3.0 performance? Rift sensors are picky as fuck and often won't operate full speed over minor things.

I'll be aiming for 4K 120-144Hz when the monitors come out and I have a Rift, so that's why I want SLI and why I'm interested in USB 3.0 passthrough and performance.

Okay so this was before or after Intel and Linux patches that fuck up vm performance?

>Does this work in a plausible fashion with SLI
Sadly I don't think so, nVidia requires you to use a Chipset that has been licensed to use SLI and the vitalized chipsets don't allow such a feature maybe some day but not for now
>Okay so this was before or after Intel and Linux patches that fuck up vm performance?
Meltdown/Specure didn't fuck up VM performance it just made security through isolation null

>nVidia requires you to use a Chipset that has been licensed to use SLI and the vitalized chipsets don't allow such a feature
Yeah I was afraid of something like that. Too bad since 1 card very likely won't be meeting my performance needs unless NVIDIA releases some miracle GPU (since AMD apparently won't be releasing anything at all this year).

My GPU does but I have no idea if X58 supports IOMMU.

Read the enabling IOMMU part on the arch wiki if you can get that working than your good to go

Will I be able to use a single GPU and mouse/keyboard for host and guest any time soon? is work being done towards that?

>Will I be able to use a single GPU and mouse/keyboard for host and guest any time soon?
For GPU no for mouse and key bored a KVM switch, multi device Bluetooth mice/keybored or synergy will work (note you have to buy synergy and it's closed source it also adds input lag)

KVM switch?

for me its mostly about not breaking my workflow. I enjoy playing a quick game of Gwent (card game) while taking a break from my work but i never do because i would have to close everything, and reboot into windows just to play a 5 minute match...

The tech required for GPU virtualization in the style you want already exists and is very likely used in enterprise setups, but I don't think it's available to us common plebs on consumer GPUs. IIRC what you're looking for is SR-IOV.

I don’t like the idea of Microsoft having unmoderated control of my system. With this, I keep a tight leash on Windows, I stay in full control of my machine at all times.

Depends on your motherboard, some have wonky issues.

Hey I'm the guy that started the first one, thanks for keeping it going!

You should definitely see a blurb in dmesg if the drivers were loaded even if they didn't do anything.

Stupid question, are you sure that when you rebuilt the initramfs that it was pointed at the kernel you were running on, and than you're booted into the same one? Try running the commands again to be sure.

I can't speak to SLI - I'd imagine that impacts how you configure what PCI devices passed through, but I don't know how.

VR Just Werks. I noticed no additional latency or slowdowns with my Vive.

Ports: Not a lot. My box has a separate USB PCI card which is what I use for the virtual crap. You can also just give the VM individual USB devices in virt-manager rather than the controller, but that may have latency issues.

USB3 works at its usual speed as far as I can tell.

Probably not with any speed. The breakthrough here is being able to run your "good" GPU with no/negligible performance loss, and most of that comes through the host's abstraction layer which you get rid of in this process.

True VM gaming still isn't a thing unfortunately.

This. Even if you have a machine that can reboot in 10 seconds (liar), there's a very nice benefit to not having your state destroyed. Swapping monitor outputs is literally the only downtime.

When you guys talk about the integrated GPU for the host system do you mean the integrated GPU that comes with the motherboard? when I shutdown the windows guest can I "return" to my good GPU on the host or just rebooting/reconfiguring the thing?

honestly once you get it setup right you can make a script that refrences the two you need to start it up sym link that in /bin and start it with a single command at that point a gui of anyk8nd will seem cumbersome

Yes, the one that's part of the CPU.

If you want your main (not-integrated) GPU usable on the host, you have to reconfigure and reboot, since what you're basically doing is telling the kernel to pretend that device doesn't exist so the VM can claim it later.

Meh I thought I'd be able to use my dedicated GPU on linux for linux games and then open the windows shit for windows-only games if I wanted smoothly without rebooting

So the GPU isn't shared, you have one per OS, yes?

I've done it with an expresscard and eGPU. That said, it's easier to setup with a desktop and a second graphics card (or integrated graphics + dedicated graphics card).

I keep one windows vm for legit purchased games on steam and another for sketchy pirated stuff.

>Tl;dr what you need
>AMD-V, Linux, Windows, time

Uh, you're missing these:
Two GPUs
An additional mouse and keyboard (or Synergy/equivalent solution).
An entire additional monitor.

Yeah, however I think it's now possible to actually dynamically detach and reattach GPUs to the host, so you can have a low end card attached to the host and then run the high end card with PRIME when the VM is off. I haven't tried it personally, though.

>An entire additional monitor.
or one monitor with multiple inputs, AKA basically any monitor

if im honest im not sure how this is better than dual booting

IOMMU fag here.

>Asus Sabertooth 990FX
>AMD FX 8350
>24GB Memory
>shitloads of SSDs
>GTX 980
>Radeon hd3450
>Intel Gigabit PCI Express NIC

I forward the GPU and the Intel NIC to the Win 10 Guest and I only ever actually use the Win 10 Guest. Host is essentially a file server and a torrent box, I can't be arsed to use two different computers and I also miss some GNU tools, too. I just SSH to the host and things are good.

IOMMU life is the comfy life.

It's important for people to be aware that they will have the experience of using two monitors (i.e. it's not integrated into your desktop) and I've certainly encountered monitors without two not-shit inputs.

>jewtel K CPUs don't have VT-D
REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

they do i know mine does

The archlinux instructions have been known wrong for years. In particular it mixes up boot-gpu and non-boot gpu instructions and use parameters that don't mean what they say it means, which can result in hosing the host depending on hardware.

The real benefit to GPU passthrough is disposable Windows instances.

I don't have to worry about what I'm installing on Windows anymore nearly as much- seedy cracks or keygens? Whatever. Any bad shit packaged with them might run while I'm playing the game, then it's stopped when I stop playing. When I'm done with the game, I can copy the save file out manually to archive and destroy the whole VM.

I have a VM just for Steam shit, and another just for Oculus shit. I have one for each pirated game I want to play. I have one for any useful Windows-only applications I want to use still. It's excellent to put a leash on this shit.

Tell me more

But do you need an extra windows installation occupying space for each one of them?

Qemu can do event passthrough (enable it and press both control keys to switch input control between host and guest), not even a need for synergy. The host gpu can be an integrated gpu, which all modern cpus come with.

Use any copy-on-write storage format (qcow2, LVM snapshots, etc) for the underlying system image to create a base image containing the Windows install. When you want a new instance, create a new image or snapshot based on this 'base' Windows install, then only the deviations between your standard image and your split image will consume storage space.

You could have 100 Windows installs take the space of 1 install, plus any changes you make from the base image in each one.

I do that and it works fine. Basically you take the arch vfio-unbind script and modprobe your card's driver and everything just werks. Since the gpu is only in use when you use bumblebee or equivalent, you can easily rmmod and vfio-bind afterward.

How is that part of the CPU if it's in the motherboard

Synergy itself is open source, it's just not as easy to get it for Windows now with whatever the hell the devs are doing now. I think v1.6 or something you can still get free and easy and I've never noticed lag. Between windows and Linux however I've had to remap the mouse buttons to get front and back working.

so basically a wine bottle

enjoy wasting a week getting this shit to barely work when you can just dual boot like a normal person. of course linux users and archtards in particular have nothing better to do with their time anyways. best of all the largest source of info for gpu passthrough was a thread on the arch forums which was locked by their own butthurt mods kek

>i have a separate VM for every app for no fucking reason

linux autism case study right here

Dual booting means having to reset your PC to use the other OS. Even if it takes less than 1 second it still kills your workflow and denies you access to other OSs software. So, if I'm chatting, listening to music, watching a movie, shopping or developing on my Linux and want to do something on windows even for a minute I'd have to fully stop everything I'm doing on Linux. This isn't acceptable.
Also, for whatever reason when I reboot the system into windows coming from Linux windows doesn't have access to any of my USB ports so I have to reboot it twice to get it to work.
>can't read ext4
It can format it.
>malware
You can control the maliciousness of windows much easier if it's contained in a VM, making your PC and windows less vulnerable.

>enjoy wasting a week getting this shit to barely work
Works perfectly on my machine. I suppose you think the grapes are sour.

Sure, but with actual compatibility and without giving the programs access to your real system.

I understand it might be a challenging concept for you that takes a long time to digest, but it's really not that complicated for those of us that aren't idiots.

>every app
No- I see you have some reading comprehension issues too. One for Steam shit (main gaming VM), one for Oculus shit (since it requires different 'hardware' configuration), and one for any seedy pirated software that I don't want to have access to my shit but still want to run.

Isolating malware, creating different hardware profiles for different needs, without having to shut down my main work shit? Yeah, no benefits at all.

So I can throw my 5770 next to my 980 Ti and it will work?

I'm unaware of iGPU's that are part of motherboards. The motherboard has the video out obviously, but the actual GPU lives on the processor.

I bet you're the contrarian faggot from the last thread.

>wasting a week
>barely work

Know how I know you're both computer illiterate *and* have never done this?

Pretty much! In fact, that's the preferred way to do it, since if you have two identical cards, you get to jump through an extra hoop or two to differentiate one from the other in the kernel.

They stopped doing that faggotry at least in the 7th gen. I've got a 7700K and it werks.

Kernal Virtual Machine switch something like this
amazon.com/gp/product/B0042G49XM/ref=s9_acsd_newrz_hd_bw_bwfoh_c_x_w/146-1640436-3841933?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=merchandised-search-3&pf_rd_r=WDNX9D6QD076623PQR0S&pf_rd_t=101&pf_rd_p=fcae4663-1ca7-5bc2-8e46-f2317481a72c&pf_rd_i=13983771

>Hardware support (most people understand that Windows 10 is a pile of shit that should be avoided)
>Manageability
Once you have it working, it's far more practical than dual booting.

>im too retarded to set it up therefore it's shit