From patchwork Mon Sep 18 10:32:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 9956355 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 C6D3260208 for ; Mon, 18 Sep 2017 10:35:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5FEC28B21 for ; Mon, 18 Sep 2017 10:35:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAF8228C09; Mon, 18 Sep 2017 10:35:10 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham 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 D53EA28C17 for ; Mon, 18 Sep 2017 10:35:08 +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 1dttMZ-0002PX-IC; Mon, 18 Sep 2017 10:33:15 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMY-0002O3-OW for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:14 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id CF/A5-03422-AE0AFB95; Mon, 18 Sep 2017 10:33:14 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTAKt3nC/Z HGvQsFLP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDNmrbrCUjBBoGLF1/0sDYxbeLsYuTiEBGYw ShxdfI8ZxGERmMcscf3lWzBHQqCfVWL3zgksXYycQE6axPn7C+HsSc9+sEPYVRKL9jxgBLGFB LQkjp6azQoxdgeTxP0XrUAOBwebgInErA4JkBoRASWJe6smM4HUMAvMZ5RomtTLBpIQFoiTmL ZmGiuIzSKgKnH+zRWwobwCPhJ9b89BLZaTuHmukxnE5gSKn1//gBVisbfEvF9XGCcwCi5gZFj FqF6cWlSWWqRrrJdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERhyDECwg7Hjn9Mh RkkOJiVRXtHI/ZFCfEn5KZUZicUZ8UWlOanFhxhlODiUJHjFgSEsJFiUmp5akZaZAwx+mLQEB 4+SCO+6+UBp3uKCxNzizHSI1ClGS44Ldy79YeI4sOcWkOy4efcPkxBLXn5eqpQ47zuQBgGQho zSPLhxsAi9xCgrJczLCHSgEE9BalFuZgmq/CtGcQ5GJWHeRyBTeDLzSuC2vgI6iAnooJYde0A OKklESEk1MGqrtj7x9K978H09R38Hyzkd9z9R65qvbOrysU7SqJQ+Icqt9MJoltbs+fGdUasu bqt/xR0gUOhauTbyQL/cFRcvgZI7+8IUZWZe8gkWvfigu2zdzerZx0pqWRTuf/s+JyD95dPPJ z8mitawNXQcX6Sx+eykah2zUxzPP8pJBrs28Fbaz+P6ocRSnJFoqMVcVJwIAL+0UXLLAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-6.tower-21.messagelabs.com!1505730790!60301954!1 X-Originating-IP: [209.85.192.170] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 58324 invoked from network); 18 Sep 2017 10:33:11 -0000 Received: from mail-pf0-f170.google.com (HELO mail-pf0-f170.google.com) (209.85.192.170) by server-6.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:11 -0000 Received: by mail-pf0-f170.google.com with SMTP id d187so25280pfg.11 for ; Mon, 18 Sep 2017 03:33:11 -0700 (PDT) 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=cKW4VVAXHwcprLM7odui2WUoZIfS5KdXFh4XFIsCHUU=; b=Es444/zXtl+Yv9d5Vtzom55XvY4vvXYOEJz1rDGz+K7+FgFM6VTn0P1SstaI3Qz2/9 cNW5DWYyPKmS3OgLulw19kvR8SF98c3cvi9QhI5vFVQGo4FaZxq54iUr3Md1DTazp/qR n2poLHJ5j5sIkyq9hQ5xQji6lMJJbettR7e4k= 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=cKW4VVAXHwcprLM7odui2WUoZIfS5KdXFh4XFIsCHUU=; b=GIkwjJU5iM9YDi3+ReKtdS0qP4jTKBgb7cGOwMKrd0uPi75kTq9amoJlxFmjyZ2yAq u+QbcJFpbWja1H/hrN1Bsr54xUCI43ntK1x7jBBsVQyHNYpzJIfuVN98wrFURLt1rbFn uuV5fKe2TY94zHRhz6EV8WWU12x1p5BTTeBjcCUozBOfpZLh6gtLw04lKT/ETSKkpGlo sUimcHr+dngPJwdRf32ngGVXuep88QHsPmj4EA3orPFDJlH8Unih5vF3IVucsEVNirRt LLtoWCnNs5AMy6l34yXvvnUzo/QD89vWMDLZg+u21TMpa5RbEt0AI1P+eYcBCSBtDU/i 1VEg== X-Gm-Message-State: AHPjjUgwY+tl7Lt4MbiACIsYpflWDy9P03RU0i5KrOfjYKrtJlAWnca7 tE8NoS57xl6ImkKKxtxwvg== X-Google-Smtp-Source: ADKCNb7wO10aZgvuwVBG8jNK2s/m44WbKrlsBE+Z4D2f/AT2kg5OmVCZmaWvliIcGgxA3RSJ+tdq/Q== X-Received: by 10.84.129.193 with SMTP id b59mr35024711plb.64.1505730789616; Mon, 18 Sep 2017 03:33:09 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:09 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:01 +0530 Message-Id: <1505730731-10947-18-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 17/27 v9] xen/arm: vpl011: Add a new handle_console_tty function in xenconsole 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 This patch introduces a new handle_console_tty function. This function performs read/write from/to console tty. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v5: - Split this change in a separate patch. tools/console/daemon/io.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index c361b42..5c6da31 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -1130,6 +1130,24 @@ static void maybe_add_console_tty_fd(struct console *con) } } +static void handle_console_tty(struct console *con) +{ + if (con->master_fd != -1 && con->master_pollfd_idx != -1) { + if (fds[con->master_pollfd_idx].revents & + ~(POLLIN|POLLOUT|POLLPRI)) + console_handle_broken_tty(con, domain_is_valid(con->d->domid)); + else { + if (fds[con->master_pollfd_idx].revents & + POLLIN) + handle_tty_read(con); + if (fds[con->master_pollfd_idx].revents & + POLLOUT) + handle_tty_write(con); + } + } + con->master_pollfd_idx = -1; +} + void handle_io(void) { int ret; @@ -1260,22 +1278,7 @@ void handle_io(void) handle_console_ring(con); - if (con->master_fd != -1 && con->master_pollfd_idx != -1) { - if (fds[con->master_pollfd_idx].revents & - ~(POLLIN|POLLOUT|POLLPRI)) - console_handle_broken_tty(con, - domain_is_valid(d->domid)); - else { - if (fds[con->master_pollfd_idx].revents & - POLLIN) - handle_tty_read(con); - if (fds[con->master_pollfd_idx].revents & - POLLOUT) - handle_tty_write(con); - } - } - - con->master_pollfd_idx = -1; + handle_console_tty(con); if (d->last_seen != enum_pass) shutdown_domain(d);