From: Parth Dixit <parth.dixit@linaro.org>
To: xen-devel@lists.xen.org
Cc: ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com,
julien.grall@linaro.org, tim@xen.org,
Parth Dixit <parth.dixit@linaro.org>,
christoffer.dall@linaro.org
Subject: [PATCH v3 1/2] xen/arm : Adding helper function for WFI
Date: Thu, 3 Jul 2014 17:52:37 +0530 [thread overview]
Message-ID: <1404390158-21542-1-git-send-email-parth.dixit@linaro.org> (raw)
WFI functionality is required at different places in xen.
Moving it to seperate helper function so that it is easier
to call WFI function and avoid duplication of code
Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
---
Changelog v3 :
- new patch for helper function, this functionality existed in same patch in v2
xen/arch/arm/domain.c | 13 +++++++++++++
xen/arch/arm/traps.c | 10 +---------
xen/include/asm-arm/event.h | 1 +
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 2ae6941..bc5e56d 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -779,6 +779,19 @@ void vcpu_mark_events_pending(struct vcpu *v)
vgic_vcpu_inject_irq(v, v->domain->arch.evtchn_irq, 1);
}
+/* The ARM spec declares that even if local irqs are masked in
+* the CPSR register, an irq should wake up a cpu from WFI anyway.
+* For this reason we need to check for irqs that need delivery,
+* ignoring the CPSR register, *after* calling SCHEDOP_block to
+* avoid races with vgic_vcpu_inject_irq.
+*/
+void vcpu_block_event(struct vcpu *v)
+{
+ vcpu_block();
+ if ( local_events_need_delivery_nomask() )
+ vcpu_unblock(current);
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 03a3da6..8d2e308 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1670,15 +1670,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
return;
}
/* at the moment we only trap WFI */
- vcpu_block();
- /* The ARM spec declares that even if local irqs are masked in
- * the CPSR register, an irq should wake up a cpu from WFI anyway.
- * For this reason we need to check for irqs that need delivery,
- * ignoring the CPSR register, *after* calling SCHEDOP_block to
- * avoid races with vgic_vcpu_inject_irq.
- */
- if ( local_events_need_delivery_nomask() )
- vcpu_unblock(current);
+ vcpu_block_event(current);
advance_pc(regs, hsr);
break;
case HSR_EC_CP15_32:
diff --git a/xen/include/asm-arm/event.h b/xen/include/asm-arm/event.h
index dd3ad13..a94ba2e 100644
--- a/xen/include/asm-arm/event.h
+++ b/xen/include/asm-arm/event.h
@@ -6,6 +6,7 @@
void vcpu_kick(struct vcpu *v);
void vcpu_mark_events_pending(struct vcpu *v);
+void vcpu_block_event(struct vcpu *v);
static inline int vcpu_event_delivery_is_enabled(struct vcpu *v)
{
--
1.9.1
next reply other threads:[~2014-07-03 12:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-03 12:22 Parth Dixit [this message]
2014-07-03 12:22 ` [PATCH v3 2/2] xen/arm : emulation of arm's PSCI v0.2 standard Parth Dixit
2014-07-09 13:24 ` Ian Campbell
2014-07-09 13:51 ` Ian Campbell
2014-07-10 10:14 ` Parth Dixit
2014-07-10 10:28 ` Ian Campbell
2014-07-10 10:34 ` Parth Dixit
2014-07-16 13:42 ` Ian Campbell
2014-07-09 12:46 ` [PATCH v3 1/2] xen/arm : Adding helper function for WFI Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404390158-21542-1-git-send-email-parth.dixit@linaro.org \
--to=parth.dixit@linaro.org \
--cc=christoffer.dall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=julien.grall@linaro.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).