From mboxrd@z Thu Jan 1 00:00:00 1970 From: David TECHER Subject: Re : Re : Re : Re : Re: Patches for VGA-Passthrough XEN 4.2 unstable Date: Wed, 7 Sep 2011 17:25:36 +0100 (BST) Message-ID: <1315412736.5486.YahooMailNeo@web29815.mail.ird.yahoo.com> References: <1315231341254-4770602.post@n5.nabble.com> <1315310225039-4774097.post@n5.nabble.com> <1315343879.61837.YahooMailNeo@web29818.mail.ird.yahoo.com> <1315382742268-4777689.post@n5.nabble.com> <1315389138.56652.YahooMailNeo@web29801.mail.ird.yahoo.com> <1315398360680-4778339.post@n5.nabble.com> <1315401901083-4778494.post@n5.nabble.com> <1315403644525-4778586.post@n5.nabble.com> <1315405372.87224.YahooMailNeo@web29801.mail.ird.yahoo.com> <1315405921936-4778727.post@n5.nabble.com> <1315408931610-4778925.post@n5.nabble.com> Reply-To: David TECHER Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0396712591==" Return-path: In-Reply-To: <1315408931610-4778925.post@n5.nabble.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: JavMV , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --===============0396712591== Content-Type: multipart/alternative; boundary="0-1810994652-1315412736=:5486" --0-1810994652-1315412736=:5486 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Javier=0A=0ASince you can test before the end of the month, please be infor= med to find the "all" patches here=0A=0AHope this helps.=0A=0ADavid=0A=0A= =0A------------------------------------------------------------=0A=0A--- to= ols/firmware/hvmloader/acpi/dsdt.asl=A0=A0=A0=A0=A0 2011-08-13 18:43:39.000= 000000 +0200=0A+++ tools/firmware/hvmloader/acpi/dsdt.asl=A0=A0=A0=A0=A0 20= 11-08-13 18:58:25.000000000 +0200=0A@@ -173,15 +173,43 @@ DefinitionBlock (= "DSDT.aml", "DSDT", 2,=0A=A0=A0=A0=A0=A0=A0=A0=A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=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 0xFB07FFFF,=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 0x00000000,=0A+=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 0x00080000,=0A+=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ,, _Y01)=0A=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 })=0A=0A=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 CreateDWordField(PRT0, \_SB.PCI0._CRS._Y01._MIN= , MMIN)=0A--- tools/firmware/hvmloader/hvmloader.c=A0=A0=A0=A0=A0=A0=A0 201= 1-08-13 18:43:39.000000000 +0200=0A+++ tools/firmware/hvmloader/hvmloader.c= =A0=A0=A0=A0=A0=A0=A0 2011-08-13 19:16:21.000000000 +0200=0A@@ -31,6 +31,7 = @@=0A=A0#include =0A=0A=A0#define ROM_INCLUDE_VGABIOS=0A+= #define ROM_INCLUDE_PTVGABIOS=0A=A0#define ROM_INCLUDE_ETHERBOOT=0A=A0#incl= ude "roms.inc"=0A=0A@@ -113,6 +114,9 @@ asm (=0A=0A=A0unsigned long scratch= _start =3D SCRATCH_PHYSICAL_ADDRESS;=0A=0A+/* virtual BDF of pass-throughed= gfx */=0A+uint8_t gfx_bdf;=0A+=0A=A0static void init_hypercalls(void)=0A= =A0{=0A=A0=A0=A0=A0 uint32_t eax, ebx, ecx, edx;=0A@@ -310,6 +314,20 @@ sta= tic int pci_load_option_roms(unsigned=0A=A0=A0=A0=A0 return rom_phys_addr -= rom_base_addr;=0A=A0}=0A=0A+static void init_vm86_tss(void)=0A+{=0A+=A0=A0= =A0 void *tss;=0A+=A0=A0=A0 struct xen_hvm_param p;=0A+=0A+=A0=A0=A0 tss = =3D mem_alloc(128, 128);=0A+=A0=A0=A0 memset(tss, 0, 128);=0A+=A0=A0=A0 p.d= omid =3D DOMID_SELF;=0A+=A0=A0=A0 p.index =3D HVM_PARAM_VM86_TSS;=0A+=A0=A0= =A0 p.value =3D virt_to_phys(tss);=0A+=A0=A0=A0 hypercall_hvm_op(HVMOP_set_= param, &p);=0A+=A0=A0=A0 printf("vm86 TSS at %08lx\n", virt_to_phys(tss));= =0A+}=0A+=0A=A0/* Replace possibly erroneous memory-size CMOS fields with c= orrect values. */=0A=A0static void cmos_write_memory_size(void)=0A=A0{=0A@@= -336,25 +354,6 @@ static void cmos_write_memory_size(void)=0A=A0=A0=A0=A0 = cmos_outb(0x35, (uint8_t)( alt_mem >> 8));=0A=A0}=0A=0A-/*=0A- * Set up an = empty TSS area for virtual 8086 mode to use.=0A- * The only important thing= is that it musn't have any bits set=0A- * in the interrupt redirection bit= map, so all zeros will do.=0A- */=0A-static void init_vm86_tss(void)=0A-{= =0A-=A0=A0=A0 void *tss;=0A-=A0=A0=A0 struct xen_hvm_param p;=0A-=0A-=A0=A0= =A0 tss =3D mem_alloc(128, 128);=0A-=A0=A0=A0 memset(tss, 0, 128);=0A-=A0= =A0=A0 p.domid =3D DOMID_SELF;=0A-=A0=A0=A0 p.index =3D HVM_PARAM_VM86_TSS;= =0A-=A0=A0=A0 p.value =3D virt_to_phys(tss);=0A-=A0=A0=A0 hypercall_hvm_op(= HVMOP_set_param, &p);=0A-=A0=A0=A0 printf("vm86 TSS at %08lx\n", virt_to_ph= ys(tss));=0A-}=0A-=0A=A0static void apic_setup(void)=0A=A0{=0A=A0=A0=A0=A0 = /* Set the IOAPIC ID to the static value used in the MP/ACPI tables. */=0A@= @ -487,8 +486,10 @@ int main(void)=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 b= reak;=0A=A0=A0=A0=A0=A0=A0=A0=A0 case VGA_pt:=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 printf("Loading VGABIOS of passthroughed gfx ...\n");=0A-=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 vgabios_sz =3D round_option_rom(=0A-=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS= +2)) * 512);=0A+=A0=A0=A0=A0=A0=A0=A0 memcpy((void *)VGABIOS_PHYSICAL_ADDRE= SS,=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 vgabios_pt, sizeof(vgabio= s_pt));=0A+=A0=A0=A0=A0=A0=A0=A0 *(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS + si= zeof(vgabios_pt)) =3D gfx_bdf;=0A+=A0=A0=A0=A0=A0=A0=A0 vgabios_sz =3D roun= d_option_rom(sizeof(vgabios_pt) + 1);=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 break;=0A=A0=A0=A0=A0=A0=A0=A0=A0 default:=0A=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 printf("No emulated VGA adaptor ...\n");=0A@@ -525,7 +526,7 @@= int main(void)=0A=A0=A0=A0=A0=A0=A0=A0=A0 hypercall_hvm_op(HVMOP_set_param= , &p);=0A=A0=A0=A0=A0 }=0A=0A-=A0=A0=A0 init_vm86_tss();=0A+=A0=A0 init_vm8= 6_tss();=0A=0A=A0=A0=A0=A0 cmos_write_memory_size();=0A=0A--- tools/firmwar= e/hvmloader/Makefile=A0=A0 2011-08-13 18:43:39.000000000 +0200=0A+++ tools/= firmware/hvmloader/Makefile=A0=A0 2011-08-13 18:58:36.000000000 +0200=0A@@ = -56,6 +56,7 @@ CIRRUSVGA_ROM :=3D ../vgabios/VGABIOS-lgpl=0A=A0else=0A=A0CI= RRUSVGA_ROM :=3D ../vgabios/VGABIOS-lgpl-latest.cirrus.bin=0A=A0endif=0A+PT= VGA_ROM=A0=A0=A0=A0 :=3D ../vgabios/vgabios-pt.bin=0A=0A=A0.PHONY: all=0A= =A0all: subdirs-all=0A@@ -94,6 +95,11 @@ ifneq ($(CIRRUSVGA_ROM),)=0A=A0=A0= =A0=A0=A0=A0=A0 sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new=0A= =A0=A0=A0=A0=A0=A0=A0 echo "#endif" >> $@.new=0A=A0endif=0A+ifneq ($(PTVGA_= ROM),)=0A+=A0=A0=A0=A0=A0=A0 echo "#ifdef ROM_INCLUDE_PTVGABIOS" >> $@.new= =0A+=A0=A0=A0=A0=A0=A0 sh ./mkhex vgabios_pt $(PTVGA_ROM) >> $@.new=0A+=A0= =A0=A0=A0=A0=A0 echo "#endif" >> $@.new=0A+endif=0A=0A=A0=A0=A0=A0=A0=A0=A0= echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> $@.new=0A=A0=A0=A0=A0=A0=A0=A0 cat = ../etherboot/eb-roms.h >> $@.new=0A--- tools/ioemu-remote/hw/pass-through.c= =A0=A0=A0=A0=A0=A0=A0 2011-08-13 23:15:13.000000000 +0200=0A+++ tools/ioemu= -remote/hw/pass-through.c=A0=A0=A0=A0=A0=A0=A0 2011-08-13 18:58:41.00000000= 0 +0200=0A@@ -3243,6 +3243,8 @@ static int pt_cmd_reg_read(struct pt_dev=0A= =A0}=0A=0A=A0/* read BAR */=0A+static int gfx_first_read_BAR[7] =3D {1, 1, = 1, 1, 1, 1, 1};=0A+=0A=A0static int pt_bar_reg_read(struct pt_dev *ptdev,= =0A=A0=A0=A0=A0=A0=A0=A0=A0 struct pt_reg_tbl *cfg_entry,=0A=A0=A0=A0=A0=A0= =A0=A0=A0 uint32_t *value, uint32_t valid_mask)=0A@@ -3265,6 +3267,17 @@ st= atic int pt_bar_reg_read(struct pt_dev=0A=A0=A0=A0=A0 /* use fixed-up value= from kernel sysfs */=0A=A0=A0=A0=A0 *value =3D ptdev->pci_dev->base_addr[i= ndex];=0A=0A+=A0=A0=A0 if ( ptdev->pci_dev->device_class =3D=3D 0x300 )=0A+= =A0=A0=A0 {=0A+=A0=A0=A0=A0=A0=A0=A0 if ( gfx_first_read_BAR[index] =3D=3D = 1 )=0A+=A0=A0=A0=A0=A0=A0=A0 {=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 gfx_fir= st_read_BAR[index] =3D 0;=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 PT_LOG("firs= t read BARs of gfx\n");=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return 0;=0A+= =A0=A0=A0=A0=A0=A0=A0 }=0A+=A0=A0=A0 }=0A+=0A+=0A=A0=A0=A0=A0 /* set emulat= e mask depend on BAR flag */=0A=A0=A0=A0=A0 switch (ptdev->bases[index].bar= _flag)=0A=A0=A0=A0=A0 {=0A--- tools/firmware/hvmloader/pci.c=A0=A0=A0=A0=A0= 2011-08-13 18:43:39.000000000 +0200=0A+++ tools/firmware/hvmloader/pci.c= =A0=A0=A0=A0=A0 2011-08-13 18:58:53.000000000 +0200=0A@@ -33,6 +33,10 @@ un= signed long pci_mem_end =3D PCI_MEM_END;=0A=0A=A0enum virtual_vga virtual_v= ga =3D VGA_none;=0A=0A+/* virtual BDF of pass-throughed gfx declared in hvm= loader.c*/=0A+extern uint8_t gfx_bdf;=0A+=0A+=0A=A0void pci_setup(void)=0A= =A0{=0A=A0=A0=A0=A0 uint32_t base, devfn, bar_reg, bar_data, bar_sz, cmd, m= mio_total =3D 0;=0A@@ -93,9 +97,44 @@ void pci_setup(void)=0A=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 }=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 else if (= virtual_vga =3D=3D VGA_none )=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 {=0A-= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 vga_devfn =3D devfn;=0A-=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 virtual_vga =3D VGA_pt;=0A+=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 virtual_vga =3D VGA_pt;=0A+= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 gfx_bdf =3D devfn;=0A+=0A+= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /* Make vBAR=3DpBAR */=0A+= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 printf("Make vBAR =3D pBAR= of assigned gfx\n");=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 f= or ( bar =3D 0; bar < 7; bar++ )=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 {=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= bar_reg =3D PCI_BASE_ADDRESS_0 + 4*bar;=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ( bar =3D=3D 6 )=0A+=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 bar_reg =3D= PCI_ROM_ADDRESS;=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 /* When first time read, it will return physical address */=0A+=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 bar_data =3D pci_= readl(devfn, bar_reg);=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 pci_writel(devfn, bar_reg, bar_data);=0A+=0A+=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /* Now enable the memory or I= /O mapping. */=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 cmd =3D pci_readw(devfn, PCI_COMMAND);=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ( (bar_reg =3D=3D PCI_ROM_ADDRESS) ||= =0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 ((bar_data & PCI_BASE_ADDRESS_SPACE) =3D=3D=0A+=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 PCI_BASE_ADDRESS_SPACE_MEMORY) )=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 cmd |=3D PCI_COMMAND_MEMOR= Y;=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 else=0A+= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 cmd |=3D PCI_COMMAND_IO;=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 cmd |=3D PCI_COMMAND_MASTER;=0A+=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 pci_writew(devfn, PCI_COMMAND, cmd);= =0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }=0A+=0A+=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /* Map the interrupt. */=0A+=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 pin =3D pci_readb(devfn, PCI_INTERRUPT= _PIN);=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ( pin !=3D 0 = )=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 {=0A+=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /* This is the barber's pole = mapping used by Xen. */=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 link =3D ((pin - 1) + (devfn >> 3)) & 3;=0A+=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 isa_irq =3D pci_readb(PCI_ISA_DE= VFN, 0x60 + link);=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 pci_writeb(devfn, PCI_INTERRUPT_LINE, isa_irq);=0A+=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }=0A+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 continue;=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }=0A+=0A= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break;=0A=A0=A0=A0=A0=A0=A0=A0=A0 case= 0x0680:=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /* PIIX4 ACPI PM. Special d= evice with special PCI config space. */=0A---------------------------------= ----------------------------------------------=0A=0A=0A=0A_________________= _______________=0ADe=A0: JavMV =0A=C0=A0: xen-de= vel@lists.xensource.com=0AEnvoy=E9 le : Mercredi 7 Septembre 2011 17h22=0AO= bjet=A0: Re: Re : Re : Re : [Xen-devel] Re: Patches for VGA-Passthrough XEN= 4.2 unstable=0A=0AI suppose you have modified the dsdt.asl file right? If = you did it and it=0Acrashed (If you didn't try it with this let me know bec= ause I have to=0Adocument the process of adapt the Tobias patches (Actually= Han,Weidong=0Apatches)) then there is something that Xen devels have added= between those=0Achangeset to the code that make the David's adaptation wor= ks (because David=0Asays he didn't add code to the patches). =0A=0AI was wo= rking on a specific computer with XEN at university and I can't try=0Athis = patchset now, that is why I have to wait to end of month.. Im=0Aimpatient!!= =0A=0AWell thanks for the answers.=0A=0AJavier Manzano.=0A=0A-----=0AJavMV= =0A--=0AView this message in context: http://xen.1045712.n5.nabble.com/Patc= hes-for-VGA-Passthrough-XEN-4-2-unstable-tp4406265p4778925.html=0ASent from= the Xen - Dev mailing list archive at Nabble.com.=0A=0A___________________= ____________________________=0AXen-devel mailing list=0AXen-devel@lists.xen= source.com=0Ahttp://lists.xensource.com/xen-devel --0-1810994652-1315412736=:5486 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Javier

Since you can test before t= he end of the month, please be informed to find the "all" patches here

Hope this helps.

David

-------------------------------------------------= -----------

--- tools/firmware/hvmloader/acpi/ds= dt.asl      2011-08-13 18:43:39.000000000 +0200+++ tools/firmware/hvmloader/acpi/dsdt.asl      2= 011-08-13 18:58:25.000000000 +0200
@@ -173,15 +173,43 @@ DefinitionBlock= ("DSDT.aml", "DSDT", 2,
           &n= bsp;            = ; 0x00000000,
         &nbs= p;            &= nbsp;  0x00020000)

+       &= nbsp;            /* = reserve MMIO BARs of gfx for 1:1 mapping */
    &nbs= p;            &= nbsp;   DWordMemory(
       = ;            &n= bsp;     ResourceProducer, PosDecode, MinFixed, MaxFixed,
          &= nbsp;           &nbs= p;  Cacheable, ReadWrite,
       = ;            &n= bsp;     0x00000000,
-     =             &nb= sp;      0xF0000000,
-    &= nbsp;           &nbs= p;       0xF4FFFFFF,
+   &n= bsp;            = ;        0xFA000000,
+  &nb= sp;            =          0xFAFFFFFF,
          = ;            &n= bsp;  0x00000000,
-        =             &nb= sp;   0x05000000,
-       &= nbsp;           &nbs= p;    ,, _Y01)
+       = ;            &n= bsp;    0x01000000)
+
+     &= nbsp;           &nbs= p;  DWordMemory(
+        &= nbsp;           &nbs= p;   ResourceProducer, PosDecode, MinFixed, MaxFixed,
+          =             &nb= sp; NonCacheable, ReadWrite,
+       =             &nb= sp;    0x00000000,
+      &= nbsp;           &nbs= p;     0xC0000000,
+     &n= bsp;            = ;      0xCFFFFFFF,
+    &nb= sp;            =        0x00000000,
+   &nbs= p;            &= nbsp;       0x10000000)
+
+         = ;           DWordMemory(<= br>+            = ;            Resourc= eProducer, PosDecode, MinFixed, MaxFixed,
+     = ;            &n= bsp;      Cacheable, ReadWrite,
+  &n= bsp;            = ;         0x00000000,
+ &nb= sp;            =           0xD0000000,
+&nbs= p;            &= nbsp;          0xD1FFFFFF,
+         &nbs= p;            &= nbsp; 0x00000000,
+         = ;            &n= bsp;  0x02000000)
+
+       &= nbsp;            DWo= rdMemory(
+          &= nbsp;           &nbs= p; ResourceProducer, PosDecode, MinFixed, MaxFixed,
+   &= nbsp;           &nbs= p;        Cacheable, ReadWrite,
+&nbs= p;            &= nbsp;          0x00000000,
+         &nbs= p;            &= nbsp; 0xFB000000,
+         = ;            &n= bsp;  0xFB07FFFF,
+        =             &nb= sp;   0x00000000,
+       &= nbsp;           &nbs= p;    0x00080000,
+      &n= bsp;            = ;    ,, _Y01)
       &= nbsp;         })

          &nbs= p;      CreateDWordField(PRT0, \_SB.PCI0._CRS._Y01= ._MIN, MMIN)
--- tools/firmware/hvmloader/hvmloader.c   &= nbsp;    2011-08-13 18:43:39.000000000 +0200
+++ tools/fi= rmware/hvmloader/hvmloader.c        2011= -08-13 19:16:21.000000000 +0200
@@ -31,6 +31,7 @@
 #include <= xen/hvm/params.h>

 #define ROM_INCLUDE_VGABIOS
+#define R= OM_INCLUDE_PTVGABIOS
 #define ROM_INCLUDE_ETHERBOOT
 #inclu= de "roms.inc"

@@ -113,6 +114,9 @@ asm (

 unsigned long s= cratch_start =3D SCRATCH_PHYSICAL_ADDRESS;

+/* virtual BDF of pass-t= hroughed gfx */
+uint8_t gfx_bdf;
+
 static void init_hyperca= lls(void)
 {
     uint32_t eax, ebx, ecx, ed= x;
@@ -310,6 +314,20 @@ static int pci_load_option_roms(unsigned
     return rom_phys_= addr - rom_base_addr;
 }

+static void init_vm86_tss(void)+{
+    void *tss;
+    struct xen_hvm= _param p;
+
+    tss =3D mem_alloc(128, 128);
+&nbs= p;   memset(tss, 0, 128);
+    p.domid =3D DOMI= D_SELF;
+    p.index =3D HVM_PARAM_VM86_TSS;
+ &n= bsp;  p.value =3D virt_to_phys(tss);
+    hypercall_= hvm_op(HVMOP_set_param, &p);
+    printf("vm86 TSS at= %08lx\n", virt_to_phys(tss));
+}
+
 /* Replace possibly erro= neous memory-size CMOS fields with correct values. */
 static void = cmos_write_memory_size(void)
 {
@@ -336,25 +354,6 @@ static void= cmos_write_memory_size(void)
     cmos_outb(0x35, (= uint8_t)( alt_mem >> 8));
 }

-/*
- * Set up an empt= y TSS area for virtual 8086 mode to use.
- * The only important thing is = that it musn't have any bits set
- * in the interrupt redirection bitmap= , so all zeros will do.
- */
-static void init_vm86_tss(void)
-{-    void *tss;
-    struct xen_hvm_para= m p;
-
-    tss =3D mem_alloc(128, 128);
- &nb= sp;  memset(tss, 0, 128);
-    p.domid =3D DOMID_SEL= F;
-    p.index =3D HVM_PARAM_VM86_TSS;
-  &= nbsp; p.value =3D virt_to_phys(tss);
-    hypercall_hvm_o= p(HVMOP_set_param, &p);
-    printf("vm86 TSS at %08l= x\n", virt_to_phys(tss));
-}
-
 static void apic_setup(void)<= br> {
     /* Set the IOAPIC ID to the static v= alue used in the MP/ACPI tables. */
@@ -487,8 +486,10 @@ int main(void)<= br>             break;
         case VGA_pt:             p= rintf("Loading VGABIOS of passthroughed gfx ...\n");
-   =          vgabios_sz =3D round_optio= n_rom(
-          &nbs= p;     (*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512= );
+        memcpy((void *)VGABIOS_PH= YSICAL_ADDRESS,
+         &= nbsp;     vgabios_pt, sizeof(vgabios_pt));
+ &n= bsp;      *(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS + = sizeof(vgabios_pt)) =3D gfx_bdf;
+      &n= bsp; vgabios_sz =3D round_option_rom(sizeof(vgabios_pt) + 1);
 &nbs= p;           break;
         default:
&nb= sp;            print= f("No emulated VGA adaptor ...\n");
@@ -525,7 +526,7 @@ int main(void)         hypercall_hvm_op(HVMOP_s= et_param, &p);
     }

-   = init_vm86_tss();
+   init_vm86_tss();

  &nbs= p;  cmos_write_memory_size();

--- tools/firmware/hvmloader/Make= file   2011-08-13 18:43:39.000000000 +0200
+++ tools/firmware/= hvmloader/Makefile   2011-08-13 18:58:36.000000000 +0200
@@ -5= 6,6 +56,7 @@ CIRRUSVGA_ROM :=3D ../vgabios/VGABIOS-lgpl
 else
&n= bsp;CIRRUSVGA_ROM :=3D ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
 e= ndif
+PTVGA_ROM     :=3D ../vgabios/vgabios-pt.bin
 .PHONY: all
 all: subdirs-all
@@ -94,6 +95,11 @@ ifneq ($(CIRRUSVGA_ROM),)
        sh= ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
  =       echo "#endif" >> $@.new
 endif=
+ifneq ($(PTVGA_ROM),)
+       echo "#= ifdef ROM_INCLUDE_PTVGABIOS" >> $@.new
+    &n= bsp;  sh ./mkhex vgabios_pt $(PTVGA_ROM) >> $@.new
+ &nb= sp;     echo "#endif" >> $@.new
+endif

=         echo "#ifdef ROM_INCLUDE_ETHERBO= OT" >> $@.new
        cat ../et= herboot/eb-roms.h >> $@.new
--- tools/ioemu-remote/hw/pass-through= .c        2011-08-13 23:15:13.000000000 = +0200
+++ tools/ioemu-remote/hw/pass-through.c    &n= bsp;   2011-08-13 18:58:41.000000000 +0200
@@ -3243,6 +3243,8 @@ static int pt_cmd_reg_read(struct pt_dev
 }

&nbs= p;/* read BAR */
+static int gfx_first_read_BAR[7] =3D {1, 1, 1, 1, 1, 1= , 1};
+
 static int pt_bar_reg_read(struct pt_dev *ptdev,
&nb= sp;        struct pt_reg_tbl *cfg_entry,=
         uint32_t *value, uint3= 2_t valid_mask)
@@ -3265,6 +3267,17 @@ static int pt_bar_reg_read(struct= pt_dev
     /* use fixed-up value from kernel sysfs= */
     *value =3D ptdev->pci_dev->base_addr[= index];

+    if ( ptdev->pci_dev->device_class = =3D=3D 0x300 )
+    {
+     &= nbsp;  if ( gfx_first_read_BAR[index] =3D=3D 1 )
+   = ;     {
+       &= nbsp;    gfx_first_read_BAR[index] =3D 0;
+            = PT_LOG("first read BARs of gfx\n");
+      = ;      return 0;
+     = ;   }
+    }
+
+
   &nb= sp; /* set emulate mask depend on BAR flag */
     s= witch (ptdev->bases[index].bar_flag)
     {
--= - tools/firmware/hvmloader/pci.c      2011-08-13 1= 8:43:39.000000000 +0200
+++ tools/firmware/hvmloader/pci.c  &n= bsp;   2011-08-13 18:58:53.000000000 +0200
@@ -33,6 +33,10 @@ = unsigned long pci_mem_end =3D PCI_MEM_END;

 enum virtual_vga vi= rtual_vga =3D VGA_none;

+/* virtual BDF of pass-throughed gfx declar= ed in hvmloader.c*/
+extern uint8_t gfx_bdf;
+
+
 void pci= _setup(void)
 {
     uint32_t base, devfn, bar_reg, bar_data, bar_sz, cmd, mmio_total =3D 0;
@@ -93,9 +97,4= 4 @@ void pci_setup(void)
       &nbs= p;     }
       &= nbsp;     else if ( virtual_vga =3D=3D VGA_none )
&n= bsp;            {-            &= nbsp;   vga_devfn =3D devfn;
-     &n= bsp;          virtual_vga =3D = VGA_pt;
+          &nb= sp;      virtual_vga =3D VGA_pt;
+  &= nbsp;           &nbs= p;  gfx_bdf =3D devfn;
+
+      &n= bsp;          /* Make vBAR=3Dp= BAR */
+           &= nbsp;     printf("Make vBAR =3D pBAR of assigned gfx\n"= );
+           &n= bsp;     for ( bar =3D 0; bar < 7; bar++ )
+ = ;            &n= bsp;   {
+        &nbs= p;            bar_re= g =3D PCI_BASE_ADDRESS_0 + 4*bar;
+      &= nbsp;           &nbs= p;  if ( bar =3D=3D 6 )
+       =             &nb= sp;         bar_reg =3D PCI_ROM_ADDRESS;
+         = ;            /* When= first time read, it will return physical address */
+   =             &nb= sp;     bar_data =3D pci_readl(devfn, bar_reg);
+&nb= sp;            =         pci_writel(devfn, bar_reg, bar_d= ata);
+
+          =            /* Now enable = the memory or I/O mapping. */
+       = ;            &n= bsp; cmd =3D pci_readw(devfn, PCI_COMMAND);
+         &n= bsp;           if ( (bar_= reg =3D=3D PCI_ROM_ADDRESS) ||
+      &nbs= p;            &= nbsp;          ((bar_data &= ; PCI_BASE_ADDRESS_SPACE) =3D=3D
+      &n= bsp;            = ;            PCI_BAS= E_ADDRESS_SPACE_MEMORY) )
+       &nb= sp;            =        cmd |=3D PCI_COMMAND_MEMORY;
+ = ;            &n= bsp;       else
+           = ;            &n= bsp;   cmd |=3D PCI_COMMAND_IO;
+     = ;            &n= bsp;   cmd |=3D PCI_COMMAND_MASTER;
+    &= nbsp;           &nbs= p;    pci_writew(devfn, PCI_COMMAND, cmd);
+  &= nbsp;           &nbs= p; }
+
+          &= nbsp;      /* Map the interrupt. */
+ &nbs= p;            &= nbsp;  pin =3D pci_readb(devfn, PCI_INTERRUPT_PIN);
+        &n= bsp;        if ( pin !=3D 0 )
+ =             &nb= sp;   {
+         = ;            /* This= is the barber's pole mapping used by Xen. */
+    &= nbsp;           &nbs= p;    link =3D ((pin - 1) + (devfn >> 3)) & 3;
= +            &n= bsp;        isa_irq =3D pci_readb(PCI_IS= A_DEVFN, 0x60 + link);
+        =              pc= i_writeb(devfn, PCI_INTERRUPT_LINE, isa_irq);
+          =        }
+     &n= bsp;           continue;<= br>            = }
+
          &nbs= p;  break;
         case 0x= 0680:
           =   /* PIIX4 ACPI PM. Special device with special PCI config space. */-------------------------------------------------------------------------= ------


De : JavMV <javier.manzano@= edu.uah.es>
=C0 : xen-devel@lists.xensource.com
E= nvoy=E9 le : Mercredi 7 Septembre 2011 17h22
Objet : Re: Re : Re : Re : [Xen-dev= el] Re: Patches for VGA-Passthrough XEN 4.2 unstable

I suppos= e you have modified the dsdt.asl file right? If you did it and it
crashe= d (If you didn't try it with this let me know because I have to
document= the process of adapt the Tobias patches (Actually Han,Weidong
patches))= then there is something that Xen devels have added between those
change= set to the code that make the David's adaptation works (because David
sa= ys he didn't add code to the patches).

I was working on a specific = computer with XEN at university and I can't try
this patchset now, that = is why I have to wait to end of month.. Im
impatient!!

Well thanks = for the answers.

Javier Manzano.

-----
JavMV
--
View= this message in context: http://xen.1045712.n5.nabble.com/Patches-for-VGA-Passthrough-XEN-4-2= -unstable-tp4406265p4778925.html
Sent from the Xen - Dev mailing lis= t archive at Nabble.com.

___________________________________________= ____
Xen-devel mailing list
Xen-devel@lists.xe= nsource.com
http://lists.xensource.com/xen-devel


--0-1810994652-1315412736=:5486-- --===============0396712591== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0396712591==--