From owner-svn-src-all@FreeBSD.ORG Mon Aug 4 09:02:49 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AAD72E54 for ; Mon, 4 Aug 2014 09:02:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8047328FC for ; Mon, 4 Aug 2014 09:02:49 +0000 (UTC) Received: from royger (uid 1332) (envelope-from royger@FreeBSD.org) id 5feb by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 04 Aug 2014 09:02:49 +0000 From: Roger Pau Monné Date: Mon, 4 Aug 2014 09:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269514 - head/sys/dev/xen/console X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53df4c39.5feb.53a075b7@svn.freebsd.org> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Aug 2014 09:02:49 -0000 Author: royger Date: Mon Aug 4 09:02:49 2014 New Revision: 269514 URL: http://svnweb.freebsd.org/changeset/base/269514 Log: 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. Modified: head/sys/dev/xen/console/xencons_ring.c Modified: head/sys/dev/xen/console/xencons_ring.c ============================================================================== --- head/sys/dev/xen/console/xencons_ring.c Mon Aug 4 09:01:21 2014 (r269513) +++ head/sys/dev/xen/console/xencons_ring.c Mon Aug 4 09:02:49 2014 (r269514) @@ -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;