Alexia Benington
2009-Jan-22 00:29 UTC
[Xen-devel] Mapping pci resources for graphics passthrough
Hi all, I''ve been trying to understand the pci_setup function in hvmloader.c in Xen unstable. I''m kinda lost at Line 328. base = (resource->base + bar_sz - 1) & ~(bar_sz - 1) I''d appreciate if someone could explain to me why base is calculated this way. Specifically, I don''t understand the bitwise AND with the one''s complements of "bar_sz-1". The reason why I''m doing this is that I''m hoping to modify hvmloader such that it can map the correct memory for a PCI-e video card. I''ve been able to passthrough the video card to a HVM guest. However, the OS (tried Linux, Vista or XP) is not able to load the driver correctly, although lspci (on Linux) does show that the video card has been passed through. I suspect it is because the video RAM and ROM has not been mapped as required, thus the video BIOS cannot be loaded. I would like to try out with only one guest first, just to see if it works and leaving out the complexities of multiplexing the graphics card with several guests. It is also fine if dom0 loses control of the graphics card. I can use serial. Thanks and have a nice day! Cheers, Alex _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2009-Jan-22 07:34 UTC
Re: [Xen-devel] Mapping pci resources for graphics passthrough
It¹s that way because a BAR base has to be aligned on a boundary the power-of-two size of the BAR. Passing thru gfx before may not have worked because the PCI I/O hole below 4GB was not big enough. That is fixed now in xen-unstable by dynamically sizing the hole. -- Keir On 22/01/2009 00:29, "Alexia Benington" <alexbenington@gmail.com> wrote:> I''ve been trying to understand the pci_setup function in hvmloader.c in Xen > unstable. I''m kinda lost at Line 328. > base = (resource->base + bar_sz - 1) & ~(bar_sz - 1) > > I''d appreciate if someone could explain to me why base is calculated this way. > Specifically, I don''t understand the bitwise AND with the one''s complements of > "bar_sz-1". > > The reason why I''m doing this is that I''m hoping to modify hvmloader such that > it can map the correct memory for a PCI-e video card. I''ve been able to > passthrough the video card to a HVM guest. However, the OS (tried Linux, Vista > or XP) is not able to load the driver correctly, although lspci (on Linux) > does show that the video card has been passed through. I suspect it is because > the video RAM and ROM has not been mapped as required, thus the video BIOS > cannot be loaded. I would like to try out with only one guest first, just to > see if it works and leaving out the complexities of multiplexing the graphics > card with several guests. It is also fine if dom0 loses control of the > graphics card. I can use serial._______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Seemingly Similar Threads
- Option iommu=1 causes hypervisor to start debugger
- [PATCH v3] xen/tools: Add 64 bits big bar support
- [LLVMdev] Error when building tutorial example
- [Patch] Make memory hole for PCI Express bigger and prevent roll-over
- Trouble enabling VT-D: "I/O virtualisation disabled"