]> xenbits.xensource.com Git - xen.git/commitdiff
ARM: VGIC: Adjust domain_max_vcpus() to be VGIC specific
authorAndre Przywara <andre.przywara@linaro.org>
Fri, 9 Mar 2018 15:11:23 +0000 (15:11 +0000)
committerJulien Grall <julien.grall@arm.com>
Mon, 12 Mar 2018 11:42:40 +0000 (11:42 +0000)
domain_max_vcpus(), which is used by generic Xen code, returns the
maximum number of VCPUs for a domain, which on ARM is mostly limited by
the VGIC model emulated (a (v)GICv2 can only handle 8 CPUs).
Our current implementation lives in arch/arm/domain.c, but reaches into
VGIC internal data structures.
Move the actual functionality into vgic.c, and provide a shim in
domain.h, to keep this VGIC internal.

Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
Reviewed-by: Julien Grall <julien.grall@arm.com>
xen/arch/arm/domain.c
xen/arch/arm/vgic.c
xen/include/asm-arm/domain.h
xen/include/asm-arm/vgic.h

index 8de4c0a34338589a5621572e909d3b30c3a6d141..6b902fa30fc31d4f1fadf40a5ba908e8425a6816 100644 (file)
@@ -967,20 +967,6 @@ void vcpu_block_unless_event_pending(struct vcpu *v)
         vcpu_unblock(current);
 }
 
-unsigned int domain_max_vcpus(const struct domain *d)
-{
-    /*
-     * Since evtchn_init would call domain_max_vcpus for poll_mask
-     * allocation when the vgic_ops haven't been initialised yet,
-     * we return MAX_VIRT_CPUS if d->arch.vgic.handler is null.
-     */
-    if ( !d->arch.vgic.handler )
-        return MAX_VIRT_CPUS;
-    else
-        return min_t(unsigned int, MAX_VIRT_CPUS,
-                     d->arch.vgic.handler->max_vcpus);
-}
-
 /*
  * Local variables:
  * mode: C
index 34269bcf27f847d5954d196abdcb0a6cd12c487c..fa00c21a690811e7c447ec65ad7b056a508f8e85 100644 (file)
@@ -665,6 +665,20 @@ void vgic_free_virq(struct domain *d, unsigned int virq)
     clear_bit(virq, d->arch.vgic.allocated_irqs);
 }
 
+unsigned int vgic_max_vcpus(const struct domain *d)
+{
+    /*
+     * Since evtchn_init would call domain_max_vcpus for poll_mask
+     * allocation when the vgic_ops haven't been initialised yet,
+     * we return MAX_VIRT_CPUS if d->arch.vgic.handler is null.
+     */
+    if ( !d->arch.vgic.handler )
+        return MAX_VIRT_CPUS;
+    else
+        return min_t(unsigned int, MAX_VIRT_CPUS,
+                     d->arch.vgic.handler->max_vcpus);
+}
+
 /*
  * Local variables:
  * mode: C
index c6aa5cf3893184e025aa9cbcd87e7ad1ad9976f2..e730e07fcfa820ae5045ea05382705521a025dc2 100644 (file)
@@ -289,7 +289,11 @@ void vcpu_show_execution_state(struct vcpu *);
 void vcpu_show_registers(const struct vcpu *);
 void vcpu_switch_to_aarch64_mode(struct vcpu *);
 
-unsigned int domain_max_vcpus(const struct domain *);
+/* On ARM, the number of VCPUs is limited by the type of GIC emulated. */
+static inline unsigned int domain_max_vcpus(const struct domain *d)
+{
+    return vgic_max_vcpus(d);
+}
 
 /*
  * Due to the restriction of GICv3, the number of vCPUs in AFF0 is
index d03298e12c61b7c72fcfaf07c9a73133bc78862b..afb4776ad4fed6f6f22ce3c9c77ea12b20baad1b 100644 (file)
@@ -254,6 +254,8 @@ static inline int vgic_allocate_spi(struct domain *d)
 
 extern void vgic_free_virq(struct domain *d, unsigned int virq);
 
+unsigned int vgic_max_vcpus(const struct domain *d);
+
 void vgic_v2_setup_hw(paddr_t dbase, paddr_t cbase, paddr_t csize,
                       paddr_t vbase, uint32_t aliased_offset);