Re: [Xen-devel] [PATCH v3 5/6] xen/arm: introduce nr_spis

2019-08-19 Thread Stefano Stabellini
On Fri, 9 Aug 2019, Julien Grall wrote:
> Hi Stefano,
> 
> On 8/9/19 12:12 AM, Stefano Stabellini wrote:
> > We don't have a clear way to know how many virtual SPIs we need for the
> > boot domains. Introduce a new option under xen,domain to specify the
> > number of SPIs to allocate for the domain.
> > 
> > The property is optional, when absent, we'll use the physical number of
> > gic lines for dom0less domains, just like for dom0. Given that dom0less
> > VMs are meant for static partitioning scenarios where the number of VMs
> > is very low, increased memory overhead should not be a problem, and it
> > is possible to minimizing it by using "nr_spis".
> > 
> > Signed-off-by: Stefano Stabellini 
> > ---
> > Changes in v3:
> > - improve commit message
> > - introduce nr_spis
> > ---
> >   xen/arch/arm/domain_build.c | 7 +++
> >   1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> > index 0057a509d1..fc4e5bc4ca 100644
> > --- a/xen/arch/arm/domain_build.c
> > +++ b/xen/arch/arm/domain_build.c
> > @@ -2270,7 +2270,6 @@ void __init create_domUs(void)
> >   struct domain *d;
> >   struct xen_domctl_createdomain d_cfg = {
> >   .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE,
> > -.arch.nr_spis = 0,
> >   .flags = XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap,
> >   .max_evtchn_port = -1,
> >   .max_grant_frames = 64,
> > @@ -2280,13 +2279,13 @@ void __init create_domUs(void)
> >   if ( !dt_device_is_compatible(node, "xen,domain") )
> >   continue;
> >   -if ( dt_property_read_bool(node, "vpl011") )
> > -d_cfg.arch.nr_spis = GUEST_VPL011_SPI - 32 + 1;
> > -
> 
> This change is not specified in the commit message nor the documentation.

I'll add a reference in the commit message.


> This will likely lead to some issues if the number of SPIs programmed (either
> from the DT or the Hardware) is smaller than the the SPI here.
> 
> Furthemore, it is important to write down in the documentation that the SPI
> used by vpl011 may clash with a device interrupt routed to the guest.

Good points, I'll add those info to the docs.


> >   if ( !dt_property_read_u32(node, "cpus", _cfg.max_vcpus) )
> >   panic("Missing property 'cpus' for domain %s\n",
> > dt_node_name(node));
> >   +if ( !dt_property_read_u32(node, "nr_spis", _cfg.arch.nr_spis)
> > )
> > +d_cfg.arch.nr_spis = gic_number_lines() - 32;
> > +
> >   d = domain_create(++max_init_domid, _cfg, false);
> >   if ( IS_ERR(d) )
> >   panic("Error creating domain %s\n", dt_node_name(node));
> > 
> 
> Cheers,
> 
> -- 
> Julien Grall
> 

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v3 5/6] xen/arm: introduce nr_spis

2019-08-09 Thread Julien Grall

Hi Stefano,

On 8/9/19 12:12 AM, Stefano Stabellini wrote:

We don't have a clear way to know how many virtual SPIs we need for the
boot domains. Introduce a new option under xen,domain to specify the
number of SPIs to allocate for the domain.

The property is optional, when absent, we'll use the physical number of
gic lines for dom0less domains, just like for dom0. Given that dom0less
VMs are meant for static partitioning scenarios where the number of VMs
is very low, increased memory overhead should not be a problem, and it
is possible to minimizing it by using "nr_spis".

Signed-off-by: Stefano Stabellini 
---
Changes in v3:
- improve commit message
- introduce nr_spis
---
  xen/arch/arm/domain_build.c | 7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 0057a509d1..fc4e5bc4ca 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2270,7 +2270,6 @@ void __init create_domUs(void)
  struct domain *d;
  struct xen_domctl_createdomain d_cfg = {
  .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE,
-.arch.nr_spis = 0,
  .flags = XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap,
  .max_evtchn_port = -1,
  .max_grant_frames = 64,
@@ -2280,13 +2279,13 @@ void __init create_domUs(void)
  if ( !dt_device_is_compatible(node, "xen,domain") )
  continue;
  
-if ( dt_property_read_bool(node, "vpl011") )

-d_cfg.arch.nr_spis = GUEST_VPL011_SPI - 32 + 1;
-


This change is not specified in the commit message nor the documentation.

This will likely lead to some issues if the number of SPIs programmed 
(either from the DT or the Hardware) is smaller than the the SPI here.


Furthemore, it is important to write down in the documentation that the 
SPI used by vpl011 may clash with a device interrupt routed to the guest.



  if ( !dt_property_read_u32(node, "cpus", _cfg.max_vcpus) )
  panic("Missing property 'cpus' for domain %s\n",
dt_node_name(node));
  
+if ( !dt_property_read_u32(node, "nr_spis", _cfg.arch.nr_spis) )

+d_cfg.arch.nr_spis = gic_number_lines() - 32;
+
  d = domain_create(++max_init_domid, _cfg, false);
  if ( IS_ERR(d) )
  panic("Error creating domain %s\n", dt_node_name(node));



Cheers,

--
Julien Grall

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v3 5/6] xen/arm: introduce nr_spis

2019-08-09 Thread Volodymyr Babchuk

Stefano,

Stefano Stabellini writes:

> We don't have a clear way to know how many virtual SPIs we need for the
> boot domains. Introduce a new option under xen,domain to specify the
> number of SPIs to allocate for the domain.
>
> The property is optional, when absent, we'll use the physical number of
> gic lines for dom0less domains, just like for dom0. Given that dom0less
> VMs are meant for static partitioning scenarios where the number of VMs
> is very low, increased memory overhead should not be a problem, and it
> is possible to minimizing it by using "nr_spis".
>
> Signed-off-by: Stefano Stabellini 
Reviewed-by: Volodymyr Babchuk 

> ---
> Changes in v3:
> - improve commit message
> - introduce nr_spis
> ---
>  xen/arch/arm/domain_build.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 0057a509d1..fc4e5bc4ca 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -2270,7 +2270,6 @@ void __init create_domUs(void)
>  struct domain *d;
>  struct xen_domctl_createdomain d_cfg = {
>  .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE,
> -.arch.nr_spis = 0,
>  .flags = XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap,
>  .max_evtchn_port = -1,
>  .max_grant_frames = 64,
> @@ -2280,13 +2279,13 @@ void __init create_domUs(void)
>  if ( !dt_device_is_compatible(node, "xen,domain") )
>  continue;
>  
> -if ( dt_property_read_bool(node, "vpl011") )
> -d_cfg.arch.nr_spis = GUEST_VPL011_SPI - 32 + 1;
> -
>  if ( !dt_property_read_u32(node, "cpus", _cfg.max_vcpus) )
>  panic("Missing property 'cpus' for domain %s\n",
>dt_node_name(node));
>  
> +if ( !dt_property_read_u32(node, "nr_spis", _cfg.arch.nr_spis) )
> +d_cfg.arch.nr_spis = gic_number_lines() - 32;
> +
>  d = domain_create(++max_init_domid, _cfg, false);
>  if ( IS_ERR(d) )
>  panic("Error creating domain %s\n", dt_node_name(node));


-- 
Volodymyr Babchuk at EPAM
___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH v3 5/6] xen/arm: introduce nr_spis

2019-08-08 Thread Stefano Stabellini
We don't have a clear way to know how many virtual SPIs we need for the
boot domains. Introduce a new option under xen,domain to specify the
number of SPIs to allocate for the domain.

The property is optional, when absent, we'll use the physical number of
gic lines for dom0less domains, just like for dom0. Given that dom0less
VMs are meant for static partitioning scenarios where the number of VMs
is very low, increased memory overhead should not be a problem, and it
is possible to minimizing it by using "nr_spis".

Signed-off-by: Stefano Stabellini 
---
Changes in v3:
- improve commit message
- introduce nr_spis
---
 xen/arch/arm/domain_build.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 0057a509d1..fc4e5bc4ca 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2270,7 +2270,6 @@ void __init create_domUs(void)
 struct domain *d;
 struct xen_domctl_createdomain d_cfg = {
 .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE,
-.arch.nr_spis = 0,
 .flags = XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap,
 .max_evtchn_port = -1,
 .max_grant_frames = 64,
@@ -2280,13 +2279,13 @@ void __init create_domUs(void)
 if ( !dt_device_is_compatible(node, "xen,domain") )
 continue;
 
-if ( dt_property_read_bool(node, "vpl011") )
-d_cfg.arch.nr_spis = GUEST_VPL011_SPI - 32 + 1;
-
 if ( !dt_property_read_u32(node, "cpus", _cfg.max_vcpus) )
 panic("Missing property 'cpus' for domain %s\n",
   dt_node_name(node));
 
+if ( !dt_property_read_u32(node, "nr_spis", _cfg.arch.nr_spis) )
+d_cfg.arch.nr_spis = gic_number_lines() - 32;
+
 d = domain_create(++max_init_domid, _cfg, false);
 if ( IS_ERR(d) )
 panic("Error creating domain %s\n", dt_node_name(node));
-- 
2.17.1


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel