From patchwork Wed Sep 27 06:13:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114319 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665003qgf; Tue, 26 Sep 2017 23:16:29 -0700 (PDT) X-Received: by 10.36.179.8 with SMTP id e8mr1004254itf.58.1506492989338; Tue, 26 Sep 2017 23:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506492989; cv=none; d=google.com; s=arc-20160816; b=e1RqZhcKum66QRcm5Ib/Gs+PJkFDQqYtdgvwKscJiq+xIfbDod+EQXL2WeYa3XHgii APHA+sgYqTcEbFuk197udrBLpsntWwS0LUu2SZQxI/QgEzTuma/aXP9qfcX4RtIhMSkX DHShljfQhvQRZDqS5oqyyruWyK3uPLNvgd5Et9FoMQdWjvCzqnVZX45hN5vemVpbWJtk GDA8NhSwVtVp7C4DCm95aDpBjv4GQHVwzweccupr+YtE5eKNXITVbGVzTT8XVBI0UBmN UUxbbU/XpUEMSoZ6aLiesSGebmNxCM7UTkjiAI7uhoGoNBHUAmDoe6MMstGItknXQIlS ec+A== 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=EUocknFP1/4WLo8tbtI19J0u7VdgpEYuwErsmY6uzF0=; b=U6mj9ZZirZGiBxzPProsN065Rkj6bPCbNRN/RE68kj5E/6QuLvSZv2ngBfcjWQtDEd 3/AY0LJfbkmfX9veKmo7QZ5dd6UiXCwr9qDvs13EKfXE2LGMvUDEKklnxc5mL5VLk0Sz yhVF7u5NcU0ktimOiu4gXCXT0x/o3ym8MDGnrVJEsY3RR8f+XaGRMo2U/zFsF3KNj9Nw aejvz13Y6wpnQUMIqhyU2Ctq7ACHrh8TJn4ZLccaGd7QeWv1wHvaZyCOySG7twJZMjxU pgBPuQCYQArqASygLqzxFCyaOWonuFECRzPLag8cFgn08wpXl2iNJ3p0n9JfmtOtbKhy m8zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AmiTxhnx; 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 h129si3584291itc.90.2017.09.26.23.16.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:29 -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=AmiTxhnx; 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 1dx5bf-0002lM-Ix; Wed, 27 Sep 2017 06:14:03 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5be-0002j9-Fl for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:02 +0000 Received: from [193.109.254.147] by server-1.bemta-6.messagelabs.com id 69/2F-03414-9A14BC95; Wed, 27 Sep 2017 06:14:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsVyMfTANt1ljqc jDda2i1h83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlvt11kLWgRqDg59R9LA+Nq3i5GTg4hgemM Eg0fxboYuThYBOYxS8xaNY0JxJEQ6GeVmHG6mxmkSkIgT+Lnyf8sEHaaxNfXL9kg7EqJGW+uM 0FM0pI4emo2K0izkMAKJomHM/8DORwcbAImErM6JEBqRASUJO6tmgy2gFlgPqNE06ReNpAaYY FUiY0nkkBqWARUJY4/Xwk2k1fAR+L9re3sELvkJG6e6wS7hxMofrr/NhvEXm+JSyv7WScwCi5 gZFjFqF6cWlSWWqRrrpdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERhuDECwg3Hm Zf9DjJIcTEqivDX/T0UK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuC94XA6UkiwKDU9tSItMwcY+ DBpCQ4eJRHeayBp3uKCxNzizHSI1ClGe44Ldy79YeL40nsDSB7YcwtIdty8+4dJiCUvPy9VSp z3IkibAEhbRmke3FBYpF5ilJUS5mUEOlOIpyC1KDezBFX+FaM4B6OSMO9dkCk8mXklcLtfAZ3 FBHRW79QTIGeVJCKkpBoYjY52N1/h+/rb6P15cdaQB07PYvav2ZHYy7vc2tG0K0Pcysq8UMda TCZr0/SwxeV6Us0/36nq8zEvLBcW33a787VxyYWDdx127xCv37Wt4Izum/2cnU4fRboeNG78z JifGaOoys90wJr9V8PSBt7KOQ/2B+jwex/f+DShIKDG4NmDS4diI4OVWIozEg21mIuKEwEyxf 5pzwIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-27.messagelabs.com!1506492837!86883088!1 X-Originating-IP: [209.85.192.182] 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 9716 invoked from network); 27 Sep 2017 06:13:58 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-11.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:58 -0000 Received: by mail-pf0-f182.google.com with SMTP id e1so6758383pfk.1 for ; Tue, 26 Sep 2017 23:13:58 -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=1zZv5gMZFdWN6HyPnIRtGQbrCrYIkCirHr84Vy7ho9I=; b=AmiTxhnxgdHE4QI7+Zf54f2W/kpZGmjRizw7+oijw2ZgCCDwetQiFDYn0n+AzuKe1n 6QK2ZzusJXR9wQGLe4a5vM1Y90h9DPaIf/VrqC0Ck0UieOnmOOmUB12UHAlfAIp2QB63 vFDsNHKxZDZZmwSofHmavZ2S9WqYX15g82STk= 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=1zZv5gMZFdWN6HyPnIRtGQbrCrYIkCirHr84Vy7ho9I=; b=jE48YK8HRe+yeH09bQ6dauKNSfEgaFPl9W+TVn7CpyR6Wa4ZrKrN/AohQ0Wv6yNpRO BPoPk+lL27BdYaL7q7LD0SQ31UQa8dkERffMM6pw0ChBbJyxrbkGO0G8xtEL2h+ZQT04 0jCzxZDpVdXjLb+SmDggUMicBcNGCF7oTr2WQDNtB2itjT2rD6vtUHzkasiXPB0GWuEw x7S+wvi1JmHelKEntZWB266zeVr1hgKUW8fsvnxWt4tvdBhCP1EVcqaRt911/u/0QUiy x9ofITZkPmYKq7NgoXIwZs3p6GfV+QOkSVfSxiiXbg8r5dEQrOQ0lrxIKVdPydJKwnoK CLJw== X-Gm-Message-State: AHPjjUgObtjb1dPmMMm2zcXlJMooFMPdN9vT1geGQX2vgEpqdqVYy3b3 JdFBKGMVgwRSL26+r8fsbldRem2By04= X-Google-Smtp-Source: AOwi7QBs6f2E/o0mVjaV5gdeQCFP0iXjN4UNaDNBYo988fApxYam9U7//NHUuTXPLSzHb/oEPjWOXQ== X-Received: by 10.84.131.197 with SMTP id d63mr324005pld.320.1506492836746; Tue, 26 Sep 2017 23:13:56 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (h3.248.139.40.ip.windstream.net. [40.139.248.3]) by smtp.gmail.com with ESMTPSA id s187sm18013485pgb.82.2017.09.26.23.13.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:56 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:23 +0530 Message-Id: <1506492816-25954-15-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506492816-25954-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506492816-25954-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 14/27 v11] xen/arm: vpl011: Add a new maybe_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 maybe_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 Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v6: - Renamed add_console_tty_fd to maybe_add_console_tty_fd since it adds the tty FD to the poll list conditionally. - I have retained the reviewed-by tag as only the function name has been changed. 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 3483252..a0b35da 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -1067,6 +1067,22 @@ static void maybe_add_console_evtchn_fd(struct console *con, void *data) *((long long *)data) = next_timeout; } +static void maybe_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; @@ -1146,19 +1162,7 @@ void handle_io(void) maybe_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); - } + maybe_add_console_tty_fd(con); } /* If any domain has been rate limited, we need to work