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

Re: [Xen-devel] [Query] Assigning PCI ranges to dom0 and domU



On Thu, 14 Aug 2014, manish jaggi wrote:
> On 1 August 2014 19:31, Stefano Stabellini
> <stefano.stabellini@xxxxxxxxxxxxx> wrote:
> > On Fri, 1 Aug 2014, manish jaggi wrote:
> >> Hi Stefano,
> >>
> >> I am working on accessing PCI nodes in the doms on ARM (cavium). If there 
> >> is the below device tree node
> >> pcie1@0x849000000000 {
> >>             compatible = "cavium,thunder-pcie";
> >>         device_type = "pci";
> >>         msi-parent = <&its>;
> >>         bus-range = <0 255>;
> >>         #size-cells = <2>;
> >>         #address-cells = <3>;
> >>             reg = <0x8490 0x00000000 0 0x40000000>;  /* Configuration 
> >> space */
> >>         ranges = <0x03000000 0x8310 0x00000000 0x8310 0x00000000 0x00 
> >> 0x10000000>, /* mem ranges */
> >>             <0x03000000 0x8100 0x00000000 0x8100 0x00000000 0x80 
> >> 0x00000000>;
> >>         };
> >>
> >>
> >> How to assign ranges to guest dom0 / domU. Is there a well defined api in 
> >> xen OR I have to parse the device tree
> >> ranges and do a 1:1 mapping using map_mmio_regions.
> >
> > Firstly you just need to get PCI up and running in Dom0, and you can do
> > that by passing this device tree node to Dom0 and remapping the
> > appropriate memory ranges. See for example:
> >
> > xen/arch/arm/platforms/xgene-storm.c:xgene_storm_specific_mapping
> >
> >
> > Once that is done, it is time to look at pciback and pcifront and try to
> > get them running on ARM.
> >
> >
> > I would start by enabling PCI passthrough in the xl toolstack, look at
> > tools/libxl/libxl_pci.c:libxl__device_pci_add, called by
> > domcreate_attach_pci. It should be working on ARM following the PV path
> > (LIBXL_DOMAIN_TYPE_PV).
> >
> >
> > After the toolstack parts are in place, you should be able to see a pci
> > entry in xenstore (xenstore-ls to list everything that is present in
> > xenstore). That is the basic information needed by pcifront and pciback
> > to enstablish a communication channel.
> I am getting this output, cmd 30 in do_physdev_op is commented though
> 
> linux:~ # xl pci-assignable-add 01:10.1
> (XEN) do_physdev_op cmd=30
> linux:~ # xl pci-assignable-list
> 0000:01:10.1
> linux:~ # xenstore-list
> xenstore-list: Usage: xenstore-list [-h] [-p] [-s] key [...]
> linux:~ # xenstore-list /local/domain/0
> name
> domid
> linux:~ # xenstore-ls
> tool = ""
>  xenstored = ""
> local = ""
>  domain = ""
>   0 = ""
>    name = "Domain-0"
>    domid = "0"
> libxl = ""
>  pciback = ""
>   0000-01-10-1 = ""
>    driver_path = "/sys/bus/pci/drivers/thunder-BGX"
> 
> Does it look good ?
> 
> Can you please send a log or point to one, which shows something
> similar for x86 so that I can use that as a reference.

You should be able to just Google something like that.
This is what Google gave me as result:

        # xenstore-ls /local/domain/0/backend/pci
        14 = ""
         0 = ""
          domain = "debian-2"
          frontend = "/local/domain/14/device/pci/0"
          uuid = "b328cab0-a704-d59f-8133-c5f053f4b639"
          dev-0 = "0000:00:1d.00"
          state = "4"
          online = "1"
          frontend-id = "14"
          num_devs = "1"
          root-0 = "0000:00"
          root_num = "1"
        # xenstore-ls /local/domain/14/device/pci
        0 = ""
         state = "4"
         backend-id = "0"
         backend = "/local/domain/0/backend/pci/14/0"
         pci-op-ref = "8"
         event-channel = "27"
         magic = "7"

You can also simply go through libxl code and see what it is writing to
xenstore: tools/libxl/libxl_pci.c:libxl__device_pci_add_xenstore.

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


 


Rackspace

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