[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Pass through in Xen



On Tue, Jul 25, 2017 at 05:59:04PM +0530, ajmalmalib4u wrote:
>    Hi,
>    >> > I have successfully tested a PCI device in my PC. 
>    >> > As per my current understanding, the control flow for PCI passthrough
>    is 
>    >> > “xen-pcifront -> xen-pciback -> driver”. Is this correct? 
>    >> That's for PV guests, and only for accesses to the PCI config space. 
>    >> Device MMIO regions are mapped directly into DomU.
>    I am using PV guests.
>    Where does the PCI MMIO gets mapped to DomU? Is it done by the front and
>    back drivers?

I don't think so, AFAIK (and I'm not expert in PV passthrough), the
toolstack sets the permissions of the DomU to allow it to map MMIO
regions that belong to the device (see do_pci_add in libxl_pci.c), and
then the DomU itself establishes the mappings using the PV MMU
interface.

>    Or Is the mapping only happening at the hardware level where IOMMU handles
>    it without Dom0's or DomU's knowledge?

How's that possible? IOMMU needs to know the GFN -> MFN relation, so
some entity in the system has to program it.

>    If possible, could you please point me to the right source file or block
>    of code in Xen source which handles this mapping of PCI memory regions?
>    Also, Does the normal PCI driver in the Linux kernel plays any role in PCI
>    passthrough?

Yes, the native Linux driver is still used. Pcifront is only used as a
different mechanism to access the configuration space, but that's just
it, it's just a different transport than writing to IO ports or MMCFG
areas.

> Or Is it the front and back drivers, that does all of it?
>    Does the front and back drivers access the PCI driver in the Linux kernel
>    at any point?

No, the flow is the following:

             Config space        Shared ring
Native driver +--------> pcifront +-------> pciback
     +
     |
     |   BAR access
     +-----------------> MMIO

Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.