All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: "Jaggi, Manish" <Manish.Jaggi@caviumnetworks.com>
Cc: "Prasun.kapoor@cavium.com" <Prasun.kapoor@cavium.com>,
	"Ian Campbell" <ian.campbell@citrix.com>,
	"Kumar, Vijaya" <Vijaya.Kumar@caviumnetworks.com>,
	"★ Stefano Stabellini" <stefano.stabellini@eu.citrix.com>,
	"Daney, David" <David.Daney@caviumnetworks.com>,
	"Xen Devel" <xen-devel@lists.xen.org>,
	"Julien Grall" <julien.grall@citrix.com>
Subject: Re: PCI Pass-through in Xen ARM: Draft 4
Date: Tue, 15 Sep 2015 14:18:49 -0700	[thread overview]
Message-ID: <55F88B39.1080206@caviumnetworks.com> (raw)
In-Reply-To: <55F8694B.6070904@cavium.com>

On 09/15/2015 11:58 AM, Jaggi, Manish wrote:
> 
> 
> On Thursday 10 September 2015 06:42 AM, Julien Grall wrote:
>> Hi Manish,
> Hi Julien, sorry for late response..
>>
>> On 13/08/2015 10:42, Manish Jaggi wrote:
>>>    3.2.    Mapping between streamID - deviceID - pci sbdf - requesterID
>>> -----------------------------------------------------------------------------
>>>    For a simpler case all should be equal to BDF. But there are some
>>> devices
>>>    that use the wrong requester ID for DMA transactions. Linux kernel has
>>> PCI
>>>    quirks for these. How the same be implemented in Xen or a diffrent
>>> approach
>>>    has to be taken is TODO here.
>>>
>>>    Till that time, for basic implementation it is assumed that all are
>>> equal
>>>    to BDF.
>>
>> Back to this streamID = DeviceID = requestID = SBDF again...
>>
>> I've just found a patch for Linux send by one of your colleague about
>> tweaking the requesterID for thunder-X board (See [1]). The most
>> interesting bits are:
>>
>> static u32 pci_requester_id_ecam(struct pci_dev *dev)
>> {
>>      return (((pci_domain_nr(dev->bus) >> 2) << 19) |
>>          ((pci_domain_nr(dev->bus) % 4) << 16) |
>>          (dev->bus->number << 8) | dev->devfn);
>> }
>>
>> static u32 thunder_pci_requester_id(struct pci_dev *dev, u16 alias)
>> {
>>      int ret;
>>
>>      ret = thunder_pem_requester_id(dev);
>>      if (ret >= 0)
>>          return (u32)ret;
>>
>>      return pci_requester_id_ecam(dev);
>> }
>>
>> Which is then used to override the default function used by ITS to
>> find the deviceID.
>>
>> AFAICT, this means that you can't safely assume that DeviceID == sBDF
>> even for your platform. Is that right?
> Yes.
>>
>> If so, I'm afraid that you have to handle DeviceID != sBDF (and so on)
>> in your design doc. I.e how do you plan to get the base requester ID.
>>
> Right. But on our platform the requesterId is uniquely generated from
> bdf. Adding David to confirm that.

The requesterId is: Node << 19 + ECAM# << 16 + bdf

For the Linux kernel, the Node/ECAM part is going to be read from OF
device-tree or ACPI, not calculated with the above formula.


>> I can see 2 different solutions:
>>      1) Let DOM0 pass the first requester ID when registering the bus
>>         Pros:
>>          * Less per-platform code in Xen
>>         Cons:
>>          * Assume that the requester ID are contiguous. (Is it really a
>> cons?)
>>          * Still require quirk for buggy device (i.e requester ID not
>> correct)
>>      2) Do it in Xen
>>         Pros:
>>          * We are not relying on DOM0 giving the requester ID
>>              => Not assuming contiguous requester ID
>>          Cons:
>>          * Per PCI bridge code to handle the mapping
>>
>    We can have (3) that when PHYSDEVOP_pci_add_device is called the sbdf
> and requesterID both are passed in hypercall.
>> Regards,
>>
>> [1] https://lkml.org/lkml/2015/7/15/703
>>
>>
>>
> 

  reply	other threads:[~2015-09-15 21:18 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13  9:42 PCI Pass-through in Xen ARM: Draft 4 Manish Jaggi
2015-08-13 10:37 ` Julien Grall
2015-09-02 15:19   ` Ian Campbell
2015-09-02 15:40     ` Julien Grall
2015-08-13 15:29 ` Jan Beulich
2015-08-13 17:01   ` Ian Campbell
2015-08-14  9:26     ` Jan Beulich
2015-08-14 13:21       ` Stefano Stabellini
2015-08-14 13:58         ` Jan Beulich
2015-08-14 14:03           ` Stefano Stabellini
2015-08-14 14:34             ` Jan Beulich
2015-08-14 14:37               ` Stefano Stabellini
2015-08-14 14:45                 ` Julien Grall
2015-08-14 15:15                   ` Jan Beulich
2015-08-14 15:24                     ` Stefano Stabellini
2015-09-02 14:45               ` Ian Campbell
2015-09-02 14:52                 ` Jan Beulich
2015-09-02 15:07                   ` Ian Campbell
2015-09-02 14:47       ` Ian Campbell
2015-08-14 15:38   ` Stefano Stabellini
2015-08-14 18:58     ` Jaggi, Manish
2015-08-16 23:59       ` Stefano Stabellini
2015-09-02 14:57   ` Ian Campbell
2015-09-02 15:06     ` Jan Beulich
2015-08-31 12:36 ` Manish Jaggi
2015-09-01  7:32   ` Jan Beulich
2015-09-02 12:08     ` Manish Jaggi
2015-09-02 12:59       ` Julien Grall
2015-09-02 13:46         ` Ian Campbell
2015-09-02 15:03           ` Ian Campbell
2015-09-02 15:03         ` Ian Campbell
2015-09-01 16:15 ` Stefano Stabellini
2015-09-10  1:12 ` Julien Grall
2015-09-15 18:58   ` Jaggi, Manish
2015-09-15 21:18     ` David Daney [this message]
2015-09-16 12:58     ` Julien Grall
2015-09-19 20:24       ` Manish Jaggi
2015-09-19 20:48         ` Julien Grall
2015-09-19 21:51           ` Daney, David
2015-09-21 10:17             ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55F88B39.1080206@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=David.Daney@caviumnetworks.com \
    --cc=Manish.Jaggi@caviumnetworks.com \
    --cc=Prasun.kapoor@cavium.com \
    --cc=Vijaya.Kumar@caviumnetworks.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.