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] [linux-ppc-2.6] [POWERPC][XEN] should call HYPERVISOR_poll() no

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [linux-ppc-2.6] [POWERPC][XEN] should call HYPERVISOR_poll() not HYPERVISOR_block()
From: Xen patchbot-linux-ppc-2.6 <patchbot-linux-ppc-2.6@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Sep 2006 02:41:19 +0000
Delivery-date: Thu, 14 Sep 2006 19:43:05 -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 Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 5a609aa8489bcb45a7e22f90526c52278025c5bc
# Parent  4a1f58739bc25b80eae92af80b9ef309cb25468c
[POWERPC][XEN] should call HYPERVISOR_poll() not HYPERVISOR_block()

block will enable interrupts, this is a bad thing to do while in
udb/xmon, and yes had to implement HYPERVISOR_poll().

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 arch/powerpc/platforms/xen/hcall.c      |   40 +++++++++++++++-----
 arch/powerpc/platforms/xen/setup.c      |    5 --
 arch/powerpc/platforms/xen/setup.h      |    5 ++
 arch/powerpc/platforms/xen/udbg_xen.c   |   61 +++++++++++++-------------------
 include/asm-powerpc/xen/asm/hypercall.h |    5 +-
 5 files changed, 62 insertions(+), 54 deletions(-)

diff -r 4a1f58739bc2 -r 5a609aa8489b arch/powerpc/platforms/xen/hcall.c
--- a/arch/powerpc/platforms/xen/hcall.c        Tue Sep 12 15:53:01 2006 -0500
+++ b/arch/powerpc/platforms/xen/hcall.c        Thu Sep 14 22:35:58 2006 -0400
@@ -39,6 +39,7 @@
 #include <asm/page.h>
 #include <asm/uaccess.h>
 #include <asm/hvcall.h>
+#include "setup.h"
 
 #define xen_guest_handle(hnd)  ((hnd).p)
 
@@ -183,7 +184,6 @@ int HYPERVISOR_sched_op(int cmd, void *a
 int HYPERVISOR_sched_op(int cmd, void *arg)
 {
        struct xencomm_desc *desc;
-       ulong argsize;
 
        switch (cmd) {
        case SCHEDOP_yield:
@@ -192,17 +192,21 @@ int HYPERVISOR_sched_op(int cmd, void *a
                                          cmd, 0);
                break;
 
-       case SCHEDOP_shutdown: {
-               desc = xencomm_create_inline(arg);
-
-               return plpar_hcall_norets(XEN_MARK(__HYPERVISOR_sched_op),
-                                       cmd, desc);
-       }
-       case SCHEDOP_poll:
-               argsize = sizeof(sched_poll_t);
-               break;
+       case SCHEDOP_poll: {
+               evtchn_port_t *ports;
+               struct sched_poll sched_poll;
+
+               memcpy(&sched_poll, arg, sizeof(sched_poll));
+
+               ports = xencomm_create_inline(
+                       xen_guest_handle(sched_poll.ports));
+               set_xen_guest_handle(sched_poll.ports, ports);
+               memcpy(arg, &sched_poll, sizeof(sched_poll));
+               
+       }
+               break;
+       case SCHEDOP_shutdown:
        case SCHEDOP_remote_shutdown:
-               argsize = sizeof(sched_remote_shutdown_t);
                break;
        default:
                printk(KERN_ERR "%s: unknown sched op %d\n", __func__, cmd);
@@ -215,6 +219,20 @@ int HYPERVISOR_sched_op(int cmd, void *a
                                cmd, desc);
 }
 EXPORT_SYMBOL(HYPERVISOR_sched_op);
+
+int
+HYPERVISOR_poll(
+       evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
+{
+       struct sched_poll sched_poll = {
+               .nr_ports = nr_ports,
+               .timeout = jiffies_to_ns(timeout)
+       };
+       set_xen_guest_handle(sched_poll.ports, ports);
+
+       return HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
+}
+EXPORT_SYMBOL(HYPERVISOR_poll);
 
 int HYPERVISOR_multicall(void *call_list, int nr_calls)
 {
diff -r 4a1f58739bc2 -r 5a609aa8489b arch/powerpc/platforms/xen/setup.c
--- a/arch/powerpc/platforms/xen/setup.c        Tue Sep 12 15:53:01 2006 -0500
+++ b/arch/powerpc/platforms/xen/setup.c        Thu Sep 14 22:35:58 2006 -0400
@@ -154,11 +154,6 @@ int is_running_on_xen(void)
        return running_on_xen;
 }
 
-static u64 jiffies_to_ns(unsigned long j) 
-{
-       return j * (1000000000UL / HZ);
-}
-
 static void xen_power_save(void)
 {
        /* SCHEDOP_yield could immediately return. Instead, we
diff -r 4a1f58739bc2 -r 5a609aa8489b arch/powerpc/platforms/xen/setup.h
--- a/arch/powerpc/platforms/xen/setup.h        Tue Sep 12 15:53:01 2006 -0500
+++ b/arch/powerpc/platforms/xen/setup.h        Thu Sep 14 22:35:58 2006 -0400
@@ -14,3 +14,8 @@ static inline u64 tb_to_ns(u64 tb)
        }
        return 0;
 }
+
+static inline u64 jiffies_to_ns(unsigned long j) 
+{
+       return j * (1000000000UL / HZ);
+}
diff -r 4a1f58739bc2 -r 5a609aa8489b arch/powerpc/platforms/xen/udbg_xen.c
--- a/arch/powerpc/platforms/xen/udbg_xen.c     Tue Sep 12 15:53:01 2006 -0500
+++ b/arch/powerpc/platforms/xen/udbg_xen.c     Thu Sep 14 22:35:58 2006 -0400
@@ -5,6 +5,30 @@
 #include <asm/udbg.h>
 #include <asm/hypervisor.h>
 #include "setup.h"
+
+static void udbg_xen_wait(void)
+{
+       evtchn_port_t port = 0;
+
+       if (xen_start_info) {
+               port = xen_start_info->console.domU.evtchn;
+               clear_evtchn(port);
+       }
+       HYPERVISOR_poll(&port, 1, 10);
+}
+
+static int udbg_getc_xen(void)
+{
+       int ch;
+       for (;;) {
+               ch = udbg_getc_poll();
+               if (ch == -1) {
+                       udbg_xen_wait();
+               } else {
+                       return ch;
+               }
+       }
+}
 
 static void udbg_putc_dom0_xen(char c)
 {
@@ -45,24 +69,6 @@ static int udbg_getc_poll_dom0_xen(void)
        inbuflen--;
 
        return ch;
-}
-
-static int udbg_getc_dom0_xen(void)
-{
-       int ch;
-       for (;;) {
-               ch = udbg_getc_poll_dom0_xen();
-               if (ch == -1) {
-                       u64 now_ns = tb_to_ns(get_tb());
-                       if (now_ns > 0) {
-                               u64 offset_ns = 100000000; /* 100ms */
-                               HYPERVISOR_set_timer_op(now_ns + offset_ns);
-                               HYPERVISOR_sched_op(SCHEDOP_block, NULL);
-                       }
-               } else {
-                       return ch;
-               }
-       }
 }
 
 static struct xencons_interface *intf;
@@ -111,22 +117,6 @@ static int udbg_getc_poll_domu_xen(void)
        return c;
 }
 
-static int udbg_getc_domu_xen(void)
-{
-       int ch;
-       for (;;) {
-               ch = udbg_getc_poll_domu_xen();
-               if (ch == -1) {
-                       /* This shouldn't be needed...but... */
-                       volatile unsigned long delay;
-                       for (delay=0; delay < 2000000; delay++)
-                               ;
-               } else {
-                       return ch;
-               }
-       }
-}
-
 void udbg_init_xen(void)
 {
        ulong __console_mfn = 0;
@@ -142,13 +132,12 @@ void udbg_init_xen(void)
 #endif
        }
 
+       udbg_getc = udbg_getc_xen;
        if (__console_mfn == 0) {
                udbg_putc = udbg_putc_dom0_xen;
-               udbg_getc = udbg_getc_dom0_xen;
                udbg_getc_poll = udbg_getc_poll_dom0_xen;
        } else {
                udbg_putc = udbg_putc_domu_xen;
-               udbg_getc = udbg_getc_domu_xen;
                udbg_getc_poll = udbg_getc_poll_domu_xen;
                intf = (struct xencons_interface *)mfn_to_virt(__console_mfn);
        }
diff -r 4a1f58739bc2 -r 5a609aa8489b include/asm-powerpc/xen/asm/hypercall.h
--- a/include/asm-powerpc/xen/asm/hypercall.h   Tue Sep 12 15:53:01 2006 -0500
+++ b/include/asm-powerpc/xen/asm/hypercall.h   Thu Sep 14 22:35:58 2006 -0400
@@ -48,6 +48,9 @@ extern int HYPERVISOR_multicall(void *ca
 extern int HYPERVISOR_multicall(void *call_list, int nr_calls);
 
 extern int HYPERVISOR_sched_op(int cmd, void *arg);
+extern int HYPERVISOR_poll(
+       evtchn_port_t *ports, unsigned int nr_ports, u64 timeout);
+
 static inline int HYPERVISOR_shutdown(unsigned int reason)
 {
        struct sched_shutdown sched_shutdown = {
@@ -61,6 +64,4 @@ static inline int HYPERVISOR_set_timer_o
 {
        return plpar_hcall_norets(XEN_MARK(__HYPERVISOR_set_timer_op), arg);
 }
-
-
 #endif /*  __HYPERCALL_H__ */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [linux-ppc-2.6] [POWERPC][XEN] should call HYPERVISOR_poll() not HYPERVISOR_block(), Xen patchbot-linux-ppc-2 . 6 <=