From patchwork Mon Aug 28 08:56:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 111105 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4547947qge; Mon, 28 Aug 2017 01:58:43 -0700 (PDT) X-Received: by 10.36.53.71 with SMTP id k68mr5361357ita.10.1503910722968; Mon, 28 Aug 2017 01:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503910722; cv=none; d=google.com; s=arc-20160816; b=wH+rvHxT+KcZryHFfCU4vtpBLAJpf5UD3qIhtNLFn06PH/KKgy+4HuVP7MugTLP1Q6 VbWdnefRr2UB6z/RDZwDK7IIo0kSM7vHkvDEKUu8Yk8tLMvppMV3PTIRMRpOB3bWdNuR smeNf//va/Z55JCbD8AIlSdXfC5XZEWmbYq5RDuTV1H6GTisipWb5ZVcghoMIy59jCiT qYUJB2Sjtln8eOCjgGK5fkZF8e0PGB65zpdm4wrm5JukyVp/SiwO1s0umiBPMl32sAB8 PzfCL46AqNCqlc7mJ7sdvdAG+2IWrtpqdJiwK95DwX7NfWg3DW+ZT8JV83LZaLpDeSUx uzXQ== 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=jTpHVNZchfGTNLi0pWAGtASVGhZh6eAn+hVs/aU+ixHue4nL082PEYgCb6YWmNcT+r Q4x+K5rZOsNuE3kF0KKEeWuMZE/PNpXm5Qm+ZRY7Cu+3U4QzcpHtU+WHA2qmdabtN82H D0CeY2FDk9O9BGvaw7y5g9ULedGplg2BwmuU/y2Ws5+RVn+omnMHZjmnJHqKsJgQEtKO aNkMBMLZ06RP8A5uHdjKt1ajTkx2J8zSSynKH4Q/0ikzpNXHJ8mdXQ14UwEX7d2hDDS9 2pwZ8wyV+zoCUEEZe0xrdyYEN3TT7S3fynk2ZhGUa4esrgtCEif06CvrHck/wYi+G+Ep QULg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FVElzWjp; 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 37si12135437iop.51.2017.08.28.01.58.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 01:58:42 -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.s=google header.b=FVElzWjp; 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 1dmFrB-0005MW-8x; Mon, 28 Aug 2017 08:57:17 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmFrA-0005Ks-Ea for xen-devel@lists.xenproject.org; Mon, 28 Aug 2017 08:57:16 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id F9/1D-09901-BEAD3A95; Mon, 28 Aug 2017 08:57:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRWlGSWpSXmKPExsXiVRuso/v61uJ Igwf3OSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxZq66wFEwQqFjxdT9LA+MW3i5GTg4hgemM EpPfxnQxcnGwCMxjlvixcB0biCMh0M8qMXnCS3aQKgmBNIm3iz4wQdhVEhdaP7BCdGtJHD01m xWkQUhgP5PEywMrGLsYOTjYBEwkZnVIgNSICChJ3Fs1mQmkhllgPqNE06ReNpCEsECcxKJbk8 FsFgFViUe3NoAt4BXwkZj3/i3UMjmJm+c6mUFsTqD4jrV32SEWe0t0vf7AOoFRYAEjwypGjeL UorLUIl1Dc72kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3k/NxNjMDQYgCCHYy3NwYcYpTk YFIS5d1ZsThSiC8pP6UyI7E4I76oNCe1+BCjDAeHkgTvmZtAOcGi1PTUirTMHGCQw6QlOHiUR Hg/gKR5iwsSc4sz0yFSpxh1OSYd2P6FSYglLz8vVUqc1wekSACkKKM0D24ELOIuMcpKCfMyAh 0lxFOQWpSbWYIq/4pRnINRSZj3L8gUnsy8ErhNr4COYAI6QlFwIcgRJYkIKakGxiKZgKWcxf+ f/mng/HKOM/T15pJytsb/sTH/tG8GMF986DeLl89h57LExbNzdBeVn/XZd2Iie1rnwwWX4prm /Ix95v3p7SaWu0/WCyW+3nP8QV/nx9YPDxrr/O/92R9uWepilV6/S13LbsXOSdcP1D/VsVnwd cLBEvMQY2+fIg+9iVsNX3GUlimxFGckGmoxFxUnAgBjHgVGswIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-2.tower-27.messagelabs.com!1503910634!54195099!1 X-Originating-IP: [74.125.83.44] 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 22694 invoked from network); 28 Aug 2017 08:57:15 -0000 Received: from mail-pg0-f44.google.com (HELO mail-pg0-f44.google.com) (74.125.83.44) by server-2.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Aug 2017 08:57:15 -0000 Received: by mail-pg0-f44.google.com with SMTP id t3so22364040pgt.0 for ; Mon, 28 Aug 2017 01:57:14 -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=FVElzWjpYsI+iOlb+ZT9hC9iqqHSNJOeKtRRukO0D6ZpHK8LcDrVxGNuWWc7jTy9gl nZKd1TGPhdoZlzq+ofSBbngRRrkDgtuGx8g2YeWj0wtoB8hmOb7fp4cXCYSMhF/o4ay3 pGaCaS7nXm150sqwY86C1NZ5pasQwhjPevdLI= 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=i6TBEtIaoMxSQSMXLRKcJXWhDqY7oh3raNaTHcv016AhkaexKHSDFh3wo/Bg/bWi8U XyI+k5IthdD6nPwTQvS9cVUr5hAkxEpv5UBZ0pX1MLBpuU9/8Y7FW+8q9pITVbqjf6NL 6m4akgDXKZQgePPM9jmvjjOyWUPIqHPKaC2AUPbZtDg3Hl4cELxLL67feBKwMqGz/qnE Etn+sKIrPsgn0OpdDp4ig94Bhhzl3FpnDmVGjvqKLXDmjol+J9TJ/fzoTckHd6nYnNJN aDuCULDFIBQfPL7MHc0HFiV5z/ia6tCZ5hb+jmi9snG7fiPketqoORhFpVe6hxLilkY5 xNzg== X-Gm-Message-State: AHYfb5j8QgiDhaVAMmZozCCuu6vGQmPsBnejeHsmitwJpR6dKHbMeyd6 IcpTfG1dzSS31IOAl0Ozzw== X-Received: by 10.99.44.150 with SMTP id s144mr6533785pgs.318.1503910633540; Mon, 28 Aug 2017 01:57:13 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id d88sm21713569pfl.158.2017.08.28.01.57.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Aug 2017 01:57:13 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 28 Aug 2017 14:26:00 +0530 Message-Id: <1503910570-24427-18-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> References: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 17/27 v8] 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);