diff options
author | Roger Pau Monné <royger@FreeBSD.org> | 2014-08-04 09:02:49 +0000 |
---|---|---|
committer | Roger Pau Monné <royger@FreeBSD.org> | 2014-08-04 09:02:49 +0000 |
commit | 2382778f4060cb2b8cfc5340e6c4bd38e0c963a8 (patch) | |
tree | 10042d968957aa0702f4c56a1c6eb801849f8c73 | |
parent | c0c19cce9e3085ee911ac4f441e0e13d16e20d1f (diff) | |
download | src-2382778f4060cb2b8cfc5340e6c4bd38e0c963a8.tar.gz src-2382778f4060cb2b8cfc5340e6c4bd38e0c963a8.zip |
xen: Dom0 console fixes
Minor fixes to make the Xen Dom0 console work. This includes always
returning there's pending input in xencons_has_input, because on Dom0
there's no shared ring and we cannot test the indexes. The second
fix is to use the CONSOLEIO_read hypercall in order to read input
data from the Xen console.
Sponsored by: Citrix Systems R&D
dev/xen/console/xencons_ring.c:
- Always return true in xencons_has_input for Dom0.
- Implement Dom0 console support for xencons_handle_input.
Notes
Notes:
svn path=/head/; revision=269514
-rw-r--r-- | sys/dev/xen/console/xencons_ring.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/dev/xen/console/xencons_ring.c b/sys/dev/xen/console/xencons_ring.c index 42b9abe09947..65d05ce14212 100644 --- a/sys/dev/xen/console/xencons_ring.c +++ b/sys/dev/xen/console/xencons_ring.c @@ -35,6 +35,7 @@ xen_intr_handle_t console_handle; extern struct mtx cn_mtx; extern device_t xencons_dev; extern bool cnsl_evt_reg; +#define DOM0_BUFFER_SIZE 16 static inline struct xencons_interface * xencons_interface(void) @@ -48,6 +49,18 @@ xencons_has_input(void) { struct xencons_interface *intf; + if (xen_initial_domain()) { + /* + * Since the Dom0 console works with hypercalls + * there's no way to know if there's input unless + * we actually try to retrieve it, so always return + * like there's pending data. Then if the hypercall + * returns no input, we can handle it without problems + * in xencons_handle_input(). + */ + return 1; + } + intf = xencons_interface(); return (intf->in_cons != intf->in_prod); @@ -98,6 +111,19 @@ xencons_handle_input(void *unused) XENCONS_RING_IDX cons, prod; CN_LOCK(cn_mtx); + + if (xen_initial_domain()) { + static char rbuf[DOM0_BUFFER_SIZE]; + int l; + + while ((l = HYPERVISOR_console_io(CONSOLEIO_read, + DOM0_BUFFER_SIZE, rbuf)) > 0) + xencons_rx(rbuf, l); + + CN_UNLOCK(cn_mtx); + return; + } + intf = xencons_interface(); cons = intf->in_cons; |