From patchwork Mon Aug 7 08:53:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 109525 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2481899obb; Mon, 7 Aug 2017 01:55:47 -0700 (PDT) X-Received: by 10.107.143.136 with SMTP id r130mr10454046iod.227.1502096147017; Mon, 07 Aug 2017 01:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502096147; cv=none; d=google.com; s=arc-20160816; b=V/e2+bi9civDLvG8h3iIt+51uDkR6ATx0NqQ4u/cwQbVm2fokykx7Lin7YTxyFx4co 7KxW12Nj4ybpU+ZLbPTZjhNdATmy2ohrikDusBCB64Ts090p1oTbe/bGsU+dJPaKtGvZ BePnY0Nr3YuGwG/UyFkrzR7eKJwvUWHP9nRA9KXdFeVeY8RwhuHbSgHzBGtAfILeNGM1 lGB2r3fkuvPgn/W7VqhT3gDobGzBVS9vv57pipSpPhXr2scJRheBRZO5N+LfRI6f2EnS dGks7W5q7ByRaS4DNUQgz+6CjcNxqr9mNzivDieYW8/+/XdQho8r8suoQSN2NHyZBo9B 6+jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=H8RR8P9mLK0Yb6u6N61ymtzG/1SrqORpSqVSo+gXTcg=; b=Kr8Ks/MKp6rHPM15BzJclJkHl75Cath4jwOi4kRJW/qxwLJk5t3blxerqHgzgEswq3 01T0Bu8P+ea1iR9cdOtEOomoFAsf/O7j1jIpkg6JkqA9xQKINOhcQBDLCcLG5wdas2yB HPhO+46JaZwjAs/CnTapWB0KCUuKSZc29BoOhdYGlKwd5Z+1iaQ9+3a8dTwOgH4S0D2F me1M5K867xCgfUNfvXwAhNLe2yhM4cyeiB8bUw72lU1qqS9VOhdj73TQUwp55X9nlzJG lf0skne65FO/eug3Z9GlTA1ji3Y3jsbzMwJViEfXlWDitH+67ajF2c5wlNnyk08pXcSq 02Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=Ov0yX3aN; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id m18si9137882ioo.193.2017.08.07.01.55.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Aug 2017 01:55:47 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=Ov0yX3aN; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dednq-0004yd-HJ; Mon, 07 Aug 2017 08:54:22 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dednp-0004wT-Ld for xen-devel@lists.xenproject.org; Mon, 07 Aug 2017 08:54:21 +0000 Received: from [85.158.143.35] by server-7.bemta-6.messagelabs.com id F0/29-03557-DBA28895; Mon, 07 Aug 2017 08:54:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRWlGSWpSXmKPExsXiVRusp7tHqyP S4OMzEYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPWqissBRMEKlZ83c/SwLiFt4uRi0NIYAaj xK9JfUwgDovAPGaJVVMnM4M4EgL9rBKnpixj7GLkBHLSJF6tfQZlV0nc2PyaBcQWEtCSOHpqN ivEqDYmiUUL2oASHBxsAiYSszokQGpEBJQk7q2aDLaBWWA+o0TTpF42kISwQJzEzkWLWEFsFg FViVtfr4HFeQV8JC4fOMAMsUxO4ua5TjCbEyh+/tIbqMXeEreP9TFOYBRYwMiwilGjOLWoLLV I19BML6koMz2jJDcxM0fX0MBMLze1uDgxPTUnMalYLzk/dxMjMLgYgGAH4/2NAYcYJTmYlER5 41e0RQrxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4H2k0REpJFiUmp5akZaZAwxzmLQEB4+SCO8Ld aA0b3FBYm5xZjpE6hSjMcekA9u/MHG8mvD/G5MQS15+XqqUOG+OJlCpAEhpRmke3CBY/F1ilJ US5mUEOk2IpyC1KDezBFX+FaM4B6OSMK8WyD08mXklcPteAZ3CBHTKm8RWkFNKEhFSUg2Mktz uex1b1DJy6uYZfua3XRIf67LtU71W2u2e+JuvRFjvi7AG9a+UL2E94HGEvWiKpuXuZcfDP8/P D9R7s++u9Nk++87XjIapjDasB5mP2ezaafI9LafJL36P7DOFVbuKuIylGNurfXyE5XvuvWZPv eMfO0n+rxn71GMpeimv3fun7mM/LqzEUpyRaKjFXFScCACDtf41ugIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-21.messagelabs.com!1502096059!73625359!1 X-Originating-IP: [74.125.83.46] 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 31648 invoked from network); 7 Aug 2017 08:54:20 -0000 Received: from mail-pg0-f46.google.com (HELO mail-pg0-f46.google.com) (74.125.83.46) by server-11.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 7 Aug 2017 08:54:20 -0000 Received: by mail-pg0-f46.google.com with SMTP id v77so31639938pgb.3 for ; Mon, 07 Aug 2017 01:54:20 -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=Ov0yX3aNbcYyz3rEkxC7Jj24UXoXKQTV1heD8+VZdmoc8aaHE20p4h/dwzspHr9W3S IRffSSg0oBmHrqX4BlB2Zvrs/E1JAESa0JPcwUaLgdQd/lgkuWKQl/ms+ZSwHrwdLIRd /sfaw6kWeyLJ1IqBzQefxDFljiNSHb0nGhgkY= 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=q/QjqV/z2GnFxEnhwLt8z9+t4Ht6EtcTg0ojUYp597vO/I02CqA6Z0mG60P+aajFQC sFa6Rze0ARUXMPte61h7Av220p74KWCA4i+0YXdi9dK05cozTyrb7kayWvI9M+FjbnZj nwWUugPQt0wvNaPvUZmlZb4XKLXGHBuHXxeVsi/IgrG77a4lZGVZA5EMcXIBSirYthsD Jhqih/NAgzvDLFPHd16iWMxz22j4U6bBcBfcSZww0YUAjKGtB066GbVxsVllivbyAdxp ZSQRpfk/0S6Kxj3IaAKbm/rPbFhEdPE/GvXUYjsdTaLz4mbNz4mICZv7Xa8GDnAX1yyL rStg== X-Gm-Message-State: AIVw113pkc1BpPSy3Grf+MzEs21r4Q9UB0fNrKOL9eXKzQQ3lJ2tVeqw tTxtS95OrHPaZ7mbamTjNQ== X-Received: by 10.84.234.15 with SMTP id m15mr13461607plk.247.1502096058582; Mon, 07 Aug 2017 01:54:18 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id p77sm12604047pfi.153.2017.08.07.01.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 01:54:18 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 7 Aug 2017 14:23:09 +0530 Message-Id: <1502095997-31219-18-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> References: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 17/25 v7] 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" 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);