Skip to contentSkip to conversation

Video Presentation on PCI Express x16 VGA Pass Through to Xen-based Windows XP Home Edition HVM Virtual Machine

DISCUSSION Mr. Teo En Ming (Zhang Enming) 4 participants 4 messages Sep 8, 2009 – Sep 10, 2009

lore
Share & tools
lore
#0 lore raw

Hi All,

I went through the history and here are the steps I took to patch xen 3.5-unstable for VGA passthrough.

Based on Weidong's advice I checked out changeset earlier than 20144.

Initial trial without secondary gfx passthrough patch
=================================

  637  hg clone http://xenbits.xensource.com/xen-unstable.hg
  638  cd xen-unstable.hg
  639  vi tools/firmware/hvmloader/hvmloader.c
  640  hg checkout 20143
  641  cp 
~enming/intel-gfx-passthru-patches/intel-gfx-passthru-patch01.patch .
  642  patch -p1 < intel-gfx-passthru-patch01.patch
  643  make tools
  644  history
  645  cd tools/ioemu-remote/
  646  cp 
~enming/intel-gfx-passthru-patches/intel-gfx-passthru-patch02.patch .
  647  patch -p1 < intel-gfx-passthru-patch02.patch
  648  cd ..
  649  cd ..
  650  cp ~enming/intel-gfx-passthru-patches/xen-load-vbios-file.patch .
  651  patch -p1 < xen-load-vbios-file.patch
  652  cp ~enming/intel-gfx-passthru-patches/xen-vBAR-pBAR.patch .
  653  patch -p1 < xen-vBAR-pBAR.patch
  654  cd tools/ioemu-remote/
  655  cp 
~enming/intel-gfx-passthru-patches/qemu-change-for-vBAR-pBAR.patch .
  656  patch -p1 < qemu-change-for-vBAR-pBAR.patch
  657  cd ../../
  658  make clean
  659  cp ~enming/vgabios-pt.bin tools/firmware/vgabios/
  660  ls tools/firmware/vgabios/vgabios-pt.bin
  661  make xen
  662  make install-xen
  663  make tools
  664  make install-tools

In the above case, intel-gfx-passthru-patch01.patch is actually xen-gfx-passthrough.patch as posted by Weidong.

intel-gfx-passthru-patch02.patch is actually qemu-gfx-passthrough.patch as posted by Weidong.

After building and installing everything, I rebooted. When I tried to passthrough the nVidia Geforce 8400 GS, I got "not enough free resources" in Windows XP domU. This is in fact much better than my earlier trial when I got "device cannot start" in Windows XP domU device manager with the wrong approach of using onboard gma4500 graphics as primary and nvidia geforce 8400 gs as secondary. This time I am using nvidia geforce 8400 gs as the primary and nothing else as the secondary.

After Timothy Moore's suggestion, I proceeded to the next trial.

Next trial WITH secondary gfx passthrough patch
==============================

  679  cd /usr/src
  680  mv xen-unstable.hg xen-unstable.hg-20143-no-secondary-patch
  681  cp -R xen-unstable.hg-20143-no-secondary-patch xen-unstable.hg
  682  cd xen-unstable.hg
  683  history
  684  cd tools/ioemu-remote/
  685  cp 
~enming/intel-gfx-passthru-patches/qemu-claim-vga-cycle-for-secondary-gfx-passthrough.patch .
  686  patch -p1 < 
qemu-claim-vga-cycle-for-secondary-gfx-passthrough.patch
  687  cd ../..
  688  make clean
  689  cp ~enming/vgabios-pt.bin tools/firmware/vgabios/
  690  ls tools/firmware/vgabios/vgabios-pt.bin
  691  make xen
  692  make install-xen
  693  make tools
  694  make install-tools

At this point, I encountered an error with build.c as documented with my earlier postings in xen-devel mailing list.

So I applied my very own patch:

Patch created by Teo En Ming (Zhang Enming) on 29 August 2009 Saturday at 8:00 P.M. Singapore Time Email #1: [email protected]
Email #2: [email protected]
MSN: [email protected]
Mobile Phone: +65-9648-9798

ssdt_pm.h 2009-08-29 19:56:51.813088550 +0800 renamed from ssdt_pm.h 2009-08-29 19:54:52.653088000 +0800 +0 -0
@@ -10,7 +10,7 @@

* C source code output
*
*/
-unsigned char AmlCode[] =
+unsigned char AmlCode_PM[] =
{
0x53,0x53,0x44,0x54,0xD6,0x05,0x00,0x00, /* 00000000 "SSDT...." */ 0x02,0xB9,0x58,0x65,0x6E,0x00,0x00,0x00, /* 00000008 "..Xen..." */

ssdt_tpm.h 2009-08-29 19:57:27.896638884 +0800 renamed from ssdt_tpm.h 2009-08-29 19:55:44.578738954 +0800 +0 -0
@@ -10,7 +10,7 @@

* C source code output
*
*/
-unsigned char AmlCode[] =
+unsigned char AmlCode_TPM[] =
{
0x53,0x53,0x44,0x54,0x4C,0x00,0x00,0x00, /* 00000000 "SSDTL..." */ 0x02,0x2A,0x58,0x65,0x6E,0x00,0x00,0x00, /* 00000008 ".*Xen..." */

Then I checked ssdt_pm.h and ssdt_tpm.h to make sure they are correct.

  695  vi tools/firmware/hvmloader/acpi/ssdt_pm.h
  696  vi tools/firmware/hvmloader/acpi/ssdt_tpm.h
  697  make install-tools

But I still get "not enough free resources" in Win XP domU device manager. So apparently
the patch qemu-claim-vga-cycle-for-secondary-gfx-passthrough.patch doesn't affect my nvidia geforce 8400 gs passed through operations since I am using nvidia as primary and nothing as secondary. The secondary gfx patch is for cases when you have a primary for dom0 and passing through the secondary gfx to a HVM domU.

Signature · 11 lines
Mr. Teo En Ming (Zhang Enming) Dip(Mechatronics Engineering) BEng(Hons)(Mechanical Engineering)
Technical Support Engineer
Information Technology Department
Asiasoft Online Pte Ltd
Tampines Central 1 #04-01 Tampines Plaza
Singapore 529541
Republic of Singapore
Company Website: http://www.asiasoft.sg/
Mobile: +65-9648-9798
MSN: [email protected]
Alma Maters: Singapore Polytechnic, National University of Singapore
#1 lore raw

I found I still cannot watch your video, even cannot access youtube.

The output of 'xm dmesg' means it really 1:1 maps for vBAR and pBAR. It should be no problem. Can you post qemu log (/var/log/xen/qemu-dm-xxx.log)?

You below steps look correct. But I didn't encounter the error with build.c. Tim, did you encounter the error?

Regards,
Weidong

Quoted 131 lines · Mr. Teo En Ming (Zhang Enming)

Hi All,

I went through the history and here are the steps I took to patch xen 3.5-unstable for VGA passthrough.

Based on Weidong's advice I checked out changeset earlier than 20144.

Initial trial without secondary gfx passthrough patch
=================================

   637  hg clone http://xenbits.xensource.com/xen-unstable.hg
   638  cd xen-unstable.hg
   639  vi tools/firmware/hvmloader/hvmloader.c
   640  hg checkout 20143
   641  cp
~enming/intel-gfx-passthru-patches/intel-gfx-passthru-patch01.patch .
   642  patch -p1 < intel-gfx-passthru-patch01.patch
   643  make tools
   644  history
   645  cd tools/ioemu-remote/
   646  cp
~enming/intel-gfx-passthru-patches/intel-gfx-passthru-patch02.patch .
   647  patch -p1 < intel-gfx-passthru-patch02.patch
   648  cd ..
   649  cd ..
   650  cp

~enming/intel-gfx-passthru-patches/xen-load-vbios-file.patch . 651 patch -p1 < xen-load-vbios-file.patch 652 cp ~enming/intel-gfx-passthru-patches/xen-vBAR-pBAR.patch . 653 patch -p1 < xen-vBAR-pBAR.patch 654 cd tools/ioemu-remote/ 655 cp
~enming/intel-gfx-passthru-patches/qemu-change-for-vBAR-pBAR.patch .

   656  patch -p1 < qemu-change-for-vBAR-pBAR.patch
   657  cd ../../
   658  make clean
   659  cp ~enming/vgabios-pt.bin tools/firmware/vgabios/
   660  ls tools/firmware/vgabios/vgabios-pt.bin
   661  make xen
   662  make install-xen
   663  make tools
   664  make install-tools

In the above case, intel-gfx-passthru-patch01.patch is actually xen-gfx-passthrough.patch as posted by Weidong.

intel-gfx-passthru-patch02.patch is actually
qemu-gfx-passthrough.patch as posted by Weidong.

After building and installing everything, I rebooted. When I tried to passthrough the nVidia Geforce 8400 GS, I got "not enough free resources" in Windows XP domU. This is in fact much better than my earlier trial when I got "device cannot start" in Windows XP domU device manager with the wrong approach of using onboard gma4500 graphics as primary and nvidia geforce 8400 gs as secondary. This time I am using nvidia geforce 8400 gs as the primary and nothing else as the secondary.

After Timothy Moore's suggestion, I proceeded to the next trial.

Next trial WITH secondary gfx passthrough patch
==============================

   679  cd /usr/src
   680  mv xen-unstable.hg xen-unstable.hg-20143-no-secondary-patch
   681  cp -R xen-unstable.hg-20143-no-secondary-patch xen-unstable.hg
   682  cd xen-unstable.hg
   683  history
   684  cd tools/ioemu-remote/
   685  cp

~enming/intel-gfx-passthru-patches/qemu-claim-vga-cycle-for-secondary-gfx-passthrough.patch .
686 patch -p1 <
qemu-claim-vga-cycle-for-secondary-gfx-passthrough.patch

   687  cd ../..
   688  make clean
   689  cp ~enming/vgabios-pt.bin tools/firmware/vgabios/
   690  ls tools/firmware/vgabios/vgabios-pt.bin
   691  make xen
   692  make install-xen
   693  make tools
   694  make install-tools

At this point, I encountered an error with build.c as documented with my earlier postings in xen-devel mailing list.

So I applied my very own patch:

Patch created by Teo En Ming (Zhang Enming) on 29 August 2009 Saturday at 8:00 P.M. Singapore Time
Email #1: [email protected]
Email #2: [email protected]
MSN: [email protected]
Mobile Phone: +65-9648-9798

ssdt_pm.h 2009-08-29 19:56:51.813088550 +0800 renamed from ssdt_pm.h 2009-08-29 19:54:52.653088000 +0800 +1 -1
@@ -10,7 +10,7 @@
 * C source code output
 *
 */
-unsigned char AmlCode[] =
+unsigned char AmlCode_PM[] =
 {

0x53,0x53,0x44,0x54,0xD6,0x05,0x00,0x00, /* 00000000 "SSDT...." */ 0x02,0xB9,0x58,0x65,0x6E,0x00,0x00,0x00, /* 00000008 "..Xen..." */

ssdt_tpm.h 2009-08-29 19:57:27.896638884 +0800 renamed from ssdt_tpm.h 2009-08-29 19:55:44.578738954 +0800 +1 -1
@@ -10,7 +10,7 @@
 * C source code output
 *
 */
-unsigned char AmlCode[] =
+unsigned char AmlCode_TPM[] =
 {

0x53,0x53,0x44,0x54,0x4C,0x00,0x00,0x00, /* 00000000 "SSDTL..." */ 0x02,0x2A,0x58,0x65,0x6E,0x00,0x00,0x00, /* 00000008 ".*Xen..." */

Then I checked ssdt_pm.h and ssdt_tpm.h to make sure they are correct.

   695  vi tools/firmware/hvmloader/acpi/ssdt_pm.h
   696  vi tools/firmware/hvmloader/acpi/ssdt_tpm.h
   697  make install-tools

But I still get "not enough free resources" in Win XP domU device manager. So apparently
the patch qemu-claim-vga-cycle-for-secondary-gfx-passthrough.patch doesn't affect my nvidia geforce 8400 gs passed through operations since I am using nvidia as primary and nothing as secondary. The secondary gfx patch is for cases when you have a primary for dom0 and passing through the secondary gfx to a HVM domU.

#3 lore raw
In reply to Mr. Teo En Ming (Zhang Enming)

Did you verify (and modify if applicable) the PCI resources as per Weidong's comment here?
http://permalink.gmane.org/gmane.comp.emulators.xen.devel/70749

On another topic, please don't answer to other threads to get attention and keep threading working by replying to previous versions of your own post or its replies (and and least for me, don't reply to my personal mail address but just to the mailing-list)

Best regards,
Christian

Quoted 5 lines · Mr. Teo En Ming (Zhang Enming)

Hi All,

I went through the history and here are the steps I took to patch xen 3.5-unstable for VGA passthrough.

Based on Weidong's advice I checked out changeset earlier than 20144.

[...]

#2 lore raw
In reply to Han, Weidong

I did not have this problem

-----Original Message-----
From: Han, Weidong [mailto:[email protected]]
Sent: 09 September 2009 07:06
To: '[email protected]'; '[email protected]'
Cc: '[email protected]'; Tim Moore; '[email protected]'
Subject: RE: [Xen-devel] Video Presentation on PCI Express x16 VGA Pass Through to Xen-based Windows XP Home Edition HVM Virtual Machine

I found I still cannot watch your video, even cannot access youtube.

The output of 'xm dmesg' means it really 1:1 maps for vBAR and pBAR. It should be no problem. Can you post qemu log (/var/log/xen/qemu-dm-xxx.log)?

You below steps look correct. But I didn't encounter the error with build.c. Tim, did you encounter the error?

Regards,
Weidong

Quoted 131 lines · Mr. Teo En Ming (Zhang Enming)

Hi All,

I went through the history and here are the steps I took to patch xen 3.5-unstable for VGA passthrough.

Based on Weidong's advice I checked out changeset earlier than 20144.

Initial trial without secondary gfx passthrough patch
=================================

   637  hg clone http://xenbits.xensource.com/xen-unstable.hg
   638  cd xen-unstable.hg
   639  vi tools/firmware/hvmloader/hvmloader.c
   640  hg checkout 20143
   641  cp
~enming/intel-gfx-passthru-patches/intel-gfx-passthru-patch01.patch .
   642  patch -p1 < intel-gfx-passthru-patch01.patch
   643  make tools
   644  history
   645  cd tools/ioemu-remote/
   646  cp
~enming/intel-gfx-passthru-patches/intel-gfx-passthru-patch02.patch .
   647  patch -p1 < intel-gfx-passthru-patch02.patch
   648  cd ..
   649  cd ..
   650  cp

~enming/intel-gfx-passthru-patches/xen-load-vbios-file.patch . 651 patch -p1 < xen-load-vbios-file.patch 652 cp ~enming/intel-gfx-passthru-patches/xen-vBAR-pBAR.patch . 653 patch -p1 < xen-vBAR-pBAR.patch 654 cd tools/ioemu-remote/ 655 cp
~enming/intel-gfx-passthru-patches/qemu-change-for-vBAR-pBAR.patch .

   656  patch -p1 < qemu-change-for-vBAR-pBAR.patch
   657  cd ../../
   658  make clean
   659  cp ~enming/vgabios-pt.bin tools/firmware/vgabios/
   660  ls tools/firmware/vgabios/vgabios-pt.bin
   661  make xen
   662  make install-xen
   663  make tools
   664  make install-tools

In the above case, intel-gfx-passthru-patch01.patch is actually xen-gfx-passthrough.patch as posted by Weidong.

intel-gfx-passthru-patch02.patch is actually
qemu-gfx-passthrough.patch as posted by Weidong.

After building and installing everything, I rebooted. When I tried to passthrough the nVidia Geforce 8400 GS, I got "not enough free resources" in Windows XP domU. This is in fact much better than my earlier trial when I got "device cannot start" in Windows XP domU device manager with the wrong approach of using onboard gma4500 graphics as primary and nvidia geforce 8400 gs as secondary. This time I am using nvidia geforce 8400 gs as the primary and nothing else as the secondary.

After Timothy Moore's suggestion, I proceeded to the next trial.

Next trial WITH secondary gfx passthrough patch
==============================

   679  cd /usr/src
   680  mv xen-unstable.hg xen-unstable.hg-20143-no-secondary-patch
   681  cp -R xen-unstable.hg-20143-no-secondary-patch xen-unstable.hg
   682  cd xen-unstable.hg
   683  history
   684  cd tools/ioemu-remote/
   685  cp

~enming/intel-gfx-passthru-patches/qemu-claim-vga-cycle-for-secondary-gfx-passthrough.patch .
686 patch -p1 <
qemu-claim-vga-cycle-for-secondary-gfx-passthrough.patch

   687  cd ../..
   688  make clean
   689  cp ~enming/vgabios-pt.bin tools/firmware/vgabios/
   690  ls tools/firmware/vgabios/vgabios-pt.bin
   691  make xen
   692  make install-xen
   693  make tools
   694  make install-tools

At this point, I encountered an error with build.c as documented with my earlier postings in xen-devel mailing list.

So I applied my very own patch:

Patch created by Teo En Ming (Zhang Enming) on 29 August 2009 Saturday at 8:00 P.M. Singapore Time
Email #1: [email protected]
Email #2: [email protected]
MSN: [email protected]
Mobile Phone: +65-9648-9798

ssdt_pm.h 2009-08-29 19:56:51.813088550 +0800 renamed from ssdt_pm.h 2009-08-29 19:54:52.653088000 +0800 +1 -1
@@ -10,7 +10,7 @@
 * C source code output
 *
 */
-unsigned char AmlCode[] =
+unsigned char AmlCode_PM[] =
 {

0x53,0x53,0x44,0x54,0xD6,0x05,0x00,0x00, /* 00000000 "SSDT...." */ 0x02,0xB9,0x58,0x65,0x6E,0x00,0x00,0x00, /* 00000008 "..Xen..." */

ssdt_tpm.h 2009-08-29 19:57:27.896638884 +0800 renamed from ssdt_tpm.h 2009-08-29 19:55:44.578738954 +0800 +1 -1
@@ -10,7 +10,7 @@
 * C source code output
 *
 */
-unsigned char AmlCode[] =
+unsigned char AmlCode_TPM[] =
 {

0x53,0x53,0x44,0x54,0x4C,0x00,0x00,0x00, /* 00000000 "SSDTL..." */ 0x02,0x2A,0x58,0x65,0x6E,0x00,0x00,0x00, /* 00000008 ".*Xen..." */

Then I checked ssdt_pm.h and ssdt_tpm.h to make sure they are correct.

   695  vi tools/firmware/hvmloader/acpi/ssdt_pm.h
   696  vi tools/firmware/hvmloader/acpi/ssdt_tpm.h
   697  make install-tools

But I still get "not enough free resources" in Win XP domU device manager. So apparently
the patch qemu-claim-vga-cycle-for-secondary-gfx-passthrough.patch doesn't affect my nvidia geforce 8400 gs passed through operations since I am using nvidia as primary and nothing as secondary. The secondary gfx patch is for cases when you have a primary for dom0 and passing through the secondary gfx to a HVM domU.