All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Roger Pau Monn? <roger.pau@citrix.com>,
	Venu Busireddy <venu.busireddy@oracle.com>
Cc: "Edgar Iglesias (edgar.iglesias@xilinx.com)"
	<edgar.iglesias@xilinx.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Chen <Wei.Chen@arm.com>, Steve Capper <Steve.Capper@arm.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jiandi An <anjiandi@codeaurora.org>,
	alistair.francis@xilinx.com,
	Punit Agrawal <punit.agrawal@arm.com>,
	Campbell Sean <scampbel@codeaurora.org>,
	xen-devel <xen-devel@lists.xenproject.org>,
	"manish.jaggi@caviumnetworks.com"
	<manish.jaggi@caviumnetworks.com>,
	Shanker Donthineni <shankerd@codeaurora.org>
Subject: Re: [early RFC] ARM PCI Passthrough design document
Date: Wed, 3 May 2017 13:53:48 +0100	[thread overview]
Message-ID: <17715965-df17-363b-f726-2fd6fe95af09@linaro.org> (raw)
In-Reply-To: <20170315163839.rd7bh2ho5wun7s67@dhcp-3-128.uk.xensource.com>

Hi Roger,

On 15/03/17 16:38, Roger Pau Monn? wrote:
> On Wed, Mar 15, 2017 at 10:11:35AM -0500, Venu Busireddy wrote:
>> On Wed, Mar 15, 2017 at 12:56:50PM +0000, Roger Pau Monn? wrote:
>>> On Wed, Mar 15, 2017 at 08:42:04AM -0400, Konrad Rzeszutek Wilk wrote:
>>>> On Wed, Mar 15, 2017 at 12:07:28PM +0000, Roger Pau Monn? wrote:
>>>>> On Fri, Mar 10, 2017 at 10:28:43AM -0500, Konrad Rzeszutek Wilk wrote:
>>>>>> On Fri, Mar 10, 2017 at 12:23:18PM +0900, Roger Pau Monn? wrote:
>>>>>>> On Thu, Mar 09, 2017 at 07:29:34PM -0500, Konrad Rzeszutek Wilk wrote:
>>>>>>>> On Thu, Mar 09, 2017 at 01:26:45PM +0000, Julien Grall wrote:
>>>>>>>>> Hi Konrad,
>>>>>>>>>
>>>>>>>>> On 09/03/17 11:17, Konrad Rzeszutek Wilk wrote:
>>>>>>>>>> On Thu, Mar 09, 2017 at 11:59:51AM +0900, Roger Pau Monn? wrote:
>>>>>>>>>>> On Wed, Mar 08, 2017 at 02:12:09PM -0500, Konrad Rzeszutek Wilk wrote:
>>>>>>>>>>>> On Wed, Mar 08, 2017 at 07:06:23PM +0000, Julien Grall wrote:
>>>>>>>>>>>> .. this as for SR-IOV devices you need the drivers to kick the hardware
>>>>>>>>>>>> to generate the new bus addresses. And those (along with the BAR regions) are
>>>>>>>>>>>> not visible in ACPI (they are constructued dynamically).
>>>>>>>>>>>
>>>>>>>>>>> There's already code in Xen [0] to find out the size of the BARs of SR-IOV
>>>>>>>>>>> devices, but I'm not sure what's the intended usage of that, does it need to
>>>>>>>>>>> happen _after_ the driver in Dom0 has done whatever magic for this to work?
>>>>>>>>>>
>>>>>>>>>> Yes. This is called via the PHYSDEVOP_pci_device_add hypercall when
>>>>>>>>>> the device driver in dom0 has finished "creating" the VF. See drivers/xen/pci.c
>>>>>>>>>
>>>>>>>>> We are thinking to not use PHYSDEVOP_pci_device_add hypercall for ARM and do
>>>>>>>>> the PCI scanning in Xen.
>>>>>>>>>
>>>>>>>>> If I understand correctly what you said, only the PCI driver will be able to
>>>>>>>>> kick SR-IOV device and Xen would not be able to detect the device until it
>>>>>>>>> has been fully configured. So it would mean that we have to keep
>>>>>>>>> PHYSDEVOP_pci_device_add around to know when Xen can use the device.
>>>>>>>>>
>>>>>>>>> Am I correct?
>>>>>>>>
>>>>>>>> Yes. Unless the PCI drivers come up with some other way to tell the
>>>>>>>> OS that oh, hey, there is this new PCI device with this BDF.
>>>>>>>>
>>>>>>>> Or the underlaying bus on ARM can send some 'new device' information?
>>>>>>>
>>>>>>> Hm, is this something standard between all the SR-IOV implementations, or each
>>>>>>> vendors have their own sauce?
>>>>>>
>>>>>> Gosh, all of them have their own sauce. The only thing that is the same
>>>>>> is that suddenly behind the PF device there are PCI devies that are responding
>>>>>> to 0xcfc requests. MAgic!
>>>>>
>>>>> I'm reading the PCI SR-IOV 1.1 spec, and I think we don't need to wait for the
>>>>> device driver in Dom0 in order to get the information of the VF devices, what
>>>>> Xen cares about is the position of the BARs (so that they can be mapped into
>>>>> Dom0 at boot), and the PCI SBDF of each PF/VF, so that Xen can trap accesses to
>>>>> it.
>>>>>
>>>>> AFAICT both of this can be obtained without any driver-specific code, since
>>>>> it's all contained in the PCI SR-IOV spec (but maybe I'm missing something).
>>>>
>>>> CC-ing Venu,
>>>>
>>>> Roger, could you point out which of the chapters has this?
>>>
>>> This would be chapter 2 ("Initialization and Resource Allocation"), and then
>>> there's a "IMPLEMENTATION NOTE" that shows how the PF/VF are matched to
>>> function numbers in page 45 (I have the following copy, which is the latest
>>> revision: "Single Root I/O Virtualization and Sharing Specification Revision
>>> 1.1" from January 20 2010 [0]).
>>>
>>> The document is quite complex, but it is a standard that all SR-IOV devices
>>> should follow so AFAICT Xen should be able to get all the information that it
>>> needs from the PCI config space in order to detect the PF/VF BARs and the BDF
>>> device addresses.
>>>
>>> Roger.
>>>
>>> [0] https://members.pcisig.com/wg/PCI-SIG/document/download/8238
>>
>> I do not have access to this document, so I have to rely on Rev 1.0
>> document, but I don't think this aspect of the spec changed much.
>>
>> In any case, I am afraid I am not seeing the overall picture, but I
>> would like to comment on the last part of this discussion. Indeed, the
>> configuration space (including the SR-IOV extended capability) contains
>> all the information, but only the information necessary for the OS to
>> "enumerate" the device (PF as well as VFs). The bus and device number
>> (SBDF) assignment, and programming of the BARs, are all done during that
>> enumeration. In this discussion, which entity is doing the enumeration?
>> Xen, or Dom0?
>
> Xen needs to let Dom0 manage the device, but at the same time it needs to
> correctly map the device BARs into Dom0 physmap. I think the easiest solution
> is to let Dom0 manage the device, and Xen should setup a trap to detect Dom0
> setting the VF Enable bit (bit 0 in SR-IOV Control (08h)), at which point Xen
> will size the VF BARs (and map them into Dom0) and also enumerate the VF
> devices.

Why not using the existing hypercall? This would avoid to duplicate 
enumerating VF devices in Xen as DOM0 will exactly do the same.

I thought a bit more about the PHYSDEVOP_pci_device_add hypercall. I 
think it would be better to keep them around for ARM because we may 
still want to keep DOM0 in the loop.

For instance some PCI hostbridge might be very complex to implement in 
Xen because of the dependencies with other components (clock, power 
domain, MSI controller)... So it may make sense to keep all those 
hostbridges in Linux and having Xen config space access going through Linux.

For "simple" hostbridges (the distinction has to be defined), Xen will 
support them directly and will be able to drive them.

An hybrid approach, would allow us to get support of all the hostbridges 
without having to port all the hostbridges in Xen (and there are quite a 
lot on ARM).

Cheers,

-- 
Julien Grall

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

  parent reply	other threads:[~2017-05-03 12:53 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-29 14:04 [early RFC] ARM PCI Passthrough design document Julien Grall
2016-12-29 14:16 ` Jaggi, Manish
2016-12-29 17:03   ` Julien Grall
2016-12-29 18:41     ` Jaggi, Manish
2016-12-29 19:38       ` Julien Grall
2017-01-04  0:24 ` Stefano Stabellini
2017-01-24 14:28   ` Julien Grall
2017-01-24 20:07     ` Stefano Stabellini
2017-01-25 11:21       ` Roger Pau Monné
2017-01-25 18:53       ` Julien Grall
2017-01-31 16:53         ` Edgar E. Iglesias
2017-01-31 17:09           ` Julien Grall
2017-01-31 19:06             ` Edgar E. Iglesias
2017-01-31 22:08               ` Stefano Stabellini
2017-02-01 19:04               ` Julien Grall
2017-02-01 19:31                 ` Stefano Stabellini
2017-02-01 20:24                   ` Julien Grall
2017-02-02 15:33                 ` Edgar E. Iglesias
2017-02-02 23:12                   ` Stefano Stabellini
2017-02-02 23:44                     ` Edgar E. Iglesias
2017-02-10  1:01                       ` Stefano Stabellini
2017-02-13 15:39                         ` Julien Grall
2017-02-13 19:59                           ` Stefano Stabellini
2017-02-14 17:21                             ` Julien Grall
2017-02-14 18:20                               ` Stefano Stabellini
2017-02-14 20:18                                 ` Julien Grall
2017-02-13 15:35                   ` Julien Grall
2017-02-22  4:03                     ` Edgar E. Iglesias
2017-02-23 16:47                       ` Julien Grall
2017-03-02 21:13                         ` Edgar E. Iglesias
2017-02-02 15:40                 ` Roger Pau Monné
2017-02-13 16:22                   ` Julien Grall
2017-01-31 21:58         ` Stefano Stabellini
2017-02-01 20:12           ` Julien Grall
2017-02-01 10:55         ` Roger Pau Monné
2017-02-01 18:50           ` Stefano Stabellini
2017-02-10  9:48             ` Roger Pau Monné
2017-02-10 10:11               ` Paul Durrant
2017-02-10 12:57                 ` Roger Pau Monne
2017-02-10 13:02                   ` Paul Durrant
2017-02-10 21:04                     ` Stefano Stabellini
2017-02-02 12:38           ` Julien Grall
2017-02-02 23:06             ` Stefano Stabellini
2017-03-08 19:06               ` Julien Grall
2017-03-08 19:12                 ` Konrad Rzeszutek Wilk
2017-03-08 19:55                   ` Stefano Stabellini
2017-03-08 21:51                     ` Julien Grall
2017-03-09  2:59                   ` Roger Pau Monné
2017-03-09 11:17                     ` Konrad Rzeszutek Wilk
2017-03-09 13:26                       ` Julien Grall
2017-03-10  0:29                         ` Konrad Rzeszutek Wilk
2017-03-10  3:23                           ` Roger Pau Monné
2017-03-10 15:28                             ` Konrad Rzeszutek Wilk
2017-03-15 12:07                               ` Roger Pau Monné
2017-03-15 12:42                                 ` Konrad Rzeszutek Wilk
2017-03-15 12:56                                   ` Roger Pau Monné
2017-03-15 15:11                                     ` Venu Busireddy
2017-03-15 16:38                                       ` Roger Pau Monn?
2017-03-15 16:54                                         ` Venu Busireddy
2017-03-15 17:00                                           ` Roger Pau Monn?
2017-05-03 12:38                                             ` Julien Grall
2017-05-03 12:53                                         ` Julien Grall [this message]
2017-01-25  4:23     ` Manish Jaggi
2017-01-06 15:12 ` Roger Pau Monné
2017-01-06 21:16   ` Stefano Stabellini
2017-01-24 17:17   ` Julien Grall
2017-01-25 11:42     ` Roger Pau Monné
2017-01-31 15:59       ` Julien Grall
2017-01-31 22:03         ` Stefano Stabellini
2017-02-01 10:28           ` Roger Pau Monné
2017-02-01 18:45             ` Stefano Stabellini
2017-01-06 16:27 ` Edgar E. Iglesias
2017-01-06 21:12   ` Stefano Stabellini
2017-01-09 17:50     ` Edgar E. Iglesias
2017-01-19  5:09 ` Manish Jaggi
2017-01-24 17:43   ` Julien Grall
2017-01-25  4:37     ` Manish Jaggi
2017-01-25 15:25       ` Julien Grall
2017-01-30  7:41         ` Manish Jaggi
2017-01-31 13:33           ` Julien Grall
2017-05-19  6:38 ` Goel, Sameer
2017-05-19 16:48   ` 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=17715965-df17-363b-f726-2fd6fe95af09@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Steve.Capper@arm.com \
    --cc=Wei.Chen@arm.com \
    --cc=alistair.francis@xilinx.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anjiandi@codeaurora.org \
    --cc=edgar.iglesias@xilinx.com \
    --cc=manish.jaggi@caviumnetworks.com \
    --cc=punit.agrawal@arm.com \
    --cc=roger.pau@citrix.com \
    --cc=scampbel@codeaurora.org \
    --cc=shankerd@codeaurora.org \
    --cc=sstabellini@kernel.org \
    --cc=venu.busireddy@oracle.com \
    --cc=xen-devel@lists.xenproject.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.