From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [Query] Flow of PCI device dedicated to a domU Date: Tue, 22 Jul 2014 17:06:00 +0100 Message-ID: References: <53C64AF8.90001@citrix.com> <53CE3541.80506@citrix.com> <53CE3DE2.8060908@citrix.com> <1721487090.20140722165657@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1721487090.20140722165657@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Simon Martin Cc: Andrew Cooper , Xenbegn developer , xen-devel@lists.xen.org, ian.campbell@citrix.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Tue, 22 Jul 2014, Simon Martin wrote: > Hello Stefano, > > > The basic mechanism is that Xen assigns the PCI root complex/host > > bridge to Dom0. Dom0 walks the bus and finds out the devices available. > > > When the user assigns a PCI device to a VM, the toolstack (xl/libxl) > > issues hypercalls to remap interrupts and MMIO regions of that device > > into the guest VM. > > I am currently trying writing my own PCI front to access directly a > PCI device from my PV guest. > > If I read this correctly you are saying that the MMIO region is > already mapped into my domain by xl? Looking again at: tools/libxl/libxl_pci.c:do_pci_add for the PV guest case, the function gives ioport and mmio access permissions to the guest and maps the irqs. It doesn't directly map any MMIO regions but it allows the guest to do so. > So when I go and read the BAR > register from the PCI configuration I can just go and access it > directly or do I have to update the VA mapping? You do need to update the VA mapping, sorry for the confusion.