[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] graphics passthrough with VT-d



After applying the 1st and 2nd patch to xen-unstable successfully, I examined the source codes Makefile and hvmloader.c in tools/firmware/hvmloader, compared them to Weidong's 3rd patch and I generated my own 3rd patch. Then I used my own generated 3rd patch to apply patching for loading vga bios from firmware file.

Here is my own generated 3rd patch instead of using Weidong's 3rd patch:

--- Makefile    2009-08-29 03:24:52.413083774 +0800
+++ Makefile    2009-08-29 03:29:12.763299633 +0800
@@ -50,6 +50,7 @@
 roms.h: ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin \
        ../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../etherboot/eb-roms.h
        sh ./mkhex rombios ../rombios/BIOS-bochs-latest > roms.h
+       sh ./mkhex vgabios_pt ../vgabios/vgabios-pt.bin >> roms.h
        sh ./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin >> roms.h
        sh ./mkhex vgabios_cirrusvga \
                ../vgabios/VGABIOS-lgpl-latest.cirrus.bin >> roms.h
--- hvmloader.c 2009-08-29 03:26:06.911085797 +0800
+++ hvmloader.c 2009-08-29 03:31:43.172084995 +0800
@@ -688,9 +688,9 @@
         vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
         break;
     case VGA_pt:
-        printf("Loading VGABIOS of passthroughed gfx ...\n");
-        vgabios_sz =
-            round_option_rom((*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
+       printf("Loading Gfx Video BIOS from file ...\n");
+       memcpy((void *)VGABIOS_PHYSICAL_ADDRESS, vgabios_pt, sizeof(vgabios_pt));
+       vgabios_sz = round_option_rom(sizeof(vgabios_pt));
         break;
     default:
         printf("No emulated VGA adaptor ...\n");


I can "make xen" successfully but when I proceeded to "make tools", errors were encountered.

Please see attached error output. How can I solve this problem?


-- 
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
Mobile: +65-9648-9798
MSN: teoenming@xxxxxxxxxxx
Alma Maters: Singapore Polytechnic, National University of Singapore


On 08/29/2009 12:59 AM, Mr. Teo En Ming (Zhang Enming) wrote:
OK I believe the 3rd patch is not incomplete but there's a white space issue when I copied the code from the mailing list into my vi.

See http://www.htdig.org/mail/2000/11/0167.html

When I used the -l flag to patch using the 3rd patch, the number of errors was reduced.

[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# patch -l -p1 < intel-gfx-passthru-patch-3.patch 
patching file tools/firmware/hvmloader/Makefile
patching file tools/firmware/hvmloader/hvmloader.c
Hunk #1 FAILED at 688.
1 out of 1 hunk FAILED -- saving rejects to file tools/firmware/hvmloader/hvmloader.c.rej

Now patching tools/firmware/hvmloader/Makefile is successful but patching tools/firmware/hvmloader/hvmloader.c still failed.

-- 
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
Mobile: +65-9648-9798
MSN: teoenming@xxxxxxxxxxx
Alma Maters: Singapore Polytechnic, National University of Singapore



On 08/28/2009 11:55 PM, Mr. Teo En Ming (Zhang Enming) wrote:
Dear Weidong,

A big big thanks for the vga passthrough patches for xen 3.5-unstable!!! These are eagerly anticipated patches. As I did not study computer science and computer architecture, I won't be able to write those patches you guys at Intel wrote.

I applied the following patches xen-gfx-passthrough.patch and qemu-gfx-passthrough.patch to xen 3.5-unstable without issues.

Then I tried to apply the 3rd patch you provided at http://lists.xensource.com/archives/html/xen-devel/2009-08/msg01047.html

I saved the following code

<CODE>
diff -r 494be76c1ad9 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile Thu Aug 27 16:54:33 2009 +0800
+++ b/tools/firmware/hvmloader/Makefile Thu Aug 27 17:22:01 2009 +0800
@@ -50,6 +50,7 @@ roms.h: ../rombios/BIOS-bochs-latest ../
 roms.h: ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin \
    ../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../etherboot/eb-roms.h
    sh ./mkhex rombios ../rombios/BIOS-bochs-latest > roms.h
+   sh ./mkhex vgabios_pt ../vgabios/vgabios-pt.bin >> roms.h
    sh ./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin >> roms.h
    sh ./mkhex vgabios_cirrusvga \
        ../vgabios/VGABIOS-lgpl-latest.cirrus.bin >> roms.h
diff -r 494be76c1ad9 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c  Thu Aug 27 16:54:33 2009 +0800
+++ b/tools/firmware/hvmloader/hvmloader.c  Thu Aug 27 17:23:00 2009 +0800
@@ -688,9 +688,9 @@ int main(void)
         vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
         break;
     case VGA_pt:
-        printf("Loading Gfx Video BIOS from 0xC0000 ...\n");
-        vgabios_sz =
-            round_option_rom((*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
+         printf("Loading Gfx Video BIOS from file ...\n");
+         memcpy((void *)VGABIOS_PHYSICAL_ADDRESS, vgabios_pt, 
sizeof(vgabios_pt));
+         vgabios_sz = round_option_rom(sizeof(vgabios_pt));
         break;
     default:
         printf("No emulated VGA adaptor ...\n");
  
</CODE>

as intel-gfx-passthru-patch-3.patch and then I tried to apply the patch to xen 3.5-unstable. I got errors. I think it's because the 3rd patch you provided is incomplete.

Here's my patching process:

[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# find . -name vgabios
./tools/firmware/vgabios
./.hg/store/data/tools/firmware/vgabios
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# cp ~enming/vgabios-pt.bin tools/firmware/vgabios/
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# ls tools/firmware/vgabios/
biossums.c  clext.c      Makefile  TODO                 vbe.h            vgabios.h       vgatables.h
BUGS        COPYING      Notes     vbe.c                vbetables-gen.c  vgabios-pt.bin
ChangeLog   dataseghack  README    vbe_display_api.txt  vgabios.c        vgafonts.h
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# pwd
/usr/src/xen-unstable.hg-vgapt
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# wget http://lists.xensource.com/archives/html/xen-devel/2009-08/bincPiiAf0QWg.bin
--2009-08-28 23:18:21--  http://lists.xensource.com/archives/html/xen-devel/2009-08/bincPiiAf0QWg.bin
Resolving lists.xensource.com... 70.42.241.110
Connecting to lists.xensource.com|70.42.241.110|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12565 (12K) [application/octet-stream]
Saving to: `bincPiiAf0QWg.bin'

100%[======================================================================>] 12,565      30.7K/s   in 0.4s    

2009-08-28 23:18:22 (30.7 KB/s) - `bincPiiAf0QWg.bin' saved [12565/12565]

[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# mv bincPiiAf0QWg.bin xen-gfx-passthrough.patch
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# vi xen-gfx-passthrough.patch 
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# patch < xen-gfx-passthrough.patch 
can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -r 5d7e7a250267 tools/firmware/hvmloader/config.h
|--- a/tools/firmware/hvmloader/config.h	Wed Aug 26 18:28:44 2009 +0800
|+++ b/tools/firmware/hvmloader/config.h	Thu Aug 27 16:54:24 2009 +0800
--------------------------
File to patch: ^C
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# ex xen-gfx-passthrough.patch 
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# patch -p1 < xen-gfx-passthrough.patch 
patching file tools/firmware/hvmloader/config.h
patching file tools/firmware/hvmloader/hvmloader.c
patching file tools/libxc/ia64/xc_ia64_hvm_build.c
patching file tools/libxc/xc_hvm_build.c
patching file tools/libxc/xc_linux.c
patching file tools/libxc/xenctrl.h
patching file tools/libxc/xenguest.h
patching file tools/python/xen/lowlevel/xc/xc.c
patching file tools/python/xen/xend/XendConfig.py
Hunk #1 succeeded at 174 (offset -1 lines).
patching file tools/python/xen/xend/image.py
Hunk #1 succeeded at 780 (offset -6 lines).
Hunk #3 succeeded at 895 (offset -6 lines).
patching file tools/python/xen/xm/create.py
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# wget http://lists.xensource.com/archives/html/xen-devel/2009-08/binglLqkeq4Rj.bin
--2009-08-28 23:21:35--  http://lists.xensource.com/archives/html/xen-devel/2009-08/binglLqkeq4Rj.bin
Resolving lists.xensource.com... 70.42.241.110
Connecting to lists.xensource.com|70.42.241.110|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9841 (9.6K) [application/octet-stream]
Saving to: `binglLqkeq4Rj.bin'

100%[======================================================================>] 9,841       24.3K/s   in 0.4s    

2009-08-28 23:21:36 (24.3 KB/s) - `binglLqkeq4Rj.bin' saved [9841/9841]

[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# mv binglLqkeq4Rj.bin qemu-gfx-passthrough.patch
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# vi qemu-gfx-passthrough.patch 
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# find . -name hw
./tools/ioemu-remote/hw
./.hg/store/data/tools/ioemu/hw
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# mv qemu-gfx-passthrough.patch tools/ioemu-remote/
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# cd tools/ioemu-remote/
[root@fedora11-x86-64-host ioemu-remote]# patch -p1 < qemu-
qemu-aio.h                  qemu-img.c                  qemu-sockets.c
qemu-binfmt-conf.sh         qemu-img.texi               qemu-tech.texi
qemu-char.c                 qemu-lock.h                 qemu-timer.h
qemu-char.h                 qemu-log.h                  qemu-tool.c
qemu-common.h               qemu-malloc.c               qemu-xen.h
qemu-doc.texi               qemu-nbd.c                  
qemu-gfx-passthrough.patch  qemu-nbd.texi               
[root@fedora11-x86-64-host ioemu-remote]# patch -p1 < qemu-gfx-passthrough.patch 
patching file hw/pass-through.c
patching file hw/pass-through.h
patching file hw/pc.c
patching file vl.c
[root@fedora11-x86-64-host ioemu-remote]# cd ..
[root@fedora11-x86-64-host tools]# cd ..
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# vi intel-gfx-passthru-patch-3.patch
[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# patch -p1 < intel-gfx-passthru-patch-3.patch 
patching file tools/firmware/hvmloader/Makefile
Hunk #1 FAILED at 50.
1 out of 1 hunk FAILED -- saving rejects to file tools/firmware/hvmloader/Makefile.rej
patching file tools/firmware/hvmloader/hvmloader.c
patch: **** malformed patch at line 24: sizeof(vgabios_pt));

[root@fedora11-x86-64-host xen-unstable.hg-vgapt]# vi intel-gfx-passthru-patch-3.patch 

For everybody's convenience, I have attached intel-gfx-passthru-patch-3.patch and the firmware for my nVidia GeForce 8400 GS PCI Express x16 graphics card in this email.

Please help me complete intel-gfx-passthru-patch-3.patch as I really need it.

Thank you very much!!!
  
-- 
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
Mobile: +65-9648-9798
MSN: teoenming@xxxxxxxxxxx
Alma Maters: Singapore Polytechnic, National University of Singapore
This patch supports basic gfx passthrough on QEMU:
  - disable emulated VGA adpater if there is passthroughed gfx
  - register/unregister legacy VGA I/O ports and MMIOs for passthroughed gfx

Signed-off-by: Ben Lin <ben.y.lin@xxxxxxxxx>
Signed-off-by: Weidong Han <weidong.han@xxxxxxxxx>
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.409 / Virus Database: 270.13.69/2328 - Release Date: 08/27/09
18:02:00

No virus found in this outgoing message.
Checked by AVG - www.avg.com 
Version: 8.5.409 / Virus Database: 270.13.71/2330 - Release Date: 08/27/09
18:02:00
  

_______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel


_______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel







Attachment: error.output.txt
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.