Windows + Linux and Xen

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Quirken
Level 1
Level 1
Posts: 26
Joined: Sat Nov 13, 2010 8:42 am

Windows + Linux and Xen

Post by Quirken »

I only have one graphics card; I'd like to do VGA passthrough to Windows, and then run an X server on windows and connect back to dom0.

It's a little ass-backwards, but I don't see why it shouldn't work. Problem is, I have no idea how to do it. (I know it can be done, as it's mentioned here: http://www.overclock.net/t/1205216/guid ... al-machine but without very detailed directions).

Any idea?

(If anyone is curious, I found a guide here: http://linux-bsd-sharing.blogspot.com/2 ... -with.html but I never got it past giving me a black screen)
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
powerhouse
Level 6
Level 6
Posts: 1144
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO to make dual-boot obsolete using XEN VGA passthro

Post by powerhouse »

Quirken wrote:I only have one graphics card; I'd like to do VGA passthrough to Windows, and then run an X server on windows and connect back to dom0.

It's a little ass-backwards, but I don't see why it shouldn't work. Problem is, I have no idea how to do it. (I know it can be done, as it's mentioned here: http://www.overclock.net/t/1205216/guid ... al-machine but without very detailed directions).

Any idea?

(If anyone is curious, I found a guide here: http://linux-bsd-sharing.blogspot.com/2 ... (rev%20a1) but I never got it past giving me a black screen)
I am a little confused as to what you are trying to achieve? From what I understand (mainly from the link to the guide on overclock.net which I've also tried to get it working), you are trying to boot into a Windows domU and connect to the Linux dom0 via VNC?

If you have a desktop computer and the possibility to install a second graphics card - do it!!! It's a lot easier. I was banging my head against the wall when I tried getting VGA passthrough working with only one graphics card. It seems simple, but there are some tricky parts to watch out for.

If you heed my advise and install a second graphics adapter, make sure you got the following:

1. Primary graphics adapter for Linux dom0: ATI card (usually a cheap but newer card will do, unless you need better graphics support - the 6450 I have is VERY baseline and I recommend a little stronger card.
2. Secondary graphics adapter for Windows domU: ATI card - many cards are supported. If you need it for gaming, get one of the more powerful ones. Check the Xen wiki and the overclock.net thread you posted. If you want Nvidia: only the "Multi-OS" cards are good. They are professional graphics workstation cards and cost a little fortune, and they are NOT specifically designed to be good for gaming (though they might do OK). Anyway, if gaming is what you are after, the Nvidia Multi-OS cards are too much $$$ for the performance they offer. I do have the Nvidia PNY Quadro 2000 and it works perfect under Xen with VGA passthrough, but I don't use it for gaming!

OK, after my suggestion to just install a cheapo ATI graphics card as primary graphics adapter for Linux dom0 and another (gaming) ATI card for Windows domU, here the challenges/caveats for single graphics adapter passthrough:

1. If you have only one graphics adapter, it must be detached from (or never attached to) the Linux dom0 graphics driver and attached to the Windows domU.
2. In the boot process, the xen-pciback module must take control of the graphics adapter and assign it to Windows domU. In Fedora 16/17 (the tutorial you referred to on overclock.net), pciback is compiled into the kernel (not a loadable module). In Linux Mint (and Ubuntu) xen-pciback is loaded as a module.
3. If you do want to use Linux Mint (I for example do prefer Linux Mint over Fedora and other distributions), you need to make sure that the Linux graphics driver doesn't get in the way with assigning the graphics card to Windows. One way to go is to load xen-pciback via /etc/modules (see my tutorial, part 3, point 6).
4. Read step 6a of the overclock.net tutorial: http://www.overclock.net/t/1205216/guid ... al-machine. You must make sure you have a way to access your computer. I used my laptop and ssh -X user@ip.address.of.pc (like ssh -X user@192.168.0.150) to connect to my desktop where I installed Xen. Make sure it works BEFORE trying to passthrough the graphics adapter.
5. Once you have edited the /etc/modules file and rebooted the PC (after all the other adjustments etc. listed in the tutorial), the screen should be black (that is detached from the dom0). Using a second PC/laptop, connect to your PC and check with xm "pci-list-assignable-devices" to confirm that your graphics card can be assigned to the Windows domU.
6. Run sudo virt-manager (from the terminal window of the remote laptop/PC).
7. Switch to the VNC screen of virt-manager and start/run Windows. You should see the Windows ISO booting and the Windows installation sequence in the X-window on your remote PC.
8. You'll be asked to reboot at some point. Do so (I mean the Windows domU needs to reboot, NOT the PC). You'll probably need to reconnect the virt-manager VNC screen. If I remember correctly, you may have to exit virt-manager and run virt-manager again.
9. Once your back into Windows (on your virt-manager VnC window), open the device manager and check the graphics adapter (or whatever its called) option. You should see the Cirrus driver and hopefully a second option showing your graphics card. Download and install your graphics card driver. In my case, I went to the Nvidia website (remember I have the Quadro2000 card) and had the website check for the appropriate driver. The card was detected and I installed the latest driver for Windows. I don't know what ATI offers, but hopefully they have similar support.
10. After the driver installation, reboot your PC and see if it boots into Windows and you get a screen.
11. Get a VNC viewer for Windows and connect to your Linux dom0.

I believe the critical part is point 3. It may not be enough to have xen-pciback as a module. The overclock.net guide is based on Fedora 16 which has pciback compiled into the kernel. I haven't tried it, or to be precise, I've tried it with the wrong Nvidia card (a Nvidia Quadro 600 which is NOT Multi-OS) and, of course, it didn't work. If in point 5 xm pci-list-assignable-devices doesn't show the graphics card, you may have to compile your kernel and include pciback. Before doing so you could try to put the module on the initial RAM disk (initrd). See also http://wiki.xen.org/wiki/Xen_PCI_Passthrough.

Hope it helps. If not, let me know and I'll try it on my system.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
powerhouse
Level 6
Level 6
Posts: 1144
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO to make dual-boot obsolete using XEN VGA passthro

Post by powerhouse »

Quirken wrote:I only have one graphics card; I'd like to do VGA passthrough to Windows, and then run an X server on windows and connect back to dom0.

It's a little ass-backwards, but I don't see why it shouldn't work. Problem is, I have no idea how to do it. (I know it can be done, as it's mentioned here: http://www.overclock.net/t/1205216/guid ... al-machine but without very detailed directions).

Any idea?

(If anyone is curious, I found a guide here: http://linux-bsd-sharing.blogspot.com/2 ... (rev%20a1) but I never got it past giving me a black screen)
I tried the second link you posted but I get this: "Sorry, the page you were looking for in this blog does not exist."

Can you check again and post a link that shows?
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
Quirken
Level 1
Level 1
Posts: 26
Joined: Sat Nov 13, 2010 8:42 am

Re: HOW-TO to make dual-boot obsolete using XEN VGA passthro

Post by Quirken »

powerhouse wrote:I tried the second link you posted but I get this: "Sorry, the page you were looking for in this blog does not exist."

Can you check again and post a link that shows?
Sorry about that! I had typed in my device IDs into the URL bar and forgot :D Link fixed!
powerhouse wrote:I am a little confused as to what you are trying to achieve? From what I understand (mainly from the link to the guide on overclock.net which I've also tried to get it working), you are trying to boot into a Windows domU and connect to the Linux dom0 via VNC?
Ultimately, I was looking to have a near-seamless experience. Windows DomU running on top of Linux Dom0, and Linux apps running in the windows environment. I know you can run X applications remotely (as opposed to VNC, which shares your entire screen).
1. If you have only one graphics adapter, it must be detached from (or never attached to) the Linux dom0 graphics driver and attached to the Windows domU.
This is probably what I was having trouble with. I was getting a black screen on startup (not surprising). I sshed in from another machine and tried to start my xen guest but never got it to work... finally gave up. At the moment, I'm back running dual-boot and will probably try again when xen 4.2 makes it into our repositories.
5. Once you have edited the /etc/modules file and rebooted the PC (after all the other adjustments etc. listed in the tutorial), the screen should be black (that is detached from the dom0). Using a second PC/laptop, connect to your PC and check with xm "pci-list-assignable-devices" to confirm that your graphics card can be assigned to the Windows domU.
I got that far, but it never listed anything in xm pci-list-assignable-devices.
I believe the critical part is point 3. It may not be enough to have xen-pciback as a module. The overclock.net guide is based on Fedora 16 which has pciback compiled into the kernel. I haven't tried it, or to be precise, I've tried it with the wrong Nvidia card (a Nvidia Quadro 600 which is NOT Multi-OS) and, of course, it didn't work. If in point 5 xm pci-list-assignable-devices doesn't show the graphics card, you may have to compile your kernel and include pciback. Before doing so you could try to put the module on the initial RAM disk (initrd). See also http://wiki.xen.org/wiki/Xen_PCI_Passthrough.
Hm, maybe. Like I said, I'll probably try again when Xen 4.2 makes it into our repositories. With any luck I'll have upgraded my computer by then and will have both integrated graphics and dedicated graphics.
powerhouse
Level 6
Level 6
Posts: 1144
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO to make dual-boot obsolete using XEN VGA passthro

Post by powerhouse »

@Quirken: What you write means that there are no assignable PCI devices.

You could check dmesg / log files and see if the graphics card driver takes the graphics card. If yes, you could try to blacklist the graphics card driver and, after reboot, see if the graphics card becomes assignable.

I'll have a look at the link you posted.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
powerhouse
Level 6
Level 6
Posts: 1144
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO to make dual-boot obsolete using XEN VGA passthro

Post by powerhouse »

@Quirken:

The link you posted uses pci-stub instead of xen-pciback to detach/attach the PCI devices. Have you tried it? It might be worth trying.

If you use the pci-stub method but follow the above tutorial, you need to skip part 3, sections 4-7, and use the instructions for pci-stub.

I'm not sure if xen 4.2 will make much if any difference to your not being able to detach the PCI devices. You will need to find the reason for it and solve it. My guess is that the video card driver is loaded and doesn't let you detach the VGA device. Check the dmesg output after booting.

As I said, you could try to blacklist the video card driver. This is also easy to revert, if needed.

Good luck!
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
User avatar
xenopeek
Level 25
Level 25
Posts: 29511
Joined: Wed Jul 06, 2011 3:58 am

Re: Windows + Linux and Xen

Post by xenopeek »

Image
Locked

Return to “Other topics”