Beng Heng, Ng
2009-May-14 22:52 UTC
[Xen-devel] Getting VGA Passthrough to work on Xen Unstable
Hi all, I''ve tried to filter out parts of XCI that are relevant to VGA passthrough (most, if not all, are Jean Guyader''s work) and apply them to Xen unstable. The patch doesn''t work with changeset 19597. I''m not sure why. But I''ve gotten DomU to boot up showing only the physical gfx on previous changesets. I didn''t have a chance to test the gfx functionalities though. I made a lot of simplifications, such as excluding user options, and ignoring HID passthrough for now. The patch is hardcoded for VGA passthrough on HVM guests. The reason is really to study which are the parts really affect VGA passthrough, and of course ultimately getting VGA passthrough to work. This may seem like taking a step backwards, but I think there are many people out there who are new, like me, and are really interested to understand and get VGA passthrough to work correctly. I''m hoping that experts out there can provide constructive criticism on this patch, and of course provide suggestions on how to make this patch work for the latest changeset. - Beng Heng _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Akio Takebe
2009-May-15 05:34 UTC
Re: [Xen-devel] Getting VGA Passthrough to work on Xen Unstable
Hi,>Hi all, > >I''ve tried to filter out parts of XCI that are relevant to VGA >passthrough (most, if not all, are Jean Guyader''s work) and apply them >to Xen unstable. The patch doesn''t work with changeset 19597. I''m not >sure why. But I''ve gotten DomU to boot up showing only the physical gfx >on previous changesets. I didn''t have a chance to test the gfx >functionalities though. I made a lot of simplifications, such as >excluding user options, and ignoring HID passthrough for now. The patch >is hardcoded for VGA passthrough on HVM guests. The reason is really to >study which are the parts really affect VGA passthrough, and of course >ultimately getting VGA passthrough to work. > >This may seem like taking a step backwards, but I think there are many >people out there who are new, like me, and are really interested to >understand and get VGA passthrough to work correctly. I''m hoping that >experts out there can provide constructive criticism on this patch, and >of course provide suggestions on how to make this patch work for the >latest changeset. >I suspect the VGA rom doesn''t be loaded. pci_load_option_roms() loads only mass stroage devices and serial bus controller. You need to remove the ckeck. @tools/firmware/hvmloader/hvmloader.c 476 static int pci_load_option_roms(uint32_t rom_base_addr) 477 { 478 uint32_t option_rom_addr, rom_phys_addr = rom_base_addr; 479 uint16_t vendor_id, device_id; 480 uint8_t devfn, class; 481 482 for ( devfn = 0; devfn < 128; devfn++ ) 483 { 484 class = pci_readb(devfn, PCI_CLASS_DEVICE + 1); 485 vendor_id = pci_readw(devfn, PCI_VENDOR_ID); 486 device_id = pci_readw(devfn, PCI_DEVICE_ID); 487 488 if ( (vendor_id == 0xffff) && (device_id == 0xffff) ) 489 continue; 490 491 /* 492 * Currently only scan options from mass storage devices and serial 493 * bus controller (Fibre Channel included). 494 */ 495 if ( (class != 0x1) && (class != 0xc) ) 496 continue; 497 498 option_rom_addr = pci_readl(devfn, PCI_ROM_ADDRESS); 499 if ( !option_rom_addr ) 500 continue; 501 502 /* Ensure Expansion Bar is enabled before copying */ 503 pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr | 0x1); 504 505 rom_phys_addr += scan_option_rom( 506 devfn, vendor_id, device_id, 507 (void *)(option_rom_addr & ~2047), rom_phys_addr); 508 509 /* Restore the default original value of Expansion Bar */ 510 pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr); 511 } 512 513 return rom_phys_addr - rom_base_addr; 514 } Best Regards, Akio Takebe _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Beng Heng, Ng
2009-May-15 12:53 UTC
Re: [Xen-devel] Getting VGA Passthrough to work on Xen Unstable
Hi Akio, Thanks for the reply. I didn''t make any changes to pci_load_option_roms. Did you mean pci_setup? :) - Beng Heng Akio Takebe wrote:> Hi, > > I suspect the VGA rom doesn''t be loaded. > pci_load_option_roms() loads only mass stroage devices and serial bus controller. > You need to remove the ckeck. > > @tools/firmware/hvmloader/hvmloader.c > 476 static int pci_load_option_roms(uint32_t rom_base_addr) > 477 { > 478 uint32_t option_rom_addr, rom_phys_addr = rom_base_addr; > 479 uint16_t vendor_id, device_id; > 480 uint8_t devfn, class; > 481 > 482 for ( devfn = 0; devfn < 128; devfn++ ) > 483 { > 484 class = pci_readb(devfn, PCI_CLASS_DEVICE + 1); > 485 vendor_id = pci_readw(devfn, PCI_VENDOR_ID); > 486 device_id = pci_readw(devfn, PCI_DEVICE_ID); > 487 > 488 if ( (vendor_id == 0xffff) && (device_id == 0xffff) ) > 489 continue; > 490 > 491 /* > 492 * Currently only scan options from mass storage devices and serial > 493 * bus controller (Fibre Channel included). > 494 */ > 495 if ( (class != 0x1) && (class != 0xc) ) > 496 continue; > 497 > 498 option_rom_addr = pci_readl(devfn, PCI_ROM_ADDRESS); > 499 if ( !option_rom_addr ) > 500 continue; > 501 > 502 /* Ensure Expansion Bar is enabled before copying */ > 503 pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr | 0x1); > 504 > 505 rom_phys_addr += scan_option_rom( > 506 devfn, vendor_id, device_id, > 507 (void *)(option_rom_addr & ~2047), rom_phys_addr); > 508 > 509 /* Restore the default original value of Expansion Bar */ > 510 pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr); > 511 } > 512 > 513 return rom_phys_addr - rom_base_addr; > 514 } > > Best Regards, > > Akio Takebe_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Akio Takebe
2009-May-18 00:20 UTC
Re: [Xen-devel] Getting VGA Passthrough to work on Xen Unstable
Hi, Beng>Thanks for the reply. I didn''t make any changes to pci_load_option_roms. >Did you mean pci_setup? :) >No, your change of pci_setup is needed. But it''s not enough. You need to change also pci_load_option_roms. Best Regards, Akio Takebe _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel