From patchwork Tue Feb 21 11:26:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 9584279 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 032C860578 for ; Tue, 21 Feb 2017 11:28:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E56C428527 for ; Tue, 21 Feb 2017 11:28:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA590288E0; Tue, 21 Feb 2017 11:28:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 99FA62885C for ; Tue, 21 Feb 2017 11:28:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cg8am-00033v-E1; Tue, 21 Feb 2017 11:26:48 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cg8al-00031L-CY for xen-devel@lists.xenproject.org; Tue, 21 Feb 2017 11:26:47 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 88/0F-02154-6F32CA85; Tue, 21 Feb 2017 11:26:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRWlGSWpSXmKPExsXiVRuspftNeU2 Ewdn1rBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a+jWeZClYJVHxtnc3cwHiGt4uRi0NIYAaj xKl139lBHBaBecwSH5ZcYARxJAT6WSXOfW1n7mLkBHJiJJo29LJD2NUSjx52sYHYQgJaEkdPz WaFGNXKJHHxxRGgIg4ONgETiVkdEiA1IgJKEvdWTWYCsZkFQiX+PWsDmyMMNOfSpUtgNouAqs S01oNgu3gFfCQeXLjABrFLTuLmuU6wOCdQ/O++l+wQe70lpt1ZwTaBUWABI8MqRvXi1KKy1CJ dY72kosz0jJLcxMwcXUMDU73c1OLixPTUnMSkYr3k/NxNjMDAYgCCHYx7/zkdYpTkYFIS5c2W WhMhxJeUn1KZkVicEV9UmpNafIhRhoNDSYLXDhioQoJFqempFWmZOcAQh0lLcPAoifAeUQRK8 xYXJOYWZ6ZDpE4x6nLs2nX5JZMQS15+XqqUOK8kyAwBkKKM0jy4EbB4u8QoKyXMywh0lBBPQW pRbmYJqvwrRnEORiVh3v1KQFN4MvNK4Da9AjqCCeiImx4rQY4oSURISTUwRpdf1WRZNkHt8Pe +0raPjEsWrd90Jcc+o2jZr3Nh9icMVnafknOrS/+z/myqhOeyM5/MBNc3Jd+6Z7HAc3tqWAdP 8D3J2Gn+zV3Mvw92+DoK3Tf+bWk+eW/b9H/pxuEMxqsfSi//sNyz3VDqrehRwXdhprGJt5U4b LWrWdVDuzRWx90uFrZRYinOSDTUYi4qTgQAeYyyIrICAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-206.messagelabs.com!1487676404!86074889!1 X-Originating-IP: [74.125.83.42] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 47500 invoked from network); 21 Feb 2017 11:26:45 -0000 Received: from mail-pg0-f42.google.com (HELO mail-pg0-f42.google.com) (74.125.83.42) by server-9.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 21 Feb 2017 11:26:45 -0000 Received: by mail-pg0-f42.google.com with SMTP id s67so23740320pgb.3 for ; Tue, 21 Feb 2017 03:26:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ds5ggo0KYCOoUcx5Ud+Osp3LLdRz+YmCRLT1YsdfZWo=; b=FUpemNZglcGJm+L7CR7OInYxLKVvsG4KGc/MqO/PuNiXmsbMWkZWntAmGRBmoUWon0 sT3Ztpw0jTTKYYAUfk1+AfxErCf13K1lah6lQ4UubnwFRnKigCefIDeQj9KDjRXoneR/ fcNYMSv4+CAObegFcxcEXkr9KiFKIpE4LBbEg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ds5ggo0KYCOoUcx5Ud+Osp3LLdRz+YmCRLT1YsdfZWo=; b=lOcZlFyD+9t4r+f33Q+tFaZ63HQ17lk0jNzNIAYi+LNT3WILi0pZeSIGK7VBQNj+w5 sVNt83itUYmtV0P4LBzPxkMdfUo9WVATRQIEUWO2odZrA9XUfwO7/Mlk1u2jRHRFFaL4 KgyrrBewnAIm1eL/ufP/R4dBjAyuKnGCFPy5Qof+bEzIX99EjTaMEb7ULWua/6B2RMXj yAIwOHrLtC36x4ULzQazI1KfrBy2ycvT67brVDXflDDpqWDT7dHKddcQfUFSE+WEdmhd HeC3v2HKfb+mDQY1Cjq3noWyFFx+M/knNRjwjk2L2hgCVfp3BP8jROuvsGQFx03L/Ihb pYbg== X-Gm-Message-State: AMke39mqcgNr5Zwa4cHv6tPr4WpEmE4xie2BJue95syVYS6TAYDC0Nq3wHSGvfVNWyoqnbY6 X-Received: by 10.98.194.153 with SMTP id w25mr32174191pfk.181.1487676404320; Tue, 21 Feb 2017 03:26:44 -0800 (PST) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id p66sm40508627pfb.88.2017.02.21.03.26.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Feb 2017 03:26:43 -0800 (PST) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 21 Feb 2017 16:56:08 +0530 Message-Id: <1487676368-22356-12-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487676368-22356-1-git-send-email-bhupinder.thakur@linaro.org> References: <1487676368-22356-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 11/11] xen/arm: vpl011: Modify handle_tty_read in xenconsole to redirect user data to vpl011 IN ring buffer X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Modification in handle_tty_read to write the user data to the vpl011 IN ring buffer. Finally this needs to be modified to allow user input for both PV and vpl011 consoles. Signed-off-by: Bhupinder Thakur --- tools/console/daemon/io.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 4e531e7..a59b4c0 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -877,6 +877,9 @@ static int ring_free_bytes(struct domain *dom) struct xencons_interface *intf = dom->interface; XENCONS_RING_IDX cons, prod, space; + if ( dom->vpl011_initialized ) + intf = dom->vpl011_interface; + cons = intf->in_cons; prod = intf->in_prod; xen_mb(); @@ -904,8 +907,9 @@ static void handle_tty_read(struct domain *dom) ssize_t len = 0; char msg[80]; int i; - struct xencons_interface *intf = dom->interface; + struct xencons_interface *intf=dom->interface; XENCONS_RING_IDX prod; + xenevtchn_port_or_error_t port=dom->local_port; if (dom->is_dead) return; @@ -918,6 +922,16 @@ static void handle_tty_read(struct domain *dom) len = sizeof(msg); len = read(dom->master_fd, msg, len); + + /* select the interface based on whether vpl011 console is + * enabled or not + */ + if ( dom->vpl011_initialized ) + { + intf = dom->vpl011_interface; + port = dom->vpl011_local_port; + } + /* * Note: on Solaris, len == 0 means the slave closed, and this * is no problem, but Linux can't handle this usefully, so we @@ -927,13 +941,14 @@ static void handle_tty_read(struct domain *dom) domain_handle_broken_tty(dom, domain_is_valid(dom->domid)); } else if (domain_is_valid(dom->domid)) { prod = intf->in_prod; + for (i = 0; i < len; i++) { intf->in[MASK_XENCONS_IDX(prod++, intf->in)] = msg[i]; } xen_wmb(); intf->in_prod = prod; - xenevtchn_notify(dom->xce_handle, dom->local_port); + xenevtchn_notify(dom->xce_handle, port); } else { domain_close_tty(dom); shutdown_domain(dom);