JimFritzMI wrote:All this work to find it will not work with my laptop. And I went the extra mile and spent money on one that had a separate GPU. I've come to realize it just doesn't bother anyone anymore that even now more and more hardware manufacturers are locking us into the Microsoft machine. Maybe it's time to wave the white flag and just embrace the borg...

I do not recommend anyone try this with a laptop. I assume the laptop has nvidia synergy (nvidia/intel). That is not recommended by myself or by Powerhouse who owns this article.

It worked for me by using seabios rather than ovmf. I also use pci_stub instead of vfio-pci to reserve my video card for qemu. Perhaps I can help you get it working. I can even do a Teamviewer session if you have the time. Provide me a way to contact you if you want help. If you do a friend request to "Linux Mint Survival Guides" (I prefer this one) or "Roger Lee Lawhorn" on facebook we can use facebook chat. Sorry, no cell phone, at least not with any minutes left.

The mint 18 ebook contains a chapter on this with my own insights and how I made this work on a laptop with Synergy.

Hello. I want to make dual-boot obsolete on my laptop(Dell Alienware 17 R3 with Integrated Intel HD 530 HD + Nvidia GeForce GTX 970M 3GB) using this tutorial. So far i had no luck using other tutorials that was based on Xen Project HVM. I am wondering why you dont recommend to try it with a laptop. Please, explain that to me and give me advice if possible(about installing HVM on laptop, not buying PC ).

bash64 already gave a good answer.

I like to add: it depends. You need to have a careful look at your hardware. First check the CPU that it supports VT-d - the i7-6700HQ looks good. But the real problem is Nvidia Optimus. For an explanation on what that means and how the Linux community tries to answer that issue, see Bumblebee.

Bumblebee is the Linux equivalent of Optimus, a technology that allows switching GPU depending on the graphics workload. In theory it sounds nice, in practice it has some caveats.

Before you try anything, BACK UP your entire disk so that you can restore your Windows or Linux when necessary!!!

When running Windows in a VM, you want Linux to use the HD530 graphics while Windows uses the Nvidia GPU. As a first step you need to turn off Optimus in your BIOS (or turn off switchable graphics) and/or select the internal graphics as primary graphics (the one use to boot the system). Then boot into Linux and follow the tutorial. The very first thing you probably want to check is that you can bind the Nvidia GPU to vfio-pci (see part 4 of the tutorial).

If you want to use your wireless connection, skip the network bridge configuration and do not configure networking in the qemu command. Qemu should automatically create a routed interface. As an alternative or when this fails, follow the advice of bash64 above.

If the tutorial and specifically the UEFI boot into Windows do not work for you, you can still try bash64's SeaBIOS approach. However, with Windows 10 you should be able to use UEFI.

In summary, you do NOT want Optimus or Bumblebee to interfere with your GPUs. After you have disabled Optimus in the BIOS and/or selected the internal graphics as primary graphics, you may need to reinstall Linux Mint or somehow disable Bumblebee. But before you even think about reinstalling Linux Mint, try to find answers to the following questions: how is your hardware wired inside? Does the Nvidia GPU have an external port you could hook to an external display? Are both the internal GPU and the Nvidia GPU wired to the laptop screen, with a button to switch between them? The answers to these will determine whether or not you can use your hardware for VGA passthrough.

Thank you for a great response. I have some result already, but i'm not satisfied with it: i received Code 43. From this point i have no clues what to do. And i would appreciate any help. I've seen info about this error somewhere, but i can't find where. I found answer on page 14. And it seems that i should bet on Win10 or try seaBIOS solution...

UPDATE: Win10 doesnt make any difference, so seaBIOS is my last option, but i couldn't find any good tutorials about it. Please, point me in the right direction.

- i managed to install Win8.1 and latest driver for NVIDIA card(it was detected by windows). But it doesn't work. - After boot in windows it says that device is not working properly. -> Code 43 =\ - In windows device manager i tried to Disable\Enable device and it says that device is working properly, but i can't o\p to monitor.(However, i did it qemu monitor).

1. Use -smp 6,sockets=1,cores=3,threads=2 \ in the qemu command. This way you won't assign all CPU resources to your VM. (I doubt this has any influence on code 43, but it's better to give the host enough resources to handle I/O etc.)

a. You installed the Windows 8.1 VM?b. Windows boots in UEFI mode (using the OVMF driver)?c. Once booted into Windows, you installed the Nvidia driver?d. When you boot Windows, the screen switches to the Windows screen? (Windows does not run in a qemu window?)e. The Nvidia card uses the Windows VGA driver, instead of the Nvidia driver? (There is a code 43 error displayed in device manager?)

In answer to your questions:

Q1 - about IOMMU group 1: the first entry 0000:00:01.0 is a root port, which you do NOT pass through!

Q2 - install Nvidia drivers: You must install the Nvidia driver in the Windows VM !!! You do NOT use the Nvidia driver on the host. Install Windows and reboot into the Windows VM. Go to the Nvidia website and download the utility to identify your GPU. Alternatively, select the correct card in the menus. Download and install the driver. If needed, reboot.

Hey powerhouse, thanks for the guide! I've followed through most of it, and now stuck at the very end. Hoping to get some help with my issue. I got the VM booted up, everything works fine kinda, until I installed the AMD drivers. It would boot but after a few seconds from the win10 login screen, the vm hangs.

I have a Ryzen system so I thought there might be something hardware-wise that is blocking. But I watched & read through Wendell's Ryzen video/guide you just posted, it doesn't seem there is much Ryzen specific changes other than npt/avic that needs to be catered for.

c. Once booted into Windows, you installed the Nvidia driver?- yes. Actually, windows have installed default driver for Nvidia, but I just updated it with newest one from nvidia site.

d. When you boot Windows, the screen switches to the Windows screen? (Windows does not run in a qemu window?)- I installed Windows and nvidia driver without “vga none, nographic” option and after that I started VM with vga none option. I waited for 10 or more minutes, but nothing changed – screen is black. So, yes, I have only qemu window which is Microsoft Basic Display Adapter.

e. The Nvidia card uses the Windows VGA driver, instead of the Nvidia driver? (There is a code 43 error displayed in device manager)?- yes, there is Code 43 error and NVIDIA card is disabled. But it should use newly installed nvidia driver(v384.76).

I have tried to boot with custom ROM that have UEFI, but still no success.

Q1(if I’ll solve the problem). If I start VM without “-vga none -nographic” flags, will my NVIDIA card be working in VM. I mean could I use both default and HDMI screens? Or if i’ll start VM with enabled VNC will NVIDIA card be working?

Q2. When I use custom ROM do I need to re-install card drivers? And how can I check that rom was loaded successfully?

@diabolusss: I'm afraid I have little to no experience with loading drivers. But back to the basics:

1. Without the "vga none, nographic" Windows sees another screen, this time a virtual screen and provides a simple VGA driver for it. It has nothing to do with the Nvidia card.

2. Make sure that you have the correct UEFI driver for your card. You need to find out your exact make and model (please share here), with the correct memory size. I've seen 6GB versions of the 980M that have UEFI drivers whereas the 3GB versions didn't support UEFI.

3. When you boot the VM without "vga none,..." and you get a qemu window, does the device manager show 2 separate graphics displays? A VGA graphics and the Nvidia graphics (with the error triangle)?

4. Are you using the laptop display or have you connected an external display?

5. When you boot the laptop and check the dmesg contents for vfio-pci messages, you get "invalid ROM contents"? What happens when you boot the VM? Is it correct that your started the VM and only then retrieved the ROM contents to check for UEFI capabilities?

In my opinion there are 2 possible scenarios that explain what you see:

I. Windows VM boots in UEFI mode and passthrough works. The only problem is that the output of the Nvidia GPU is not to the screen you use/have connected. Try to hook up an external screen to the HDMI or whatever output(s). See if there are soft switches on the keyboard that allow you to switch between internal and external screen and try them.However, the same phenomenon could also have to do with the laptop and the fact it uses Nvidia Optimus and there might not be a workaround.The best option to try now is to not use UEFI boot, but the Seabios option. In that case you do not use the OVMF driver. See further up, I think bash64 posted an example for the qemu command. You can also follow the link to the Arch Linux forum that I posted in my how-to. You'll see that Seabios is even simpler. The possible caveat with Seabios is that you may have to patch your Linux kernel with the VGA arbiter patch. But let's go one step at a time.

II. The Windows VM hangs at the UEFI boot, probably because of the graphics card respectively the UEFI bios that doesn't work with your card. Try the Seabios option (see above).

In answer to your questions:

Q1: Yes. You should see two graphics devices in your Windows device manager - 1 VGA device (the emulated device shown in the qemu window) and 1 Nvidia GPU. When everything works as it should, Windows should switch to the Nvidia GPU.

Q2: I don't know, but possibly you have to reinstal the GPU driver. I don't have the answer to the second question, but please search the internet as this is indeed a crutial question.

Q3: Make sure you got the correct GPU BIOS. There are differences from manufacturer to manufacturer, and from model to model. If you can't find a 100% matching UEFI driver, go the Seabios way as suggested above.

@procabiac: Try to only install the AMD GPU driver, not the whole package. It has been reported that the control center or whatever it's called can cause problems.

If that doesn't help, see and try to follow the how-to in the link I posted. Of course you need to get the 4.11 kernel (I have 4.10). In the video he explains that the latest kernel is required. Go to the kernel sources and check for the changelog. You may find some notes related to AMD and perhaps Ryzen.

Tomorrow I hope to have a better look at your post, but now I need to get going. Good luck!

2. What actually do you mean by "make and ..."? - I suppose model is by DELL, it's 3Gb and signed Bioses doesn't support UEFI, but unsigned does, so i'm trying them. Is it safe to check different bioses even if they aren't supposed for this card?

3. When you boot the VM without "vga none,..." and you get a qemu window, does the device manager show 2 separate graphics displays? A VGA graphics and the Nvidia graphics (with the error triangle)? - yes, exactly.

4. Are you using the laptop display or have you connected an external display? - I connected external display to HDMI port which is exclusively owned by nvidia card.

5. When you boot the laptop and check the dmesg contents for vfio-pci messages, you get "invalid ROM contents"? What happens when you boot the VM? Is it correct that your started the VM and only then retrieved the ROM contents to check for UEFI capabilities? - I receive “invalid ROM contents” only when I try to read it contents if it’s not loaded by VM. After I launch VM with VGA enabled(i.e. I have default qemu window) I can read it contents successfully. If I shutdown VM I receive this error again.

There exist soft switch on keyboard, but it dont work. When I hit it I receive errors in dmesg:

So , I suppose I need to patch kernel, but I don’t know how to do that.. I tried to patch my current kernel(Linux Mint 18 4.4.0-21-generic) using this tutorial:http://kvm-exp.blogspot.com/2015/06/how ... biter.html, but It’s said nothing to patch. I suppose I need another kernel, i.e. like in tutorial linux-3.16.7?

I patched Nvidia driver using your tutorial, but it doesnt helped neither.

Before patching, check if you can upgrade to a newer kernel. I'm running Linux Mint 18.1 with kernel 4.10.0-26-generic x86_64.

Click the Update Manager, then select View --> Linux kernels. Do you see any 4.8 and 4.10 kernels? If yes, select a recent 4.10 kernel and install. Reboot and see if that helps.

Also, post the IOMMU groups using the small script from my post above.

EDIT: I might be wrong, but I believe it has to do with the UEFI BIOS not matching your actual video card.

The steps I'd do now, in the following order, are:

1. Upgrade kernel to the latest 4.10 kernel.2. Check and recheck that you got the right UEFI enabled BIOS for YOUR graphics card.3. To my knowledge, it's enough to load the UEFI BIOS at VM boot, but I might be mistaken. Search and look for users with the same issue and how they solved it. If I'm wrong, you might need to flash your graphics card BIOS, something that should be done with utmost caution (and only after you backed up the original BIOS). If that is what's needed, then first try Seabios.4. If none of the above helps, reinstall Windows using Seabios.

When you use Seabios, do NOT use the UEFI BIOS! Remove the BIOS location. Also, remove the lines:

@diabolusss: With "make" I mean the manufacturer of your graphics card. I posted a link to techpowerup that lists the known makes and models, together with the UEFI support. Under Linux, lspci -vv should should list all the information needed.

I found UEFI capable BIOS at techpowerup under unverified uploads. (they should add BIOS filter parameter ). It seems that I’ll try them all one by one...Ok, i’m doing full system upgrade now. I have installed the latest kernel which is by now 4.10.0-26.Well, I have to believe in something and I share your belief, moreover it would work finally. But I don’t want to brick GPU, so I wouldn’t flash its BIOS… Meanwhile, I have installed Windows with Seabios on other image and I know now that I need to patch kernel, but I found, I think, working patch only for kernel 4.2.5, so I am downloading now Linux Mint 17.I have deleted default qemu, which was v2.5, and installed new one from sources, which is v2.9, and I can’t passthrough usb mouse now. Everything else is working fine.

UPDATE1:While testing different rom's from techpowerup in VM i found in device driver info my GPU Subsystem id, which is 1028 0708.(Actually i could get it using command lspci -vvn, This IGD and 3D shares the same sub_id)Q1. Loaded custom ROM should override this value or not? Or custom ROM SUB_ID must exactly match real GRU SUB_ID?(I believe DEV_ID should)

powerhouse wrote:@procabiac: Try to only install the AMD GPU driver, not the whole package. It has been reported that the control center or whatever it's called can cause problems.

Hey powerhouse, thanks for getting back to me. I managed to redo the guide in Mint 18.2, using qemu 2.6.x from the Jacob ppa (a must for AMD [edit - I mean AMD CPUs], there's a bug in 2.5.0), and using the 4.12 Kernel (I was on 4.11.5 previously). I installed the GPU drivers via Windows Update this time (instead of a simple install or the Windows Driver Update method), and it worked!

Unfortunately, I don't know what the issue was. I also had other weird issues like Windows only picking up 1 cpu core (despite seeing 8 in device manager) and thought it was a license issue. The new install now sees all 8 virtual cores.

@procabiac: Thanks for your feedback. I don't have a AMD card at my disposal now, so I can't test. This is why your advice about the bug in Qemu 2.5 and the need to use a later version is so valuable. The moment I have some time I will update my tutorial.

Would you be able to run some benchmarks and post them in the dedicated thread (see end of my tutorial)? Thanks!

@diabolusss: Thanks for sharing all the information. To me it looks like a graphics BIOS issue. Since you have tried all options using UEFI boot, except for flashing the GPU BIOS (a thing I wouldn't do unless I were 100% sure of what I'm doing), there is one last option I believe you haven't tried: Seabios.

Instead of booting the OVMF code, use the traditional way as I pointed out (or see bash64). You'll need to reinstall Windows. Keep the latest kernel and qemu as this might solve some issues. I haven't checked if the latest kernel includes the VGA arbitration patch, but I doubt. But perhaps the problem has been solved on the Intel driver side (I need to read up on that, haven't had much time lately).If you can't get it to work, check out the VGA arbiter patch.Note: UEFI boot does not require the VGA arbitration patch.

powerhouse wrote:@procabiac: Thanks for your feedback. I don't have a AMD card at my disposal now, so I can't test. This is why your advice about the bug in Qemu 2.5 and the need to use a later version is so valuable. The moment I have some time I will update my tutorial.

Would you be able to run some benchmarks and post them in the dedicated thread (see end of my tutorial)? Thanks!

My Benchmarks posted. I still have work to do in order to improve the performance. There's a quirk with the Ryzen CPU - it's kinda like two 4-core CPUs glued together. I think I have to pin only the threads that all belong in one of those 4-cores to improve performance. RAM speed also affects Ryzen, I need to OC the RAM to its XMP profile eventually... Also don't know why my GPU benches 30% lower (seems quite a lot), but it might be bottlenecked by the CPU.

But for now it's very passable, enough to play the not-so-demanding games.

powerhouse wrote:@procabiac: Thanks for your feedback. I don't have a AMD card at my disposal now, so I can't test. This is why your advice about the bug in Qemu 2.5 and the need to use a later version is so valuable. The moment I have some time I will update my tutorial.

Would you be able to run some benchmarks and post them in the dedicated thread (see end of my tutorial)? Thanks!

My Benchmarks posted. I still have work to do in order to improve the performance. There's a quirk with the Ryzen CPU - it's kinda like two 4-core CPUs glued together. I think I have to pin only the threads that all belong in one of those 4-cores to improve performance. RAM speed also affects Ryzen, I need to OC the RAM to its XMP profile eventually... Also don't know why my GPU benches 30% lower (seems quite a lot), but it might be bottlenecked by the CPU.

But for now it's very passable, enough to play the not-so-demanding games.