From: Keir Fraser Subject: Re: Mapping pci resources for graphics passthrough Date: Thu, 22 Jan 2009 07:34:55 +0000 Message-ID: References: <7969168f0901211629h5842259p5727fd904a1f864e@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <7969168f0901211629h5842259p5727fd904a1f864e@mail.gmail.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: Alexia Benington , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org It=B9s 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" wrote: > I've been trying to understand the pci_setup function in hvmloader.c in X= en > unstable. I'm kinda lost at Line 328. > base =3D (resource->base + bar_sz - 1) & ~(bar_sz - 1) >=20 > 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 complemen= ts of > "bar_sz-1". >=20 > 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 be= cause > the video RAM and ROM has not been mapped as required, thus the video BIO= S > 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 grap= hics > card with several guests. It is also fine if dom0 loses control of the > graphics card. I can use serial.