From: Isaku Yamahata <yamahata@valinux.co.jp>
To: jeremy@goop.org
Cc: chrisw@sous-sol.org, sct@redhat.com,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, xen-ia64-devel@lists.xensource.com,
eddie.dong@intel.com, yamahata@valinux.co.jp
Subject: [PATCH 07/12] Xen: Make events.c portable for ia64/xen support.
Date: Fri, 28 Mar 2008 20:40:13 +0900 [thread overview]
Message-ID: <12067044180-git-send-email-yamahata@valinux.co.jp> (raw)
In-Reply-To: <12067044183207-git-send-email-yamahata@valinux.co.jp>
Remove x86 dependency in drivers/xen/events.c for ia64/xen support.
Introduce xen_irqs_disabled() to hide regs->flags
Introduce xen_do_IRQ() to hide regs->orig_ax.
Add one rmb() because on ia64 xchg() isn't barrier.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
drivers/xen/events.c | 13 +++++++------
include/asm-x86/xen/hypervisor.h | 10 ++++++++++
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index c50d499..2396b44 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -469,7 +469,7 @@ irqreturn_t xen_debug_interrupt(int irq, void *dev_id)
for_each_online_cpu(i) {
struct vcpu_info *v = per_cpu(xen_vcpu, i);
printk("%d: masked=%d pending=%d event_sel %08lx\n ", i,
- (get_irq_regs() && i == cpu) ? !(get_irq_regs()->flags & X86_EFLAGS_IF) : v->evtchn_upcall_mask,
+ (get_irq_regs() && i == cpu) ? xen_irqs_disabled(get_irq_regs()) : v->evtchn_upcall_mask,
v->evtchn_upcall_pending,
v->evtchn_pending_sel);
}
@@ -527,7 +527,10 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)
if (__get_cpu_var(nesting_count)++)
goto out;
- /* NB. No need for a barrier here -- XCHG is a barrier on x86. */
+#ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */
+ /* Clear master flag /before/ clearing selector flag. */
+ rmb();
+#endif
pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
while (pending_words != 0) {
unsigned long pending_bits;
@@ -539,10 +542,8 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)
int port = (word_idx * BITS_PER_LONG) + bit_idx;
int irq = evtchn_to_irq[port];
- if (irq != -1) {
- regs->orig_ax = ~irq;
- do_IRQ(regs);
- }
+ if (irq != -1)
+ xen_do_IRQ(irq, regs);
}
}
diff --git a/include/asm-x86/xen/hypervisor.h b/include/asm-x86/xen/hypervisor.h
index 8e15dd2..767a361 100644
--- a/include/asm-x86/xen/hypervisor.h
+++ b/include/asm-x86/xen/hypervisor.h
@@ -61,6 +61,16 @@ extern struct start_info *xen_start_info;
/* Force a proper event-channel callback from Xen. */
extern void force_evtchn_callback(void);
+/* macro to avoid header inclusion dependncy hell */
+#define xen_irqs_disabled(regs) (!((regs)->flags & X86_EFLAGS_IF))
+
+/* macro to avoid header inclusion dependncy hell */
+#define xen_do_IRQ(irq, regs) \
+ do { \
+ (regs)->orig_ax = ~(irq); \
+ do_IRQ(regs); \
+ } while (0)
+
/* Turn jiffies into Xen system time. */
u64 jiffies_to_st(unsigned long jiffies);
--
1.5.3
next prev parent reply other threads:[~2008-03-28 11:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-28 11:40 [PATCH 00/12] Xen arch portability patches (take 4) Isaku Yamahata
2008-03-28 11:40 ` [PATCH 01/12] xen: add missing __HYPERVISOR_arch_[0-7] definisions which ia64 needs Isaku Yamahata
2008-03-28 11:40 ` [PATCH 02/12] xen: add missing VIRQ_ARCH_[0-7] definitions which ia64/xen needs Isaku Yamahata
2008-03-28 11:40 ` [PATCH 03/12] xen: add missing definitions for xen grant table " Isaku Yamahata
2008-03-28 11:40 ` [PATCH 04/12] xen: add missing definitions in include/xen/interface/vcpu.h " Isaku Yamahata
2008-03-28 11:40 ` [PATCH 05/12] xen: move features.c from arch/x86/xen/features.c to drivers/xen Isaku Yamahata
2008-03-28 11:40 ` [PATCH 06/12] xen: Move events.c to drivers/xen for IA64/Xen support Isaku Yamahata
2008-03-28 11:40 ` Isaku Yamahata [this message]
2008-03-28 20:27 ` [PATCH 07/12] Xen: Make events.c portable for ia64/xen support Jeremy Fitzhardinge
2008-03-31 9:34 ` Isaku Yamahata
2008-03-28 11:40 ` [PATCH 08/12] xen: add resend_irq_on_evtchn() definition into events.c Isaku Yamahata
2008-03-28 20:29 ` Jeremy Fitzhardinge
2008-03-31 9:36 ` Isaku Yamahata
2008-03-28 11:40 ` [PATCH 09/12] xen: make include/xen/page.h portable moving those definitions under asm dir Isaku Yamahata
2008-03-28 20:41 ` Jeremy Fitzhardinge
2008-03-30 13:41 ` Avi Kivity
2008-03-28 11:40 ` [PATCH 10/12] xen: replace callers of alloc_vm_area()/free_vm_area() with xen_ prefixed one Isaku Yamahata
2008-03-28 20:31 ` Jeremy Fitzhardinge
2008-03-31 10:11 ` Isaku Yamahata
2008-03-28 11:40 ` [PATCH 11/12] xen: make grant table arch portable Isaku Yamahata
2008-03-28 11:40 ` [PATCH 12/12] xen: import arch generic part of xencomm Isaku Yamahata
2008-03-28 20:09 ` Jeremy Fitzhardinge
2008-03-31 9:49 ` Isaku Yamahata
2008-03-31 15:01 ` Jeremy Fitzhardinge
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=12067044180-git-send-email-yamahata@valinux.co.jp \
--to=yamahata@valinux.co.jp \
--cc=chrisw@sous-sol.org \
--cc=eddie.dong@intel.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sct@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xen-ia64-devel@lists.xensource.com \
/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
all inboxes | Powered by JetHome®