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

[Xen-changelog] [xen staging-4.10] xen/arm: vgic-v3: Delay the initialization of the domain information



commit 278e9f511e97de734668a7190138eebe05834ffe
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Mon Oct 1 17:42:26 2018 +0100
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Fri Jan 25 17:22:16 2019 -0800

    xen/arm: vgic-v3: Delay the initialization of the domain information
    
    A follow-up patch will require to know the number of vCPUs when
    initializating the vGICv3 domain structure. However this information is
    not available at domain creation. This is only known once
    XEN_DOMCTL_max_vpus is called for that domain.
    
    In order to get the max vCPUs around, delay the domain part of the vGIC
    v3 initialization until the first vCPU of the domain is initialized.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@xxxxxxxxxx>
    Acked-but-disliked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    (cherry picked from commit 703d9d5ec13a0f487e7415174ba54e0e3ca158db)
    (cherry picked from commit 015b00ff3581d5f83cbc0ea96ebdc3900f12053e)
---
 xen/arch/arm/vgic-v3.c | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index af16dfd005..6a30b4a8fc 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -1585,9 +1585,11 @@ static const struct mmio_handler_ops 
vgic_distr_mmio_handler = {
     .write = vgic_v3_distr_mmio_write,
 };
 
+static int vgic_v3_real_domain_init(struct domain *d);
+
 static int vgic_v3_vcpu_init(struct vcpu *v)
 {
-    int i;
+    int i, rc;
     paddr_t rdist_base;
     struct vgic_rdist_region *region;
     unsigned int last_cpu;
@@ -1597,6 +1599,19 @@ static int vgic_v3_vcpu_init(struct vcpu *v)
     uint32_t rdist_stride = d->arch.vgic.rdist_stride;
 
     /*
+     * This is the earliest place where the number of vCPUs is
+     * known. This is required to initialize correctly the vGIC v3
+     * domain structure. We only to do that when vCPU 0 is
+     * initilialized.
+     */
+    if ( v->vcpu_id == 0 )
+    {
+        rc = vgic_v3_real_domain_init(d);
+        if ( rc )
+            return rc;
+    }
+
+    /*
      * Find the region where the re-distributor lives. For this purpose,
      * we look one region ahead as we have only the first CPU in hand.
      */
@@ -1644,7 +1659,7 @@ static inline unsigned int vgic_v3_rdist_count(struct 
domain *d)
                GUEST_GICV3_RDIST_REGIONS;
 }
 
-static int vgic_v3_domain_init(struct domain *d)
+static int vgic_v3_real_domain_init(struct domain *d)
 {
     struct vgic_rdist_region *rdist_regions;
     int rdist_count, i, ret;
@@ -1747,6 +1762,16 @@ static int vgic_v3_domain_init(struct domain *d)
     return 0;
 }
 
+static int vgic_v3_domain_init(struct domain *d)
+{
+    /*
+     * The domain initialization for vGIC v3 is delayed until the first vCPU
+     * is created. This because the initialization may require to know the
+     * number of vCPUs that is not known when creating the domain.
+     */
+    return 0;
+}
+
 static void vgic_v3_domain_free(struct domain *d)
 {
     vgic_v3_its_free_domain(d);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10

_______________________________________________
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®.