Weather Refresh
Oops, No Weather For Now!

Hi, this is Guilherme Suzuki speaking! I'm 34 years old and have been working with information technology since 2003.

Specialized in Microsoft programming languages and tools, I'm also very fond of the Linux world, having worked in projects involving the platform.

I really hope you enjoy this new website and its content, not only IT-related stuff.

+1 (647) 781 7390

Gaming on a Virtual Machine: Part 1 - The Hardware

In this post I talk about the hardware requirements for gaming on a virtual machine.
  • Gaming on a Virtual Machine: Part 1 - The Hardware

Hi Folks! This will start a series of posts related to gaming virtual machines, taking advantage of Intel VT-d compatible hardware and using the Fedora 24 Workstation as the host operating system. Windows 10 version 1607 will be later on installed as the virtual machine OS.

Thanks to Alex Williamson from Red Hat! He's the one responsible for developing and improving the fedora's kernel, making this whole thing possible. Here's a link to his blog and the guide material for this how to.

First, let's go through the hardware I have and some considerations. The graphics card I have been using is a Geforce GTX 1070 from ASUS, the TURBO model with 8GB of GDDR5. If you have another graphics card, a Radeon for example, just make sure that it's PCIe 3.0 compatible and it supports UEFI, because we will use KVM (Kernel Virtual Machines) with OVMF (Open Virtual Machine Firmware) as the emulated BIOS for the vm. 

OVMF will allow us to POST the VM directly in the GPU, eliminating the need for an emulated graphics card in the virtual machine only for that step. If you are familiar with PCI passthrough back in the days or you read this series (xen + pci passthrough), you know what I am talking about. The difference with today's method is huge: we no longer need to worry about extracting the BIOS definitions from the GPUs or be concerned whether the VM can restart or not without crashing the whole system.

Geforce 1070 Turbo with 8GB of GDDR5 from Asus

Make sure to install the GPU for the VM in the first PCIe slot. In case you have more than 2 GPUs (one for the Linux host and another for the Windows VM), I would suggest to take the other ones off your PC temporarily, while trying to replicate this how to. The Window Manager from Fedora, the X11, is very sensitive when it comes to multiple GPU configurations (hanging on boot or not initializing properly).

Next component we will take a look at is the motherboard itself, which needs to be compatible with and BIOS enabled for intel vt-d. Without this feature, you won't be able to pass-through the graphics card to a virtual machine from your fedora. The one I am using is an ASUS Z170-P D3 with a BIOS version 1801.

The reason why I chose an LGA 1151 motherboard is because of the CPU. Several skylake CPUs come with onboard graphics (it will be used by your fedora)... remember, your GPU will be off for virtualization since the beginning, so it's crucial to have a dedicated graphics unit to access your linux. If the hardware you have does fulfill the requirements to proceed, but your CPU doesn't come with onboard graphics, you would have to buy a lame PCI graphics card and setup your system to use it as the primary graphics card.

I strongly recommend a BIOS update for your MB, if you are not running the latest one. Just be careful and do some research about the version you will be updating your equipment to.

The Motherboard

Last, but not least, is the CPU. The one I have been using is an i7 6700K, also supporting Intel VT-d. I am not sure about other models of CPUs, if this will work whether them supporting or not supporting Intel VT-d. TBH, this is a gray area for me.

If you were successful with a different hardware setup, especially with your GPU and CPU, don't hesitate to leave a comment. You will be welcome!

i7 6700K (Intel VT-d enabled)

The amount of RAM I would recommend is 16GB, although my system has been running with 32GB of DDR3. The virtual machine needs 8GB of memory at least, so we can game on it. Just make sure you have at least 4GB of RAM remaining for your fedora.

Setting up the BIOS for starters

Now, we have to configure our system and set the CPU graphics prior to the powerful one we will pass-through. Turn on your PC and go straight to the BIOS. For this particular motherboard, I open the Advanced options and then System Agent (SA) configuration. As you can see in the following image, the hardware supports VT-d and it can be activated.

Enabling Intel VT-d

Next, make sure Intel Virtualization Technology is also enabled and the CPU graphics is set as the Primary Display.

CPU graphics

Save the new settings and be prepared for the next step!

The peripherals

Although not mandatory, I would recommend a second monitor just for the VM and a separate set of keyboard and mouse (we will dedicate an entire USB controller and its ports to the VM in the host preparation, so we can plug-n-play devices more conveniently). In the end, the PC will look like a 2-in-1 setup when ready.

For better performance, consider a dedicated SSD drive with enough space for your host OS and the image that is going to hold our VM's filesystem (256GB should be enough).

hmmmm... it looks like 2 PCs

So, the next step will be host preparation, how to configure fedora and use a kernel module called VFIO-PCI to take over the GPU early in the boot. Stay tuned!

What about AMD hardware?

Well, AMD hardware are up to the challenge when it comes to this kind of virtualization method once they support the same features. There are some differences though when preparing the host along with the Linux OS, but out of the scope of this how to (for the sake of "I don't have the hardware to test it out").