Skip to contentSkip to conversation

xen/arm: gic: don't use dom0 variable in gicv_setup

PATCH In review Julien Grall 2 participants 2 messages Nov 19, 2013 – Nov 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: gic: don't use dom0 variable in gicv_setup

The commit 99bf30a "xen: arm: define guest virtual platform in API headers" modifies gicv_setup to either use harcoded addresses for guest or hardware addresses for dom0. In the latter case, the variable dom0 is not yet initialized. dom0 receives assignment by the return of domain_create which calls gicv_setup.
Use the ID to know whether the domain is dom0 or not.

---
 xen/arch/arm/gic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/gic.c +1 -1
index 3b1ef3a..d5ac770 100644
@@ -881,7 +881,7 @@ int gicv_setup(struct domain *d)
      * Domain 0 gets the hardware address.
      * Guests get the virtual platform layout.
      */
-    if ( d == dom0 )
+    if ( d->domain_id == 0 )
     {
         d->arch.vgic.dbase = gic.dbase;
         d->arch.vgic.cbase = gic.cbase;
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 6 lines · Julien Grall

The commit 99bf30a "xen: arm: define guest virtual platform in API headers" modifies gicv_setup to either use harcoded addresses for guest or hardware addresses for dom0. In the latter case, the variable dom0 is not yet initialized. dom0 receives assignment by the return of domain_create which calls gicv_setup.
Use the ID to know whether the domain is dom0 or not.

Oops, I missed this because the platform I was testing (fastmodel == vexpress) happens to have the same GIC addresses as the virtual platform.

Quoted 1 line

Acked + applied.

I investigated is_hardware_domain and friends but they relies on d->is_privileged which is also not yet set.

Ian.