HOW-TO make dual-boot obsolete using XEN VGA passthrough

Questions about virtualization software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
gordon.cooke

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

Post by gordon.cooke »

powerhouse wrote:c) You could also use your keyboard and mouse without passing the PCI device through (using the USB=1 and/or tablet=1 settings in the win7.cfg file). Frankly I have no experience with this.
So I gave this a try. Did not have to do anything really to set it up. The catch is- you have to have vncviewer running. What happens is: the vncviewer screen gets through to the 'starting windows' screen. Then video switchers to the graphics card, but vnc just keeps displaying the 'starting windows' screen. As long as the mouse is inside the vnc window on the host, then the keyboard and mouse is passed through to windows which is displayed on the other video card. If vnc is closed then there is no control over the mouse or keyboard.

A few things to be aware of.
  • VNC needs to be on top, not just running. If you have a window open and covering part of vnc then you will get a region of the MS Windows screen that has no mouse.
  • If you run the mouse off the edge of vnc then the mouse on MS Windows goes to the edge and stops-- BUT if you press the mouse button then you are pressing on whatever is under it in the host. And if this brings a window up over top of vnc you will loose control until you raise vnc in the host.
  • If you maximize VNC full screen the above is not much of an issue-- BUT- on my cinamon desktop there is the hot corner in the upper right corner. When the mouse hits there then Mint goes into the wall view showing all desktops. When that happens you loose control inside MS Windows.
  • Nothing crashes in any of the above but you need to be aware to go into Mint and fix it.
I suppose when I say "host" above it could be any machine running VNC, even if a domU, but I only have a Mint dom0 and Win7 domU so far.
gordon.cooke

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

Post by gordon.cooke »

I am using an AMD Radeon HD5450 card (made by Saphire). I have now successfully got Windows 7 64 bit running as domU with a Mint 13 dom0!!!

At first I tried downloading the Catalyst driver software from the AMD website. But that wouldnt make the card work and kept failing to install any driver. In device manager the graphics card was listed with the little yellow triangle (since it wasnt working) and had no driver. I noticed it was just labeled as a generic VGA. This is the key problem. The AMD installing must be checking for what hardware is installed, windows doesnt report an AMD card, and the insatller doesnt do anything with respect to drivers.

When I tried going through device manager and finding a driver for the device, nothing was found automatically (just reported it was already the most current driver for a generic VGA). When I tried picking a driver I noticed that the most current choices were a Radeon HD 4xxx (this was a Win7 SP1 install).

What worked was:
  • With Win7 off and not running (check xm list)
  • I put the CD that came in the box with the graphics card into the physcial drive.
  • Then modified the config file

    Code: Select all

    sudo gedit /etc/xen/win7.cfg
  • and changed the virual cd device to the physical cd (note: my machine only had /sr0, your drive may be /cdrom or something else)

    Code: Select all

    disk=[..... 'phy:/dev/sr0,hdc:cdrom,r' ]
  • Then started the VM

    Code: Select all

    sudo xm create /etc/xen/win7.cfg
    vncviewer localhost:0
  • Went into device manager, selected the graphics card I want to passthrough, and open the properties
  • Choose to update the driver, and browse to find a driver manually
  • I then selected the CD drive and made the the "include subfodlers" option was selected
  • That was enough direction that Windows was able to find the correct driver and at that point the identity of the graphics card changed to be Radeon HD 5450
  • My windows required a restart and the graphics worked
Locuust

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

Post by Locuust »

Update 2

Goal: Use fglrx driver under Mint 14 w/Xen (as Dom0). Why? Because I live in a warm climate and I don't like how warm my video cards run with the opensource driver. Joking aside I have learned there is a way to get the open source driver to do dynaPM (dynamic power management) but it has graphic defects and is restricted to one monitor.

My hardware:

Code: Select all

ASRock 970 Extreme 4
AMD FX-6300
16 Gb Ram
Radeon 7870 (for vga passthrough w/Xen)
Radeon 7750 (for use on Dom0)
Software:

Code: Select all

Mint 14 64bit
Xen 4.1.3 (ubuntu package)
I have two kernels -
Stock Mint 14 3.5.0-17-generic
Custom 3.5.5-domz. Compiled from Ubuntu-Quantal git repo branch 3.5.0.17.28. Added backend Xen kernel options.
What works -
1) Booting into Mint 14 baremetal (w/o Xen). Both kernels. Open/Ubuntu/Official AMD drivers.
2) Booting into Mint 14 w/Xen recovery mode and dropping to terminal. Both kernels. Open/Ubuntu/Official AMD drivers. However, startx locks up the system on proprietary driver.
3) Booting into Mint 14 w/Xen. Both kernels. Opensource AMD driver. Result - Cinnamon doesn't load. No panel. However I can load into a gnome classic session.

What doesn't -
1) Booting into Mint 14 w/Xen. Both kernels. Ubuntu/Official AMD driver. Result - Black screen after Mint splash. No login screen.

From this I think it's safe to say Xen has a problem with cinnamon and fglrx. I've already gone through my logs and addressed three errors I was getting in Xen mode but sadly they weren't the source of my Xorg woes (missing packages and blacklisting some troublesome modules). I might post about this elsewhere but I figure the response will be that Xen and custom kernels is asking for trouble, k-thx-bye.

The good news is that I got my kernel built the way I wanted and pciback works great from the grub kernel options.

I'm thinking my only hope at this point is using the open source driver. Unfortunately that means poor support for my cards. Actually, now that I think about it, that's probably why cinnamon doesn't work right (guess I might need to try a different desktop manager). 3D support for the 7750+ is spotty and there is no support for HDMI audio. So I'll have to throw this ancient Sound Blaster Live I found gathering dust in the corner of my closet into my machine.

*edit* Ohhh.. someone just mentioned to me that there is a session option to run cinnamon in 2D mode at the login screen. Guess I'll try reinstalling the open source driver and logging in that way.

*edit2* While in hind sight my reasoning may have been sleep depraved nonsense (clearly it's not 3D support if it works outside Xen) it did lead me to a temporary solution for cinnamon. Simply bypass it by running a classic gnome session. So I have my X in Dom0 and I'll just have to see how the power management / video decoding goes later. In the mean time I have Win7 happily installing in the background. In a few minutes I'll be able to see if VGA passthrough works on this hardware.

*edit3* VGA passthrough is working. :) AMD driver installed. CCC installed after reboot. I still have a few things to work on, but at least I can confirm the effort was worth it. There is light at the end of the tunnel per say. I've seriously had more problems with Dom0 than DomU.
powerhouse
Level 6
Level 6
Posts: 1138
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

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

Post by powerhouse »

@Locuust: That's good news about VGA passthrough!

Now to Xen and the AMD fglrx driver: I'm running the Mate desktop (the continuation of the classic Gnome desktop) with the proprietary AMD driver and Catalyst Control Center - no issues at all:

Code: Select all

# lsmod | grep -i amd
amd_iommu_v2           19098  1 fglrx
Perhaps you may want to give the Mate desktop a chance (backup your Windows guest!). One more thing: if you haven't done so, blacklist the opensource radeon driver.

Now for clarification: You are using the compiled kernel with pciback in grub to detach the second VGA card? Did you also try it "my" way, i.e. with the standard kernel and the xen-pciback module?

Here is a simple backup script to backup the Windows VM - I called it win7-backup.sh:

Code: Select all

#!/bin/sh
mv /media/tmp_stripe/lm13-win7.img /media/tmp_stripe/lm13-win7.img.old
lvcreate --size 10G --snapshot -n win7-snap /dev/lm13/win7
echo Creating backup copy of win7...
pv /dev/mapper/lm13-win7-snap | dd of=/media/tmp_stripe/lm13-win7.img
lvremove /dev/lm13/win7-snap
echo Finished
You need to change the volume/folder/file names in the script to match yours:
/media/tmp_stripe/lm13-win7.img /media/tmp_stripe/lm13-win7.img.old - change the location/name of the backup file to match yours.

lvcreate --size 10G --snapshot -n win7-snap /dev/lm13/win7 - change /dev/lm13/win7 to match your Windows guest LVM volume.

/dev/mapper/lm13-win7-snap - change this to the name of your snapshot volume. This volume is created with the lvcreate --size 10G --snapshot -n win7-snap /dev/lm13/win7 command. You can run that command manually and then check with ls /dev/mapper - your new Windows snapshot volume should show up. Just don't forget to lvremove /dev/.../win7-snap !

Don't forget to make the script executable. If you need to compress the Windows volume, let me know. I got a script that does a backup with compression.
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: 1138
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

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

Post by powerhouse »

earlboy wrote:
powerhouse wrote:...
Just for clarification: You had to build the kernel and Xen 4.1.4 from source? And you are using the xm toolstack?

Are you willing to share detailed information on how you got it working with UEFI, incl. kernel and Xen compilation steps? Perhaps in a separate how-to? I would then link to it from the first post here.
Yes I'm using 4.1.4 for uefi booting, and still using xm toolstack.
I'm manage to make kernel 3.5.0-26 (just did an update using package)to work with xen 4.1.4.

Here's the stuff that I did differently from your guide.
- Updated my kernel to 3.5.0-26
- Compiled xen 4.1.4. Did not do the install.sh from the build. I just copied the xen kernel to the /boot directory and updated grub
- added the following parameters to xen "iommu=1 dom0_mem=min:2048M,max:4192M dom0_max_vcpus=4 dom0_vcpus_pin" so that I won't get kernel panic. "dom0_mem=<value>" caused kernel panic, as for the max_vpsu and vcpus_pin it may not be necessary.
xen seems to be sensitive about the dom0_mem parameter, tried different values, but "dom0_mem=min:2048M,max:4192M" did it for me.
- black listed the radeon driver from the linux kernel by adding "radeon.blacklist=1". This prevents kernel panic for happening when the pciback script gets executed. I've been getting random panics with the radeon driver when pciback tries to grab it.
- when installing the graphics card driver for ati in the vm, I install only the drivers first. Then do a couple of reboots then intall all the options in the catalyst intallation.
- I don't know if this just happens on my install, but everytime I install the ati gpu drivers on a fresh win7 vm, CCC won't start at boot, because it requires microsoft .net runtime. After installing it CCC should start up with no problems

The rest I followed your guid.

Cheers.
Hm, did you ever try Xen 4.1.3 (from LM repos) in conjunction with "radeon.blacklist=1" ?

I just don't see how 4.1.4 would solve the issues you had.
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: 1138
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

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

Post by powerhouse »

@gordon.cooke:

1. Thanks for sharing your experiments with using Xen's usb=1 / tablet=1 settings in the guest config file. I edited my how-to and linked to your post. Hope you don't mind. Great work !

2. Getting your AMD driver installed under Windows was quite a challenge. Great that you found a solution. I wonder why Windows didn't recognize your AMD display adapter in the first place?

Usually you should see 2 display adapters listed under device manager:

- Generic VGA - the primary display adapter used for booting into Windows

- AMD Radeon or whatever - the secondary display adapter whose driver is subsequently loaded.

When booting the Windows guest, it first loads the BIOS and driver for the Generic VGA adapter, after which it loads the driver for the real passed through graphics adapter. This is why this method is called VGA passthrough of secondary display adapter.

Note: One can also pass through the graphics card as primary display adapter, but it's a lot more difficult and often doesn't work at all. This method would require extracting the video BIOS from the card, patching Xen, etc., etc. Some people do that with Nvidia cards, as that is the only chance of getting them to work with VGA passthrough (except of course the "multi-OS" type cards like Quadro 2000, which work as described in the tutorial).

So, do you have any thoughts on why Windows didn't recognize your card, or am I misunderstanding you?
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
Locuust

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

Post by Locuust »

gordon.cooke wrote:
locuust wrote: Does Win7 give you a grace period on activation like XP did?
Yes it does. Im doing some testing using the Windows 7 iso download from Digital River. Wanted to be sure things work before I open the seal on the liscened copy I bought and couldn't return it anymore. Looks like it is 3 days before you have to enter the activation key.
Yeah, it looks like I should be fine on this. It's really too bad I had an ID10T error and my windows partition got wiped. I reinstalled on the same machine inside a Xen DomU. 8)
gordon.cooke wrote:
powerhouse wrote:c) You could also use your keyboard and mouse without passing the PCI device through (using the USB=1 and/or tablet=1 settings in the win7.cfg file). Frankly I have no experience with this.
So I gave this a try. Did not have to do anything really to set it up. The catch is- you have to have vncviewer running. What happens is: the vncviewer screen gets through to the 'starting windows' screen. Then video switchers to the graphics card, but vnc just keeps displaying the 'starting windows' screen. As long as the mouse is inside the vnc window on the host, then the keyboard and mouse is passed through to windows which is displayed on the other video card. If vnc is closed then there is no control over the mouse or keyboard.
Yeah, I experienced this loading Win7 last night. It's... interesting. For me the mouse pointer in VNC and the virtual one (the dot) weren't in sync so it was a pain to click on anything at the edges of the screen. Basically the mouse pointer trailed behind the dot you control directly. So I'd get to the edge of the VNC terminal and the mouse pointer would be stuck somewhere in the middle of the screen. /shrug. I just used keyboard shortcuts as much as possible to navigate. Ultimately I'll be using something else for keyboard/mouse.
gordon.cooke wrote:I am using an AMD Radeon HD5450 card (made by Saphire). I have now successfully got Windows 7 64 bit running as domU with a Mint 13 dom0!!!
Grats. AMD really does seem to be the way to go for passthrough. I had zero issues there. Didn't get to try any games before I went to bed though.
At first I tried downloading the Catalyst driver software from the AMD website. But that wouldnt make the card work and kept failing to install any driver. In device manager the graphics card was listed with the little yellow triangle (since it wasnt working) and had no driver. I noticed it was just labeled as a generic VGA. This is the key problem. The AMD installing must be checking for what hardware is installed, windows doesnt report an AMD card, and the insatller doesnt do anything with respect to drivers.
The catalyst driver didn't detect my card at first and then I realized I had commented out the passthrough when testing something else earlier in the day. Duh. Once I reloaded with it uncommented catalyst had no problem finding it.
When I tried going through device manager and finding a driver for the device, nothing was found automatically (just reported it was already the most current driver for a generic VGA). When I tried picking a driver I noticed that the most current choices were a Radeon HD 4xxx (this was a Win7 SP1 install).

What worked was:
.
.
[*]That was enough direction that Windows was able to find the correct driver and at that point the identity of the graphics card changed to be Radeon HD 5450
[*]My windows required a restart and the graphics worked[/list]
Strange. All I did was install just the drivers first (deselected everything else in the custom setup). Reboot, and then install everything else. Maybe the difference was that I didn't have my card passed when I was loading windows. It didn't have a chance to detect and install a generic driver for the card.

With my build I'll probably try uninstalling cinnamon and installing Mate without reinstalling. I don't really feel like setting everything up again if I can help it. I've also decided to make room for a second monitor. My dad has a screen he repaired with a few a few capacitors and a ergotron mount just like mine he's never used. He's donating it to the cause ;) After working with the two screens this last week I remembered how much I miss it. This way I can look stuff up in my Dom0 while I'm playing a game on my DomU. :P I have a second sound card to pass now too so I don't need to mess around with HDMI audio. The real fun is cleaning up my workspace this morning so I have room for the second screen. Oh, I did some brief testing of HD video streaming and it seems to do fairly well with the open source driver. Screen tearing seemed minimal. I feel like my cpu usage was a little high, but then I don't have a frame of reference for running in a Dom0 (not to mention I have it pinned to two processors atm).

I wrote a Howto on building a custom Xen kernel. Later, when I've cleaned it up and let my dad give it a try I'll post/link it here. When my dad heard what I was doing with Xen he ordered the same motherboard and processor. lol. All he's got is nvidia video cards though. He said he might give it a try despite that. lol. If he succeeds I'll post the details of that as well.
Locuust

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

Post by Locuust »

powerhouse wrote:@Locuust: That's good news about VGA passthrough!
Thanks. :)
Now to Xen and the AMD fglrx driver: I'm running the Mate desktop (the continuation of the classic Gnome desktop) with the proprietary AMD driver and Catalyst Control Center - no issues at all:

Code: Select all

# lsmod | grep -i amd
amd_iommu_v2           19098  1 fglrx
I will really hate my stubborn self if all it ends up being is the desktop I was running. It's not even like I made a conscious choice about it. My dad handed me a usb stick with Mint on it and I just used it. On the other hand I guess it would be nice to confirm so others don't have to make the same mistake. ;) I'll try reloading fglrx when I get Mate installed later.
Perhaps you may want to give the Mate desktop a chance (backup your Windows guest!). One more thing: if you haven't done so, blacklist the opensource radeon driver.
Fwiw the amd proprietary driver already blacklists the opensource driver. Not in the kernel options though. So I guess that might make a difference. As far as Mate goes my dad already switched one of his cinnamon installs to Mate just to show me it could be done (the man has like every distro and desktop known to man loaded on his machines). Like I said in my other post I'll probably give that a try first.
Now for clarification: You are using the compiled kernel with pciback in grub to detach the second VGA card? Did you also try it "my" way, i.e. with the standard kernel and the xen-pciback module?
Yeah I'm using pciback statically compiled instead of the module. No, I didn't try the script. I just felt like doing it with the kernel was easier. I know. I know. My idea of easy is different than most. I had to compile a new kernel back in the day when I was messing with KVM pci passthrough so I wasn't afraid to try it. It's not that hard really.
Here is a simple backup script to backup the Windows VM - I called it win7-backup.sh:

Code: Select all

#!/bin/sh
mv /media/tmp_stripe/lm13-win7.img /media/tmp_stripe/lm13-win7.img.old
lvcreate --size 10G --snapshot -n win7-snap /dev/lm13/win7
echo Creating backup copy of win7...
pv /dev/mapper/lm13-win7-snap | dd of=/media/tmp_stripe/lm13-win7.img
lvremove /dev/lm13/win7-snap
echo Finished
Cool, thanks, at least making backups of windows partition will be easier under LVM. *ahem* ;)

Probably start moving LVM snapshots out to my server running zfs.
earlboy

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

Post by earlboy »

powerhouse wrote:
earlboy wrote:
powerhouse wrote:...
Just for clarification: You had to build the kernel and Xen 4.1.4 from source? And you are using the xm toolstack?

Are you willing to share detailed information on how you got it working with UEFI, incl. kernel and Xen compilation steps? Perhaps in a separate how-to? I would then link to it from the first post here.
Yes I'm using 4.1.4 for uefi booting, and still using xm toolstack.
I'm manage to make kernel 3.5.0-26 (just did an update using package)to work with xen 4.1.4.

Here's the stuff that I did differently from your guide.
- Updated my kernel to 3.5.0-26
- Compiled xen 4.1.4. Did not do the install.sh from the build. I just copied the xen kernel to the /boot directory and updated grub
- added the following parameters to xen "iommu=1 dom0_mem=min:2048M,max:4192M dom0_max_vcpus=4 dom0_vcpus_pin" so that I won't get kernel panic. "dom0_mem=<value>" caused kernel panic, as for the max_vpsu and vcpus_pin it may not be necessary.
xen seems to be sensitive about the dom0_mem parameter, tried different values, but "dom0_mem=min:2048M,max:4192M" did it for me.
- black listed the radeon driver from the linux kernel by adding "radeon.blacklist=1". This prevents kernel panic for happening when the pciback script gets executed. I've been getting random panics with the radeon driver when pciback tries to grab it.
- when installing the graphics card driver for ati in the vm, I install only the drivers first. Then do a couple of reboots then intall all the options in the catalyst intallation.
- I don't know if this just happens on my install, but everytime I install the ati gpu drivers on a fresh win7 vm, CCC won't start at boot, because it requires microsoft .net runtime. After installing it CCC should start up with no problems

The rest I followed your guid.

Cheers.
Hm, did you ever try Xen 4.1.3 (from LM repos) in conjunction with "radeon.blacklist=1" ?

I just don't see how 4.1.4 would solve the issues you had.
I used 4.1.4 because I'm 100% sure that it already had the fix for the Dom0 memory allocation bug when booting in UEFI. Can't remember if 4.1.3 already has the fix or not or I was encountering kernel panics when booting to it.
Besides I've already got a compiled copy in of 4.1.4(from my other attempts) when I was installing LM 14 KDE. (Tried Xen with other DE and had a working UEFI Xen with Ubuntu Unity until I settled for LM 14 KDE)

I used the "radeon.blacklist=1", because there were times when I get kernel panic when pciback scripts get executed and the trace message was leading to the radeon driver. I tried blacklisting it int /etc/modprobe/blacklist.conf, but I was still encountering the same problem. It totally disappeared when I directly blacklisted it in the kernel command line. It's odd as well, because after blacklisting it in the kernel command line, the graphic glitches I was having in kde dis-appeared as well.
powerhouse
Level 6
Level 6
Posts: 1138
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

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

Post by powerhouse »

earlboy wrote:...

I used 4.1.4 because I'm 100% sure that it already had the fix for the Dom0 memory allocation bug when booting in UEFI. Can't remember if 4.1.3 already has the fix or not or I was encountering kernel panics when booting to it.
Besides I've already got a compiled copy in of 4.1.4(from my other attempts) when I was installing LM 14 KDE. (Tried Xen with other DE and had a working UEFI Xen with Ubuntu Unity until I settled for LM 14 KDE)

I used the "radeon.blacklist=1", because there were times when I get kernel panic when pciback scripts get executed and the trace message was leading to the radeon driver. I tried blacklisting it int /etc/modprobe/blacklist.conf, but I was still encountering the same problem. It totally disappeared when I directly blacklisted it in the kernel command line. It's odd as well, because after blacklisting it in the kernel command line, the graphic glitches I was having in kde dis-appeared as well.
OK, so 4.1.4 was needed for UEFI boot. That explains.

I wasn't even aware of the radeon.blacklist=1 (or nouveau.blacklist=1) boot option - thanks again for pointing that out. I used the /etc/modprobe.d way to blacklist the nouveau driver, but have changed it now to use the grub boot option.

By the way, I found bootchart (from repos) to be very helpful in analyzing the boot process and finding problems. Just make sure to remove the program and the logs when done - the logs are huge!
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: 1138
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

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

Post by powerhouse »

Locuust wrote:...I wrote a Howto on building a custom Xen kernel. Later, when I've cleaned it up and let my dad give it a try I'll post/link it here. When my dad heard what I was doing with Xen he ordered the same motherboard and processor. lol. All he's got is nvidia video cards though. He said he might give it a try despite that. lol. If he succeeds I'll post the details of that as well.
I look forward to the how-to. Thanks!
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
Locuust

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

Post by Locuust »

Well, I've exhausted my options.

Switching to Mate did solve the problem with cinnamon not loading properly with the open source driver (while under Xen). But I've had no luck at all solving the fglrx issue. So I posted this thread - http://forums.linuxmint.com/viewtopic.php?f=46&t=130733

I'd really prefer to get fglrx to work.
gordon.cooke

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

Post by gordon.cooke »

@Locuust

Im running Mint 13 Cinamon as dom0 and using fglrx (or I think I am)

Code: Select all

gedit /etc/X11/xorg.conf
opens my X configuration and under my device lists:

Code: Select all

Section "Device"
	Identifier  "aticonfig-Device[0]-0"
	Driver      "fglrx"
	BusID       "PCI:1:0:0"
EndSection
*EDIT* In addition to the above I also used the following to check my xorg log file. It is loading the "ATI Proprietary Linux Driver Version Identifier:8.96.4" and fglrx.

Code: Select all

cat /var/log/Xorg.0.log | grep -i driver
The first time I rebooted after installing Xen and updating grub, The grub came up with the default of Xen, then I got a Mint Splash screen, then I got a black screen with a big grey box and a little blue box- kind of like a stock debian installer with with no text. I used the reboot button on the case and got the same thing but this time it had text. The error reported that it could not start X. So I chose to check the logs.

Had 2 errors for "Failed to load fglrx (module doesnt exist)" I assume one for each of my two cards. Also an error for "open /dev/fb0! No such file or dir" as well as a few errors related to keyboard.

I rebooted. This time it came to the grub screen I chose the option to start the Mint without Xen. This logged in OK, but there was no cinamon and I had a standard gnome desktop. I was able to use firefox to search for an answer and navigated thru the AMD support page to the unofficial wiki and went to the Ubuntu page at http://wiki.cchtml.com/index.php/Ubuntu I have Mint 13 so I followed the link for Precise 12.04

From there the best optioin seemed to be to use the repo and not the downloaded driver.

Code: Select all

sudo apt-get install fglrx fglrx-amdcccle
sudo amdconfig --initial -f
gedit /etc/X11/xorg.conf
and checked in the Xorg file that I was using the correct graphics card (mine was 1,0,0)

Then I rebooted and lett he machine boot into Xen. I got the login screen and then cinamon desktop loaded. Success!
From there I resumed powerhouses instructions as 3) /etc/init.d/network-manager stop

I will say though that now, everything seems to work fine except the Linux Mint splash screen withthe four or five little circles under it- is notthe nice pretty graphics, its like a low res text mode version (if anyone has ideas)
Locuust

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

Post by Locuust »

gordon.cooke wrote:Im running Mint 13 Cinamon as dom0 and using fglrx (or I think I am)

Code: Select all

gedit /etc/X11/xorg.conf
opens my X configuration and under my device lists:

Code: Select all

Section "Device"
	Identifier  "aticonfig-Device[0]-0"
	Driver      "fglrx"
	BusID       "PCI:1:0:0"
EndSection
The first time I rebooted after installing Xen and updating grub, The grub came up with the default of Xen, then I got a Mint Splash screen, then I got a black screen with a big grey box and a little blue box- kind of like a stock debian installer with with no text. I used the reboot button on the case and got the same thing but this time it had text. The error reported that it could not start X. So I chose to check the logs.
You're lucky to have gotten that much ;) I don't get anything after the Mint splash. No cursor. Just black.
Had 2 errors for "Failed to load fglrx (module doesnt exist)" I assume one for each of my two cards. Also an error for "open /dev/fb0! No such file or dir" as well as a few errors related to keyboard.
Strange that you had a xorg.conf pointing to fglrx but no module. Unless I misunderstand? As for the /dev/fb0 error I was getting the same thing until I did "radeon.blacklist=1" in grub. Never had issues with my keyboard. Though I do get a bunch of errors about my wacom. I'm not to worried about that though. I know how much worse it can be. A few years back the wacom linux project hadn't added support for my model yet. So I found some messages on ubuntu's boards about a patch that would add support. So I downloaded the driver source, applied the patch, and installed the custom module. Unfortunately took some more tinkering with xorg/udev? files to get the thing to work. It was generally a pain.
I rebooted. This time it came to the grub screen I chose the option to start the Mint without Xen. This logged in OK, but there was no cinamon and I had a standard gnome desktop. I was able to use firefox to search for an answer and navigated thru the AMD support page to the unofficial wiki and went to the Ubuntu page at http://wiki.cchtml.com/index.php/Ubuntu I have Mint 13 so I followed the link for Precise 12.04
For me I couldn't get cinnamon to run with the open source driver inside Xen. I switched to the Mate desktop and it worked fine. I can say this much - Xen and cinnamon don't play well together. Yeah, I posted a link from the unofficial wiki in my other thread. They have some good info. I especially like that they organize things by distro and release. This way you can be more confident that their howto's are closer to your setup.
From there the best optioin seemed to be to use the repo and not the downloaded driver.

Code: Select all

sudo apt-get install fglrx fglrx-amdcccle
sudo amdconfig --initial -f
gedit /etc/X11/xorg.conf
and checked in the Xorg file that I was using the correct graphics card (mine was 1,0,0)
Yeah I started by using the 'other drivers' screen in software sources so I've tried every driver available.
Then I rebooted and lett he machine boot into Xen. I got the login screen and then cinamon desktop loaded. Success!
From there I resumed powerhouses instructions as 3) /etc/init.d/network-manager stop
That's what I keep hoping will happen. :(
I will say though that now, everything seems to work fine except the Linux Mint splash screen withthe four or five little circles under it- is notthe nice pretty graphics, its like a low res text mode version (if anyone has ideas)
I'm not sure what your asking? Do you want to disable it? Or did you mean that it looks lower resolution when booting from Xen? I noticed mine does. I think it's because Xen defaults in a lower video mode. I believe you can change the mode Xen starts in, but I think the open source driver has the best support for this. At least that was the impression I was left with after reading about kernel mode select and framebuffer support.
gordon.cooke

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

Post by gordon.cooke »

powerhouse wrote:@gordon.cooke:
1. Thanks for sharing your experiments with using Xen's usb=1 / tablet=1 settings in the guest config file. I edited my how-to and linked to your post. Hope you don't mind. Great work !
No problem linking- thats what the forum is for.
powerhouse wrote: 2. Getting your AMD driver installed under Windows was quite a challenge. Great that you found a solution. I wonder why Windows didn't recognize your AMD display adapter in the first place?
Usually you should see 2 display adapters listed under device manager:.....
My windows DID recognize that it had two video cards. One was Generic VGA and was working, which output to VNC. But the other device was recognized as Generic VGA and had the little yellow triangle that it wasnt working (lacked proper drivers).

Im not certain what the exact issue was. But windows couldnt automatically find appropriate driver. When I tried to select a driver (from what was on the system) I did notice that the most recent AMD Radeon options were HD4xxx series. No HD5xxx, HD6xxx etc. I suspect that either windows could not find proper driver because the device identity was somehow wrong (Generic instead of AMD Readeon) OR that the required drivers were newer than the Win7 SP1 disc I used and not included in the image. My guess is the second, although Im surprised that the card would be too new for SP1- but I have not checked the dates the card or SP1 were released.

When I took the route of using the install disc that came with the graphics card, and manually telling Windows where to look for the driver (on the CD) it found it without much hassel. That just was not my first method I had tried because this is Xen. If I was just installing normally I would have used the included CD right away, but using Xen I had not passed through the CD drive yet so I left that option for last.
gordon.cooke

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

Post by gordon.cooke »

Locuust wrote:
gordon.cooke wrote:
powerhouse wrote:c) You could also use your keyboard and mouse without passing the PCI device through (using the USB=1 and/or tablet=1 settings in the win7.cfg file). Frankly I have no experience with this.
So I gave this a try. Did not have to do anything really to set it up. The catch is- you have to have vncviewer running. What happens is: the vncviewer screen gets through to the 'starting windows' screen. Then video switchers to the graphics card, but vnc just keeps displaying the 'starting windows' screen. As long as the mouse is inside the vnc window on the host, then the keyboard and mouse is passed through to windows which is displayed on the other video card. If vnc is closed then there is no control over the mouse or keyboard.
Yeah, I experienced this loading Win7 last night. It's... interesting. For me the mouse pointer in VNC and the virtual one (the dot) weren't in sync so it was a pain to click on anything at the edges of the screen. Basically the mouse pointer trailed behind the dot you control directly. So I'd get to the edge of the VNC terminal and the mouse pointer would be stuck somewhere in the middle of the screen. /shrug. I just used keyboard shortcuts as much as possible to navigate. Ultimately I'll be using something else for keyboard/mouse.
I think we are talking about two different things.

When you first install windows and open it in VNC viewer, you have windows running inside of a window on your Mint desktop. This is where you get a little dot (your real mouse) and the arrow cursor in windows. I had the same problem of being able to see the lag of the arrow. If I was using VNC over the internet I can really see how the little dot helps deal with the lag. But running on the same hardware the lag is so small it almost seems distracting. If the dot was turned off I doubt Id notice the amount of lag in the cursor.

But thats not what I was refering to. After you get your VGA passthrough working, you will be looking at Windows on a seperate monitor (or the same one iwth a seocnd input) and not inside of a window. In that case, you can also have VNC viewer open on the linux machine but the VNC screen wont show any video (it is stuck at the start windows image). Inthis case all you see on the windows dekstop is the windows cursor and nothing else.

What you have is the mouse and keyboard connected tothe linux machine. VNC running on the linux machine showing on the linux VGA port. Windows video output going to the windows VGA port. VNC is forwarding the linux mouse and jeyboard 'commands' through the VNC connection over to windows (as long as the linux cursor is inside of the VNC window). And you see the cursor and text on the Windows display as if everything was normal.
Locuust

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

Post by Locuust »

I think we are talking about two different things.
Huh? We're talking about controlling the Windows DomU through VNC, right?
When you first install windows and open it in VNC viewer, you have windows running inside of a window on your Mint desktop. This is where you get a little dot (your real mouse) and the arrow cursor in windows. I had the same problem of being able to see the lag of the arrow. If I was using VNC over the internet I can really see how the little dot helps deal with the lag. But running on the same hardware the lag is so small it almost seems distracting. If the dot was turned off I doubt Id notice the amount of lag in the cursor.
Yup. Up until you load the driver for the second card Xen maintains the emulated VGA card so you see windows update in VNC.
But thats not what I was refering to. After you get your VGA passthrough working, you will be looking at Windows on a seperate monitor (or the same one iwth a seocnd input) and not inside of a window. In that case, you can also have VNC viewer open on the linux machine but the VNC screen wont show any video (it is stuck at the start windows image). Inthis case all you see on the windows dekstop is the windows cursor and nothing else.
Yeah I got the stuck/video artifacts in my VNC too once I loaded the driver for the passthrough card. Still I saw the two cursors in VNC... well.. I'm pretty sure I did. My memory sucks. I do know I couldn't properly move the mouse pointer to all the edges of the windows screen. I think it suffices to say it was acting weird (uncalibrated?).
powerhouse
Level 6
Level 6
Posts: 1138
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

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

Post by powerhouse »

Locuust wrote:...
Yeah I got the stuck/video artifacts in my VNC too once I loaded the driver for the passthrough card. Still I saw the two cursors in VNC... well.. I'm pretty sure I did. My memory sucks. I do know I couldn't properly move the mouse pointer to all the edges of the windows screen. I think it suffices to say it was acting weird (uncalibrated?).
If you use the Xen way of mouse/keyboard support under Windows, that is you don't pass through a USB controller, use the usbdevice='tablet' option in the Windows config file. At least that's what's recommended for better mouse control.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
Locuust

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

Post by Locuust »

Here's a Howto I threw together for compiling a Kernel with Xen modules builtin. I wrote it while I went through the trial and error process of making mine so let me know if something doesn't make sense.

http://forums.linuxmint.com/viewtopic.php?f=42&t=130871
gordon.cooke

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

Post by gordon.cooke »

Locuust wrote:
I think we are talking about two different things.
Huh? We're talking about controlling the Windows DomU through VNC, right?
Yes and no. Im not talking about just using VNC like normal. What Im talking about is all video going through a physical VGA passthrough to a monitor, and then using VNC only for the keyboard and mouse, but there is no video going through VNC viewer.

In my case I have the linux dom0 going to my monitor's DVI port and the windows 7 domU passthrough going to the VGA port. I use the monitor input select to move between the two. So to use win7 I have VNC running on linux, with the mouse anywhere in the vnc window, then I have the monitor on the vga input. I only see the windows pointer and everythings works like native.
Locked

Return to “Virtual Machines”