Stuck on PCI passthrough with virtualbox

Sooo I thought I would try my hand at making a virtual machine for gaming.

Right now I have a i7 5930K, an asus x99-a, openSUSE 13.2 running virtual box with windows 8.1, and a GT630 with a GTX660 that I would like to pass through. All of my hardware should work.

Here is what I have done.

I enabled virtualization in the bios (it said intel virtualization, and I am assuming it means VT-D).

I have installed virtual box, and made a virtual drive for windows 8.1. I have VT-X and AMD-V enabled.

The only thing I have not done is enable IOMMU in the linux kernel. I have read that you need to edit grub.conf, but I can not find that file. I also read that there is a decent chance it is enabled by default anyways. Soooooooo meh.

At this point I have hit a brick wall. All of the information on how to do this is with KVM/Xen. I might work up the courage to give KVM a shot, but it would be really nice if I could get this to work.

Here is the information I am given...

The first column is a PCI address (in format bus:device.function). This address could be used to identify the device for further operations. For example, to attach a PCI network controller on the system listed above to the second PCI bus in the guest, as device 5, function 0, use the following command:

VBoxManage modifyvm "VM name" --pciattach 02:00.0@01:05.0
To detach same device, use

VBoxManage modifyvm "VM name" --pcidetach 02:00.0
Please note that both host and guest could freely assign a different PCI address to the card attached during runtime, so those addresses only apply to the address of the card at the moment of attachment (host), and during BIOS PCI init (guest).

So fine, I do lspci and I find out that my gpu is 02:00.0 just like the example says.

I also know that the VM's name is "Windows 8.1".

So according to the example, all I should have to do at this point is type in "VBoxManage modifyvm Windows 8.1 --pciattach 02:00.0@.............." and I should be good to go (hopefully....probably not).

Well the part I do not get is the @XX:XX.X part. What am I supposed to put in here? What does this command even do for that matter?

If someone could give me some help, that would be great.

You can set kernel options in Yast.

thanks for replying. Could you be a little more specific though? I am afraid I am going to ruin my nice pretty installation. : P

I assume you want me to go to boot loader, then kernel parameters, and then add IOMMU=on to either the optional command line boot options or the failsafe one, but I am not sure.

You can't do pci passthrough.
K sku intel cpus' cannot do pci passthrough because they do not have vt-d instead they have vt-x

Not always true, it is a case by case situation.

Mine indeed does support VT-D, and so do the rest of the X99 chips.

here is the 5820K

The 5930K

And the 5960X


Where things start to get weird is the i7 4770K does not have vt-d but the 4790K does.

They added it on the refresh.

And yes, add that to the kernel parameters.

Cool, done and rebooted without any issues.

Where do I go from here?

Find a Windows ISO I guess. I think VB can also read from host dvd drives so you could use a dvd install.

I already did all that. It is even updated and has all the right drivers.

With the exception of the IOMMU thing, I am pretty much ready to shove my GPU into the VM. I just do not know how. : P

I've done something similar with KVM. First have a look at this thread: https://bbs.archlinux.org/viewtopic.php?id=162768. And maybe this too: http://www.reddit.com/r/linuxmasterrace/comments/2z30dq/gpu_passthrough_or_how_to_play_any_game_at_near/.

I know they're about KVM but the kernel and boot stuff should still apply. Something that you may see in that thread is the Intel specific patches. I'm not sure if they're required (I have an AMD CPU) but I'd have a look a look into it.

That's the bus/device ID that the VM will see. The first to Xs are the bus ID, the second Xs are the device ID and the third is the function ID. I'm not 100% what the function ID is but I've seen it used for the sound on my card.

You'll need this to add a PCI stub (as described in posts I linked). Basically the PCI stub stops other drivers from registering the device. grub.conf should be located in /boot/grub/. You could also be using syslinux (another boot loader) and that's config file is located in /boot/syslinux/ and should be called syslinux.cfg.

The KVM route isn't all too hard once it's working. The setup can be a little tough if you're a beginner. But once it's working, it's working.

My issues with KVM (and I might be misunderstanding this) is not the work. I can sit here and punch in commands all day long.

My concern is the end result. I am trying to get away with using seamless mode along with auto hiding the windows tool bar.

My goal is to be able to have my gnome desktop look 100% normal and be able to simply hit the right hand windows key to launch the start menu so that I can play steam games.

That is all I want/need, and I do not think that is possible with KVM (although I could be wrong).


BTW, no grub.conf, and no syslinux.

KVM is a virtualization module, and conflicts with VirtualBox. You have to pick one. Neither will let you do seamless windows when you are doing VGA passthrough of a graphics card. You are passing through a separate graphics card, so you have to plug a monitor in to that card. Either use different inputs on the same monitor and switch inputs to go between the VM and the host, or use separate monitors.

What I don't see mentioned in this thread is that you have to blacklist the card you will be passing through in the host, so that it doesn't grab the gpu. You will have to give the PCI IDs of the card to pci-stub. I don't use openSUSE so hopefully you can figure out the specifics of how to achieve this on your own, but the high-level overview of the process is this: Make sure the pci-stub module is in your initrd image, and assign the graphics card to the pci-stub module by adding this to your bootloader command line (substituting the correct IDs of course) pci-stub.ids=1002:6719,1002:aa80

This thread on the Arch forum might help you a bit if you need more info on the pci-stub bit: https://bbs.archlinux.org/viewtopic.php?id=162768

If you want to hand edit your grub config, take a look in /etc/default/grub and edit there. You should update the grub config after editing this file. The command is mentioned in the comments of the /etc/default/grub, and should be something like grub2-mkconfig -o /boot/grub2/grub.cfg