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
NotYetRated

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

Post by NotYetRated »

Wow, incredibly quick responses. Thanks so much for the help! Will get backups set up this weekend.
powerhouse
Level 6
Level 6
Posts: 1144
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 »

NotYetRated wrote:Wow, incredibly quick responses. Thanks so much for the help! Will get backups set up this weekend.
I made a little mistake in two of the scripts above and fixed them now (see EDITs) - my apologies. I hope you got your backup working.

I'm not sure if I should share such scripts that can potentially lead to data loss, if they are not applied correctly. Did you have any problems with them?

To those who saw the above scripts, I'm open to suggestions and improvements.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
chiwou

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

Post by chiwou »

I've read through some posts and the thread, but I couldn't find a definitive answer.

Are two graphic cards really necessary?

If I install a minimal setup without Xorg, couldn't I just login to the terminal and passthrough the vga and start windows or another linux system?
And the host could be controlled via SSH.

Thanks and take care
-Chris
powerhouse
Level 6
Level 6
Posts: 1144
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 »

chiwou wrote:I've read through some posts and the thread, but I couldn't find a definitive answer.

Are two graphic cards really necessary?

If I install a minimal setup without Xorg, couldn't I just login to the terminal and passthrough the vga and start windows or another linux system?
And the host could be controlled via SSH.

Thanks and take care
-Chris
Not really. If you install a headless server with Xen you can do without a GPU for dom0 (the host). However, bear in mind that you cannot "switch" your graphics card between guests. That means, if you booted the PC and then started a Windows guest, you cannot exit the Windows guest and then run a Linux guest for example and expect to get a graphics display.

The above limitation definitely applies to graphics cards without FLR (function level reset). It might work with cards that support FLR, but I'm not sure (neither my Nvidia Quadro 2000 nor my AMD HD 7770 support FLR). FLR is listed in the output of:

Code: Select all

sudo lspci -vv
If, under your graphics card, it says FLReset- it's not supported.
In practice you would need to unbind the GPU to have it list again as xm pci-list-assignable-devices.

In other words, if you don't intend to stop and run different domUs (guests), you should be OK with one GPU that's passed through to your guest.

You might be able to login to the dom0 while using the graphics display, and then run the pciback script to bind the GPU to the pciback module. In order to do so, add your graphics card PCI IDs to the pciback.conf file in step 9 and skip the 2nd command in that step:

echo "xen-pciback passthrough=1 hide=(02:00.0)(02:00.1)" >> /etc/initramfs-tools/modules

In step 10, install the script to a different place and skip:

update-rc.d pciback defaults 21 19

You will need to run the pciback script when you start your guest. The best is to combine both pciback and the domU startup command in a script - here is mine for reference (adopt to your needs !!!:

Code: Select all

#!/bin/sh

configfile=/etc/xen/pciback.conf

# The following bindback function is:
# License: GPLv2
# Author: Peter Maloney
#
# Script to bind devices to pciback (or pci-stub)
   
bindback() {
	device="$1"

	if [ ! -e "/sys/bus/pci/devices/$device" ]; then
		zenity --warning --window-icon=error --timeout=15 --text="ERROR: Device does not exist... cancelling" &
		return
	fi

#	with pciback, you do unbind, then new_slot, then bind

	if [ ! -e "/sys/bus/pci/devices/$device/driver" ]; then
		zenity --warning --window-icon=error --timeout=15 --text="    no driver to unbind" &
	else
		chmod +w "/sys/bus/pci/devices/${device}/driver/unbind"
		echo -n "$device" > "/sys/bus/pci/devices/$device/driver/unbind"
	fi

	chmod +w /sys/bus/pci/drivers/pciback/new_slot
	echo -n "$device" > /sys/bus/pci/drivers/pciback/new_slot

	chmod +w /sys/bus/pci/drivers/pciback/bind
	echo -n "$device" > /sys/bus/pci/drivers/pciback/bind
    
}



if xm list | grep -q win7; then
	zenity --info --window-icon=info --timeout=15 --text="Windows 7 is already running." &
	exit 1

else

	cat $configfile | while read line;do
	echo $line | grep ^# >/dev/null 2>&1 && continue
		bindback $line
	done

# Create (run) the guest:
	xm create /etc/xen/win7.cfg &> /dev/null
	zenity --info --timeout=15 --text="Starting Windows 7, please wait." &
	exit 0

fi
In step 11 skip the following command:

update-initramfs -k all -c

Before you follow my how-to, make sure you have an ssh server installed and configured, and that you can access your machine from a remote PC !!!

Good luck!
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
chiwou

Post by chiwou »

Thanks for the detailed support.
But this way if I unbind the VGA after a guest shutdown, I should be able to use the VGA in my host or another guest.
At least theoretically :-)
powerhouse
Level 6
Level 6
Posts: 1144
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re:

Post by powerhouse »

chiwou wrote:Thanks for the detailed support.
But this way if I unbind the VGA after a guest shutdown, I should be able to use the VGA in my host or another guest.
At least theoretically :-)
No, unless your graphics card supports FLR. VGA passthrough is different from PCI passthrough. You can easily unbind for example USB or SATA controllers and then bind them to the host or another VM. VGA devices are different in that there is a lot more going on behind the scene than just passing through the devices. I tried it with my Quadro 2000 and all hell broke loose - I had to hard reset the dom0 when I tried. However, you may experiment with it and perhaps your graphics card plays better.

Here a script I found on the net (don't know who wrote it), that seems to be doing the job: http://pastebin.com/6DYec0jM. Be careful to check the entire script carefully.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
chiwou

Post by chiwou »

Thanks again B-)
mbalino

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

Post by mbalino »

Well, my friends ... I am almost giving up with Linux ...
I updated the BIOS to 4608 which enabled the Vt-d :

mbalino@Bolso:~ > sudo xm dmesg
(XEN) Xen version 4.3.0 (Ubuntu 4.3.0-1ubuntu1.2) (stefan.bader@canonical.com) (gcc (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1) debug=n Tue Dec 17 15:35:25 UTC 2013
(XEN) Bootloader: GRUB 2.00-19ubuntu2
(XEN) Intel VT-d iommu 0 supported page sizes: 4kB, 2MB, 1GB.
(XEN) Intel VT-d Snoop Control enabled.
(XEN) Intel VT-d Dom0 DMA Passthrough not enabled.
(XEN) Intel VT-d Queued Invalidation enabled.
(XEN) Intel VT-d Interrupt Remapping enabled.
(XEN) Intel VT-d Shared EPT tables enabled.
(XEN) I/O virtualisation enabled
(XEN) - Dom0 mode: Relaxed

I followed step by step the list and I get this results:
mbalino@Bolso:~ > sudo xm pci-list-assignable-devices
0000:02:00.0
0000:02:00.1

I got win7 up and runing (I noticed some lags in the response, in the mouse, etc) but I can't access the PCI
I am stucked again in the same issue.

Can you please tell me when you click on SHOW VIRTUAL HARDWARE DETAILS, if you can see your PCI 02:00.0 /1
If I try to add hardware, then the VM freeze and close (I can hear the fan of the card spin up for few sec)

I need some help guys ...

Marcel
powerhouse
Level 6
Level 6
Posts: 1144
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 »

Hello mbalino:

First of all the dmesg output and xm pci-list-assignable-devices looks good ! This is a MAJOR advance.

Now in order to find out the reason why you are not able to install the driver, I need some information. Can you post the following:

1. Your /etc/xen/win7.cfg file
2. A screen shot of your device manager in Windows, with graphics adapter tab open (see my screen shot below)
3. Name and model of your graphics adapter (the one you pass through to Windows)

Now to your question:
Can you please tell me when you click on SHOW VIRTUAL HARDWARE DETAILS, if you can see your PCI 02:00.0 /1
I have no idea what you are talking about. Where do you see "SHOW VIRTUAL HARDWARE DETAILS"? Are you referring to virt-manager?

If so, please don't use virt-manager. Install vncviewer and, after you have started your guest domain, use

Code: Select all

sudo xm vncviewer win7
"win7" being the name of the guest domain (domU).

Once booted into Windows, open the Device manager, and there open the Display adapter tab:
Device manager graphics.png
In your case you should see your graphics adapter listed, with a yellow triangle, since the driver is missing. Below the entry of your graphics adapter is the "Standard VGA graphics adapter".

Now either let Windows find a driver (I believe right-click should show an option), or better download the relevant AMD graphics driver while inside your Windows guest. After you downloaded the driver, run it and let it do its things.

Note: Some people have reported problems with the Catalyst Control Center (CCC). You can install the driver without the CCC.

Once the driver is installed you may need to reboot your Windows guest to have Windows switch to the second display adapter (your passed through graphics card). When you reboot Windows, your screen should go blank and you will need to switch your screen to the second VGA adapter, the one used by your Windows guest (my screen switches automatically).

As for mouse and keyboard support, check out "synergy" - see http://synergy-foss.org/. Read the documentation first: http://synergy-foss.org/help/ and http://synergy-foss.org/wiki/User.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
mbalino

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

Post by mbalino »

lspci | grep VGA

Code: Select all

mbalino@Bolso:~ > 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT [Radeon HD 7970/R9 280X]
02:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde XT [Radeon HD 7770 GHz Edition 
sudo xm dmesg

Code: Select all

(XEN) Xen version 4.3.0 (Ubuntu 4.3.0-1ubuntu1.2) (stefan.bader@canonical.com) (gcc (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1) debug=n Tue Dec 17 15:35:25 UTC 2013
(XEN) Bootloader: GRUB 2.00-19ubuntu2
(XEN) Command line: placeholder something iommu=1 dom0_mem=2048M something else
(XEN) Video information:
(XEN)  VGA is text mode 80x25, font 8x16
(XEN)  VBE/DDC methods: V2; EDID transfer time: 1 seconds
(XEN) Disc information:
(XEN)  Found 2 MBR signatures
(XEN)  Found 6 EDD information structures
(XEN) Xen-e820 RAM map:
(XEN)  0000000000000000 - 000000000009e800 (usable)
(XEN)  000000000009e800 - 00000000000a0000 (reserved)
(XEN)  00000000000e0000 - 0000000000100000 (reserved)
(XEN)  0000000000100000 - 00000000bbf1e000 (usable)
(XEN)  00000000bbf1e000 - 00000000bc35c000 (reserved)
(XEN)  00000000bc35c000 - 00000000bc46a000 (ACPI data)
(XEN)  00000000bc46a000 - 00000000bc68c000 (ACPI NVS)
(XEN)  00000000bc68c000 - 00000000bd71c000 (reserved)
(XEN)  00000000bd71c000 - 00000000bd71d000 (usable)
(XEN)  00000000bd71d000 - 00000000bd7a3000 (ACPI NVS)
(XEN)  00000000bd7a3000 - 00000000bdbde000 (usable)
(XEN)  00000000bdbde000 - 00000000bdff4000 (reserved)
(XEN)  00000000bdff4000 - 00000000be000000 (usable)
(XEN)  00000000e0000000 - 00000000f0000000 (reserved)
(XEN)  00000000fed1c000 - 00000000fed20000 (reserved)
(XEN)  00000000ff000000 - 0000000100000000 (reserved)
(XEN)  0000000100000000 - 0000000840000000 (usable)
(XEN) ACPI: RSDP 000F0490, 0024 (r2 ALASKA)
(XEN) ACPI: XSDT BC392078, 0064 (r1 ALASKA    A M I  1072009 AMI     10013)
(XEN) ACPI: FACP BC39C240, 010C (r5 ALASKA    A M I  1072009 AMI     10013)
(XEN) ACPI: DSDT BC392170, A0C9 (r2 ALASKA    A M I       16 INTL 20051117)
(XEN) ACPI: FACS BC683080, 0040
(XEN) ACPI: APIC BC39C350, 00C8 (r3 ALASKA    A M I  1072009 AMI     10013)
(XEN) ACPI: FPDT BC39C418, 0044 (r1 ALASKA    A M I  1072009 AMI     10013)
(XEN) ACPI: MCFG BC39C460, 003C (r1 ALASKA OEMMCFG.  1072009 MSFT       97)
(XEN) ACPI: HPET BC39C4A0, 0038 (r1 ALASKA    A M I  1072009 AMI.        5)
(XEN) ACPI: BGRT BC469710, 0038 (r0 ALASKA    A M I  1072009 AMI     10013)
(XEN) ACPI: SSDT BC39C530, CD128 (r2  INTEL    CpuPm     4000 INTL 20051117)
(XEN) ACPI: DMAR BC469658, 00B4 (r1 A M I   OEMDMAR        1 INTL        1)
(XEN) System RAM: 32707MB (33491984kB)
(XEN) Domain heap initialised
(XEN) ACPI: 32/64X FACS address mismatch in FADT - bc683080/0000000000000000, using 32
(XEN) Processor #0 7:14 APIC version 21
(XEN) Processor #2 7:14 APIC version 21
(XEN) Processor #4 7:14 APIC version 21
(XEN) Processor #6 7:14 APIC version 21
(XEN) Processor #1 7:14 APIC version 21
(XEN) Processor #3 7:14 APIC version 21
(XEN) Processor #5 7:14 APIC version 21
(XEN) Processor #7 7:14 APIC version 21
(XEN) IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23
(XEN) IOAPIC[1]: apic_id 2, version 32, address 0xfec01000, GSI 24-47
(XEN) Enabling APIC mode:  Flat.  Using 2 I/O APICs
(XEN) Switched to APIC driver x2apic_cluster.
(XEN) Using scheduler: SMP Credit Scheduler (credit)
(XEN) Detected 3702.442 MHz processor.
(XEN) Initing memory sharing.
(XEN) xstate_init: using cntxt_size: 0x340 and states: 0x7
(XEN) Intel VT-d iommu 0 supported page sizes: 4kB, 2MB, 1GB.
(XEN) Intel VT-d Snoop Control enabled.
(XEN) Intel VT-d Dom0 DMA Passthrough not enabled.
(XEN) Intel VT-d Queued Invalidation enabled.
(XEN) Intel VT-d Interrupt Remapping enabled.
(XEN) Intel VT-d Shared EPT tables enabled.
(XEN) I/O virtualisation enabled
(XEN)  - Dom0 mode: Relaxed
(XEN) Interrupt remapping enabled
(XEN) Enabled directed EOI with ioapic_ack_old on!
(XEN) ENABLING IO-APIC IRQs
(XEN)  -> Using old ACK method
(XEN) Platform timer is 14.318MHz HPET
(XEN) Allocated console ring of 16 KiB.
(XEN) VMX: Supported advanced features:
(XEN)  - APIC MMIO access virtualisation
(XEN)  - APIC TPR shadow
(XEN)  - Extended Page Tables (EPT)
(XEN)  - Virtual-Processor Identifiers (VPID)
(XEN)  - Virtual NMI
(XEN)  - MSR direct-access bitmap
(XEN)  - Unrestricted Guest
(XEN) HVM: ASIDs enabled.
(XEN) HVM: VMX enabled
(XEN) HVM: Hardware Assisted Paging (HAP) detected
(XEN) HVM: HAP page sizes: 4kB, 2MB, 1GB
(XEN) Brought up 8 CPUs
(XEN) *** LOADING DOMAIN 0 ***
(XEN)  Xen  kernel: 64-bit, lsb, compat32
(XEN)  Dom0 kernel: 64-bit, PAE, lsb, paddr 0x1000000 -> 0x23f6000
(XEN) PHYSICAL MEMORY ARRANGEMENT:
(XEN)  Dom0 alloc.:   000000081c000000->0000000820000000 (489916 pages to be allocated)
(XEN)  Init. ramdisk: 000000083b9bc000->000000083ffff400
(XEN) VIRTUAL MEMORY ARRANGEMENT:
(XEN)  Loaded kernel: ffffffff81000000->ffffffff823f6000
(XEN)  Init. ramdisk: ffffffff823f6000->ffffffff86a39400
(XEN)  Phys-Mach map: ffffffff86a3a000->ffffffff86e3a000
(XEN)  Start info:    ffffffff86e3a000->ffffffff86e3a4b4
(XEN)  Page tables:   ffffffff86e3b000->ffffffff86e76000
(XEN)  Boot stack:    ffffffff86e76000->ffffffff86e77000
(XEN)  TOTAL:         ffffffff80000000->ffffffff87000000
(XEN)  ENTRY ADDRESS: ffffffff81d2f1e0
(XEN) Dom0 has maximum 8 VCPUs
(XEN) Scrubbing Free RAM: ..............................................................................................................................................................................................................................................................................................................done.
(XEN) Initial low memory virq threshold set at 0x4000 pages.
(XEN) Std. Loglevel: Errors and warnings
(XEN) Guest Loglevel: Nothing (Rate-limited: Errors and warnings)
(XEN) Xen is relinquishing VGA console.
(XEN) *** Serial input -> DOM0 (type 'CTRL-a' three times to switch input to Xen)
(XEN) Freed 260kB init memory.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
mbalino@Bolso:~ > 
cat /etc/default/grub

Code: Select all

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT="Xen 4.3-amd64"
# GRUB_HIDDEN_TIMEOUT=0
# GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"


# Xen boot parameters for all Xen boots
GRUB_CMDLINE_XEN="something iommu=1 dom0_mem=2048M"
# Xen boot parameters for non-recovery Xen boots (in addition to GRUB_CMDLINE_XEN)
GRUB_CMDLINE_XEN_DEFAULT="something else"
mbalino@Bolso:~ > 
sudo pvdisplay

Code: Select all

  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               LVMGroup
  PV Size               1.82 TiB / not usable 4.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              476803
  Free PE               3
  Allocated PE          476800
  PV UUID               KFoHLb-iEcL-2IOV-fvhR-SLvE-zhOU-tHM272
mbalino@Bolso:~ > 
sudo vgdisplay

Code: Select all

  --- Volume group ---                                                                                
  VG Name               LVMGroup                                                                      
  System ID                                                                                           
  Format                lvm2                                                                          
  Metadata Areas        1                                                                             
  Metadata Sequence No  4                                                                             
  VG Access             read/write                                                                    
  VG Status             resizable                                                                     
  MAX LV                0                                                                             
  Cur LV                3                                                                             
  Open LV               3                                                                             
  Max PV                0                                                                             
  Cur PV                1                                                                             
  Act PV                1                                                                             
  VG Size               1.82 TiB
  PE Size               4.00 MiB
  Total PE              476803
  Alloc PE / Size       476800 / 1.82 TiB
  Free  PE / Size       3 / 12.00 MiB
  VG UUID               Hy5KAj-1Ce2-A1pL-W9hs-DZU1-2yvP-j28uvH
   
sudo lvdisplay

Code: Select all

  --- Logical volume ---
  LV Path                /dev/LVMGroup/WinVHD
  LV Name                WinVHD
  VG Name                LVMGroup
  LV UUID                1zfNqu-0r50-O2JH-FnEb-3d8k-8wNt-EYOB4e
  LV Write Access        read/write
  LV Creation host, time Bolso, 2014-01-05 14:22:52 -0700
  LV Status              available
  # open                 1
  LV Size                350.00 GiB
  Current LE             89600
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0
   
  --- Logical volume ---
  LV Path                /dev/LVMGroup/Data
  LV Name                Data
  VG Name                LVMGroup
  LV UUID                1kCpWN-78cn-GNAV-lSWk-C9KL-N0W6-y9F8ut
  LV Write Access        read/write
  LV Creation host, time Bolso, 2014-01-05 14:23:20 -0700
  LV Status              available
  # open                 1
  LV Size                550.00 GiB
  Current LE             140800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1
   
  --- Logical volume ---
  LV Path                /dev/LVMGroup/Documents
  LV Name                Documents
  VG Name                LVMGroup
  LV UUID                xqxtnT-hTPs-XBEi-pMfx-Aj9I-IIs8-iIDWhK
  LV Write Access        read/write
  LV Creation host, time Bolso, 2014-01-05 14:28:12 -0700
  LV Status              available
  # open                 1
  LV Size                962.50 GiB
  Current LE             246400
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2
sudo inxi -Fx

Code: Select all

System:    Host: Bolso Kernel: 3.12.6-031206-generic x86_64 (64 bit, gcc: 4.6.3) Desktop: N/A Distro: Linux Mint 16 Petra
Machine:   Mobo: ASUSTeK model: SABERTOOTH X79 version: Rev 1.xx serial: 130309290900345
           Bios: American Megatrends version: 4608 date: 12/24/2013
CPU:       Quad core Intel Core i7-4820K CPU (-HT-MCP-) cache: 10240 KB flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3) bmips: 29619.5 
           Clock Speeds: 1: 3702.442 MHz 2: 3702.442 MHz 3: 3702.442 MHz 4: 3702.442 MHz 5: 3702.442 MHz 6: 3702.442 MHz 7: 3702.442 MHz 8: 3702.442 MHz
Graphics:  Card-1: Advanced Micro Devices [AMD/ATI] Tahiti XT [Radeon HD 7970/R9 280X] bus-ID: 01:00.0 
           Card-2: Advanced Micro Devices [AMD/ATI] Cape Verde XT [Radeon HD 7770 GHz Edition] bus-ID: 02:00.0 
           X.org: 1.14.3 driver: fglrx tty size: 102x52 Advanced Data: N/A for root 
Audio:     Card-1: Intel C600/X79 series chipset High Definition Audio Controller driver: snd_hda_intel bus-ID: 00:1b.0
           Card-2: Advanced Micro Devices [AMD/ATI] Tahiti XT HDMI Audio [Radeon HD 7970 Series] driver: snd_hda_intel bus-ID: 01:00.1
           Card-3: Advanced Micro Devices [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] driver: pciback bus-ID: 02:00.1
           Sound: Advanced Linux Sound Architecture ver: k3.12.6-031206-generic
Network:   Card: Intel 82579V Gigabit Network Connection driver: e1000e ver: 2.3.2-k port: f040 bus-ID: 00:19.0
           IF: eth0 state: up speed: 1000 Mbps duplex: full mac: 74:d0:2b:28:00:ca
Drives:    HDD Total Size: 2250.5GB (0.5% used) 1: id: /dev/sda model: ST2000DM001 size: 2000.4GB 
           2: id: /dev/sdb model: Samsung_SSD_840 size: 250.1GB 
Partition: ID: / size: 229G used: 12G (5%) fs: xfs ID: /boot size: 226M used: 83M (40%) fs: ext4 
           ID: swap-1 size: 4.00GB used: 0.01GB (0%) fs: swap 
RAID:      No RAID devices detected - /proc/mdstat and md_mod kernel raid module present
Sensors:   System Temperatures: cpu: 30.0C mobo: N/A gpu: 54.00C 
           Fan Speeds (in rpm): cpu: N/A 
Info:      Processes: 300 Uptime: 1:20 Memory: 1128.9/1566.0MB Runlevel: 2 Gcc sys: 4.8.1 Client: Shell inxi: 1.8.4 
mbalino@Bolso:~ > 
cat /var/log/boot.log

Code: Select all

mbalino@Bolso:~ > Scanning for Btrfs filesystems
 * Starting SystemD login management service                             [ OK ]
 * Starting bluetooth daemon                                             [ OK ]
 * Starting configure network device security                            [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting mDNS/DNS-SD daemon                                           [ OK ]
 * Starting Reload cups, upon starting avahi-daemon to make sure remote q[ OK ]are populated
 * Starting Mount network filesystems                                    [ OK ]
 * Starting Failsafe Boot Delay                                          [ OK ]
 * Starting SMB/CIFS File Server                                         [ OK ]
 * Starting Reload cups, upon starting avahi-daemon to make sure remote q[fail]are populated
 * Stopping Mount network filesystems                                    [ OK ]
 * Starting Bridge file events into upstart                              [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting Bridge socket events into upstart                            [ OK ]
 * Starting configure network device                                     [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting CUPS printing spooler/server                                 [ OK ]
 * Starting cups-browsed - Bonjour remote printer browsing daemon        [ OK ]
 * Starting Samba Auto-reload Integration                                [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping Samba Auto-reload Integration                                [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping cold plug devices                                            [ OK ]
 * Stopping log initial device creation                                  [ OK ]
 * Starting load fallback graphics devices                               [ OK ]
 * Starting enable remaining boot-time encrypted block devices           [ OK ]
 * Starting configure network device security                            [ OK ]
 * Starting load fallback graphics devices                               [fail]
 * Stopping enable remaining boot-time encrypted block devices           [ OK ]
 * Starting save udev log and update rules                               [ OK ]
 * Stopping save udev log and update rules                               [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting configure network device security                            [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting configure network device                                     [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting Mount network filesystems                                    [ OK ]
 * Stopping Failsafe Boot Delay                                          [ OK ]
 * Starting System V initialisation compatibility                        [ OK ]
 * Starting modem connection manager                                     [ OK ]
 * Starting configure network device security                            [ OK ]
 * Starting NetBIOS name server                                          [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping Mount network filesystems                                    [ OK ]
 * Starting configure virtual network devices                            [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting network connection manager                                   [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting zfs-fuse zfs-fuse                                            [ OK ] 
 * Immunizing zfs-fuse against OOM kills and sendsigs signals...         [ OK ] 
 * Mounting ZFS filesystems...                                           [ OK ] 
 * Setting sensors limits                                                [ OK ] 
 * Setting up X socket directories...                                    [ OK ] 
 * Stopping System V initialisation compatibility                        [ OK ]
 * Starting KVM                                                          [ OK ]
 * Starting System V runlevel compatibility                              [ OK ]
 * Starting                                                              [ OK ]
 * Starting                                                              [ OK ]
 * Starting OpenSSH server                                               [ OK ]
 * Starting                                                              [ OK ]
 * Starting                                                              [ OK ]
 * Starting MDM Display Manager                                          [ OK ]
 * Starting save kernel messages                                         [ OK ]
 * Starting                                                              [ OK ]
 * Starting anac(h)ronistic cron                                         [ OK ]
 * Starting regular background program processing daemon                 [ OK ]
 * Starting deferred execution scheduler                                 [ OK ]
 * Stopping save kernel messages                                         [ OK ]
 * Starting                                                              [ OK ]
 * Starting ACPI daemon                                                  [ OK ]
 * Starting CPU interrupts balancing daemon                              [ OK ]
 * Starting libvirt daemon                                               [ OK ]
 * Stopping Restore Sound Card State                                     [ OK ]
 * Starting startpar bridge for notification of upstart job start/stop   [ OK ]
 * Stopping startpar bridge for notification of upstart job start/stop   [ OK ]
 * Starting DirMngr dirmngr                                              [ OK ] 
speech-dispatcher disabled; edit /etc/default/speech-dispatcher
mbalino@Bolso:~ > 
cat /proc/cpuinfo

Code: Select all

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      : Intel(R) Core(TM) i7-4820K CPU @ 3.70GHz
stepping        : 4
microcode       : 0x416
cpu MHz         : 3702.442
cache size      : 10240 KB
physical id     : 0
siblings        : 8
core id         : 0
cpu cores       : 4
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu de tsc msr pae mce cx8 apic sep mca cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl nonstop_tsc eagerfpu pni pclmulqdq monitor est ssse3 cx16 sse4_1 sse4_2 popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb xsaveopt pln pts dtherm fsgsbase erms
bogomips        : 7404.88
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:
sudo xm list

Code: Select all

Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  2048     8     r-----    685.8
Win7                                            8192     4                 0.0
mbalino@Bolso:~ > 
sudo xm pci-list-assignable-devices

Code: Select all

0000:02:00.0
0000:02:00.1
mbalino@Bolso:~ > 
sudo xm info

Code: Select all

host                   : Bolso
release                : 3.12.6-031206-generic
version                : #201312201218 SMP Fri Dec 20 17:20:06 UTC 2013
machine                : x86_64
nr_cpus                : 8
nr_nodes               : 1
cores_per_socket       : 4
threads_per_core       : 2
cpu_mhz                : 3702
hw_caps                : bfebfbff:2c100800:00000000:00007f00:77bee3bf:00000000:00000001:00000281
virt_caps              : hvm hvm_directio
total_memory           : 32707
free_memory            : 30233
free_cpus              : 0
xen_major              : 4
xen_minor              : 3
xen_extra              : .0
xen_caps               : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64 
xen_scheduler          : credit
xen_pagesize           : 4096
platform_params        : virt_start=0xffff800000000000
xen_changeset          : 
xen_commandline        : placeholder something iommu=1 dom0_mem=2048M something else
cc_compiler            : gcc (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1
cc_compile_by          : stefan.bader
cc_compile_domain      : canonical.com
cc_compile_date        : Tue Dec 17 15:35:25 UTC 2013
xend_config_format     : 4
sudo brctl show

Code: Select all

bridge name     bridge id               STP enabled     interfaces
virbr0          8000.000000000000       yes
xenbr0          8000.74d02b2800ca       no              eth0
lspci -v | grep -A 10 VGA

Code: Select all

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT [Radeon HD 7970/R9 280X] (prog-if 00 [VGA controller])
        Subsystem: Hightech Information System Ltd. HD 7970 IceQ X²
        Flags: bus master, fast devsel, latency 0, IRQ 156
        Memory at d0000000 (64-bit, prefetchable) [size=256M]
        Memory at fbe00000 (64-bit, non-prefetchable) [size=256K]
        I/O ports at e000 [size=256]
        Expansion ROM at fbe40000 [disabled] [size=128K]
        Capabilities: <access denied>
        Kernel driver in use: fglrx_pci

01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT HDMI Audio [Radeon HD 7970 Series]
--
02:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde XT [Radeon HD 7770 GHz Edition] (prog-if 00 [VGA controller])
        Subsystem: Hightech Information System Ltd. Device 201c
        Flags: bus master, fast devsel, latency 0, IRQ 155
        Memory at c0000000 (64-bit, prefetchable) [size=256M]
        Memory at fbd00000 (64-bit, non-prefetchable) [size=256K]
        I/O ports at d000 [size=256]
        Expansion ROM at fbd40000 [disabled] [size=128K]
        Capabilities: <access denied>
        Kernel driver in use: pciback

02:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
sudo cat /etc/network/interfaces

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback


auto xenbr0
iface xenbr0 inet dhcp
    bridge_ports eth0

# auto eth0
mbalino@Bolso:~ > 
cat /sys/hypervisor/properties/capabilities

Code: Select all

xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64 
cat /etc/xen/Win7.cfg

Code: Select all

kernel_override = "/usr/lib/xen-default/boot/hvmloader"
# kernel = “/usr/lib/xen-default/boot/hvmloader”
builder='hvm'
# Memory reserved for Windows domU, in this case 4GB (adjust to your
# needs):
memory = 8192
# Name of the domU that will be created/used:
name = "win7"
vcpus=6 #Most CPUs have 4 cores / 8 threads (=vcpus). Check your CPU
# and change as needed!
#pae=1 #only for 32 bit guests - don't use for 64 bit!
acpi=1
apic=1
# Here my virtual network interfaces – see /etc/network/interfaces below:
vif = [ 'mac=00:16:3e:68:e1:01,bridge=xenbr0' ]
# vif = [ 'vifname=win7,type=ioemu,mac=00:16:3e:68:e1:01,bridge=xenbr0' ]
# I assigned a static MAC address, else it will be changed each time Windows
# boots. The address should start with 00:16:3e., the rest is up to you.
#
# Specifying the disks and Windows ISO for installation, adjust to your
# needs:
disk = ['/dev/mapper/os-Windows,raw,hda,rw']
#disk = [ 'phy:/dev/mapper/guest-win7,hda,w' ]

# More disks can be added later using this same method. The path to the
# device or a file can be added. After the first comma is how the device will
# appear. “hda” is the first, “hdb” the second etc. “hda” will appear as IDE,
# sda will appear as SCSI or SATA. After the second comma “r” means read
# only and “w” is for write.

# device_model = ‘/usr/lib/xen-default/bin/qemu-dm’
device_model_override = '/usr/lib/xen-default/bin/qemu-dm'

boot="dc"
# The above should be changed once Windows is installed: boot=”c” to only
# show the Windows file system, else it may try to boot from the ISO image.
sdl=0
vnc=1
vncpasswd=""
stdvga=0
# nographic=1 #!!! only uncomment this if you are using win8 or are trying
# to get a Nvidia card to work. In my case – Nvidia Quadro 2000 - this was not
# needed.
serial='pty'
tsc_mode="default"
#tsc_mode=0

viridian=1
#soundhw=’all’ # I commented it out since it’s not relevant to me now.
usb=1 # This allows sharing the USB mouse/keyboard.
usbdevice=’tablet’ # is recommended; in conjunction with USB=1, else comment out

gfx_passthru=1
# Leaving this as 0 is how it works for me with my Quadro 2000 card.
# gfx_passthru=1 would pass through the graphics card as primary display adapter.
# You can change this later for iGPUs or nVidia if needed.
# Try it with 0 first!
pci=['02:00.0','02:00.1']

# These values are the ones you found out using the lspci command earlier.
# I also passed through an entire USB controller for native support.
# You can use usb-devices to find out to which hub/host the keyboard/mouse
# is connected. I use a USB KVM switch to connect my keyboard/mouse to two
# USB ports residing on different hubs! One – 00:1a.0 – is then passed through
# to the domU.
# The following lets Windows take the local time from the dom0:
localtime=1
#To turn on pci power management globally, use (see remarks under pci=... below):
pci_power_mgmt=1
mbalino@Bolso:~ > 
Few additions:
* sudo xm vncviewer Win7 --> Does not do anything, just few seconds and nothing, got back to the prompt
* I don't have pciback.conf file (it is ok?)
* notification area: "Connection wired 1 deactivated" every 2 minutes it pop up this message and keep on and on
* If I choose "ADD HARDWARE" in virt-manager and select PCI 0002:00:00 when click on START the fan spin up and the VM shut-off few seconds after (see snapshots)
mbalino

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

Post by mbalino »

Adding manually the PCI Host device
powerhouse
Level 6
Level 6
Posts: 1144
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 »

mbalino wrote:lspci | grep VGA

Code: Select all

mbalino@Bolso:~ > 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT [Radeon HD 7970/R9 280X]
02:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde XT [Radeon HD 7770 GHz Edition 
OK, you try to pass through the AMD 7770 card. I got the same but I'm using it for dom0. Unfortunately I won't have the time now to test the 7770, but I doubt that this is the problem. See also http://www.overclock.net/t/1307834/xen- ... s-adapters.
mbalino wrote:sudo xm dmesg

Code: Select all

...
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
(XEN) traps.c:2503:d0 Domain attempted WRMSR 00000000000001fc from 0x000000002104005b to 0x0000000021040059.
mbalino@Bolso:~ > 
I don't know what this means, but it may point to a problem. Did your run xm dmesg after trying to start the Windows VM? The rest of the xm dmesg output looks fine - it's mostly identical to mine.
mbalino wrote:cat /etc/default/grub

Code: Select all

# Xen boot parameters for all Xen boots
GRUB_CMDLINE_XEN="something iommu=1 dom0_mem=2048M"
# Xen boot parameters for non-recovery Xen boots (in addition to GRUB_CMDLINE_XEN)
GRUB_CMDLINE_XEN_DEFAULT="something else"
mbalino@Bolso:~ > 
Replace the entire "Xen" section in your /etc/default/grub file by:

Code: Select all

GRUB_CMDLINE_XEN="iommu=1 dom0_mem=2048M,max:2048M"
and run

Code: Select all

sudo update-grub
I don't know what "something" or "something else" does in your grub file, but it shouldn't be there.
mbalino wrote:sudo inxi -Fx

Code: Select all

...
Graphics:  Card-1: Advanced Micro Devices [AMD/ATI] Tahiti XT [Radeon HD 7970/R9 280X] bus-ID: 01:00.0 
           Card-2: Advanced Micro Devices [AMD/ATI] Cape Verde XT [Radeon HD 7770 GHz Edition] bus-ID: 02:00.0 
           X.org: 1.14.3 driver: fglrx tty size: 102x52 Advanced Data: N/A for root 
...
Mine shows:

Code: Select all

X.org: 1.14.3 drivers: ati,fglrx (unloaded: fbdev,vesa,radeon)...
You could replace your GRUB_CMDLINE_LINUX_DEFAULT entry in your /etc/default/grub file with:

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="radeon.blacklist=1 profile elevator=deadline quiet splash"
if you use the SSD to boot! Else enter:

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="radeon.blacklist=1 quiet splash"
In both cases perform sudo update-grub.

I think the problem lies here:
mbalino wrote:cat /etc/xen/Win7.cfg

Code: Select all

kernel_override = "/usr/lib/xen-default/boot/hvmloader"
# kernel = “/usr/lib/xen-default/boot/hvmloader”
builder='hvm'
# Memory reserved for Windows domU, in this case 4GB (adjust to your
# needs):
memory = 8192
# Name of the domU that will be created/used:
name = "win7"
vcpus=6 #Most CPUs have 4 cores / 8 threads (=vcpus). Check your CPU
# and change as needed!
#pae=1 #only for 32 bit guests - don't use for 64 bit!
acpi=1
apic=1
# Here my virtual network interfaces – see /etc/network/interfaces below:
vif = [ 'mac=00:16:3e:68:e1:01,bridge=xenbr0' ]
# vif = [ 'vifname=win7,type=ioemu,mac=00:16:3e:68:e1:01,bridge=xenbr0' ]
# I assigned a static MAC address, else it will be changed each time Windows
# boots. The address should start with 00:16:3e., the rest is up to you.
#
# Specifying the disks and Windows ISO for installation, adjust to your
# needs:
disk = ['/dev/mapper/os-Windows,raw,hda,rw']
#disk = [ 'phy:/dev/mapper/guest-win7,hda,w' ]

# More disks can be added later using this same method. The path to the
# device or a file can be added. After the first comma is how the device will
# appear. “hda” is the first, “hdb” the second etc. “hda” will appear as IDE,
# sda will appear as SCSI or SATA. After the second comma “r” means read
# only and “w” is for write.

# device_model = ‘/usr/lib/xen-default/bin/qemu-dm’
device_model_override = '/usr/lib/xen-default/bin/qemu-dm'

boot="dc"
# The above should be changed once Windows is installed: boot=”c” to only
# show the Windows file system, else it may try to boot from the ISO image.
sdl=0
vnc=1
vncpasswd=""
stdvga=0
# nographic=1 #!!! only uncomment this if you are using win8 or are trying
# to get a Nvidia card to work. In my case – Nvidia Quadro 2000 - this was not
# needed.
serial='pty'
tsc_mode="default"
#tsc_mode=0

viridian=1
#soundhw=’all’ # I commented it out since it’s not relevant to me now.
usb=1 # This allows sharing the USB mouse/keyboard.
usbdevice=’tablet’ # is recommended; in conjunction with USB=1, else comment out

gfx_passthru=1
# Leaving this as 0 is how it works for me with my Quadro 2000 card.
# gfx_passthru=1 would pass through the graphics card as primary display adapter.
# You can change this later for iGPUs or nVidia if needed.
# Try it with 0 first!
pci=['02:00.0','02:00.1']

# These values are the ones you found out using the lspci command earlier.
# I also passed through an entire USB controller for native support.
# You can use usb-devices to find out to which hub/host the keyboard/mouse
# is connected. I use a USB KVM switch to connect my keyboard/mouse to two
# USB ports residing on different hubs! One – 00:1a.0 – is then passed through
# to the domU.
# The following lets Windows take the local time from the dom0:
localtime=1
#To turn on pci power management globally, use (see remarks under pci=... below):
pci_power_mgmt=1
mbalino@Bolso:~ > 
Specifically:

Code: Select all

disk = ['/dev/mapper/os-Windows,raw,hda,rw']
When using /dev/mapper, the syntax is /dev/mapper/<VG_group>-<LV>

Your VG-group according to your vgdisplay above is "LVMGroup", your Windows LV is "WinVHD". Check it with:

Code: Select all

ls /dev/mapper
Do you see an "LVMGroup-WinVHD" entry? If yes, replace the disk=... line in your /etc/xen/Win7.cfg file with this:

Code: Select all

disk = [ 'phy:/dev/mapper/LVMGroup-WinVHD,hda,w' ]
Note the syntax I use - yours may be correct too, but mine definitely works!

While we are at it, change:

Code: Select all

boot="dc"
to

Code: Select all

boot="c"
Note: I assume you managed to install Windows?

The following entry in your config file is most likely NOT going to work:

Code: Select all

gfx_passthru=1
Change it to:

Code: Select all

gfx_passthru=0
[/b]

You can also revert the kernel_override and device_model_override entries and use the ones I provided. But start with the above Win7.cfg changes.
mbalino wrote:Few additions:
* sudo xm vncviewer Win7 --> Does not do anything, just few seconds and nothing, got back to the prompt
* I don't have pciback.conf file (it is ok?)
* notification area: "Connection wired 1 deactivated" every 2 minutes it pop up this message and keep on and on
* If I choose "ADD HARDWARE" in virt-manager and select PCI 0002:00:00 when click on START the fan spin up and the VM shut-off few seconds after (see snapshots)
Do yourself a favor - don't use virt-manager ! First there are bugs/incompatibilities with the newer Xen releases, but worst of all virt-manager creates files and images in the most irregular places. Try find a human readable config file of a guest you created with virt-manager. The best is to get completely rid of it.

pciback.conf: You don't need it, but in that case don't install the pciback script either! I understand that you pass through your VGA card using the initramfs method, and it works fine. So there is no need to have the pciback script and config file.
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 make dual-boot obsolete using XEN VGA passthrough

Post by powerhouse »

mbalino wrote:Adding manually the PCI Host device
Don't use virt-manager!

To start Windows, use this command:

Code: Select all

sudo xm create /etc/xen/Win7.cfg
Then connect to it using:

Code: Select all

sudo vncviewer localhost:0
or use sudo xm vncviewer Win7


I will remove virt-manager from my how-to. By the way, I only ever used virt-manager to start the Windows guest and as a VNC viewer, and that is more than a year ago with an old Xen release. Since then Xen support in virt-manager is broken.

(Note: To be correct, I also used virt-manager to create some Linux VMs for testing, but when I saw what virt-manager does and in view of the lack of proper documentation I wiped it off my disk. I'm not missing it.)
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
mbalino

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

Post by mbalino »

I did all the steps that you asked me to correct and inclusive I have purged virt-manager
I have installed: gtkvncviewer, x11vncviewer, etc.

When I am trying to run:

Code: Select all

[1]mbalino@Bolso:~ > sudo xm vncviewer Win7
[142]mbalino@Bolso:~ > 
nothing happens

sudo vncviewer localhost:0
I am connected to my LINUX screen, therefore I am not connected to Win7

.... help ???
:shock:
powerhouse
Level 6
Level 6
Posts: 1144
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 »

@mbalino:

1. I have assumed that you already succeeded to install Windows, and that the only problem you got now is VGA passthrough.
2. I see sudo vncviewer localhost:5900 in the screenshots? Have you tried sudo vncviewer localhost:0 ?
3. After you start the Windows guest with xm create ..., can you enter sudo xm list and check if Windows is running. Or better even, type

Code: Select all

sudo xm top
This will show you the dom0 and Win7 domains and their CPU usage updated every second or so - this way you see if Win7 is (still) running.
4. If Win7 crashes, go to /var/log/xen and check the logs (can't remember which one). Can you post the relevant part here?

Please let me know of the Win7 guest crashes, or if you just aren't able to connect with vncviewer?
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 make dual-boot obsolete using XEN VGA passthrough

Post by powerhouse »

mbalino wrote:I did all the steps that you asked me to correct and inclusive I have purged virt-manager
I have installed: gtkvncviewer, x11vncviewer, etc.

When I am trying to run:

Code: Select all

[1]mbalino@Bolso:~ > sudo xm vncviewer Win7
[142]mbalino@Bolso:~ > 
nothing happens

sudo vncviewer localhost:0
I am connected to my LINUX screen, therefore I am not connected to Win7

.... help ???
:shock:
Another remark: You need only ONE VNC viewer. I don't know what happens when you install several different ones. I'm using xtightvncviewer.

Actually, xm vncviewer Win7 does nothing but run vncviewer localhost:0, so either command run as sudo should work. As I said before, make sure that your Win7 guest actually runs.

If your Win7 guest runs but you can't connect to it no matter what you try, I suggest you check your Win7.cfg file again for VNC related configuration. It should contain the following:

Code: Select all

sdl=0
vnc=1
vncpasswd=''
Note that vncpasswd='' uses two single quotes ('), without space between them!

If nothing helps, I suggest you install Linux Mint 16 64-bit from scratch and follow the how-to. The only thing you can skip is the pciback script and pciback.cfg file which you don't need.

Use the following win7.cfg file:

Code: Select all

kernel = "/usr/lib/xen-default/boot/hvmloader"
builder='hvm'
memory = 4096
name = "win7"
vcpus=4
acpi=1
apic=1
on_xend_stop="shutdown"
vif = [ 'mac=00:16:3e:68:02:03,bridge=xenbr0' ]
disk = [ 'phy:/dev/mapper/LVMGroup-WinVHD,hda,w' ]
device_model = '/usr/lib/xen-default/bin/qemu-dm'
boot="c"
sdl=0
vnc=1
vncpasswd=''
stdvga=0
serial='pty'
tsc_mode=0
viridian=1
# If usb='yes' doesn't work, try usb=0 to turn it off
usb='yes'
usbdevice='tablet'
gfx_passthru=0
pci=[ '02:00.0', '02:00.1' ]
localtime=1
pci_power_mgmt=1
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
Quich

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

Post by Quich »

Hello everyone,

I followed the how-to (thank you powerhouse!), and I was able to successfully run a Win 7 x64 Pro domU with VGA passthrough over Mint 16 dom0.

My hardware configuration is not referenced anywhere for supporting vt-d, so I think I am very lucky as I bought it mainly for the low price (might be price error). Feel free to add it to the Xen vt-d compatibility list.
I run an OEM Lenovo K450 57317803.
It is based on a Lenovo CIB85M µATX motherboard, featuring an Intel B85 chipset, lga1150 socket, 4 dimm slot, 4 sata3 + 1 esata, 1 pci-e 16x, 3 pci-e 1x, 2 usb 3.0 (+ 2 or 4 available via cables, 2 are on the top of the case) + 2 usb 2.0, a mini pci-e onboard wifi card, Gigabit LAN and 5.1 audio with Optical output (realtek ALC892). It also provides one HDMI and one VGA port for the integrated graphic card.
On top of that, the 57317803 configuration runs a i7-4770, 4GB DDR3-1600, an OEM HD8570 2GB DDR3, a Seagate 2TB HDD and a multi DVD optical drive, and it comes with Win 8 x64. Some pictures are available here : http://www.casimages.com/a/jfLFu if you are interested, and I got it for 399€.

The bios is the stock one, as there is no update available anywhere. There is only an option to enable Intel Virtualization Technology, but it does not speak about Vt-d so I was not sure at all it would work before trying.
There is a little bug, when the bios is said to use the integrated graphic adaptater, it does not boot if there is two monitors connected to internal graphic outputs and if they are powered on. If I have only one monitor powered on when I start the PC, it boots and the second one is working without problem if I powered it after the bios post time. (I have two monitors with two inputs each, so I use the two outputs of each graphic card to connect to them, and I can have two monitors on dom0, or two on one domU, or one for each, just by selecting the right inputs).

I added 4GB before installing Mint (so 8GB ram, waiting for a 32GB kit).

Regarding the how-to, I encounter some problems :
- The first time I installed Mint 16 with LVM support following the other how-to of powerhouse ( http://forums.linuxmint.com/viewtopic.p ... 42#p793203 ), the system did not wanted to boot, GRUB saying that it did not find any operating system. The only thing I did differently from the how-to, is that I added a step between the 9 and 10 to indicate the swap logical volume to the installer, as I thought it had been forgotten in the how-to.
I did the installation another time without doing that and everything went fine. I then re-assigned manually the swap volume and it is working without problem.
Regarding the motherboard compatibiliy, everything seems to work so far, USB3, USB2, LAN and WLAN networks and audio chipset.

- Step 6 gives me some troubles. I tried several times, but when I used the static IP conf, and re-enable networking ( "service networking restart" ), I always get a crash of cinnamon which passed in rescue mode. When I tried to reboot with this conf, the network was not working anymore.
I had no problem with the DHCP conf, and I really do not understand why it was not working in static.

- Step 17, related to 8-11. I just wanted to pass the dedicated graphic card (HD8570) to the domU, but I did not succeed to avoid the radeon module to load before the xen-pciback module with what is explain in this how-to (the radeon.blacklist in GRUB did not work either). I were finally able to blacklist it in modprob.conf.

- Step 18, related to 12. I was not able to start the domU in a first time, because there were a lot of formating problem in the conf file (but the error of xm was not clear for me). I had to remove a lot of comments, to replace every quote with single quote ', and to delete the unnecessary space.
After that, I had no problem to install Windows 7 x64 Pro with vnc (I affected 6 vCpus and 4GB of ram).
The AMD 13.12 graphic driver installed without any warning, as well as the GPLPV drivers.

I was able to do a 3DMark11 with no problem. The card graphic score was 2280pts @1000/1000 (o/c via afterburner) vs 2350 on original Windows 8.
But I have a problem when I launched Passmark Performance Test with MSI Afterburner Runing, it freezes on "Collecting Temperatures", Afterburner goes to 1 core max utilisation, and I am not able to kill neither of this two programs, the system fails to shutdown (I have to do a xm destroy). But maybe it is not related to the VM itself and would have the same behavior on a classic Windows, I did not test it (but I saw that there is some parameters to add to Qemu/KVM for avoiding PerformanceTest to crash, so it might be related).

I use Synergy for the mouse/keyboard, and it works very well, except that it handles when there is a UAC prompt (the mouse goes back to the Synergy server (dom0 here), but the Synergy client is still working and you just have to move your mouse again on it).

I played BF4 (in low setting due to the low power GFX) without any problem yesterday night.

The only problem I have, is that I have "no sound" in the domU. :(
The audio card of the HD8570 is working, and I get sound on my HDMI monitor plugged to it.
I have an audio output on this monitor, and I tried to connect it to the line in of the integrated audio card used by dom0.
It works if I enable the loopback with "pactl load-module module-loopback", but the result is not very good (cheap audio cable).
My problem is that I use a jack microphone to chat with my friend on TS/mumble (and a USB headset), and I was not able to activate the line-in and the mic at the same time.

So I tried to activate a virtualized audio card, but I have the exact same problem as darthazad in this thread : http://forums.linuxmint.com/viewtopic.p ... 7&p=803206
From what I read on the web, qemu should propose a HDA audio card compatible with Win 7 x64, but qemu-dm does not, althought I am pretty sure that I read that Xen 4.3 should be able to do that.
Do you know how I could get the sound from the domU? :?:
I read that it is possible to install a fake soundcard on the domU and to redirect the raw audio via ethernet to the dom0, thank to a piece of software, but I am not able to find where I read that.

Thank you in advance for your help :D
powerhouse
Level 6
Level 6
Posts: 1144
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 »

Quich wrote:...I run an OEM Lenovo K450 57317803.
It is based on a Lenovo CIB85M µATX motherboard, featuring an Intel B85 chipset, lga1150 socket, 4 dimm slot, 4 sata3 + 1 esata, 1 pci-e 16x, 3 pci-e 1x, 2 usb 3.0 (+ 2 or 4 available via cables, 2 are on the top of the case) + 2 usb 2.0, a mini pci-e onboard wifi card, Gigabit LAN and 5.1 audio with Optical output (realtek ALC892). It also provides one HDMI and one VGA port for the integrated graphic card.
On top of that, the 57317803 configuration runs a i7-4770, 4GB DDR3-1600, an OEM HD8570 2GB DDR3, a Seagate 2TB HDD and a multi DVD optical drive, and it comes with Win 8 x64. Some pictures are available here : http://www.casimages.com/a/jfLFu if you are interested, and I got it for 399€.
Thanks for posting! I'll add the specs to the hardware compatibility list.

EDIT: Please post the output of the following (motherboard, CPU and graphics card):

Code: Select all

inxi -Fx
Quich wrote:...Regarding the how-to, I encounter some problems :
- The first time I installed Mint 16 with LVM support following the other how-to of powerhouse ( http://forums.linuxmint.com/viewtopic.p ... 42#p793203 ), the system did not wanted to boot, GRUB saying that it did not find any operating system. The only thing I did differently from the how-to, is that I added a step between the 9 and 10 to indicate the swap logical volume to the installer, as I thought it had been forgotten in the how-to.
I did the installation another time without doing that and everything went fine. I then re-assigned manually the swap volume and it is working without problem.
Perhaps you specified the wrong device to install the boot loader? In most cases this would be /dev/sda (note: not /dev/sda1). But perhaps I missed something, though I always "test" my how-to. By the way, the how-to assumes an MBR disk. Glad you made it work despite the glitch.
Quich wrote:- Step 6 gives me some troubles. I tried several times, but when I used the static IP conf, and re-enable networking ( "service networking restart" ), I always get a crash of cinnamon which passed in rescue mode. When I tried to reboot with this conf, the network was not working anymore.
I had no problem with the DHCP conf, and I really do not understand why it was not working in static.
I'm not surprised - the networking part was my biggest hurdle when upgrading to Linux Mint 16. Have you removed/purged network-manager?
Quich wrote:- Step 17, related to 8-11. I just wanted to pass the dedicated graphic card (HD8570) to the domU, but I did not succeed to avoid the radeon module to load before the xen-pciback module with what is explain in this how-to (the radeon.blacklist in GRUB did not work either). I were finally able to blacklist it in modprob.conf.
Are you referring to /etc/modprobe.d/blacklist.conf ? Please let me know exactly where you blacklisted the driver. Thanks.
Quich wrote:- Step 18, related to 12. I was not able to start the domU in a first time, because there were a lot of formating problem in the conf file (but the error of xm was not clear for me). I had to remove a lot of comments, to replace every quote with single quote ', and to delete the unnecessary space.
Good that you mention that. I hadn't touched my initial win7.conf here although I changed a lot in the meantime. I will post my new version (slightly modified).
Quich wrote:I was able to do a 3DMark11 with no problem. The card graphic score was 2280pts @1000/1000 (o/c via afterburner) vs 2350 on original Windows 8.
Can you post the benchmark results here: http://forums.linuxmint.com/viewtopic.p ... 5&t=153482?
Quich wrote:But I have a problem when I launched Passmark Performance Test with MSI Afterburner Runing, it freezes on "Collecting Temperatures", Afterburner goes to 1 core max utilisation, and I am not able to kill neither of this two programs, the system fails to shutdown (I have to do a xm destroy). But maybe it is not related to the VM itself and would have the same behavior on a classic Windows, I did not test it (but I saw that there is some parameters to add to Qemu/KVM for avoiding PerformanceTest to crash, so it might be related).
I'm not familiar with MSI Afterburner. I use PassMark for benchmarking and it works without issues in my setup. Try to disable Afterburner and then start PassMark.
Quich wrote:I use Synergy for the mouse/keyboard, and it works very well, except that it handles when there is a UAC prompt (the mouse goes back to the Synergy server (dom0 here), but the Synergy client is still working and you just have to move your mouse again on it).
Yes, I experienced the same issue, hence I chose to use a KVM USB switch. However, the following may solve it: http://synergy-foss.org/osqa/questions/ ... ontrol-uac.
Quich wrote:The only problem I have, is that I have "no sound" in the domU. :(
The audio card of the HD8570 is working, and I get sound on my HDMI monitor plugged to it.
I have an audio output on this monitor, and I tried to connect it to the line in of the integrated audio card used by dom0.
It works if I enable the loopback with "pactl load-module module-loopback", but the result is not very good (cheap audio cable).
My problem is that I use a jack microphone to chat with my friend on TS/mumble (and a USB headset), and I was not able to activate the line-in and the mic at the same time.

So I tried to activate a virtualized audio card, but I have the exact same problem as darthazad in this thread : http://forums.linuxmint.com/viewtopic.p ... 7&p=803206
From what I read on the web, qemu should propose a HDA audio card compatible with Win 7 x64, but qemu-dm does not, althought I am pretty sure that I read that Xen 4.3 should be able to do that.
Do you know how I could get the sound from the domU? :?:
I read that it is possible to install a fake soundcard on the domU and to redirect the raw audio via ethernet to the dom0, thank to a piece of software, but I am not able to find where I read that.
I chose to get a cheap $7 USB audio card which is connected to a passed through USB2 port. The earphone jack is then wired to the line-in port on my board, and the MIC port of the USB audio stick can be used to connect a microphone.
If you find a better solution, please post here. This is one thing I never got around to do, and I don't want to mess up my bit perfect audiophile setup under Linux using ALSA (I purged pulseaudio).
Last edited by powerhouse on Sat Jan 11, 2014 3:39 pm, edited 1 time in total.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
Quich

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

Post by Quich »

Thank you for the reply.
powerhouse wrote: Perhaps you specified the wrong device to install the boot loader? In most cases this would be /dev/sda (note: not /dev/sda1). But perhaps I missed something, though I always "test" my how-to. By the way, the how-to assumes an MBR disk. Glad you made it work despite the glitch.
I did exactly the same during the two installations (deleting all the partition and creating a msdos partition table (MBR) with Gparted, the disk was GPT before), excepted what I wrote in my previous post. I really do not know what happened.
powerhouse wrote:I'm not surprised - the networking part was my biggest hurdle when upgrading to Linux Mint 16. Have you removed/purged network-manager?
No, it is still here.
powerhouse wrote:Are you referring to /etc/modprobe.d/blacklist.conf ? Please let me know exactly where you blacklisted the driver. Thanks.
Yes. I was not remembering exactly what I have done, but it seems that I simply added "blacklist radeon" into /etc/modprobe.d/blacklist.conf.
powerhouse wrote:Can you post the benchmark results here: http://forums.linuxmint.com/viewtopic.p ... 5&t=153482?
I will ;)
powerhouse wrote:I'm not familiar with MSI Afterburner. I use PassMark for benchmarking and it works without issues in my setup. Try to disable Afterburner and then start PassMark.
As I was implying (maybe it was not clear), PassMark is running fine if I close Afterburner.
powerhouse wrote:Yes, I experienced the same issue, hence I chose to use a KVM USB switch. However, the following may solve it: http://synergy-foss.org/osqa/questions/ ... ontrol-uac.
Synergy is already running as a service on Win7. In fact, maybe I did not explain it well, I lose the mouse/keyboard in Win7 during 2-3 seconds and my mouse is sent back to Mint, but after this little time I can access again to Win7 and click/interract with the UAC prompt. It is just annoying to wait but not really a problem.

[quote="powerhouse"I chose to get a cheap $7 USB audio card which is connected to a passed through USB2 port. The earphone jack is then wired to the line-in port on my board, and the MIC port of the USB audio stick can be used to connect a microphone.
If you find a better solution, please post here. This is one thing I never got around to do, and I don't want to mess up my bit perfect audiophile setup under Linux using ALSA (I purged pulseaudio).[/quote]
I read what you did, but it does not help regarding my current situation, as I am already able to get Win7 sound to a jack (via the HDMI output of the graphic card and the jack output of my monitor).
I do not want to have my microphone on Win7, I am using it on Linux.
Maybe I could use the integrated sound card line-in for Win7 sound, and the microphone on the USB sound card for the microphone (but under Linux, not linked to Win7).
I still think it would be better to have an emulated sound card working.

I find again where I read about the dummy sound card : http://www.overclock.net/t/1205216/guid ... t_18525583
It did not work for me with this driver, and lineincode do not work with my HDMI soundcard (do not know why), but I was able to install another "fake" sound card with virtual audio cable
The thing is working, but there is a delay of around 1 second before the sound is played on linux, which is not really acceptable.

Is anyone knowing why there is no support for emulated hda audio card in the qemu-dm used by Xen ?
powerhouse
Level 6
Level 6
Posts: 1144
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 »

@Quich: Thanks for the answers and clarifying the points.

Regarding networking: You can try to purge network-manager, but be aware that it can break networking and that is a real fiasco with LM16. In case you are prepared to reinstall LM16 if things go wrong, purge network-manager (while still using dhcp configured in /etc/network/interfaces), then reboot and change to static, then restart the network and cross your fingers. Sorry I can't be of more help, they keep messing up the networking part and it's a real shame.

Regarding sound: You could connect the headphone jack of your screen to the line-in on your rear panel. Then under Linux you would select the line-in to enable sound from Windows. The mic input works as usual under Linux, so I don't see a problem here.

I agree that sound support is a tragedy under Xen. A software solution would be much neater. Have a look at "jack" here http://jackaudio.org/netjack and http://jackaudio.org/download for the Windows part, and install the jackd2 package under Linux.

EDIT: Just followed the link you posted - it's a conversation between me and another Xen user I had totally forgotten :oops: . Never mind, it didn't work for me, and the other also reported that it's pretty useless.
Another thing is that this solution is based on PulseAudio, something I wouldn't run as it re-encodes on the fly every audio stream to 48kHz or so. It's good enough for games, video, and mp3 audio, but not for audiophile use.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
Locked

Return to “Virtual Machines”