xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: "Edgar Iglesias (edgar.iglesias@xilinx.com)"
	<edgar.iglesias@xilinx.com>, "Wei Chen" <Wei.Chen@arm.com>,
	"Campbell Sean" <scampbel@codeaurora.org>,
	"Jiandi An" <anjiandi@codeaurora.org>,
	"Punit Agrawal" <punit.agrawal@arm.com>,
	alistair.francis@xilinx.com,
	xen-devel <xen-devel@lists.xenproject.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"manish.jaggi@caviumnetworks.com"
	<manish.jaggi@caviumnetworks.com>,
	"Shanker Donthineni" <shankerd@codeaurora.org>,
	"Steve Capper" <Steve.Capper@arm.com>
Subject: Re: [early RFC] ARM PCI Passthrough design document
Date: Tue, 24 Jan 2017 14:28:33 +0000	[thread overview]
Message-ID: <56a2cd48-f7cf-25ca-2bfe-cabf02d34df3@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1701031541510.17742@sstabellini-ThinkPad-X260>

Hi Stefano,

On 04/01/17 00:24, Stefano Stabellini wrote:
> On Thu, 29 Dec 2016, Julien Grall wrote:

[...]

>> # Introduction
>>
>> PCI passthrough allows to give control of physical PCI devices to guest. This
>> means that the guest will have full and direct access to the PCI device.
>>
>> ARM is supporting one kind of guest that is exploiting as much as possible
>> virtualization support in hardware. The guest will rely on PV driver only
>> for IO (e.g block, network), interrupts will come through the virtualized
>> interrupt controller. This means that there are no big changes required
>> within the kernel.
>>
>> By consequence, it would be possible to replace PV drivers by assigning real
>   ^ As a consequence

I will fix all the typoes in the next version.

>
>
>> devices to the guest for I/O access. Xen on ARM would therefore be able to
>> run unmodified operating system.

[...]

>> Instantiation of a specific driver for the host controller can be easily done
>> if Xen has the information to detect it. However, those drivers may require
>> resources described in ASL (see [4] for instance).
>>
>> XXX: Need more investigation to know whether the missing information should
>> be passed by DOM0 or hardcoded in the driver.
>
> Given that we are talking about quirks here, it would be better to just
> hardcode them in the drivers, if possible.

Indeed hardcoded would be the preferred way to avoid introduce new 
hypercall for quirk.

For instance, in the case of Thunder-X (see commit 44f22bd "PCI: Add 
MCFG quirks for Cavium ThunderX pass2.x host controller) some region are 
read from ACPI. What I'd like to understand is whether this could be 
hardcoded or can it change between platform? If it can change, is there 
a way in ACPI to differentiate 2 platforms?

Maybe this is a question that Cavium can answer? (in CC).


[...]

>> ## Discovering and register hostbridge
>>
>> Both ACPI and Device Tree do not provide enough information to fully
>> instantiate an host bridge driver. In the case of ACPI, some data may come
>> from ASL,
>
> The data available from ASL is just to initialize quirks and non-ECAM
> controllers, right? Given that SBSA mandates ECAM, and we assume that
> ACPI is mostly (if not only) for servers, then I think it is safe to say
> that in the case of ACPI we should have all the info to fully
> instantiate an host bridge driver.

 From the spec, the MCFG will only describe host bridge available at 
boot (see 4.2 in "PCI firmware specification, rev 3.2"). All the other 
host bridges will be described in ASL.

So we need DOM0 to feed Xen about the latter host bridges.

>
>
>> whilst for Device Tree the segment number is not available.
>>
>> So Xen needs to rely on DOM0 to discover the host bridges and notify Xen
>> with all the relevant informations. This will be done via a new hypercall
>> PHYSDEVOP_pci_host_bridge_add. The layout of the structure will be:
>
> I understand that the main purpose of this hypercall is to get Xen and Dom0 to
> agree on the segment numbers, but why is it necessary? If Dom0 has an
> emulated contoller like any other guest, do we care what segment numbers
> Dom0 will use?

I was not planning to have a emulated controller for DOM0. The physical 
one is not necessarily ECAM compliant so we would have to either emulate 
the physical one (meaning multiple different emulation) or an ECAM 
compliant.

The latter is not possible because you don't know if there is enough 
free MMIO space for the emulation.

In the case on ARM, I don't see much the point to emulate the host 
bridge for DOM0. The only thing we need in Xen is to access the 
configuration space, we don't have about driving the host bridge. So I 
would let DOM0 dealing with that.

Also, I don't see any reason for ARM to trap DOM0 configuration space 
access. The MSI will be configured using the interrupt controller and it 
is a trusted Domain.

>
>
>> struct physdev_pci_host_bridge_add
>> {
>>     /* IN */
>>     uint16_t seg;
>>     /* Range of bus supported by the host bridge */
>>     uint8_t  bus_start;
>>     uint8_t  bus_nr;
>>     uint32_t res0;  /* Padding */
>>     /* Information about the configuration space region */
>>     uint64_t cfg_base;
>>     uint64_t cfg_size;
>> }
>>
>> DOM0 will issue the hypercall PHYSDEVOP_pci_host_bridge_add for each host
>> bridge available on the platform. When Xen is receiving the hypercall, the
>> the driver associated to the host bridge will be instantiated.
>
> I think we should mention the relationship with the existing
> PHYSDEVOP_pci_mmcfg_reserved hypercall.

Sorry, I did not spot this hypercall until now. From a brief look, this 
hypercall would be redundant, but I will investigate a bit more.

>
>
>> XXX: Shall we limit DOM0 the access to the configuration space from that
>> moment?
>
> If we can, we should

Why would be the benefits? For now, I see a big drawback: resetting a 
PCI devices would need to be done in Xen rather than DOM0. As you may 
now there are a lot of quirks for reset.

So for me, it looks more sensible to handle this in DOM0 and let DOM0 a 
full access to the configuration space. Overall he is a trusted domain.

Regards,

-- 
Julien Grall

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

  reply	other threads:[~2017-01-24 14:28 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 [this message]
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
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=56a2cd48-f7cf-25ca-2bfe-cabf02d34df3@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Steve.Capper@arm.com \
    --cc=Wei.Chen@arm.com \
    --cc=alistair.francis@xilinx.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=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 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).