From: Stefano Stabellini Subject: [PATCH 2/2] xen/arm: handle the runstate_memory_area Date: Wed, 1 May 2013 20:32:28 +0100 Message-ID: <1367436748-10352-2-git-send-email-stefano.stabellini@eu.citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xensource.com Cc: Ian.Campbell@citrix.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Support VCPUOP_register_runstate_memory_area on ARM. Update_runstate_area on context switch. Signed-off-by: Stefano Stabellini --- xen/arch/arm/domain.c | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 2d018cf..40bf963 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -212,16 +213,25 @@ static void ctxt_switch_to(struct vcpu *n) virt_timer_restore(n); } +/* Update per-VCPU guest runstate shared memory area (if registered). */ +static void update_runstate_area(struct vcpu *v) +{ + if ( guest_handle_is_null(runstate_guest(v)) ) + return; + + __copy_to_guest(runstate_guest(v), &v->runstate, 1); +} + static void schedule_tail(struct vcpu *prev) { ctxt_switch_from(prev); local_irq_enable(); - /* TODO - update_runstate_area(current); - */ ctxt_switch_to(current); + + if ( prev != current ) + update_runstate_area(current); } static void continue_new_vcpu(struct vcpu *prev) @@ -241,9 +251,8 @@ void context_switch(struct vcpu *prev, struct vcpu *next) ASSERT(prev != next); ASSERT(cpumask_empty(next->vcpu_dirty_cpumask)); - /* TODO - update_runstate_area(prev); - */ + if ( prev != next ) + update_runstate_area(prev); local_irq_disable(); @@ -636,6 +645,7 @@ long do_arm_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) switch ( cmd ) { case VCPUOP_register_vcpu_info: + case VCPUOP_register_runstate_memory_area: return do_vcpu_op(cmd, vcpuid, arg); default: return -EINVAL; -- 1.7.2.5