WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [xenppc-unstable] [ppc] implement new upstream local_event_deli

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [xenppc-unstable] [ppc] implement new upstream local_event_delivery_* interface
From: Xen patchbot-xenppc-unstable <patchbot-xenppc-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Jun 2006 19:22:26 +0000
Delivery-date: Mon, 12 Jun 2006 12:28:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID 43058739a5d32f9048d2305c2f1cd0506597da30
# Parent  7eba79a7639cac7cf96798f601efe177d6c2637e
[ppc] implement new upstream local_event_delivery_* interface
- remove 'arch_event_deliverable' hack
- PPC now uses MSR:EE instead of 'evtchn_upcall_mask'
- define vcpu_regs(vcpu *v), which should replace most users of 'current'
  and 'guest_cpu_user_regs'
---
 xen/arch/ppc/exceptions.h     |    1 -
 xen/arch/ppc/external.c       |   12 +++++-------
 xen/include/asm-ppc/current.h |   21 +++++++++++++++++++--
 xen/include/asm-ppc/domain.h  |    2 --
 xen/include/asm-ppc/event.h   |   28 ++++++++++++++++++++++++----
 5 files changed, 48 insertions(+), 16 deletions(-)

diff -r 7eba79a7639c -r 43058739a5d3 xen/arch/ppc/exceptions.h
--- a/xen/arch/ppc/exceptions.h Mon Jun 12 14:09:38 2006 -0500
+++ b/xen/arch/ppc/exceptions.h Mon Jun 12 14:20:14 2006 -0500
@@ -13,7 +13,6 @@ extern void ack_APIC_irq(void);
 extern void ack_APIC_irq(void);
 extern int ioapic_guest_read(unsigned long physbase, unsigned int reg, u32 
*pval);
 extern int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 
val);
-extern int pirq_acktype(int irq);
 extern void __start_xen_ppc(
     ulong r3, ulong r4, ulong r5, ulong r6, ulong r7, ulong orig_msr);
 extern  multiboot_info_t *boot_of_init(ulong r3, ulong r4, ulong vec, ulong 
r6, ulong r7, ulong orig_msr);
diff -r 7eba79a7639c -r 43058739a5d3 xen/arch/ppc/external.c
--- a/xen/arch/ppc/external.c   Mon Jun 12 14:09:38 2006 -0500
+++ b/xen/arch/ppc/external.c   Mon Jun 12 14:20:14 2006 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Jimi Xenidis <jimix@xxxxxxxxxxxxxx>, IBM Corporation
+ * Copyright (C) 2005,2006 Jimi Xenidis <jimix@xxxxxxxxxxxxxx>, IBM Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -51,12 +51,10 @@ void deliver_ee(struct cpu_user_regs *re
                              MSR_BE | MSR_FP | MSR_PMM | MSR_PR | MSR_SE);
 
     BUG_ON(mfmsr() & MSR_EE);
-
-    /* trigger exception only if we have a pending irq, we're resuming a guest
-     * (not the hypervisor), the guest is dom0, and it has MSR:EE set. */
-    if (!event_pending(current)) return;
-    if (!(regs->msr & MSR_EE)) return;
     BUG_ON(regs->msr & MSR_HV);
+
+    if (!local_events_need_delivery())
+        return;
 
     /* XXX OS error: EE was set but RI was not. We could trigger a machine
      * check, or kill the domain... for now just crash Xen so we notice. */
@@ -107,7 +105,7 @@ static unsigned int xen_startup_irq(unsi
     if (xen_local_irq(irq)) {
         return hc_irq->startup(irq);
     }
-       return 0;
+    return 0;
 }
 
 static void xen_shutdown_irq(unsigned int irq)
diff -r 7eba79a7639c -r 43058739a5d3 xen/include/asm-ppc/current.h
--- a/xen/include/asm-ppc/current.h     Mon Jun 12 14:09:38 2006 -0500
+++ b/xen/include/asm-ppc/current.h     Mon Jun 12 14:20:14 2006 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Hollis Blanchard <hollisb@xxxxxxxxxx>, IBM Corporation
+ * Copyright (C) 2005,2006 Hollis Blanchard <hollisb@xxxxxxxxxx>, IBM 
Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@
 #include <asm/processor.h>
 #include <asm/ppc64/procarea.h>
 
+struct vcpu;
+
 register struct processor_area *parea asm("r13");
 
 static inline struct vcpu *get_current(void)
@@ -32,12 +34,13 @@ static inline struct vcpu *get_current(v
 }
 #define current get_current()
 
-struct vcpu;
 static inline void set_current(struct vcpu *v)
 {
     parea->cur_vcpu = v;
 }
 
+/* The *currently running* guest's register state has been saved at the top of
+ * this processor's hypervisor stack. */
 static inline struct cpu_user_regs *guest_cpu_user_regs(void)
 {
     ulong stack_top = (ulong)parea->hyp_stack_base;
@@ -45,6 +48,20 @@ static inline struct cpu_user_regs *gues
     return (struct cpu_user_regs *)(stack_top - STACK_VOLATILE_AREA
                                     - sizeof (struct cpu_user_regs));
 }
+
+/* XXX *#%(ing circular header dependencies force this to be a macro */
+/* If the vcpu is running, its state is still on the stack, and the vcpu
+ * structure's copy is obsolete. If the vcpu isn't running, the vcpu structure
+ * holds the only copy. This routine always does the right thing. */
+#define vcpu_regs(v) ({                 \
+    struct cpu_user_regs *regs;         \
+    if (v == current)                   \
+        regs = guest_cpu_user_regs();   \
+    else                                \
+        regs = &v->arch.ctxt;           \
+    regs;                               \
+})
+
 
 static inline void reset_stack_and_jump(void (*f)(void))
 {
diff -r 7eba79a7639c -r 43058739a5d3 xen/include/asm-ppc/domain.h
--- a/xen/include/asm-ppc/domain.h      Mon Jun 12 14:09:38 2006 -0500
+++ b/xen/include/asm-ppc/domain.h      Mon Jun 12 14:20:14 2006 -0500
@@ -91,8 +91,6 @@ extern void save_float(struct vcpu *);
 extern void save_float(struct vcpu *);
 extern void load_float(struct vcpu *);
 
-#define arch_event_deliverable (!!((guest_cpu_user_regs())->msr & MSR_EE))
-
 #define RMA_SHARED_INFO 1
 #define RMA_START_INFO 2
 #define RMA_LAST_DOM0 2
diff -r 7eba79a7639c -r 43058739a5d3 xen/include/asm-ppc/event.h
--- a/xen/include/asm-ppc/event.h       Mon Jun 12 14:09:38 2006 -0500
+++ b/xen/include/asm-ppc/event.h       Mon Jun 12 14:20:14 2006 -0500
@@ -8,6 +8,8 @@
 
 #ifndef __ASM_EVENT_H__
 #define __ASM_EVENT_H__
+
+#include <asm/current.h>
 
 /* copied from x86 evtchn_notify() */
 static inline void evtchn_notify(struct vcpu *v)
@@ -22,10 +24,28 @@ static inline void evtchn_notify(struct 
 #endif
 }
 
-/* Note: Bitwise operations result in fast code with no branches. */
-#define event_pending(v)                        \
-    (!!(v)->vcpu_info->evtchn_upcall_pending &  \
-      !(v)->vcpu_info->evtchn_upcall_mask)
+static inline int local_events_need_delivery(void)
+{
+    struct vcpu *v = current;
+    /* Note: Bitwise operations result in fast code with no branches. */
+    return (!!v->vcpu_info->evtchn_upcall_pending &
+            !!(vcpu_regs(v)->msr & MSR_EE));
+}
+
+static inline int local_event_delivery_is_enabled(void)
+{
+    return vcpu_regs(current)->msr & MSR_EE;
+}
+
+static inline void local_event_delivery_disable(void)
+{
+    vcpu_regs(current)->msr &= ~MSR_EE;
+}
+
+static inline void local_event_delivery_enable(void)
+{
+    vcpu_regs(current)->msr |= MSR_EE;
+}
 
 /* No arch specific virq definition now. Default to global. */
 static inline int arch_virq_is_global(int virq)

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel

<Prev in Thread] Current Thread [Next in Thread>