From patchwork Mon Jul 17 13:06:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 9844925 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 C17166037F for ; Mon, 17 Jul 2017 13:09:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B41D226E4A for ; Mon, 17 Jul 2017 13:09:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8B4D28509; Mon, 17 Jul 2017 13:09:43 +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=-2.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB, 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 5948C26E4A for ; Mon, 17 Jul 2017 13:09:43 +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 1dX5ki-0004m7-Up; Mon, 17 Jul 2017 13:07:56 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX5ki-0004kb-6x for xen-devel@lists.xenproject.org; Mon, 17 Jul 2017 13:07:56 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id 9C/D6-27137-BA6BC695; Mon, 17 Jul 2017 13:07:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsXiVRtsqrt6W06 kwdY5TBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8ab0/UFK/krHiy5xN7AeJWni5GLQ0hgOqPE x49v2EEcFoF5zBJzX/SzgDgSAv2sEl9OzwLKcAI5aRIPN21jgbCrJL7MeglmCwloSRw9NZsVY lQrk8S1J8+BHA4ONgETiVkdEiA1IgJKEvdWTWYCqWEWmM8o0TSplw0kISwQJ7Gp7SjYAhYBVY m3rRfBhvIK+Ej0951ghlgmJ3HzXCeYzQkUP7NhNRPEYm+Jm0cmMk1gFFjAyLCKUaM4tagstUj X0FQvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMwtBiAYAfjt2UBhxglOZiURHkv smVHCvEl5adUZiQWZ8QXleakFh9ilOHgUJLg3bw1J1JIsCg1PbUiLTMHGOQwaQkOHiUR3q0ga d7igsTc4sx0iNQpRmOOSQe2f2HieDXh/zcmIZa8/LxUKXHeFSClAiClGaV5cINg0XeJUVZKmJ cR6DQhnoLUotzMElT5V4ziHIxKwryZIFN4MvNK4Pa9AjqFCegUYV+wU0oSEVJSDYyyx5Z5vd0 qP+O7zJrAmqy68AfPL3Tnl+j9vnsz9v37bTfmdE12eHm5RmSu7KtvH7itPH2fZb89/zoqzYrv r/7vAiH1ZXO2nXBdIOnQ0fMs4omKklRx9CK//VueKE29NSFgy7nHHqrCTBJO2aYfVadeMZDev 1jjnR8bi1FY3cliw4X/frSkap1VYinOSDTUYi4qTgQAlHw/h7kCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-13.tower-27.messagelabs.com!1500296874!97992867!1 X-Originating-IP: [74.125.83.53] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 43691 invoked from network); 17 Jul 2017 13:07:54 -0000 Received: from mail-pg0-f53.google.com (HELO mail-pg0-f53.google.com) (74.125.83.53) by server-13.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jul 2017 13:07:54 -0000 Received: by mail-pg0-f53.google.com with SMTP id 123so6572432pgj.1 for ; Mon, 17 Jul 2017 06:07:54 -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=JHD4TzvomNM6NaYwRVbF1nslo77q0LGaKotBxN/IgzA=; b=WlfS7K5fkAJ2R8AnNtfSsNscTaFC4n64DSU+Xl22Znv/MosO9i2qVY6OzLeFpFaP/S DhVuftB3qkepX8phriytCKcOU7tUchFnWZMn8s3NFPkMSui1vIB9WDjgda5qBSpUBLai Z2eQJlcLJlKExiSUG/B3/r1xbcjmavXp0ii+k= 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=JHD4TzvomNM6NaYwRVbF1nslo77q0LGaKotBxN/IgzA=; b=DnR1nDS21kR3PTnuxrKVNJZPtYL87MLGTtV3TjeTEsu5cwaXnZ81qGsMIEXCdR7ul+ LjUjjMa8cTOnqKRVBbIL1nwei97A9ozp1VPDk0n0OsU3phQYw1VqtR7WYPSjtE5z0m+d WIWT4sxO4NT5UaTxWwwBFDfmlcXYfIzHaVT8B4PyaNdCc9mL4OO42LxkR0385G7jfZtj IT9Vl12imvvkRV4QJAJrw0h1hbJyCkmROBKs/qqTu2EkhMJ9G+WI0K+uTfrEgogcbRNb R2Bi4HT1/bn0i4uuMsND+Dp4XcJRlPV/tpebNf5reMZryeMWND2+3o6S6IVIXSPEoF5P /zdw== X-Gm-Message-State: AIVw1119F0kaLyRdv9K1uZbP4S9sARYeDW+WFsdQkd2KtjBe1TWPAjlf zi1aLENbtbgikSZAqTk72Q== X-Received: by 10.98.69.219 with SMTP id n88mr18806284pfi.192.1500296873419; Mon, 17 Jul 2017 06:07:53 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id z69sm15705665pgz.42.2017.07.17.06.07.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 06:07:53 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 17 Jul 2017 18:36:47 +0530 Message-Id: <1500296815-10243-18-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> References: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 17/25 v6] 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 Acked-by: Wei Liu Reviewed-by: Stefano Stabellini --- 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 775fb04..4097673 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -1133,6 +1133,24 @@ static void 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; @@ -1263,22 +1281,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);