[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] xen/arm: introduce nr_spis



commit 2a6f8cfb126a1b4ec3d0df8fbe32653cb3cbcb89
Author:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
AuthorDate: Thu Oct 3 10:34:15 2019 -0700
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Fri Oct 4 10:16:11 2019 -0700

    xen/arm: introduce nr_spis
    
    We don't have a clear way to know how many virtual SPIs we need for the
    dom0-less domains. Introduce a new option under xen,domain to specify
    the number of SPIs to allocate for a domain.
    
    The property is optional. When absent, we'll use the physical number of
    GIC lines for dom0-less domains, or GUEST_VPL011_SPI+1 if vpl011 is
    requested, whichever is greater.
    
    Remove the old setting of nr_spis based on the presence of the vpl011.
    
    The implication of this change is that without nr_spis dom0less domains
    get the same amount of SPI allocated as dom0, regardless of how many
    physical devices they have assigned, and regardless of whether they have
    a virtual pl011 (which also needs an emulated SPI). This is done because
    the SPIs allocation needs to be done before parsing any passthrough
    information, so we have to account for any potential physical SPI
    assigned to the domain.
    
    When nr_spis is present, the domain gets exactly nr_spis allocated SPIs.
    If the number is too low, it might not be enough for the devices
    assigned it to it. If the number is less than GUEST_VPL011_SPI, the
    virtual pl011 won't work.
    
    Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
    Acked-by: Julien Grall <julien.grall@xxxxxxx>
---
 xen/arch/arm/domain_build.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 8cf3309784..921b054520 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2408,7 +2408,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 | XEN_DOMCTL_CDF_hap,
             .max_evtchn_port = -1,
             .max_grant_frames = 64,
@@ -2418,9 +2417,6 @@ 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", &d_cfg.max_vcpus) )
             panic("Missing property 'cpus' for domain %s\n",
                   dt_node_name(node));
@@ -2428,6 +2424,19 @@ void __init create_domUs(void)
         if ( dt_find_compatible_node(node, NULL, "multiboot,device-tree") )
             d_cfg.flags |= XEN_DOMCTL_CDF_iommu;
 
+        if ( !dt_property_read_u32(node, "nr_spis", &d_cfg.arch.nr_spis) )
+        {
+            d_cfg.arch.nr_spis = gic_number_lines() - 32;
+
+            /*
+             * vpl011 uses one emulated SPI. If vpl011 is requested, make
+             * sure that we allocate enough SPIs for it.
+             */
+            if ( dt_property_read_bool(node, "vpl011") )
+                d_cfg.arch.nr_spis = MAX(d_cfg.arch.nr_spis,
+                                         GUEST_VPL011_SPI - 32 + 1);
+        }
+
         d = domain_create(++max_init_domid, &d_cfg, false);
         if ( IS_ERR(d) )
             panic("Error creating domain %s\n", dt_node_name(node));
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.