xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: "Manish Jaggi" <mjaggi@caviumnetworks.com>,
	"Xen Devel" <xen-devel@lists.xen.org>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
	"★ Stefano Stabellini" <stefano.stabellini@eu.citrix.com>,
	"Manish Jaggi,★ Kumar, Vijaya" <Vijaya.Kumar@caviumnetworks.com>,
	"Julien Grall" <julien.grall@linaro.org>,
	"Ian Campbell" <ian.campbell@citrix.com>
Cc: "Prasun.kapoor@cavium.com" <Prasun.kapoor@cavium.com>
Subject: Re: PCI Pass-through in Xen ARM: Draft 4
Date: Thu, 10 Sep 2015 02:12:28 +0100	[thread overview]
Message-ID: <55F0D8FC.7050606@citrix.com> (raw)
In-Reply-To: <55CC668F.80104@caviumnetworks.com>

Hi Manish,

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?

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.

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

Regards,

[1] https://lkml.org/lkml/2015/7/15/703



-- 
Julien Grall

  parent reply	other threads:[~2015-09-10  1:12 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 [this message]
2015-09-15 18:58   ` Jaggi, Manish
2015-09-15 21:18     ` David Daney
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=55F0D8FC.7050606@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=Prasun.kapoor@cavium.com \
    --cc=Vijaya.Kumar@caviumnetworks.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=konrad.wilk@oracle.com \
    --cc=mjaggi@caviumnetworks.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).