From patchwork Mon Jul 17 13:06:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 107934 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4494898qge; Mon, 17 Jul 2017 06:09:18 -0700 (PDT) X-Received: by 10.107.145.132 with SMTP id t126mr4635555iod.127.1500296958869; Mon, 17 Jul 2017 06:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500296958; cv=none; d=google.com; s=arc-20160816; b=MXW7SYmAVrDpT7YxqSyvJvW8dBX6drumod9kjg5Qn8mtwDHvjI4wHQR8SEXN4l+6oi D72z4ZTHzngsI97ggEXNIUoXV8rfMeoBd6TTGvlWuC2Ye6urBUZt21HP+I6oJaPFZ605 ucsmUUxnYvrhMndpHipEDbB2ZpSemzZ3ilbUmPeBhDzQ5XR6mpkzVIGuA8rlmxdguKre OXzAgrR+VrEKwTgPJqYGHyW0fgclgVYIvubX8HQSxHCrtqmGlVwbQfreHmnpMkMeiIff YeN1+BKTG06iPNw8z5mMkEXi56ZfmdhP77IkjsGlRT/4UVd4iAoiywHt+nToKbhbpVIj 3sMA== 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=WlEyFl9DG9m8dLSRc3GfM3gemuMFCIDZJjq8bSCnu2k=; b=ZOBDBojhbGvq5QQRPBkPu8HWbR54+HgwA0jDgtCIR7X/ESd74CHC4XEC+8+EJi2Ux5 6K9eeU1/KCuClWiuLYy/0m8Qbw3e1A1ar31M24lZ2Gg1d4rsb6u5Z9rByp9mbLJWkpbL L9XSgOiULWY1itcnr0bJjTs8ewrhyh2vBbXHcGdbPD3INGep46HWNDpsNnu082TTKGoC f81pS0ypMx6f/RF7nrY5TFVneJkZNTGFX8TiL5XcYOpFOT8FL0UTNfCqwRTQhHE+78Gi O/gk7JJciLqXXU5C/oeqBuZ4Xnv61JnD8eTY3F9JSjNa1hUlEWI3NxflXfFm3sCGmO0T Vdjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=Kd6I00N8; 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 p63si15846774iop.13.2017.07.17.06.09.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 06:09:18 -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=Kd6I00N8; 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 1dX5kc-0004cS-6g; Mon, 17 Jul 2017 13:07:50 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX5kb-0004aq-6C for xen-devel@lists.xenproject.org; Mon, 17 Jul 2017 13:07:49 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id DC/FB-01732-4A6BC695; Mon, 17 Jul 2017 13:07:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsXiVRtsprtoW06 kwZujihbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8b/tj+sBSt5K15tEm9gbODuYuTiEBKYySix YtczZhCHRWAes8TcfR/BHAmBflaJmZ+62LsYOYGcNIlvkzYzQdiVEhvfrWMBsYUEtCSOnprNC jGqlUni2KQfjF2MHBxsAiYSszokQGpEBJQk7q2azARSwywwn1GiaVIvG0hCWCBO4sfS6awgNo uAqsSaa98YQWxeAR+JnV9nQi2Wk7h5rpMZxOYEip/ZsJoJYrG3xM0jE5kmMAosYGRYxahRnFp Ullqka2isl1SUmZ5RkpuYmaNraGCql5taXJyYnpqTmFSsl5yfu4kRGFoMQLCD8d82z0OMkhxM SqK8F9myI4X4kvJTKjMSizPii0pzUosPMcpwcChJ8G7emhMpJFiUmp5akZaZAwxymLQEB4+SC O9WkDRvcUFibnFmOkTqFKMxx6QD278wcbya8P8bkxBLXn5eqpQ47wqQUgGQ0ozSPLhBsOi7xC grJczLCHSaEE9BalFuZgmq/CtGcQ5GJWHeTJApPJl5JXD7XgGdwgR0irAv2CkliQgpqQZGNTe NtcUfWPgtX2RH2d6pevtXqjLCs4/h491pvq5XOQ6x7iiViBX7/dHxzN40HS0bkVdtLxPn1JU8 qBZMVF4yPUvnNhunympPUatSiT0psU8yJhqZfZv8P2z1JWaRpEVnq8tO3ouzFj+y6XfM/YqbY VV+qvOjtzX+W3yKu75qycROpSC5AH8lluKMREMt5qLiRADx7jnpuQIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-3.tower-206.messagelabs.com!1500296865!99644104!1 X-Originating-IP: [74.125.83.54] 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 13156 invoked from network); 17 Jul 2017 13:07:46 -0000 Received: from mail-pg0-f54.google.com (HELO mail-pg0-f54.google.com) (74.125.83.54) by server-3.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jul 2017 13:07:46 -0000 Received: by mail-pg0-f54.google.com with SMTP id v190so21524030pgv.2 for ; Mon, 17 Jul 2017 06:07:46 -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=K3DWX8wlmctzvNAdmVkRyZxAZgZLbbj8ag0TSca/pNM=; b=Kd6I00N8UQOX0mQe/BCjMiX8UWR7yQvgmogaA/9vMKN3hBRghbSbP3GE+XE5y5UHto RUsLZyZcunUwo7AjDE+If9uM0wofGxce/OwEQHarwsWsqKovanDpxet3Fdf+mmxnnLxi vCix/Eruh5xwgUxs0voQKdyV7esrmXWzr2Aps= 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=K3DWX8wlmctzvNAdmVkRyZxAZgZLbbj8ag0TSca/pNM=; b=L8uHZ++1gPNlKS8/X9jVeYlsi0pM/2SNX4aD3xPCXNWb1TkPRNeMEC02ryomAhg0uJ LtB3sL3+GWysZwE3YpInDWcML2C5Z03ZCWqvtIEzwV3aUTTDOOd3R29A92CRveeTXvDk ZQWLjJLcOTCXntuCXjW/eIni9PG0tY6luLadhca6mx5hds8mH1tTCG4TrF4Ny8RFsVyQ zyZ3pwyuq+F86l233DZmAwMGfc9eCmk0UZGppxcRp1DK45gyKBlJggDXsE1rVLYj12cx nKldLr03hYPQWlh85Y2Wr9cWbl5QzlsBi9G/hz9tsAGlpzxs8sY27rn/9vpwv+iv1sHJ E+lQ== X-Gm-Message-State: AIVw110IEDb6mhFzb2hFiKoxPUUz5w1iPaaAzCp9tTLqzEaNj/VR7cLZ YEXEOUp+QX0wtsgC4HA94Q== X-Received: by 10.99.166.17 with SMTP id t17mr29247071pge.60.1500296864922; Mon, 17 Jul 2017 06:07:44 -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.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 06:07:44 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 17 Jul 2017 18:36:44 +0530 Message-Id: <1500296815-10243-15-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 14/25 v6] xen/arm: vpl011: Add a new add_console_tty_fd 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 add_console_tty_fd function. This function adds the tty fd to the list of polled fds. Signed-off-by: Bhupinder Thakur 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 | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index dc96203..6321d78 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -1069,6 +1069,22 @@ static void add_console_evtchn_fd(struct console *con, void *data) *((long long *)data) = next_timeout; } +static void add_console_tty_fd(struct console *con) +{ + if (con->master_fd != -1) { + short events = 0; + if (!con->d->is_dead && ring_free_bytes(con)) + events |= POLLIN; + + if (!buffer_empty(&con->buffer)) + events |= POLLOUT; + + if (events) + con->master_pollfd_idx = + set_fds(con->master_fd, events|POLLPRI); + } +} + void handle_io(void) { int ret; @@ -1148,19 +1164,7 @@ void handle_io(void) add_console_evtchn_fd(con, (void *)&next_timeout); - if (con->master_fd != -1) { - short events = 0; - if (!d->is_dead && ring_free_bytes(con)) - events |= POLLIN; - - if (!buffer_empty(&con->buffer)) - events |= POLLOUT; - - if (events) - con->master_pollfd_idx = - set_fds(con->master_fd, - events|POLLPRI); - } + add_console_tty_fd(con); } /* If any domain has been rate limited, we need to work