diff mbox

[Xen-devel,v2,19/21] xen/arm: Reserve region in guest memory for device passthrough

Message ID 1406818852-31856-20-git-send-email-julien.grall@linaro.org
State Superseded, archived
Headers show

Commit Message

Julien Grall July 31, 2014, 3 p.m. UTC
This region will be split by the toolstack to allocate MMIO range for eac
device.

For now only reserve a 768MB region, this should be enought to passthrough
multiple device at the same time.

Signed-off-by: Julien Grall <julien.grall@linaro.org>

---

I can't allocate easily a range of 1GB in the current layout without shrink
the first RAM bank. So I decided to use only 768MB. If in the future we need
more, then we will have to choose at runtime the guest layout.

    Changes in v2:
        - Bump the reserved region from 512MB to 768MB
---
 xen/include/public/arch-arm.h |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Stefano Stabellini Aug. 6, 2014, 4:27 p.m. UTC | #1
On Thu, 31 Jul 2014, Julien Grall wrote:
> This region will be split by the toolstack to allocate MMIO range for eac
> device.
> 
> For now only reserve a 768MB region, this should be enought to passthrough
> multiple device at the same time.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> 
> ---
> 
> I can't allocate easily a range of 1GB in the current layout without shrink
> the first RAM bank. So I decided to use only 768MB. If in the future we need
> more, then we will have to choose at runtime the guest layout.
> 
>     Changes in v2:
>         - Bump the reserved region from 512MB to 768MB


Better than nothing.
Would it be possible to add a second region > 4GB? Maybe after RAM?
How hard would be to handle that?


>  xen/include/public/arch-arm.h |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index ac54cd6..cebb349 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -369,6 +369,10 @@ typedef uint64_t xen_callback_t;
>  #define GUEST_GICC_BASE   0x03002000ULL
>  #define GUEST_GICC_SIZE   0x00000100ULL
>  
> +/* Space for mapping MMIO from device passthrough: 768MB @ 256MB*/
> +#define GUEST_MMIO_BASE   0x10000000ULL
> +#define GUEST_MMIO_SIZE   0x30000000ULL
> +
>  /* 16MB == 4096 pages reserved for guest to use as a region to map its
>   * grant table in.
>   */
> -- 
> 1.7.10.4
>
Julien Grall Aug. 6, 2014, 4:33 p.m. UTC | #2
Hi Stefano,

On 08/06/2014 05:27 PM, Stefano Stabellini wrote:
> On Thu, 31 Jul 2014, Julien Grall wrote:
>> This region will be split by the toolstack to allocate MMIO range for eac
>> device.
>>
>> For now only reserve a 768MB region, this should be enought to passthrough
>> multiple device at the same time.
>>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>>
>> ---
>>
>> I can't allocate easily a range of 1GB in the current layout without shrink
>> the first RAM bank. So I decided to use only 768MB. If in the future we need
>> more, then we will have to choose at runtime the guest layout.
>>
>>     Changes in v2:
>>         - Bump the reserved region from 512MB to 768MB
> 
> 
> Better than nothing.
> Would it be possible to add a second region > 4GB? Maybe after RAM?
> How hard would be to handle that?

It won't work if the guest is using short-descriptor translation table
format because only 32 bits address will be supported.

Regards,
Stefano Stabellini Aug. 6, 2014, 4:44 p.m. UTC | #3
On Wed, 6 Aug 2014, Julien Grall wrote:
> Hi Stefano,
> 
> On 08/06/2014 05:27 PM, Stefano Stabellini wrote:
> > On Thu, 31 Jul 2014, Julien Grall wrote:
> >> This region will be split by the toolstack to allocate MMIO range for eac
> >> device.
> >>
> >> For now only reserve a 768MB region, this should be enought to passthrough
> >> multiple device at the same time.
> >>
> >> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> >>
> >> ---
> >>
> >> I can't allocate easily a range of 1GB in the current layout without shrink
> >> the first RAM bank. So I decided to use only 768MB. If in the future we need
> >> more, then we will have to choose at runtime the guest layout.
> >>
> >>     Changes in v2:
> >>         - Bump the reserved region from 512MB to 768MB
> > 
> > 
> > Better than nothing.
> > Would it be possible to add a second region > 4GB? Maybe after RAM?
> > How hard would be to handle that?
> 
> It won't work if the guest is using short-descriptor translation table
> format because only 32 bits address will be supported.

I know.
Stefano Stabellini Aug. 6, 2014, 4:45 p.m. UTC | #4
On Wed, 6 Aug 2014, Stefano Stabellini wrote:
> On Wed, 6 Aug 2014, Julien Grall wrote:
> > Hi Stefano,
> > 
> > On 08/06/2014 05:27 PM, Stefano Stabellini wrote:
> > > On Thu, 31 Jul 2014, Julien Grall wrote:
> > >> This region will be split by the toolstack to allocate MMIO range for eac
> > >> device.
> > >>
> > >> For now only reserve a 768MB region, this should be enought to passthrough
> > >> multiple device at the same time.
> > >>
> > >> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> > >>
> > >> ---
> > >>
> > >> I can't allocate easily a range of 1GB in the current layout without shrink
> > >> the first RAM bank. So I decided to use only 768MB. If in the future we need
> > >> more, then we will have to choose at runtime the guest layout.
> > >>
> > >>     Changes in v2:
> > >>         - Bump the reserved region from 512MB to 768MB
> > > 
> > > 
> > > Better than nothing.
> > > Would it be possible to add a second region > 4GB? Maybe after RAM?
> > > How hard would be to handle that?
> > 
> > It won't work if the guest is using short-descriptor translation table
> > format because only 32 bits address will be supported.
> 
> I know.

However it would make things easier if you want to assign a device with
a large MMIO region to a guest that can handle it.
Julien Grall Aug. 6, 2014, 4:47 p.m. UTC | #5
On 08/06/2014 05:44 PM, Stefano Stabellini wrote:
> On Wed, 6 Aug 2014, Julien Grall wrote:
>> Hi Stefano,
>>
>> On 08/06/2014 05:27 PM, Stefano Stabellini wrote:
>>> On Thu, 31 Jul 2014, Julien Grall wrote:
>>>> This region will be split by the toolstack to allocate MMIO range for eac
>>>> device.
>>>>
>>>> For now only reserve a 768MB region, this should be enought to passthrough
>>>> multiple device at the same time.
>>>>
>>>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>>>>
>>>> ---
>>>>
>>>> I can't allocate easily a range of 1GB in the current layout without shrink
>>>> the first RAM bank. So I decided to use only 768MB. If in the future we need
>>>> more, then we will have to choose at runtime the guest layout.
>>>>
>>>>     Changes in v2:
>>>>         - Bump the reserved region from 512MB to 768MB
>>>
>>>
>>> Better than nothing.
>>> Would it be possible to add a second region > 4GB? Maybe after RAM?
>>> How hard would be to handle that?
>>
>> It won't work if the guest is using short-descriptor translation table
>> format because only 32 bits address will be supported.
> 
> I know.

I don't plan to handle another region for this series. If someone come
with a real use case, then I will think about it.

Regards,
Julien Grall Aug. 6, 2014, 4:55 p.m. UTC | #6
On 08/06/2014 05:45 PM, Stefano Stabellini wrote:
> On Wed, 6 Aug 2014, Stefano Stabellini wrote:
>> On Wed, 6 Aug 2014, Julien Grall wrote:
>>> Hi Stefano,
>>>
>>> On 08/06/2014 05:27 PM, Stefano Stabellini wrote:
>>>> On Thu, 31 Jul 2014, Julien Grall wrote:
>>>>> This region will be split by the toolstack to allocate MMIO range for eac
>>>>> device.
>>>>>
>>>>> For now only reserve a 768MB region, this should be enought to passthrough
>>>>> multiple device at the same time.
>>>>>
>>>>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>>>>>
>>>>> ---
>>>>>
>>>>> I can't allocate easily a range of 1GB in the current layout without shrink
>>>>> the first RAM bank. So I decided to use only 768MB. If in the future we need
>>>>> more, then we will have to choose at runtime the guest layout.
>>>>>
>>>>>     Changes in v2:
>>>>>         - Bump the reserved region from 512MB to 768MB
>>>>
>>>>
>>>> Better than nothing.
>>>> Would it be possible to add a second region > 4GB? Maybe after RAM?
>>>> How hard would be to handle that?
>>>
>>> It won't work if the guest is using short-descriptor translation table
>>> format because only 32 bits address will be supported.
>>
>> I know.
> 
> However it would make things easier if you want to assign a device with
> a large MMIO region to a guest that can handle it.

Last time you told me about graphics card. But we don't have any board
with graphic card and IOMMU supported by Xen.
In any case the developer will have to modify Xen to add the new
platform. It won't hurt to add a new region at this time.

Regards,
Stefano Stabellini Aug. 6, 2014, 4:57 p.m. UTC | #7
On Wed, 6 Aug 2014, Julien Grall wrote:
> On 08/06/2014 05:45 PM, Stefano Stabellini wrote:
> > On Wed, 6 Aug 2014, Stefano Stabellini wrote:
> >> On Wed, 6 Aug 2014, Julien Grall wrote:
> >>> Hi Stefano,
> >>>
> >>> On 08/06/2014 05:27 PM, Stefano Stabellini wrote:
> >>>> On Thu, 31 Jul 2014, Julien Grall wrote:
> >>>>> This region will be split by the toolstack to allocate MMIO range for eac
> >>>>> device.
> >>>>>
> >>>>> For now only reserve a 768MB region, this should be enought to passthrough
> >>>>> multiple device at the same time.
> >>>>>
> >>>>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> >>>>>
> >>>>> ---
> >>>>>
> >>>>> I can't allocate easily a range of 1GB in the current layout without shrink
> >>>>> the first RAM bank. So I decided to use only 768MB. If in the future we need
> >>>>> more, then we will have to choose at runtime the guest layout.
> >>>>>
> >>>>>     Changes in v2:
> >>>>>         - Bump the reserved region from 512MB to 768MB
> >>>>
> >>>>
> >>>> Better than nothing.
> >>>> Would it be possible to add a second region > 4GB? Maybe after RAM?
> >>>> How hard would be to handle that?
> >>>
> >>> It won't work if the guest is using short-descriptor translation table
> >>> format because only 32 bits address will be supported.
> >>
> >> I know.
> > 
> > However it would make things easier if you want to assign a device with
> > a large MMIO region to a guest that can handle it.
> 
> Last time you told me about graphics card. But we don't have any board
> with graphic card and IOMMU supported by Xen.
> In any case the developer will have to modify Xen to add the new
> platform. It won't hurt to add a new region at this time.

I understand your concerns and in theory you are right, but in practice
it would be much easier to add it now than then. The new guy won't know
anything about device passthrough and libxl. While at the moment it is
all still new and fresh in our minds.
diff mbox

Patch

diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index ac54cd6..cebb349 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -369,6 +369,10 @@  typedef uint64_t xen_callback_t;
 #define GUEST_GICC_BASE   0x03002000ULL
 #define GUEST_GICC_SIZE   0x00000100ULL
 
+/* Space for mapping MMIO from device passthrough: 768MB @ 256MB*/
+#define GUEST_MMIO_BASE   0x10000000ULL
+#define GUEST_MMIO_SIZE   0x30000000ULL
+
 /* 16MB == 4096 pages reserved for guest to use as a region to map its
  * grant table in.
  */