diff mbox

[RFC,5/5] xen/arm: cpupool: implement arch_domain_cpupool_compatible

Message ID 1474250936-27962-6-git-send-email-peng.fan@nxp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peng Fan Sept. 19, 2016, 2:08 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

When migrating domain between different cpupools, need to check
whether the domain is compatible with the cpupool.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/cpupool.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/xen/arch/arm/cpupool.c b/xen/arch/arm/cpupool.c
index 74a5ef3..6c1c092 100644
--- a/xen/arch/arm/cpupool.c
+++ b/xen/arch/arm/cpupool.c
@@ -41,5 +41,20 @@  int arch_cpupool_cpu_add(struct cpupool *c, unsigned int cpu)
 
 bool_t arch_domain_cpupool_compatible(struct domain *d, struct cpupool *c)
 {
-    return true;
+    if ( !d->vcpu || !d->vcpu[0] )
+    {
+        /*
+         * We are in process of domain creation, vcpu not constructed or
+         * initialiszed, ok to move domain from cpupool0 to other pool
+         */
+        return true;
+    }
+    else if ( d->vcpu[0] )
+    {
+        return !!( d->vcpu[0]->arch.vpidr == c->info.midr );
+    }
+    else
+    {
+        return false;
+    }
 }