From patchwork Wed Sep 27 06:13:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114338 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665448qgf; Tue, 26 Sep 2017 23:17:06 -0700 (PDT) X-Received: by 10.36.50.150 with SMTP id j144mr903574ita.52.1506493026045; Tue, 26 Sep 2017 23:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493026; cv=none; d=google.com; s=arc-20160816; b=I9AkD+wA5LwAssFPm5Hq/M+c8nMNwzUswiRrV38+RREj2jYLR/wrQ5o3yS7CqnMF+m N6jqRsdkaZi50bIyZWZs2NK+8BolCJ0XApPmWraLEQSYHlig8hLR99XT48dWvQ63U5kk 1aopJunDXDaZFo6232sL3woSl4LTi9TNjEiUjbA3qLiU/32zYjWQcYUjtDRb/8Sf62Xk TmQfQLeltb1FkEl9HoBOPgd4Wd3OwWCB/YAFweS624TB4jvahbuzLOTg6+TKQeDT5cJt /ACnwAffL9g4+Euhumu3MGC3ij+ZeAmKXUB0Ak6ZMpZ1pwBcdi7+wvwjC8Grpz5iBQlt WDVw== 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=UUk80xfYWEl3tHJQairDKMzhjTXbABUI39P62I2TePo=; b=XpviKxunkNRZ08LQMV2PeXrLMGhUohl6478THm2yK7vzFectdSU6XLZOju3GHXQWgA QuIM6x61NI+mRFxgZwHK6QbIZ/kV0d3knmjZO6Z63uiH/cuwXQP/4wQQT65xPFl/c0x7 jiefQzkkYRO1k5BLIvT6so9T3jMACRpJEId11MudnBp1lSyQRviITsGiLRu06LQxUeJJ g/EgDyep3QER6fHKBkykE4zI5w7O4yOhnBYgaTu/Jw7FMnnTuEOy+vNI4+hPa/mT72hf aEOlPN5+R3SwnOjhbCIN6FG/xW2PbEP29XxpN0g9Ms1O+1McBhjFQYjrm6ltU2bPBoke y9ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fomsjdRe; 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 x88si3482130ita.38.2017.09.26.23.17.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:06 -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=fomsjdRe; 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 1dx5bN-0002PK-Q9; Wed, 27 Sep 2017 06:13:45 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bM-0002Oi-Lg for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:44 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id DD/82-10804-8914BC95; Wed, 27 Sep 2017 06:13:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRWlGSWpSXmKPExsVyMfTARt1pjqc jDeZ/07X4vmUykwOjx+EPV1gCGKNYM/OS8isSWDNWTrvOXrBbuuLD6VmsDYwHxLsYuTiEBGYw Suy5fo0VxGERmMcssWP1PzBHQqCfVWJvwzaWLkZOICdP4u+yDewQdprEpJvToOwKicU7roDZQ gJaEkdPzWaFsFcwSexbqtPFyMHBJmAiMatDAiQsIqAkcW/VZCaQ+cwCFxglZv59zgaSEBZIll jVNwFsF4uAqsSRFc1gNq+At8Tb3ZPYIHbJSdw818kMYnMK+Eic7r/NBrHLW+LSyn7WCYyCCxg ZVjFqFKcWlaUW6Rqa6CUVZaZnlOQmZuboGhqY6eWmFhcnpqfmJCYV6yXn525iBIYcAxDsYLy+ MeAQoyQHk5Iob83/U5FCfEn5KZUZicUZ8UWlOanFhxhlODiUJHjnOZyOFBIsSk1PrUjLzAEGP 0xagoNHSYQ3CiTNW1yQmFucmQ6ROsXoynHhzqU/TBzHNl0Gkl96bwDJA3tuAcmOm3f/MAmx5O XnpUqJ81aBNAuANGeU5sGNhkXuJUZZKWFeRqBjhXgKUotyM0tQ5V8xinMwKgnzJoNM4cnMK4G 74BXQcUxAx/VOPQFyXEkiQkqqgVH86+rZqqoeyx4Wzp56PLz8oJmu38noZr0f8ptXcPos0Lz6 5Za8P89ztpvXa3IDH7yodHwxRTKbb/XbVIOz/xqXVrMrOz5lyQyzinVLPszZFc5xIjSNVfKx8 P/Fzbd3H6k9d33P6tXMk5Pc2rvqRXb4cnjNKdf9kiZ0yEzuW2iq8PXzPJMU1ZVYijMSDbWYi4 oTAbaUH2bXAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-27.messagelabs.com!1506492821!113221474!1 X-Originating-IP: [209.85.192.177] 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 8304 invoked from network); 27 Sep 2017 06:13:42 -0000 Received: from mail-pf0-f177.google.com (HELO mail-pf0-f177.google.com) (209.85.192.177) by server-5.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:42 -0000 Received: by mail-pf0-f177.google.com with SMTP id r68so6749519pfj.3 for ; Tue, 26 Sep 2017 23:13:42 -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=iEjfZLGFpkTJbmA53YBiJXpiNqpkjy4JrF6UOsZuq6Q=; b=fomsjdRefx1dFb6CfW/8OGNeH3RCe0bl8ld/emFze6SY/uJoV6XIqoSegIzlpL+YtJ HCaCkX484VwNh72LFthmku/j5+q8quv4EA2Pqkc+8tV9cJkBtRaZCX/fjAW6fF+zkaE+ Fnn0z0/CZATNK2XMHa7ZPRzR7wsVDlxq1gdOE= 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=iEjfZLGFpkTJbmA53YBiJXpiNqpkjy4JrF6UOsZuq6Q=; b=Em8tHOLhNPVYD1y8wvLPhRINCFUsJ0s1/Bb+oWb4hiTInhVV2gy0jXn5z9GMQhV872 CbFe+3wfszkr0RRVZKjwo/rx3Mx3QEJxoP+QU803dz12ClNZQ5g+rvjvbuTW5Mce1sOP j3NUcwB8BIA9q42nP2oLNftW1dStsbcTONNtjlk+l/acvHTV3bFhsc2Xj0qL7HCBo6G+ SrT7SeGIGbRUGo8rzOlqLGyqcCwh5Lj3Wt6XjV/B7i6sKtlbT9VEUu8bV7uif8/nYBKT PadITeffb2RGTx2bz2TnJzfjEhRVgJY81BWtAOLutqlDUHoNuzqYw+irDLthGM9Xm/km PSbQ== X-Gm-Message-State: AHPjjUjGf+LLcMTiznJxkKqsZ0cgs4maf79Yx/N1hr5/cVfgK8KIsPuT flzCxchvurlTB3F1aYoI4qg3LTtEeJU= X-Google-Smtp-Source: AOwi7QC9uGPtzo7d0S2WQMzpqCDRmstthE3Dsos8MxzLbwRIxHwOJ55MB0nbaDzzQWhDo8I35VFLHQ== X-Received: by 10.98.200.197 with SMTP id i66mr329637pfk.73.1506492820973; Tue, 26 Sep 2017 23:13:40 -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.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:40 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:10 +0530 Message-Id: <1506492816-25954-2-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 01/27 v11] xen/arm: vpl011: Define common ring buffer helper functions in console.h 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" DEFINE_XEN_FLEX_RING(xencons) defines common helper functions such as xencons_queued() to tell the current size of the ring buffer, xencons_mask() to mask off the index, which are useful helper functions. pl011 emulation code will use these helper functions. io/console.h includes io/ring.h which defines DEFINE_XEN_FLEX_RING. In console/daemon/io.c, string.h had to be included before io/console.h because ring.h uses string functions. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu Acked-by: Konrad Rzeszutek Wilk Reviewed-by: Stefano Stabellini --- CC: Ian Jackson CC: Wei Liu CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Julien Grall Changes since v10: - Fix for the headers.chk/headers++.chk compilation failures when code is compiled natively. 1) Inclusion of DEFINE_XEN_FLEX_RING in console.h had to be put under !defined(__STRICT_ANSI__) check as console.h is __STRICT_ANSI__ currently since it is part of headers.chk. 2) Also string header file had to be added as a pre-req for headers++.chk to pass the compilation because c++ does not define __STRICT_ANSI__ and thus expands DEFINE_XEN_FLEX_RING, which looks for memcpy(), size_t declarations. To satify that requirement string header file had to be added a pre-req for header++.chk. Changes since v4: - Split this change in a separate patch. tools/console/daemon/io.c | 2 +- xen/include/public/io/console.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) tools/console/daemon/io.c | 2 +- xen/include/Makefile | 1 + xen/include/public/io/console.h | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 7e474bb..e8033d2 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -21,6 +21,7 @@ #include "utils.h" #include "io.h" +#include #include #include #include @@ -29,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/xen/include/Makefile b/xen/include/Makefile index 1299b19..c90fdee 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -98,6 +98,7 @@ PUBLIC_C99_HEADERS := public/io/9pfs.h public/io/pvcalls.h PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/xsm/% public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS)) public/io/9pfs.h-prereq := string +public/io/console.h-prereq := string public/io/pvcalls.h-prereq := string headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile diff --git a/xen/include/public/io/console.h b/xen/include/public/io/console.h index e2cd97f..0f0711f 100644 --- a/xen/include/public/io/console.h +++ b/xen/include/public/io/console.h @@ -27,6 +27,8 @@ #ifndef __XEN_PUBLIC_IO_CONSOLE_H__ #define __XEN_PUBLIC_IO_CONSOLE_H__ +#include "ring.h" + typedef uint32_t XENCONS_RING_IDX; #define MASK_XENCONS_IDX(idx, ring) ((idx) & (sizeof(ring)-1)) @@ -38,6 +40,10 @@ struct xencons_interface { XENCONS_RING_IDX out_cons, out_prod; }; +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +DEFINE_XEN_FLEX_RING(xencons); +#endif + #endif /* __XEN_PUBLIC_IO_CONSOLE_H__ */ /* From patchwork Wed Sep 27 06:13:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114340 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665499qgf; Tue, 26 Sep 2017 23:17:09 -0700 (PDT) X-Received: by 10.36.123.200 with SMTP id q191mr830265itc.83.1506493029007; Tue, 26 Sep 2017 23:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493029; cv=none; d=google.com; s=arc-20160816; b=QzjK53yxwHyxd7p3N2Fe7u9ari4GFhNnKhVqOYHce0X+avGUGJM6VmXhe2ybx+veIE QPKb+XKDB+uN3gBI4xZ9sVmNAy9/cMdfISPuijJNUYcnmo5zIU2yy3W1kWLXuqvzKxR2 8ZOH8agUMD27ItMkjPSz3PvbGAm1FhOP6UV0lPJoqtCyqOsQ5oToOAZiPHJI1/v1ySax 6K3vDVuD6uY/5at4tbI9oAEj+jeenyU7XMuVdOImXXiNzbThfYTouZmSu2ypfxzCwNxf mwiR+rk/c9r5JWwd3BfNxhKmhblxBEsdmfOJ0HeMLpX4CCMzkvEVS6+u/a7ojUrZ/Cqv ZPFA== 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=gCQLR2+7QN2q45s5X27tQdIkMlSacKEnQX6ge3WR0Mc=; b=LgHYz6W7dsogYxWPOncBmAUKgR2r0s1gxvKaAoGb4sSTIa8E4EQ9tkiQJpCvUvLjiu yO2diJXx5U/M/O0QUIX0H93BQwqvnY0fy3HW/z3I6lB5WGO7hFqeRxOpKZ/kBytzFFzJ kp8OgGkkTwiqAnMjVBxrbG+NWXZ6T+LyOML461b3YdKwei8akKHZ4PMQZuOlaDHeEm+U GjfThW+M7IEOX5Zk88ZBXSFWweNShTOe6dxcJU2U58x4ZEeasdFLto9akXvUjYf51+4l Ro7XZ7+4Ztlrea5GI6WldhgBG5JsG8lcnfiN9gFZcD5Kq2WWIGK+RXkthOyOXjQ8Rdmb QkPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ul8YeTiB; 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 u2si3589990itu.110.2017.09.26.23.17.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:08 -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=Ul8YeTiB; 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 1dx5bQ-0002QJ-7k; Wed, 27 Sep 2017 06:13:48 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bO-0002Pe-N0 for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:46 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 2F/AE-03414-9914BC95; Wed, 27 Sep 2017 06:13:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAIsWRWlGSWpSXmKPExsVyMfTAat0Zjqc jDfpPmFl83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnHV+xjKdi2nLGi/fQs5gbG5Q2MXYxcHEIC Mxgl9vXNZe9i5ORgEZjHLDFtqQdIQkKgn1Xi79UdTF2MHEBOnkTvp2qQGgmBNInO+8+ZIOwqi dVTX7CB2EICWhJHT81mhRi6gkmi++4vZpBeNgETiVkdEiA1IgJKEvdWTQbrZRaol1i0aRsLiC 0s4CXxZ/NHFogbVCU6rrWxgti8At4Su5b2sEPskpO4ea6TGcTmFPCRON1/G2qvt8Sllf2sExg FFzAyrGLUKE4tKkst0jWy1EsqykzPKMlNzMzRNTQw08tNLS5OTE/NSUwq1kvOz93ECAw5BiDY wXhgUeAhRkkOJiVR3pr/pyKF+JLyUyozEosz4otKc1KLDzHKcHAoSfDGOZyOFBIsSk1PrUjLz AEGP0xagoNHSYQ3CiTNW1yQmFucmQ6ROsUYyHHhzqU/TBwHJlwBkl96b4DYe24ByY6bd4HkJj C54fuDP0xCLHn5ealS4rxVIIMEQAZllObBrYFF9CVGWSlhXkagw4V4ClKLcjNLUOVfMYpzMCo J8y4EmcKTmVcCd80roEOZgA7tnXoC5NCSRISUVAOjqH/em++b8m8d5V3dK/b5W2680RFGp2c/ 9qWenxPLvzvjD3/CBJ0d8eq9dm/8tK/dYn2j7Om88rHcjIMzLN9e+FrxWal3l+DrSxeVrDZwO bNnXrkgrVt9kkdMm/PhpVt1ezv9dk1STHh/iu3Pec6aD7zhO62tHly27Vjk39HUHih8WXBtuc MzJZbijERDLeai4kQAOaem2uMCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-21.messagelabs.com!1506492823!76795212!1 X-Originating-IP: [209.85.192.171] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 43058 invoked from network); 27 Sep 2017 06:13:44 -0000 Received: from mail-pf0-f171.google.com (HELO mail-pf0-f171.google.com) (209.85.192.171) by server-5.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:44 -0000 Received: by mail-pf0-f171.google.com with SMTP id b70so6746358pfl.8 for ; Tue, 26 Sep 2017 23:13:44 -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=FIIEoGYJlDlQOlB1rNCGAkalKS3RzS1n2lan1ceAzBg=; b=Ul8YeTiBsppDtTB6CATBmC/NnDoJsMpR2U4SuOdQCqKAIrppXmQDwrsWVsC8NOMn7o 54VyDImB0mEL2ldQJ0sc3AlwBzCns6MTmhjHNUgOyIDhPZhqI/kG5KpvbzbCdU2YgOiJ 6LPbFGK7mAm3JDpNiwFYMSlhB4+WN+3EaJfrc= 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=FIIEoGYJlDlQOlB1rNCGAkalKS3RzS1n2lan1ceAzBg=; b=EVPKr/Y0jRlqRNQgXK2ZJaUq5SULdPp6Jo8rzmb0fcbvBHa7LMj4lTVkUIQwqft9jz POfLN0V7pdA3uZu5+RxIgZr1Gg3wA+oZeFHNHtEmXoi1J5a+IC/P6O6kUeK7fpXq2qs1 NdF/9TnHRt4UzNJqbnSeHEfOnibs/llIkw+xRfqr60ojRRd22Me2Cpu426zbEgQ7oL4J O5IUeBTMhK1afcQYrPGe9IhXxX4mMrYorZCDqJ/El4m2XPUmPAwA5Ocpzv6WfbA7x8Rd 6ldRhWk7pLrYddby7dYe0iMXqYfSqX2qYETD4LLyuZUes3CzRkg0qDUOeJQK/bME2zoc uULA== X-Gm-Message-State: AHPjjUgZikd3Dmn12pkEm+9KYCv4ftC9iBOFB5pyVgIbp75vETdZfQuH XfmqtcHfVYtf/3WZ6vP89KirMTMd41k= X-Google-Smtp-Source: AOwi7QD8p6WobMxb4ttvpDieZu+gVYufhXtC7SCjwcKlz53l4HqM4rxtPwk9pMDghgCT+uBeUn6PCQ== X-Received: by 10.99.109.142 with SMTP id i136mr324912pgc.353.1506492822544; Tue, 26 Sep 2017 23:13:42 -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.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:42 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:11 +0530 Message-Id: <1506492816-25954-3-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: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 02/27 v11] xen/arm: vpl011: Add SBSA UART emulation in Xen 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" Add emulation code to emulate read/write access to pl011 registers and pl011 interrupts: - Emulate DR read/write by reading and writing from/to the IN and OUT ring buffers and raising an event to the backend when there is data in the OUT ring buffer and injecting an interrupt to the guest when there is data in the IN ring buffer - Other registers are related to interrupt management and essentially control when interrupts are delivered to the guest This patch implements the SBSA Generic UART which is a subset of ARM PL011 UART. The SBSA Generic UART is covered in Appendix B of https://static.docs.arm.com/den0029/a/Server_Base_System_Architecture_v3_1_ARM_DEN_0029A.pdf Signed-off-by: Bhupinder Thakur Acked-by: Julien Grall Reviewed-by: Stefano Stabellini --- CC: Stefano Stabellini CC: Julien Grall CC: Andre Przywara Changes since v7: - Set/clear the TX interrupt status bit based on whether space available for 16 bytes in the ring buffer - Clear the BUSY status bit as soon as space becomes available in the ring buffer Changes since v6: - Removed freeing of mmio_handlers in vpl011_deinit() as the handlers get freed when a domain is destroyed. Since this is a minor change, I have included the reviewed-by and acked-by tags. Changes since v5: - use instead of for including arm specific header files. - renamed shadow_uartris to shadow_uartmis to indicate that it is masked interrupt status. - use smp_mb() instead of smp_rmb() in vpl011_write_data(). Changes since v4: - Renamed vpl011_update() to vpl011_update_interrupt_status() and added logic to avoid raising spurious interrupts. - Used barrier instructions correctly while reading/writing data to the ring buffer. - Proper lock taken before reading ring buffer indices. Changes since v3: - Moved the call to DEFINE_XEN_FLEX_RING from vpl011.h to public/console.h. This macro defines standard functions to operate on the ring buffer. - Lock taken while updating the interrupt mask and clear registers in mmio_write. - Use gfn_t instead of xen_pfn_t. - vgic_free_virq called if there is any error in vpl011 initialization. - mmio handlers freed if there is any error in vpl011 initialization. - Removed vpl011->initialized flag usage as the same check could be done using vpl011->ring-ref. - Used return instead of break in the switch handling of emulation of different pl011 registers. - Renamed vpl011_update_spi() to vpl011_update(). Changes since v2: - Use generic vreg_reg* for read/write of registers emulating pl011. - Use generic ring buffer functions defined using DEFINE_XEN_FLEX_RING. - Renamed the SPI injection function to vpl011_update_spi() to reflect level triggered nature of pl011 interrupts. - The pl011 register access address should always be the base address of the corresponding register as per section B of the SBSA document. For this reason, the register range address access is not allowed. Changes since v1: - Removed the optimiztion related to sendiing events to xenconsole - Use local variables as ring buffer indices while using the ring buffer xen/arch/arm/Kconfig | 7 + xen/arch/arm/Makefile | 1 + xen/arch/arm/vpl011.c | 454 +++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/domain.h | 6 + xen/include/asm-arm/pl011-uart.h | 2 + xen/include/asm-arm/vpl011.h | 72 +++++++ xen/include/public/arch-arm.h | 6 + 7 files changed, 548 insertions(+) create mode 100644 xen/arch/arm/vpl011.c create mode 100644 xen/include/asm-arm/vpl011.h diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index d46b98c..f58019d 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -50,6 +50,13 @@ config HAS_ITS prompt "GICv3 ITS MSI controller support" if EXPERT = "y" depends on HAS_GICV3 +config SBSA_VUART_CONSOLE + bool "Emulated SBSA UART console support" + default y + ---help--- + Allows a guest to use SBSA Generic UART as a console. The + SBSA Generic UART implements a subset of ARM PL011 UART. + endmenu menu "ARM errata workaround via the alternative framework" diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 17bff98..424580b 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_HAS_GICV3) += vgic-v3.o obj-$(CONFIG_HAS_ITS) += vgic-v3-its.o obj-y += vm_event.o obj-y += vtimer.o +obj-$(CONFIG_SBSA_VUART_CONSOLE) += vpl011.o obj-y += vpsci.o obj-y += vuart.o diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c new file mode 100644 index 0000000..56d9cbe --- /dev/null +++ b/xen/arch/arm/vpl011.c @@ -0,0 +1,454 @@ +/* + * arch/arm/vpl011.c + * + * Virtual PL011 UART + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Since pl011 registers are 32-bit registers, all registers + * are handled similarly allowing 8-bit, 16-bit and 32-bit + * accesses except 64-bit access. + */ +static bool vpl011_reg32_check_access(struct hsr_dabt dabt) +{ + return (dabt.size != DABT_DOUBLE_WORD); +} + +static void vpl011_update_interrupt_status(struct domain *d) +{ + struct vpl011 *vpl011 = &d->arch.vpl011; + uint32_t uartmis = vpl011->uartris & vpl011->uartimsc; + + /* + * This function is expected to be called with the lock taken. + */ + ASSERT(spin_is_locked(&vpl011->lock)); + + /* + * TODO: PL011 interrupts are level triggered which means + * that interrupt needs to be set/clear instead of being + * injected. However, currently vGIC does not handle level + * triggered interrupts properly. This function needs to be + * revisited once vGIC starts handling level triggered + * interrupts. + */ + + /* + * Raise an interrupt only if any additional interrupt + * status bit has been set since the last time. + */ + if ( uartmis & ~vpl011->shadow_uartmis ) + vgic_vcpu_inject_spi(d, GUEST_VPL011_SPI); + + vpl011->shadow_uartmis = uartmis; +} + +static uint8_t vpl011_read_data(struct domain *d) +{ + unsigned long flags; + uint8_t data = 0; + struct vpl011 *vpl011 = &d->arch.vpl011; + struct xencons_interface *intf = vpl011->ring_buf; + XENCONS_RING_IDX in_cons, in_prod; + + VPL011_LOCK(d, flags); + + in_cons = intf->in_cons; + in_prod = intf->in_prod; + + smp_rmb(); + + /* + * It is expected that there will be data in the ring buffer when this + * function is called since the guest is expected to read the data register + * only if the TXFE flag is not set. + * If the guest still does read when TXFE bit is set then 0 will be returned. + */ + if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) > 0 ) + { + data = intf->in[xencons_mask(in_cons, sizeof(intf->in))]; + in_cons += 1; + smp_mb(); + intf->in_cons = in_cons; + } + else + gprintk(XENLOG_ERR, "vpl011: Unexpected IN ring buffer empty\n"); + + if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) == 0 ) + { + vpl011->uartfr |= RXFE; + vpl011->uartris &= ~RXI; + } + + vpl011->uartfr &= ~RXFF; + + vpl011_update_interrupt_status(d); + + VPL011_UNLOCK(d, flags); + + /* + * Send an event to console backend to indicate that data has been + * read from the IN ring buffer. + */ + notify_via_xen_event_channel(d, vpl011->evtchn); + + return data; +} + +static void vpl011_write_data(struct domain *d, uint8_t data) +{ + unsigned long flags; + struct vpl011 *vpl011 = &d->arch.vpl011; + struct xencons_interface *intf = vpl011->ring_buf; + XENCONS_RING_IDX out_cons, out_prod; + + VPL011_LOCK(d, flags); + + out_cons = intf->out_cons; + out_prod = intf->out_prod; + + smp_mb(); + + /* + * It is expected that the ring is not full when this function is called + * as the guest is expected to write to the data register only when the + * TXFF flag is not set. + * In case the guest does write even when the TXFF flag is set then the + * data will be silently dropped. + */ + if ( xencons_queued(out_prod, out_cons, sizeof(intf->out)) != + sizeof (intf->out) ) + { + intf->out[xencons_mask(out_prod, sizeof(intf->out))] = data; + out_prod += 1; + smp_wmb(); + intf->out_prod = out_prod; + } + else + gprintk(XENLOG_ERR, "vpl011: Unexpected OUT ring buffer full\n"); + + if ( xencons_queued(out_prod, out_cons, sizeof(intf->out)) == + sizeof (intf->out) ) + { + vpl011->uartfr |= TXFF; + vpl011->uartris &= ~TXI; + } + + vpl011->uartfr |= BUSY; + + vpl011->uartfr &= ~TXFE; + + vpl011_update_interrupt_status(d); + + VPL011_UNLOCK(d, flags); + + /* + * Send an event to console backend to indicate that there is + * data in the OUT ring buffer. + */ + notify_via_xen_event_channel(d, vpl011->evtchn); +} + +static int vpl011_mmio_read(struct vcpu *v, + mmio_info_t *info, + register_t *r, + void *priv) +{ + struct hsr_dabt dabt = info->dabt; + uint32_t vpl011_reg = (uint32_t)(info->gpa - GUEST_PL011_BASE); + struct vpl011 *vpl011 = &v->domain->arch.vpl011; + struct domain *d = v->domain; + unsigned long flags; + + switch ( vpl011_reg ) + { + case DR: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + *r = vreg_reg32_extract(vpl011_read_data(d), info); + return 1; + + case RSR: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + /* It always returns 0 as there are no physical errors. */ + *r = 0; + return 1; + + case FR: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + *r = vreg_reg32_extract(vpl011->uartfr, info); + VPL011_UNLOCK(d, flags); + return 1; + + case RIS: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + *r = vreg_reg32_extract(vpl011->uartris, info); + VPL011_UNLOCK(d, flags); + return 1; + + case MIS: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + *r = vreg_reg32_extract(vpl011->uartris & vpl011->uartimsc, + info); + VPL011_UNLOCK(d, flags); + return 1; + + case IMSC: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + *r = vreg_reg32_extract(vpl011->uartimsc, info); + VPL011_UNLOCK(d, flags); + return 1; + + case ICR: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + /* Only write is valid. */ + return 0; + + default: + gprintk(XENLOG_ERR, "vpl011: unhandled read r%d offset %#08x\n", + dabt.reg, vpl011_reg); + return 0; + } + + return 1; + +bad_width: + gprintk(XENLOG_ERR, "vpl011: bad read width %d r%d offset %#08x\n", + dabt.size, dabt.reg, vpl011_reg); + domain_crash_synchronous(); + return 0; + +} + +static int vpl011_mmio_write(struct vcpu *v, + mmio_info_t *info, + register_t r, + void *priv) +{ + struct hsr_dabt dabt = info->dabt; + uint32_t vpl011_reg = (uint32_t)(info->gpa - GUEST_PL011_BASE); + struct vpl011 *vpl011 = &v->domain->arch.vpl011; + struct domain *d = v->domain; + unsigned long flags; + + switch ( vpl011_reg ) + { + case DR: + { + uint32_t data = 0; + + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + vreg_reg32_update(&data, r, info); + data &= 0xFF; + vpl011_write_data(v->domain, data); + return 1; + } + + case RSR: /* Nothing to clear. */ + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + return 1; + + case FR: + case RIS: + case MIS: + goto write_ignore; + + case IMSC: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + vreg_reg32_update(&vpl011->uartimsc, r, info); + vpl011_update_interrupt_status(v->domain); + VPL011_UNLOCK(d, flags); + return 1; + + case ICR: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + vreg_reg32_clearbits(&vpl011->uartris, r, info); + vpl011_update_interrupt_status(d); + VPL011_UNLOCK(d, flags); + return 1; + + default: + gprintk(XENLOG_ERR, "vpl011: unhandled write r%d offset %#08x\n", + dabt.reg, vpl011_reg); + return 0; + } + +write_ignore: + return 1; + +bad_width: + gprintk(XENLOG_ERR, "vpl011: bad write width %d r%d offset %#08x\n", + dabt.size, dabt.reg, vpl011_reg); + domain_crash_synchronous(); + return 0; + +} + +static const struct mmio_handler_ops vpl011_mmio_handler = { + .read = vpl011_mmio_read, + .write = vpl011_mmio_write, +}; + +static void vpl011_data_avail(struct domain *d) +{ + unsigned long flags; + struct vpl011 *vpl011 = &d->arch.vpl011; + struct xencons_interface *intf = vpl011->ring_buf; + XENCONS_RING_IDX in_cons, in_prod, out_cons, out_prod; + XENCONS_RING_IDX in_ring_qsize, out_ring_qsize; + + VPL011_LOCK(d, flags); + + in_cons = intf->in_cons; + in_prod = intf->in_prod; + out_cons = intf->out_cons; + out_prod = intf->out_prod; + + smp_rmb(); + + in_ring_qsize = xencons_queued(in_prod, + in_cons, + sizeof(intf->in)); + + out_ring_qsize = xencons_queued(out_prod, + out_cons, + sizeof(intf->out)); + + /* Update the uart rx state if the buffer is not empty. */ + if ( in_ring_qsize != 0 ) + { + vpl011->uartfr &= ~RXFE; + if ( in_ring_qsize == sizeof(intf->in) ) + vpl011->uartfr |= RXFF; + vpl011->uartris |= RXI; + } + + /* Update the uart tx state if the buffer is not full. */ + if ( out_ring_qsize != sizeof(intf->out) ) + { + vpl011->uartfr &= ~TXFF; + vpl011->uartris |= TXI; + if ( out_ring_qsize == 0 ) + { + vpl011->uartfr &= ~BUSY; + vpl011->uartfr |= TXFE; + } + } + + vpl011_update_interrupt_status(d); + + VPL011_UNLOCK(d, flags); +} + +static void vpl011_notification(struct vcpu *v, unsigned int port) +{ + vpl011_data_avail(v->domain); +} + +int domain_vpl011_init(struct domain *d, struct vpl011_init_info *info) +{ + int rc; + struct vpl011 *vpl011 = &d->arch.vpl011; + + if ( vpl011->ring_buf ) + return -EINVAL; + + /* Map the guest PFN to Xen address space. */ + rc = prepare_ring_for_helper(d, + gfn_x(info->gfn), + &vpl011->ring_page, + &vpl011->ring_buf); + if ( rc < 0 ) + goto out; + + rc = vgic_reserve_virq(d, GUEST_VPL011_SPI); + if ( !rc ) + { + rc = -EINVAL; + goto out1; + } + + rc = alloc_unbound_xen_event_channel(d, 0, info->console_domid, + vpl011_notification); + if ( rc < 0 ) + goto out2; + + vpl011->evtchn = info->evtchn = rc; + + spin_lock_init(&vpl011->lock); + + register_mmio_handler(d, &vpl011_mmio_handler, + GUEST_PL011_BASE, GUEST_PL011_SIZE, NULL); + + return 0; + +out2: + vgic_free_virq(d, GUEST_VPL011_SPI); + +out1: + destroy_ring_for_helper(&vpl011->ring_buf, vpl011->ring_page); + +out: + return rc; +} + +void domain_vpl011_deinit(struct domain *d) +{ + struct vpl011 *vpl011 = &d->arch.vpl011; + + if ( !vpl011->ring_buf ) + return; + + free_xen_event_channel(d, vpl011->evtchn); + destroy_ring_for_helper(&vpl011->ring_buf, vpl011->ring_page); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index b174c65..4c804eb 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -11,6 +11,7 @@ #include #include #include +#include struct hvm_domain { @@ -145,6 +146,11 @@ struct arch_domain struct { uint8_t privileged_call_enabled : 1; } monitor; + +#ifdef CONFIG_SBSA_VUART_CONSOLE + struct vpl011 vpl011; +#endif + } __cacheline_aligned; struct arch_vcpu diff --git a/xen/include/asm-arm/pl011-uart.h b/xen/include/asm-arm/pl011-uart.h index 123f477..57e9ec7 100644 --- a/xen/include/asm-arm/pl011-uart.h +++ b/xen/include/asm-arm/pl011-uart.h @@ -49,6 +49,8 @@ /* FR bits */ #define TXFE (1<<7) /* TX FIFO empty */ #define RXFE (1<<4) /* RX FIFO empty */ +#define TXFF (1<<5) /* TX FIFO full */ +#define RXFF (1<<6) /* RX FIFO full */ #define BUSY (1<<3) /* Transmit is not complete */ /* LCR_H bits */ diff --git a/xen/include/asm-arm/vpl011.h b/xen/include/asm-arm/vpl011.h new file mode 100644 index 0000000..1b583da --- /dev/null +++ b/xen/include/asm-arm/vpl011.h @@ -0,0 +1,72 @@ +/* + * include/xen/vpl011.h + * + * Virtual PL011 UART + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; If not, see . + */ + +#ifndef _VPL011_H_ +#define _VPL011_H_ + +#include +#include +#include +#include + +/* helper macros */ +#define VPL011_LOCK(d,flags) spin_lock_irqsave(&(d)->arch.vpl011.lock, flags) +#define VPL011_UNLOCK(d,flags) spin_unlock_irqrestore(&(d)->arch.vpl011.lock, flags) + +struct vpl011 { + void *ring_buf; + struct page_info *ring_page; + uint32_t uartfr; /* Flag register */ + uint32_t uartcr; /* Control register */ + uint32_t uartimsc; /* Interrupt mask register*/ + uint32_t uarticr; /* Interrupt clear register */ + uint32_t uartris; /* Raw interrupt status register */ + uint32_t shadow_uartmis; /* shadow masked interrupt register */ + spinlock_t lock; + evtchn_port_t evtchn; +}; + +struct vpl011_init_info { + domid_t console_domid; + gfn_t gfn; + evtchn_port_t evtchn; +}; + +#ifdef CONFIG_SBSA_VUART_CONSOLE +int domain_vpl011_init(struct domain *d, + struct vpl011_init_info *info); +void domain_vpl011_deinit(struct domain *d); +#else +static inline int domain_vpl011_init(struct domain *d, + struct vpl011_init_info *info) +{ + return -ENOSYS; +} + +static inline void domain_vpl011_deinit(struct domain *d) { } +#endif +#endif /* _VPL011_H_ */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index 8f9d06e..5708cd2 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -410,6 +410,10 @@ typedef uint64_t xen_callback_t; #define GUEST_ACPI_BASE 0x20000000ULL #define GUEST_ACPI_SIZE 0x02000000ULL +/* PL011 mappings */ +#define GUEST_PL011_BASE 0x22000000ULL +#define GUEST_PL011_SIZE 0x00001000ULL + /* * 16MB == 4096 pages reserved for guest to use as a region to map its * grant table in. @@ -444,6 +448,8 @@ typedef uint64_t xen_callback_t; #define GUEST_TIMER_PHYS_NS_PPI 30 #define GUEST_EVTCHN_PPI 31 +#define GUEST_VPL011_SPI 32 + /* PSCI functions */ #define PSCI_cpu_suspend 0 #define PSCI_cpu_off 1 From patchwork Wed Sep 27 06:13:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114328 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665279qgf; Tue, 26 Sep 2017 23:16:52 -0700 (PDT) X-Received: by 10.107.36.83 with SMTP id k80mr420576iok.176.1506493012568; Tue, 26 Sep 2017 23:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493012; cv=none; d=google.com; s=arc-20160816; b=Ks6IiCINRrWAOIGMotfAp/zsbZL7+r1ClY68v1uuv1M6D5OkyFiiXuAiEW9OEYcXVb pshYGHUh4PAHeOjvRTgLmhez/ZPbBm7NquN7GzgqsuMe0KmMLPQEXuxRP7xaXgcyu2tN D62vm9hkbZ3MUvQ7mE7t7BUDIoqwJ7MPaF6mlINIKk5xynxxbfzVUwi9uXsGpANy/aOG H6IVBH4QV4FsabicCyGU5bvNh6lNbgviZcH08vqpmc00PBFCYJuQpdrCbcDTydyj+vNV syuFVhA8ry0ap/fM37j+lQD/y6tGtqNPLD7sxJ1DUndnWx2Yg09zVHprowuhZG8eN8nL 8+NQ== 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=0ao0R4TUMt/NZk0LNAGseeON7682MI1gnH9Au+puTTU=; b=XfwU7K6hBydRdcZs4SD6Nn+XqcSGGDTYfewGpxhijZmSn7tJ8mc6YTV3AmkLZAwhzB SoGflD0Su3wND/eg5JetvWwbahAGfLV8dxeWg+3gvPi/1Bg83Q5mBBKhItSr+4tRC5l9 CJG7mbEVcrwU+RrTqWbcixIOdjt4Aqk+cMRqtfELVJZJSMdbGAIBKC2jCz2GXEVPUWz9 nDCDCqCk2gZGFnT1B2Tism7U26iKF18ssPHZBvMUnN6CztvFuc0WCGiy5yN06Wc6gphO 8RL/Z1JGCvIgjm+9B99fQbR+3MQhIwCOfliE6XfJ83LsfQgvzReJhPqefVM2M09C10Rj Jz0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VsBzDlI3; 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 l192si8923732ioe.234.2017.09.26.23.16.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:52 -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=VsBzDlI3; 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 1dx5bQ-0002Q8-18; Wed, 27 Sep 2017 06:13:48 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bO-0002PX-Iy for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:46 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id 3D/AA-30935-9914BC95; Wed, 27 Sep 2017 06:13:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTAat2Zjqc jDRoe8Ft83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBm/bzSwF7ySrDh8YQlbA+Md0S5GTg4hgRmM Es/mxYPYLALzmCWurOboYuTikBDoZ5WYNPMxO0hCQiBP4vWhJ0wQdprE6y19jBB2ucTFP72sE IO0JI6ems0K0iwksIJJ4sXjDqAiDg42AROJWR0SIDUiAkoS91ZNZgKpYRaYzyjRNKmXDSQhLB Ap8e75X3aIK1QlWv53gC3gFfCWWDr7MRvEMjmJm+c6mUFsTgEfidP9t9kgFntLXFrZzzqBUXA BI8MqRo3i1KKy1CJdI0u9pKLM9IyS3MTMHF1DA1O93NTi4sT01JzEpGK95PzcTYzAgKtnYGDc wXh5i98hRkkOJiVR3pr/pyKF+JLyUyozEosz4otKc1KLDzHKcHAoSfDecDgdKSRYlJqeWpGWm QMMfZi0BAePkgjvNZA0b3FBYm5xZjpE6hSjPceFO5f+MHF86b0BJA/suQUkO27e/cMkxJKXn5 cqJc57EaRNAKQtozQPbigsVi8xykoJ8zIyMDAI8RSkFuVmlqDKv2IU52BUEua9CzKFJzOvBG7 3K6CzmIDO6p16AuSskkSElFQDYzLr2vXcj5wVN7L6sUcU3F71aU3Igzf8jfe+f1uhyT6X9WRt /d+QOztETBVvdupVNK70CJv3eY+p/r4NO63+st+yXlbks7lZ1evLBNO2b873vh31UtzTwuYcW DGz+tG+Y11sj9NXy6wrTN/U+UwmRnRF1/GqmiuF/ZNqZqz2L1qae/J2/NGvfEosxRmJhlrMRc WJAIGra/HQAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-7.tower-206.messagelabs.com!1506492824!110540296!1 X-Originating-IP: [209.85.192.171] 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 9466 invoked from network); 27 Sep 2017 06:13:45 -0000 Received: from mail-pf0-f171.google.com (HELO mail-pf0-f171.google.com) (209.85.192.171) by server-7.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:45 -0000 Received: by mail-pf0-f171.google.com with SMTP id m63so6749926pfk.7 for ; Tue, 26 Sep 2017 23:13:45 -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=1SnejLuK1E7QinOqF2LtaUIP1aM9kOWy3HE1yvqUZqQ=; b=VsBzDlI3xGU9fp/s9/NwZ/ENrH26TT8CZ2xBMPZLRYpC91iD+oPGbts6W0vOemdfUu 7EYbvjgUP9Uj6Bwh2pXuz0Z+e/AfWqv7XK0HDizf5FXkXPGWGblT7mL6PWpLMzthUYt9 jhMp67+2F1BPGsfJ4tCs/7dY7Ljf06M5jA8OU= 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=1SnejLuK1E7QinOqF2LtaUIP1aM9kOWy3HE1yvqUZqQ=; b=TKqRTMtFJ4sQZ5s/ITfsDxH4grAv3/v97yNgpFHUziidWsT+INOfvUPxcT7DHKGKei /1B9y8W7jO1rfsY33yQPppMVv2e323rPJAapFmM5Xx0xX3gLDM7+VpwYP8PrhLGFaKW3 ftZhD2IXvH69b7TV1vj+6MevsHDbGyqNbXdSVTfsHTpW5dcsNJKwl0P1HWfQS+JJC9iR YijYqWOdQdXgZ/MyluXosw02x/l+tAJQzcNjhpw/h9zf0kdD8+hw5RvVkHgrA/WQbEMz Yky//UFiTzZUIT5N0yTW+Rlt2m8BBM8plL3P7xM35ySn3nZdLAmu5c3bdgTkCqacPR7o OEDg== X-Gm-Message-State: AHPjjUhmuoYylZdvfBOmfWXTh/nwlNFRcfFJWfF/C120AJMVhLtRgxHJ /SeU6a3rfP36kVuPZdG9ztPrDmr8aKI= X-Google-Smtp-Source: AOwi7QBmG8hS9MCVJxE9v/jJjePlDhE8Mc2BrQL3mSQQlCxbvjfX2wEYycKbkPAyXurVaCaP0iDfWA== X-Received: by 10.99.170.14 with SMTP id e14mr367584pgf.12.1506492823549; Tue, 26 Sep 2017 23:13:43 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:43 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:12 +0530 Message-Id: <1506492816-25954-4-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 03/27 v11] xen/arm: vpl011: Allocate a new GFN in the toolstack for vuart 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" Allocate a new gfn to be used as a ring buffer between xenconsole and Xen for sending/receiving pl011 console data. Signed-off-by: Bhupinder Thakur Acked-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v4: - Removed xc_get_vuart_gfn() as it is not required since the vpl011 initialization function which used this API has been moved to after gfn is allocated. - I have included the reviewed-by and acked-by tags as there is no change in the logic. Changes since v3: - Added a new helper function xc_get_vuart_gfn() to return the GFN allocated for vpl011. - Since a new function has been added in this patch, I have not included Stefano's reviewed-by and Wei's acked-by tags. Changes since v2: - Removed the DOMCTL call to set the GFN as now this information is passed in the DOMCTL call to initialize vpl011 emulation. tools/libxc/include/xc_dom.h | 2 ++ tools/libxc/xc_dom_arm.c | 5 ++++- tools/libxc/xc_dom_boot.c | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h index ce47058..6e06ef1 100644 --- a/tools/libxc/include/xc_dom.h +++ b/tools/libxc/include/xc_dom.h @@ -216,6 +216,8 @@ struct xc_dom_image { /* Extra SMBIOS structures passed to HVMLOADER */ struct xc_hvm_firmware_module smbios_module; + + xen_pfn_t vuart_gfn; }; /* --- pluggable kernel loader ------------------------------------- */ diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index e669fb0..98200ae 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -26,10 +26,11 @@ #include "xg_private.h" #include "xc_dom.h" -#define NR_MAGIC_PAGES 3 +#define NR_MAGIC_PAGES 4 #define CONSOLE_PFN_OFFSET 0 #define XENSTORE_PFN_OFFSET 1 #define MEMACCESS_PFN_OFFSET 2 +#define VUART_PFN_OFFSET 3 #define LPAE_SHIFT 9 @@ -85,10 +86,12 @@ static int alloc_magic_pages(struct xc_dom_image *dom) dom->console_pfn = base + CONSOLE_PFN_OFFSET; dom->xenstore_pfn = base + XENSTORE_PFN_OFFSET; + dom->vuart_gfn = base + VUART_PFN_OFFSET; xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn); xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn); xc_clear_domain_page(dom->xch, dom->guest_domid, base + MEMACCESS_PFN_OFFSET); + xc_clear_domain_page(dom->xch, dom->guest_domid, base + VUART_PFN_OFFSET); xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_PFN, dom->console_pfn); xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_STORE_PFN, diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c index c3b44dd..8a376d0 100644 --- a/tools/libxc/xc_dom_boot.c +++ b/tools/libxc/xc_dom_boot.c @@ -226,6 +226,8 @@ int xc_dom_boot_image(struct xc_dom_image *dom) return rc; if ( (rc = clear_page(dom, dom->xenstore_pfn)) != 0 ) return rc; + if ( (rc = clear_page(dom, dom->vuart_gfn)) != 0 ) + return rc; /* start info page */ if ( dom->arch_hooks->start_info ) From patchwork Wed Sep 27 06:13:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114326 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665261qgf; Tue, 26 Sep 2017 23:16:51 -0700 (PDT) X-Received: by 10.107.174.216 with SMTP id n85mr420094ioo.21.1506493011350; Tue, 26 Sep 2017 23:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493011; cv=none; d=google.com; s=arc-20160816; b=hYcI/NwhoDfX7OfBL0kt9Omo2ooMETD9p2bYXhek94KTmEvhT5hVOKJeIFEzx0btUk DyGxx3gOc9WEqcygUAc+n/LmDARFAbN4ABSfNDPAFHY2ktrkonl3FDu/hG+xPGrMhnn/ 0vkauVDTLGlz7hlNQaZvy6fGvaA8bM20/gbGZYC8UcQvCPska4YZo11EHPl11MldwsY3 sGoJsWJnSaLQUL6utXS0f+o4LoCkZh2J1CqWopazQaoqL+qM96gBDc4p/JGLLKZNgA1I QHLboQ+nNmzim6d54g+AnLNyvz++jiPLFZQ7yrGeMqBhxvJQQc3wQI2bMj4xtg7whsc2 tnnQ== 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=CE5Bdy5qyzmR31Oifvf1YJnVhxYEBxdqf0MkgR7yYzw=; b=0SfmuMlfCeuGSrH0i2yoh8qUMFOHNMhgBzeIWIIWCgvap9hchjmNfObMXmRSFbcKLY 2zon6MhIYoe701THUpP/drRH4ACpsaEhsTP/UdkfgYCs85DexmQFT3nmXZpnXAva8dK/ b0hOC9PEIw0Cnfi/wFpKkdiS8HAtGpC8YJbBDp8+nB7pcVtLW/XAFrChigsvAr81cfPN 7hCX61HL67+m+9jga8hpBOEqCgDoo0mjfhPSmOg+8fu8STabanMxjqkYpcRllnOSHLAW YKQWC0avvgmn+iNAx4R8y0HH10Od2uECG7STaTBHGbRPrzwUOw0tcnzZBxGaVdncrwD8 sUnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=X5kJh9xF; 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 67si3606080itt.179.2017.09.26.23.16.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:51 -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=X5kJh9xF; 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 1dx5bR-0002SB-J2; Wed, 27 Sep 2017 06:13:49 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bQ-0002Q7-DI for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:48 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id E5/C0-02092-B914BC95; Wed, 27 Sep 2017 06:13:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRWlGSWpSXmKPExsVyMfTAWt3Zjqc jDdaJWXzfMpnJgdHj8IcrLAGMUayZeUn5FQmsGY1NzawFG0wqPqxqZ25gPKfZxcjFISQwnVHi y9L/7CAOi8A8ZonT/5aDORIC/awSa/e8Zu5i5ARy8iSOvb8HZadJvN92lh3CrpCY1NgMFhcS0 JI4emo2K8TYFUwSr99PBEpwcLAJmEjM6pAAqRERUJK4t2oyE0gNs8B8RommSb1sIAlhAS+Jje u+gA1lEVCVmPh0PQuIzSvgLbGubQ4bxDI5iZvnOsGWcQr4SJzuv80Gsdhb4tLKftYJjIILGBl WMWoUpxaVpRbpGlnqJRVlpmeU5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEhlw9AwPjDsbL W/wOMUpyMCmJ8tb8PxUpxJeUn1KZkVicEV9UmpNafIhRhoNDSYL3hsPpSCHBotT01Iq0zBxg8 MOkJTh4lER4r4GkeYsLEnOLM9MhUqcYXTku3Ln0h4nj2KbLQPJL7w0geWDPLSDZcfPuHyYhlr z8vFQpcd6LIM0CIM0ZpXlwo2GRe4lRVkqYl5GBgUGIpyC1KDezBFX+FaM4B6OSMO9dkCk8mXk lcBe8AjqOCei43qknQI4rSURISTUwsnwsuZ09M2ai77VFAmvls9/NCVC2flR7MmpR6FWxe4E7 l+ztTUkriH9cKMshqeGxZFVBVPzjg7JJ51p0p71ZXXe/x6Fv8ZR1obf1f/ptCqk8v2zRhgkut XFmtbq7Hlz4+fbJgjv2pUZHSr+Xii6Nytt3OZsh5ty7tgzPX2ppBpPe3C3KPCa4UomlOCPRUI u5qDgRAFpft+PXAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-2.tower-206.messagelabs.com!1506492825!92817139!1 X-Originating-IP: [209.85.192.173] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40009 invoked from network); 27 Sep 2017 06:13:46 -0000 Received: from mail-pf0-f173.google.com (HELO mail-pf0-f173.google.com) (209.85.192.173) by server-2.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:46 -0000 Received: by mail-pf0-f173.google.com with SMTP id e1so6758152pfk.1 for ; Tue, 26 Sep 2017 23:13: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=LGLhx7Och6xef4nWNZ5DPoUrb0BM0rjwbeTkFLXpAzY=; b=X5kJh9xFXC67j7MAc9Po/FsbCOCIlHd9oDCEe2Dr2SBa1NQqcHRNKRW80ncyA6/thW R6nrQLjKwGEDSsM0qbOgfneN8w0RmgllAz/4+5DNgOCjC/V9rolPCOZVooBxKAgj4HwN ei2aWuDMvlzN/N593wWwg0si3uF0F681PFVB4= 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=LGLhx7Och6xef4nWNZ5DPoUrb0BM0rjwbeTkFLXpAzY=; b=E8r+wnx5mToSf/4luev3N1AcH+e4doPEYOjWYKS0Ip4xkNhxj9tvLPvNt86tVcXLoY gnA/qftd2htwzM2Kpd0ULzq1YPRbYs7aVchkzJHv+ckZt89osp2bqmoO39iYRFjm8w8y PnzHz4qESqJ8dVe0OHjInCFNfWsLRhYrEa/luvvhxDjAxdQxkFXm9Tpys8zSeAIL6m3W 47qxNajF/FOkSuOGRUHRoZJCEBhfTvOSIRUBci7qMmfo4CV2IUDqFIdOcmPWCnnfu5iZ EOV8WuqRBFvPNUolcPalbsPjbSa/+FW4gkPJlRySpsNl2vMxSUzTrZopBbe3Zto2mILq 3ldQ== X-Gm-Message-State: AHPjjUjG6DVAEN07ErcXjkHiHGWMNERTbrCMI6Ks0AvWP2McFS9sbL/Q XbunSuzBQO9Ms4cG5hEizMbLQEHzR14= X-Google-Smtp-Source: AOwi7QBCrGStdCWyoBoxc/B8G+iX2TMCbDfzdtJZ8IV6snomVxN8MzrvGjTEnMUMyfvkZwjo4yDH7w== X-Received: by 10.99.186.81 with SMTP id l17mr350598pgu.170.1506492825140; Tue, 26 Sep 2017 23:13:45 -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.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:44 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:13 +0530 Message-Id: <1506492816-25954-5-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 04/27 v11] xen/arm: vpl011: Add support for vuart in libxl 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" An option is provided in libxl to enable/disable SBSA vuart while creating a guest domain. Libxl now supports a generic vuart console and SBSA uart is a specific type. In future support can be added for multiple vuart of different types. User can enable SBSA vuart by adding the following line in the guest configuration file: vuart = "sbsa_uart" Signed-off-by: Bhupinder Thakur Acked-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v4: - Renamed "pl011" to "sbsa_uart". Changes since v3: - Added a new config option CONFIG_VUART_CONSOLE to enable/disable vuart console support. - Moved libxl_vuart_type to arch-arm part of libxl_domain_build_info - Updated xl command help to mention new console type - vuart. Changes since v2: - Defined vuart option as an enum instead of a string. - Removed the domain creation flag defined for vuart and the related code to pass on the information while domain creation. Now vpl011 is initialized independent of domain creation through new DOMCTL APIs. tools/libxl/libxl.h | 7 +++++++ tools/libxl/libxl_console.c | 3 +++ tools/libxl/libxl_dom.c | 1 + tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_types.idl | 7 +++++++ tools/xl/xl_cmdtable.c | 2 +- tools/xl/xl_console.c | 5 ++++- tools/xl/xl_parse.c | 8 ++++++++ 8 files changed, 34 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 7d853ca..9dfd964 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -308,9 +308,16 @@ /* * LIBXL_HAVE_P9S indicates that the p9 field in IDL has been changed to p9s */ + #define LIBXL_HAVE_P9S 1 /* + * LIBXL_HAVE_BUILDINFO_ARM_VUART indicates that the toolstack supports virtual UART + * for ARM. + */ +#define LIBXL_HAVE_BUILDINFO_ARM_VUART 1 + +/* * libxl ABI compatibility * * The only guarantee which libxl makes regarding ABI compatibility diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index 68511d7..f4f64ad 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -67,6 +67,9 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, case LIBXL_CONSOLE_TYPE_SERIAL: cons_type_s = "serial"; break; + case LIBXL_CONSOLE_TYPE_VUART: + cons_type_s = "vuart"; + break; default: goto out; } diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index f54fd49..e0f0d78 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -803,6 +803,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid, if (xc_dom_translated(dom)) { state->console_mfn = dom->console_pfn; state->store_mfn = dom->xenstore_pfn; + state->vuart_gfn = dom->vuart_gfn; } else { state->console_mfn = xc_dom_p2m(dom, dom->console_pfn); state->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 81e87ae..30a5cb2 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1139,6 +1139,9 @@ typedef struct { uint32_t num_vmemranges; xc_domain_configuration_t config; + + xen_pfn_t vuart_gfn; + evtchn_port_t vuart_port; } libxl__domain_build_state; _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid, diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 756e120..37ac8ec 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -105,6 +105,7 @@ libxl_console_type = Enumeration("console_type", [ (0, "UNKNOWN"), (1, "SERIAL"), (2, "PV"), + (3, "VUART"), ]) libxl_disk_format = Enumeration("disk_format", [ @@ -240,6 +241,11 @@ libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (2, "COLO"), ]) +libxl_vuart_type = Enumeration("vuart_type", [ + (0, "unknown"), + (1, "sbsa_uart"), + ]) + # # Complex libxl types # @@ -581,6 +587,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("arch_arm", Struct(None, [("gic_version", libxl_gic_version), + ("vuart", libxl_vuart_type), ])), # Alternate p2m is not bound to any architecture or guest type, as it is # supported by x86 HVM and ARM support is planned. diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 48f0324..2126e70 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -133,7 +133,7 @@ struct cmd_spec cmd_table[] = { &main_console, 0, 0, "Attach to domain's console", "[options] \n" - "-t console type, pv or serial\n" + "-t console type, pv , serial or vuart\n" "-n console number" }, { "vncviewer", diff --git a/tools/xl/xl_console.c b/tools/xl/xl_console.c index 0508dda..4e65d73 100644 --- a/tools/xl/xl_console.c +++ b/tools/xl/xl_console.c @@ -27,6 +27,7 @@ int main_console(int argc, char **argv) uint32_t domid; int opt = 0, num = 0; libxl_console_type type = 0; + char *console_names = "pv, serial, vuart"; SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) { case 't': @@ -34,8 +35,10 @@ int main_console(int argc, char **argv) type = LIBXL_CONSOLE_TYPE_PV; else if (!strcmp(optarg, "serial")) type = LIBXL_CONSOLE_TYPE_SERIAL; + else if (!strcmp(optarg, "vuart")) + type = LIBXL_CONSOLE_TYPE_VUART; else { - fprintf(stderr, "console type supported are: pv, serial\n"); + fprintf(stderr, "console type supported are: %s\n", console_names); return EXIT_FAILURE; } break; diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 0678fbc..edcdd9e 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -965,6 +965,14 @@ void parse_config_data(const char *config_source, if (!xlu_cfg_get_long (config, "maxvcpus", &l, 0)) b_info->max_vcpus = l; + if (!xlu_cfg_get_string(config, "vuart", &buf, 0)) { + if (libxl_vuart_type_from_string(buf, &b_info->arch_arm.vuart)) { + fprintf(stderr, "ERROR: invalid value \"%s\" for \"vuart\"\n", + buf); + exit(1); + } + } + parse_vnuma_config(config, b_info); /* Set max_memkb to target_memkb and max_vcpus to avail_vcpus if From patchwork Wed Sep 27 06:13:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114330 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665340qgf; Tue, 26 Sep 2017 23:16:57 -0700 (PDT) X-Received: by 10.107.186.6 with SMTP id k6mr448354iof.183.1506493017150; Tue, 26 Sep 2017 23:16:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493017; cv=none; d=google.com; s=arc-20160816; b=MGBPD3blo+xeezsyc/di5MocwhfwrDt0a0+Tf2SkXWmVflNkSY4EIa3DKoiiiomxov TNQgWf/+f8SjsHESIU8SNwIVvLMq0ci/ftylEzUbiAu6qzR5Tdn/buhzfqTGfq8+zmxw S4ENoimrKsxep9SMZlgZrqgCr0+rB39/FlM3/580JKhfTltR6oOSJqvBaAbaiyHq934H 8RGyEcSxiLg5iZqKrAjTc4Ne5xWN3UotlAv84FgGI5f5+qv+zrfdyD+ujWGlNdTdraEk IlFhw2CiAHcmCyH0yO7b60S0FNmYmu+xjgNhQ5pnUOfFoT1T7Oks1chUWdSotYoSlNRH ejwQ== 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=tN08GY3/uorUX4O9GotsstG5RbknWBJ2tiaR4/47ta0=; b=qhzVv+rGl2Jet083chafOSUOWoD95K2OTHIyrKTHEOnTj+Vz4Uct38pnaPV02db1xg L/s5HHWtHl6QWNHNwnPfCvr380LWRPTHGSklYmVL1ttMHgKezT3AS8h6Y/RRkN5bT46R M9IgPupfLwDRT6RUDVZvpNpuUjHsp4c+6P6HePRj9eEJ2jrPNHeY+lecqiL9tg48ZbpJ S6M4VY4zW42+3Z7+cTSTOH1kwVWq2tMOoi0sgsV5yOuqraoqZ50MFmHzrKdehMYYdmks KBLmg1LODqE76G9VjsY7ovtB3m9zWn6x0WNk5lPVsMXv97QW8lOAJmhwNITRwmtlrALd JERw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IQmm9fgI; 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 p74si3433383ita.205.2017.09.26.23.16.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:57 -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=IQmm9fgI; 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 1dx5bS-0002TQ-QX; Wed, 27 Sep 2017 06:13:50 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bS-0002SD-17 for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:50 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 7C/61-03283-D914BC95; Wed, 27 Sep 2017 06:13:49 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsXiVRusrzvb8XS kwYyjuhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aiQzkFl9gr/u+9xdTAeJuti5GLQ0hgOqPE pis9rCAOi8A8ZonGDcfBMhIC/awSZ2Z+Y+xi5ABy8iSarut3MXICmWkSm+8eZoKwKyTOX1vEC mILCWhJHD01mxVi6gomiUevJjCB9LIJmEjM6pAAqRERUJK4t2oyWC+zQKjE1L8PWEBsYYFsiR kL57KB2CwCqhJ3u++B2bwC3hI/351kh9glJ3HzXCcziM0p4CNxuv82G8Reb4lLK/tZJzAKLmB kWMWoUZxaVJZapGtoqJdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERhuDECwg/HT soBDjJIcTEqivDX/T0UK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuCd53A6UkiwKDU9tSItMwcY+ DBpCQ4eJRHeayBp3uKCxNzizHSI1ClGe44bD6//YeL40nsDSO7bcwtIdty8+4dJiCUvPy9VSp y3CqRNAKQtozQPbigsUi8xykoJ8zICnSnEU5BalJtZgir/ilGcg1FJmHchyBSezLwSuN2vgM5 iAjqrd+oJkLNKEhFSUg2MO4//W111kNNXsKn45ZyOGb5+WxnZJ5wOVL74remLZoDOihve0XvD f5UIntQVONk03eC9b+Zx/T1PXh4WtGqKlzcoXmuZzrmiXXTK9I0lKb/vnCqxf9kb3X69/NvzK McLSztv28dl/p/jdLfV4PwaNYbwK1uc1V7Wexf0+UZy+LM6qevnuzorsRRnJBpqMRcVJwIAz2 uqkc8CAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-14.tower-27.messagelabs.com!1506492826!106268028!1 X-Originating-IP: [74.125.83.47] 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 11185 invoked from network); 27 Sep 2017 06:13:47 -0000 Received: from mail-pg0-f47.google.com (HELO mail-pg0-f47.google.com) (74.125.83.47) by server-14.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:47 -0000 Received: by mail-pg0-f47.google.com with SMTP id v23so7222338pgc.5 for ; Tue, 26 Sep 2017 23:13:47 -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=NcuXv+CZc89ZmONq94DxQZ/VYburH6TvSZVWD6FvN2A=; b=IQmm9fgIN0wA+dAPnh9C+1LVGrjVrXg0KOGU3Rc0gru9QXOjNSqvt54K7/jBj35O0E pmz2xkTz/OcYKbXYuBilmWDLuZA81136WrnvS4Oj1LtOgwSv86xXRdwMuyRmasBrTQu2 +Ef5bLXHN8PuXcmd07IOJ0wT/3F1rq/Iye1DE= 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=NcuXv+CZc89ZmONq94DxQZ/VYburH6TvSZVWD6FvN2A=; b=iQseWZ74rcO0pZ75VGNUHEYO9utb23saZwOWJ23v7+5bBEjq7GaTFiEMCj7VALZXCg 5mhix2FtEjMADPDMyhAaKJvhOiK2gLd/vTn+5pNKvK3A4Xq70EmmyTU9Gp7cgLvWLgD5 O0PUCVyS8jtjRUaiDmTKHSK8oQgF96dZgaGsc5uhT+KoDRT5qa9iS8dS1H9VJX+Q1QZZ uNN2swGmwQQX8oW3a1VckmhR1GbmJxQm/b75r25f8dEQWINYVjQXIo+uHcFLrzXMJT8L c8s8Z8tNyN9Fx5Ni8b/NQyTzANfCsjb/Mmly9gGZV4A4tl+Z6NdsPZ2+pjMcXuwcj0XB Fntw== X-Gm-Message-State: AHPjjUhGg3v+5QQ7HwjwUv8UNuNzFiG36ABlzralVWjonN1eVXF4SMsG SXtzeYsSysbdbwv6hvMbMPoGltNzl48= X-Google-Smtp-Source: AOwi7QB07rObYqgYckHKf7JFOvbPnUokl53ZIb2N1ONeoO/vSEjBsJuBx3+0/jtV6DiOyfE2iOGZ5g== X-Received: by 10.99.165.88 with SMTP id r24mr328259pgu.331.1506492826148; Tue, 26 Sep 2017 23:13:46 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:45 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:14 +0530 Message-Id: <1506492816-25954-6-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: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 05/27 v11] xen/arm: vpl011: Rearrange xen header includes in alphabetical order in domctl.c 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" Rearrange xen header includes in alphabetical order in domctl.c. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Reviewed-by: Julien Grall --- CC: Stefano Stabellini CC: Julien Grall Changes since v5: - Corrected include of in alphabetical order. xen/arch/arm/domctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c index 24bcb55..8232f44 100644 --- a/xen/arch/arm/domctl.c +++ b/xen/arch/arm/domctl.c @@ -4,12 +4,12 @@ * Copyright (c) 2012, Citrix Systems */ -#include -#include #include -#include #include #include +#include +#include +#include #include #include From patchwork Wed Sep 27 06:13:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114343 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665533qgf; Tue, 26 Sep 2017 23:17:12 -0700 (PDT) X-Received: by 10.36.199.7 with SMTP id t7mr897261itg.65.1506493031984; Tue, 26 Sep 2017 23:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493031; cv=none; d=google.com; s=arc-20160816; b=oqVVuTdKIt8s04KO6xemppGEh8wgnQJANTQI4F+gLd+Q9/KPiob3V+f+n03zvF9sCD MKZEGifLgFhjOUDJTwWWTB5KufX+IXJZpeeYGd5OufGXT0kAvuyziY8NN3XHbtQaCSKz fPqH3L8kw2GCINi7XrCo5aF+lv/EuD2KTy1VidQNjj21op53YJA2630nQzVE20Xw4Nzj 0ZXu2mtM6zqSShL7QUi7R5j8e25cIRVeyj316KmPbZQNtcLbQIwWYOi4fwCa5JEw0LBw kL+HUOz6eC0sNvO5IuOiFCwTiNgvO+ftC0UAONAWXSfCv09Zdc9wMbYbGUULCZrmykMc 6mvw== 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=31xVjx3Gt3m+HoSg3xcv/D+A6NsG19giXqfllTn982g=; b=vvu6VjOMkD6M7wVA43CKyt3u+7ibLpMK8xQ8Pm1QHK1nS40kWGqE4UmTIvBs/TZDFY 8x2+g0caklPCXPKD2KoaLgRqFY8DXpKIycAsl3lKccQ0HlxkIoynoukGXDVnSeYEsQBv DFRULCcwMsuP7hJNZu4XU/wkED63JRAMkNbUaJ6ILZ6zgl+w6acO3mAZIcyOJVgg97BV ascQrpDqHalyHZ/i7lWm5FaVrkOASL50hrK7GNBywzEZS8nc2QmH+yFcCGw1JrvxbpJL 4oktKUuzOUGODSVjTMI5EIdkqAMR34PI4K+9TWUrKwk7H77wq5QLYNXHjxrlqqYN+3HG 1WNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ggsri5wG; 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 g67si9076888iof.390.2017.09.26.23.17.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:11 -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=ggsri5wG; 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 1dx5bU-0002UY-1A; Wed, 27 Sep 2017 06:13:52 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bS-0002TE-UH for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:51 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id F8/79-09852-E914BC95; Wed, 27 Sep 2017 06:13:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsVyMfTAZt25jqc jDW7PFbP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDNWfFzPVtCYXdGz+wJbA2ODXxcjF4eQwExG iQ8zfrN0MXJysAjMY5aYcpgXJCEh0M8q8exkAztIQkIgT+LX6jtQdprE1bl/GLsYOYDsConXh +tAwkICWhJHT81mhRi6gklizolfYDVsAiYSszokQGpEBJQk7q2azARiMws8Z5KYdkkHxBYWCJ VYe3gvG8QNqhKTFnxlBrF5Bbwl3s9ZyQaxVk7i5rlOsDingI/E6f7bbBB7vSUurexnncAouIC RYRWjRnFqUVlqka6hhV5SUWZ6RkluYmaOrqGBqV5uanFxYnpqTmJSsV5yfu4mRmC4MQDBDsam 7Z6HGCU5mJREeWv+n4oU4kvKT6nMSCzOiC8qzUktPsQow8GhJME7z+F0pJBgUWp6akVaZg4w8 GHSEhw8SiK810DSvMUFibnFmekQqVOM9hwX7lz6w8TxpfcGkDyw5xaQ7Lh59w+TEEtefl6qlD hvFUibAEhbRmke3FBYpF5ilJUS5mUEOlOIpyC1KDezBFX+FaM4B6OSMO9CkCk8mXklcLtfAZ3 FBHRW79QTIGeVJCKkpBoYDys833dpvdX9pVtEvrkazLmYnG53Z+/RPaGpops/hL53U6nZ/tep YOo73jQRHmbWW//vyfF5bd8gGxlfq6nSdY3xlLDkUtNvq64e1DvaPbXgssmJw0+mM/of2la6Z PXThV9nfcuYImx4lNHwovMmj4q5D5Wr8g6+qiupP1/zIUsxN+t90uOzl5VYijMSDbWYi4oTAc 1v8yPPAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1506492828!111798189!1 X-Originating-IP: [209.85.192.179] 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 10861 invoked from network); 27 Sep 2017 06:13:49 -0000 Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:49 -0000 Received: by mail-pf0-f179.google.com with SMTP id g65so6739178pfe.13 for ; Tue, 26 Sep 2017 23:13:48 -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=R8iGMRMxgah35e8ImX4XxbhwshQ9CzZ+FqewgVRBYg8=; b=ggsri5wGl7agGYK80ACVW28VIzLaZP1AeY/IZuJO41kNf+nvTXnuWfAEx2s75/b+14 Hwnui5hf3G+H1LvE8D4tW/zuk3H3AeLnJW7tBmzjuwPR1EtRJ7jKp/qNPN1j7dt5kVzr u2Cwfkdkc+Lu/TogyBM9YamImMATFXpnqJ5P8= 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=R8iGMRMxgah35e8ImX4XxbhwshQ9CzZ+FqewgVRBYg8=; b=dfmrtZrSZExNEviaW5/UrI9BBTNFtYqNU5u/c77UDmlxuYZeLeZM8n5AH8+1yRbY/4 Uus63NuemgoWHC6K5twW4CmKArImtLTdOemqkbmzgPexI9jOUKqwGIMYivL4Tw31mgiX LFMhmhsSxnac9pweS0DhZ/6tjaVD4jXLhnDmUCJr2gYVV38UKDAB+XU1nYSpPk4QuxMr HNaPLgCqQhUvj+p3tQD+WsNTtpdESjlu9VG7O4pcwVfkJde0GKDRn5WQWgUKfbCzQNRL XhnGTcl6ZIuBj2aQKBmPvOnJBz4STqriBJ0XLJyS4Z30h3cfqQfMCKv359Kczej+LXpH 7rHw== X-Gm-Message-State: AHPjjUhCvQuHS1iqUV3cBWR23xxNEceCL/4uiSo0STCUjlGIG0hJI69o b9RcJQauKkU/M1OP26L4Y5r2yl0iI/A= X-Google-Smtp-Source: AOwi7QDzP0dkd5IBti1lOQsOkaC2r8mHyyEGCXTsx0izkiVajpwvt+4ksJMq9KqxTq2qJZE8HDChRQ== X-Received: by 10.99.181.23 with SMTP id y23mr333800pge.189.1506492827306; Tue, 26 Sep 2017 23:13:47 -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.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:46 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:15 +0530 Message-Id: <1506492816-25954-7-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: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH 06/27 v11] xen/arm: vpl011: Add a new domctl API to initialize vpl011 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" Add a new domctl API to initialize vpl011. It takes the GFN and console backend domid as input and returns an event channel to be used for sending and receiving events from Xen. Xen will communicate with xenconsole using GFN as the ring buffer and the event channel to transmit and receive pl011 data on the guest domain's behalf. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Andrew Cooper CC: George Dunlap CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Julien Grall Changes since v9: - Initialized local variable in libxl__arch_build_dom_finish - Replaced __copy_to_guest with copy_to_guest - Added comment for console_domid field in vuart_op structure Changes since v8: - Added explicit padding in the vuart_op structure - Moved vuart_op structure after the PSR structure definition - The input fields moved before the output fields in vuart_op structure - Checking explicitly that padding fields are initialized to 0 Changes since v6: - Renamed the vuart initialization function to a generic name xc_dom_vuart_init - Used domid_t as a type instead of uint32_t for domid - Checking the vuart type explicitly against vpl011 enum value Changes since v5: - xc_dom_vpl011_init() will be compiled for both x86/arm architectures as there is nothing architecture specific in this function. This function will return error when called for x86. - Fixed coding style issues in libxl. Changes since v4: - Removed libxl__arch_domain_create_finish(). - Added a new function libxl__arch_build_dom_finish(), which is called at the last in libxl__build_dom(). This function calls the vpl011 initialization function now. Changes since v3: - Added a new arch specific function libxl__arch_domain_create_finish(), which calls the vpl011 initialization function. For x86 this function does not do anything. - domain_vpl011_init() takes a pointer to a structure which contains all the required information such as console_domid, gfn instead of passing parameters separately. - Dropped a DOMCTL API defined for de-initializing vpl011 as that should be taken care when the domain is destroyed (and not dependent on userspace libraries/applications). Changes since v2: - Replaced the DOMCTL APIs defined for get/set of event channel and GFN with a set of DOMCTL APIs for initializing and de-initializing vpl011 emulation. tools/libxc/include/xenctrl.h | 20 +++++++++++++++++ tools/libxc/xc_domain.c | 27 ++++++++++++++++++++++ tools/libxl/libxl_arch.h | 7 ++++++ tools/libxl/libxl_arm.c | 27 ++++++++++++++++++++++ tools/libxl/libxl_dom.c | 4 ++++ tools/libxl/libxl_x86.c | 8 +++++++ xen/arch/arm/domain.c | 6 +++++ xen/arch/arm/domctl.c | 52 +++++++++++++++++++++++++++++++++++++++++++ xen/include/public/domctl.h | 24 ++++++++++++++++++++ 9 files changed, 175 insertions(+) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 073fbc9..2086e71 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -886,6 +886,26 @@ int xc_vcpu_getcontext(xc_interface *xch, vcpu_guest_context_any_t *ctxt); /** + * This function initializes the vuart emulation and returns + * the event to be used by the backend for communicating with + * the emulation code. + * + * @parm xch a handle to an open hypervisor interface + * #parm type type of vuart + * @parm domid the domain to get information from + * @parm console_domid the domid of the backend console + * @parm gfn the guest pfn to be used as the ring buffer + * @parm evtchn the event channel to be used for events + * @return 0 on success, negative error on failure + */ +int xc_dom_vuart_init(xc_interface *xch, + uint32_t type, + domid_t domid, + domid_t console_domid, + xen_pfn_t gfn, + evtchn_port_t *evtchn); + +/** * This function returns information about the XSAVE state of a particular * vcpu of a domain. If extstate->size and extstate->xfeature_mask are 0, * the call is considered a query to retrieve them and the buffer is not diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index f40dc4f..f2e9f0c 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -343,6 +343,33 @@ int xc_domain_get_guest_width(xc_interface *xch, uint32_t domid, return 0; } +int xc_dom_vuart_init(xc_interface *xch, + uint32_t type, + domid_t domid, + domid_t console_domid, + xen_pfn_t gfn, + evtchn_port_t *evtchn) +{ + DECLARE_DOMCTL; + int rc = 0; + + memset(&domctl, 0, sizeof(domctl)); + + domctl.cmd = XEN_DOMCTL_vuart_op; + domctl.domain = domid; + domctl.u.vuart_op.cmd = XEN_DOMCTL_VUART_OP_INIT; + domctl.u.vuart_op.type = type; + domctl.u.vuart_op.console_domid = console_domid; + domctl.u.vuart_op.gfn = gfn; + + if ( (rc = do_domctl(xch, &domctl)) < 0 ) + return rc; + + *evtchn = domctl.u.vuart_op.evtchn; + + return rc; +} + int xc_domain_getinfo(xc_interface *xch, uint32_t first_domid, unsigned int max_doms, diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h index 5e1fc60..784ec7f 100644 --- a/tools/libxl/libxl_arch.h +++ b/tools/libxl/libxl_arch.h @@ -44,6 +44,13 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc, libxl_domain_build_info *info, struct xc_dom_image *dom); +/* perform any pending hardware initialization */ +_hidden +int libxl__arch_build_dom_finish(libxl__gc *gc, + libxl_domain_build_info *info, + struct xc_dom_image *dom, + libxl__domain_build_state *state); + /* build vNUMA vmemrange with arch specific information */ _hidden int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc, diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index d842d88..6f5bc3c 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -1038,6 +1038,33 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc, return 0; } +int libxl__arch_build_dom_finish(libxl__gc *gc, + libxl_domain_build_info *info, + struct xc_dom_image *dom, + libxl__domain_build_state *state) +{ + int rc = 0, ret; + + if (info->arch_arm.vuart != LIBXL_VUART_TYPE_SBSA_UART) { + rc = 0; + goto out; + } + + ret = xc_dom_vuart_init(CTX->xch, + XEN_DOMCTL_VUART_TYPE_VPL011, + dom->guest_domid, + dom->console_domid, + dom->vuart_gfn, + &state->vuart_port); + if (ret < 0) { + rc = ERROR_FAIL; + LOG(ERROR, "xc_dom_vuart_init failed\n"); + } + +out: + return rc; +} + int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc, uint32_t domid, libxl_domain_build_info *info, diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index e0f0d78..5f92023 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -702,6 +702,10 @@ static int libxl__build_dom(libxl__gc *gc, uint32_t domid, LOGE(ERROR, "xc_dom_gnttab_init failed"); goto out; } + if ((ret = libxl__arch_build_dom_finish(gc, info, dom, state)) != 0) { + LOGE(ERROR, "libxl__arch_build_dom_finish failed"); + goto out; + } out: return ret != 0 ? ERROR_FAIL : 0; diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 455f6f0..0aaeded 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -391,6 +391,14 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc, return rc; } +int libxl__arch_build_dom_finish(libxl__gc *gc, + libxl_domain_build_info *info, + struct xc_dom_image *dom, + libxl__domain_build_state *state) +{ + return 0; +} + /* Return 0 on success, ERROR_* on failure. */ int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc, uint32_t domid, diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 784ae39..0779087 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -874,6 +874,12 @@ int domain_relinquish_resources(struct domain *d) if ( ret ) return ret; + /* + * Release the resources allocated for vpl011 which were + * allocated via a DOMCTL call XEN_DOMCTL_vuart_op. + */ + domain_vpl011_deinit(d); + d->arch.relmem = RELMEM_xen; /* Fallthrough */ diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c index 8232f44..4587c75 100644 --- a/xen/arch/arm/domctl.c +++ b/xen/arch/arm/domctl.c @@ -5,9 +5,11 @@ */ #include +#include #include #include #include +#include #include #include #include @@ -20,6 +22,29 @@ void arch_get_domain_info(const struct domain *d, info->flags |= XEN_DOMINF_hap; } +static int handle_vuart_init(struct domain *d, + struct xen_domctl_vuart_op *vuart_op) +{ + int rc; + struct vpl011_init_info info; + + info.console_domid = vuart_op->console_domid; + info.gfn = _gfn(vuart_op->gfn); + + if ( d->creation_finished ) + return -EPERM; + + if ( vuart_op->type != XEN_DOMCTL_VUART_TYPE_VPL011 ) + return -EOPNOTSUPP; + + rc = domain_vpl011_init(d, &info); + + if ( !rc ) + vuart_op->evtchn = info.evtchn; + + return rc; +} + long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) { @@ -119,6 +144,33 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, d->disable_migrate = domctl->u.disable_migrate.disable; return 0; + case XEN_DOMCTL_vuart_op: + { + int rc; + unsigned int i; + struct xen_domctl_vuart_op *vuart_op = &domctl->u.vuart_op; + + /* check that structure padding must be 0. */ + for ( i = 0; i < sizeof(vuart_op->pad); i++ ) + if ( vuart_op->pad[i] ) + return -EINVAL; + + switch( vuart_op->cmd ) + { + case XEN_DOMCTL_VUART_OP_INIT: + rc = handle_vuart_init(d, vuart_op); + break; + + default: + rc = -EINVAL; + break; + } + + if ( !rc ) + rc = copy_to_guest(u_domctl, domctl, 1); + + return rc; + } default: { int rc; diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index e2fd685..9dcc969 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -33,6 +33,7 @@ #endif #include "xen.h" +#include "event_channel.h" #include "grant_table.h" #include "hvm/save.h" #include "memory.h" @@ -1077,6 +1078,27 @@ struct xen_domctl_set_gnttab_limits { uint32_t maptrack_frames; /* IN */ }; +/* XEN_DOMCTL_vuart_op */ +struct xen_domctl_vuart_op { +#define XEN_DOMCTL_VUART_OP_INIT 0 + uint32_t cmd; /* XEN_DOMCTL_VUART_OP_* */ +#define XEN_DOMCTL_VUART_TYPE_VPL011 0 + uint32_t type; /* IN - type of vuart. + * Currently only vpl011 supported. + */ + uint64_aligned_t gfn; /* IN - guest gfn to be used as a + * ring buffer. + */ + domid_t console_domid; /* IN - domid of domain running the + * backend console. + */ + uint8_t pad[2]; + evtchn_port_t evtchn; /* OUT - remote port of the event + * channel used for sending + * ring buffer events. + */ +}; + struct xen_domctl { uint32_t cmd; #define XEN_DOMCTL_createdomain 1 @@ -1155,6 +1177,7 @@ struct xen_domctl { #define XEN_DOMCTL_psr_cat_op 78 #define XEN_DOMCTL_soft_reset 79 #define XEN_DOMCTL_set_gnttab_limits 80 +#define XEN_DOMCTL_vuart_op 81 #define XEN_DOMCTL_gdbsx_guestmemio 1000 #define XEN_DOMCTL_gdbsx_pausevcpu 1001 #define XEN_DOMCTL_gdbsx_unpausevcpu 1002 @@ -1218,6 +1241,7 @@ struct xen_domctl { struct xen_domctl_monitor_op monitor_op; struct xen_domctl_psr_cat_op psr_cat_op; struct xen_domctl_set_gnttab_limits set_gnttab_limits; + struct xen_domctl_vuart_op vuart_op; uint8_t pad[128]; } u; }; From patchwork Wed Sep 27 06:13:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114345 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665562qgf; Tue, 26 Sep 2017 23:17:14 -0700 (PDT) X-Received: by 10.36.173.33 with SMTP id c33mr888899itf.5.1506493034013; Tue, 26 Sep 2017 23:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493034; cv=none; d=google.com; s=arc-20160816; b=T+VuDXbPQ68S87e98Ko1xElH0cJolEh8xXWqkCTBhtn6gsQMkFKkestMx3MBE7rxmk 0Pa4OVS3kgT/2/8I+s2GKoX2yczPvoYn4Sp1I8nOrOyaVHDCpeqWw+m4An+dXQXNmMyx O+BJ2tO/USqTPZbVMSjMfJavV05LYIoTzOaNnoZWPTkZb6YVvgZNt+XLc1IuVSasf0pY EC+AUbnvHcrGcC9+Nv8ErM831ZLjQDrZ/w/kW1aP04uIImYfzVdQlaEmuBYVWr2t+DC3 shGw4OOFC5lA/pY2ofYpiYiZ97KUu3OqHphV1lSLo8gBAOU6ThZYoAxl7JjuHd2rh5/3 HxAg== 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=NQu2U2Y0mmfBaEBqfsKZpaOj5vrCPTemt8YZW0wsXZs=; b=NgEf49z7lK5Wccfy8ZM1hBx3CYJfSX/tbbvW7wi3lYp0VfFBrIaduCWmhOoTJ1J+yn 2hJPwZ4k780AXRW658eKrF+oPDLPI7JpzBx3cOJqCdvHwUnn5TM0wYLZaHXvAv5RUFKa YquTIjdtyMyrgda8E9oLI5BsYDpYaJ1membgLxYr8UKtw024rB2ka0VBbbjH/5xPcZxF S2FG87V0TjRG70q12Wzv4Nphz6TAOflcA6FqvTxY9ytC80/NbWaoBCSQUHxj2+upcqFe tpva1knAzpxuCLE4v2AUnuZu5j4RlK1+cwLo7pZjvwx4V9OFJg3nSM/uczZgs237AW1H vrBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AN0QUx8G; 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 f75si4321838ioe.372.2017.09.26.23.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:14 -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=AN0QUx8G; 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 1dx5bY-0002Zx-S4; Wed, 27 Sep 2017 06:13: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 1dx5bX-0002Xd-88 for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:55 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 66/05-03423-2A14BC95; Wed, 27 Sep 2017 06:13:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRWlGSWpSXmKPExsVyMfTAFt15jqc jDS6dU7P4vmUykwOjx+EPV1gCGKNYM/OS8isSWDNONHEX/LGqmNh+nLmBcYJuFyMXh5DADEaJ Zb+3M4E4LALzmCX2z5vHCuJICPSzSmxd8Iili5ETyMmTWHD8FzOEnSbxqWcHI4RdIdH+vhGsR khAS+LoqdmsEPYKJokX06K6GDk42ARMJGZ1SICERQSUJO6tmgy2jFlgPqNE06ReNpCEsECAxK tT/9lBbBYBVYkZa+cxgfTyCnhLTL3hBrFKTuLmuU6wEzgFfCRO999mg1jlLXFpZT/rBEbBBYw MqxjVi1OLylKLdC31kooy0zNKchMzc3QNDcz0clOLixPTU3MSk4r1kvNzNzECg40BCHYw3t0U cIhRkoNJSZS35v+pSCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvPMcTkcKCRalpqdWpGXmAMMeJ i3BwaMkwnsNJM1bXJCYW5yZDpE6xWjPceHOpT9MHF96bwDJA3tuAcmOm3f/MAmx5OXnpUqJ81 aBtAmAtGWU5sENhcXpJUZZKWFeRqAzhXgKUotyM0tQ5V8xinMwKgnzLgSZwpOZVwK3+xXQWUx AZ/VOPQFyVkkiQkqqgbHl8rMtU3YmbHyfpvL45uzzv4JCQwo3bZ8nIDWt8sHLparnrtYX7UhI 7Z1ixDDpdfu6h1VGIbnrkiSv3Jxfe+hntUhSgdnBdfXrzq9z6XrEFPUucf7vb9YXP55IOPCn1 mn52wPTzVS2H7jpszLyaNu/hGk//yaFXrktskRHldmMV3HthLLd1Wk9SizFGYmGWsxFxYkAew cuJ84CAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-27.messagelabs.com!1506492829!118773469!1 X-Originating-IP: [209.85.192.180] 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 12031 invoked from network); 27 Sep 2017 06:13:50 -0000 Received: from mail-pf0-f180.google.com (HELO mail-pf0-f180.google.com) (209.85.192.180) by server-9.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:50 -0000 Received: by mail-pf0-f180.google.com with SMTP id b70so6746470pfl.8 for ; Tue, 26 Sep 2017 23:13:50 -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=4sd+jityzyLKl9T+2Zny6hdYes/xeKdW5J2msJXqt9U=; b=AN0QUx8GJs3uBEubDT+sDKCWRSllGssWlut9nRPIknZMEHkLtNuBFoFPrXiDBzYe1b KCtgoIWvDuHKcmcG3AEfiaZI4PmNLpG1JBAq8knuKcgYfzTU0aPKdVQ4F1YvWvXItYo7 N3f/BTumYj5UhIfAZHboT8I3rLnjDLB2TRJvs= 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=4sd+jityzyLKl9T+2Zny6hdYes/xeKdW5J2msJXqt9U=; b=VWKbcsT7fQOooKMlB/En2f09aPUsVhFzv1TzwYCRL5vBTbpfJ62Cb34gUCmCLgCQEE 6z0CRFfOYtVeKeV/V8aQoYyfMpZvOll0UJ7HYFVWEhjJ9VGB2zZTIbBtKp4GdYpBIijf bA0r+PrCViX+IkAPfUSEbSDzqn05fmvRrLh0BHbCGiCmostM73Av7DT4C152JjdxAPXL m65UfFPUHTchueGY/VafsS3b1FJQDjtJx/JQo9heZdW7QRQT+dN5Qq/oToup2dxhVxbJ YuXNH9JbbiiValEQOIMiwLsgVppTRlzGziXwUJ0o4sV6nq5hLgqyr1rX/v9R8KGJJIPR ui2Q== X-Gm-Message-State: AHPjjUjyR6+74LFSiztfHp164Jk7i7IaQKGs8wc3y/b+OcMBdlx1UxXe o0j2bVkQfoIwwRj3KnleN3r0ZYO8Shw= X-Google-Smtp-Source: AOwi7QC+ap6bnAsTaJFVORh6ndgzaPzvPFVaqck8po/9dliseEv0Nx1MoaxIAIjDyMDHrQZEA/+7PQ== X-Received: by 10.99.125.81 with SMTP id m17mr323845pgn.343.1506492828547; Tue, 26 Sep 2017 23:13:48 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:48 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:16 +0530 Message-Id: <1506492816-25954-8-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 07/27 v11] xen/arm: vpl011: Add a new vuart node in the xenstore 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" Add a new vuart console node to xenstore. This node is added at /local/domain/$DOMID/vuart/0. The node contains information such as the ring-ref, event channel, buffer limit and type of console. Xenconsole reads the node information to setup the ring buffer and event channel for sending/receiving vuart data. 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 v4: - vuart_device moved inside libxl__device_vuart_add() as a local variable. Changes since v3: - Added a backend node for vpl011. - Removed libxl__device_vuart_add() for HVM guest. It is called only for PV guest. tools/libxl/libxl_console.c | 44 ++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_create.c | 9 +++++++- tools/libxl/libxl_device.c | 9 ++++++-- tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_types_internal.idl | 1 + 5 files changed, 63 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index f4f64ad..0db9cd0 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -344,6 +344,50 @@ out: return rc; } +int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, + libxl__device_console *console, + libxl__domain_build_state *state) +{ + libxl__device device; + flexarray_t *ro_front; + flexarray_t *back; + int rc; + + ro_front = flexarray_make(gc, 16, 1); + back = flexarray_make(gc, 16, 1); + + device.backend_devid = console->devid; + device.backend_domid = console->backend_domid; + device.backend_kind = LIBXL__DEVICE_KIND_VUART; + device.devid = console->devid; + device.domid = domid; + device.kind = LIBXL__DEVICE_KIND_VUART; + + flexarray_append(back, "frontend-id"); + flexarray_append(back, GCSPRINTF("%d", domid)); + flexarray_append(back, "online"); + flexarray_append(back, "1"); + flexarray_append(back, "state"); + flexarray_append(back, GCSPRINTF("%d", XenbusStateInitialising)); + flexarray_append(back, "protocol"); + flexarray_append(back, LIBXL_XENCONSOLE_PROTOCOL); + + flexarray_append(ro_front, "port"); + flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port)); + flexarray_append(ro_front, "ring-ref"); + flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn)); + flexarray_append(ro_front, "limit"); + flexarray_append(ro_front, GCSPRINTF("%d", LIBXL_XENCONSOLE_LIMIT)); + flexarray_append(ro_front, "type"); + flexarray_append(ro_front, "xenconsoled"); + + rc = libxl__device_generic_add(gc, XBT_NULL, &device, + libxl__xs_kvs_of_flexarray(gc, back), + NULL, + libxl__xs_kvs_of_flexarray(gc, ro_front)); + return rc; +} + int libxl__init_console_from_channel(libxl__gc *gc, libxl__device_console *console, int dev_num, diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 0ef54d2..9dcbe48 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1370,7 +1370,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, } case LIBXL_DOMAIN_TYPE_PV: { - libxl__device_console console; + libxl__device_console console, vuart; libxl__device device; for (i = 0; i < d_config->num_vfbs; i++) { @@ -1380,6 +1380,13 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, &d_config->vkbs[i]); } + if (d_config->b_info.arch_arm.vuart == LIBXL_VUART_TYPE_SBSA_UART) { + init_console_info(gc, &vuart, 0); + vuart.backend_domid = state->console_domid; + libxl__device_vuart_add(gc, domid, &vuart, state); + libxl__device_console_dispose(&vuart); + } + init_console_info(gc, &console, 0); console.backend_domid = state->console_domid; libxl__device_console_add(gc, domid, &console, state, &device); diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 67b7afb..3473687 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -26,6 +26,9 @@ static char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device) if (device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0) return GCSPRINTF("%s/console", dom_path); + if (device->kind == LIBXL__DEVICE_KIND_VUART) + return GCSPRINTF("%s/vuart/%d", dom_path, device->devid); + return GCSPRINTF("%s/device/%s/%d", dom_path, libxl__device_kind_to_string(device->kind), device->devid); @@ -170,7 +173,8 @@ retry_transaction: * historically contained other information, such as the * vnc-port, which we don't want the guest fiddling with. */ - if (device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0) + if ((device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0) || + (device->kind == LIBXL__DEVICE_KIND_VUART)) xs_set_permissions(ctx->xsh, t, frontend_path, ro_frontend_perms, ARRAY_SIZE(ro_frontend_perms)); else @@ -800,7 +804,8 @@ void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs) dev->domid = domid; dev->kind = kind; dev->devid = atoi(devs[j]); - if (dev->backend_kind == LIBXL__DEVICE_KIND_CONSOLE) { + if (dev->backend_kind == LIBXL__DEVICE_KIND_CONSOLE || + dev->backend_kind == LIBXL__DEVICE_KIND_VUART) { /* Currently console devices can be destroyed * synchronously by just removing xenstore entries, * this is what libxl__device_destroy does. diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 30a5cb2..1f878de 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1206,6 +1206,9 @@ _hidden int libxl__device_console_add(libxl__gc *gc, uint32_t domid, libxl__device_console *console, libxl__domain_build_state *state, libxl__device *device); +_hidden int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, + libxl__device_console *console, + libxl__domain_build_state *state); /* Returns 1 if device exists, 0 if not, ERROR_* (<0) on error. */ _hidden int libxl__device_exists(libxl__gc *gc, xs_transaction_t t, diff --git a/tools/libxl/libxl_types_internal.idl b/tools/libxl/libxl_types_internal.idl index 673a6d5..d144dd6 100644 --- a/tools/libxl/libxl_types_internal.idl +++ b/tools/libxl/libxl_types_internal.idl @@ -27,6 +27,7 @@ libxl__device_kind = Enumeration("device_kind", [ (10, "QUSB"), (11, "9PFS"), (12, "VDISPL"), + (13, "VUART"), ]) libxl__console_backend = Enumeration("console_backend", [ From patchwork Wed Sep 27 06:13:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114346 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665605qgf; Tue, 26 Sep 2017 23:17:17 -0700 (PDT) X-Received: by 10.107.135.91 with SMTP id j88mr443180iod.213.1506493037167; Tue, 26 Sep 2017 23:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493037; cv=none; d=google.com; s=arc-20160816; b=wZfn9vyhbVBheh488lehf8z04AI1P7HCGw11b+uOQ/ikMQkDfm7GI/JqGrgoCmpccX Li5o1cY3cPfu6jFEm1qfJtN9xwILM3oji4ZaCpBxURmoHoVMfGRSkBa5oP+7WlVI2v13 JsuR+7jQlJ/LzLPnFJc/NUp9cieFt9ZjCsBe3t6sn9fzmI/a5OsPFhDOr5fRYe7blebv We5XBQM/FslttDJiLFf7lpSHr6yzx5LtMMJECrCanXz8feSD4wjn1/nNDIv6+AWyZeGl 9MTsuT2Gc/Bg7clTo1rMTYCZZLSNuRpmxi9x8+GAKtIRxlburg/3L4plwaqiEwws0RSt 4wAA== 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=lUHrSFtRcdxi7jno74yZPIn1tbfCDeIZZLckatWcVNg=; b=vIr92Sjt+QbqGkXq+TAynK9ednCp2o28MuQ0iWUX/wI0+IfYrDqePXrd9p/A+P8tnM 7b8lgdi3T9aStJMJ52yafO9mLFzG9bFbgZJJH3tPx8p7sEPkGcqUzhAEQ+GAMgKQNWK6 iPBtGaKz+fewEPJFYumWZ+BWTWBhU7e/+kCNerUTUMMfLF3rYV2wDw9XTRunsc401Myv +kXEt0u4yRX14h4RC1yc3ZRfH2mJ2rTfEgcfSViKAExsZgntuajZLuBhYrnS6jlCzQyI ZSKMPC4URtTko8oT+k9supCrhQMKAwprlrVU/eKcl3TIrT7saKdoS78uizGQMhsaNvv/ uO9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=J1oRfCYV; 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 200si9036445iou.349.2017.09.26.23.17.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:17 -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=J1oRfCYV; 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 1dx5bX-0002Xz-Br; Wed, 27 Sep 2017 06:13:55 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bW-0002Wm-65 for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:54 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id E4/26-01778-1A14BC95; Wed, 27 Sep 2017 06:13:53 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGIsWRWlGSWpSXmKPExsVyMfTANt0Fjqc jDf40MFp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBl/bt5gKVi0mLHi3OqTzA2MS1oYuxg5OYQE ZjBKLD1o2MXIxcEiMI9ZonPlRxYQR0Kgn1Vi1u1uFpAqCYE8ibObN0PZaRLXr85hgrDLJR7Mf AM1SUvi6KnZrCDNQgIrmCRWne9j7mLk4GATMJGY1SEBUiMioCRxb9VkJpAaZoH5jBJNk3rZQB LCAukSL880MYPYLAKqEt2Xj4Et4xXwlrizdRErxDI5iZvnOsFqOAV8JE7332aDWOwtcWllP+s ERsEFjAyrGDWKU4vKUot0DY30kooy0zNKchMzc3QNDYz1clOLixPTU3MSk4r1kvNzNzECw44B CHYwvup2PsQoycGkJMpb8/9UpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3hsOpyOFBItS01Mr0 jJzgBEAk5bg4FES4Y0CSfMWFyTmFmemQ6ROMbpyXLhz6Q8Tx7FNl4Hkl94bQPLAnltAsuPm3T 9MQix5+XmpUuK8F0GaBUCaM0rz4EbDovcSo6yUMC8j0LFCPAWpRbmZJajyrxjFORiVhHk1Qab wZOaVwF3wCug4JqDjeqeeADmuJBEhJdXAaMR9ZM61u18TpJ5/aWSuvFWgoe12oeWtYcErizZ7 t6wQ8ylxeiXFz9jfFE0Iu3p/p5WE0nfDzQu+VnplV08xfGgk/G8nk3ppLKMhf+HNK3UFj9nfu WUanFixk5XVoEgqqkPOcpHOrsXz+WsNxaSesszkMi20VMm0mcteNWXDWU4DyYvrLwQrsRRnJB pqMRcVJwIAFSzBbdkCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-31.messagelabs.com!1506492830!116761326!1 X-Originating-IP: [209.85.192.182] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38722 invoked from network); 27 Sep 2017 06:13:51 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-8.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:51 -0000 Received: by mail-pf0-f182.google.com with SMTP id n24so6750278pfk.5 for ; Tue, 26 Sep 2017 23:13:51 -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=Ot1bQTJbL3uvWQMApMJcqouOKIP7MuaE+/N/bjqFU8k=; b=J1oRfCYVa3KAexsZQt6MIeoUGFk+EB5mlCnzmTnPi9BTRHUialtixMC11NM095cpJu LjFYfZh7J/Whx7kptRDRpFRJEKSKbTK6hUlTSZbR8DmHDTfw6DobxzKCtFjSR9Bj8Rst VPja65AOlRWpFgatSWSSN30/ncIAjgCOikdhY= 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=Ot1bQTJbL3uvWQMApMJcqouOKIP7MuaE+/N/bjqFU8k=; b=hztj8Fbge3YQkaDCifch+aCmSg6o5zRKSBrseY1aLkzrkSR85PLDtp2NHQkgusgfhj iIRWog40F0FoJh0DY6p4WcO5Iytdrfr300E/NxLm1DKRGFyCJA3HzIBe00vrQU81fPli T7jeBqmWrfMovCG2cTYjq5hVNOeEWoILg4CeYaXUx0cqlMl2/bpPM3qFM40uu2ESZ/WL 1GxqCKdLwcnKrI1RWXOOTF4mkFRr1h1e5U+JbrUuwL70KIKquW948qcLZX45XAY+tPxy pxCD5Pw1X62n6jI6DHbH8SdpUipvw0neTL0SDy8H7y8oqiGYU7po40Y/jOPQydkbawK9 0DdQ== X-Gm-Message-State: AHPjjUhRJtktS3Wyq8iZLqWNyvF0pXIWSj1Nb0SSGBpXSb3XYhzBF1e5 GR7Ic6VglJHEyIlpj5Ww9a0reCiGEMQ= X-Google-Smtp-Source: AOwi7QBmHToILIp0AIuCmv0HgyhxqT1+f3jkYjIgqei5lYD0wYZOOttrG0qTNZl9IJjOB1nkKmVDPA== X-Received: by 10.99.95.71 with SMTP id t68mr338057pgb.432.1506492829694; Tue, 26 Sep 2017 23:13:49 -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.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:49 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:17 +0530 Message-Id: <1506492816-25954-9-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 08/27 v11] xen/arm: vpl011: Modify xenconsole to define and use a new console structure 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" Xenconsole uses a domain structure which contains console specific fields. This patch defines a new console structure, which would be used by the xenconsole functions to perform console specific operations like reading/writing data from/to the console ring buffer or reading/writing data from/to console tty. This patch is in preparation to support multiple consoles to support vuart console. 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 v4: - Moved the following fields from the struct domain to struct console: ->xenevtchn_handle *xce_handle; ->int xce_pollfd_idx; ->int event_count; ->long long next_period; Changes since v3: - The changes in xenconsole have been split into four patches. This is the first patch which modifies the xenconsole to use a new console structure. Changes since v2: - Defined a new function console_create_ring() which sets up the ring buffer and event channel a new console. domain_create_ring() uses this function to setup a console. - This patch does not contain vuart specific changes, which would be introduced in the next patch. - Changes for keeping the PV log file name unchanged. Changes since v1: - Split the domain struture to a separate console structure - Modified the functions to operate on the console struture - Replaced repetitive per console code with generic code tools/console/daemon/io.c | 299 +++++++++++++++++++++++++--------------------- 1 file changed, 165 insertions(+), 134 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index e8033d2..30cd167 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -89,25 +89,30 @@ struct buffer { size_t max_capacity; }; -struct domain { - int domid; +struct console { int master_fd; int master_pollfd_idx; int slave_fd; int log_fd; - bool is_dead; - unsigned last_seen; struct buffer buffer; - struct domain *next; char *conspath; int ring_ref; - xenevtchn_port_or_error_t local_port; - xenevtchn_port_or_error_t remote_port; xenevtchn_handle *xce_handle; int xce_pollfd_idx; - struct xencons_interface *interface; int event_count; long long next_period; + xenevtchn_port_or_error_t local_port; + xenevtchn_port_or_error_t remote_port; + struct xencons_interface *interface; + struct domain *d; +}; + +struct domain { + int domid; + bool is_dead; + unsigned last_seen; + struct domain *next; + struct console console; }; static struct domain *dom_head; @@ -160,9 +165,10 @@ static int write_with_timestamp(int fd, const char *data, size_t sz, static void buffer_append(struct domain *dom) { - struct buffer *buffer = &dom->buffer; + struct console *con = &dom->console; + struct buffer *buffer = &con->buffer; XENCONS_RING_IDX cons, prod, size; - struct xencons_interface *intf = dom->interface; + struct xencons_interface *intf = con->interface; cons = intf->out_cons; prod = intf->out_prod; @@ -187,22 +193,22 @@ static void buffer_append(struct domain *dom) xen_mb(); intf->out_cons = cons; - xenevtchn_notify(dom->xce_handle, dom->local_port); + xenevtchn_notify(con->xce_handle, con->local_port); /* Get the data to the logfile as early as possible because if * no one is listening on the console pty then it will fill up * and handle_tty_write will stop being called. */ - if (dom->log_fd != -1) { + if (con->log_fd != -1) { int logret; if (log_time_guest) { logret = write_with_timestamp( - dom->log_fd, + con->log_fd, buffer->data + buffer->size - size, size, &log_time_guest_needts); } else { logret = write_all( - dom->log_fd, + con->log_fd, buffer->data + buffer->size - size, size); } @@ -338,14 +344,16 @@ static int create_domain_log(struct domain *dom) static void domain_close_tty(struct domain *dom) { - if (dom->master_fd != -1) { - close(dom->master_fd); - dom->master_fd = -1; + struct console *con = &dom->console; + + if (con->master_fd != -1) { + close(con->master_fd); + con->master_fd = -1; } - if (dom->slave_fd != -1) { - close(dom->slave_fd); - dom->slave_fd = -1; + if (con->slave_fd != -1) { + close(con->slave_fd); + con->slave_fd = -1; } } @@ -418,11 +426,12 @@ static int domain_create_tty(struct domain *dom) char *data; unsigned int len; struct termios term; + struct console *con = &dom->console; - assert(dom->slave_fd == -1); - assert(dom->master_fd == -1); + assert(con->slave_fd == -1); + assert(con->master_fd == -1); - if (openpty(&dom->master_fd, &dom->slave_fd, NULL, NULL, NULL) < 0) { + if (openpty(&con->master_fd, &con->slave_fd, NULL, NULL, NULL) < 0) { err = errno; dolog(LOG_ERR, "Failed to create tty for domain-%d " "(errno = %i, %s)", @@ -430,7 +439,7 @@ static int domain_create_tty(struct domain *dom) return 0; } - if (tcgetattr(dom->slave_fd, &term) < 0) { + if (tcgetattr(con->slave_fd, &term) < 0) { err = errno; dolog(LOG_ERR, "Failed to get tty attributes for domain-%d " "(errno = %i, %s)", @@ -438,7 +447,7 @@ static int domain_create_tty(struct domain *dom) goto out; } cfmakeraw(&term); - if (tcsetattr(dom->slave_fd, TCSANOW, &term) < 0) { + if (tcsetattr(con->slave_fd, TCSANOW, &term) < 0) { err = errno; dolog(LOG_ERR, "Failed to set tty attributes for domain-%d " "(errno = %i, %s)", @@ -446,7 +455,7 @@ static int domain_create_tty(struct domain *dom) goto out; } - if ((slave = ptsname(dom->master_fd)) == NULL) { + if ((slave = ptsname(con->master_fd)) == NULL) { err = errno; dolog(LOG_ERR, "Failed to get slave name for domain-%d " "(errno = %i, %s)", @@ -454,18 +463,18 @@ static int domain_create_tty(struct domain *dom) goto out; } - success = asprintf(&path, "%s/limit", dom->conspath) != + success = asprintf(&path, "%s/limit", con->conspath) != -1; if (!success) goto out; data = xs_read(xs, XBT_NULL, path, &len); if (data) { - dom->buffer.max_capacity = strtoul(data, 0, 0); + con->buffer.max_capacity = strtoul(data, 0, 0); free(data); } free(path); - success = (asprintf(&path, "%s/tty", dom->conspath) != -1); + success = (asprintf(&path, "%s/tty", con->conspath) != -1); if (!success) goto out; success = xs_write(xs, XBT_NULL, path, slave, strlen(slave)); @@ -473,7 +482,7 @@ static int domain_create_tty(struct domain *dom) if (!success) goto out; - if (fcntl(dom->master_fd, F_SETFL, O_NONBLOCK) == -1) + if (fcntl(con->master_fd, F_SETFL, O_NONBLOCK) == -1) goto out; return 1; @@ -519,29 +528,32 @@ static int xs_gather(struct xs_handle *xs, const char *dir, ...) static void domain_unmap_interface(struct domain *dom) { - if (dom->interface == NULL) + struct console *con = &dom->console; + + if (con->interface == NULL) return; - if (xgt_handle && dom->ring_ref == -1) - xengnttab_unmap(xgt_handle, dom->interface, 1); + if (xgt_handle && con->ring_ref == -1) + xengnttab_unmap(xgt_handle, con->interface, 1); else - munmap(dom->interface, XC_PAGE_SIZE); - dom->interface = NULL; - dom->ring_ref = -1; + munmap(con->interface, XC_PAGE_SIZE); + con->interface = NULL; + con->ring_ref = -1; } static int domain_create_ring(struct domain *dom) { int err, remote_port, ring_ref, rc; char *type, path[PATH_MAX]; + struct console *con = &dom->console; - err = xs_gather(xs, dom->conspath, + err = xs_gather(xs, con->conspath, "ring-ref", "%u", &ring_ref, "port", "%i", &remote_port, NULL); if (err) goto out; - snprintf(path, sizeof(path), "%s/type", dom->conspath); + snprintf(path, sizeof(path), "%s/type", con->conspath); type = xs_read(xs, XBT_NULL, path, NULL); if (type && strcmp(type, "xenconsoled") != 0) { free(type); @@ -550,77 +562,77 @@ static int domain_create_ring(struct domain *dom) free(type); /* If using ring_ref and it has changed, remap */ - if (ring_ref != dom->ring_ref && dom->ring_ref != -1) + if (ring_ref != con->ring_ref && con->ring_ref != -1) domain_unmap_interface(dom); - if (!dom->interface && xgt_handle) { + if (!con->interface && xgt_handle) { /* Prefer using grant table */ - dom->interface = xengnttab_map_grant_ref(xgt_handle, + con->interface = xengnttab_map_grant_ref(xgt_handle, dom->domid, GNTTAB_RESERVED_CONSOLE, PROT_READ|PROT_WRITE); - dom->ring_ref = -1; + con->ring_ref = -1; } - if (!dom->interface) { + if (!con->interface) { /* Fall back to xc_map_foreign_range */ - dom->interface = xc_map_foreign_range( + con->interface = xc_map_foreign_range( xc, dom->domid, XC_PAGE_SIZE, PROT_READ|PROT_WRITE, (unsigned long)ring_ref); - if (dom->interface == NULL) { + if (con->interface == NULL) { err = EINVAL; goto out; } - dom->ring_ref = ring_ref; + con->ring_ref = ring_ref; } /* Go no further if port has not changed and we are still bound. */ - if (remote_port == dom->remote_port) { + if (remote_port == con->remote_port) { xc_evtchn_status_t status = { .dom = DOMID_SELF, - .port = dom->local_port }; + .port = con->local_port }; if ((xc_evtchn_status(xc, &status) == 0) && (status.status == EVTCHNSTAT_interdomain)) goto out; } - dom->local_port = -1; - dom->remote_port = -1; - if (dom->xce_handle != NULL) - xenevtchn_close(dom->xce_handle); + con->local_port = -1; + con->remote_port = -1; + if (con->xce_handle != NULL) + xenevtchn_close(con->xce_handle); /* Opening evtchn independently for each console is a bit * wasteful, but that's how the code is structured... */ - dom->xce_handle = xenevtchn_open(NULL, 0); - if (dom->xce_handle == NULL) { + con->xce_handle = xenevtchn_open(NULL, 0); + if (con->xce_handle == NULL) { err = errno; goto out; } - rc = xenevtchn_bind_interdomain(dom->xce_handle, + rc = xenevtchn_bind_interdomain(con->xce_handle, dom->domid, remote_port); if (rc == -1) { err = errno; - xenevtchn_close(dom->xce_handle); - dom->xce_handle = NULL; + xenevtchn_close(con->xce_handle); + con->xce_handle = NULL; goto out; } - dom->local_port = rc; - dom->remote_port = remote_port; + con->local_port = rc; + con->remote_port = remote_port; - if (dom->master_fd == -1) { + if (con->master_fd == -1) { if (!domain_create_tty(dom)) { err = errno; - xenevtchn_close(dom->xce_handle); - dom->xce_handle = NULL; - dom->local_port = -1; - dom->remote_port = -1; + xenevtchn_close(con->xce_handle); + con->xce_handle = NULL; + con->local_port = -1; + con->remote_port = -1; goto out; } } - if (log_guest && (dom->log_fd == -1)) - dom->log_fd = create_domain_log(dom); + if (log_guest && (con->log_fd == -1)) + con->log_fd = create_domain_log(dom); out: return err; @@ -630,16 +642,17 @@ static bool watch_domain(struct domain *dom, bool watch) { char domid_str[3 + MAX_STRLEN(dom->domid)]; bool success; + struct console *con = &dom->console; snprintf(domid_str, sizeof(domid_str), "dom%u", dom->domid); if (watch) { - success = xs_watch(xs, dom->conspath, domid_str); + success = xs_watch(xs, con->conspath, domid_str); if (success) domain_create_ring(dom); else - xs_unwatch(xs, dom->conspath, domid_str); + xs_unwatch(xs, con->conspath, domid_str); } else { - success = xs_unwatch(xs, dom->conspath, domid_str); + success = xs_unwatch(xs, con->conspath, domid_str); } return success; @@ -651,6 +664,7 @@ static struct domain *create_domain(int domid) struct domain *dom; char *s; struct timespec ts; + struct console *con; if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) { dolog(LOG_ERR, "Cannot get time of day %s:%s:L%d", @@ -667,25 +681,26 @@ static struct domain *create_domain(int domid) dom->domid = domid; - dom->conspath = xs_get_domain_path(xs, dom->domid); - s = realloc(dom->conspath, strlen(dom->conspath) + + con = &dom->console; + con->conspath = xs_get_domain_path(xs, dom->domid); + s = realloc(con->conspath, strlen(con->conspath) + strlen("/console") + 1); if (s == NULL) goto out; - dom->conspath = s; - strcat(dom->conspath, "/console"); + con->conspath = s; + strcat(con->conspath, "/console"); - dom->master_fd = -1; - dom->master_pollfd_idx = -1; - dom->slave_fd = -1; - dom->log_fd = -1; - dom->xce_pollfd_idx = -1; + con->master_fd = -1; + con->master_pollfd_idx = -1; + con->slave_fd = -1; + con->log_fd = -1; + con->xce_pollfd_idx = -1; - dom->next_period = ((long long)ts.tv_sec * 1000) + (ts.tv_nsec / 1000000) + RATE_LIMIT_PERIOD; + con->next_period = ((long long)ts.tv_sec * 1000) + (ts.tv_nsec / 1000000) + RATE_LIMIT_PERIOD; - dom->ring_ref = -1; - dom->local_port = -1; - dom->remote_port = -1; + con->ring_ref = -1; + con->local_port = -1; + con->remote_port = -1; if (!watch_domain(dom, true)) goto out; @@ -697,7 +712,7 @@ static struct domain *create_domain(int domid) return dom; out: - free(dom->conspath); + free(con->conspath); free(dom); return NULL; } @@ -729,30 +744,34 @@ static void remove_domain(struct domain *dom) static void cleanup_domain(struct domain *d) { + struct console *con = &d->console; + domain_close_tty(d); - if (d->log_fd != -1) { - close(d->log_fd); - d->log_fd = -1; + if (con->log_fd != -1) { + close(con->log_fd); + con->log_fd = -1; } - free(d->buffer.data); - d->buffer.data = NULL; + free(con->buffer.data); + con->buffer.data = NULL; - free(d->conspath); - d->conspath = NULL; + free(con->conspath); + con->conspath = NULL; remove_domain(d); } static void shutdown_domain(struct domain *d) { + struct console *con = &d->console; + d->is_dead = true; watch_domain(d, false); domain_unmap_interface(d); - if (d->xce_handle != NULL) - xenevtchn_close(d->xce_handle); - d->xce_handle = NULL; + if (con->xce_handle != NULL) + xenevtchn_close(con->xce_handle); + con->xce_handle = NULL; } static unsigned enum_pass = 0; @@ -782,7 +801,8 @@ static void enum_domains(void) static int ring_free_bytes(struct domain *dom) { - struct xencons_interface *intf = dom->interface; + struct console *con = &dom->console; + struct xencons_interface *intf = con->interface; XENCONS_RING_IDX cons, prod, space; cons = intf->in_cons; @@ -812,7 +832,8 @@ static void handle_tty_read(struct domain *dom) ssize_t len = 0; char msg[80]; int i; - struct xencons_interface *intf = dom->interface; + struct console *con = &dom->console; + struct xencons_interface *intf = con->interface; XENCONS_RING_IDX prod; if (dom->is_dead) @@ -825,7 +846,7 @@ static void handle_tty_read(struct domain *dom) if (len > sizeof(msg)) len = sizeof(msg); - len = read(dom->master_fd, msg, len); + len = read(con->master_fd, msg, len); /* * Note: on Solaris, len == 0 means the slave closed, and this * is no problem, but Linux can't handle this usefully, so we @@ -841,7 +862,7 @@ static void handle_tty_read(struct domain *dom) } xen_wmb(); intf->in_prod = prod; - xenevtchn_notify(dom->xce_handle, dom->local_port); + xenevtchn_notify(con->xce_handle, con->local_port); } else { domain_close_tty(dom); shutdown_domain(dom); @@ -851,37 +872,39 @@ static void handle_tty_read(struct domain *dom) static void handle_tty_write(struct domain *dom) { ssize_t len; + struct console *con = &dom->console; if (dom->is_dead) return; - len = write(dom->master_fd, dom->buffer.data + dom->buffer.consumed, - dom->buffer.size - dom->buffer.consumed); + len = write(con->master_fd, con->buffer.data + con->buffer.consumed, + con->buffer.size - con->buffer.consumed); if (len < 1) { dolog(LOG_DEBUG, "Write failed on domain %d: %zd, %d\n", dom->domid, len, errno); domain_handle_broken_tty(dom, domain_is_valid(dom->domid)); } else { - buffer_advance(&dom->buffer, len); + buffer_advance(&con->buffer, len); } } static void handle_ring_read(struct domain *dom) { xenevtchn_port_or_error_t port; + struct console *con = &dom->console; if (dom->is_dead) return; - if ((port = xenevtchn_pending(dom->xce_handle)) == -1) + if ((port = xenevtchn_pending(con->xce_handle)) == -1) return; - dom->event_count++; + con->event_count++; buffer_append(dom); - if (dom->event_count < RATE_LIMIT_ALLOWANCE) - (void)xenevtchn_unmask(dom->xce_handle, port); + if (con->event_count < RATE_LIMIT_ALLOWANCE) + (void)xenevtchn_unmask(con->xce_handle, port); } static void handle_xs(void) @@ -948,9 +971,11 @@ static void handle_log_reload(void) if (log_guest) { struct domain *d; for (d = dom_head; d; d = d->next) { - if (d->log_fd != -1) - close(d->log_fd); - d->log_fd = create_domain_log(d); + struct console *con = &d->console; + + if (con->log_fd != -1) + close(con->log_fd); + con->log_fd = create_domain_log(d); } } @@ -1059,48 +1084,52 @@ void handle_io(void) /* Re-calculate any event counter allowances & unblock domains with new allowance */ for (d = dom_head; d; d = d->next) { + struct console *con = &d->console; + /* CS 16257:955ee4fa1345 introduces a 5ms fuzz * for select(), it is not clear poll() has * similar behavior (returning a couple of ms * sooner than requested) as well. Just leave * the fuzz here. Remove it with a separate * patch if necessary */ - if ((now+5) > d->next_period) { - d->next_period = now + RATE_LIMIT_PERIOD; - if (d->event_count >= RATE_LIMIT_ALLOWANCE) { - (void)xenevtchn_unmask(d->xce_handle, d->local_port); + if ((now+5) > con->next_period) { + con->next_period = now + RATE_LIMIT_PERIOD; + if (con->event_count >= RATE_LIMIT_ALLOWANCE) { + (void)xenevtchn_unmask(con->xce_handle, con->local_port); } - d->event_count = 0; + con->event_count = 0; } } for (d = dom_head; d; d = d->next) { - if (d->event_count >= RATE_LIMIT_ALLOWANCE) { + struct console *con = &d->console; + + if (con->event_count >= RATE_LIMIT_ALLOWANCE) { /* Determine if we're going to be the next time slice to expire */ if (!next_timeout || - d->next_period < next_timeout) - next_timeout = d->next_period; - } else if (d->xce_handle != NULL) { + con->next_period < next_timeout) + next_timeout = con->next_period; + } else if (con->xce_handle != NULL) { if (discard_overflowed_data || - !d->buffer.max_capacity || - d->buffer.size < d->buffer.max_capacity) { - int evtchn_fd = xenevtchn_fd(d->xce_handle); - d->xce_pollfd_idx = set_fds(evtchn_fd, + !con->buffer.max_capacity || + con->buffer.size < con->buffer.max_capacity) { + int evtchn_fd = xenevtchn_fd(con->xce_handle); + con->xce_pollfd_idx = set_fds(evtchn_fd, POLLIN|POLLPRI); } } - if (d->master_fd != -1) { + if (con->master_fd != -1) { short events = 0; if (!d->is_dead && ring_free_bytes(d)) events |= POLLIN; - if (!buffer_empty(&d->buffer)) + if (!buffer_empty(&con->buffer)) events |= POLLOUT; if (events) - d->master_pollfd_idx = - set_fds(d->master_fd, + con->master_pollfd_idx = + set_fds(con->master_fd, events|POLLPRI); } } @@ -1163,33 +1192,35 @@ void handle_io(void) } for (d = dom_head; d; d = n) { + struct console *con = &d->console; + n = d->next; - if (d->event_count < RATE_LIMIT_ALLOWANCE) { - if (d->xce_handle != NULL && - d->xce_pollfd_idx != -1 && - !(fds[d->xce_pollfd_idx].revents & + if (con->event_count < RATE_LIMIT_ALLOWANCE) { + if (con->xce_handle != NULL && + con->xce_pollfd_idx != -1 && + !(fds[con->xce_pollfd_idx].revents & ~(POLLIN|POLLOUT|POLLPRI)) && - (fds[d->xce_pollfd_idx].revents & + (fds[con->xce_pollfd_idx].revents & POLLIN)) handle_ring_read(d); } - if (d->master_fd != -1 && d->master_pollfd_idx != -1) { - if (fds[d->master_pollfd_idx].revents & + if (con->master_fd != -1 && con->master_pollfd_idx != -1) { + if (fds[con->master_pollfd_idx].revents & ~(POLLIN|POLLOUT|POLLPRI)) domain_handle_broken_tty(d, domain_is_valid(d->domid)); else { - if (fds[d->master_pollfd_idx].revents & + if (fds[con->master_pollfd_idx].revents & POLLIN) handle_tty_read(d); - if (fds[d->master_pollfd_idx].revents & + if (fds[con->master_pollfd_idx].revents & POLLOUT) handle_tty_write(d); } } - d->xce_pollfd_idx = d->master_pollfd_idx = -1; + con->xce_pollfd_idx = con->master_pollfd_idx = -1; if (d->last_seen != enum_pass) shutdown_domain(d); From patchwork Wed Sep 27 06:13:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114336 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665417qgf; Tue, 26 Sep 2017 23:17:03 -0700 (PDT) X-Received: by 10.107.63.67 with SMTP id m64mr437491ioa.104.1506493023636; Tue, 26 Sep 2017 23:17:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493023; cv=none; d=google.com; s=arc-20160816; b=keXvLMnXqajC8mYPDLw6biZDSVa52NiB84j7Ljes40Tq5245/56xYjmXOWvOueBnuj wUw/Mc53DTa+w+EGNGE2aX1Nt8IyyhdGe3KJBwza/eA+z6bSQRsKjW9SU0dfAuTVPjXq sWR3BX+0sCo5Wdcwhe2IKuop2treVoirozczo+Nl1uUdSNSUpMO0zUOKru1AfW0sKYRi i0+S0AbajjwemiqnJJxMlRRAkRnYYyPzb8VXHbyBZcHp0rAYay8Y0zBKp/tu/ieOFUZt QOrj7v4+VJNB3PZRsQ2a8Cz4C8cHFBHaJBtdYRlsROuiR4iNsnCnCeUhZgAGPI6Al/yl So1w== 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=VinFKbGW/N9iWYxDU/IUOtMObQz7BGGOyQ2kukHnANc=; b=VMPudbIlpLyQPVWUPDLcDe5muhCTygHv48zTY1pezm7XF2n8HNCnABY4lmxk9EaR0A zZpyMElpKGHmEPqMrKr3CnX0dVTMFE2kTZehSh6Rn+7c7yO+sW3Lsa5Ma0HBHJTlAjya WrobXf5j2OmvkBcANpUSMa+L7yv4qF52x6RW/VWL3rQAXXld+a2HCPLV8nSQW8NCAzYb DG+Bo9pcNa5IFWciaqBklGvSPBet8QjOQxW3H/pmRn0NBuco492Vbv1DH5sp+ayRCx2H vevxkSpfBUMtlPbRmwWJpoTNV93CIJsqNnJUobNif1aTKK7bkesEkRCZeYB4lXZvZgip uZLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aeGlw/iW; 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 t15si3548404iti.72.2017.09.26.23.17.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:03 -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=aeGlw/iW; 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 1dx5bY-0002ZV-J3; Wed, 27 Sep 2017 06:13: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 1dx5bX-0002Xc-7W for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:55 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id A2/03-17770-2A14BC95; Wed, 27 Sep 2017 06:13:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsXiVRuspbvA8XS kQd8GA4vvWyYzOTB6HP5whSWAMYo1My8pvyKBNePC6172gr/SFRtu/mdtYNwv3sXIxSEkMI1R 4tihlawgDovAPGaJlVOmsnUxcnJICPSzSvy6AlTFAWTnSUzcYg4RTpNY2j6HBcKukPjd/ZgJx BYS0JI4emo2K8TQFUwS807sZQLpZRMwkZjVIQFSIyKgJHFv1WQmkBpmgfmMEk2TesF2CQskSj Rvec8MYrMIqEosf9cG1ssr4CMx8ZwpxC45iZvnOsFKOIHCp/tvs0Hs9Za4tLKfdQKj4AJGhlW MGsWpRWWpRbrGRnpJRZnpGSW5iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmbGIHhxgAEOxhPrws8 xCjJwaQkylvz/1SkEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQneOIfTkUKCRanpqRVpmTnAwIdJS 3DwKInwRoGkeYsLEnOLM9MhUqcYLTm+9N74w8Sxb88tINlx8+4fJiGWvPy8VClx3iqQBgGQho zSPLhxsOi8xCgrJczLCHSgEE9BalFuZgmq/CtGcQ5GJWHeZJApPJl5JXBbXwEdxAR0UO/UEyA HlSQipKQaGJfYXEsImPeRiVfww6ZNaYJdmx2iUkryQ7cZ9K46+VnwHOtNdr53LrtW/N1UMe8x 44p3ylovWUIudnVy3xBPSZnXuty/JCX5gNjrdeXmKTJfsr6tSWiVe/D6aTD3wiM1+nMuXBN9O Tmtzkzp6tmDATUzYh7G/NBcZhOUcGrNp1szlkY85BNenKvEUpyRaKjFXFScCABVwNuMyQIAAA == X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-12.tower-21.messagelabs.com!1506492831!84769283!1 X-Originating-IP: [74.125.83.42] 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 44945 invoked from network); 27 Sep 2017 06:13:52 -0000 Received: from mail-pg0-f42.google.com (HELO mail-pg0-f42.google.com) (74.125.83.42) by server-12.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:52 -0000 Received: by mail-pg0-f42.google.com with SMTP id 7so7210543pgd.13 for ; Tue, 26 Sep 2017 23:13:52 -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=AGHJrnwneXKl3Z1bjGKh+k5Ixw7YK+0ghFT9u/p0sak=; b=aeGlw/iWpU91r/VUxq+VOv779qlFg770iQFjOgfJPudEG1PjjJvp0ipMWZfSi9vkq/ ooo+VESCXYf8r/dwvbPUxpSU2sKjViVapZXGFcFnyazkVtQE1LnEyo4jAAiVhX2Ar8Y7 Xky3xeISnj4uwfDpGEjb/vSuEk2ZkbWlJJvsQ= 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=AGHJrnwneXKl3Z1bjGKh+k5Ixw7YK+0ghFT9u/p0sak=; b=Nr9224tEnnFx+OkoGTPl2FhVWkJN6ljLYcetg2WHlVRo+q1BWNhHyKH/6p9X3Dlh+f g4g1Sae+52avmPE4GjZ3yBlzuRBdQX0KG2qAqSaRxnjQDd3ghTMBJUC3VxtrF7cbOjvi smgHipjanwSqSPCaXF1mJA3O+9ObI4BrX84uNNl07FOJWQB0oj3cc76UOLzQqPv6cWGP hnoYOx2NQ183GiqmXO71W7UT1eufiiizacs7Gm87FvRzTBaG3N733VaOo8vEkhQZjnQl Nnsq151cpRRVKkDPXVXnPrHrdpI7B109BREExuTVB+4tXU31IZ1vnocEGDNDt5NwWPWH zhtQ== X-Gm-Message-State: AHPjjUj0StPRx8U0MXHw9KPg7JX9trJTJUK6mSjiB+xv73XssG4DU8Db 7pBOwdBwEHQPMe6hFiiPV3PTU0xZcW8= X-Google-Smtp-Source: AOwi7QDvYuV5FnIUrCxpwVxcZQ6fnkLWy0dTGNywWMrAr0pBeC9m96c0dbaBQ1lb8vNjDG6/9J3DCA== X-Received: by 10.84.253.23 with SMTP id z23mr329339pll.210.1506492831066; Tue, 26 Sep 2017 23:13:51 -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.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:50 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:18 +0530 Message-Id: <1506492816-25954-10-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 09/27 v11] xen/arm: vpl011: Rename the console structure field conspath to xspath 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" The console->conspath name is changed to console->xspath as it is clear from the name that it is referring to xenstore path. 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 v4: - Split this change in a separate patch. tools/console/daemon/io.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 30cd167..6f5c69c 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -95,7 +95,7 @@ struct console { int slave_fd; int log_fd; struct buffer buffer; - char *conspath; + char *xspath; int ring_ref; xenevtchn_handle *xce_handle; int xce_pollfd_idx; @@ -463,7 +463,7 @@ static int domain_create_tty(struct domain *dom) goto out; } - success = asprintf(&path, "%s/limit", con->conspath) != + success = asprintf(&path, "%s/limit", con->xspath) != -1; if (!success) goto out; @@ -474,7 +474,7 @@ static int domain_create_tty(struct domain *dom) } free(path); - success = (asprintf(&path, "%s/tty", con->conspath) != -1); + success = (asprintf(&path, "%s/tty", con->xspath) != -1); if (!success) goto out; success = xs_write(xs, XBT_NULL, path, slave, strlen(slave)); @@ -546,14 +546,14 @@ static int domain_create_ring(struct domain *dom) char *type, path[PATH_MAX]; struct console *con = &dom->console; - err = xs_gather(xs, con->conspath, + err = xs_gather(xs, con->xspath, "ring-ref", "%u", &ring_ref, "port", "%i", &remote_port, NULL); if (err) goto out; - snprintf(path, sizeof(path), "%s/type", con->conspath); + snprintf(path, sizeof(path), "%s/type", con->xspath); type = xs_read(xs, XBT_NULL, path, NULL); if (type && strcmp(type, "xenconsoled") != 0) { free(type); @@ -646,13 +646,13 @@ static bool watch_domain(struct domain *dom, bool watch) snprintf(domid_str, sizeof(domid_str), "dom%u", dom->domid); if (watch) { - success = xs_watch(xs, con->conspath, domid_str); + success = xs_watch(xs, con->xspath, domid_str); if (success) domain_create_ring(dom); else - xs_unwatch(xs, con->conspath, domid_str); + xs_unwatch(xs, con->xspath, domid_str); } else { - success = xs_unwatch(xs, con->conspath, domid_str); + success = xs_unwatch(xs, con->xspath, domid_str); } return success; @@ -682,13 +682,13 @@ static struct domain *create_domain(int domid) dom->domid = domid; con = &dom->console; - con->conspath = xs_get_domain_path(xs, dom->domid); - s = realloc(con->conspath, strlen(con->conspath) + + con->xspath = xs_get_domain_path(xs, dom->domid); + s = realloc(con->xspath, strlen(con->xspath) + strlen("/console") + 1); if (s == NULL) goto out; - con->conspath = s; - strcat(con->conspath, "/console"); + con->xspath = s; + strcat(con->xspath, "/console"); con->master_fd = -1; con->master_pollfd_idx = -1; @@ -712,7 +712,7 @@ static struct domain *create_domain(int domid) return dom; out: - free(con->conspath); + free(con->xspath); free(dom); return NULL; } @@ -756,8 +756,8 @@ static void cleanup_domain(struct domain *d) free(con->buffer.data); con->buffer.data = NULL; - free(con->conspath); - con->conspath = NULL; + free(con->xspath); + con->xspath = NULL; remove_domain(d); } From patchwork Wed Sep 27 06:13:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114341 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665506qgf; Tue, 26 Sep 2017 23:17:09 -0700 (PDT) X-Received: by 10.107.186.6 with SMTP id k6mr448988iof.183.1506493029666; Tue, 26 Sep 2017 23:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493029; cv=none; d=google.com; s=arc-20160816; b=jJcqqA3Ur66clTd0QGybuBkweZxBSbhjwI6CO3uB9+qCY7UhhPGinZIM4WlgB1ubfg 2CJR/Fz86aX/FYjeUdxkVb13fiGIe+gxE+KU24wK9xwLG0le8cDuoqCHjrttCBpSrI7W 9TieakPLrPCddHIpdtLxFkYeRT+JP5zvyX8zHF3Uqdw6aLXfCZml+GN1KyTTzLdm2f1o 7oFLDbGPbvKzNgkAjJ+kB5curqiVa285WZ1Nzu3lXd/ezyK91HReZgh7Xo+FVOu+dmiT ZDcpWB+Mv6h2yTfGfevT0My7A9RFrCJQ+hGP/Hex79487CS4g7Ck9F+sFOxzVNQEtRKm MnIg== 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=WXsVKFtSEvooh/gQViJFmbABTRKBe0u52bhIWXyD934=; b=TpqbsOUVp21zKao0yObXP5IJxHKCkeE2iWuZCYrvkvtTBnVeo9Gk7VOkqtROCnWWUa nUHcjyMwWTod39CpfK8zM+Pv/F/fGCSzdKolkep7xk92wnVUMOttgezwPsvEcs9PjKIZ rbVyI1BHVKFsQW2lIsOX8V++umb/aBFbg7jOVMSCQkpt90lU4XisCGKWn2t73bqAb2fV WkEv+JuRNn4UBr5l0f40EgH/sxSTYVVc9MnAPXBbTUgoSBM9B+shi1xaZ2AjmvTWdKwX Rujx4nOyOO61BnQYkMvI/TroM4awnLSfXA8+oCTP4npSthHmfb8a7xq4ef11tskreAd7 z9+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hjbXyCzS; 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 u26si9178235ioi.29.2017.09.26.23.17.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:09 -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=hjbXyCzS; 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 1dx5bZ-0002bD-7t; Wed, 27 Sep 2017 06:13:57 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bX-0002Xk-IK for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:55 +0000 Received: from [85.158.137.68] by server-13.bemta-3.messagelabs.com id 43/E2-01916-2A14BC95; Wed, 27 Sep 2017 06:13:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsXiVRtsqrvQ8XS kwf/jNhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa0bDibPMBW89K7oO7WBsYPxr08XIxSEkMJ1R 4tOTXcwgDovAPGaJJ9v72UEcCYF+VokJWy+ydjFyAjl5EqfbD7BD2GkS0zdeAOrgALIrJJ6cE AQJCwloSRw9NZsVYuoKJokVp64xgdSwCZhIzOqQAKkREVCSuLdqMhNIDbPAfEaJpkm9bCAJYY Esif0v/jGB2CwCqhLf+hvA4rwCPhIPTn9ggdgrJ3HzXCcziM0JFD/df5sNYrG3xKWV/awTGAU XMDKsYtQoTi0qSy3SNbTUSyrKTM8oyU3MzNE1NDDWy00tLk5MT81JTCrWS87P3cQIDLl6BgbG HYy/j/sdYpTkYFIS5a35fypSiC8pP6UyI7E4I76oNCe1+BCjDAeHkgTvPIfTkUKCRanpqRVpm TnA4IdJS3DwKInwRoGkeYsLEnOLM9MhUqcYLTm+9N74w8Sxb88tINlx8+4fJiGWvPy8VClx3i qQBgGQhozSPLhxsAi9xCgrJczLyMDAIMRTkFqUm1mCKv+KUZyDUUmYdyHIFJ7MvBK4ra+ADmI COqh36gmQg0oSEVJSDYy1nuvvfpv11ELMN8/h2fdzf1xDZqt9qr5oXGVePEM3Z8ECNbbc2Ztu RUf9L9TZfON7zSLNvVpxvyRe3pi34EPoqZL5KbxK795fLtj59ZracodZeZ/vNzzQ3pWiVPpO9 bKTan7a0n0fJZease8R4Po0/wKvb/P/Y3aP/JYeZWGrlRJbWSqnVrVAiaU4I9FQi7moOBEADQ FPAcsCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-31.messagelabs.com!1506492832!116761331!1 X-Originating-IP: [74.125.83.53] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38896 invoked from network); 27 Sep 2017 06:13:53 -0000 Received: from mail-pg0-f53.google.com (HELO mail-pg0-f53.google.com) (74.125.83.53) by server-8.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:53 -0000 Received: by mail-pg0-f53.google.com with SMTP id v23so7222457pgc.5 for ; Tue, 26 Sep 2017 23:13:53 -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=/c87JD9XyWkvHP2iWascyeQ5IUSzbfWQc11J8Ir9N+k=; b=hjbXyCzSSoam0ZYpCx4eFRK/Xz6t0SMoAGwyAKnMM/wdyz6jAKs6eCuVkr3oDAR4ye /cvfCsw+SQLh+x7aLYImfz/scQIhb6eGXHSLWg0mHnzFD/Eg7CrKiiRBcE4hKjzWCMQG b45nqo+6ilxyfiIqTXnQIGN4DaCytVq38ebXk= 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=/c87JD9XyWkvHP2iWascyeQ5IUSzbfWQc11J8Ir9N+k=; b=fF3RKLuxp/ablPDSrPdBfCK1zW++LAPATV2Ee5XqYOQ0JGX64Tb/Z8mJnSJPKhxy0Q IKQtloXG4OyDPR1/m1UZf4nEnTCVtSBBmszGYVOeCorImvy7Q6RnYP5DzztRRQDzUoIG 09eTXNWHCp/p/gg5tNFEl00WIFvakeKWFe1+j2N6fe9qhFCje4g4iByx8yrGdFnJiWPw uvEX+nHq4IPqvKydh77ZSb1FNJKd3ML4xb8P3heCZYBA4RUZemHHE6AZuyIyXLDNF15F Z7ikxRNoGHDUHPdpB1q5irCq+euPiLwntAILKtYXQWpHd0/ozAsASj0TD0bddWLoGjer tm4w== X-Gm-Message-State: AHPjjUgbYeBv9PlE9L/ZCrgOJGKe/NtvI+puDb09o2xebt0vpGQ/AO1N XAkNRvE6v7Cw/+sYsmPnOHAQLDHAyR0= X-Google-Smtp-Source: AOwi7QC1KdjffUPy/2oGhLGZu3B+Tf5uQKuiudvd6yX4g2Rftt/njVPv1ltciehHP87+CvikkudUeQ== X-Received: by 10.98.68.206 with SMTP id m75mr333721pfi.163.1506492832102; Tue, 26 Sep 2017 23:13:52 -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.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:51 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:19 +0530 Message-Id: <1506492816-25954-11-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 10/27 v11] xen/arm: vpl011: Modify xenconsole functions to take console structure as input 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" Xenconsole functions take domain structure as input. These functions shall be modified to take console structure as input since these functions typically perform console specific operations. Also the console specific functions starting with prefix "domain_" shall be modified to "console_" to indicate that these are console specific functions. This patch is in preparation to support multiple consoles to support vuart console. Signed-off-by: Bhupinder Thakur Acked-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v3: - The changes in xenconsole have been split into multiple patches. This is the second patch. tools/console/daemon/io.c | 79 +++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 6f5c69c..a2a3496 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -163,10 +163,10 @@ static int write_with_timestamp(int fd, const char *data, size_t sz, return 0; } -static void buffer_append(struct domain *dom) +static void buffer_append(struct console *con) { - struct console *con = &dom->console; struct buffer *buffer = &con->buffer; + struct domain *dom = con->d; XENCONS_RING_IDX cons, prod, size; struct xencons_interface *intf = con->interface; @@ -296,12 +296,13 @@ static int create_hv_log(void) return fd; } -static int create_domain_log(struct domain *dom) +static int create_console_log(struct console *con) { char logfile[PATH_MAX]; char *namepath, *data, *s; int fd; unsigned int len; + struct domain *dom = con->d; namepath = xs_get_domain_path(xs, dom->domid); s = realloc(namepath, strlen(namepath) + 6); @@ -342,10 +343,8 @@ static int create_domain_log(struct domain *dom) return fd; } -static void domain_close_tty(struct domain *dom) +static void console_close_tty(struct console *con) { - struct console *con = &dom->console; - if (con->master_fd != -1) { close(con->master_fd); con->master_fd = -1; @@ -417,7 +416,7 @@ void cfmakeraw(struct termios *termios_p) } #endif /* __sun__ */ -static int domain_create_tty(struct domain *dom) +static int console_create_tty(struct console *con) { const char *slave; char *path; @@ -426,7 +425,7 @@ static int domain_create_tty(struct domain *dom) char *data; unsigned int len; struct termios term; - struct console *con = &dom->console; + struct domain *dom = con->d; assert(con->slave_fd == -1); assert(con->master_fd == -1); @@ -487,7 +486,7 @@ static int domain_create_tty(struct domain *dom) return 1; out: - domain_close_tty(dom); + console_close_tty(con); return 0; } @@ -526,10 +525,8 @@ static int xs_gather(struct xs_handle *xs, const char *dir, ...) return ret; } -static void domain_unmap_interface(struct domain *dom) +static void console_unmap_interface(struct console *con) { - struct console *con = &dom->console; - if (con->interface == NULL) return; if (xgt_handle && con->ring_ref == -1) @@ -540,11 +537,11 @@ static void domain_unmap_interface(struct domain *dom) con->ring_ref = -1; } -static int domain_create_ring(struct domain *dom) +static int console_create_ring(struct console *con) { int err, remote_port, ring_ref, rc; char *type, path[PATH_MAX]; - struct console *con = &dom->console; + struct domain *dom = con->d; err = xs_gather(xs, con->xspath, "ring-ref", "%u", &ring_ref, @@ -563,7 +560,7 @@ static int domain_create_ring(struct domain *dom) /* If using ring_ref and it has changed, remap */ if (ring_ref != con->ring_ref && con->ring_ref != -1) - domain_unmap_interface(dom); + console_unmap_interface(con); if (!con->interface && xgt_handle) { /* Prefer using grant table */ @@ -621,7 +618,7 @@ static int domain_create_ring(struct domain *dom) con->remote_port = remote_port; if (con->master_fd == -1) { - if (!domain_create_tty(dom)) { + if (!console_create_tty(con)) { err = errno; xenevtchn_close(con->xce_handle); con->xce_handle = NULL; @@ -632,7 +629,7 @@ static int domain_create_ring(struct domain *dom) } if (log_guest && (con->log_fd == -1)) - con->log_fd = create_domain_log(dom); + con->log_fd = create_console_log(con); out: return err; @@ -648,7 +645,7 @@ static bool watch_domain(struct domain *dom, bool watch) if (watch) { success = xs_watch(xs, con->xspath, domid_str); if (success) - domain_create_ring(dom); + console_create_ring(con); else xs_unwatch(xs, con->xspath, domid_str); } else { @@ -695,6 +692,7 @@ static struct domain *create_domain(int domid) con->slave_fd = -1; con->log_fd = -1; con->xce_pollfd_idx = -1; + con->d = dom; con->next_period = ((long long)ts.tv_sec * 1000) + (ts.tv_nsec / 1000000) + RATE_LIMIT_PERIOD; @@ -746,7 +744,7 @@ static void cleanup_domain(struct domain *d) { struct console *con = &d->console; - domain_close_tty(d); + console_close_tty(con); if (con->log_fd != -1) { close(con->log_fd); @@ -768,7 +766,7 @@ static void shutdown_domain(struct domain *d) d->is_dead = true; watch_domain(d, false); - domain_unmap_interface(d); + console_unmap_interface(con); if (con->xce_handle != NULL) xenevtchn_close(con->xce_handle); con->xce_handle = NULL; @@ -799,9 +797,8 @@ static void enum_domains(void) } } -static int ring_free_bytes(struct domain *dom) +static int ring_free_bytes(struct console *con) { - struct console *con = &dom->console; struct xencons_interface *intf = con->interface; XENCONS_RING_IDX cons, prod, space; @@ -816,30 +813,30 @@ static int ring_free_bytes(struct domain *dom) return (sizeof(intf->in) - space); } -static void domain_handle_broken_tty(struct domain *dom, int recreate) +static void console_handle_broken_tty(struct console *con, int recreate) { - domain_close_tty(dom); + console_close_tty(con); if (recreate) { - domain_create_tty(dom); + console_create_tty(con); } else { - shutdown_domain(dom); + shutdown_domain(con->d); } } -static void handle_tty_read(struct domain *dom) +static void handle_tty_read(struct console *con) { ssize_t len = 0; char msg[80]; int i; - struct console *con = &dom->console; struct xencons_interface *intf = con->interface; + struct domain *dom = con->d; XENCONS_RING_IDX prod; if (dom->is_dead) return; - len = ring_free_bytes(dom); + len = ring_free_bytes(con); if (len == 0) return; @@ -853,7 +850,7 @@ static void handle_tty_read(struct domain *dom) * keep the slave open for the duration. */ if (len < 0) { - domain_handle_broken_tty(dom, domain_is_valid(dom->domid)); + console_handle_broken_tty(con, domain_is_valid(dom->domid)); } else if (domain_is_valid(dom->domid)) { prod = intf->in_prod; for (i = 0; i < len; i++) { @@ -864,15 +861,15 @@ static void handle_tty_read(struct domain *dom) intf->in_prod = prod; xenevtchn_notify(con->xce_handle, con->local_port); } else { - domain_close_tty(dom); + console_close_tty(con); shutdown_domain(dom); } } -static void handle_tty_write(struct domain *dom) +static void handle_tty_write(struct console *con) { ssize_t len; - struct console *con = &dom->console; + struct domain *dom = con->d; if (dom->is_dead) return; @@ -882,7 +879,7 @@ static void handle_tty_write(struct domain *dom) if (len < 1) { dolog(LOG_DEBUG, "Write failed on domain %d: %zd, %d\n", dom->domid, len, errno); - domain_handle_broken_tty(dom, domain_is_valid(dom->domid)); + console_handle_broken_tty(con, domain_is_valid(dom->domid)); } else { buffer_advance(&con->buffer, len); } @@ -901,7 +898,7 @@ static void handle_ring_read(struct domain *dom) con->event_count++; - buffer_append(dom); + buffer_append(con); if (con->event_count < RATE_LIMIT_ALLOWANCE) (void)xenevtchn_unmask(con->xce_handle, port); @@ -925,7 +922,7 @@ static void handle_xs(void) /* We may get watches firing for domains that have recently been removed, so dom may be NULL here. */ if (dom && dom->is_dead == false) - domain_create_ring(dom); + console_create_ring(&dom->console); } free(vec); @@ -975,7 +972,7 @@ static void handle_log_reload(void) if (con->log_fd != -1) close(con->log_fd); - con->log_fd = create_domain_log(d); + con->log_fd = create_console_log(con); } } @@ -1121,7 +1118,7 @@ void handle_io(void) if (con->master_fd != -1) { short events = 0; - if (!d->is_dead && ring_free_bytes(d)) + if (!d->is_dead && ring_free_bytes(con)) events |= POLLIN; if (!buffer_empty(&con->buffer)) @@ -1208,15 +1205,15 @@ void handle_io(void) if (con->master_fd != -1 && con->master_pollfd_idx != -1) { if (fds[con->master_pollfd_idx].revents & ~(POLLIN|POLLOUT|POLLPRI)) - domain_handle_broken_tty(d, + console_handle_broken_tty(con, domain_is_valid(d->domid)); else { if (fds[con->master_pollfd_idx].revents & POLLIN) - handle_tty_read(d); + handle_tty_read(con); if (fds[con->master_pollfd_idx].revents & POLLOUT) - handle_tty_write(d); + handle_tty_write(con); } } From patchwork Wed Sep 27 06:13:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114335 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665404qgf; Tue, 26 Sep 2017 23:17:02 -0700 (PDT) X-Received: by 10.36.225.202 with SMTP id n193mr935773ith.106.1506493022891; Tue, 26 Sep 2017 23:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493022; cv=none; d=google.com; s=arc-20160816; b=OYXWT76loBQE5gs+oCx8jPhHVfERgVRWSvVOjePROETQ7l7Ri4cKzprPiYpm644x9W Chbk0gL7OzcWA/5hStpITod2XsVhHB11p3kW1bmcJo1goEzjoZuHWaNULU1h5b7qoWtI rpbdhGH0R3XJoL54sXYKp0YeCrYv1cUpcXpjGSbahfcCJp8GiPnCem0I9OEmAvZqWEQy rOJKXKJ7pjB0g+hoDzvVzPNZBOXTxwNKnPlhl/S8O1Ltg/TcjELpOFexpJ7G6PyYXItc exIg7aE7VfIQomnWK2aCOIv/N17xCr3ASytElMfAWNGbambeIjxq6MNdSfW64VPQOUkX 7CTg== 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=HCv3UlhcoI7MIaid0Q2Iq9o17QQmhXdFQEnxbwICUws=; b=Kw6Dhg8nq7OuNiUvoBWrtqkk2581DBjY8oIPvgAdNfqIMOMEnSvOQh34jCF9fmhjEO bp2oUd5aJGyJPrSMgn4I4DZMOt/MFnlFidFwYzjIfK+eFbyJBSxYhO5my6CaaLNKhJg/ bO0M5SK1iY1vIRqmmu+mL4qr3djG8G+jzcdtqkQ6wnSC2JpGo8BCbkTZ15o7SUU5A1UM lNQWTnY+M3WofbtX692hDZqIbcOw3bqX9h4jGQmRR1P7wI82d3h1M+C6lHIr3WoBC/is Fw0SrirMoDfiq3r0Mg+nkZHQ+5UfoisJcb+0sAjQtV/llFAT0cQ7xGub0odFMidoomBk jVYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ACgZigtR; 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 e190si3470769itb.85.2017.09.26.23.17.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:02 -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=ACgZigtR; 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 1dx5bc-0002fi-08; Wed, 27 Sep 2017 06:14:00 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5ba-0002b2-Cv for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:58 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id FA/2A-03454-6A14BC95; Wed, 27 Sep 2017 06:13:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsXiVRusr7vY8XS kwebd4hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa0bDng7GghXiFUfPnGBuYNwl3MXIxSEkMJNR onP2YjYQh0VgHrPE/s2TGUEcCYF+Voktk+6zdjFyAjl5Ek1bLjFC2GkSx9cugbLLJa6cOscGY gsJaEkcPTWbFWLsCiaJU6397F2MHBxsAiYSszokQGpEBJQk7q2azARSwywwn1GiaVIvWLOwQK TEgtU7mEBsFgFVib77l8HivAI+EhMbP7FDLJOTuHmukxnE5gSKn+6/DbXYW+LSyn7WCYyCCxg ZVjGqF6cWlaUW6VrqJRVlpmeU5CZm5ugaGpjp5aYWFyemp+YkJhXrJefnbmIEhhwDEOxgvLsp 4BCjJAeTkihvzf9TkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeOc5nI4UEixKTU+tSMvMAQY/T FqCg0dJhPcaSJq3uCAxtzgzHSJ1itGS40vvjT9MHPv23AKSHTfv/mESYsnLz0uVEuetAmkQAG nIKM2DGweL0EuMslLCvIxABwrxFKQW5WaWoMq/YhTnYFQS5l0IMoUnM68EbusroIOYgA7qnXo C5KCSRISUVANjYkrVx6DSeQ5KwodvvfNdbppVw617Zebf7D291lw/G8+7p6pqLgnS+iC96Pzv hkMVHjW+PAxi2YWaxxk5NR2cmLoeHjy/JuLei5sbvKvM+KavfydjWZR1g3PL0QPm1xdlVVx/G CiT3Ta784ixbJ5adpCENmdCh+6uQGHHuKnWn29Y28T8tVRiKc5INNRiLipOBAC2VxI4ywIAAA == X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-21.messagelabs.com!1506492834!84672494!1 X-Originating-IP: [74.125.83.47] 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 28061 invoked from network); 27 Sep 2017 06:13:55 -0000 Received: from mail-pg0-f47.google.com (HELO mail-pg0-f47.google.com) (74.125.83.47) by server-8.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:55 -0000 Received: by mail-pg0-f47.google.com with SMTP id c137so7216449pga.11 for ; Tue, 26 Sep 2017 23:13:55 -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=EtvhJzM3HTL/NgQ6915SS3H5bdB2TB/oZeG6xtku1W0=; b=ACgZigtReMLZNLNAD6D7Z9BSSbnYrGDPUa8YkQuvdbz2dd9e86ZlpGAxahGdaa4Flw Z6jm9hoSZmYGJfhvjhRz3V/MavfYamx5gxAeUyFKjVLNdeKKlDZkR6tq6L8wQWXelQu1 FrKyRR9w3Mqthu0k6RZJNjnrihnPsFcsxoM2s= 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=EtvhJzM3HTL/NgQ6915SS3H5bdB2TB/oZeG6xtku1W0=; b=FXoE+Atm/P0IGNVeSOVE7QVPg9eSzY9T64GBA2T4hu2Mvcoc2TuBJysLxtckwuO96y qr7MoSpZJx6aa4HcJtjWsfU0K4jn60pXNo7nNUVMZhibTpvL0Qwc6JQTSCKnTuqzY6Ic zXJ+jlUGXkNLTxHx0eiXYe/zvkiaW1tDws0+/hriJDFIv1pJydrfCK2BeReu6sO+vqcp btWKgcw9l9p3nCMY6pjTCs01iDJ9enCeVHAYBjg7V9Fz/L8DYMeKHyH66Z1SyIZUvBsi lqzFWJVgMyMl6c07G4L9MMFbkEUFljnoqM2RVMswa53z/dn+UTK74Rn2cT4X9HQwJza+ I4vg== X-Gm-Message-State: AHPjjUi6xi4hUTX8kWpK6azJdHnW6GrPQ4gPk1n5IPstDBTlTcfYWSjT WMubisG6rEbSpZIvbCvbQDTXnNEosLo= X-Google-Smtp-Source: AOwi7QC1GF2V1kWRwmEdi5Dr+JvZAjzVDrM9VM+G5CGCsZnvp95w00eOqBenWiFbW7f9DWvBY2351A== X-Received: by 10.159.252.5 with SMTP id n5mr324029pls.360.1506492833344; Tue, 26 Sep 2017 23:13:53 -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.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:52 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:20 +0530 Message-Id: <1506492816-25954-12-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 11/27 v11] xen/arm: vpl011: Add a new console_init 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 console_init function. This function initializes the console structure. Signed-off-by: Bhupinder Thakur 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 | 65 ++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index a2a3496..1da08d7 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -655,20 +655,51 @@ static bool watch_domain(struct domain *dom, bool watch) return success; } - -static struct domain *create_domain(int domid) +static int console_init(struct console *con, struct domain *dom) { - struct domain *dom; char *s; + int err = -1; struct timespec ts; - struct console *con; if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) { dolog(LOG_ERR, "Cannot get time of day %s:%s:L%d", __FILE__, __FUNCTION__, __LINE__); - return NULL; + return err; } + con->master_fd = -1; + con->master_pollfd_idx = -1; + con->slave_fd = -1; + con->log_fd = -1; + con->ring_ref = -1; + con->local_port = -1; + con->remote_port = -1; + con->xce_pollfd_idx = -1; + con->next_period = ((long long)ts.tv_sec * 1000) + (ts.tv_nsec / 1000000) + RATE_LIMIT_PERIOD; + con->d = dom; + con->xspath = xs_get_domain_path(xs, dom->domid); + s = realloc(con->xspath, strlen(con->xspath) + + strlen("/console") + 1); + if (s) { + con->xspath = s; + strcat(con->xspath, "/console"); + err = 0; + } + + return err; +} + +static void console_free(struct console *con) +{ + if (con->xspath) + free(con->xspath); +} + +static struct domain *create_domain(int domid) +{ + struct domain *dom; + struct console *con; + dom = calloc(1, sizeof *dom); if (dom == NULL) { dolog(LOG_ERR, "Out of memory %s:%s():L%d", @@ -677,28 +708,10 @@ static struct domain *create_domain(int domid) } dom->domid = domid; - con = &dom->console; - con->xspath = xs_get_domain_path(xs, dom->domid); - s = realloc(con->xspath, strlen(con->xspath) + - strlen("/console") + 1); - if (s == NULL) - goto out; - con->xspath = s; - strcat(con->xspath, "/console"); - - con->master_fd = -1; - con->master_pollfd_idx = -1; - con->slave_fd = -1; - con->log_fd = -1; - con->xce_pollfd_idx = -1; - con->d = dom; - - con->next_period = ((long long)ts.tv_sec * 1000) + (ts.tv_nsec / 1000000) + RATE_LIMIT_PERIOD; - con->ring_ref = -1; - con->local_port = -1; - con->remote_port = -1; + if (console_init(con, dom)) + goto out; if (!watch_domain(dom, true)) goto out; @@ -710,7 +723,7 @@ static struct domain *create_domain(int domid) return dom; out: - free(con->xspath); + console_free(con); free(dom); return NULL; } From patchwork Wed Sep 27 06:13:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114342 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665509qgf; Tue, 26 Sep 2017 23:17:10 -0700 (PDT) X-Received: by 10.36.131.4 with SMTP id d4mr828555ite.43.1506493030026; Tue, 26 Sep 2017 23:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493030; cv=none; d=google.com; s=arc-20160816; b=KW/Mk5OFolXjViDtrLEn+qIWLB5dxyAhIiDAr5mPwZzTbWVXZ7u2MMsyEtniQdbRAe uLzXmxwK78fzC1GO+ZCnFm9anxnRnkZjCLR1E7vOhKA8w3EU4wViqTReiGs689JtcaHg rmFYeouPnYJCLHXPrEEcFddpKqHEGW9ci18aTkhoqrCK10gWaNILgaWSP6P45sEkQVpm 9CV3OhM1DCqLLFZyOeY2/pQ8PnrnJoIk5yLtvfIwUjgzwtYNP1eGGCM2FN4LPVMx9TRy voRLi2KykVO/EPimvKAjlRoEtAN+xSi6IDSaM4J3YRwLFz0L8ckNdaVRja5xAieG0rws e9hA== 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=RBIonTcOwRkHLeFjaA/5ZTqVDWSkdEy4IXZH98gtXnM=; b=mTVGYA7qUtday5AqA16smLDyXpxHVqAQK1ZWZmgSlg8hMpSp9Q218gHzBGACv+Mzm8 ypRARjcwVqBzSwCXwSxsAqL76nUS8TCIsUBmwZ1Yq/ejy5Md5Rqdh2mnG0uDra8amiGn zJXzjqAg09C/jWLU8uE4oq3pjXwzHyB59iWeqcTE9GNFoyuCZVH0zC0bdS0kuUBAsW7t nxA4vwuuVuCboUNUTe/H9rm1nV1BmIDGIAKpIaWbjkArk943Kn/UMQb5FjZfphLocakV 0/zo9i2Km9Kh5oeelVw5IBFZmV8GagphedEPUQkBhjuHS1DWNkDNcMPVLxa3qnnYoj8H NUGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OWP8kGBd; 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 192si3476936itw.92.2017.09.26.23.17.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:10 -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=OWP8kGBd; 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 1dx5bb-0002eQ-G8; Wed, 27 Sep 2017 06:13:59 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bZ-0002b2-Jf for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:57 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id F0/2A-03454-4A14BC95; Wed, 27 Sep 2017 06:13:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsXiVRtsprvE8XS kwY+9Ihbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bey3eZC77xVFx8vp6tgfEhVxcjJ4eQwAxG iY4DOl2MXBwsAvOYJfZ8OcgO4kgI9LNK3F6xlaWLkQPIyZN4sUkBpEFCIE3i6qYpTBB2mUTDm mcsEIO0JI6ems0K0isksIJJ4trqSUwgvWwCJhKzOiRAakQElCTurZrMBFLDLDCfUaJpUi8bSE JYIFbiXMd1RpB6FgFViYf/UkDCvAI+Et+v7GeH2CUncfNcJzOIzQkUP91/mw1ir7fEpZX9rBM YBRcwMqxi1ChOLSpLLdI1MtdLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMNwYg 2MG4eG3gIUZJDiYlUd6a/6cihfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwznM4HSkkWJSanlqRl pkDDHyYtAQHj5IIbxRImre4IDG3ODMdInWK0ZLjS++NP0wc+/bcApIdN+/+YRJiycvPS5US56 0CaRAAacgozYMbB4vOS4yyUsK8jEAHCvEUpBblZpagyr9iFOdgVBLmXQgyhSczrwRu6yugg5i ADuqdegLkoJJEhJRUA2Oo8Mx1Nyyb1RuZU3nEOIovPm39m3fsVpbgsmuzJix8nXHpC2tDiS6z qSLj8ugXabzz+HXi/LpeGW36aXaP50ChBPPWBJOeBckZjgrqlu5bdnf+vJ/Fd/Okx9+yDW82C vcu96vf+83MJu5Fm+KaV5beQpOKplkltV6d5zZJq0M0U2oFS7l/jhJLcUaioRZzUXEiAB0PBI jJAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-4.tower-27.messagelabs.com!1506492835!117902735!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.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8302 invoked from network); 27 Sep 2017 06:13:56 -0000 Received: from mail-pg0-f54.google.com (HELO mail-pg0-f54.google.com) (74.125.83.54) by server-4.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:56 -0000 Received: by mail-pg0-f54.google.com with SMTP id i130so7220540pgc.3 for ; Tue, 26 Sep 2017 23:13:56 -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=yB+nxIvgk8UjZRr/CwimK1H7zFddzpCzBRq7KGA1phI=; b=OWP8kGBdShsB2FfJjqbETfUTALPZ9rQXNFBN0kbc1zsE/9gQwuY8LzzNAkD5dsnOHP MHfNEbdSWqxt/bXGeT/Twd5D6vhMJ2IdLXbYxbulSkKwr4yOuP8g95bWChxOTkX7xEcM IZRlzLuLf8GRijB6h2b5vgpdjjxITbgjdxUsY= 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=yB+nxIvgk8UjZRr/CwimK1H7zFddzpCzBRq7KGA1phI=; b=QNtZlKZhgX3QujoJhEZiyMeOgzzErpxU05fdP4pwtKTQeqd6I03+QCZhh0faHn5xFg fD+juxBdzUEoA9w0mMzorU+hVjG31fO9i/6/9XSLFGyg4VnXQzqu3/TgoEoXTPSi1mvH X9BG8Vu+zDqpXii56WVMLu5DSNrQ/lTuCiTvWQkTjTKlt4kj2v9+dv5/TgPhfdJGtvOI aWRZEp6RceojeR+uoxPLFrwoApEBLyOWkv8nT4BdC0Kk5Q/l1AT7nUe3+zJylWmW9tPz 841m4SeBNpHDhr6eiCyKRl4JgYm8sGo07p6HBlAcNZJBET72cPh4sb9CL/3TFBaueqAa tspg== X-Gm-Message-State: AHPjjUhS9BLshksn4+5oJJh8mGy1qUAweCK8gWpWsEkV7qVYwzKGjV/6 3VjMOB5xI7ifekj/SO4JsMfZfkZ+Irs= X-Google-Smtp-Source: AOwi7QAV23G+LeEu8Fxh/Hgcr93T9ko3GJ/MpgOEYm4qpRE2gI+K5VIvjf1K8aYB35L2m5kea2pikA== X-Received: by 10.84.254.4 with SMTP id b4mr307280plm.285.1506492834504; Tue, 26 Sep 2017 23:13:54 -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.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:54 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:21 +0530 Message-Id: <1506492816-25954-13-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 12/27 v11] xen/arm: vpl011: Add a new buffer_available 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 buffer_available function to check if more data is allowed to be buffered. 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 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 1da08d7..0009bbe 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -163,6 +163,16 @@ static int write_with_timestamp(int fd, const char *data, size_t sz, return 0; } +static inline bool buffer_available(struct console *con) +{ + if (discard_overflowed_data || + !con->buffer.max_capacity || + con->buffer.size < con->buffer.max_capacity) + return true; + else + return false; +} + static void buffer_append(struct console *con) { struct buffer *buffer = &con->buffer; @@ -1120,9 +1130,7 @@ void handle_io(void) con->next_period < next_timeout) next_timeout = con->next_period; } else if (con->xce_handle != NULL) { - if (discard_overflowed_data || - !con->buffer.max_capacity || - con->buffer.size < con->buffer.max_capacity) { + if (buffer_available(con)) { int evtchn_fd = xenevtchn_fd(con->xce_handle); con->xce_pollfd_idx = set_fds(evtchn_fd, POLLIN|POLLPRI); From patchwork Wed Sep 27 06:13:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114333 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665377qgf; Tue, 26 Sep 2017 23:17:01 -0700 (PDT) X-Received: by 10.36.44.200 with SMTP id i191mr930080iti.136.1506493020967; Tue, 26 Sep 2017 23:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493020; cv=none; d=google.com; s=arc-20160816; b=gtYu5zNUUyAaE2WdzqQIH3EoTCo6vEVCfCUF5Cd8pESW1QkAPjo5WcTeyLVbdbROKS 00O6C+uYeHrmWoI2cQ63yxYV9e/HGXDmv1BjNmae5LpL2/BifbMbFm8UIdHhCYSQ6+Bz qlhpzyybXG4N4yJ2tgcQckC+amQB9nO4Oxu8YNdLfg1IlKD/e25mu6P5UiIjuXtd08Ui PPnHwD+Gf9pbXwSlBgbwsri7/Nrhk6b9YIBBIwKfrrDaU97RkhRwqI6mQ68/Z8+zSGCv 9kSm+yVaPql4Y90gwTIR6d/x8+q7rXFO8ucrg/+jhI2yEtcmutxdj2UdnieZO4F/MphS D/iQ== 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=EncVTiWfBbtIxylxnUk9+xT21OqnAVDQk2kqPlpQZiU=; b=blCzuFOuGEJerQlRU5g4vwgmZcC0t0aeh5zIOoF45pgOArXMz+Z8sFMo54h/ouqcAP eCuOjSTyrIjFDMHP73g2YGxtCSJ/vjiqqPz6MlJ9lwzuU6RLPth+bMdxRt2DTwTewryv XegtUxOK7qJljV/hAyv01G3bfgQHPlLBDjxTcnfFBnFa+ni6jEQpAG+PCsIadUgqSqNS FpRG7MJQAwoxm6Lp5ZWsrrGhBLWnjtKSAgfBiDEaaqhax37AKo1M4V/3ConAUgOx6GWT QvVRzLsKDEPT0oFZeF4TWP32yjpILz/fdRVvIh8H+IO00CPT9g0DruhThZHhYfbgngt5 nV+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NnszRVRX; 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 k6si8963838ioi.250.2017.09.26.23.17.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:00 -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=NnszRVRX; 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 1dx5bb-0002ex-No; Wed, 27 Sep 2017 06:13:59 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5ba-0002cf-CC for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:58 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 4F/36-27708-5A14BC95; Wed, 27 Sep 2017 06:13:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHIsWRWlGSWpSXmKPExsVyMfTAat2ljqc jDXZ08Fp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBndG2cwFmwRqnh44SRbA2M/fxcjF4eQwAxG iS2/HjGDOCwC85glPlxqZgVxJAT6WSV2Tn7N3sXICeTkSZyYtZgZwk6T+L/mHFCcA8iukLh/1 BokLCSgJXH01GxWiKkrmCTeHD3IAlLDJmAiMatDAqRGREBJ4t6qyUwgNcwC8xklmib1soEkhA UyJCY8PMAIYrMIqEoc3rKWFcTmFfCRWL59IyvEXjmJm+c6wW7gBIqf7r/NBrHYW+LSyn7WCYy CCxgZVjFqFKcWlaUW6Roa6CUVZaZnlOQmZuYAeaZ6uanFxYnpqTmJScV6yfm5mxiBIccABDsY 10x1PsQoycGkJMpb8/9UpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3jiH05FCgkWp6akVaZk5w OCHSUtw8CiJ8EaBpHmLCxJzizPTIVKnGO05Lty59IeJ40vvDSB5YM8tINlx8+4fJiGWvPy8VC lx3iqQNgGQtozSPLihsGi9xCgrJczLCHSmEE9BalFuZgmq/CtGcQ5GJWHeZJApPJl5JXC7XwG dxQR0Vu/UEyBnlSQipKQaGFO9VVm6NErWrpM4zDLdnO/nronv/ZzmTJ73OvJSxddTtRK32l6f ZTxRc1T8ruOsZ+k7cjXunJRd5rL3cmP2LqUbT1pWsz5Wz+ZNPpa3hPOhzu8Jv9aIxOV3LVFYf W1VLMsV0cn562VvP13rf2b75DiRzqNdmr0vlt1XULhRXLbtli3zDP3uXb+UWIozEg21mIuKEw GQGAf90QIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-15.tower-206.messagelabs.com!1506492836!99401081!1 X-Originating-IP: [209.85.192.171] 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 30173 invoked from network); 27 Sep 2017 06:13:57 -0000 Received: from mail-pf0-f171.google.com (HELO mail-pf0-f171.google.com) (209.85.192.171) by server-15.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:57 -0000 Received: by mail-pf0-f171.google.com with SMTP id u12so6757491pfl.4 for ; Tue, 26 Sep 2017 23:13:56 -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=+Jo1JpAkfFAajaOT3dp6fEfCx26fj20ZkRTJgD45A5A=; b=NnszRVRXisgnWkhUcsNnVt4KN+bucWeYkef+A9UtX8M+zJEtxLq9NThyHvw2sVmfca LA0T61WXcK2l/IemfSp4Tt559169Gijg907ncR1MCK93WJ8xKWIo6K/unYFWCgJj/ggx Ze9nzG9AaDDPl1b3pdcJIKN0tFdcSgxjqu+EI= 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=+Jo1JpAkfFAajaOT3dp6fEfCx26fj20ZkRTJgD45A5A=; b=s+raxfFEVaa+QapjP4N9lKDXjZl+CNknDyogUIB2WdbC9SS3xaSwmYlxNUN+sPOz2R SRsxmGqH0dQOJ+dsMOnrVaH/e7KCBgkGADZTNZkiqPjKqyvdVqW9ONPgw/PXhF0TgTFS L7JuvJYxIul7NQdOicv6WQDMmkbQ3DsWzRNjAkBYey95BHrUEQtwaNth1Bp9Dk33W97v Qq0vKBDeMDz0PLFf3v/pqB4tI72uox3oOjCjKHzVhoATKQFXPIzYFQUSpNS4hqO1hT5A AB6j7XuELPNhRBVZbyrCVqbVroLq/ayq4JIyX080MshGKCIsdAcNZ7jKacBPws/Il3by OTtA== X-Gm-Message-State: AHPjjUhi5sFVJ9Lpd/TXknXAQefBIlQDpMSbf2UGyX4b60o5BPJQAbkU asubgEtnYh5R/ieGpV1EGicGopWg31M= X-Google-Smtp-Source: AOwi7QC25B8Nu1vUsYERnbObaYjLSGbFFpGuIkdmRR41qVu+hXS/OpRNdPm1hONGOs7RoClyaD8LHg== X-Received: by 10.98.200.76 with SMTP id z73mr351909pff.154.1506492835588; Tue, 26 Sep 2017 23:13:55 -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.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:55 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:22 +0530 Message-Id: <1506492816-25954-14-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 13/27 v11] xen/arm: vpl011: Add a new maybe_add_console_evtchn_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_evtchn_fd function. This function adds the console event channel FD to list of polled FDs. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v6: - Renamed add_console_evtchn_fd to maybe_add_console_evtchn_fd since it adds the FD to the poll list conditionally. Changes since v5: - Split this change in a separate patch. tools/console/daemon/io.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 0009bbe..3483252 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -1047,6 +1047,26 @@ static void reset_fds(void) memset(fds, 0, sizeof(struct pollfd) * current_array_size); } +static void maybe_add_console_evtchn_fd(struct console *con, void *data) +{ + long long next_timeout = *((long long *)data); + + if (con->event_count >= RATE_LIMIT_ALLOWANCE) { + /* Determine if we're going to be the next time slice to expire */ + if (!next_timeout || + con->next_period < next_timeout) + next_timeout = con->next_period; + } else if (con->xce_handle != NULL) { + if (buffer_available(con)) { + int evtchn_fd = xenevtchn_fd(con->xce_handle); + con->xce_pollfd_idx = set_fds(evtchn_fd, + POLLIN|POLLPRI); + } + } + + *((long long *)data) = next_timeout; +} + void handle_io(void) { int ret; @@ -1124,18 +1144,7 @@ void handle_io(void) for (d = dom_head; d; d = d->next) { struct console *con = &d->console; - if (con->event_count >= RATE_LIMIT_ALLOWANCE) { - /* Determine if we're going to be the next time slice to expire */ - if (!next_timeout || - con->next_period < next_timeout) - next_timeout = con->next_period; - } else if (con->xce_handle != NULL) { - if (buffer_available(con)) { - int evtchn_fd = xenevtchn_fd(con->xce_handle); - con->xce_pollfd_idx = set_fds(evtchn_fd, - POLLIN|POLLPRI); - } - } + maybe_add_console_evtchn_fd(con, (void *)&next_timeout); if (con->master_fd != -1) { short events = 0; 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 From patchwork Wed Sep 27 06:13:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114337 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665425qgf; Tue, 26 Sep 2017 23:17:04 -0700 (PDT) X-Received: by 10.107.18.85 with SMTP id a82mr402411ioj.251.1506493024119; Tue, 26 Sep 2017 23:17:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493024; cv=none; d=google.com; s=arc-20160816; b=r4J4J2H+FOHY4mUHfaIuv1TFf+MhBdD9YZQEvcD+7pXnXdHyYm8bPA286sFaLgU8sd /ngWKBbQohsQuz0iOLbw4xMRc4wI4daH+aeicIR595RlPjVdq0JoaVOFvzrkJyfDgG+S rC8YceFIfIMpM4MD3MiEP2zMPsCPwdBKjVhDq1DgHnrhJKysbf5P4LMxpNnZMONGAyTV uAvYL+6ApqeBS7sxCqINHMIobdNykKoJqsDG8UkQ+uh71M7nZuDS0waGhJ22eQ03yevQ T2EIVTiR2TTj3X7anTwAc5zwVd7ie4KCU5GBdJqmxSQny7ROS3SJVkXZWKbA8evRnWnx Vo5A== 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=Q//ZvXSf6O3d1s0mYjwUQWsaeqGoT/sNc0NvqLgFwSc=; b=Z2UlOsBiAlqdHtt4CrUSI9EdlaGBmw/yROwllWTb/V5LSWU8gKEtamSf8beAeWKcEc 2C8G/4J0UllGEOFPUDvG56iM0iw9ioayjDPQSR8aRk6AG7yF3LrzOJROMwSuZ5QYpIxX SWEzPbU8C/Ztu0YjUFN3L7bwyJ4uzO+lbx2QmTVzHdAlDUDCidiRiPwVadOnt/E0wqfP BgOvXJw/Bh/D4gLpHRk/UR8f0hvFtWp+vt7fSFTAM0wyLoy/eH4nqArHwqpQtUjf8Fk3 HqIqq8aSd5D+QA8IZwJ9rJutKtmJ6w2UNp/R3AGL7+QFHSI8LQCfBZHaLleAWLc++0BQ jkZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=M27bXCuT; 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 2si9050639ioz.84.2017.09.26.23.17.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:04 -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=M27bXCuT; 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 1dx5be-0002jO-BD; Wed, 27 Sep 2017 06:14:02 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bd-0002ho-Ed for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:01 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 11/21-02092-8A14BC95; Wed, 27 Sep 2017 06:14:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRWlGSWpSXmKPExsVyMfTAZt0Vjqc jDZbeY7H4vmUykwOjx+EPV1gCGKNYM/OS8isSWDMWvr7PXDBfomLintuMDYy/hbsYuTiEBGYw Shy6cY0VxGERmMcs0bPlLiOIIyHQzyrxe/515i5GTiAnT2L7tMNMEHaaxMlVr9kh7HKJfx1Hw OJCAloSR0/NZoUYu4JJ4vLlz0DNHBxsAiYSszokQGpEBJQk7q2azARSwywwn1GiaVIvG0hCWC BJ4sH6g2A2i4CqxMkdd8BsXgEficbrLVBHyEncPNcJZnMCxU/332aDWOwtcWllP+sERsEFjAy rGDWKU4vKUot0jUz1kooy0zNKchMzc3QNDUz1clOLixPTU3MSk4r1kvNzNzECg66egYFxB+Ou dr9DjJIcTEqivDX/T0UK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuCd53A6UkiwKDU9tSItMwcY/ jBpCQ4eJRHeKJA0b3FBYm5xZjpE6hSjPceFO5f+MHF86b0BJA/suQUkO27e/cMkxJKXn5cqJc 5bBdImANKWUZoHNxQWr5cYZaWEeRkZGBiEeApSi3IzS1DlXzGKczAqCfMmg0zhycwrgdv9Cug sJqCzeqeeADmrJBEhJdXAGFLiFTzp0MU7LbU1yypvXUzS+K9y4a/Oq7dHFff3H3dd0eqd/UFq BUubf+aGSVv2rz47gy13dVahSdrSvIP3bOYVrmNrlGx8XRD/523i1ROfYnaf36/f8TG5bFX9R vOt/2YY93WuN0/nEXkU3PnnRfPGXTIe1rduHosWf7pX8E3CR/soI1f9w0osxRmJhlrMRcWJAD 0+pYDSAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1506492838!111798209!1 X-Originating-IP: [209.85.192.179] 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 11998 invoked from network); 27 Sep 2017 06:13:59 -0000 Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:59 -0000 Received: by mail-pf0-f179.google.com with SMTP id r68so6749832pfj.3 for ; Tue, 26 Sep 2017 23:13:59 -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=6YGovVGluRqECYuWlBHwMmYrCh73aradxIet+Hw08pw=; b=M27bXCuTHC2l16U1Iy9e2RxkUrAEALlGCjFThuBRD9qn9H6Uctls4sm/LLqLR7TyWt swEdPj/S2HTSLzD3qyNcmr4wC7tuiRVUZSxLdYxr6sygnF9YxFB29Mf6Xk9fGw6ZzdBG HEL/2aRAIGw31noRGdZZUdmII6qEdwTSaH1cw= 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=6YGovVGluRqECYuWlBHwMmYrCh73aradxIet+Hw08pw=; b=ZXxvHt+zsPzygNt8bnx2r6x6qcRN+GCdkX6zONTPrRqkm98JsrE/vd7GYR8S2HvyQO OtrndUNR5Y5Rtorj+rucYUUw5tlr7Wde3e83HpNiENsA1/TjPKP8bj5SRG78FKN7r7Yv ROIdf6SnA8qDxGJwWdkUay5CK57biwu83sngXwux9jFYC5RXrw3e5COpMYsTdY7W91pe L/taELbVjVHzKt1KFKhCfohptIcSRbk8Bl75qAWunZiK2dHwe/1cIwtQ82gz52wwgJ2P LjkgkqCHTrS6SAci6gqHdtK2tOBsGOLFqq4AOhjMBYVOR3kbLc7I6Am8+he9ODVZ7lqA nxUw== X-Gm-Message-State: AHPjjUirA/bFvoTyc5Qya0h1Epc7YsZqUnFiAWDjgwRurSQ1Lbk//Nat gCG3FoJF3OUV87QVtjZm77DEyxisb9A= X-Google-Smtp-Source: AOwi7QAkMbI5O+5uLVndXryjZRbM5oeJQwUV+Wz5sZiJAC7kUvGD0uImC67pEotRe50MEQKN//HlYw== X-Received: by 10.159.198.71 with SMTP id y7mr334024plt.56.1506492838106; Tue, 26 Sep 2017 23:13:58 -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.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:57 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:24 +0530 Message-Id: <1506492816-25954-16-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 15/27 v11] xen/arm: vpl011: Add a new console_evtchn_unmask 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 console_evtchn_unmask function. This function unmasks the console event channel if it is masked for some timeout period. One optimization that has been done is to merge the two for loops. One for loop was used to iterate through all domains and unmask the domain event channels which had been rate limited for a specified duration. The other for loop was run to add the event channel fd and the tty fd to the poll list. These two for loops were merged so that the these operations can be done in one iteration instead of two iterations. Signed-off-by: Bhupinder Thakur 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 | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index a0b35da..2dcaee6 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -117,6 +117,11 @@ struct domain { static struct domain *dom_head; +static inline bool console_enabled(struct console *con) +{ + return con->local_port != -1; +} + static int write_all(int fd, const char* buf, size_t len) { while (len) { @@ -908,6 +913,27 @@ static void handle_tty_write(struct console *con) } } +static void console_evtchn_unmask(struct console *con, void *data) +{ + long long now = (long long)data; + + if (!console_enabled(con)) + return; + + /* CS 16257:955ee4fa1345 introduces a 5ms fuzz + * for select(), it is not clear poll() has + * similar behavior (returning a couple of ms + * sooner than requested) as well. Just leave + * the fuzz here. Remove it with a separate + * patch if necessary */ + if ((now+5) > con->next_period) { + con->next_period = now + RATE_LIMIT_PERIOD; + if (con->event_count >= RATE_LIMIT_ALLOWANCE) + (void)xenevtchn_unmask(con->xce_handle, con->local_port); + con->event_count = 0; + } +} + static void handle_ring_read(struct domain *dom) { xenevtchn_port_or_error_t port; @@ -1142,23 +1168,7 @@ void handle_io(void) for (d = dom_head; d; d = d->next) { struct console *con = &d->console; - /* CS 16257:955ee4fa1345 introduces a 5ms fuzz - * for select(), it is not clear poll() has - * similar behavior (returning a couple of ms - * sooner than requested) as well. Just leave - * the fuzz here. Remove it with a separate - * patch if necessary */ - if ((now+5) > con->next_period) { - con->next_period = now + RATE_LIMIT_PERIOD; - if (con->event_count >= RATE_LIMIT_ALLOWANCE) { - (void)xenevtchn_unmask(con->xce_handle, con->local_port); - } - con->event_count = 0; - } - } - - for (d = dom_head; d; d = d->next) { - struct console *con = &d->console; + console_evtchn_unmask(con, (void *)now); maybe_add_console_evtchn_fd(con, (void *)&next_timeout); From patchwork Wed Sep 27 06:13:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114321 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665064qgf; Tue, 26 Sep 2017 23:16:34 -0700 (PDT) X-Received: by 10.107.50.196 with SMTP id y187mr428894ioy.67.1506492994212; Tue, 26 Sep 2017 23:16:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506492994; cv=none; d=google.com; s=arc-20160816; b=Es3QMws6GdExw6oqqINfYvcajrvc3aRA7ArQ73Y9dq565C4fUJAzJkLpYdt6pu3IjC gPtWt2zF1mafJ5UBbcKLFlRQG8Cec/UkDctOu6AJby6Lgxf66gNuNCFrJSCLXGrUO6GK YCA235cR59xIaMmctbC1s6FeMgtfHnaOaK889CH6A6x8zOL4uUAp4GQTHqRD0ZzCXnYl yoST24nJOJEFAuumbHXtqV247h314i5BQcsZ0dSYLb1EZRGI3FmBU8ZKXtRcseojpMyP MEbQGblAKMFBYuMmiCqH2vXnOQ9nAKbeu22VPNF/cuCdcBis2zye1HDLrbsKhn16B+lC ELbg== 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=GCwa/gkQ+E7SKoiInGs++cf6PNAtsj+M23Bj3i/wbxA=; b=r+AxssZEyjjlyRPvY0gQjjXT/+kUhjMy+6e9HY+/BVYL+PetJ9+74aZcyU1SGpnZtq vDgNXcM1cumSXCmtBaxnAWMtAW7dG7jXFLH/VRnDJQvqLH/5LgEYnYklVdEL8yiTmcb6 3143jXgU8xzdyAkT0O1Uyw7HI+VZqwfkpwEmiHrq59mEpipG4tLG9YAR0EW5zFfvBhvs YZIcHJotzslHs9bUHjyd/J2LiMbjdJaViQJ3Npf3Ip4oJ6HvN5BRBOM/PxnJT0E288D3 BroyLhZIsV1Nn3voUqP03Irs/2thi7xebOr5BfMN9rUQXzwwQFKQp4BFkDanPow6WuOL iamQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fKWZlo5O; 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 s103si8592805ioi.273.2017.09.26.23.16.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:34 -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=fKWZlo5O; 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 1dx5bg-0002nc-QX; Wed, 27 Sep 2017 06:14:04 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bf-0002l1-OY for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:03 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id F5/C3-03422-BA14BC95; Wed, 27 Sep 2017 06:14:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTAVt2Vjqc jDZ58ErP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDMubNItmCxesf9DL2MD40+hLkYuDiGBmYwS XzYfYwZxWATmMUvcWLadEcSREOhnlTj04D9QhhPIyZNonLeYFcJOk3i/awo7hF0ucXfhezYQW 0hAS+LoqdmsEGNXMEnsvtfL0sXIwcEmYCIxq0MCpEZEQEni3qrJTCA1zALzGSWaJvWCNQsLJE h8710EtoxFQFViRfMTdpBeXgEfiav90RC75CRunusEK+EECp/uvw2111vi0sp+1gmMggsYGVY xahSnFpWlFukaGeslFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFesl5+duYgQGHAMQ7GD8Mz/w EKMkB5OSKG/N/1ORQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR45zmcjhQSLEpNT61Iy8wBhj5MW oKDR0mENwokzVtckJhbnJkOkTrFaM9x4c6lP0wcX3pvAMkDe24ByY6bd/8wCbHk5eelSonzVo G0CYC0ZZTmwQ2FxeolRlkpYV5GoDOFeApSi3IzS1DlXzGKczAqCfPeBZnCk5lXArf7FdBZTEB n9U49AXJWSSJCSqqBccI1d1WhpW9mb5r39sTnYoUFL87HL3Z5uKTtm25r24+Nmssu7H681urg 2a07FU76nxatZ/FaN7Xy3+XlkZ5f92sXJ0+ap/NDd0kun/veC6+vrb+c1fa3233PnOcOZ09d+ hwZ9khp6VuVuJS9U4pn6GUEGn5orw59qrDvof/h8/xG59edey8ZZeyvxFKckWioxVxUnAgAIp 8pvtACAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-21.messagelabs.com!1506492840!76795250!1 X-Originating-IP: [209.85.192.181] 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 46235 invoked from network); 27 Sep 2017 06:14:01 -0000 Received: from mail-pf0-f181.google.com (HELO mail-pf0-f181.google.com) (209.85.192.181) by server-5.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:01 -0000 Received: by mail-pf0-f181.google.com with SMTP id g65so6739386pfe.13 for ; Tue, 26 Sep 2017 23:14:01 -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=YOnVbf2KQHJUvnXkY+8NWwhSqgBo0gewN4GYDNIiV08=; b=fKWZlo5OpKKYz6J8jfnwvR+UbvXpcHjIDfrUON7vnMF7GBE77nf6/81yK5ThAIfXiu iDtsv1T6cs562cMJDEND9GIT3IDZ8IsXwdCpjgGS48d68YQpo9I/CU4vqrBbH0uwKjTr GR8Xm5k7hFdBNgQhIpu9s2kU9Fc/JWv286+4w= 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=YOnVbf2KQHJUvnXkY+8NWwhSqgBo0gewN4GYDNIiV08=; b=M1huDjJl2KkIIkiTebzIfXMHB8fTpqRB3CZh/ptvqYiqRiROcqZ6cfDfbJ4uExUwaW G35Kj0LsuPLvwkxyTw2+m7ONhMP2ZEsmPn5eodtChnFYjAb3n0Up1eY3eNlbmyhLjvJj Gh2Tp/tVvZoZSMXznrpEI8UMuImDCGDTfbm8D46L8cCLRMNerSyvYfAsIK1Iz07rC33Z f/aMJJxZ/wwweIQMycb+b55ajrxlf9lG4egSLQoSasLENNv29woHvFCLfc+6Qjp5OdfO NK5ZnF1UuxJOwe9eQv3OpApUEitknzSRKuJ1DI0NfcyhlYm6tXZ8WED5ZAK2LCA9Ze+W dt6A== X-Gm-Message-State: AHPjjUgoIOsQa55fSsGjn9cmgHP72ndASQHEMYHPw051F5Y5BW4pC53c zjfh6ITfIokVAgar9cWzNa2I5mep41w= X-Google-Smtp-Source: AOwi7QCWnVtwGc1sWhkAvVBp/k8CitDRT5SuQZXMK1iy0bFgnnpubm/obm1SATdUouVJXU97CBzZkw== X-Received: by 10.84.235.67 with SMTP id g3mr340041plt.326.1506492839746; Tue, 26 Sep 2017 23:13:59 -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.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:59 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:25 +0530 Message-Id: <1506492816-25954-17-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 16/27 v11] xen/arm: vpl011: Add a new handle_console_ring 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_ring function. This function reads the data from the ring buffer on receiving an event. The initialization of event channel poll fd to -1 is moved inside the handle_console_ring function as they are related. There should be no change in the behavior as there is no functional change. 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 | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 2dcaee6..c361b42 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -934,17 +934,23 @@ static void console_evtchn_unmask(struct console *con, void *data) } } -static void handle_ring_read(struct domain *dom) +static void handle_ring_read(struct console *con) { xenevtchn_port_or_error_t port; - struct console *con = &dom->console; - if (dom->is_dead) + if (con->d->is_dead) return; if ((port = xenevtchn_pending(con->xce_handle)) == -1) return; + if (port != con->local_port) { + dolog(LOG_ERR, + "Event received for invalid port %d, Expected port is %d\n", + port, con->local_port); + return; + } + con->event_count++; buffer_append(con); @@ -953,6 +959,21 @@ static void handle_ring_read(struct domain *dom) (void)xenevtchn_unmask(con->xce_handle, port); } +static void handle_console_ring(struct console *con) +{ + if (con->event_count < RATE_LIMIT_ALLOWANCE) { + if (con->xce_handle != NULL && + con->xce_pollfd_idx != -1 && + !(fds[con->xce_pollfd_idx].revents & + ~(POLLIN|POLLOUT|POLLPRI)) && + (fds[con->xce_pollfd_idx].revents & + POLLIN)) + handle_ring_read(con); + } + + con->xce_pollfd_idx = -1; +} + static void handle_xs(void) { char **vec; @@ -1236,15 +1257,8 @@ void handle_io(void) struct console *con = &d->console; n = d->next; - if (con->event_count < RATE_LIMIT_ALLOWANCE) { - if (con->xce_handle != NULL && - con->xce_pollfd_idx != -1 && - !(fds[con->xce_pollfd_idx].revents & - ~(POLLIN|POLLOUT|POLLPRI)) && - (fds[con->xce_pollfd_idx].revents & - POLLIN)) - handle_ring_read(d); - } + + handle_console_ring(con); if (con->master_fd != -1 && con->master_pollfd_idx != -1) { if (fds[con->master_pollfd_idx].revents & @@ -1261,7 +1275,7 @@ void handle_io(void) } } - con->xce_pollfd_idx = con->master_pollfd_idx = -1; + con->master_pollfd_idx = -1; if (d->last_seen != enum_pass) shutdown_domain(d); From patchwork Wed Sep 27 06:13:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114323 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665097qgf; Tue, 26 Sep 2017 23:16:37 -0700 (PDT) X-Received: by 10.36.162.14 with SMTP id j14mr818628itf.52.1506492997256; Tue, 26 Sep 2017 23:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506492997; cv=none; d=google.com; s=arc-20160816; b=NiQnMLgvQkeQwza2jul++2ys1WiUwBz+N9IW4Ne0Bb7ftolVZVP2DlJZ/Qr0nrHvj/ FVTPpsFaFQBSyEFclg0irqiJg6CWAFp9c6r4B8kFkU7+Lo+g7JdpN55rufEgWN09Wiiu +wd4oDKi1bldBywTG33HPJzANIB7WBoakMUuSuBIe96dfCv/ea/dCLCkmhmQ01sVGiDL ZYSHxQAvSa6ni3O2eRzTqIn1mtbk3RFhuCIOPn6BMZHAmPnOodAGZ3npJb19kaWrikQG W+RbFXDcY30iRRjSf15sP1PY9X1PdLui8F/gtpQPlIjq50rwokU9Q4wg0TEc9gUOwwsT 609Q== 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=H6a5aAYVM5VWiZL/6//7SE5OAqmOplcu4xioQEFBUnkfnsAi3H1ZN1YSj2Z9dptMYQ k+oUMRcKp3jZXsmAR5TYltCKIRKNTHHeBY+H+xbUrTfHz4z/QciidxJvYFjN/QSaHVI5 r+/TVoUlIPtUlvl+WolFrqHaJ7YT4wRz2WuLKnQ+tRbvF+l6frr2CHIGPAA8vSALQZSa tM6Qh028BZxRlduDKk2fueDwrvagNfuOyC4+Dw62JY1MjF0N3d7YdD8HBxCn2GYhQ3js gKl/P8ILV0SsPYeijexre6QS+vZ8z3RnQdFtAUKmyhfO8zrQwmkYAZQA80Ctk9JdFXR3 Gc1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VhK8se8r; 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 f5si9012571iob.38.2017.09.26.23.16.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:37 -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=VhK8se8r; 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 1dx5bl-0002vi-KJ; Wed, 27 Sep 2017 06:14:09 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bj-0002sY-U6 for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:08 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 5F/C8-03642-FA14BC95; Wed, 27 Sep 2017 06:14:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTASt1Vjqc jDY79NLT4vmUykwOjx+EPV1gCGKNYM/OS8isSWDNmrbrCUjBBoGLF1/0sDYxbeLsYuTiEBGYw SrybvJ8RxGERmMcs8e/0KlYQR0Kgn1Xix+1JQBlOICdP4uDX/1B2msTeeYeZuhg5gOxKiV0rt UHCQgJaEkdPzWaFmLqCSWLO9cmsIDVsAiYSszokQGpEBJQk7q2azARSwywwn1GiaVIvG0iNsE C8xLaGQpAaFgFViccTmtlBbF4BH4mpS1uYIdbKSdw81wlmcwLFT/ffZoPY6y1xaWU/6wRGwQW MDKsYNYpTi8pSi3QNjfWSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQIDjgEIdjB+ WRZwiFGSg0lJlLfm/6lIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8NxxORwoJFqWmp1akZeYAQ x8mLcHBoyTCKwgMfyHe4oLE3OLMdIjUKUZ7jgt3Lv1h4vjSewNIHthzC0h23Lz7h0mIJS8/L1 VKnPciyFQBkLaM0jy4obBYvcQoKyXMywh0phBPQWpRbmYJqvwrRnEORiVh3rsgU3gy80rgdr8 COosJ6KzeqSdAzipJREhJNTDujWKI1dNvYfV4Ku1jdfrdzEy2tytd8nxfVfmJaihqhMn9W9r+ Of6povVJVaHtz0w673Nd/XFBI8k7lzNHbMrlS4td/I4LN9pszxIW2eSZ/txPZP+ypUxes87s/ cryfVkGq5TAFLntwSFnJ66Src2SsoiWKNGPmu9U83NXsLtNy8U8v/cJzUosxRmJhlrMRcWJAO vRRInQAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-15.tower-21.messagelabs.com!1506492841!84633288!1 X-Originating-IP: [209.85.192.169] 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 11694 invoked from network); 27 Sep 2017 06:14:02 -0000 Received: from mail-pf0-f169.google.com (HELO mail-pf0-f169.google.com) (209.85.192.169) by server-15.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:02 -0000 Received: by mail-pf0-f169.google.com with SMTP id r68so6749885pfj.3 for ; Tue, 26 Sep 2017 23:14:02 -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=VhK8se8rypn7NESe113iUn5HBt4d+ZSVfKzGUM1I2Ih8dNVOrEBEgihpZYGO1NjyK2 vkAp2jimjfcvtbnDTDDQNwMnNSRvvxXv7MOdYFANh4AZsH9zQDwQyPoUE3T92igCRh1+ MNpRgRZYpi2kgEdUfCDAPWbU0iUsIgJCvrg5U= 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=KSJ+vOi/ob7eg06jaBrwDk3DC0z81j/S/nsC3bupf3O88tdmrbUxtU9g65rR3hhRIl Kg+VS74YW6PmyHwQZ08wCj/vs3blLfYgqNs7VJ1mu1bM4NevK0KZTBVoNWmUC4DBTYXy NfN7hojnO+ro+n7KdnzvalIX/2PM6Yt1+BI8bu+FM46/PbhflXqYuhc6ICwbffDDNZvY S0Sp5BLLWBCN7GfRJ/Y6142V0wVkxmmGYvKyrArUfrXVy/CKzhA3HRziirP6V19MyM3R LmCojRXo86f5rJjvHEM7SdhUOTzSVBz1tXU1sowepvrDGFIOtKmlWYvm96I28LAe4ZE+ BJbQ== X-Gm-Message-State: AHPjjUi5KAJBxqd2eLy1HXeSM/H1xhHxPw57mm5hHV7pT1enQvwSN8GR Vh2MB4ZIFsAzk/ICkCBOCxHyZAXvz7U= X-Google-Smtp-Source: AOwi7QCFGlhCBwAUE9k/AjHyV7pwvnOZvC6uzolG/dhVCrR0GI9MbSaYxKs1+9nPmt0R53lJSPwwzw== X-Received: by 10.84.218.141 with SMTP id r13mr302733pli.271.1506492840926; Tue, 26 Sep 2017 23:14:00 -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.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:00 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:26 +0530 Message-Id: <1506492816-25954-18-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 17/27 v11] 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); From patchwork Wed Sep 27 06:13:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114324 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665154qgf; Tue, 26 Sep 2017 23:16:42 -0700 (PDT) X-Received: by 10.36.123.200 with SMTP id q191mr829005itc.83.1506493002173; Tue, 26 Sep 2017 23:16:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493002; cv=none; d=google.com; s=arc-20160816; b=vg1EkdLyA5PrnKleVNzt9vYb78ksF6Di1zdX/369YnBBBVX0rWpc0p/8oOfFvljbjo BopjkEiZHEP4gU9iDxwMyhMqX2iUDTdVaC4Rv/DlUZjIwCDgLIYHmtQlZ8a0s41zuItt pTrddffqLsDmtdpoVKNOeNwpxNbk12rgT5EzylS2WeuzGAy0FN9LqSsP29BRPCH7AWU4 CGZwofeSm3qJhBsILP/B4R27jA+fnMU6N8vjmzF7v1Q5F0iIGpouO2i6hpjjA+0+hXnn l4hM2+47XdBMQUTPQOBdTOmcIOzDWThaDa8f8R+nSZXKI6R55M2zs25FX+wqpxcE5Gg3 H3GA== 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=Bg6fT8CW/IMdJdKHwnAiGPV2040T6kKQ60tEt4w7sHw=; b=r6zn2hlLqU5HFedpACFsFKMa4EeHjMB0uRpK6EOnaPX5FZu62x+fgf4MdVLHYROrIb pNbATM7ZTt1ZS5R8kfZ0gDtKltw+1gHzNHeY9Djvab5p9kdk7mRPaWOE2iAKRk6CeTK6 IxW3Tm0LJK4phcib/6DFuj4QKx30gsovE8AUPhLDKq6lnEO3DThTHhggwBNRpAQATvet vv+I9BWlZjmIWK+HrgD63T8piD3tv2TCa/cIlI3GmJCuwwMyFieHZ2GQjY6zfn5SZIUM MolZd1G7Vs+9utNTsGyQEYVIERWCUFzlQhS/tg0PN1ejojfZSGOK64zzVMPq+wU37sCL DLFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=By+cHbaX; 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 e141si8216204iof.90.2017.09.26.23.16.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16: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=By+cHbaX; 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 1dx5bi-0002qN-54; Wed, 27 Sep 2017 06:14:06 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bh-0002ou-LI for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:05 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 11/F1-03283-DA14BC95; Wed, 27 Sep 2017 06:14:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTANt01jqc jDWZdULH4vmUykwOjx+EPV1gCGKNYM/OS8isSWDOOr13GWrCZu2LCysgGxmecXYxcHEICMxkl Xty6yQrisAjMY5bYdfk7I4gjIdDPKnHzx0T2LkZOICdPYu7asywQdprE9c0PmboYOYDsConu5 kyQsJCAlsTRU7NZIaauYJJY/eIqG0gNm4CJxKwOCZAaEQEliXurJjOB1DALzGeUaJrUywaSEB aIkbh26Q7YLhYBVYkdc38wgdi8Aj4SV46uZYXYKydx81wnM4jNCRQ/3X+bDWKxt8Sllf2sExg FFzAyrGLUKE4tKkst0jUy1EsqykzPKMlNzMzRNTQw08tNLS5OTE/NSUwq1kvOz93ECAw4BiDY wfhnWcAhRkkOJiVR3pr/pyKF+JLyUyozEosz4otKc1KLDzHKcHAoSfDKOJyOFBIsSk1PrUjLz AGGPkxagoNHSYT3Gkiat7ggMbc4Mx0idYrRnuPCnUt/mDi+9N4Akgf23AKSHTfv/mESYsnLz0 uVEuetAmkTAGnLKM2DGwqL1UuMslLCvIxAZwrxFKQW5WaWoMq/YhTnYFQS5tUEmcKTmVcCt/s V0FlMQGf1Tj0BclZJIkJKqoExJForZ+enJzu8ebsYL8/qqv/xK/rQBkaXJsbVC3e6/HgZbK+W nqRhbRh4bULehyMcDLfXnV6bmyR/dHN036ude54L37kf0jGj7wlT1rZ3Zk+fef938w85ZqhYI r33jP2XY/PXX2gzrw+Kn89vXrQ7yOU4R+vP1iqBer0jzv86Jrv5vepP9ylWYinOSDTUYi4qTg QA54M+LtACAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-6.tower-27.messagelabs.com!1506492843!118876951!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 24055 invoked from network); 27 Sep 2017 06:14:04 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-6.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:04 -0000 Received: by mail-pf0-f182.google.com with SMTP id l188so6750948pfc.6 for ; Tue, 26 Sep 2017 23:14:04 -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=ibyLFSz2OCW5sE3Ydz65ZRFcFBf596L9bo9Hcmr8ZFk=; b=By+cHbaX+SE9xaDcfjg3nFLkrUV3MVx1qRWtLI4+hFLyZi8FyQ0aUEulPy0qmmMiSp haNKnDwxkN8IL3mzTS+9qpPaRhrETXxUEqGkr178qz5kUOmK3I/uZWDQ8kO+Arj4j/BY M3gBT/g8DTxaoNzqlZYv3dHAS2B3AHsFwKE9M= 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=ibyLFSz2OCW5sE3Ydz65ZRFcFBf596L9bo9Hcmr8ZFk=; b=uiOTGb+NwXQXG5RGzrzZfp4PHas3sAY24t2HI/cerCNtA1+gKVINcQfNFNyxsHDNFB WsJ1qKYzgr/S4zFFEhzUBkr/re05HypKtfouG2LV6REvMZd9TptVPtGQ9vHmpFmqOkmC fBJ7ET208wLrDrtBIqPICIOjZyEu6K1/52WNsi+hVg1VZH1MAR++2Qx4UK+GGfobMWXN l3fK/2JMJ2oYnRoVY04tvzIwmyX5eiEnYz8IXU9HZQ/1AM7UC5KszpUXxz0WNotaOkOr 2STC2kiGoUF8+i+wYk8neEUADgV3WcJSidk4ymzTgbYoQFD5L2ZUzl7zHX43PUqu03gc cMLg== X-Gm-Message-State: AHPjjUjU5zgYXUY9TORahZgQx8DtGfTzXMdJFqF7jYw5ZS6b9jfC3XL2 kJC8O557hEW47Ni1kOBiHD6MUzed57g= X-Google-Smtp-Source: AOwi7QAOg304QJK+LsI9h/l8adOwtGaNFeEQemvFEmk/kwFz1WoaX49lYRJnQmA4eh64oWTVUqbFpg== X-Received: by 10.98.70.221 with SMTP id o90mr325959pfi.277.1506492842717; Tue, 26 Sep 2017 23:14:02 -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.14.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:02 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:27 +0530 Message-Id: <1506492816-25954-19-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 18/27 v11] xen/arm: vpl011: Add a new console_cleanup 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 console_cleanup function. This function frees up the console resources. 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: - Removed a null pointer check before calling free() as free() already checks that. Changes since v5: - Split this change in a separate patch. tools/console/daemon/io.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 5c6da31..ff69e52 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -768,12 +768,8 @@ static void remove_domain(struct domain *dom) } } -static void cleanup_domain(struct domain *d) +static void console_cleanup(struct console *con) { - struct console *con = &d->console; - - console_close_tty(con); - if (con->log_fd != -1) { close(con->log_fd); con->log_fd = -1; @@ -784,6 +780,15 @@ static void cleanup_domain(struct domain *d) free(con->xspath); con->xspath = NULL; +} + +static void cleanup_domain(struct domain *d) +{ + struct console *con = &d->console; + + console_close_tty(con); + + console_cleanup(con); remove_domain(d); } From patchwork Wed Sep 27 06:13:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114322 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665088qgf; Tue, 26 Sep 2017 23:16:36 -0700 (PDT) X-Received: by 10.36.184.4 with SMTP id m4mr860987ite.41.1506492996085; Tue, 26 Sep 2017 23:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506492996; cv=none; d=google.com; s=arc-20160816; b=axlTJjxnlrWAN2jNukjPpE0ik/DSV2Xjcv5LXFJ25Gc45LfqB/H76OdoF2PQkQ+ec7 oBdkN158X+Bg/3Nzu3InhU5k83KeOvM00bv2tPeeGxsoYie42Kj1sWeQvaemo4SfL54j 4xHn0lkd9vIlRUm/bySyEEMWEHTBKPEDxm1ed/2AP+HnQ1du6zxEh+TkOmwYFgu3lTvH 2u29EnNu0OlyY64PC0VVIyQWm7vC2BgfElQemw6818Antzc8a782Ko6uHczcbtpogwZ0 9dWv9MEg3/2wXD6ZGunF07X2PZqC/zGfl0mZP9rg511RjtAjJLGjtjJWFEIRbZ/Eh3tw 8wtg== 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=Em6IOaAuN4l9Udc4AQQsj05f48nAJF1yHYv8gt15suE=; b=XXSynz7LltSTWoa3NqcBqmKdDHyWIzAYMDtr/ufnaOCSzh072eEDj4x3nJn57zcRaF wfC6xA4f14PUHSzkFEQd1vEwjxvu69Klsf+oSIaF1s/pXKkvjOH28VyR2Kod0lfi3S+b HXbEH0r23XUYVrjYmYq1Bsj6ZuC56yEwEwmeVvmEN0ipJzGwTaVXM/EC7s+cUuLy/vxj JFNJlqIvOdYSJubX+3mtb8RsATOUHxg2Jm6xsQNeZwnORep+1ydo/H8RBPkLVwrkvE7v L6gg0Otx01dkfxs/bCb7aNQ7n9rxezDcqqH6+NiSkONEBzufp/nQY52N94hXsPSQnFoA ARFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aq3BxXCK; 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 g129si8979172iog.414.2017.09.26.23.16.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:36 -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=aq3BxXCK; 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 1dx5bk-0002tg-CY; Wed, 27 Sep 2017 06:14:08 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bj-0002rm-Er for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:07 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 7A/55-03423-EA14BC95; Wed, 27 Sep 2017 06:14:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRWlGSWpSXmKPExsVyMfTAFt21jqc jDfY/1LD4vmUykwOjx+EPV1gCGKNYM/OS8isSWDP+bulkLpjMXbFqwRamBsajnF2MXBxCAjMY JWbM3sUM4rAIzGOWODSlGcyREOhnlTh9azlLFyMnkJMnsblxAzOEnSbxa+F/dgi7SuJ83x9WE FtIQEvi6KnZrBBjVzBJ9PcuZuti5OBgEzCRmNUhAVIjIqAkcW/VZCaQGmaB+YwSTZN62UASwg KxEjfmQCxgEVCVODyxgwmkl1fAR+LfVTOIXXISN891gpVwAoVP999mg9jrLXFpZT/rBEbBBYw Mqxg1ilOLylKLdI0N9ZKKMtMzSnITM3N0DQ3M9HJTi4sT01NzEpOK9ZLzczcxAkOOAQh2MDYt CjzEKMnBpCTKW/P/VKQQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd55DqcjhQSLUtNTK9Iyc4DBD 5OW4OBREuGNAknzFhck5hZnpkOkTjG6cly4c+kPE8exTZeB5JfeG0DywJ5bQLLj5t0/TEIsef l5qVLivFUgzQIgzRmleXCjYZF7iVFWSpiXEehYIZ6C1KLczBJU+VeM4hyMSsK8ySBTeDLzSuA ueAV0HBPQcb1TT4AcV5KIkJJqYNSbs/THy5a2dTpGU150+E49LnZo0p+kU20KIRl8Zo0WPj9k A5jX531+ncAp/2zFDWeplVonu+f8kYnp3ci7iD3J86P5raPP2eYv0ZoS/OrO170f1mQsPTEnL 0dZoIZLdpKho02K24Obk/J05uv97bAKt5kXl+9WuuDkk5qri5l2FfIGXT01RUeJpTgj0VCLua g4EQB7WHGq1wIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-4.tower-27.messagelabs.com!1506492844!117902761!1 X-Originating-IP: [209.85.192.180] 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 9581 invoked from network); 27 Sep 2017 06:14:05 -0000 Received: from mail-pf0-f180.google.com (HELO mail-pf0-f180.google.com) (209.85.192.180) by server-4.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:05 -0000 Received: by mail-pf0-f180.google.com with SMTP id n24so6750528pfk.5 for ; Tue, 26 Sep 2017 23:14:05 -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=Czel33Q/wCzetrNTUKuMCaNrHbuXAUhTInKJVQs+Ekc=; b=aq3BxXCKcM9Wq8qLDbD4DIss3++qbDGCHc7wdnMGgw+wdV6TCXkz4qY9VFoKBoFYDI WuyXN7AibWZcJ1d/yNerfqhAucvpsy3LTOhsmS29nKUiqgK4HKfAJQMsiZwrOaX6eyRP pRUXdr6lXiO67Z95bgoA2ZfeMVCT0ji8oGXkg= 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=Czel33Q/wCzetrNTUKuMCaNrHbuXAUhTInKJVQs+Ekc=; b=MMzqe8CQVsCmDyqMZ31gBRa0FwXpKURm2/c43Gr46vae1zhCou93wAnR1ATHZXrU0p epekyIAj6VdS7gQJxq1pmwn+S/ZgkYLNjQ+gRymyKFp3E/4IC/kYQdeRVkaD1eXy1vRk a2i2DIMJanfWzXG6fesOUEXizf/wxtiYpzFQt6u8Z3T2o2mVcBCvcNpKANp4U+4t3c6F EM/WKY3tlYN+6Tfblbzc50XAs7dfoyzIzFnu69UOEP8q1kjxaPTfqVNFbIxpweU2MKyD EMrwV3VAhRWFmpMi1Gt4f3QQq9pwkRwUhj9p82+wBaWgAQXd/8GRGtpveBFIyvcqkaQC gwVw== X-Gm-Message-State: AHPjjUidBU9/OY9vm5JedSafkOLh9juNg+FBG6dKOGd4L+1uKbmxxW/U 2EmYeMu95LbewFo2toiRcjnoas2Bmic= X-Google-Smtp-Source: AOwi7QAcdzVrCe1vu9/adwyljV1R2auVcPPyC4KEdBhOpWNLDJpz4RLPlImW5O/hTcIZjDdyY9B2Cg== X-Received: by 10.98.130.200 with SMTP id w191mr346511pfd.246.1506492843702; Tue, 26 Sep 2017 23:14:03 -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.14.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:03 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:28 +0530 Message-Id: <1506492816-25954-20-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 19/27 v11] xen/arm: vpl011: Add a new console_open_log 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 console_open_log console_cleanup function. This function opens the console log file. 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 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index ff69e52..cfd7273 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -1038,6 +1038,15 @@ static void handle_hv_logs(xenevtchn_handle *xce_handle, bool force) (void)xenevtchn_unmask(xce_handle, port); } +static void console_open_log(struct console *con) +{ + if (console_enabled(con)) { + if (con->log_fd != -1) + close(con->log_fd); + con->log_fd = create_console_log(con); + } +} + static void handle_log_reload(void) { if (log_guest) { @@ -1045,9 +1054,7 @@ static void handle_log_reload(void) for (d = dom_head; d; d = d->next) { struct console *con = &d->console; - if (con->log_fd != -1) - close(con->log_fd); - con->log_fd = create_console_log(con); + console_open_log(con); } } From patchwork Wed Sep 27 06:13:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114320 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665047qgf; Tue, 26 Sep 2017 23:16:33 -0700 (PDT) X-Received: by 10.107.68.16 with SMTP id r16mr436286ioa.274.1506492993574; Tue, 26 Sep 2017 23:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506492993; cv=none; d=google.com; s=arc-20160816; b=08b6ZmXE4FzOAMFh7/6XjjbJ318VajyxhlSlhMIgyXPeJKcFtLYZtk1U9XsgUkIs5V h6B5gDezaslwdZvWijZnskvdJT9pj4Yb3BUqrClN/4F8HQQ1hjgb7BvtoZqlYg6Qo9Dw CPlnGX3CSYA84Ol/NP+COZpoZMqgIUD8OW6ifYznGHh7B8FJYB+m0lSzcMIrlL+GEAWT v/5igDppoVW6EyN4ccHDhHX868SxJ0LOGTADI+uDc+klSN3iIwfzv/RkoBQo4sloGQOX pPotnKfkcsnetj3np0NGkq9zXZ+OVHiyyEiGk0C3GfnaLv/SDhwDIbTy41mQs9aRkxvY aVuQ== 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=B/iWbb165fhqROXYtc1SUPyns/TlpQEbmkL/vah2sQ4=; b=b+GwiEPeIQnqYVmwmJwCiBFyHBX6Cin2juDr3u/yc1E7xgHQJzgQyO1T25OF7GlKPn 9bc4SDdLh6VYcwECedfEEk9538A+xUQmCN7scnYb3SHH1duXPpsuTc5AABf3LFCRcGXp EXUjhArT7yVPA4cNQX/71PvxuEDQEsXvXTaNzRKNnkmUZh1+0WnPB22aY7laa4Fodhb8 8bq4SDqnae0oZLg0W5IJ4tGPfXm7XbIhcRyLYA4SqZ759yVRah61r2odLZcHcWMPZYbv 23FkhAAUfdbByuiX4VuDKrk4QD/kvYJFHMYXMfQ06pNI+QZ+owzR8vQp496fqO8WbFy6 JJTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Di5aOAsw; 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 r13si8974965iod.301.2017.09.26.23.16.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:33 -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=Di5aOAsw; 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 1dx5bm-0002y2-SS; Wed, 27 Sep 2017 06:14:10 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bl-0002vM-Rb for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:09 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 33/26-02023-1B14BC95; Wed, 27 Sep 2017 06:14:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsXiVRuso7vB8XS kwaKH0hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bjMxeZCn5zVRxdvp+1gfEoZxcjF4eQwAxG iY9PLzOCOCwC85glPs+bxwbiSAj0s0oc75oF5HACOXkS/2c8g7LTJH7MPQZkcwDZFRJXHnmBh IUEtCSOnprNCjF1BZPEuQddTCA1bAImErM6JEBqRASUJO6tmswEUsMsMJ9RomlSL9hMYYFEiX W3/jKC2CwCqhIHd05iAenlFfCROPU/G2KtnMTNc53MIDYnUPh0/202iL3eEpdW9rNOYBRcwMi wilG9OLWoLLVI10gvqSgzPaMkNzEzR9fQwFQvN7W4ODE9NScxqVgvOT93EyMw3BiAYAfj9z9O hxglOZiURHlr/p+KFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBO8/hdKSQYFFqempFWmYOMPBh0 hIcPEoivFEgad7igsTc4sx0iNQpRkuOL703/jBx7NtzC0h23Lz7h0mIJS8/L1VKnLcKpEEApC GjNA9uHCw6LzHKSgnzMgIdKMRTkFqUm1mCKv+KUZyDUUmY9y7IFJ7MvBK4ra+ADmICOqh36gm Qg0oSEVJSDYwbVubdyPj9ITrKbVFsmnvVSf4leznLN6gwmT040BReOC9DQPnW3ztWXE+vva16 8Upv26mslnttPg2mk2+89NqdsEN3+dSj3TOX//UKbjyc99bihMaCBc9TUnqV5vFcOy6yXvmT2 fJPy20juDeEPGvlvad9s29/SW1D5dmje4Q3bOTNbfnHwHZCiaU4I9FQi7moOBEA2C8tRskCAA A= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1506492847!111798232!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 12537 invoked from network); 27 Sep 2017 06:14:08 -0000 Received: from mail-pg0-f44.google.com (HELO mail-pg0-f44.google.com) (74.125.83.44) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:08 -0000 Received: by mail-pg0-f44.google.com with SMTP id j70so7213022pgc.10 for ; Tue, 26 Sep 2017 23:14:08 -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=cCjDRmwTdHUYIQiYgejFMteqYI89juGj+je6V6CGGvI=; b=Di5aOAswpuBKQhUuCieAzSZAwOmAK0WcjUBJT1afv7Qopa8Q66pT8rXtpbK0R0mtNF m09ER3k14CbjKU6iBli7osSQno+AevHetm7EPJ3vWZzLmyVlg6rCsPPuB5xCIKNXYotc 8nZ8CXFz1rRUPaV7gnpwwAa/wODku4NLtZUMQ= 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=cCjDRmwTdHUYIQiYgejFMteqYI89juGj+je6V6CGGvI=; b=raRk3XeY5xU6RYKxJLAbOnwrHYNVQg3kJki0Vi6zBkHPuQupaSJpwRdc0/B0pzB0JD azkfHwJ9xs7EHlEQdSflbGJtQVSar6C7p0vnRbRQuxsFOv6I/tjJBoZuf78aoBuO66y1 +4n6bNg7pUrAtKG7CJjQQAIJATaUgSfsN2xJ818w2dq2WYPFhSHNyJDNANdL6XMJtm5H J/Si6UjdDRYzYwhe1ZUGJNIaOgjV8EFSAV+2rTLHXtgEISnx1QWYvgvUytQz6taHZBo4 VjZlbRyrfctWwgPuY14tdrBSrnsY8cw38alNVILNg4ipt6rsOf8Jwl/Z5lmUSH5tFlUW xMlg== X-Gm-Message-State: AHPjjUgRlggcRoi8LjxZxsqFmWm72816NGzo6x2RkxZMtvsutQBSLaDk bkDzUp+TrMc5EbW1ympOizZYJog0tC4= X-Google-Smtp-Source: AOwi7QBGjXCElSxX3sCq8pMdxw7bkL25p+8h7VwMCrEcFTmkReEm9MkFMBdk9IwcfBBb4oqlt4Cbog== X-Received: by 10.98.236.17 with SMTP id k17mr331375pfh.191.1506492846786; Tue, 26 Sep 2017 23:14:06 -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.14.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:06 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:29 +0530 Message-Id: <1506492816-25954-21-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 20/27 v11] xen/arm: vpl011: Add a new console_close_evtchn 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 console_close_evtchn function. This function closes the console event channel. 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index cfd7273..71465a0 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -793,6 +793,14 @@ static void cleanup_domain(struct domain *d) remove_domain(d); } +static void console_close_evtchn(struct console *con) +{ + if (con->xce_handle != NULL) + xenevtchn_close(con->xce_handle); + + con->xce_handle = NULL; +} + static void shutdown_domain(struct domain *d) { struct console *con = &d->console; @@ -800,9 +808,7 @@ static void shutdown_domain(struct domain *d) d->is_dead = true; watch_domain(d, false); console_unmap_interface(con); - if (con->xce_handle != NULL) - xenevtchn_close(con->xce_handle); - con->xce_handle = NULL; + console_close_evtchn(con); } static unsigned enum_pass = 0; From patchwork Wed Sep 27 06:13:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114325 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665221qgf; Tue, 26 Sep 2017 23:16:48 -0700 (PDT) X-Received: by 10.36.87.83 with SMTP id u80mr834054ita.41.1506493008741; Tue, 26 Sep 2017 23:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493008; cv=none; d=google.com; s=arc-20160816; b=VBru1cFptuWSGz4EJrac670PUkYAjen2mOL8JXXQhFG6eo9Uprv2iw9QGcYjZ4uwnD bysppzq9zfS+iod6wEr6LuJhNnufAqYxcJuPDL7gHGwUZY1sbN/ZHe6bPjWzamQj/+ph pTU45O8dxk2iq0OCWpSnhY1RBqet888c8EK9LY6nR1xpruv5xTLmc9ohCgYBB6gg6ag1 deRqvTOCV1O2N1fAClhI6ZoChhLC/xz9GUS5a1SmswA5jFk8c1hMABz83TicbL6PeBdT XVmt2mXah7smuejYtEoiHEjhDzgQDm7rf1YAlHf6NOH5vnvl785i0wUtfJhQHx4cPgxC Uegw== 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=d28LQcbW5AD8LMs7FTS7EYwy8nxOvKDMb/oprClQods=; b=pOLw/Af2qiyicHSvmPitXp7oGCfqh8CVlpbp7qWrjGAB4gGrSx3rVSKofBo53umZZ3 drp56UxxWLZb/PYSg84Af4tw8s0+BRk/q2Er8/+1VXCNkaiEl23I3Kfv191jhXBFNgqp MzbiLEGmFiLnKIAF8gNX/eJNqwjs+mTuMNjiaTVoHGUKeqSLbNvCFApsntZmmsgZJ3LZ Ic1fE1TuFPpUjQa0n7JP6+ocjmSSyyPbfYCpNjtvy17VVb4lFZMDZMH8fu9OHS3wnZg3 DRRGZ8d+/ln2BRQsUhVGr48db1fbMJXiLhmxwZCKohfd8CAlfbdUuI2zeGMHQTqSqFoG pziw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FQyg0Pzg; 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 n75si8754410ioi.350.2017.09.26.23.16.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:48 -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=FQyg0Pzg; 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 1dx5bv-00039B-40; Wed, 27 Sep 2017 06:14:19 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bt-00036A-9B for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:17 +0000 Received: from [85.158.139.211] by server-17.bemta-5.messagelabs.com id 05/77-25201-8B14BC95; Wed, 27 Sep 2017 06:14:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsXiVRuso7vd8XS kwb6VKhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8b5+zvYCx54Vtz7dpKlgfGuTRcjF4eQwDRG icZLT5hBHBaBecwS+z4tYQVxJAT6WSWm/fgH5HACOXkSS/d1QNlpEhff32SBsCsktqy5AmYLC WhJHD01mxVi7AomiZuvzgM5HBxsAiYSszokQGpEBJQk7q2azARSwywwn1GiaVIvG0hCWCBaYs Oba2A2i4CqxPyp7WDLeAV8JFrefWaEWCYncfNcJzOIzQkUP91/mw1isbfEpZX9rBMYBRcwMqx i1ChOLSpLLdI1NNZLKspMzyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAgMOgYg2MH4b5vn IUZJDiYlUd6a/6cihfiS8lMqMxKLM+KLSnNSiw8xynBwKEnw3nA4HSkkWJSanlqRlpkDDH+Yt AQHj5IIryAwBoR4iwsSc4sz0yFSpxgtOb703vjDxLFvzy0g2XHz7h8mIZa8/LxUKXHeiyDzBE AaMkrz4MbBYvQSo6yUMC8j0IFCPAWpRbmZJajyrxjFORiVhHllQdbyZOaVwG19BXQQE9BBvVN PgBxUkoiQkmpgtP5q0b1+obbyPK/HHCKzeMM12JXmLHQJ0rkRuPif91cZgbkLd/UmTp+2Tvyk 4gYb5xT31vuLs/9vbJgzpVipfUJn0/eWSl/B7u2PIvxiltobmk1Q3fNyq8udnX5FL3RnrDK9/ nynUHC9kXAjF6fgpoM8rMYSyzZfjVSqvRg9Y3+wz1zlg7vDlFiKMxINtZiLihMBIIMymMwCAA A= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-7.tower-206.messagelabs.com!1506492854!110540352!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 11859 invoked from network); 27 Sep 2017 06:14:15 -0000 Received: from mail-pg0-f44.google.com (HELO mail-pg0-f44.google.com) (74.125.83.44) by server-7.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:15 -0000 Received: by mail-pg0-f44.google.com with SMTP id p5so7220953pgn.7 for ; Tue, 26 Sep 2017 23:14:15 -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=ynPuUYoJvCxIS6CFaobuA5PgWjQou9R3STzppfCSqEs=; b=FQyg0PzgjjHlWMdEGmoNzV92h2J8Ow5scIvVKzXtwbpdLfwXqi9Kgiun8RfE0p8W3f xLcAxwPStBd18aW3aoDpXdqTw1pXz2bOU4Yqd1LJGNpr2KztgwCk1ZoGdDrIR0Arsejs c2u0f0r6qSodmLLzfFuEEmu60UHtgsR/SPl9Y= 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=ynPuUYoJvCxIS6CFaobuA5PgWjQou9R3STzppfCSqEs=; b=VsHzkqMGAePBuurV3Rhb/nF//c98jDkCIvCO56xpsL7a9DRkqqk4VtKn0ccI8QxIhl 6lwFjTRy3pUlh6zJGn8loWzcWvq3CgUSm6XciuzgFdlo8WgVqP3zzbXilT7MoR9ifdFN FTxqPH54ivTcALhsF2T9w0OjYw/R5JlFypATfKqmGHj7wix6UgxqZdF5WpYwqUdnBKCb tsoQaLkkeyhgW5RgM9RPg0ubhpeMhZrp9Opct/DwrbAf0OPvY0TPt28Tt9yBTs5s/Hp/ CJu64hnb6V88gF4ncSpFpv/Qfm7vHANgzJ8TQyyKjMe7vbpEfPVD60GHWwL40U4dDR4i bOTg== X-Gm-Message-State: AHPjjUhyD0zxFsgLe48H0VyrW8kBK66Ac/VL3HbKwn5wYqbTRmIexGUR ZPsZyNB0wBE4nGb+KRFc7Yey2ZZ99NQ= X-Google-Smtp-Source: AOwi7QAnAkmt1ctTz+Ybco6qqkJazKKfyWLPfa7rmHvyWzI8iaoRzK/3wPzO0EVRIJugDxafSEosTg== X-Received: by 10.84.128.107 with SMTP id 98mr333174pla.282.1506492853456; Tue, 26 Sep 2017 23:14:13 -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.14.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:13 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:30 +0530 Message-Id: <1506492816-25954-22-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 21/27 v11] xen/arm: vpl011: Add support for multiple consoles 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 adds the support for multiple consoles and introduces the iterator functions to operate on multiple consoles. The functions called by the iterators check that they are operating on valid I/O parameters. This ensures that if a particular console is not initialized then the functions will not do anything for that console type. This patch is in preparation to support a new vuart console. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v5: - Split this patch in multiple smaller patches. Changes since v4: - Changes to make event channel handling per console rather than per domain. Changes since v3: - The changes in xenconsole have been split into four patches. This is the third patch. tools/console/daemon/io.c | 160 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 126 insertions(+), 34 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 71465a0..a198dbb 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -90,12 +90,14 @@ struct buffer { }; struct console { + char *ttyname; int master_fd; int master_pollfd_idx; int slave_fd; int log_fd; struct buffer buffer; char *xspath; + char *log_suffix; int ring_ref; xenevtchn_handle *xce_handle; int xce_pollfd_idx; @@ -107,21 +109,109 @@ struct console { struct domain *d; }; +struct console_type { + char *xsname; + char *ttyname; + char *log_suffix; +}; + +static struct console_type console_type[] = { + { + .xsname = "/console", + .ttyname = "tty", + .log_suffix = "", + }, +}; + +#define NUM_CONSOLE_TYPE (sizeof(console_type)/sizeof(struct console_type)) + struct domain { int domid; bool is_dead; unsigned last_seen; struct domain *next; - struct console console; + struct console console[NUM_CONSOLE_TYPE]; }; static struct domain *dom_head; +typedef void (*VOID_ITER_FUNC_ARG1)(struct console *); +typedef int (*INT_ITER_FUNC_ARG1)(struct console *); +typedef void (*VOID_ITER_FUNC_ARG2)(struct console *, void *); +typedef int (*INT_ITER_FUNC_ARG3)(struct console *, + struct domain *dom, void **); + static inline bool console_enabled(struct console *con) { return con->local_port != -1; } +static inline void console_iter_void_arg1(struct domain *d, + VOID_ITER_FUNC_ARG1 iter_func) +{ + unsigned int i; + struct console *con = &d->console[0]; + + for (i = 0; i < NUM_CONSOLE_TYPE; i++, con++) { + iter_func(con); + } +} + +static inline void console_iter_void_arg2(struct domain *d, + VOID_ITER_FUNC_ARG2 iter_func, + void *iter_data) +{ + unsigned int i; + struct console *con = &d->console[0]; + + for (i = 0; i < NUM_CONSOLE_TYPE; i++, con++) { + iter_func(con, iter_data); + } +} + +static inline int console_iter_int_arg1(struct domain *d, + INT_ITER_FUNC_ARG1 iter_func) +{ + unsigned int i; + int ret; + struct console *con = &d->console[0]; + + for (i = 0; i < NUM_CONSOLE_TYPE; i++, con++) { + /* + * Zero return values means success. + * + * Non-zero return value indicates an error in which + * case terminate the loop. + */ + ret = iter_func(con); + if (ret) + break; + } + return ret; +} + +static inline int console_iter_int_arg3(struct domain *d, + INT_ITER_FUNC_ARG3 iter_func, + void **iter_data) +{ + unsigned int i; + int ret; + struct console *con = &d->console[0]; + + for (i = 0; i < NUM_CONSOLE_TYPE; i++, con++) { + /* + * Zero return values means success. + * + * Non-zero return value indicates an error in which + * case terminate the loop. + */ + ret = iter_func(con, d, iter_data); + if (ret) + break; + } + return ret; +} + static int write_all(int fd, const char* buf, size_t len) { while (len) { @@ -336,7 +426,9 @@ static int create_console_log(struct console *con) return -1; } - snprintf(logfile, PATH_MAX-1, "%s/guest-%s.log", log_dir, data); + snprintf(logfile, PATH_MAX-1, "%s/guest-%s%s.log", + log_dir, data, con->log_suffix); + free(data); logfile[PATH_MAX-1] = '\0'; @@ -488,7 +580,7 @@ static int console_create_tty(struct console *con) } free(path); - success = (asprintf(&path, "%s/tty", con->xspath) != -1); + success = (asprintf(&path, "%s/%s", con->xspath, con->ttyname) != -1); if (!success) goto out; success = xs_write(xs, XBT_NULL, path, slave, strlen(slave)); @@ -654,13 +746,13 @@ static bool watch_domain(struct domain *dom, bool watch) { char domid_str[3 + MAX_STRLEN(dom->domid)]; bool success; - struct console *con = &dom->console; + struct console *con = &dom->console[0]; snprintf(domid_str, sizeof(domid_str), "dom%u", dom->domid); if (watch) { success = xs_watch(xs, con->xspath, domid_str); if (success) - console_create_ring(con); + console_iter_int_arg1(dom, console_create_ring); else xs_unwatch(xs, con->xspath, domid_str); } else { @@ -670,11 +762,13 @@ static bool watch_domain(struct domain *dom, bool watch) return success; } -static int console_init(struct console *con, struct domain *dom) +static int console_init(struct console *con, struct domain *dom, void **data) { char *s; int err = -1; struct timespec ts; + struct console_type **con_type = (struct console_type **)data; + char *xsname, *xspath; if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) { dolog(LOG_ERR, "Cannot get time of day %s:%s:L%d", @@ -692,15 +786,21 @@ static int console_init(struct console *con, struct domain *dom) con->xce_pollfd_idx = -1; con->next_period = ((long long)ts.tv_sec * 1000) + (ts.tv_nsec / 1000000) + RATE_LIMIT_PERIOD; con->d = dom; - con->xspath = xs_get_domain_path(xs, dom->domid); - s = realloc(con->xspath, strlen(con->xspath) + - strlen("/console") + 1); + con->ttyname = (*con_type)->ttyname; + con->log_suffix = (*con_type)->log_suffix; + xsname = (char *)(*con_type)->xsname; + xspath = xs_get_domain_path(xs, dom->domid); + s = realloc(xspath, strlen(xspath) + + strlen(xsname) + 1); if (s) { - con->xspath = s; - strcat(con->xspath, "/console"); + xspath = s; + strcat(xspath, xsname); + con->xspath = xspath; err = 0; } + (*con_type)++; + return err; } @@ -713,7 +813,7 @@ static void console_free(struct console *con) static struct domain *create_domain(int domid) { struct domain *dom; - struct console *con; + struct console_type *con_type = &console_type[0]; dom = calloc(1, sizeof *dom); if (dom == NULL) { @@ -723,9 +823,8 @@ static struct domain *create_domain(int domid) } dom->domid = domid; - con = &dom->console; - if (console_init(con, dom)) + if (console_iter_int_arg3(dom, console_init, (void **)&con_type)) goto out; if (!watch_domain(dom, true)) @@ -738,7 +837,7 @@ static struct domain *create_domain(int domid) return dom; out: - console_free(con); + console_iter_void_arg1(dom, console_free); free(dom); return NULL; } @@ -784,11 +883,9 @@ static void console_cleanup(struct console *con) static void cleanup_domain(struct domain *d) { - struct console *con = &d->console; + console_iter_void_arg1(d, console_close_tty); - console_close_tty(con); - - console_cleanup(con); + console_iter_void_arg1(d, console_cleanup); remove_domain(d); } @@ -803,12 +900,10 @@ static void console_close_evtchn(struct console *con) static void shutdown_domain(struct domain *d) { - struct console *con = &d->console; - d->is_dead = true; watch_domain(d, false); - console_unmap_interface(con); - console_close_evtchn(con); + console_iter_void_arg1(d, console_unmap_interface); + console_iter_void_arg1(d, console_close_evtchn); } static unsigned enum_pass = 0; @@ -1003,7 +1098,7 @@ static void handle_xs(void) /* We may get watches firing for domains that have recently been removed, so dom may be NULL here. */ if (dom && dom->is_dead == false) - console_create_ring(&dom->console); + console_iter_int_arg1(dom, console_create_ring); } free(vec); @@ -1058,9 +1153,7 @@ static void handle_log_reload(void) if (log_guest) { struct domain *d; for (d = dom_head; d; d = d->next) { - struct console *con = &d->console; - - console_open_log(con); + console_iter_void_arg1(d, console_open_log); } } @@ -1223,13 +1316,13 @@ void handle_io(void) /* Re-calculate any event counter allowances & unblock domains with new allowance */ for (d = dom_head; d; d = d->next) { - struct console *con = &d->console; - console_evtchn_unmask(con, (void *)now); + console_iter_void_arg2(d, console_evtchn_unmask, (void *)now); - maybe_add_console_evtchn_fd(con, (void *)&next_timeout); + console_iter_void_arg2(d, maybe_add_console_evtchn_fd, + (void *)&next_timeout); - maybe_add_console_tty_fd(con); + console_iter_void_arg1(d, maybe_add_console_tty_fd); } /* If any domain has been rate limited, we need to work @@ -1290,13 +1383,12 @@ void handle_io(void) } for (d = dom_head; d; d = n) { - struct console *con = &d->console; n = d->next; - handle_console_ring(con); + console_iter_void_arg1(d, handle_console_ring); - handle_console_tty(con); + console_iter_void_arg1(d, handle_console_tty); if (d->last_seen != enum_pass) shutdown_domain(d); From patchwork Wed Sep 27 06:13:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114327 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665267qgf; Tue, 26 Sep 2017 23:16:51 -0700 (PDT) X-Received: by 10.107.78.25 with SMTP id c25mr413950iob.25.1506493011929; Tue, 26 Sep 2017 23:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493011; cv=none; d=google.com; s=arc-20160816; b=P0iyHNgIyMVb+EFngpUPJEpCW0+076MoWvTifRzZXcIZheAhPLdpLzfKOiZ06rJUDc whVAPdFDf2woVmlsa+QFfWsHqxfUY+ekPwi5hqMbIsr0ChLO5nMSTg9P2Hi00Ww3jhmw rzBbBQSeQZbWETQVjKlltL2jLoP+hqUrNtv8AE+OwjWjJV6DrGYdS0OoSP06lC31n+5f lApS8JVr+e6WI0kHNVfaucEo7gls3en1ETF/s9xtN0L8AfoY/k5THtcuy5yx8T2nHw0w Hodu5HL7Vp1GDFFPa6HAE8oiKDz0Jv9HEtm6cXx5zsEyHocqfLU0uYHc9ar3QG9iCSbj f/cA== 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=i1DerMoIfoPo/MsSXJfIlpUT2liqezAHI1qr9iqywbA=; b=rLRPkSxXPNQg/65VO9yfCiUUmf4vZB/03FIO4PtGORFnFFT74wvUNqURZj/9kz1hxP 9ZIaiXmQCFBWv+KGf9VpcAgAJdOFghkccr4pDNQLnC9xRmaGcBTgs5FUYWsCmJnOmIpp IBKDmeCDrC2B+tsb6NXzamihfvXpnmtJB38u+yrKOEVhfFr5CII114A8v8MHpxkIt2MG Pk4n8egVVVki8MGNXNGm3HEafubWx28xXuAXB7sLRSYCzy5XEoZsiQqvzex4M3408mEC 5VqYDEFbjJJlWYZIUErfYrqrSRY42SMTt07GgPTWOSQnR85OCK2LnRMyxh2Tdm3tcYlY dlIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jkLokppx; 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 a10si3490308itb.154.2017.09.26.23.16.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:51 -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=jkLokppx; 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 1dx5by-0003E5-GC; Wed, 27 Sep 2017 06:14:22 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bx-0003CA-F1 for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:21 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 14/06-02044-CB14BC95; Wed, 27 Sep 2017 06:14:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRWlGSWpSXmKPExsVyMfTANt3djqc jDa685LH4vmUykwOjx+EPV1gCGKNYM/OS8isSWDM+nFvPVvBfvmLSs+WsDYxd0l2MXBxCAjMY JRbcfcQO4rAIzGOWaJhyFMyREOhnlbhxbztTFyMnkJMn0buuBcjmALLTJP5ck4UIl0t83HQHr ERIQEvi6KnZrBD2CiaJ69frQcrZBEwkZnVIgIRFBJQk7q2azAQynllgPqPE/5+3WEASwgLhEg 9mdIONZxFQlXhyLxgkzCvgI7H4xnxmiFVyEjfPdYLZnEDx0/232SBWeUtcWtnPOoFRcAEjwyp GjeLUorLUIl0jc72kosz0jJLcxMwcXUMDY73c1OLixPTUnMSkYr3k/NxNjMBwq2dgYNzB2LLX 7xCjJAeTkihvzf9TkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeG84nI4UEixKTU+tSMvMAQY+T FqCg0dJhFcQGPxCvMUFibnFmekQqVOMrhwX7lz6w8RxbNNlIPml9waQPLDnFpDsuHn3D5MQS1 5+XqqUOO9FkNkCIM0ZpXlwo2FRe4lRVkqYl5GBgUGIpyC1KDezBFX+FaM4B6OSMK8syAk8mXk lcBe8AjqOCei43qknQI4rSURISTUwaleqdF61bSt4KNM8TdaBuWj9d6Obh95ZWC7zVT1z3oM5 T8LHcO60Mv/naybomP5IE/tZavls2W3zCZ05Zcsv7xffzXbowNRuZUWTs5wbyr5eWhLgt6VDq CStTptxQuTh2P6PL38vKYjbpls41YVXb0pmzjLJvHMb3x8vSfp8/97Uj1e+WzLrKLEUZyQaaj EXFScCAIm5KujVAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-14.tower-31.messagelabs.com!1506492857!116524231!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 45513 invoked from network); 27 Sep 2017 06:14:19 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-14.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:19 -0000 Received: by mail-pf0-f182.google.com with SMTP id p87so6745120pfj.9 for ; Tue, 26 Sep 2017 23:14:18 -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=+FatmofrAza4mRjPSInOolFST8U95IIGtc54zK1irIA=; b=jkLokppxfiDHEdHwx87nXoT9ZZ0ZnCRo8vIXL6TAoK9OT+LT/WuDkXV85DiurgGTAG BFLPwnLt2alyomPUeP3BNgWuM+ipFrULzPMQJJP7FTn8MDKh6ZAWG4NNSJuxbGelLH7s mIvecJWn5lCaMml9rv/qolqe5SsVflAFUnq+o= 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=+FatmofrAza4mRjPSInOolFST8U95IIGtc54zK1irIA=; b=s3Bd0lFwNvTzTBOKbExlI/mzfo+pwq+u9vvtqTXffIj0WXme3o09cDJGCiVrCkEWdG 22L1E88apcl1nsAeUMjZAwL88m/1qsJusgzWtpJT32leFVqTlOd8eDfRsuXS11mBpszX B5EE6N6G9aIHXUPEy7AYhvszKvyuX7MOLSift9vDYuNOFthQlV9IBw8NkXpw2WrMgNIi 1KJ0HTtUSU4q4QHEmm5MTZ0aZ6vzL41lnVgY36rfTe8vaY0kBowtYaZP4x7R87RSVk12 hp5KWjaKPjEnUSV/j9DvUJ2sfVGHf/KTnR5j8tk4NEk3PgnGDCCsNedbjNYMWfayiFf+ MZKg== X-Gm-Message-State: AHPjjUioIA6VKoI0tJSQew6DcnJmeLyr90OVz2bXpKeeWSaNwQH5k0Ve i1f1WWbsrLY5Bojqz0DG16WUH9mzNsM= X-Google-Smtp-Source: AOwi7QD9NMwYTqMnsKWm8qAoXnurWebk4JdsbNCBZ0k+dkjUvrG/jOrwKQs9YwZ/IeK9yEVGPC0PYw== X-Received: by 10.101.69.194 with SMTP id m2mr358460pgr.20.1506492857304; Tue, 26 Sep 2017 23:14:17 -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.14.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:16 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:31 +0530 Message-Id: <1506492816-25954-23-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 22/27 v11] xen/arm: vpl011: Add support for vuart console 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 finally adds the support for vuart console. It adds two new fields in the console initialization: - optional - use_gnttab optional flag tells whether the console is optional. use_gnttab tells whether the ring buffer should be allocated using grant table. The VUART console is enabled ony for ARM. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Julien Grall CC: Stefano Stabellini Changes since v8: - Removed CONFIG_VUART_CONSOLE config option - Renamed CFLAGS_vuart-$(CONFIG_VUART_CONSOLE) to CONSOLE_CFLAGS-$(CONFIG_ARM) - I hav retained the acked-by tag as it is a minor change Changes since v6: - Renames prefer_gnttab to use_gnttab Changes since v4: - Renamed VUART_CFLAGS- to CFLAGS_vuart- in the Makefile as per the convention. tools/console/Makefile | 3 ++- tools/console/daemon/io.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/tools/console/Makefile b/tools/console/Makefile index c5f3f5c..84796ea 100644 --- a/tools/console/Makefile +++ b/tools/console/Makefile @@ -11,6 +11,7 @@ LDLIBS += $(SOCKET_LIBS) LDLIBS_xenconsoled += $(UTIL_LIBS) LDLIBS_xenconsoled += -lrt +CONSOLE_CFLAGS-$(CONFIG_ARM) = -DCONFIG_ARM BIN = xenconsoled xenconsole @@ -28,7 +29,7 @@ clean: distclean: clean daemon/main.o: daemon/_paths.h -daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) +daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) $(CONSOLE_CFLAGS-y) xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c)) $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_xenconsoled) $(APPEND_LDFLAGS) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index a198dbb..2615b50 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -107,12 +107,16 @@ struct console { xenevtchn_port_or_error_t remote_port; struct xencons_interface *interface; struct domain *d; + bool optional; + bool use_gnttab; }; struct console_type { char *xsname; char *ttyname; char *log_suffix; + bool optional; + bool use_gnttab; }; static struct console_type console_type[] = { @@ -120,7 +124,18 @@ static struct console_type console_type[] = { .xsname = "/console", .ttyname = "tty", .log_suffix = "", + .optional = false, + .use_gnttab = true, }, +#if defined(CONFIG_ARM) + { + .xsname = "/vuart/0", + .ttyname = "tty", + .log_suffix = "-vuart0", + .optional = true, + .use_gnttab = false, + }, +#endif }; #define NUM_CONSOLE_TYPE (sizeof(console_type)/sizeof(struct console_type)) @@ -654,8 +669,17 @@ static int console_create_ring(struct console *con) "ring-ref", "%u", &ring_ref, "port", "%i", &remote_port, NULL); - if (err) + + if (err) { + /* + * This is a normal condition for optional consoles: they might not be + * present on xenstore at all. In that case, just return without error. + */ + if (con->optional) + err = 0; + goto out; + } snprintf(path, sizeof(path), "%s/type", con->xspath); type = xs_read(xs, XBT_NULL, path, NULL); @@ -669,7 +693,7 @@ static int console_create_ring(struct console *con) if (ring_ref != con->ring_ref && con->ring_ref != -1) console_unmap_interface(con); - if (!con->interface && xgt_handle) { + if (!con->interface && xgt_handle && con->use_gnttab) { /* Prefer using grant table */ con->interface = xengnttab_map_grant_ref(xgt_handle, dom->domid, GNTTAB_RESERVED_CONSOLE, @@ -788,6 +812,8 @@ static int console_init(struct console *con, struct domain *dom, void **data) con->d = dom; con->ttyname = (*con_type)->ttyname; con->log_suffix = (*con_type)->log_suffix; + con->optional = (*con_type)->optional; + con->use_gnttab = (*con_type)->use_gnttab; xsname = (char *)(*con_type)->xsname; xspath = xs_get_domain_path(xs, dom->domid); s = realloc(xspath, strlen(xspath) + From patchwork Wed Sep 27 06:13:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114329 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665333qgf; Tue, 26 Sep 2017 23:16:56 -0700 (PDT) X-Received: by 10.36.26.133 with SMTP id 127mr959368iti.88.1506493016728; Tue, 26 Sep 2017 23:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493016; cv=none; d=google.com; s=arc-20160816; b=oHu7YbF/J+5PnKzf6MvDtrcW9zbxRVu7Slrt82D0kpWXNfRm/1d6l/RE/9N/SxQD+C 3tWRP+Z/c9C98/FIG7IoQFXUIuS3FgeRgtQAywFn5Wv9HI1bd7qVVZXVPR8uDc4JR9c7 kIm6wjwWk67Xm+t3cXWLn+NrD7euujf/8FIHw8oTpOnXXcTkT95SkajrplUR3gqQsHOI gniAcY+7oKjbzTY42CXTj3kFv3v+hxeIYlBick/HqlLGoeyToiLU7HzJxNR3fQ7Io/dh AzyLIaMiTo8IkPe/55/d18tmvQGhiEvxlSXsqbLIePKbjvB4rJU46fYuQg1gS4KoCYyE geZA== 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=pJyNIWfhAVo2E2CgMcfI/HHFeP51uQR9/ksH+7RgARQ=; b=meWU2kwAlTPlDHTcmu56WgYuH0OWxncgLKHGLoKMoUczV7RMDazVewBPSLT0D2b44B 337ix8XVqhRsVwgAz52Amj5IpzqG4IEJVrLQYm+z7iiqRC7qiOVtfaKMI7Rtnx4diAJF 70eY510RB/StGj4QG+ezMqdOyCK30C76k0I8k9xkajrDWqQ+lWi1OoPUncibNgPuf4Zt QqBQKCghyUW8eACa9/nFEf4PBJ61xWbjReh0XNTh+1MefWCNNy+SCymwzOkiFkCvAYaL JBJJOVLdo5P6aIwkYqudytOvd3FGwffQOec6V8mGNYfvClvtzh5GLtJmnpkyfB4C6deQ /Dlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HI+JJsQN; 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 e38si3547062itd.195.2017.09.26.23.16.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:56 -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=HI+JJsQN; 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 1dx5c1-0003J0-NW; Wed, 27 Sep 2017 06:14:25 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5c0-0003HM-Sn for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:24 +0000 Received: from [85.158.139.211] by server-16.bemta-5.messagelabs.com id 89/9C-18674-0C14BC95; Wed, 27 Sep 2017 06:14:24 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsXiVRtsqLvf8XS kwaF3Shbft0xmcmD0OPzhCksAYxRrZl5SfkUCa0bjrNXsBZdFK84t3cDewDhbsIuRi0NIYDqj xPTPP9hAHBaBecwS55d8Ze9i5OSQEOhnlVg/q6iLkQPIzpP4vs4XIpwmsbR1BQuEXS6xZupFZ hBbSEBL4uip2awQ9gomiUlba0Ba2QRMJGZ1SICERQSUJO6tmswEsopZYD6jRNOkXjaQhLBArM T8d8fB1rIIqEp8PrmUEcTmFfCRmLliHhvELjmJm+c6wXZxAsVP999mg9jlLXFpZT/rBEbBBYw Mqxg1ilOLylKLdA1N9JKKMtMzSnITM3N0DQ1M9XJTi4sT01NzEpOK9ZLzczcxAsONAQh2MJ49 7XmIUZKDSUmUt+b/qUghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErzzHE5HCgkWpaanVqRl5gADH yYtwcGjJMJ7DSTNW1yQmFucmQ6ROsVoyfGl98YfJo59e24ByY6bd/8wCbHk5eelSonzXgRpEA BpyCjNgxsHi85LjLJSwryMQAcK8RSkFuVmlqDKv2IU52BUEuZdCDKFJzOvBG7rK6CDmIAO6p1 6AuSgkkSElFQDY7iZfGZXlOhhw1VBD5rvna9WC27mbL3x7r9sQzmjOnfX1VOWiat8pc6rxNYG RD54Pc3j6H7horInQgeT9tae2XZBZ8nkNZMe2icziLJvvn/o041ejdkmGmffB4dnu+9aKbWmU WD+l+UuTTumc7d9tP5+zP9a53ex06f/s1nLb5tz6htf+L4EXyWW4oxEQy3mouJEAJeK46DJAg AA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-206.messagelabs.com!1506492862!113276141!1 X-Originating-IP: [74.125.83.49] 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 39853 invoked from network); 27 Sep 2017 06:14:23 -0000 Received: from mail-pg0-f49.google.com (HELO mail-pg0-f49.google.com) (74.125.83.49) by server-8.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:23 -0000 Received: by mail-pg0-f49.google.com with SMTP id m30so7218328pgn.6 for ; Tue, 26 Sep 2017 23:14:23 -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=HWroLNIkhQjYUcAWyd7ghBserWIB9IYYwUwfhZwGLVc=; b=HI+JJsQNybnWCzPhzjdNUi7V5DIcHGVNRJb/V96JWheJt2VPQ4OJxtAekcLDrmZICD E+8tRI2ygRXFUnkqVchZlacf3QuajPJPQSeYGFgAvxldtPqd5mqaK+H36lnBGj2xCtYn TJ2buvx+IKl4FmPX4u+Rl1Sp7xmMdw+M2jlZE= 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=HWroLNIkhQjYUcAWyd7ghBserWIB9IYYwUwfhZwGLVc=; b=Z2YRF4qXohkguwrEVoGdhear+LtiiKWd1d6Svpnb7mTZNHPCT8zl1kcFPLaARjXUS4 /QHC6vzZ4tKXjfdB9JCz29EHJniVRa1JxK/ei1Mw/8gczZWoCRpAuAiked9xNGdyVZJN lyVwQ8h0nczEdwOK/ExhakLv/f7TDE6ehUMZBuVDMMDb7JQbdvlpflJg6PjdYVybghuD OwFA5oIQSjPZFEqqPsoFWJInoI7AisMJ0mm4MwnYvzYQYzXOP8bxQR0EhGVMTu2o7bSK TDJ56myKQnTeKihQSlHay+1Tn09dVsaDFuT9GyrUZTMGaT3QSk8k1WBGyNLii2Rc0PoZ a7jg== X-Gm-Message-State: AHPjjUhgbX3tFrAmGGe9mxTRjSeOOSEJG+rxR99LLDNeuRFd/vkFYIzH xw7p827bNL92xKA0yrbkKv0UTosI8WQ= X-Google-Smtp-Source: AOwi7QCQaxF4A2RGy2z+CkUdoWWx4UFzL8Fs0dJArkooxCXZNDX/sSvaLZh9HBMCC69Z7Ai4ivvoaA== X-Received: by 10.98.10.146 with SMTP id 18mr332758pfk.346.1506492861747; Tue, 26 Sep 2017 23:14:21 -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.14.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:21 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:32 +0530 Message-Id: <1506492816-25954-24-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 23/27 v11] xen/arm: vpl011: Add a new vuart console type to xenconsole client 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" Add a new console type VUART to connect to guest's emualated vuart console. 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 v4: - Removed the vuart compile time flag so that vuart code is compiled always. Changes since v3: - The vuart console support is under CONFIG_VUART_CONSOLE option. - Since there is a change from last review, I have not included reviewed-by tag from Stefano and acked-by tag from Wei. tools/console/client/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/console/client/main.c b/tools/console/client/main.c index c340cb7..f92ad3d 100644 --- a/tools/console/client/main.c +++ b/tools/console/client/main.c @@ -76,7 +76,7 @@ static void usage(const char *program) { "\n" " -h, --help display this help and exit\n" " -n, --num N use console number N\n" - " --type TYPE console type. must be 'pv' or 'serial'\n" + " --type TYPE console type. must be 'pv', 'serial' or 'vuart'\n" " --start-notify-fd N file descriptor used to notify parent\n" , program); } @@ -264,6 +264,7 @@ typedef enum { CONSOLE_INVAL, CONSOLE_PV, CONSOLE_SERIAL, + CONSOLE_VUART, } console_type; static struct termios stdin_old_attr; @@ -344,6 +345,7 @@ int main(int argc, char **argv) char *end; console_type type = CONSOLE_INVAL; bool interactive = 0; + char *console_names = "serial, pv, vuart"; while((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) { switch(ch) { @@ -359,9 +361,12 @@ int main(int argc, char **argv) type = CONSOLE_SERIAL; else if (!strcmp(optarg, "pv")) type = CONSOLE_PV; + else if (!strcmp(optarg, "vuart")) + type = CONSOLE_VUART; else { fprintf(stderr, "Invalid type argument\n"); - fprintf(stderr, "Console types supported are: serial, pv\n"); + fprintf(stderr, "Console types supported are: %s\n", + console_names); exit(EINVAL); } break; @@ -437,6 +442,10 @@ int main(int argc, char **argv) else snprintf(path, strlen(dom_path) + strlen("/device/console/%d/tty") + 5, "%s/device/console/%d/tty", dom_path, num); } + if (type == CONSOLE_VUART) { + snprintf(path, strlen(dom_path) + strlen("/vuart/0/tty") + 1, + "%s/vuart/0/tty", dom_path); + } /* FIXME consoled currently does not assume domain-0 doesn't have a console which is good when we break domain-0 up. To keep us From patchwork Wed Sep 27 06:13:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114334 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665381qgf; Tue, 26 Sep 2017 23:17:01 -0700 (PDT) X-Received: by 10.107.189.129 with SMTP id n123mr496456iof.48.1506493021389; Tue, 26 Sep 2017 23:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493021; cv=none; d=google.com; s=arc-20160816; b=MgQxx87dUv+JIk+FbEWaXbBXw0VQDf+N+Wbp2AQ8ZOSQJVgSqoZgT0YAjOM1GX0V/2 51Pi/TZE6G2uibiIhDrdIYoHZNjEjRRrzIgdUHjFpVYUfWkqvgSWTLzOlCdgL99YBItx yojJXzU7PNB1tRVaS59BkovRg9E2ksnEXsnvE5sC0Tz2wAJP5l9GoBhwm2kTAj/pSzKi A8gCi3xzmhDa+K2/5VIoIMXSRlNE1P42iDdarAtp6bjvtBFSOijYUCoUpOQC1LhJe6Oa pM49Tlm13GxpOkXO3sG2TIn7I4a3lQ5Whx3KaFpii8dd6gdCs5DmyyySy7JioEhI+FuK 334Q== 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=ia2w5dL59G4X6+C2K0E6OoFSmdQkQ2qrAt+g+fzQ0uY=; b=KHk3LYjrMHguLqYxynzoSi9RNXoQde0R1UGlpgHHBAds9u7OI3WZFYjXdeZLw5TgO8 scsI1L4lQFfOXZY7sPuqpzXDY4KEKcMG5/5eMh8lzsnKCbnMuxDJc37Z+fKzLbTnAZmR NdpyJqOwrtmZDKsnr4c6T+JotntxbjqT9S7ab4Rj0mXHb26bSF9oOjLJUDt+PMSKs2lG CTDxKT2MrwYbQrHB7jdCnp7kAt66YEi1BYLyouoVBCfLmAZXuJhGr4JV+T8p6krxwCkv rxpWaic7RBH4T5n2/g6+/c4MN8UnXzD6R3f4zVWTviENWn1brzCjDdlmYonA/z4lU1NU 9Jnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BWgQVDZ3; 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 l75si8819038ioe.135.2017.09.26.23.17.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:01 -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=BWgQVDZ3; 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 1dx5c5-0003OV-0E; Wed, 27 Sep 2017 06:14:29 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5c3-0003Lm-Ps for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:27 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id FE/FF-03414-3C14BC95; Wed, 27 Sep 2017 06:14:27 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsXiVRtsqHvQ8XS kQcMzSYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPjw5XsBTPUKvb8X8rSwNgn28XIxSEkMINR ovlNFyOIwyIwj1nixPEZrCCOhEA/q8Tvzm8sXYycQE6exNk/D9kg7DSJyVv/MEHYFRJtPQ+YQ WwhAS2Jo6dms0KMXcEk8eb4OqBmDg42AROJWR0SIDUiAkoS91ZNZgKpYRaYzyjRNKkXbKiwQK zEmzOb2UFsFgFVieWNK1hBbF4BH4m1u/5BLZaTuHmuE2wZJ1D8dP9tNojF3hKXVvazTmAUXMD IsIpRozi1qCy1SNfQRC+pKDM9oyQ3MTNH19DATC83tbg4MT01JzGpWC85P3cTIzDoGIBgB+P1 jQGHGCU5mJREeWv+n4oU4kvKT6nMSCzOiC8qzUktPsQow8GhJMF7w+F0pJBgUWp6akVaZg4w/ GHSEhw8SiK810DSvMUFibnFmekQqVOMlhxfem/8YeLYt+cWkOy4efcPkxBLXn5eqpQ470WQBg GQhozSPLhxsBi9xCgrJczLCHSgEE9BalFuZgmq/CtGcQ5GJWHehSBTeDLzSuC2vgI6iAnooN6 pJ0AOKklESEk1MPoE2B26+Fm838mEaXvdDt8XwqLeMzb8jLk/Ky6XJ1sjsXryWdd49nPrzZQ+ Jr+/m2dzXO3cnNhDTPz7/H3cfm9Z6Sale2RZvPtODnuNqC6l415i716wzwm6UZqw8dl8/dmn5 q5IbG78G/V15bLb7ccK9618Kl//08nBqXTfsxO3Hplt3unjsluJpTgj0VCLuag4EQD+oZB9zA IAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-7.tower-21.messagelabs.com!1506492864!84828988!1 X-Originating-IP: [74.125.83.49] 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 17740 invoked from network); 27 Sep 2017 06:14:25 -0000 Received: from mail-pg0-f49.google.com (HELO mail-pg0-f49.google.com) (74.125.83.49) by server-7.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:25 -0000 Received: by mail-pg0-f49.google.com with SMTP id k193so7220888pgc.8 for ; Tue, 26 Sep 2017 23:14:25 -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=8o2al3bzod4mOOONVe20amJaaulnmm2NgPZDeRZkrVE=; b=BWgQVDZ3DiaBOxA038MJDkkmSlQ4Z9eMrNd/w/CJ1wlTUTFz7CqHAJAhA7VQjbDO31 RbMgu+b0XZFVAfTnfs73KVS/wfOA9MDYT1V+6o5HZuy8HKwLY8CjT2H4auK73Sm2RyTi nWuTgs2+lgT53nIBzcPPtJiod/Tvzyeb1V+HE= 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=8o2al3bzod4mOOONVe20amJaaulnmm2NgPZDeRZkrVE=; b=cKdu324IPHUmTHnmmEKKyI4/IzoKjU98t3H9n+VfWW7EroLJIFW6jQD8SqXSZlFqkk 1XWhIjNSJMQD/ztvzToFnyHOaNIz2ZQCIlmEHAsqcV2QXWUMCIpr3ZrQcxbWYipdO/5Y A8pSWsYszFL4eyR9fFY7TXM7ya5UPrFzFpD+dfbi05UkpPPbX/9CkBCMosESzRFX81rl BrW8aD/cx02EErpAAlCSYqjTMlTxzCWtsDFSHnWdaOOEiPwauK+3J8X0gdblkRGGHPBh g1PMzzM0MwbBR3UtZw5cJVLZGhUAKLxXwrM4p9MsnyfHlk9wjWuvfZAnsPgUsm45kXBt Cepw== X-Gm-Message-State: AHPjjUhOOxWO/RZ1p+VBfWOzfeWFzDXpNRr6JEcPTjqgfTdMPgOUiGLH Y4uazVeG0+7CcOcH2Jh7tjyQRUWw9VE= X-Google-Smtp-Source: AOwi7QBvDqJf/f2M4fFytEP1GGR9foQTO7jGEWgO0YHPAw0KmJjGmnnbavNTB2+4kkHPu+t7X7B56Q== X-Received: by 10.98.157.139 with SMTP id a11mr360549pfk.70.1506492863469; Tue, 26 Sep 2017 23:14:23 -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.14.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:22 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:33 +0530 Message-Id: <1506492816-25954-25-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 24/27 v11] xen/arm: vpl011: Add a pl011 uart DT node in the guest device tree 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" The SBSA UART node format is as specified in Documentation/devicetree/bindings/serial/arm_sbsa_uart.txt and given below: ARM SBSA defined generic UART ------------------------------ This UART uses a subset of the PL011 registers and consequently lives in the PL011 driver. It's baudrate and other communication parameters cannot be adjusted at runtime, so it lacks a clock specifier here. Required properties: - compatible: must be "arm,sbsa-uart" - reg: exactly one register range - interrupts: exactly one interrupt specifier - current-speed: the (fixed) baud rate set by the firmware Currently the baud rate of 115200 has been selected as a default value, which is one of the valid baud rate settings. Higher baud rate was selected since an emulated pl011 can support any valid baud rate without any limitation of the hardware. 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 v7: - Added a TODO to avoid conflict between vpl011 irq and user specified irqs. - Used a new bool vuart_enabled to explicitly set whether pl011 UART is enabled/disabled. Changes since v6: - Added a comment explaining why user specified IRQ should not conflict with vpl011 SPI. - Checking the vuart type explicitly against vpl011 enum type. - Removed uart-compat string and using "arm,sbsa-uart" string directly. - I have retained the reviewed-by/acked-by tags as these are minor changes. tools/libxl/libxl_arm.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 2e9f780..bfb7d08 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -43,11 +43,38 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, { uint32_t nr_spis = 0; unsigned int i; + uint32_t vuart_irq; + bool vuart_enabled = false; + + /* + * If pl011 vuart is enabled then increment the nr_spis to allow allocation + * of SPI VIRQ for pl011. + */ + if (d_config->b_info.arch_arm.vuart == LIBXL_VUART_TYPE_SBSA_UART) { + nr_spis += (GUEST_VPL011_SPI - 32) + 1; + vuart_irq = GUEST_VPL011_SPI; + vuart_enabled = true; + } for (i = 0; i < d_config->b_info.num_irqs; i++) { uint32_t irq = d_config->b_info.irqs[i]; uint32_t spi; + /* + * This check ensures the if user has requested pass-through of a certain irq + * which conflicts with vpl011 irq then it flags an error to indicate to the + * user that the specific HW irq cannot be used as it is dedicated for vpl011. + * + * TODO: + * The vpl011 irq should be assigned such that it never conflicts with user + * specified irqs thereby preventing its pass-through. This TODO is for + * implementing that logic in future. + */ + if (vuart_enabled && irq == vuart_irq) { + LOG(ERROR, "Physical IRQ %u conflicting with pl011 SPI\n", irq); + return ERROR_FAIL; + } + if (irq < 32) continue; @@ -590,6 +617,38 @@ static int make_hypervisor_node(libxl__gc *gc, void *fdt, return 0; } +static int make_vpl011_uart_node(libxl__gc *gc, void *fdt, + const struct arch_info *ainfo, + struct xc_dom_image *dom) +{ + int res; + gic_interrupt intr; + + res = fdt_begin_node(fdt, "sbsa-pl011"); + if (res) return res; + + res = fdt_property_compat(gc, fdt, 1, "arm,sbsa-uart"); + if (res) return res; + + res = fdt_property_regs(gc, fdt, ROOT_ADDRESS_CELLS, ROOT_SIZE_CELLS, + 1, + GUEST_PL011_BASE, GUEST_PL011_SIZE); + if (res) return res; + + set_interrupt(intr, GUEST_VPL011_SPI, 0xf, DT_IRQ_TYPE_LEVEL_HIGH); + + res = fdt_property_interrupts(gc, fdt, &intr, 1); + if (res) return res; + + /* Use a default baud rate of 115200. */ + fdt_property_u32(fdt, "current-speed", 115200); + + res = fdt_end_node(fdt); + if (res) return res; + + return 0; +} + static const struct arch_info *get_arch_info(libxl__gc *gc, const struct xc_dom_image *dom) { @@ -889,6 +948,9 @@ next_resize: FDT( make_timer_node(gc, fdt, ainfo, xc_config->clock_frequency) ); FDT( make_hypervisor_node(gc, fdt, vers) ); + if (info->arch_arm.vuart == LIBXL_VUART_TYPE_SBSA_UART) + FDT( make_vpl011_uart_node(gc, fdt, ainfo, dom) ); + if (pfdt) FDT( copy_partial_fdt(gc, fdt, pfdt) ); From patchwork Wed Sep 27 06:13:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114344 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665536qgf; Tue, 26 Sep 2017 23:17:12 -0700 (PDT) X-Received: by 10.107.78.25 with SMTP id c25mr414865iob.25.1506493032061; Tue, 26 Sep 2017 23:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493032; cv=none; d=google.com; s=arc-20160816; b=WocZcybrrrWsx06PQtolecah4/MQ2aJ/8AEQl5HV4tPzxqEDH7n61RHso4oDa4bkSU uXy9woez9g1V72kGU7gvs9LIdL6hFUyRcZB2apVOqfG1ylOBKd9n6mGoqInimAYyGlJD zwl/RVNF559TEzjZiPfoqmRqqfPO1ApZjbz1mJXLPV4Y59ojcTtRZD5mJy7GtrQLs4TD Aic+6hVWd0B07vUkAv7eonoyWDxvdBu+2nVFimLnh9KBpH0ZwYb1WmJdys6qPMkSU2p0 7ODefWs7pk0OYHw49jBw0oEWE9iB6hsFprTpdUGr1qxXA5zQpoI+1Y6QIw18SeuWn6Hx vsmQ== 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=LDkp4vb2s3MmBG1ZCxeOsr+xia053wtYTgkt6nh0LO4=; b=AU3xiTncbThL7/saUO9P29mFIZhWMtOIDzOQcfHKjagNDuL0uAv5lkLQPe/Fb47tfx tA1IgDID/KsCL2wJuRRWmrPv4fkhc3DJEsJQiuxNiHy29gtnNpf33rJR4GRFXEVdRBpN tDZjeouOfO3vS2eUv+D505ICJqi/mZzDqb0V/5CC66NsTZdg4aHd/F5oLbAMxALDqGo8 CyWt5Cjxvl6rm1vwoVc8IvSQfL0FXr5iltTuMh1gWbIqHfFF0/wyrOYhGGwx37K/EzHp DsjMx9+4XAMhA3LHGQ5BgFMPOScTdziwQMUHcrhLG6i39AE4hKpizKhrZUImGWLrYFD6 KrMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=b63wBXcL; 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 q197si9161449iod.180.2017.09.26.23.17.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:12 -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=b63wBXcL; 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 1dx5cB-0003Yx-KD; Wed, 27 Sep 2017 06:14:35 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5cA-0003VX-80 for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:34 +0000 Received: from [85.158.143.35] by server-7.bemta-6.messagelabs.com id 00/FB-03610-9C14BC95; Wed, 27 Sep 2017 06:14:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRWlGSWpSXmKPExsVyMfTAVt1jjqc jDXr2mlh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlzLp9lLujQrJg9R6WBcYNSFyMXh5DADEaJ n4d72EEcFoF5zBJTbrSwgjgSAv2sErNe/wLKcAA5eRJT+iy7GDmBzDSJj6vuskLYFRInT55iB LGFBLQkjp6azQphr2CSOPNCHaSVTcBEYlaHBEhYREBJ4t6qyUwgNrPAcyaJaZd0QGxhgSiJx6 +vMIPYLAKqEhvP/AYbySvgI9HeexhqlZzEzXOdYDWcQPHT/bfZIFZ5S1xa2c86gVFwASPDKkb 14tSistQiXRO9pKLM9IyS3MTMHF1DAzO93NTi4sT01JzEpGK95PzcTYzAUGMAgh2M3Zf9DzFK cjApifLW/D8VKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mC94bD6UghwaLU9NSKtMwcYNDDpCU4e JREeK+BpHmLCxJzizPTIVKnGO05Lty59IeJ40vvDSB5YM8tINlx8+4fJiGWvPy8VClx3osgbQ IgbRmleXBDYVF6iVFWSpiXEehMIZ6C1KLczBJU+VeM4hyMSsK8miBTeDLzSuB2vwI6iwnorN6 pJ0DOKklESEk1MK61CnvrfL3L/ecb/kuB4asEUyuyXnpukNu55OvCK+sb5txr36i/Wnzlsnc3 Hoev0PaPf9Il92iyWZLAskK5gs/fnb8qa+ibhc3dvdjm0n1N/5Lz0z/d3KH5ecOdbYcfRK2Pc 5HOFZ53ek2RV+nGnrw3DxVntOQzbP56xUdwlrr5ziuT/fRvbu5TYinOSDTUYi4qTgQA82/EGc 0CAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-4.tower-21.messagelabs.com!1506492869!78594003!1 X-Originating-IP: [209.85.192.181] 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 36760 invoked from network); 27 Sep 2017 06:14:30 -0000 Received: from mail-pf0-f181.google.com (HELO mail-pf0-f181.google.com) (209.85.192.181) by server-4.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:30 -0000 Received: by mail-pf0-f181.google.com with SMTP id z84so6755928pfi.2 for ; Tue, 26 Sep 2017 23:14:30 -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=0dDjqhXxWsv/zS1ps0b/tJGOGIRU9n88m8CQHyVX6Ts=; b=b63wBXcLpyLF283BzQ8bTuT1Zau9zM/KEa3KFA8bhbV8Bp0KwSHfNdrFb1pzExVjuP A/nsKinCXDKBAd1boFQ9Ke45IEI2a1DFp8f+K2pu+zzmv1lRG6fErdCDa+I0BooSUFFd PvbzDYUIPBdvsmovZZX6UdL3cjUIrdKCBqXcg= 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=0dDjqhXxWsv/zS1ps0b/tJGOGIRU9n88m8CQHyVX6Ts=; b=Hv5bCkoV5PQrinbk0gEOPo0jPPMC0uNY8f+uCBsPPqQVGHLk5kMFSEBHDz6g04TERM jfUBt9yJ4L9YTkb6/ljBsQ05QixTTXYhsDvUxZnYASnLta2pH2tQ+e0ldFEF/ST/qWPT L5gx1+l6o8HmU+8nnJSjUHYB/28X6wC9yzAUymdmiMFKP0DZQHbV7UU1XwdGM/ZPzLKY c8i71EBUHMQOCj/bKSOGXfriXBXRgNX/srupiZIds40AacfbrlIDKU07W73Glb4sECl+ M3yuZ22ED9dYb4Kb50lsZltLjyGofhdgW8Mt3fGpQiKhk9VsMnZdLDAi/3ECYs699JVP skuA== X-Gm-Message-State: AHPjjUgp+5c/3c+1Gp9T6sU+R24z/e/WIbOQ8pOEk5rdhgopT+VycjZP FQurkkmykvq6AUfk60Rw6hcUgJazCQA= X-Google-Smtp-Source: AOwi7QCnOzl8/bussn0xb+Iv6hjNugL+Ll7wFfJPasBxRRApi6eOq3glx1MexyJcSWwmnjjxtDauGg== X-Received: by 10.99.113.94 with SMTP id b30mr348275pgn.312.1506492868833; Tue, 26 Sep 2017 23:14:28 -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.14.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:28 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:34 +0530 Message-Id: <1506492816-25954-26-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: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH 25/27 v11] xen/arm: vpl011: Update documentation for vuart console support 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" 1. Update documentation for a new vuart option added. 2. Update documentation about SPI irq reserved for vuart. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Andrew Cooper CC: George Dunlap CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Julien Grall Changes since v6: - Added a new section for vuart usage. - I have retained the reviewed-by/acked-by tags as this is a limited change. Kindly review. Changes since v4: - Minor change to rename "pl011" to "sbsa_uart". Since it is a minor change I have retained the reviewed-by and acked-by tags. docs/man/xl.cfg.pod.5.in | 12 ++++++++++++ docs/misc/console.txt | 44 +++++++++++++++++++++++++++++++++----------- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in index 247ae99..f1d2a7a 100644 --- a/docs/man/xl.cfg.pod.5.in +++ b/docs/man/xl.cfg.pod.5.in @@ -1105,6 +1105,9 @@ Allow a guest to access specific physical IRQs. It is recommended to only use this option for trusted VMs under administrator's control. +If vuart console is enabled then irq 32 is reserved for it. See +L to know how to enable vuart console. + =item B Limit the guest to using at most N event channels (PV interrupts). @@ -2220,6 +2223,15 @@ the domain was created. This requires hardware compatibility with the requested version, either natively or via hardware backwards compatibility support. +=item B + +To enable vuart console, user must specify the following option in the +VM config file: + +vuart = "sbsa_uart" + +Currently, only the "sbsa_uart" model is supported for ARM. + =back =head3 x86 diff --git a/docs/misc/console.txt b/docs/misc/console.txt index 16da805..4e180f8 100644 --- a/docs/misc/console.txt +++ b/docs/misc/console.txt @@ -19,7 +19,20 @@ The first PV console path in xenstore remains: /local/domain/$DOMID/console -the other PV consoles follow the conventional xenstore device path and +The virtual UART console path in xenstore is defined as: + +/local/domain/$DOMID/vuart/0 + +The vuart console provides access to a virtual SBSA UART on ARM systems. +To enable vuart the following line has to be added to the guest configuration +file: + +vuart = "sbsa_uart" + +In Linux you can select the virtual SBSA UART by using the "ttyAMA0" +console instead of "hvc0". + +The other PV consoles follow the conventional xenstore device path and live in: /local/domain/$DOMID/device/console/$DEVID. @@ -61,6 +74,14 @@ output = pty The backend will write the pty device name to the "tty" node in the console frontend. +For the PV console the tty node is added at + +/local/domain/$DOMID/console/tty + +For the virtual UART console the tty node is added at + +/local/domain/$DOMID/vuart/0/tty + If the toolstack wants a listening Unix domain socket to be created at path , a connection accepted and data proxied to the console, it will write: @@ -79,8 +100,8 @@ For example: ioemu The supported values are only xenconsoled or ioemu; xenconsoled has -several limitations: it can only be used for the first PV console and it -can only connect to a pty. +several limitations: it can only be used for the first PV or virtual UART +console and it can only connect to a pty. Emulated serials are provided by qemu-dm only to hvm guests; the number of emulated serials depends on how many "-serial" command line options @@ -90,14 +111,15 @@ xenstore in the following path: /local/domain/$DOMID/serial/$SERIAL_NUM/tty -xenconsole is the tool to connect to a PV console or an emulated serial -that has a pty as output. Xenconsole takes a domid as parameter plus an -optional console type (pv for PV consoles or serial for emulated -serials) and console number. Depending on the type and console -number, xenconsole will look for the tty node in different xenstore -paths, as described above. If the user doesn't specify the console type -xenconsole will try to guess: if the guest is a pv guest it defaults to -PV console, if the guest is an hvm guest it defaults to emulated serial. +xenconsole is the tool to connect to a PV or virtual UART console or an +emulated serial that has a pty as output. Xenconsole takes a domid as +parameter plus an optional console type (pv for PV consoles, vuart for +virtual UART or serial for emulated serials) and console number. +Depending on the type and console number, xenconsole will look for the tty +node in different xenstore paths, as described above. If the user doesn't +specify the console type xenconsole will try to guess: if the guest is a pv +guest it defaults to PV console, if the guest is an hvm guest it defaults to +emulated serial. By default xl creates a pv console for hvm guests, plus an emulated serial if the user specified 'serial = "pty"' in the VM config file. From patchwork Wed Sep 27 06:13:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114332 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665369qgf; Tue, 26 Sep 2017 23:17:00 -0700 (PDT) X-Received: by 10.36.215.195 with SMTP id y186mr903793itg.3.1506493020065; Tue, 26 Sep 2017 23:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493020; cv=none; d=google.com; s=arc-20160816; b=wc1AZyNs9RCw4uyhVTDHjxtCNkM9jZZRZq6T6hq02qjAi8YXUjs0HQCAReUFaESa6a xHSAVaB+AfD6oo/zx/A5xWO7Xb+S3hZJDGlKwOw0/V4z5/WT3x5xVvMy4KjybBESpwvl D1Ko8HOOmBmBmRPL2hRu9KaNzhyDzuqjDk0fDkfm2hV8u3jNjVS50cIqsAjhuFnE3vMO FNmS6gIA9EXPVamQFX9scjPr5aHUwxkMJtNsJ7RbIjDWcVf9jL0PkZvuxGRoKj+QEz78 jiKrft+1wn/YUH5ogumCZEnRfJxJc6QVykIpudVMUZN2gaB6xeSDEtlkOCXFseoThJ2W ay6w== 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=Oy/4abxUhiFMYmHkbzXyqnKHCU3+JYCYDir9aJJIH38=; b=0ld7rYVmobTRB4icKWxVdSS9MmAQzSDwU+1bQMBA/uA/JhgYaLFrmHImf1b8ynsSEI l9vgfQrw3dD+RLKgI2T737q+0RYqadpA3vxdGhLIZyhjbDGlXyllaVxU3DL8mKkenG/l AKAUlVO86EcT1UdRYObXVQam0gHCimjPIp9wI3OYWCXYLXHo8uAikQMogBJXeZITROtW vFAPVISE1wU4mslbgj9R0FoPFswchGvgGfdZFS9pz1yryeVt5Wrb9NK9XdocBQer6QZ2 ZEYq/5Za3vOQP3F0UEJZYQZRyCW2lSIxcs3SBmAZCyHt8WKIULisP/cr33jR6Xn+AiC4 1oSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ReMZhyhf; 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 o130si3389304itb.88.2017.09.26.23.16.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:00 -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=ReMZhyhf; 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 1dx5cA-0003Vy-8R; Wed, 27 Sep 2017 06:14:34 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5c9-0003UC-3v for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:33 +0000 Received: from [85.158.139.211] by server-16.bemta-5.messagelabs.com id 82/DC-18674-8C14BC95; Wed, 27 Sep 2017 06:14:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRWlGSWpSXmKPExsVyMfTARt3jjqc jDRpOGlp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBkHbv1hLDgnWPH++0OmBsb5vF2MXBxCAjMZ JU49msMK4rAIzGOWOPr3JEsXIyeHhEA/q8SilaUQdp7Ev41L2SHsNImGef+ZIOxyibkbb7OB2 EICWhJHT81mhZi6gkli16LbQA0cHGwCJhKzOiRAakQElCTurZoM1sssUC+x7dwvRhBbWCBcon X3TiaQchYBVYn+404gYV4BH4kTt/cxQqySk7h5rpMZxOYEip/uh1nrLXFpZT/rBEbBBYwMqxg 1ilOLylKLdA3N9JKKMtMzSnITM3N0DQ1M9XJTi4sT01NzEpOK9ZLzczcxAsONAQh2ME59H3eI UZKDSUmUt+b/qUghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErzzHE5HCgkWpaanVqRl5gADHyYtw cGjJMIbBZLmLS5IzC3OTIdInWJ05bhw59IfJo4vvTeA5IE9t4Dkiuu3gWTHzbt/mIRY8vLzUq XEeatAmgVAmjNK8+BGw6L2EqOslDAvI9CxQjwFqUW5mSWo8q8YxTkYlYR5F4JM4cnMK4G74BX QcUxAx/VOPQFyXEkiQkqqgVG/h19jq45O8T2JmTemZhytPH4l/WKdx3un3qPTPPbc267+b96M Q0w5JrO5vX+X2r8/bb7r5mSVklTe/2p/jxb5vlS4NzWa4eXfr80ihnFLz5dZdxd0Kph37fU85 36e6WGw5+fPS9+fWblqcSmD36sQ6aB7kjfLkvUk9q2Vf/Sx+aQmT2zdj1NKLMUZiYZazEXFiQ DEBHVD1QIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-7.tower-206.messagelabs.com!1506492870!110540381!1 X-Originating-IP: [209.85.192.177] 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 13096 invoked from network); 27 Sep 2017 06:14:31 -0000 Received: from mail-pf0-f177.google.com (HELO mail-pf0-f177.google.com) (209.85.192.177) by server-7.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:31 -0000 Received: by mail-pf0-f177.google.com with SMTP id x78so6744017pff.10 for ; Tue, 26 Sep 2017 23:14:31 -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=2cGA9GWQ2dcLrzuB4im3ko3qiqx5AgeGA+TPbfZsVTY=; b=ReMZhyhfeOuHC94OwmhcvlwiicnzxbJS1LajtmMx6ES4hV8L6FXYnCJ8FBekJCUIio Sf0ExfxPTYkOhDOiqKg/wKU1g5hTyvzQxJnKZRObihT2Wr8DPoFRBN4oxcf876AM1mwp yDGG4xX3MYsbu5cX/HoVBv4PiFF05fPhLNKSg= 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=2cGA9GWQ2dcLrzuB4im3ko3qiqx5AgeGA+TPbfZsVTY=; b=ED9Qa3qmhU+3GWUlPIZ7sJhionBR1+z+hj4K9VOp8XbDNU6knTpajeiOIwaAyf19iq BdyqEj2OGc9N2u2qjeA7IzPMIEOUR3Mr+w8aNT7GwPmZ1AaptrLA0VmnyKcvP2PhYFfC 3hXGmgulxVF7n4Ekn5TifGHy9XL7fhCIZ4evOjxgqYAeG6t4jcXcWa7S95wqCVX8QLmA D64tH8jp22koiQy+O4oqKN8M/IOV2w5fxFcz69aHmFEqRmjo1bM8zQPTice6tumbmvIo wWgBEA5gAMrDhyfu9USltfPbToYUrvB0IlaQwDMOz0uhyFJtG88anZIt6/o0AUQObie2 8ppg== X-Gm-Message-State: AHPjjUjOj5tM/E3t9K+jQLTUsTX+2BFUxRbdHR/DbSqIbMlHe7qdAm7y RnzOZTfxZU1nIHjss+tJ2DMWLcwVrrw= X-Google-Smtp-Source: AOwi7QBGe18m61vLKaGsRtQk5EUoIf0YV8SI6ppDijOnjadsQ63FRDTjhCzh3+nKXWmWRtDoTXtp+g== X-Received: by 10.101.69.194 with SMTP id m2mr358874pgr.20.1506492869864; Tue, 26 Sep 2017 23:14:29 -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.14.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:29 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:35 +0530 Message-Id: <1506492816-25954-27-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: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 26/27 v11] xen/arm: vpl011: Fix the slow early console SBSA UART output 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" The early console output uses pl011_early_write() to write data. This function waits for BUSY bit to get cleared before writing the next byte. In the SBSA UART emulation logic, the BUSY bit was set as soon one byte was written in the FIFO and it remained set until the FIFO was emptied. This meant that the output was delayed as each character needed the BUSY to get cleared. Since the SBSA UART is getting emulated in Xen using ring buffers, it ensures that once the data is enqueued in the FIFO, it will be received by xenconsole so it is safe to set the BUSY bit only when FIFO becomes full. This will ensure that pl011_early_write() is not delayed unduly to write the data. Signed-off-by: Bhupinder Thakur --- CC: Julien Grall CC: Andre Przywara CC: Stefano Stabellini xen/arch/arm/vpl011.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c index 56d9cbe..36794d8 100644 --- a/xen/arch/arm/vpl011.c +++ b/xen/arch/arm/vpl011.c @@ -157,9 +157,15 @@ static void vpl011_write_data(struct domain *d, uint8_t data) { vpl011->uartfr |= TXFF; vpl011->uartris &= ~TXI; - } - vpl011->uartfr |= BUSY; + /* + * This bit is set only when FIFO becomes full. This ensures that + * the SBSA UART driver can write the early console data as fast as + * possible, without waiting for the BUSY bit to get cleared before + * writing each byte. + */ + vpl011->uartfr |= BUSY; + } vpl011->uartfr &= ~TXFE; @@ -369,11 +375,16 @@ static void vpl011_data_avail(struct domain *d) { vpl011->uartfr &= ~TXFF; vpl011->uartris |= TXI; + + /* + * Clear the BUSY bit as soon as space becomes available + * so that the SBSA UART driver can start writing more data + * without any further delay. + */ + vpl011->uartfr &= ~BUSY; + if ( out_ring_qsize == 0 ) - { - vpl011->uartfr &= ~BUSY; vpl011->uartfr |= TXFE; - } } vpl011_update_interrupt_status(d); From patchwork Wed Sep 27 06:13:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114339 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665501qgf; Tue, 26 Sep 2017 23:17:09 -0700 (PDT) X-Received: by 10.107.1.16 with SMTP id 16mr472747iob.211.1506493029077; Tue, 26 Sep 2017 23:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493029; cv=none; d=google.com; s=arc-20160816; b=MQdKpZcm/zzsBf9cBhbhEtzIBL3osIgmqfa7w4vocItklaO/cMDXAM2187Xl7A/Xqe YT7THDcSMg1ktnqv9wPrjg0obo+KSP/ePkSI7xCLvUzmWcudryTwviAG0Rnenit9TRi1 TlpCXcLE//mKv+FDfpuW0i8H1ipIC6Sag9xf0IIWf3BGL0baQF80nxdbAQGWDD9Ze4Ya k3tEU0oGSK9F7TwUXKVTiWv8SiRLI8OpMemqHouq85RlPFss1X5a+USO1GTmzxMNAJhv fA5Yr++Jv+m3EwCcyrcLbwI4gK/DuT3sgS5GVIdKyKpXBGH6HSx4SOz7RbtPmjwKnxTv mW8A== 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=x80X3cVOF2GtV72izfuKrNXUD0dopJtWWYJ3ZCBIDco=; b=rUZZqi/NmgxJ2+X6ucNILbVcqo8ifgA8QXsy0+br/RegzSXZFKX+KBWV6rBMCRNuAS bJyi3A5elmmX47epYSYF4oqJpb6odPrKjcijUCB6cuwT1CadjbwyyxL4wFEp+RfBRSRY vvAuLylnN0Z2kzorpwv7usyxxADAo2MvH9l8MUCDhNtmCvqjEa7oGt76P75XOhb+FSxg FLWyEf0vB/z5UzyD9qg3LuNpOLOS6XhQZ/JijHwBpJ7nePaXgUaqYrPgOuPQfHFzB7UD T/2Iro3EG4NAaFgpHXm8Lk2+SfZlPK6bq2253RUQHt8Hbx6+MpXJkirkhyekqNQnbH7W rIiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HBO4JTgb; 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 206si8746736ioc.276.2017.09.26.23.17.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:09 -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=HBO4JTgb; 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 1dx5cB-0003ZZ-Sq; Wed, 27 Sep 2017 06:14:35 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5cA-0003Vr-JJ for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:34 +0000 Received: from [85.158.143.35] by server-6.bemta-6.messagelabs.com id 94/16-03423-9C14BC95; Wed, 27 Sep 2017 06:14:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRWlGSWpSXmKPExsVyMfTAOt2Tjqc jDc5d5LX4vmUykwOjx+EPV1gCGKNYM/OS8isSWDN2/BcuuGRdsezmApYGxtfaXYxcHEICMxgl Js69xwzisAjMY5a4dusXmCMh0M8qseXGbKYuRk4gJ0/iwI3lUHaaxM6de5kh7AqJdTd/s4DYQ gJaEkdPzWaFGLuCSeLvuT9ACQ4ONgETiVkdEiA1IgJKEvdWTQabwyxQL7Ht3C9GEFtYIF/i99 49rCA2i4CqxKPWd2A1vAI+Ev+nLmKB2CUncfNcJ9heTqD46f7bbBB7vSUurexnncAouICRYRW jRnFqUVlqka6RsV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRmDAMQDBDsY/8wMP MUpyMCmJ8tb8PxUpxJeUn1KZkVicEV9UmpNafIhRhoNDSYJ3nsPpSCHBotT01Iq0zBxg6MOkJ Th4lER4o0DSvMUFibnFmekQqVOMrhwX7lz6w8TxpfcGkDyw5xaQXHH9NpDsuHn3D5MQS15+Xq qUOG8VSLMASHNGaR7caFjcXmKUlRLmZQQ6VoinILUoN7MEVf4VozgHo5Iw712QKTyZeSVwF7w COo4J6LjeqSdAjitJREhJNTDys3T65h74bnb4tXmUVs/SxBcSf74t6XLSmHXnXmV2O+NsvxXL WFbEcUXNevLf+Eey5F3dH++mOkjlH2+fPnvK+mNpu9f8mPV7i/Ev4bNbG7/nSnR5GoYxv2O6X BDYsSP+xpm82asVds/iF45LnDnp/rKM76vi91gsuCPhbv/jVZl8sMubJodWJZbijERDLeai4k QAfISMMdYCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-3.tower-21.messagelabs.com!1506492871!81307899!1 X-Originating-IP: [209.85.192.174] 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 31974 invoked from network); 27 Sep 2017 06:14:32 -0000 Received: from mail-pf0-f174.google.com (HELO mail-pf0-f174.google.com) (209.85.192.174) by server-3.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:32 -0000 Received: by mail-pf0-f174.google.com with SMTP id z84so6755983pfi.2 for ; Tue, 26 Sep 2017 23:14:32 -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=ShLFdjyBwOXeMOQr3lQ1MFu6ReaYVbjCfilIir6inKk=; b=HBO4JTgbmHQptbKGVlhlh7HSLAmwQl/QmetJe8kK0QQfwj+xAJTtx/z8wv+iYIZIzG P5wiLMFHYtEDE3FAoelPVV9PF8LPZnTK9+9fEX3JyYfq/4pyLdYjPVIHd0ijuXgt+D2R YeR9Y3HMlSoND4vNe3bPCz5Ra1dpcA/pepwos= 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=ShLFdjyBwOXeMOQr3lQ1MFu6ReaYVbjCfilIir6inKk=; b=t2iDOzGOjSYC2QDJjUtsfWcPUJshx7/x4FssFgV/H7sd4RaTbpRoYfE06rGlZ6M4Yd ZhgzxwJyHBvVXFTbwZj3OY8AP+IwIdcIyhhL6MMCHOxHv7R+7hIjSqpmhhsdiLBRmrQI tQrea6LL1CLbONJemiJpQ4zzXaCwRh2iQHly8v51bZIufcGYoWofQzzfIdkfrz1CYaWM Evyp2ohz739mVUdM04sAE+9glhLF9l3GmssAoYBvO8bdAG7gA1Jj7jIj4/AiYsSj/3TB qTk1xR3JbiVGsZR8TvTy2K1ssS886HY/7lxHgtKZfDXErwc9JmoTk7QOFcUdnT4BrD5N EySg== X-Gm-Message-State: AHPjjUgmYZE4wqYUh4ebVL6AUlRQvmhQWFIPA8Q7/+z89zpHLKSihn5Z eRgER5Vth7tEif6fcGnWfvHpwHfw+v4= X-Google-Smtp-Source: AOwi7QDSeSYBQA/v/aVYo7QcrwIAUH17BDQh6BjviwIaXHJnufjzNgGMSdMTp5/oliviVPBLCpzRIQ== X-Received: by 10.98.68.206 with SMTP id m75mr335102pfi.163.1506492871288; Tue, 26 Sep 2017 23:14:31 -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.14.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:30 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:36 +0530 Message-Id: <1506492816-25954-28-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: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 27/27 v11] xen/arm: vpl011: Correct the logic for asserting/de-asserting SBSA UART TX interrupt 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 fixes the issue observed when pl011 patches were tested on the junos hardware by Andre/Julien. It was observed that when large output is generated such as on running 'find /', output was getting truncated intermittently due to OUT ring buffer getting full. This issue was due to the fact that the SBSA UART driver expects that when a TX interrupt is asserted then the FIFO queue should be atleast half empty and that it can write N bytes in the FIFO, where N is half the FIFO queue size, without the bytes getting dropped due to FIFO getting full. The SBSA UART emulation logic was asserting the TX interrupt as soon as any space became available in the FIFO and the SBSA UART driver tried to write more data (upto 16 bytes) in the FIFO expecting that there is enough space available leading to dropped bytes. The SBSA spec [1] does not specify when the TX interrupt should be asserted or de-asserted. Due to lack of clarity on the expected behavior, it is assumed for now that TX interrupt should be asserted only when the FIFO goes half empty. TBD: Once the SBSA spec is updated with the expected behavior, the implementation will be modified to align with the spec requirement. [1] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0183f/DDI0183.pdf Signed-off-by: Bhupinder Thakur --- CC: Julien Grall CC: Andre Przywara CC: Stefano Stabellini Changes since v8: - Used variables fifo_level/fifo_threshold for more clarity - Added a new macro SBSA_UART_FIFO_SIZE instead of using a magic number - Renamed ring_qsize variables to fifo_level for consistency xen/arch/arm/vpl011.c | 87 ++++++++++++++++++++++++++++++-------------- xen/include/asm-arm/vpl011.h | 2 + 2 files changed, 61 insertions(+), 28 deletions(-) diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c index 36794d8..1f97261 100644 --- a/xen/arch/arm/vpl011.c +++ b/xen/arch/arm/vpl011.c @@ -91,20 +91,24 @@ static uint8_t vpl011_read_data(struct domain *d) */ if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) > 0 ) { + unsigned int fifo_level; + data = intf->in[xencons_mask(in_cons, sizeof(intf->in))]; in_cons += 1; smp_mb(); intf->in_cons = in_cons; + + fifo_level = xencons_queued(in_prod, in_cons, sizeof(intf->in)); + + if ( fifo_level == 0 ) + { + vpl011->uartfr |= RXFE; + vpl011->uartris &= ~RXI; + } } else gprintk(XENLOG_ERR, "vpl011: Unexpected IN ring buffer empty\n"); - if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) == 0 ) - { - vpl011->uartfr |= RXFE; - vpl011->uartris &= ~RXI; - } - vpl011->uartfr &= ~RXFF; vpl011_update_interrupt_status(d); @@ -144,28 +148,41 @@ static void vpl011_write_data(struct domain *d, uint8_t data) if ( xencons_queued(out_prod, out_cons, sizeof(intf->out)) != sizeof (intf->out) ) { + unsigned int fifo_level, fifo_threshold; + intf->out[xencons_mask(out_prod, sizeof(intf->out))] = data; out_prod += 1; smp_wmb(); intf->out_prod = out_prod; - } - else - gprintk(XENLOG_ERR, "vpl011: Unexpected OUT ring buffer full\n"); - if ( xencons_queued(out_prod, out_cons, sizeof(intf->out)) == - sizeof (intf->out) ) - { - vpl011->uartfr |= TXFF; - vpl011->uartris &= ~TXI; + fifo_level = xencons_queued(out_prod, out_cons, sizeof(intf->out)); + + if ( fifo_level == sizeof (intf->out) ) + { + vpl011->uartfr |= TXFF; + + /* + * This bit is set only when FIFO becomes full. This ensures that + * the SBSA UART driver can write the early console data as fast as + * possible, without waiting for the BUSY bit to get cleared before + * writing each byte. + */ + vpl011->uartfr |= BUSY; + } /* - * This bit is set only when FIFO becomes full. This ensures that - * the SBSA UART driver can write the early console data as fast as - * possible, without waiting for the BUSY bit to get cleared before - * writing each byte. + * Clear the TXI bit if the fifo level exceeds fifo_size/2 mark which + * is the trigger level for asserting/de-assterting the TX interrupt. */ - vpl011->uartfr |= BUSY; + fifo_threshold = sizeof (intf->out) - SBSA_UART_FIFO_SIZE/2; + + if ( fifo_level <= fifo_threshold ) + vpl011->uartris |= TXI; + else + vpl011->uartris &= ~TXI; } + else + gprintk(XENLOG_ERR, "vpl011: Unexpected OUT ring buffer full\n"); vpl011->uartfr &= ~TXFE; @@ -342,7 +359,7 @@ static void vpl011_data_avail(struct domain *d) struct vpl011 *vpl011 = &d->arch.vpl011; struct xencons_interface *intf = vpl011->ring_buf; XENCONS_RING_IDX in_cons, in_prod, out_cons, out_prod; - XENCONS_RING_IDX in_ring_qsize, out_ring_qsize; + XENCONS_RING_IDX in_fifo_level, out_fifo_level; VPL011_LOCK(d, flags); @@ -353,37 +370,51 @@ static void vpl011_data_avail(struct domain *d) smp_rmb(); - in_ring_qsize = xencons_queued(in_prod, + in_fifo_level = xencons_queued(in_prod, in_cons, sizeof(intf->in)); - out_ring_qsize = xencons_queued(out_prod, + out_fifo_level = xencons_queued(out_prod, out_cons, sizeof(intf->out)); /* Update the uart rx state if the buffer is not empty. */ - if ( in_ring_qsize != 0 ) + if ( in_fifo_level != 0 ) { vpl011->uartfr &= ~RXFE; - if ( in_ring_qsize == sizeof(intf->in) ) + + if ( in_fifo_level == sizeof(intf->in) ) vpl011->uartfr |= RXFF; + vpl011->uartris |= RXI; } /* Update the uart tx state if the buffer is not full. */ - if ( out_ring_qsize != sizeof(intf->out) ) + if ( out_fifo_level != sizeof(intf->out) ) { + unsigned int out_fifo_threshold; + vpl011->uartfr &= ~TXFF; - vpl011->uartris |= TXI; /* - * Clear the BUSY bit as soon as space becomes available + * Clear the BUSY bit as soon as space becomes avaliable * so that the SBSA UART driver can start writing more data * without any further delay. */ vpl011->uartfr &= ~BUSY; - if ( out_ring_qsize == 0 ) + /* + * Set the TXI bit only when there is space for fifo_size/2 bytes which + * is the trigger level for asserting/de-assterting the TX interrupt. + */ + out_fifo_threshold = sizeof(intf->out) - SBSA_UART_FIFO_SIZE/2; + + if ( out_fifo_level <= out_fifo_threshold ) + vpl011->uartris |= TXI; + else + vpl011->uartris &= ~TXI; + + if ( out_fifo_level == 0 ) vpl011->uartfr |= TXFE; } diff --git a/xen/include/asm-arm/vpl011.h b/xen/include/asm-arm/vpl011.h index 1b583da..db95ff8 100644 --- a/xen/include/asm-arm/vpl011.h +++ b/xen/include/asm-arm/vpl011.h @@ -28,6 +28,8 @@ #define VPL011_LOCK(d,flags) spin_lock_irqsave(&(d)->arch.vpl011.lock, flags) #define VPL011_UNLOCK(d,flags) spin_unlock_irqrestore(&(d)->arch.vpl011.lock, flags) +#define SBSA_UART_FIFO_SIZE 32 + struct vpl011 { void *ring_buf; struct page_info *ring_page;