From: Andrew Cooper Date: Thu, 19 Mar 2015 21:13:51 +0000 (+0100) Subject: Hypercall infrastructure needed for writing to a PV console X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a839fc084a37c8c6bf8bdc1343a996ce147d1876;p=people%2Froyger%2Fxen-test-framework.git Hypercall infrastructure needed for writing to a PV console Signed-off-by: Andrew Cooper --- diff --git a/arch/x86/hypercall_page.S b/arch/x86/hypercall_page.S index 725cfb2..5447bc1 100644 --- a/arch/x86/hypercall_page.S +++ b/arch/x86/hypercall_page.S @@ -11,3 +11,4 @@ GLOBAL(hypercall_page) DECLARE_HYPERCALL(console_io) DECLARE_HYPERCALL(sched_op) +DECLARE_HYPERCALL(event_channel_op) diff --git a/include/xen/event_channel.h b/include/xen/event_channel.h new file mode 100644 index 0000000..3754f9e --- /dev/null +++ b/include/xen/event_channel.h @@ -0,0 +1,18 @@ +#ifndef XEN_PUBLIC_EVENT_CHANNEL_H +#define XEN_PUBLIC_EVENT_CHANNEL_H + +#define EVTCHNOP_send 4 + +typedef uint32_t evtchn_port_t; + +#endif /* XEN_PUBLIC_EVENT_CHANNEL_H */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/include/xen/sched.h b/include/xen/sched.h index bf3868b..0f13469 100644 --- a/include/xen/sched.h +++ b/include/xen/sched.h @@ -5,6 +5,7 @@ #ifndef XEN_PUBLIC_SCHED_H #define XEN_PUBLIC_SCHED_H +#define SCHEDOP_yield 0 #define SCHEDOP_shutdown 2 #ifndef __ASSEMBLY__ diff --git a/include/xen/xen.h b/include/xen/xen.h index e311a6e..d3e226f 100644 --- a/include/xen/xen.h +++ b/include/xen/xen.h @@ -13,6 +13,7 @@ #define __HYPERVISOR_console_io 18 #define __HYPERVISOR_sched_op 29 +#define __HYPERVISOR_event_channel_op 32 /* Commands to HYPERVISOR_console_io */ #define CONSOLEIO_write 0 diff --git a/include/xtf/hypercall.h b/include/xtf/hypercall.h index 3dca881..0de3ebf 100644 --- a/include/xtf/hypercall.h +++ b/include/xtf/hypercall.h @@ -22,6 +22,7 @@ /* All Xen ABI for includers convenience .*/ #include #include +#include /* * Hypercall primatives, compiled for the correct bitness @@ -31,6 +32,11 @@ static inline long hypercall_sched_op(unsigned int cmd, void *arg) return HYPERCALL2(long, sched_op, cmd, arg); } +static inline long hypercall_event_channel_op(unsigned int cmd, void *arg) +{ + return HYPERCALL2(long, event_channel_op, cmd, arg); +} + /* * Higher level hypercall helpers */ @@ -44,6 +50,16 @@ static inline long hypercall_shutdown(unsigned int reason) return hypercall_sched_op(SCHEDOP_shutdown, &reason); } +static inline void hypercall_yield(void) +{ + hypercall_sched_op(SCHEDOP_yield, NULL); +} + +static inline int hypercall_evtchn_send(evtchn_port_t port) +{ + return hypercall_event_channel_op(EVTCHNOP_send, &port); +} + #endif /* XTF_HYPERCALL_H */ /*