From patchwork Mon Sep 18 10:31:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112883 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501090qgf; Mon, 18 Sep 2017 03:34:47 -0700 (PDT) X-Received: by 10.36.10.8 with SMTP id 8mr7362725itw.112.1505730887180; Mon, 18 Sep 2017 03:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730887; cv=none; d=google.com; s=arc-20160816; b=R8Pb/MM32Of6Vw5sJeA/0Hn94m2sgDvy8YSKMwzv+Yixm1RyR8+9p6LMeAqk5gWSMh 2Zdb5jLDsE9wqxYgGt6uhkBTSP0kEJ/JrKuS/y2NzmCMLw/Jo7XGsEoD+FQltRscom1p /26A7f/Z2ar8ySqIlx/EMyiFLdK81Gyi6mMM0bj5nHiHEB4kT4y9rTWRxtapwTce+cOG +0AqO397v/icGBrVhd0/wt3kCfKsP+TT5naHo2P7R6uFbEHT2MnvnUEA8JhJCgftXlhp 39B5jtyFXlBaj2eR6zHJEPs+MjbgyzTC+dUErvWqACvijjUHeQuJ9gWH0P9laMfEaL0V e5sQ== 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=IxKPDvYb+1OabrIniZPQp+sl1Vg+m4VSWdbQZki1zo0=; b=bE8fTg0EooKU5Lt7tRODts2+5NBaciQzchbU03hBP7WHA4Fv/wkPQty2jhmy/KvoCf RE6cTPfXin7q+Zo73KAf1zeeUmiHyITtiJ7uEZy72ndVlsOCHZ9OOdisW9brXvMwUnjY 3oR+nkLNuigBLWZZtwe1vfM1zT2PMMaCiFJbUn5jMRkc+jOIu1BE6fXCHrgTMjKXjBeB qvoUKOA2KKv/OLv9FX22Nuu/2G81t3HWGRhKKyW/VvqOR2f2kaJQcwwIjwqRonCHhbxQ DYWlDqjP8Z2rMOyGE61iX3AXp8mHpT14/r6aHz09gRxenG0gR3aGf5/aIP1aI9Cy1VXe yu1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GVvTav4B; 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 o6si5408594iof.95.2017.09.18.03.34.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:47 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GVvTav4B; 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 1dttLn-0001Z7-OV; Mon, 18 Sep 2017 10:32:27 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttLm-0001Yv-65 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:26 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 66/FF-02048-9B0AFB95; Mon, 18 Sep 2017 10:32:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTAVt3tC/Z HGkz7YGbxfctkJgdGj8MfrrAEMEaxZuYl5VcksGY8WzCdsaBTsGLV7JPsDYyv+boYuTiEBKYz SvQd3cDUxcjJwSIwj1ni1AQnkISEQD+rxNy2pywgCQmBNIklV7sYYey9N6+zQtiVEvtn9bOB2 EICWhJHT81mhZi6g0nizf6tQFM5ONgETCRmdUiA1IgIKEncWzWZCaSGWeACo8TMv8/BmoUFki S6p3SxQFyhKtHW1scG0ssr4C1xoa8KYpecxM1zncwgNqeAj8T59Q9YIfZ6S8z7dYVxAqPgAka GVYwaxalFZalFukZmeklFmekZJbmJmTm6hgbGermpxcWJ6ak5iUnFesn5uZsYgQFXz8DAuIOx Ya/fIUZJDiYlUV7RyP2RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4380HygkWpaanVqRl5gBDH yYtwcGjJMK7DiTNW1yQmFucmQ6ROsVoz3HhzqU/TBzHNl0Gkgf23AKSHTfv/mESYsnLz0uVEo eYKgDSllGaBzcUFquXGGWlhHkZGRgYhHgKUotyM0tQ5V8xinMwKgnzLgOZwpOZVwK3+xXQWUx AZ7Xs2ANyVkkiQkqqgXHrdcfIPRpbp58P98wsnfF2X+SyTStsExoYGpoWFcot+j37RmzDFLWJ Ya2p1ek/Z5/+JM5j/vb8//3mM32XzzRpq+A9fnPixt+tppeCqiQzHuQ/ufjhn5+D9JNF3vMfC Gd+yv7n+bLRWHJayrnFRZV1du/rpu/wT2Tf7fD5UsemE54XDd5qSoYpsRRnJBpqMRcVJwIAnD qc0dACAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-7.tower-31.messagelabs.com!1505730742!107735996!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 48901 invoked from network); 18 Sep 2017 10:32:23 -0000 Received: from mail-pf0-f181.google.com (HELO mail-pf0-f181.google.com) (209.85.192.181) by server-7.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:23 -0000 Received: by mail-pf0-f181.google.com with SMTP id l188so29775pfc.6 for ; Mon, 18 Sep 2017 03:32: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=kHjNQsBYLTEcMCSCGNjE7lavT4ilQV2qZ4hWRmdbIA8=; b=GVvTav4BMPYTtifQHDgHlzLAt+0y2Hy5rkI7HwVISWoipWHdgZbwXEUL3IGZblzcLM WQolRGHgkOMwxSI7SoPHR4GZoyirYg1zs68b89D4iuQZaAKpp54f40WARZ1pvNd4wNVn cBDtCQSrpsHHK/2hZUDmYn9ALrynHLRv1le18= 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=kHjNQsBYLTEcMCSCGNjE7lavT4ilQV2qZ4hWRmdbIA8=; b=lm2qihaEd2qe7txWtC8iGB3muXm5NQjIFip2fVzCZ5UxxL33YT35TZUsQl1Eus6zuJ h7gYLYoeTZLng2Nz6p7Irxe9iguUbctz4q7ESlhl2aZ5h5Ohtc8YSOkxxHaEQJfYx9UO OVLNLS6fb0N/+Z9VgTLlN6KOVv/JvIpdDtnG2d5CctLetj8V9Zky+B/AHLim8YCQ90Il WGqZ6YVFjwS6rPBabXwUmtt4LP8418kZQbk/8/cLyxFY4qS8LSmzV5vR3ou8qndH9iP/ DDN4Gq0szwyK5EsBUxHSYj1dXeMR2FLzedCPhAuRr1g2BTlutecmt3YK5zAaFzqJ6xcF GFSA== X-Gm-Message-State: AHPjjUitz/8g4u62k9w8InWm/cCdWSiYVlGWMx+FypR/FmlntvSZrrLe iv0NbvsC1ZRkJcVsqLlBPQ== X-Google-Smtp-Source: ADKCNb6UkpSTqlfM5qO3OeOwNLCdj8usaaaP12FuWcqxlmK2cHwt4xLypcoisetzpcnFoaY9hVBLMg== X-Received: by 10.84.238.196 with SMTP id l4mr35411418pln.63.1505730742113; Mon, 18 Sep 2017 03:32:22 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:21 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:45 +0530 Message-Id: <1505730731-10947-2-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 01/27 v9] 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 --- CC: Ian Jackson CC: Wei Liu CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Julien Grall 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/public/io/console.h | 4 ++++ 2 files changed, 5 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/public/io/console.h b/xen/include/public/io/console.h index e2cd97f..5e45e1c 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,8 @@ struct xencons_interface { XENCONS_RING_IDX out_cons, out_prod; }; +DEFINE_XEN_FLEX_RING(xencons); + #endif /* __XEN_PUBLIC_IO_CONSOLE_H__ */ /* From patchwork Mon Sep 18 10:31:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112878 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501022qgf; Mon, 18 Sep 2017 03:34:42 -0700 (PDT) X-Received: by 10.107.189.129 with SMTP id n123mr2198063iof.48.1505730882865; Mon, 18 Sep 2017 03:34:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730882; cv=none; d=google.com; s=arc-20160816; b=UpWVV0n2poTncBDD4aIGwbmX2HUHXOUAITZPrPzNsSatRcUI8G3YUldFx0pcECdjU6 sjcncluXgjzU6vbKKfd0778Y83PcmoG/VX3NrRH0rWsP8315ygn/8sLz/PclXY4t6FxB YfFdX8LPvQgNJNS9CfovG4Rnv3IhqX7b0AAAJfJVU5U3WUj4tqKSHmX8L/CUh650+pBn OcIz75pPNU1CEa7RtAc+mRAE10q3KbCd0Eg8pjLbIsh7MglSqewhAxOoUF9kcHdxfBSA yLGvH3IgsUpTFX/WWEhNOpw1NvnNBzQYvnI27F5m8w4RRU77KYfU3JYIhKXsOAw5mBYI XRSQ== 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=/ZNcPKOp7iHP/rOsoBWoEjS7GHxFbVG1NC/tHmpY5dk=; b=ioYasiuoH6keZmLGwqlDLaciJDfEK14Bw8F67dQWPVbkNO7yA7f31qDWcKpxAGqDrV yzRQ9oIdsEH/YAmKHF3yWHQXa4fF9Gwq6uCQ08ckDUwdSI3J26HMzzztwjeViUoUxIY1 sO68k9m6/g7LV/byCQ/r7OhoN4nVzGpXJ3aoHruWWdPPuCCFUrC8kX3QZZd+Lymp5hbs WG3JWoK0eTnaiSvGzehHf5tQC6Bckya5idVB3+/axzFh98xU8C7a3cR68TSOAT2UyBbM iz6d06Qf/Uyx4maLDAwUiMI9/6yTAMjvc5dyvdV5kds6Q6a6eC51o3ykO2q4gXjwvDN5 v8AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TPDM/ncO; 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 y185si4310016itg.3.2017.09.18.03.34.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34: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=TPDM/ncO; 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 1dttLq-0001aJ-9S; Mon, 18 Sep 2017 10:32:30 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttLp-0001ZU-0J for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:29 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 44/53-03422-CB0AFB95; Mon, 18 Sep 2017 10:32:28 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNIsWRWlGSWpSXmKPExsVyMfTAat3dC/Z HGlydKWjxfctkJgdGj8MfrrAEMEaxZuYl5VcksGa8fdDJXrBtOWPFsfmzWBsYlzcwdjFycQgJ zGCU6Or+xgbisAjMY5a4NfM/C4gjIdDPKnH6ziamLkZOICdNYurRXmYYe8+lH1B2pcSVgz1gN UICWhJHT81mhRi7g0ni2K8pQAkODjYBE4lZHRIgNSICShL3Vk0Gq2cWqJdYtGkbC4gtLOAp8e rJCTCbRUBVYuayN+wgNq+At0RnywUWiF1yEjfPdYLt5RTwkTi//gErxF5viXm/rjBOYBRcwMi wilG9OLWoLLVI11wvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMw6BiAYAfjzMv+ hxglOZiURHlFI/dHCvEl5adUZiQWZ8QXleakFh9ilOHgUJLgfTcfKCdYlJqeWpGWmQMMf5i0B AePkgjvOpA0b3FBYm5xZjpE6hSjN8eFO5f+MHEcmHAFRO65BSQ7bt4FkpvA5IbvD/4wCbHk5e elSolDbBAAGZFRmge3ABbHlxhlpYR5GYFOFuIpSC3KzSxBlX/FKM7BqCTMKwdMCkI8mXklcHe 8AjqRCejElh17QE4sSURISTUw+tdkhnGI8R5/1zxhf+YkhnxdWQHnL80vo0JFZM+dms5nI9YX HTW/p/dIUsXdMvuSE7Xvm+R6OcqqLucrikTrzU7/1lP+2LPw+/uj0s6f4kuYX+9jcr08uUzD0 ymxdIvfm9T3yZIL1Ys2s19zcH2xZd7BHKHNc06uOLbAUtxOZ24QV0GuJocSS3FGoqEWc1FxIg Cm0RHU3gIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-21.messagelabs.com!1505730745!80232249!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 41362 invoked from network); 18 Sep 2017 10:32:26 -0000 Received: from mail-pf0-f171.google.com (HELO mail-pf0-f171.google.com) (209.85.192.171) by server-11.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:26 -0000 Received: by mail-pf0-f171.google.com with SMTP id d187so24518pfg.11 for ; Mon, 18 Sep 2017 03:32:26 -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=YQTHoaxGMfdKPKC4AzDYWcSvsAdX1ejQhr3vvw9s0r8=; b=TPDM/ncO7f7T0qrVq9Hukn1x0tFJLgzvMz/uG7LgxwANN7xdkIqyRL5UeYJTxr1Rj5 q6pdFWa7FUgxuuC5ZdgPxmiOBayimiaEauN/hpt8J0NVS4biDd5taRPEeTwYwO7BeJEO 8/hoDoVLobztsBiCr2QFOg1PQ4Zt48Xxf1GgY= 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=YQTHoaxGMfdKPKC4AzDYWcSvsAdX1ejQhr3vvw9s0r8=; b=Qts7DIdQ+MKbDLSJ8mIf+Dmja2jyNR80BGU0TtWr6VEsSqeERG8TgsmRkAcig77dCE zkh1KQWS2BCKrYO3PAy9OeAU/X0Br93q7H3/ZDXWPeFyTHM1LORvv0NKS1YQhkLjNZDw IzFvjksSncRuJIOdURbU4uW+zTHe4gg0Glw6aH1MmgafCbl0IBbkH1uYxlD6aFRChcGl nFc/fd6rAMwYsJnT8naxhzVDQuYqIqamX8SpA3v5QsO6X291juK8cE0pkJYIqjARldjH 8SswxQVUI9kB1tInt1p9EdhWytlAw3TYSdy0TUQrWxo0J3HzqQlcTGvoKqBX8xM/KnRz Cs5Q== X-Gm-Message-State: AHPjjUgIHRpdzdoZM/MA5UEK5lVoFpjp98MOjwL7a9NUKD6YqTw0zqmh 1/VUnSE96IV23AE/vRyyqw== X-Google-Smtp-Source: AOwi7QCreCvJL+qaoBEDaKYv2t4w54GG9TpGY1UaHX5kFzN1pKKrmWc3t+9VZ+gRRNN6Z0rZ0LkLAw== X-Received: by 10.159.198.6 with SMTP id f6mr11734398plo.160.1505730744977; Mon, 18 Sep 2017 03:32:24 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:24 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:46 +0530 Message-Id: <1505730731-10947-3-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 02/27 v9] 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 282d2c2..3a381ee 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -51,6 +51,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 8dfc1d1..1a1145d 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 Mon Sep 18 10:31:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112873 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3500927qgf; Mon, 18 Sep 2017 03:34:35 -0700 (PDT) X-Received: by 10.107.4.207 with SMTP id 198mr9186825ioe.163.1505730875628; Mon, 18 Sep 2017 03:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730875; cv=none; d=google.com; s=arc-20160816; b=M5BvIUWlQTXfrXCoopAZTDpBxojhCEAW4weErkS5pmPzpi9wmGGsZILOki8wtYPdv8 sIwORTHswraIbpJc75ilBnCqUybJD+7MLpOoqIgb2evvfy7mB3ArRRrMj+aBESgjYPF4 viQr+/EXPyElOmA/4Q8sI2Tl9rqmpesbr12OgNShidbA1gVe0pcAJMY+8LBF9NhXsyHR +1X8yvlwAPGT4GH3+1ta+YP0jBMEr7ogbhc6O2XlTdyxgBfjt02s7PwDPK57/fOqJMnw rGQXRsfpy81aEoyBtNAW/LlINJhOvj7ldOezI1JHIBBL2YP3+LwFGJef7+Sfw+w8sxFD +Lfg== 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=1IuzFyJbl0QFe8Bll2d4LTs+Vul9bhA4x1wUSkaT19WtqYFMPg8l1Xu9j1XbZVIFzG LidclQlrdOlffQ3bmyM7OmUJxw+2DLsZfdKrSzbFC4C86/NBUUQ53yMKZwKWAbSBgAN6 Tahccq+RYGL42GOtJ3xgHSrtaUymX+dAFw6dlAZ379hJH3KZVT+rdvsjbmtcbv5Duyvq E40J/KNU4rwG8z+P1YXHLB7CEjXJmvYSCqQ43udgkargQQ/DIJc5sqeSmRqj0KP6b9pt rycnwD5ikSVSywyvpbqDCuouyKRFPgES/+OC4ucTtKlaT9DjvhxiqTTBvP2BRqQcBJTA 3Xjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TYLrvL3c; 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 e16si4343381itb.200.2017.09.18.03.34.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:35 -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=TYLrvL3c; 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 1dttLu-0001d6-Rh; Mon, 18 Sep 2017 10:32: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 1dttLt-0001bm-At for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:33 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id A7/21-27708-0C0AFB95; Mon, 18 Sep 2017 10:32:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRWlGSWpSXmKPExsXiVRusp7t3wf5 Ig/YTFhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bvGw3sBa8kKw5fWMLWwHhHtIuRi0NIYAqj xKb7E5lBHBaBecwSR9ceY+xi5OSQEOhnlXj6IxPCTpN4vOsjWxcjB5j97LI4RLhK4t3WFhYQW 0hAS+LoqdmsEEN3MElcmn6WBaSeTcBEYlaHBEiNiICSxL1Vk5lAapgF5jNKNE3qZQNJCAtESM yYtoUVxGYRUJW49bgJ7AZeAW+Jrj2NrBDL5CRunutkBrE5BXwkzq9/wAqx2Fti3q8rjBMYBRc wMqxi1ChOLSpLLdI1NNdLKspMzyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAgMOAYg2MF4 8bTnIUZJDiYlUV7RyP2RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4V88HygkWpaanVqRl5gBDH yYtwcGjJMK7DiTNW1yQmFucmQ6ROsVozLFvz60/TBwdN+/+YRJiycvPS5US560DKRUAKc0ozY MbBIvJS4yyUsK8jECnCfEUpBblZpagyr9iFOdgVBLmXQYyhSczrwRu3yugU5iATmnZsQfklJJ EhJRUA6NjTtnqDxsXdbzIild7f/hmsZjqtFebTzFlBHLrnAt9euGUyScpl5l81hXfZrw/I3rh juD/sGMBlZUxnbNK1u76PZ1BKstk+k42h9p5Xhe0v/o4zNYqcYztMd4+t37eg43tB8V9tCdlc W4ROzJpnufzXeJp27j+vq0ru86y1k5Daech+7LuzrdKLMUZiYZazEXFiQDAXFLdxAIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-15.tower-206.messagelabs.com!1505730748!98014943!1 X-Originating-IP: [74.125.83.46] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25858 invoked from network); 18 Sep 2017 10:32:29 -0000 Received: from mail-pg0-f46.google.com (HELO mail-pg0-f46.google.com) (74.125.83.46) by server-15.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:29 -0000 Received: by mail-pg0-f46.google.com with SMTP id 7so22323pgd.13 for ; Mon, 18 Sep 2017 03:32:29 -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=TYLrvL3cWtg6BfqLUvKVR2OMXb+9bKwmwgvQM2t7/A+qlDp0a1/UsIzqFrPfvHOmpT KwV1wxjLHgAuUuSzmG77UkAOHpB2cRqcYiRFHZGl2MbVDsLz5JXU9HXsZ/jBXFfgtS3F G8zWhTn2Ld54FGWySTBdKrljfB2qXru4eizkA= 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=Gyi+M5izpLavEPgWhnZlel+kB+JivzC6EOungFhcuL83mIDLKRp2qWC+omYcIjW19h uL1kXB02fmYN8EfF952QbG6NWT+4sasUMqIXmucfejNXCB3n6oM8FVVY3qvSSADTJ9Ag 0y62t+zuCi8SzI0dK060SM+aeWjK1RmhGin5Ip87Y2DOQdF2M1ttfsKYHNFbYjutyQfF mGL0T+JRvd/RjipIK2/lAE1lSwz8n8TdRIo2KPn4UMXD46M0EXR8VNgq61SGU7UBPPym VAIaSHahOHc69Vi4op56ETOOFmuAQKqRHX0lK0KmM6WlhzHFySm4nls5EE0Uw7i4psD+ rkyw== X-Gm-Message-State: AHPjjUiqBfE8CfeuWltvoaAELVyo9Eqrn8mkLZsP1cXxmMUhueJ6OOac c649CDG379Dj7fOZ9l7UQQ== X-Google-Smtp-Source: ADKCNb5SLJWo93rMCgP9HQyycMrgW/FrzxQCm4Y6Yu9Uec3VjH6yqjBtnQgNY8b3OhPGiAFwoOvr8Q== X-Received: by 10.99.160.100 with SMTP id u36mr31934714pgn.22.1505730747732; Mon, 18 Sep 2017 03:32:27 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:27 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:47 +0530 Message-Id: <1505730731-10947-4-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 03/27 v9] 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 Mon Sep 18 10:31:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112880 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501065qgf; Mon, 18 Sep 2017 03:34:45 -0700 (PDT) X-Received: by 10.36.2.204 with SMTP id 195mr15630752itu.35.1505730885687; Mon, 18 Sep 2017 03:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730885; cv=none; d=google.com; s=arc-20160816; b=JEDFlk2PjZ/FjtDrxqOQ0MVVsUUqll0n20Oqa8YxlciClBX2y04Ujm0dwlc6cVhWYO y8Z/k7NUujvvf6xgU8EY4Zq3jA200D6805zypfvrLrI6kaejRr1PFpDmJ6b+2OJMHbbH k3RmFbiMl0+o5AhLlVKt1/gwPGO6y42Pd1d7O+UgM5D1V7P3TSRkN+Unpl5rCP0YpTrW ypRAIYkNrVfrP1h5ZbTT1QKIYbrrm9Ezv/DZtArb4SQ28T+NFZkyTytRwg1Nb139EKm7 jcd/dlLSSlAj3jTYNY0wlEXiOH3hJ3NmDkFRxiXop7OkPpWSp/lZfZCJbFM/A14xhQFo Dyyw== 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=O+oBwHQ33Jd8/GMgkAPDx+ojvzRxx3lXxGI8dDDCH2I=; b=ai1Zab/0nSyXKRRxaUe0hpxKOl1lP4JcdgopsoB5k+SnRSxh2rOtGNgkVMX2q9/TVx BdwDrLhCNdWlCHb5FONAutVVaV8eCnJFXPVKh/P719/VC76uY3HwzmxZtyuy1OFyM2A2 kQ6Qt5FwIoCZ24gwKG9Sc5EVF3g4wvSTB6f0wXWUaaHG9j8wPRaI+4iAAlNCHnrwrKRc 35k2aO9YbGGDFOa81PnHJw9G1X5bOazddz6oKdiVn5dfvMxhQ/pmfKk9IBmaUu2dJ29i KBD6OkPXZueijymmJkKAMUoGfU78083EHohyvOv3lVsEydk6EzLx8k0FDDdpGlk4bDnh vXVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e9UmXPkP; 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 i62si5499480ioa.45.2017.09.18.03.34.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:45 -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=e9UmXPkP; 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 1dttLy-0001gO-9t; Mon, 18 Sep 2017 10:32:38 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttLx-0001ef-3N for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:37 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id D2/DF-00743-4C0AFB95; Mon, 18 Sep 2017 10:32:36 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsXiVRusrXtgwf5 Igx3TNC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxT/esYCzaYVLydeYSxgfGcZhcjJ4eQwDRG id1b/bsYuThYBOYxS0w4PJMZJCEh0M8q8eAMP4SdJvGoYyYbjP3/72UmCLtKYsmrRUwQg7Qkj p6azQoySEhgB5PEq4eTGbsYOTjYBEwkZnVIgNSICChJ3Fs1mQmkhllgPqNE06ResKHCAp4Sx9 ZMAlvMIqAq8XE3RJxXwFti0qZljBDL5CRunusEq+EU8JE4v/4BK8Rib4l5v64wTmAUXMDIsIp RvTi1qCy1SNdSL6koMz2jJDcxM0fX0MBULze1uDgxPTUnMalYLzk/dxMjMNwYgGAH49pW50OM khxMSqK8opH7I4X4kvJTKjMSizPii0pzUosPMcpwcChJ8K6eD5QTLEpNT61Iy8wBBj5MWoKDR 0mEdx1Imre4IDG3ODMdInWK0ZLj2KbLf5g49u25BSQ7bt79wyTEkpeflyolzlsH0iAA0pBRmg c3DhadlxhlpYR5GYEOFOIpSC3KzSxBlX/FKM7BqCTM+whkCk9mXgnc1ldABzEBHdSyYw/IQSW JCCmpBsaimeKGAZ/Zfe8JPzn7vtzep55louQ1n8gNkRNNw5dsv1jyLP/u8StmQi+v/Vn19/H8 1AfXmQ+VOwbysiw7xne54qXinJOuT4KmrjwgaMolw1TTJHV+2ZL6r8/iMsTecBXsX2fTsL83Z 5vM/5uq/2I+5NT/al6gcv306WcdPjNT5RlDJm2/4JmsxFKckWioxVxUnAgADAPQQskCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-7.tower-206.messagelabs.com!1505730751!109152286!1 X-Originating-IP: [74.125.83.43] 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 52146 invoked from network); 18 Sep 2017 10:32:32 -0000 Received: from mail-pg0-f43.google.com (HELO mail-pg0-f43.google.com) (74.125.83.43) by server-7.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:32 -0000 Received: by mail-pg0-f43.google.com with SMTP id k193so27395pgc.8 for ; Mon, 18 Sep 2017 03:32: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=6Sv3zXfkR3omwBhjdz2GaCKZZGwz+PiMk3NDVeEtWV0=; b=e9UmXPkP5nvY5vRKdvVn+agvZcoCEhwfWl+CFYfjmSWgYSLHLEnI1IzlBvKp2c32RA xkL9YKxuzE630hqNCTtLsubY+qPUD4iR6dlBrKr93tcYSBk5wvuHSeO9C53zmUPyo74t YqXIGUbxwFhA7cJEqq8N5eViWc7swFlqQejEo= 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=6Sv3zXfkR3omwBhjdz2GaCKZZGwz+PiMk3NDVeEtWV0=; b=XT40XzTg+MXOC5VRMuJWaEgNtKgjLA9kitXpsBxFeEF94eZ4J0FCq9H8FJcFIFbMmG gvSbWL3gFIASbjmrX4qZIFRo7204MVLGLLNOLn86B14iMDhCHJf06h7CT5xsKHL0BfIi o4gkWSac8V1YItnJQQD4AU5d3EJXQrIIXxCpAgmnfD2QDb060YEigrMKOZFMOiwTvixX yLWI0v7hsnjmawldagjstL8fWYMMt405tKMo6jANA51vWItn1pePxDApaBOlTbTIOvKo z/ZVc+PUtbK3xs3PY3IpL0TWaNV22mPSq3UWB0my4obu0uFuQSDcEoUag67iZngKWgEv D05Q== X-Gm-Message-State: AHPjjUgE/M5bHEObQyVvJxsWNT8OCJHjCH8hY8SdSLRd/xBuZqqDalOU ErC7RC550+sELVE/pKVHsw== X-Google-Smtp-Source: ADKCNb4itgoUfFdFUyVpEK/6zOtRIOenlAYdUqaBIsEkTuNGLcLNPKzGhIhTsMFxwlgGDBVSi4GxIA== X-Received: by 10.101.68.130 with SMTP id l2mr31937167pgq.346.1505730750742; Mon, 18 Sep 2017 03:32:30 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:30 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:48 +0530 Message-Id: <1505730731-10947-5-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 04/27 v9] 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 91408b4..3b54e80 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 446e766..853be15 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 7247509..6b38453 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 173d70a..87e025a 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 5cfc7e8..0583b34 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 02ddd2e..239460b 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -918,6 +918,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 Mon Sep 18 10:31:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112876 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3500969qgf; Mon, 18 Sep 2017 03:34:38 -0700 (PDT) X-Received: by 10.36.80.194 with SMTP id m185mr15486586itb.127.1505730878545; Mon, 18 Sep 2017 03:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730878; cv=none; d=google.com; s=arc-20160816; b=zlLgX+QjlyCAJeqPquEbdxaSzHhXJvnUz0r/sM43pJUXTTZYYBE1OHZ8OBvI0d2umz GRAxhTpFtuFKxIYDE154J72KX+uKSb5YrRYU7yN1tkRAkC1al0QxoRNnz8L7YsjuzZ74 sbOedbgpSi1yKgCSqg89wMVJlpcBubeupJagNVrkpU2abV7vK/YKlV1R1OVn9FAsTSfk XsAjxMkYkXVUTDibjlZg4bc1DSFhrgVehakbEPBX+XYyYXtHjE5H9KyfnHHMxV+FrNOd eqxARKrU90OOlanpqybmw8bxomnHArVUF9opb0GKDIm7aZwllaY0x9CPYrum75MspJ3H di7A== 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=mV9Hngypj1Q3cb4StM0ZIyrwNRJbKGcsu6meTYrpf88=; b=Mk26rTSXy7F7d1TM2KwgPq03PjtCsYqiFlwIcl8qDFmb44s8fSCj8rU59PXoCeXFFw 9jkRbG9storvX0FLetAyk3p8g3tyP7nThPSlbT5/xU7vdHoo8NnFd6OBQZJTbH0lLCQu p5uwnbdcX92lX+QZ4Cj6P3UofsjXujnfwVwmIwU8W2GxukoH8lGuC3V4iT9GniTwhnQ+ te0VJncQSMNfq7H7HLIPax+xmu0wVPY5aTKKzggrQxZV12cTLewnyZYZKGFPXO3GNCx2 pBDJVlKV3G3kUfJI+4ImdmN37+F2vjXQBJTM7KzUjylMrpLBq1M11FdoCYd6yXcdlBRY tOjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KDbCMuGt; 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 y204si5638532ioy.118.2017.09.18.03.34.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:38 -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=KDbCMuGt; 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 1dttLx-0001eu-2s; Mon, 18 Sep 2017 10:32:37 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttLv-0001dp-V9 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:36 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id 36/FD-03454-3C0AFB95; Mon, 18 Sep 2017 10:32:35 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsXiVRtsrHtowf5 Ig6nzjCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owFu7rZCy6xVxw+Oou5gfE2WxcjF4eQwDRG ief9O1hBHBaBecwSm+cfZAdxJAT6WSVmd39i6mLkBHLSJA49boKzH59cxwphV0kcWjoJzBYS0 JI4emo2K8TYHUwS549fAdrBwcEmYCIxq0MCpEZEQEni3qrJYHOYBUIlpv59wAJiCwtkSTy+Mo kNxGYRUJV4dvEjO4jNK+AtsfXQThaIXXISN891MoPYnAI+EufXP4Da6y0x79cVxgmMggsYGVY xahSnFpWlFukaG+klFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFesl5+duYgSGHAMQ7GA8vS7w EKMkB5OSKK9o5P5IIb6k/JTKjMTijPii0pzU4kOMMhwcShK8q+cD5QSLUtNTK9Iyc4DBD5OW4 OBREuFdB5LmLS5IzC3OTIdInWK05Ljx8PofJo59e24ByY6bd/8wCbHk5eelSonz1oE0CIA0ZJ TmwY2DReglRlkpYV5GoAOFeApSi3IzS1DlXzGKczAqCfMuA5nCk5lXArf1FdBBTEAHtezYA3J QSSJCSqqBsdaF+/PB+zxsb3tNn97crss90Z016V6z3SuRbSKJ6g/ucC5J/dz/94FB4EMW/6Jd PbGeZhue1Wg9X9Ujupura/YxX0nfrb8TDOsNJmjucVuzW0LgZu6+Yv9LEzjm9523qc1l89rko 1uc0LJLxiz2mMevi7kX9J8nrTOt0lS6uSGi6ZbUNP5fSizFGYmGWsxFxYkAw7kh1MsCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-21.messagelabs.com!1505730753!80232278!1 X-Originating-IP: [74.125.83.51] 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 44617 invoked from network); 18 Sep 2017 10:32:34 -0000 Received: from mail-pg0-f51.google.com (HELO mail-pg0-f51.google.com) (74.125.83.51) by server-11.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:34 -0000 Received: by mail-pg0-f51.google.com with SMTP id i130so34103pgc.3 for ; Mon, 18 Sep 2017 03:32:34 -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=nFTNxZDC2qp97HE4gxLCge8kPmvOQujiAaRxzy3SoOk=; b=KDbCMuGtO97hXKg8nuie6E/M5wWnGUHcx8XirXUVUl2M7fktGDmvOmfRAy9KPLfFIK LSjQgtohztPn6WZkr5ZsBmdYweJwL0BkPfxht/Y5F5z0GSbp+M5L/lK7inxgqU0/Ylf7 eyCzBKArdGTFGIATW81x6eKwyM2sbRkpsNjPs= 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=nFTNxZDC2qp97HE4gxLCge8kPmvOQujiAaRxzy3SoOk=; b=Q9y1H9AwvJASRs3tKXSDITu/yyRSAAiwyBsjVBtsN48Y05ayncLn6kARNJfBS7mUyA AMDPGWAiBWhBFJFaKwhuLpZHOKrH91boTPM8YyWEyk2YXCpNePpcBk1ONKHb2sQuEQtP Eucga0Q6glYQINrGe5pWT3yDwEYjbdMrXL+hPycz4Z3fj+KFOBRLUlVDnUChfYK3j1Hi VE4q+xDrXhBrWx3VY7Clmjjq00FpyMIDsi50XnmcgnS7tmUX/OIL0wVtO1k5i9154c7r NxGfO3lX6V31b5gy9cx4HRQHY8sjw2gdQVfJ+9Je01eY+PpLo+fDwAdBErCxnBs6vGhF 5I1A== X-Gm-Message-State: AHPjjUg0g5gdWAhWntmfLu8yDqPqjvrn37ywrqcd3SoGyhZm75mKCFyS 8NobVgyPXBoZFmciCexp5A== X-Google-Smtp-Source: AOwi7QA+EC8G0M/LN+KOGvIkZsNSCR3w9/Z3UgSdIjqVaMUPHs9qKRAvU//JR2HQcpHaP9wvbrO8HQ== X-Received: by 10.99.169.25 with SMTP id u25mr10369208pge.363.1505730752970; Mon, 18 Sep 2017 03:32:32 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:32 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:49 +0530 Message-Id: <1505730731-10947-6-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 05/27 v9] 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 971caec..db6838d 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 Mon Sep 18 10:31:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112884 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501105qgf; Mon, 18 Sep 2017 03:34:47 -0700 (PDT) X-Received: by 10.107.189.129 with SMTP id n123mr2198366iof.48.1505730887690; Mon, 18 Sep 2017 03:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730887; cv=none; d=google.com; s=arc-20160816; b=jB1xRfDOCddwYp6T7d1E6JdcZ28t7ods3OIRbqzZjmV/xFYSkYpNko+rn7oDBrk6js aDf8Fov8AeGTfjXvlddJsFfJETKwKakY8s0GJ0zSYbiKHyR83Zr/AtUW7oorhT4HX40N hF0aW+p+lFXsOZbq5+bI+yRIpms/aptN1aEokn4czC27OrLIu7pM50hojtdLhxzkFlio j1/zDCPY2vLJAAVKvfjTeS/0PN3XZGINGqgoPzGUqo/Ax2vtD5UPfh+/zRZRvC54aoGx oIorXlAXktU9Dj+ZAKy9uuv9sb83FcfzuIlldQgyzV4geq6EAgDmGMwORZOndS6vITc3 DVhw== 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=rTP6/wVk33tfrBQuyvUxyZn1KhKHVf3K0hupJ3v/0bo=; b=jyNGDHam9PGaRYR3WqSEEwzTHmkkH3skTvYoFZFFQQqRVEE+reBX6FLe3dhJjGXSeo 745uNnuQ2wDEccT2Cz+Qam+a7HArdJKrqZthgvnkZ8RbAFmGkvTM9nPwsctNEFB6YD7t b3A+2kiFHjD3dFPy6JwdX2IhyipD371VYb1rkuncitleCMBJPUAXdGiTmxP2Jz0TUKXM 03pAMExwEWWHqb/e0yfyHMPrM+Y7h1tlb7Z69kHmkirYIyXJghgG1jHT4BcP7IxGLFBF M5et8VyayNR6DyRi+r4YIFZAU2nCPUykYvixE6OVSaTKW4/aQk80hubSC/AopZc+GVjE VXLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PbraXb8m; 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 l73si4511620ith.39.2017.09.18.03.34.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:47 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PbraXb8m; 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 1dttM2-0001jK-HY; Mon, 18 Sep 2017 10:32:42 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttM0-0001i9-Vx for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:41 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id D0/B4-03423-8C0AFB95; Mon, 18 Sep 2017 10:32:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTASt3jC/Z HGqxdKmbxfctkJgdGj8MfrrAEMEaxZuYl5VcksGZcPLSHseBlRsWdqV1sDYxbfboYuTiEBKYx SvxvW84E4rAIzGOWeHryMjuIIyHQzyqxfEkrkMMJ5KRJzOqZygJjr5p+hBXCrpJomHOQCcQWE tCSOHpqNivE2B1MEu8PXWDrYuTgYBMwkZjVIQFSIyKgJHFv1WSwemaB50wS0y7pgNjCAiES82 a3MoPYLAKqEh3LboHV8Ap4S6xd9pkJYpecxM1znWA1nAI+EufXP2CF2OstMe/XFcYJjIILGBl WMWoUpxaVpRbpGproJRVlpmeU5CZm5ugaGpjp5aYWFyemp+YkJhXrJefnbmIEhhwDEOxgvL4x 4BCjJAeTkiivaOT+SCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvO/mA+UEi1LTUyvSMnOAwQ+Tl uDgURLhXQeS5i0uSMwtzkyHSJ1itOS4cOfSHyaOA3tuAcmOm3f/MAmx5OXnpUqJ89aBNAiANG SU5sGNg0XoJUZZKWFeRqADhXgKUotyM0tQ5V8xinMwKgnzZoJM4cnMK4Hb+groICagg1p27AE 5qCQRISXVwMj007/Yf7Fh9fv9AXKx+51VH4fXCPx/37XRrHlBuaj10adCuxYZst7rVpszne3X E9uPS03c1h/ZyGiU2dvYKFq7oWJ2i0pr1nx5m+1T5xpeP7d/i9baJfJZ850nnFDn+XHhaJFot tqaHzOcOvf217roO5RKTt83KzfHzNBAPtJ49wrl6X1PLJRYijMSDbWYi4oTAQaQJOzLAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-27.messagelabs.com!1505730758!111786353!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 19782 invoked from network); 18 Sep 2017 10:32:39 -0000 Received: from mail-pf0-f169.google.com (HELO mail-pf0-f169.google.com) (209.85.192.169) by server-5.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:39 -0000 Received: by mail-pf0-f169.google.com with SMTP id m63so29248pfk.7 for ; Mon, 18 Sep 2017 03:32:38 -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=1iE0uIpQRh+DhF/m3IwmR9ZNUXERQxS9/14GcT5G764=; b=PbraXb8m9OS+s+N9wLmqyvcSXetSAW2MUo+M+qOZSCGrVJ8+OcpYy6sj3Cm4hhr6hO 9V4lXQnRjmfRoiVU3K0Y9Z4qAvR6nMe71Ur3WukwEr+cSVR+QbtBdSd10BXUxu3T2kqV Wus3MoiFuDpWX5WGE55Acuv9bPhEUrsfH4V0U= 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=1iE0uIpQRh+DhF/m3IwmR9ZNUXERQxS9/14GcT5G764=; b=nxdxJO8O1wAKKOAOffOEp0dC0+ptVS5f1PTPOv4j+/FW026zeTDPWcZe971LJ57Qiq lwdpbW8M1T4Ygj74VDIGbaQefu+IU1g0ge4cRQRpydqnmnJ7nhq2AMhukjoubHECkFOx XA4NqgKCzwxHjGnIFDmRnYll9HaCeOqnpKZLaHXjrGcjeYNYbZXxjbkVKYbWULhZ6nY8 cA6ajAMoY3QIapyE7yQQXQVqdiTB/2DcTdWOdr2YDIU+cztnIQ1SdAxPhgcc0yj/DiNw 20dN5PAB+2HV6pKrgXGgJqquab5f6cdggr2Nsxb8ROcofxusz5tTkwdxCjIiRGub+Z9u U19g== X-Gm-Message-State: AHPjjUgHNIGX6Fi5FgeHt9a1vVTGsBztwvcZbFBh5HsKLxY49e9R2oWn zXCNmSYAtT4PzMNEDp67Qg== X-Google-Smtp-Source: ADKCNb7CWDCIsfskM+W1Ds37FAuX5w90tNbeK7Is5sWaKHvYbE3bUTrhMjeOpCuZrbujUdfZyAEuyg== X-Received: by 10.84.129.226 with SMTP id b89mr36338371plb.48.1505730757401; Mon, 18 Sep 2017 03:32:37 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:37 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:50 +0530 Message-Id: <1505730731-10947-7-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-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 v9] 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 --- 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 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 | 22 ++++++++++++++++++ 9 files changed, 173 insertions(+) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 43151cb..37beb14 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 3bab4e8..43720a2 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..2e9f780 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, 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 6512f01..788dafa 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 db6838d..a2de642 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 50ff58f..17f98eb 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -36,6 +36,7 @@ #include "grant_table.h" #include "hvm/save.h" #include "memory.h" +#include "event_channel.h" #define XEN_DOMCTL_INTERFACE_VERSION 0x0000000e @@ -1160,9 +1161,28 @@ struct xen_domctl_psr_cat_op { uint32_t target; /* IN */ uint64_t data; /* IN/OUT */ }; + typedef struct xen_domctl_psr_cat_op xen_domctl_psr_cat_op_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_psr_cat_op_t); +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 */ + 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 @@ -1240,6 +1260,7 @@ struct xen_domctl { #define XEN_DOMCTL_monitor_op 77 #define XEN_DOMCTL_psr_cat_op 78 #define XEN_DOMCTL_soft_reset 79 +#define XEN_DOMCTL_vuart_op 80 #define XEN_DOMCTL_gdbsx_guestmemio 1000 #define XEN_DOMCTL_gdbsx_pausevcpu 1001 #define XEN_DOMCTL_gdbsx_unpausevcpu 1002 @@ -1302,6 +1323,7 @@ struct xen_domctl { struct xen_domctl_psr_cmt_op psr_cmt_op; struct xen_domctl_monitor_op monitor_op; struct xen_domctl_psr_cat_op psr_cat_op; + struct xen_domctl_vuart_op vuart_op; uint8_t pad[128]; } u; }; From patchwork Mon Sep 18 10:31:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112889 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501183qgf; Mon, 18 Sep 2017 03:34:53 -0700 (PDT) X-Received: by 10.107.135.147 with SMTP id r19mr20367173ioi.26.1505730893777; Mon, 18 Sep 2017 03:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730893; cv=none; d=google.com; s=arc-20160816; b=e5RkWzNlGJNQuWHxXlTBXPdrZAtUGUQ3UWDw3UD2DqFeTvmQyky1Le1vbh1drKEiO0 tFEqDz0vIBPH0J+3zEu3nDw1vkqqBgCv2fGjqJpAi5KPCky3a7v+WW/RDx90Z1WZ6jbY u//VFRm1eXqjlBwu0EZlfJqSuW7ATvbfMnMgkeCqDwrB+DQ7rOaMH7CpXDD3LAavOvl7 MNDi2fYSm6RS8q1RVbhyp2GrRnoeEYSM/AD4mKbr9k0y9Sh/OOWhIgjUu79lMiLlWRDm m+C9Jt0Of3Di9UhohCQ4KcoUb17VYfW3mihHQFzYlVyfQvpRPNEZHllcdi9DjkiiZ6Fr zTjQ== 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=DmRwMRT+ra3PNIYHq+0kidi0emxQV3nZuOjuwKPRsa4=; b=aD63ULU2WwhhGO7j6Q9nQo+0F4MFbWg7pYl5D2B9LAJd3koo8gAWao0c0Tu639DRv9 tCB/bLC60wAi9ZwZ6QbdoRUdrCgYFYPIZeWla8+T/nGAm6I7MhmfWMQIwbsYiNFwYm2d yKJeTO9sV5D26ncK7mmZBUfuYty8K8qa7J6BGOzn916JgaugBXFx22vN1OKqYpFg9MVb 8SZdvhIPyE1UU5lK+wMdhybLRQ93g1l7+F/+nCJtq7vypZUjFc3Hv6kpQXNY1VUHxxNF SetiYJSvSvju5V4jE1XX5u9DuK/1c9bbowoO0hCoHTvnvrl9ICVFh+9w2lyaR2IJ5JWJ GLEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iIf8Ath9; 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 82si5509964ioc.178.2017.09.18.03.34.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:53 -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=iIf8Ath9; 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 1dttM4-0001mN-TJ; Mon, 18 Sep 2017 10:32:44 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttM3-0001kX-GO for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:43 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id A1/0E-30935-AC0AFB95; Mon, 18 Sep 2017 10:32:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEIsWRWlGSWpSXmKPExsXiVRusq3tqwf5 Ig423uC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1owX55MKOqwrHrcdZGpgXKPbxcjFISQwhVHi 36MpbCAOi8A8ZonNnfPYQRwJgX5WiZur3rJ2MXICOWkSzUvXM8HYh3aeYIOwqyV27z/DDGILC WhJHD01mxVi7A4miYnLXgEVcXCwCZhIzOqQAKkREVCSuLdqMhNIDbPAfEaJpkm9YIOEBfwlLj c3gS1jEVCVeLhyKlicV8Bb4sO1PqjFchI3z3WCLeMU8JE4v/4BK8Rib4l5v64wTmAUXMDIsIp Rozi1qCy1SNfQSC+pKDM9oyQ3MTNH19DAVC83tbg4MT01JzGpWC85P3cTIzDkGIBgB2PfLOdD jJIcTEqivKKR+yOF+JLyUyozEosz4otKc1KLDzHKcHAoSfCung+UEyxKTU+tSMvMAQY/TFqCg 0dJhHcdSJq3uCAxtzgzHSJ1itGYY9+eW3+YODpu3v3DJMSSl5+XKiXOWwdSKgBSmlGaBzcIFp WXGGWlhHkZgU4T4ilILcrNLEGVf8UozsGoJMy7DGQKT2ZeCdy+V0CnMAGd0rJjD8gpJYkIKak GxkSZJB2jCme2y1XN0zdsvjW3z+71soKZXQkZ14tEA6MXVOv0z/zzoODMcQapi+s4pfgOCvrr xCY5vPp/WtHl2z33Pp0ldQJd6xQVFac+b7izYsMW4f7AJmVB4d3fxWa/7FsmEtZ//d+vCx9zr 97fL6cyce+U7e6brh3R99VzPHNWZO/DhaEbcpVYijMSDbWYi4oTARkax+/FAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1505730760!110410516!1 X-Originating-IP: [74.125.83.45] 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 23605 invoked from network); 18 Sep 2017 10:32:41 -0000 Received: from mail-pg0-f45.google.com (HELO mail-pg0-f45.google.com) (74.125.83.45) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:41 -0000 Received: by mail-pg0-f45.google.com with SMTP id d8so32859pgt.4 for ; Mon, 18 Sep 2017 03:32:41 -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=s3/gWfHm1xRDkfl4rM3PTmmMPTppea4twhsagiIEdTk=; b=iIf8Ath9xzwGUku0ojiczll+Rf1m7efmsimIgFjGxxWq71EnRiW1bXaNUimmYm+Nvc rVSZOotJfqlAQraLgS2Fk+2u7e/XCap4BrabUq/Lx+aLA0m3Lzxmu/A/i9svk55t9qXW ywb/Kc6Bl0fqALZHxls0UOQA+2BJR10G6VhjI= 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=s3/gWfHm1xRDkfl4rM3PTmmMPTppea4twhsagiIEdTk=; b=ExFyG5N43oHQMa5TxAKgp2WBfqGF9muTkqW2Qj0barTT6b9+MjCCQrJ0zQ2ujDEeu9 QYy0LtL8/zNgQx1gg5WZnZp1tL/OoFGQCtBw1vdP1ighpkRcDfRgFackP34YeuxwgwTR bd82Mes+HbDEtFt12AcnPC7JJe/ObP/Ax13W4qEhR3Nd9PZOggCJmjFIoCWDQOnpLkzP vFN7/O80tjU5lY1W9rl3ausu1TU1Mxh+EJ2fzOsik9Ni0yN+T+pyK8b6bapOihGDLgTE YlxH4HbueIVKBuR5KhPcZlBJr4AVnciifRKrrgcZ2ZN4OCReCcEcSljAiZ2jy3SlxAKV cUhw== X-Gm-Message-State: AHPjjUiGn6ELME+rJS175wWaFuIJ/oRjklfkxP0U5WW3UDuRhvMhiYqM 7iQHKdV6qkJIMpziGQYfgg== X-Google-Smtp-Source: ADKCNb6d7CJrs0GMQJKlewWBzFdq1hUkqZjZgLIguotQMOW2ClzLn+KmEUyUu0RUoqPqI4+KRdtcRQ== X-Received: by 10.84.148.203 with SMTP id y11mr35786365plg.277.1505730760383; Mon, 18 Sep 2017 03:32:40 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:39 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:51 +0530 Message-Id: <1505730731-10947-8-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 07/27 v9] 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 853be15..cdaf7fd 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 9123585..a3a3254 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1369,7 +1369,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++) { @@ -1377,6 +1377,13 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, libxl__device_vkb_add(gc, domid, &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 00356af..3b10c58 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 6b38453..3f7cff9 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 7dc4d0f..c463c33 100644 --- a/tools/libxl/libxl_types_internal.idl +++ b/tools/libxl/libxl_types_internal.idl @@ -26,6 +26,7 @@ libxl__device_kind = Enumeration("device_kind", [ (9, "VUSB"), (10, "QUSB"), (11, "9PFS"), + (12, "VUART"), ]) libxl__console_backend = Enumeration("console_backend", [ From patchwork Mon Sep 18 10:31:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112888 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501169qgf; Mon, 18 Sep 2017 03:34:52 -0700 (PDT) X-Received: by 10.36.51.5 with SMTP id k5mr15585458itk.98.1505730892401; Mon, 18 Sep 2017 03:34:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730892; cv=none; d=google.com; s=arc-20160816; b=L6eyzYv4xEF3zYD9G+edKYn6buDYv9W8xiX3tT+rO77Uu8BJnC1GKnuluwPqhaqW9g 68ds4vldAazQqTFyWzDHxIJgznQVOTdMEMtySeiGpPsyorYz+WK7Sm+WzpWb/meo552Q Yzh4Ym3BblE/lfzp9T/BynL2Xtn38Uec+9nICoggyEmJ+wvpoRznPvfhm4lUVAXBNulH G4T+1qa0aukVppqIPch6zmwJ4826iS0hJHoUbcxmVQTZ9NAtYlKn3x19nVXUkwbhG2A5 fm0Sr3oekwlKKvBa0EuwrnWCrC/y8WFUsL9bBIZOXEqTLC0u0RW+iZUfCk0I/Lm9AwNy N7zg== 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=ceDIGj+pS7dEU4MLPBclKk1qXjBKDrEmMkGXH+kIgHsOOB90f1XnKMKdiM1Jdq4mko +mzD70vMHmLB7pNrx0HGxxfg9sE3wyQYJTXjubacXDn7/0PlcrUoXCVMPqNZytPvh81q 1Cl44T8OPeqEiT2TkmAgFtma5jvuFEl4JBefACXKiFLx++sc+cMg0BeYDASGx3hKxRyN hOinfB7xrIOx1cLxbI9mvst62POb+pBxUpqT6IQDinoKSGesamOfR+6jGMKZ0AG81mgF 42PkFMf+qWMa8p/n8YdiDLOONnOWRrll9hcIFlVnUBKYNpl6XKhX/uQn0Odepmd0uJ3N Bjzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ijMdyx8w; 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 w189si2237718iod.352.2017.09.18.03.34.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34: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=ijMdyx8w; 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 1dttM9-0001qy-4a; Mon, 18 Sep 2017 10:32: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 1dttM8-0001oZ-5Y for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:48 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id AD/AC-02023-EC0AFB95; Mon, 18 Sep 2017 10:32:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsXiVRtspHt2wf5 Igx93lC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ow/N2+wFCxazFhxbvVJ5gbGJS2MXYxcHEIC UxklXi9ewQzisAjMY5Z4sfkuC4gjIdDPKjHp6EXWLkZOICdN4nbPd6AWDjB77Qs7CLNGYsqaH JAKIQEtiaOnZrNCDN3BJPFv2lRmkBo2AROJWR0SIDUiAkoS91ZNZgKpYRaYzyjRNKmXDSQhDD Ty+9qLLCA2i4CqxNdfs1lAenkFvCW62hQhLpCTuHmukxnE5hTwkTi//gErxF5viXm/rjBOYBR cwMiwilG9OLWoLLVI11AvqSgzPaMkNzEzR9fQwFQvN7W4ODE9NScxqVgvOT93EyMw4OoZGBh3 MDb1Oh9ilORgUhLlFY3cHynEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgvfdfKCcYFFqempFWmYOM PRh0hIcPEoivOtA0rzFBYm5xZnpEKlTjJYcxzZd/sPEsW/PLSDZcfPuHyYhlrz8vFQpcYh5Ai ANGaV5cONg8XmJUVZKmJeRgYFBiKcgtSg3swRV/hWjOAejkjDvI5ApPJl5JXBbXwEdxAR0UMu OPSAHlSQipKQaGFWjPrutfnZzA5uu3j3DH92us3NbP09Mv7zTVVLmWj27yMYLm4x4ze54rbvd nb27bnXWztV/fmhNYo1qW/+cRcBm2lmFkPXsUs6aHkmzLC4qpoYXTj7dXnCuJsQsQeCotPYTP Ztu6fxb640j77M3LgvLr794YOcky++PD3zb5hnrvuVIwapjbEosxRmJhlrMRcWJAATVczjKAg AA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1505730764!110410528!1 X-Originating-IP: [74.125.83.50] 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 23984 invoked from network); 18 Sep 2017 10:32:45 -0000 Received: from mail-pg0-f50.google.com (HELO mail-pg0-f50.google.com) (74.125.83.50) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:45 -0000 Received: by mail-pg0-f50.google.com with SMTP id j16so37531pga.1 for ; Mon, 18 Sep 2017 03:32: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=Ot1bQTJbL3uvWQMApMJcqouOKIP7MuaE+/N/bjqFU8k=; b=ijMdyx8wZbbAo+FVTOWnm/QsRMG9YzW1OWFH2GUaLR1+Iurm+EuvFeOZWZb9x1rYxm 2ce2AaSs95l7mjZ9x4gdYSw9EiyR+adRaeJBnoDVX6jOhq+QpLRPbJT/94Ne6ritCfTL O71waUPKWc95rEHSEEsjrWgcqWfNcKQPiSvRY= 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=I8zaolEeSR1ePItH88/LUw6OA1UD0s0bYocMWUJjcgr4/8LJv+xPN+zN6XBPtz0Lcb XGGvn+5bwmE6cgTC/hewhH8yoWE2xVWDk8P/AZrJAj4+Gpb7at8iyFjQJbSO/fOGfgsT G30qyOX0jM40mUZhSRqNI1vG+xfdcbDVroBG2XVML0iqb5+DWI4Araq1azyLvbWQjeKg pFHyTUUb8Ssv7fP04OCZNjzxBClL8x4KIv6Y/txi0GEd0YGmsIZ5GLLnB9tSe1j2D7r+ W5Tmb/FGLt6J4cFBjM4E+mNp68sPvocaOs1yRUROjgmYj0iT9RteN+OZsc6HhPSANeRd khbg== X-Gm-Message-State: AHPjjUhr9BaWQQqjs/UMckQOmE5eDK2BPRUY0EiKygKGB32Omt9/e4ax RyS9qlZXUe7NuNluSgFbSw== X-Google-Smtp-Source: ADKCNb75+rLN6fp3Pj72yEbs/zMm7BQj7H1pOfjHtAnQrMulwdHj3IKWCQxl2lJvDgbC4l0gER12cw== X-Received: by 10.99.104.138 with SMTP id d132mr21330981pgc.268.1505730763462; Mon, 18 Sep 2017 03:32:43 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:43 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:52 +0530 Message-Id: <1505730731-10947-9-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 08/27 v9] 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 Mon Sep 18 10:31:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112897 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501313qgf; Mon, 18 Sep 2017 03:35:03 -0700 (PDT) X-Received: by 10.107.3.10 with SMTP id 10mr20591223iod.297.1505730903425; Mon, 18 Sep 2017 03:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730903; cv=none; d=google.com; s=arc-20160816; b=kA52fUKcXF2YAYAf1dkf8Hoe8mOhBSsV4mdBGZCw+MbegEmmCg6Sa49OYByevaI+de DUn6urCBZUjHhYK0qRcKXS1CSvbh6FfU14MtlnH2WZ9BZnWxswcJgzk/DWPrE8HTIib+ V+Po8P2Zj+oybBUSHuZAU6Z3qhgNLgAoI7U+21gPPWxMKfpFeWONgZ5XpHW9+iWqVIkZ hgWOMT2vAG+E+PnlYewSdgj1H092V1mlQVGJg22LTM8Tan1Xf06vU+iO/m/zynbwPGVo ddGnRtqJffBNA2OO/z6v3B4zDGneGJgHfz94q+XPpNCvaDI65WMIEc/T+JpyHUWVPc+4 BRfg== 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=vOhmUYmJy/SPIplZ7IRTu6YykTXJregCkFqxJgqSPyqvFp+pcJrWTd5nn8Tz++64SY DZgZdY0xGYgyqybyafcaHbFa64MekrJF9jHjgWKkjRIckdd/7iNR2i9KGqSt6s2AJoXQ +4GDLm43YZovN3ii2cSM1ufsKasBgVsYSIIn0TLcJNPnFxDRU6QJNgKJlv9Bz0R49Jop MQbjtsGEnrgubuJB9ksPzxjRUiebdvYnMLSORSk1RebWi6fK7Ft6hDe/BXtpAW+t3rP3 Bni4ZU+9xh2NvEsegzQloV0S/8pPx2NWqVEfmrepQ9nQE273FgmEVm5iDx4Ywnvd1xDH UtwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JHZGYk4E; 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 g9si1384422iof.137.2017.09.18.03.35.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:35: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=JHZGYk4E; 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 1dttMB-0001tu-HI; Mon, 18 Sep 2017 10:32:51 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttM9-0001rY-V2 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:50 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id A8/E9-30688-1D0AFB95; Mon, 18 Sep 2017 10:32:49 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPIsWRWlGSWpSXmKPExsXiVRtsqHthwf5 Ig63zZS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1owLr3vZC/5KV2y4+Z+1gXG/eBcjF4eQwDRG iTXdz9m7GDk5WATmMUts3hwMYksI9LNKTJnHCGGnSXQ09DLB2G3tJ9gh7EqJf3sXgtlCAloSR 0/NZoUYuoNJ4sTWFUDNHBxsAiYSszokQGpEBJQk7q2azARSwywwn1GiaVIvG0iNsECCxMVV5h A3qErsvzOdDcTmFfCR2HV8IRvELjmJm+c6mUFsTqD4+fUPWCH2ekvM+3WFcQKj4AJGhlWM6sW pRWWpRboWeklFmekZJbmJmTm6hgamermpxcWJ6ak5iUnFesn5uZsYgcHGAAQ7GA82Ox9ilORg UhLlFY3cHynEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgnf1fKCcYFFqempFWmYOMOxh0hIcPEoiv OtA0rzFBYm5xZnpEKlTjMYc+/bc+sPE0XHz7h8mIZa8/LxUKXHeOpBSAZDSjNI8uEGweLzEKC slzMsIdJoQT0FqUW5mCar8K0ZxDkYlYd5HIFN4MvNK4Pa9AjqFCeiUlh17QE4pSURISTUwuvF dffhW7pDv/SDhN5NPXwr5fepR8b0fs88+8Q/K8Xm+aN/Tptt3E81nstSd8pZ0Dyr85mJautxu 2lc2dwGhuSJ+82qZlGrlS35vWRi9RntihdHfPWxRkhrzAw4uYtjxzHSnY+2ukpMHPy/48k9+t 5hh84THnj2ioVtl176+7/D2ELv9khP7+pRYijMSDbWYi4oTAW4GsUDCAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-4.tower-206.messagelabs.com!1505730766!112001224!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 63423 invoked from network); 18 Sep 2017 10:32:48 -0000 Received: from mail-pg0-f49.google.com (HELO mail-pg0-f49.google.com) (74.125.83.49) by server-4.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:48 -0000 Received: by mail-pg0-f49.google.com with SMTP id i130so34374pgc.3 for ; Mon, 18 Sep 2017 03:32: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=AGHJrnwneXKl3Z1bjGKh+k5Ixw7YK+0ghFT9u/p0sak=; b=JHZGYk4ErW6Cb9kmPPeWInR1aYQI2zH1Mj4mUT2HieEUgF6SN7O5sA5+9oCiaHrdDP zzuHbNtfUe9ZBn1q1AwJnl9lrpInbMumLGxjFpNGy972HJMl4Te9s/VB+a+nyvnmfE73 bY9ThN0Lp1DUOtNUzmsV7Sv2e86ExrnPUY8sk= 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=SiDSt+dP24lnV4qEdieySNREw7rMXxQihgsBcXJ1ZnQ9OSHalbIVvoa7VEpe85YxUc YIavLtMryqPLWFhtEveM+UHX4tAem1PEMxDNLy7xQEyAXLo+qP2iKN6qBp80xUOmbZ9S whxj4g2wK3P9D5Yfd1f8J4dfJ0WpWoysi4KAWmHU/JbtV4I0rmj1YmjiRsygi5ZRUFsH JRxIJiJCZL5PFgSVy0fa9hEEnhgXhfyHHIMUei/sOw40Pi9IGwSnr1ammksLYPDzZaHF rvtfBe1TfAtN7ldnefY5vmRsyDsxVO8OkT9WYcJDHGbhcjRamXbkiCB/xCzuN48gt5b9 7ZKA== X-Gm-Message-State: AHPjjUil39V6UNOS+Jw4EEiz0J5I95bLBavZW2sA+TwksaijgDbVwmlY Npfes2phPuiVpBAaxRUv3A== X-Google-Smtp-Source: ADKCNb5XeHHlbUr2G6ds/ahTIZVB+HVxXS8ilJFo8RSPHRJ0tjgN8rhvnTisPyKvMDxN6nQFSj4giA== X-Received: by 10.99.55.25 with SMTP id e25mr31537120pga.383.1505730766344; Mon, 18 Sep 2017 03:32:46 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:45 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:53 +0530 Message-Id: <1505730731-10947-10-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 09/27 v9] 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 Mon Sep 18 10:31:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112895 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501293qgf; Mon, 18 Sep 2017 03:35:02 -0700 (PDT) X-Received: by 10.107.57.70 with SMTP id g67mr21669353ioa.224.1505730902021; Mon, 18 Sep 2017 03:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730902; cv=none; d=google.com; s=arc-20160816; b=hOKjNp++Y1KE4NxS7K15uEqoDssY4CwCQ/gITvkozheHX+J4PUGPwn2NctWi9nKScx Rue/haJyNgglFpWQlxQa6ukty9QpU8DaCC4Srv5x35u5sWCLDq5P26z0ZSEG9tl7gv3Y uwMoHEq5Te584EYroOLSoitgqusMiHOQF9+HXQ9NT8rzxd+minrma1YWoEQ+AuHtW6+X dtN7Ympr8iqEdrGKA41rX4VcPy7cOGEpPpORK6zrMwa5PuFC4ivvbzRbeDh+s3QXmx79 f+KlqrkHtUetlYrzzIpZiyOReJuraQanxcy2mXWJlFOkXjiGt9DEAn0v/Y4Xrx/6ndhp j01A== 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=lAP3lMvECfrUEJa+3PzgS+tjiEQJQYUc99/U5YKYcTQKc9dhC+0/yeATYdZpzlOD6m MuEEkHPkJAmT5spQEmGREV5/gjzviWt/JTqOxUIdg1XE1jxCdA95Bklx7es9m60wJ3QZ 7nBddIlX7vrOPLon2VK9IS3gB8txpPUuJPrPdtaqkkKSDY9k7yFQaK8HKF4crbC4atIb vcuQrFlEp+nxlXI1MyT/IVTLq2Q0cF2SUBqJ3KCfKE2Vkfv7FbNowVSvmwWoVOEcoz4v g0pD9RpvGZGyEFuNRXUVyieQz9fLJUIpVD3KFK/tOQTEahC3gVI/6EL13Cb8/D5b+0Cg Y8iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XrSlDlQO; 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 s128si4294885itd.186.2017.09.18.03.35.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:35: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=XrSlDlQO; 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 1dttMI-00021w-Vr; Mon, 18 Sep 2017 10:32:58 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMH-0001zW-Qy for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:57 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 93/57-02226-8D0AFB95; Mon, 18 Sep 2017 10:32:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTAet3LC/Z HGrRNF7P4vmUykwOjx+EPV1gCGKNYM/OS8isSWDMaTpxlLnjrWdF1aAdjA+Nfmy5GLg4hgWmM Eqt7jrOCOCwC85glZi+7wQbiSAj0s0p0P3sNlOEEctIktjzoZIKxb/xqZIawqySOnZnFDmILC WhJHD01mxVi7A4midXtS4EmcXCwCZhIzOqQAKkREVCSuLdqMhNIDbPAfEaJpkm9YDXCApkSTw 5JgtSwCKhKvD7yCWwmr4CPxPm3TVC75CRunusEszlB4usfsELs9ZaY9+sK4wRGwQWMDKsYNYp Ti8pSi3SNzPWSijLTM0pyEzNzdA0NjPVyU4uLE9NTcxKTivWS83M3MQJDrp6BgXEHY8tev0OM khxMSqK8opH7I4X4kvJTKjMSizPii0pzUosPMcpwcChJ8JbNB8oJFqWmp1akZeYAgx8mLcHBo yTCWwiS5i0uSMwtzkyHSJ1itOS4cOfSHyaOA3tuAcmOm3f/MAmx5OXnpUqJ89aBNAiANGSU5s GNg0XoJUZZKWFeRgYGBiGegtSi3MwSVPlXjOIcjErCvMtApvBk5pXAbX0FdBAT0EEtO/aAHFS SiJCSamCUt6l5IF99wn9O5Dq737POcS353RTdLPiYh2Xp4zk/7itXe6Ub2LNdL+RSejsv4GV7 kchbTS31Va48x/+3MlmffSuyl/mnqsIp072lL1d1XPM6fSbgLJe0+Z3+O/sY73o4X329bbues cU+rrXahz1PpsXkrP8lrOOWOnupW1zRNLtkrd3HXM2VWIozEg21mIuKEwFlIfS4ywIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-16.tower-31.messagelabs.com!1505730770!107672538!1 X-Originating-IP: [209.85.192.175] 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 12985 invoked from network); 18 Sep 2017 10:32:51 -0000 Received: from mail-pf0-f175.google.com (HELO mail-pf0-f175.google.com) (209.85.192.175) by server-16.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:51 -0000 Received: by mail-pf0-f175.google.com with SMTP id m63so29459pfk.7 for ; Mon, 18 Sep 2017 03:32: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=/c87JD9XyWkvHP2iWascyeQ5IUSzbfWQc11J8Ir9N+k=; b=XrSlDlQOWep1SZeVyvhec9s8RWjox1qQKrGzLPDUhtWRE3oIgw7rH6B3hRujOmykAN BFqOr+Nh+Se3xuV3iblL2Hm30aWYJ/TZd1nensmoOmkVLIdEnktbLOo31lMLhYQhFGgR j+lz3Pm+aowXH/O2oDTPjOMtSlyzwOuo62CVU= 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=Hl0mi7+nq6EUg/2Q8hKCFoQcmKYcVLzTmh/zGHOS0YqcJJmqiprh84F5c4jX4+a5No VUlY/gPXRs2gqHXqf5K71d5yY1BHIXgjHeRdnIgt99eWlOJkMJbyADJCVElUSmoVttVB Q2FfyhUwKYWeomy8M7dsHfTlVKJpTrREgyjKGeUjlxZyTXqL4POQsAkz4bdz/G74Jd1r +D3dkGkTBnAdaM/Ugbg3h4Q/Nv0/yeilppGR64PvTCnGJaRDTr8a3bfkuFLs4wlWFkc4 Q0dMbXxxHr1tX1zDDdiTt7mD4kMI+Bd6zt7xjpQPw2H+o6faouxzqAu+Bdb9Un9DeOI9 JOwQ== X-Gm-Message-State: AHPjjUgo8LcoF5Wm+2XYNQqEvyUSExBanE2yq8NV+nCCY9vrkxGNBPvB nVKQsht55eCUbZKnKqD3fw== X-Google-Smtp-Source: ADKCNb57MFoU0dbNdT7WFJM3BXtvFP1cxg9DsUUsrYYdXNNBtUmW1bBEh8SZpPugcOlDed2a1wS8Ng== X-Received: by 10.99.126.84 with SMTP id o20mr32575867pgn.131.1505730769472; Mon, 18 Sep 2017 03:32:49 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:48 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:54 +0530 Message-Id: <1505730731-10947-11-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 10/27 v9] 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 Mon Sep 18 10:31:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112892 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501259qgf; Mon, 18 Sep 2017 03:34:59 -0700 (PDT) X-Received: by 10.107.97.5 with SMTP id v5mr21080951iob.68.1505730898998; Mon, 18 Sep 2017 03:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730898; cv=none; d=google.com; s=arc-20160816; b=XnH4CHlYgoCjjSpgMhJHidf4pnxBgOqRtZNnxqHi+C0iPtEX1jbq1YKjAT/eSPvqn8 XUc9KIw2toU0xAmTDPhp8JXvSDlEDoezjcvz8p3FWv3dd00sNAo5XPqoNelAXCZw5LgE FTqdJ1GPHzDgcpQv7nwS8tZaPRISVvEYPFqPMNzoFf+g/OalF4b3IPIv7Vfp0EGglBy9 9zcM3Uy91UMHvPQ0k75BT3DEHm72YfUac4rDLaPmPddjPE047FTdx/eEmUhhYNrMDfI/ q9lds6BONAdBdRvK/wb8anLpaOUNut65LW5lFbLY539p5O9q5eXp/UmqtCeAoPR4KiWH o58g== 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=0nM8mvtKii95qfKEt8b+ioPGcRg1r6JoDuY1AEgEyikpGsOlHQXcAqujSo0Jw6EWV7 e7jNXC5XF3+FYkURSlT45E3GTFbCqnVg1eEnsrwAuZRpNUMGvxhQ8pqhy20sAKeatku+ AgxqCGuaPmM7KPyknqQWgz86mzvgJg96nzkt3fc2S0r7TbUAM8DG7byXSJP/c7APFEIg GgZPsyls+qmwXL6pvwRO4MsdW+tonh42y3E/YcxloP6DB3sjuF88a6K56mkko4Mb+GAf TKetsHlqZW+zRcHNcUrvY4rHawrNiYk3He5PNzG7UFTXDCla/YJo+/jQg+lFBYVALgo3 ty7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UCapcZKv; 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 g67si4334963ita.125.2017.09.18.03.34.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:58 -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=UCapcZKv; 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 1dttMH-0001zr-OY; Mon, 18 Sep 2017 10:32:57 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMG-0001y5-8V for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:56 +0000 Received: from [193.109.254.147] by server-11.bemta-6.messagelabs.com id A8/0D-03616-7D0AFB95; Mon, 18 Sep 2017 10:32:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRWlGSWpSXmKPExsVyMfTAWt1rC/Z HGjwpsvi+ZTKTA6PH4Q9XWAIYo1gz85LyKxJYMxr2dDAWrBCvOHrmBHMD4y7hLkZODiGBaYwS J6+YdzFycbAIzGOWuLX0CAuIIyHQzypx6uMnZpAqCYE0ic/rulhh7GuX9gEVcQDZNRK7WlkgB mlJHD01mxWkV0hgB5PE/YnLGEFq2ARMJGZ1SIDUiAgoSdxbNZkJpIZZYD6jRNOkXjaQGmGBCI mFrxJBalgEVCXerJkNNpNXwEdi+/rZ7BBr5SRunusEO4cTKH5+/QNWiL3eEvN+XWGcwCi4gJF hFaN6cWpRWWqRrqVeUlFmekZJbmJmjq6hgZlebmpxcWJ6ak5iUrFecn7uJkZgqDEAwQ7Gu5sC DjFKcjApifKKRu6PFOJLyk+pzEgszogvKs1JLT7EKMPBoSTB+24+UE6wKDU9tSItMwcY9DBpC Q4eJRHedSBp3uKCxNzizHSI1ClGS44Ldy79YeI4sOcWkOy4efcPkxBLXn5eqpQ4xDwBkIaM0j y4cbDIvMQoKyXMywh0oBBPQWpRbmYJqvwrRnEORiVh3kcgU3gy80rgtr4COogJ6KCWHXtADip JREhJNTCq5H63XPsisOjIpqZCXm1b7pkRHEa6Sx983e3x/Qfbo0cOHz7/dZ+odLNzmefkB6az cg2+THz6ofJwQN653gb91CPvDh042vP3U8rhBfJOobxXks2l9LZdbpHWTtugtrlg+5LTf+sF/ zbZn1N9ebhudVzYxbZyySTF0I42H5kexlMhtd+mvzBSYinOSDTUYi4qTgQATsmgD8cCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-27.messagelabs.com!1505730772!85447993!1 X-Originating-IP: [209.85.192.173] 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 5918 invoked from network); 18 Sep 2017 10:32:53 -0000 Received: from mail-pf0-f173.google.com (HELO mail-pf0-f173.google.com) (209.85.192.173) by server-11.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:53 -0000 Received: by mail-pf0-f173.google.com with SMTP id p87so27608pfj.9 for ; Mon, 18 Sep 2017 03:32: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=EtvhJzM3HTL/NgQ6915SS3H5bdB2TB/oZeG6xtku1W0=; b=UCapcZKvYLGylzbNemCSTQkummga6UP2Np3Ltn/iT1Ddj+ql1f6o9yM/pCapJVnMEt xy70oZs3yJ3fGCpZWvnxDKs8sE0EDA8tIMgsJ9jfECUAYqfWL5pwkKnw42erIfQIp1NE jK0ur23xv1ID93y2gHXLArGeUVcH4MYrIKjsI= 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=L/oxwPaAcp2C1Itng8UjF4S76D49ZuQLaTq3muP8Y0sEeTt8JFFt3cxdxCI8TK3cRZ c/Q7HvpAFP6oROx5MIW7MJfuwQNNCPPMVmA27+KfFU1czxyk7xDS+IbAv/uWXLZEEecE XDI5wxLhguSw+qNUmq6tdTYhwRhSOj0/x24deUM1OgSK+53E0mqvL+M5AxAQPJSWyIiB CU5YS0NX1rKHti7kjGG3uH3IjNPT/j44UXPVYiWcChACDxvhmQBePS9cczh+fZ7TotLW fya8he0EULqefr/71DrO1guTM0GMpdsXdfCXrSjj5+ptH92Xx8BACM07mraE0lEQlmDJ DBHg== X-Gm-Message-State: AHPjjUj3mN11yj4byCJzYngfY2SC5d7divg8ZfM1C7/jhSosuNXMfw8u DdsKOcLRF29bgyswzjbUEA== X-Google-Smtp-Source: AOwi7QDPb1uLX6+ZKIc7YkTbTk0pLZv6q6nHEIH8YOS8axPCVklVjqiTooeqYk6/aBUXZ8GpiF7Bgg== X-Received: by 10.98.210.138 with SMTP id c132mr17911558pfg.331.1505730772274; Mon, 18 Sep 2017 03:32:52 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:51 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:55 +0530 Message-Id: <1505730731-10947-12-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 11/27 v9] 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 Mon Sep 18 10:31:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112890 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501210qgf; Mon, 18 Sep 2017 03:34:55 -0700 (PDT) X-Received: by 10.36.95.5 with SMTP id r5mr17619923itb.9.1505730895109; Mon, 18 Sep 2017 03:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730895; cv=none; d=google.com; s=arc-20160816; b=C+M3fM6v4IFr7sw7mI0I/Kc1bKyxaTcH3cZ3FpujE/FpxDX7F7pUxU9RS9pSkViAyL 4KARtNPy71SWZeNx50XvRrgacwTqwUj8gm60lYplhVNFBeXyOnLGj7ldoTQIeLdInrkh OhQYZFpxG1O8m2QAAyb/ACaFTGpOrF27i7xCmZA7SlLTDAGy37mg1+zayXeyI6kxoZsN CMpFiz8YuRXZ9KxezEeqYBM92S8ZUzkiPDNCnQLkcEJ/VKaXjDpRocHW0fsym3rEzZpC RbIWDkAgLEpQlAnU5TwooBlVGCHMUJOWCneKPNhI2aaZWZ5a2orz9+h1dhzPFi+4XqPT TtYA== 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=BEhgXDIx53zFQoDBZBvqwc6sRf2Ecy5qELbzlTBFkL2f/DYnBvhc2RjFP3KSkHQt9T Vfy6k0PN4pTMe2dS0wlV/NnmkErIsjCvPY2/EobQBbslGxP5dtIZ2R9cBfFF71R7A0zy O77FoBID6fH2IlZa37VZqKHIrtx6PVOW2BEfAP5KePTAysPj+35mp2dAwL7wuw8U1z2E vCSYFpFGDiwdaomD49EQ+PeO/sqi29j0k4CTlDnmggEW79JHwyEJmALZJrrW3brwcYk3 eI8GVhoTAem5qdE9QymgEr2Jm3ZwjousOwTvD6D9BH06LDMoetx/YZyGn33hNcolCZN1 9dMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DOmhUFMd; 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 j135si4411292itj.37.2017.09.18.03.34.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:55 -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=DOmhUFMd; 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 1dttMK-000242-7w; Mon, 18 Sep 2017 10:33:00 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMJ-00021N-5y for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:59 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id B0/34-01778-AD0AFB95; Mon, 18 Sep 2017 10:32:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMIsWRWlGSWpSXmKPExsXiVRtspHtjwf5 Ig7nTjSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oy9l+8yF3zjqbj4fD1bA+NDri5GLg4hgWmM EncXHWECcVgE5jFLbJ8yD8yREOhnlfi3ax17FyMnkJMm8ffdRFY4u3M2E4RdKbHi5HowW0hAS +LoqdmsEGN3MElsmbgHyOHgYBMwkZjVIQFSIyKgJHFv1WSwBcwC8xklmib1soEkhAViJC50PA JbwCKgKvGp7yyYzSvgI/H5TivUMjmJm+c6mUFsTqD4+fUPWCEWe0vM+3WFcQKj4AJGhlWMGsW pRWWpRbqGhnpJRZnpGSW5iZk5uoYGxnq5qcXFiempOYlJxXrJ+bmbGIFBxwAEOxhX/3Y6xCjJ waQkyisauT9SiC8pP6UyI7E4I76oNCe1+BCjDAeHkgSv1nygnGBRanpqRVpmDjD8YdISHDxKI rwWIGne4oLE3OLMdIjUKUZjjn17bv1h4ui4efcPkxBLXn5eqpQ47zuQUgGQ0ozSPLhBsLi8xC grJczLCHSaEE9BalFuZgmq/CtGcQ5GJWFeQ5ApPJl5JXD7XgGdwgR0SsuOPSCnlCQipKQaGA2 a+A3PvDZacffVkgNLfnHy77uk9bPK8X/t5fZSzc/LM+0Ckrds5ApaYKt4x9u4e4XcnwKdFxxd 6cdPsU52a82YxRyrMLtFQ9KWf6apQaG3F+OUquhaBu2Gjyv7bvbmXcgRUtoU9ubCwQlPPCveb ZCsX7FqV8n0KEeb8vIA+8Or3O6V+JgfV2Ipzkg01GIuKk4EAInhdm7GAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-10.tower-31.messagelabs.com!1505730775!114591538!1 X-Originating-IP: [74.125.83.50] 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 38069 invoked from network); 18 Sep 2017 10:32:56 -0000 Received: from mail-pg0-f50.google.com (HELO mail-pg0-f50.google.com) (74.125.83.50) by server-10.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:56 -0000 Received: by mail-pg0-f50.google.com with SMTP id i130so34519pgc.3 for ; Mon, 18 Sep 2017 03:32: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=DOmhUFMds7R2zbi+kft6wWR5/sPlETIpk5A98hO33G1soG6CGLrdsU/b3GILO1BNzE W3CwG4UwXQ7dZhh5oyTZZlfrPrtPJd4xxH6B9HqlvGXISJc+HvMgpZztEtCL/TvnZfg9 Mnvgqtj+fwDWO+okaXXYs9jjvW3WFUOxf8e1M= 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=NOPIMleB04b+wuaX2lIO1rhH7ga17puWvkq8Xwe2wKiHmITQHpZor42td4AlMjG5rD /E8oOSdYTyAKjNqbGui3fGlAS1zpPnmDArxYvqcw0WeMuoALjH+0QG5SpiegmP+Giu2g 0B8rQXncBVYVsUwHE1CrwFKBAXcAReC2XFcM8Skv34xcgTIDoHR/STtrOd6BPkUnsPNd UxWcIVXWyN4X/rxoMTVRVCj0gR27UEoX/4UZxpvtwMA7gh4vE1VOkMwso2j/fIR7CCc8 +nRHHMwPKBC7Yt+/IEKOlIGwNEXA82dUR+DPWKZrYY/8ssnNsWJVR87cwviIjkssAPwK EZYA== X-Gm-Message-State: AHPjjUhgL7GskAhXsY44A40zM6ZzeyNgHSO0wb3J7h9QZ3Yy9jYoBg8n Km6XQfeSYu02x1FERZzKyA== X-Google-Smtp-Source: ADKCNb6D+slg+qmqUIU0JAB9Es4mRB951xSoEf03m+GLTRn8iobwL/GdTjRsn7LCpM0xQe/vJ0yAqg== X-Received: by 10.98.62.131 with SMTP id y3mr31097475pfj.178.1505730775135; Mon, 18 Sep 2017 03:32:55 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:54 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:56 +0530 Message-Id: <1505730731-10947-13-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 12/27 v9] 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 Mon Sep 18 10:31:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112894 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501273qgf; Mon, 18 Sep 2017 03:35:00 -0700 (PDT) X-Received: by 10.36.254.135 with SMTP id w129mr17225351ith.93.1505730900377; Mon, 18 Sep 2017 03:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730900; cv=none; d=google.com; s=arc-20160816; b=WsB0sj854pTlUcU2UDbhewGQAQuQhoCGolY7QjXCvrRvfYk5odBgG/Tsn33k59OUva 3p/4fE8c3o0xyW/UzQRO1+atJ7VxoRP8563SGOiY6gXvHiWguK6xUh8aF60U+zMcYiTS FawmKTI84sOoImbam9KOHaFM+g9g2GCQjabMlY2Lr0KpFzhO0Fuc7dJJZyD4Z/IGt2K6 YEY0YZlhWuWOrjB4aQQkwBFfnZhGwUa5qBSRy35V8LX4I6iBE/jJGLqEZ3qTFvMNFAsT aYhuEGDfoB5UtY6LymmxTFmR0D7osXlw3pUcy43aZj9ThdqBISX1gBkmUxzKQQFMUO2W 7K+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=EncVTiWfBbtIxylxnUk9+xT21OqnAVDQk2kqPlpQZiU=; b=CIh0nWro8fh5EH/h5e/lK5FHuC/Y9EscScdtvisQIoUQHL72+d21ZS4EHu11JnzE0m 0HJifxNW8dLc3prW6slsL6+do6h5CB8lShLDusnkuTb4s90HSK47/CweO/hIer3RF1ZH eJl20h6ZDCOfHy2DPaqGXY8Lo9fg7KKIadYuKPqOtWYxqjtF0xQyFVy9Dk/rekO+DeRR RhGqQ2WcC52pUVrfOr+Rs1uvRD0Es+o8WAtnfgIKpGl8t4bI6qljiupekU73ZQ/w2f+E QroDsCfxOxAPQeGxUYFXTfoIMVx6jH7y8LPPqpI567Ykpb7/MZ3Xc7sDRnCIUYWV5457 mw6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Lnd7fp1J; 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 99si5273636iom.222.2017.09.18.03.35.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:35: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=Lnd7fp1J; 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 1dttMO-00029R-JC; Mon, 18 Sep 2017 10:33: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 1dttMN-00028K-MQ for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:03 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 5E/6F-17770-FD0AFB95; Mon, 18 Sep 2017 10:33:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTAZt3bC/Z HGhz8p2jxfctkJgdGj8MfrrAEMEaxZuYl5VcksGZ0b5zBWLBFqOLhhZNsDYz9/F2MXBxCAtMY JRZP/8wM4rAIzGOWmHT+G5gjIdDPKnH1bT9rFyMnkJMm0XfqKwuMfWDOamYIu1xi96SzYHEhA S2Jo6dms0KM3cEkMWPhMsYuRg4ONgETiVkdEiA1IgJKEvdWTWYCqWEWmM8o0TSplw0kISyQLt Hb8A5sGYuAqsTZY9PBbF4BH4lbLRMYIZbJSdw81wm2mBMofn79A1aIxd4S835dYZzAKLiAkWE Vo3pxalFZapGuhV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRmDIMQDBDsbZl/0P MUpyMCmJ8opG7o8U4kvKT6nMSCzOiC8qzUktPsQow8GhJMFbNh8oJ1iUmp5akZaZAwx+mLQEB 4+SCO86kDRvcUFibnFmOkTqFKMlx4U7l/4wcRzYcwtIdty8+4dJiCUvPy9VSpy3DqRBAKQhoz QPbhwsQi8xykoJ8zICHSjEU5BalJtZgir/ilGcg1FJmHcZyBSezLwSuK2vgA5iAjqoZccekIN KEhFSUg2MEfFPuf4wctqftD4x94Ky97l1D105yzp5Vr+5/fxHauXSRd779r44yuYdozGL/R/P 6TTtCeEWRWxbr+/0lJ0mdX7z4nkLt7gVf986X0T/1RHlnF+zX++YXK3IcKRNYdLEHFfbLSLyG wUNVy3kz7i88kffQnG73r0ZzGWv2AWyApaIiN4zZvRQV2Ipzkg01GIuKk4EAF8lf+XLAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-2.tower-21.messagelabs.com!1505730778!69432302!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 614 invoked from network); 18 Sep 2017 10:32:59 -0000 Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by server-2.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:59 -0000 Received: by mail-pf0-f179.google.com with SMTP id y29so37355pff.0 for ; Mon, 18 Sep 2017 03:32: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=+Jo1JpAkfFAajaOT3dp6fEfCx26fj20ZkRTJgD45A5A=; b=Lnd7fp1JKtxKJuLBNH3IA8oPeJ4p0dSQ2DjEN8NKUbtdEWBps+fMeMrBrX5KK6POyw wJblssio13+L1wQg+PS2h7oJcuhQE4Fm0H6HoMjZXM1YFQVk4lkZgmPk0lkprsWKJngm Zr/+xWgqQytS+kmuhFsl7h99ijb5xtpZCfkLs= 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=EaATRwk4YEtkokvDta+EjmJstz2N37mlWrrDfew8sp4wKxwZkXZFJk6LWp+ruoB3e5 1eLMMGANX/7NHFbRxJtYaPAMxeexZ4lGXEgTUM+IDOoXz3Ehto+3dqD8afGyiyHWnFE6 vXjD53Dl7ZoRCE4S5ddBNjHIIeaQv/gHWxmzL6brzgefAg8wV7pzETdSxviQzf3EpWsz 2JX8OzUmadbkg3+EKJhqlOCsa2456K7UWp6WdQULxF7v/YArOuLPgAcGFA0Mz3xkDG4p H87DCJPnqm+zrhEWamqmgSYj0hONl3/MV49fdHcA3H0hV0ldZjYufDcbEoRcUUDXB6f7 3LOw== X-Gm-Message-State: AHPjjUgKLTjGnm9pvw4EEqfKM1X/8+LUtD2ensGy9Cm4vL2jjdIsvAG0 EJfwG7RUk5+nPpLkpBLyxg== X-Google-Smtp-Source: AOwi7QBezFypTGaXuXni7b++vYBoD+e5KC8j3zxTMqculd8jqsNYH7cw3lcbDozeez637Z1nPcOtRQ== X-Received: by 10.101.72.5 with SMTP id h5mr4898059pgs.305.1505730777985; Mon, 18 Sep 2017 03:32:57 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:57 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:57 +0530 Message-Id: <1505730731-10947-14-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 13/27 v9] 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 Mon Sep 18 10:31:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112874 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3500945qgf; Mon, 18 Sep 2017 03:34:36 -0700 (PDT) X-Received: by 10.107.129.229 with SMTP id l98mr17898845ioi.244.1505730876750; Mon, 18 Sep 2017 03:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730876; cv=none; d=google.com; s=arc-20160816; b=QMuMdpgJuWZWcm2BdlKBV4x7hPheDclUA/RQKl/OBDYqiyROraaCMMGxJcLq+tkDg2 oCrEhufaqsi6WLRN4C10U0q0UIGGledFCXvOJDktOsYmWwYqKBPh5wq2aDn1Y9s8Ytnh vMYt3nAt0OTr2ATtGkDXR2uOuzCUmypfNGEhoTmaRb92p2BmAahfMH6PEs40VOG93hd/ RwnlDywHBxBkzh+8D8rAc7SZm2HiYWIhLqOToEpUrDMjnTOZBRzCMQAMsMA/hoRcOvhp JtaPLVQCEX1yq0FJISvPkf+nDmxNKZxgzjF0EGNkpjusJyAw1SSDeyqhUxw0sVOxMmzI g0YQ== 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=CE2KvsfGaAH9mTDLYPDJE86ilMb0eC+WyPDvfRPblq/5EII8aKWpG9MXkCXTzYUsQD 2mLNQCElPW8I4mK1L4EPTin1/NOQ1n5DxDSUc948HNcj5FvCfCmO762WyWgQNRH2st+V wrqGnwh5VCbNIubzH1mz2RLib6yruo58AzkpvE+zsXfp6nQ+ZAs593B/ywZIr9xB0+Nz klI7IR/dOmsP9ctt9FQ+8DRVvHhf2ZE8iRliUuXO2W74XuJ+FCGo2buYyecZ1dsrdHg3 kHdeblenjLQVcNyfhbVSpXS3etk2nKcSBiZHENDMfSY3pkgkmFZhn5Yolgn1VqjW7Dae 8G6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FdOxwUNE; 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 b62si4531714ith.131.2017.09.18.03.34.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34: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=FdOxwUNE; 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 1dttMS-0002Ex-Px; Mon, 18 Sep 2017 10:33: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 1dttMR-0002CI-3I for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:07 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id 20/FF-03454-2E0AFB95; Mon, 18 Sep 2017 10:33:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRWlGSWpSXmKPExsXiVRusq3tvwf5 Ig919Whbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bbbRdZC1oEKk5O/cfSwLiat4uRi0NIYCqj RNPn32wgDovAPGaJBX+nMXcxcnJICPSzSmz5UgRhp0m8mb6FCcY++HEqUAMHkF0h8XGrC0hYS EBL4uip2awQQ3cwSTQcWcwOUsMmYCIxq0MCpEZEQEni3qrJTCA1zALzgRZP6mUDSQgLpEh8+b 4RzGYRUJW4tv8UK4jNK+AjcXRLCzvEXjmJm+c6wW7jBIqfX/+AFWKxt8S8X1cYJzAKLmBkWMW oUZxaVJZapGtkrpdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERhwDECwg3Hx2sBD jJIcTEqivKKR+yOF+JLyUyozEosz4otKc1KLDzHKcHAoSfDGAQNYSLAoNT21Ii0zBxj6MGkJD h4lEd4UkDRvcUFibnFmOkTqFKMxx749t/4wcXTcvPuHSYglLz8vVUqcNxWkVACkNKM0D24QLC YvMcpKCfMyAp0mxFOQWpSbWYIq/4pRnINRSZhXDmQKT2ZeCdy+V0CnMAGd0rJjD8gpJYkIKak GRp6PWQ9FwrZ5hzpsaiv7O31GUs6R7S+5l048v+z7JK2eBeI9Gx7u4ZcKyxbZMJG1qlP/zp3z Tw9aH3NXPrn35fmeVR6h+baB+pX2m43nssVbfVHNjOH8c0Iw1+VeRV+S39Y9q+SuJmWmzlgn0 ax2+nFYu1sCZ/1d3oCH7cresdPD1W3bOp3vKbEUZyQaajEXFScCAIb6aYvEAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-27.messagelabs.com!1505730781!117343733!1 X-Originating-IP: [74.125.83.45] 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 15901 invoked from network); 18 Sep 2017 10:33:02 -0000 Received: from mail-pg0-f45.google.com (HELO mail-pg0-f45.google.com) (74.125.83.45) by server-9.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:02 -0000 Received: by mail-pg0-f45.google.com with SMTP id v66so32057pgb.5 for ; Mon, 18 Sep 2017 03:33: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=1zZv5gMZFdWN6HyPnIRtGQbrCrYIkCirHr84Vy7ho9I=; b=FdOxwUNEC2zUtcqQo9tVVH8xWdyYEGHFKtoUBETKtgoESIHlugjC0KKufmmSfNPWaE IJ79D3RypDqEUpdbiRoikEkD8lEo3RX1vgaPx4mJQ/HUEDGs7VPHCYGjAlokZQLyf254 pXXVYkke6+O5mYJN54WCrUpx2b8OBcRk8Fr4g= 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=LPHFazvBVXO7zvxu8DZfz/E26jRavpx11SXLiwuTMzslv3Dw58WT4nSHs7Nd1lXz+J 7vyF/K1eKKGFO9P8vP7TSMseTrtzCTZLJpHWltInkrsXXttBeBC/4bmx4mQRNgYYH7QO z3+d6k2HSN8H7KpMxwPgRnVvNYaX24f1qTlhzAjn+6E8/rweEX8FFDUvtjR/OWsad+Q3 bL+rnuuk6J+CzE/1EOAWL44CXdQ/QlLNPKzZWgmZywpVO+JhKUsER/Iqr65CA7fggaej dKa5a0a1u+5ZWeM+8X3fR8gfk4W+KjkbbDu8RucX7HIvYxnSSjIxAkk7JlcGGLy1/KJ5 QJNQ== X-Gm-Message-State: AHPjjUhv7W66N53pL++CW9GsPHSGBoD07dq0pRfWGzyqeR9hNoJXAmR3 l+vQAKr8JOgtuRuQZCCItg== X-Google-Smtp-Source: ADKCNb62Aj/aau69u3L29xRzTvqTZ3Zbl6kgV02oB5nn4anZROPwTfx73afZY2uml+nje7cGOB635g== X-Received: by 10.99.172.69 with SMTP id z5mr32012940pgn.46.1505730780937; Mon, 18 Sep 2017 03:33:00 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.32.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:00 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:58 +0530 Message-Id: <1505730731-10947-15-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 14/27 v9] 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 Mon Sep 18 10:31:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112882 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501083qgf; Mon, 18 Sep 2017 03:34:46 -0700 (PDT) X-Received: by 10.107.197.198 with SMTP id v189mr19664361iof.94.1505730886596; Mon, 18 Sep 2017 03:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730886; cv=none; d=google.com; s=arc-20160816; b=SjZgcVTtCilehQ31ZpvIvmAClyTJnFQPsuPyIhW4NfqgLSizcxGeqngcmbCJEYRBmU y2IGkC5Id2pOzV26bqy6iloyEzPG9n4Jkeau/bOBbzkrDQ25RrLPVd6glH3eVJzIUeRO idL5mBtSE2aarZAsG/nmRgGy+C3QvvOpmcTGqexddJFAYfCjyZsjSVmnI+NyhtnXSETd XtNhBK2Og/DacEWmi3BKNhPRlTMzxprjGLQ5/gg174smXGr+UCk1t+RS1XAFWnwT/5Fb M2J1o0x2ZsangirHIEt2AEAarU7Bg7Icgg7+Pgjwq4R04xmNSRBF7Zz63yn0UNodGTBz Qe2A== 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=rDXAE+Jb7oXDRxHW8M69sk3CLQB8tnkfNRAymsmlhYLKlJMsBMHOYWpOkxGKlOcJyK JTN1dZRE3QxPjqJHdQ7U9YXHynvAGpC4xQpLBPM9KwidLN9HHMCc4xWiQ9WpNUya0+j+ ToOQaqox21zQlgdSi4c+WPJftyaMTKHHueRk4fuHRqDNfaVFXTykA+QKI3hjiCfy8H0R RmYAS5wqvuYv0RM0UetBEjlSKqkTLV7voWUU2r+Exbg2p1gvS3Ro5haOHkS+jAhQyYu0 zWotybsnlq7IRMgLuaZsvumyeeAX9PQgyVj4Fdc0+KOqEUeEsJd0rORUuCTwT/vgHUK7 0rzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IjP9ng1k; 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 3si527643itx.160.2017.09.18.03.34.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:46 -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=IjP9ng1k; 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 1dttMU-0002Gv-0o; Mon, 18 Sep 2017 10:33: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 1dttMS-0002Di-3m for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:08 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id 95/BA-30688-3E0AFB95; Mon, 18 Sep 2017 10:33:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVyMfTASt2HC/Z HGvxZaW7xfctkJgdGj8MfrrAEMEaxZuYl5VcksGYsfH2fuWC+RMXEPbcZGxh/C3cxcnEICUxn lJj+5w17FyMnB4vAPGaJzZfNQGwJgX5WidbfLhB2msTZc9uYYezTM3qYIOxyiU0rehhBbCEBL Ymjp2azQgzdwSQx9e9zti5GDg42AROJWR0SIDUiAkoS91ZNZgKpYRaYzyjRNKmXDSQhLJAo0T zpGyPEEaoSTf+vgi3jFfCRmHBmCdQyOYmb5zrB4pxA8fPrH7BCLPaWmPfrCuMERsEFjAyrGDW KU4vKUot0DS30kooy0zNKchMzc3QNDUz1clOLixPTU3MSk4r1kvNzNzECA44BCHYwNm33PMQo ycGkJMorGrk/UogvKT+lMiOxOCO+qDQntfgQowwHh5IEr9Z8oJxgUWp6akVaZg4w9GHSEhw8S iK8FiBp3uKCxNzizHSI1ClGS44Ldy79YeI4sOcWkOy4efcPkxBLXn5eqpQ4bx1IgwBIQ0ZpHt w4WHxeYpSVEuZlBDpQiKcgtSg3swRV/hWjOAejkjDvl3lAU3gy80rgtr4COogJ6KCWHXtADip JREhJNTD6mL75Os3JIFw7Pz5cKEfzjMAtHiMtoebyZV1WPzdxNMQ8cFpwW3J/8oG583SuBgob FkQ+mfKwZ1aS5Jwea4+Us/3/HEMzfqx7kc4QIVun/uzh4/BldXMY/v9r9uucJbeUaa5j1POmS 48PNM4vjT7o+mb6UzNO6XPGj6bk6J/ayslou87t/QclluKMREMt5qLiRACzQhz8ygIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1505730784!110410598!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 27765 invoked from network); 18 Sep 2017 10:33:05 -0000 Received: from mail-pf0-f169.google.com (HELO mail-pf0-f169.google.com) (209.85.192.169) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:05 -0000 Received: by mail-pf0-f169.google.com with SMTP id l188so30493pfc.6 for ; Mon, 18 Sep 2017 03:33: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=6YGovVGluRqECYuWlBHwMmYrCh73aradxIet+Hw08pw=; b=IjP9ng1kGvmq9LzCAG5mZlnCzXSLf8J+/7eTPlkbilfc2o82u0n3D+vCsJNDHrd0vX rMEuRR3cluBx1QhRNIQ9TdrmQqdC2bJTHQ47/zLGTld3wVhUgM51B0oWbnDTW+ayFaaP YiYLdQEpqU8p12oIPNYvhNv63TbosQ4jU+bVU= 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=RhwavrrCapQAieBHjQgxNtpUQBNG8FPXO9qGjPH9+bhbSRHLhPX2sWs7DqGPWboXlV IewwbpRT+APkzLkO9rhmdYZW6XP/rncCBXpt4EhdcAq8qdSIgw4v4DE66C0HVmSUdng+ /iIYsqxCR79cG+LSxPwKf7vb/F9Av+infTG/glg1BOQQRDLj6cz+DcvVGMBY5v6tb8Oe R7iiXw3oyPgqw5LbWhahlCS3g6O8S5pP1BblD12mfQW0gpLRU2Qhbxfd5LcTH02y9x+K PDYZRIE6lu4WmE+P+chVTLeFX9Nxxx2+xx/GbwSEtMqCdexTHqYnmWSa0HNq/LE/dNFM +fEQ== X-Gm-Message-State: AHPjjUg6FAdSgwDan03o6BS3LgUl9BY6otYskUSQn3Lma2Pq+l1kNVZg Ymg3Fl3qWvQhH/MdFuuVJA== X-Google-Smtp-Source: AOwi7QDMwRXJ6ymuFdrwvUaHDi6oWjj2flyKm7UdqAnsuvai3yGUxktQotvl3+bN/d9N38jojYXECA== X-Received: by 10.98.40.3 with SMTP id o3mr11433431pfo.317.1505730783931; Mon, 18 Sep 2017 03:33:03 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:03 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:59 +0530 Message-Id: <1505730731-10947-16-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 15/27 v9] 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 Mon Sep 18 10:32:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112881 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501077qgf; Mon, 18 Sep 2017 03:34:46 -0700 (PDT) X-Received: by 10.107.149.143 with SMTP id x137mr20627903iod.266.1505730886213; Mon, 18 Sep 2017 03:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730886; cv=none; d=google.com; s=arc-20160816; b=kCxP4vMG1qMYDCWUoUIQeZSqhUeHKE0DQWr1VByj8C2EI7O11LTjYO3NhNhOgXK7w8 uRyscllFyoiggOzkxcNaFNhERsYAsLPgPt3kWn0D5V4SURGxu6qbbQpsVw7vOpNa1L/s 1JNil94OBAOdnYSwFxQvcgfRIfcPQPWmnoLae6c5PhyS174QXVgV3Oj8xaZ8/nqQABqL Ca62ubZZJQVnV8J3OqBskKj2t8GiR1V2x5UFQD29eDOYAXsGINegsfI8vyoeOyqtCz66 plDLx5pbk0MFopeSY1gFGTODGr/aLDgikU8k2pa4os3RhTxc4ysPXIfvfX3KS6x6sT0o Ok6w== 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=ANhoXhtb2JOPUhsbrI8Y3TMIBLAY8WcbbiLo1jdfJiZzqZ18pjw9ihD8UoM7k9RvE3 XmGNkfkJjEmpuxY5MISGWvEwX/ZcYDsVvY9NnvLmHmyuxOzDpfDRLRA6cPO47Yp+ac+2 XMyT4P6fINjo6kJ2STY0gvjsGReRRLkpvVm7wUntvdckMfAeqjarL5ap/OOY4rFY+9Cl QrpdYcyDC4qF77Mla/C6dARKc/U9gjWsYhNt8wntpb0mkninaL+z5gxV5dhQILOwR9q4 J4O1P6GnHE4sXAwBDGSbYisD9jIeoHHSTWNPm2M6RxAH8v+b+Hmq9bpqYEN/FqAQE82u t3TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VwLnr/C2; 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 v132si2827903iod.87.2017.09.18.03.34.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:46 -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=VwLnr/C2; 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 1dttMV-0002JR-9d; Mon, 18 Sep 2017 10:33:11 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMT-0002GF-UZ for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:10 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 6B/EC-02224-5E0AFB95; Mon, 18 Sep 2017 10:33:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEIsWRWlGSWpSXmKPExsXiVRusq/tkwf5 Ig/W71S2+b5nM5MDocfjDFZYAxijWzLyk/IoE1owLm3QLJotX7P/Qy9jA+FOoi5GLQ0hgCqPE od1tjCAOi8A8Zol7u44wgzgSAv2sEusXLGLpYuQEctIkuh9OYoOx33S8ZYKwqyRu3pgAViMko CVx9NRsVoixO5gkNjTcBiri4GATMJGY1SEBUiMioCRxb9VkJpAaZoH5jBJNk3rBhgoLxEus+7 2aEcRmEVCVaN6zkh3E5hXwkbh5eTrUMjmJm+c6mUFsTqD4+fUPWCEWe0vM+3WFcQKj4AJGhlW MGsWpRWWpRbqGlnpJRZnpGSW5iZk5uoYGxnq5qcXFiempOYlJxXrJ+bmbGIEhV8/AwLiD8fdx v0OMkhxMSqK8opH7I4X4kvJTKjMSizPii0pzUosPMcpwcChJ8IoDQ1hIsCg1PbUiLTMHGPwwa QkOHiUR3nXzgdK8xQWJucWZ6RCpU4zGHPv23PrDxNFx8+4fJiGWvPy8VClx3ncgpQIgpRmleX CDYFF5iVFWSpiXkYGBQYinILUoN7MEVf4VozgHo5Iw7yOQKTyZeSVw+14BncIEdErLjj0gp5Q kIqSkGhj3/Vu2Tywqw6fnifOS4Lb1Eh8O/cr9VBLFzh728uEeQSbb3jD250I8i+WiWnf4H+Rh Ey678IYlgWd3MldxfZhaQYB13oGIORyM6pweLZK6F1KvLuRYMMVwa2mN77nmnY4fj2z24lp76 libYI6JYpWksKYu49+buvycjTtDKl9PU5Xcn29WqsRSnJFoqMVcVJwIAMZClSDFAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-31.messagelabs.com!1505730787!84414138!1 X-Originating-IP: [74.125.83.45] 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 59635 invoked from network); 18 Sep 2017 10:33:08 -0000 Received: from mail-pg0-f45.google.com (HELO mail-pg0-f45.google.com) (74.125.83.45) by server-11.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:08 -0000 Received: by mail-pg0-f45.google.com with SMTP id 7so22948pgd.13 for ; Mon, 18 Sep 2017 03:33: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=YOnVbf2KQHJUvnXkY+8NWwhSqgBo0gewN4GYDNIiV08=; b=VwLnr/C2tamQzJJsjw7K9zPy3YPr4EvSAblUdS3wzIUQE6bTsjNNYh6ux3HTLQBasl qww8UAK1Yjfpxlw32IY7P/zPJihKgHTevAvTYGt+A+Zalq8W/dUZ3QBNd4Zd3uzEWvgJ zFmDfXu7JIYViAW8LqnwxU+NlFZbTbaP4DSDQ= 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=LmE0Vi+n+g/ZXcgUsK5VdfiXncb/BPtqqVfQiTdviRJjXEyXdHwVqPeMZE+e9PUpsa LjY4kA0OgHuHS1sANUtJ5nzJENsNxXST17sGMsmKnzMDngCdyD9PkSHAc8LiMDMKI0pL 1CjJgZUjXbGyAynJO6ZeJDnNMe/veB9fuC85IGK2HwoXSk2lmjk015pHj0v4Fsvn16mI 2/Z6HOSxmGjA7C/e8UHVj+lD4KV7e+mAubdQmWdc3qKdITRq6Ke3PW6Ao6bBzTDjv+MH svEKhHTyOEs0r9UeFvf3cl9hRZnzXgrxWR3vSRIswu9CkluIzjWF0Q3pI5/t9zQcB/NM B2Cg== X-Gm-Message-State: AHPjjUjw+9fRccnXtII4p4oRbd64K2E0ZLotH5wasHAyPbDefWWmhYcl G6+pEVRLGjUyzbnegAorDg== X-Google-Smtp-Source: ADKCNb56FFnTxyEJdi0O0GPNAKTzJCfeuBd+va4bNgCei5QoCl0YNCmrjhRsuQRckXnYW48qaz8A3Q== X-Received: by 10.98.139.134 with SMTP id e6mr32650902pfl.259.1505730786933; Mon, 18 Sep 2017 03:33:06 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:06 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:00 +0530 Message-Id: <1505730731-10947-17-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 16/27 v9] 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 Mon Sep 18 10:32:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112879 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501051qgf; Mon, 18 Sep 2017 03:34:45 -0700 (PDT) X-Received: by 10.107.22.65 with SMTP id 62mr1962256iow.269.1505730885093; Mon, 18 Sep 2017 03:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730885; cv=none; d=google.com; s=arc-20160816; b=N2dYfAqDsrosJMbFyUSIE1R7yedyembE6V8vdY6ko2xfEJdHz+v9zaDIMJiGUzp7T4 D2hHSvkdKjpV730bewKhKd9prDjThplmhC4T7Obq9gm11qs5p6t6NNcT/xkKEAeFsopI 7TJD+Zn37u9NyE6XDMSGfAPbylxFojphMtvX6bJvgQf+H1XG/fdqZt6bzmrxvLMWG9ad 3Kz6XwNeDbpDn3l13PL2CMLxWcRYS/Dh790PKRuhvsfmdmEzBPrFgrvanLk/S4m8VnbM 7OD3QnMT468xC+xIMGBnqApltMmU0CefDjDxD0ubHg2oidBDYeXktVdcvMlY8an0djsx NiVw== 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=dhxEs4CbyPU/EK3CIrN/Fv9hRJ2Vpxe72N4PEtvQUQmkc/7XlV9HvfUY3GTyvgXYO7 j4wZYf2X+GeZkUqLNdhjZDskNaM2md7VcHpk1jfGtL+OxQW3sv1bDdwS8m6ZZtDBo7W1 xK9UMK0kLNZJYP8Ib1I90+yVZbuyVs0E0vH4XxKAl/M+WiVzY0hKrpwjNG3hC4KAR38N PeCK64IYdCS4LjC1db4+FnUCZNu6cj9nPsWXItT32QKlv4wVXFn0sPK/l5QK/hkcGuFw 5igpxxyUJ/YpjfcEZP8pKM+e7zF+TzjmLzf/gcM5uDxfi7gBngNiMESOgJX6vRqWLIu7 TlSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Es444/zX; 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 s5si4420302ita.64.2017.09.18.03.34.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:45 -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=Es444/zX; 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 1dttMZ-0002PX-IC; Mon, 18 Sep 2017 10:33:15 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMY-0002O3-OW for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:14 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id CF/A5-03422-AE0AFB95; Mon, 18 Sep 2017 10:33:14 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTAKt3nC/Z HGvQsFLP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDNmrbrCUjBBoGLF1/0sDYxbeLsYuTiEBGYw ShxdfI8ZxGERmMcscf3lWzBHQqCfVWL3zgksXYycQE6axPn7C+HsSc9+sEPYVRKL9jxgBLGFB LQkjp6azQoxdgeTxP0XrUAOBwebgInErA4JkBoRASWJe6smM4HUMAvMZ5RomtTLBpIQFoiTmL ZmGiuIzSKgKnH+zRWwobwCPhJ9b89BLZaTuHmukxnE5gSKn1//gBVisbfEvF9XGCcwCi5gZFj FqF6cWlSWWqRrrJdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERhyDECwg7Hjn9Mh RkkOJiVRXtHI/ZFCfEn5KZUZicUZ8UWlOanFhxhlODiUJHjFgSEsJFiUmp5akZaZAwx+mLQEB 4+SCO+6+UBp3uKCxNzizHSI1ClGS44Ldy79YeI4sOcWkOy4efcPkxBLXn5eqpQ47zuQBgGQho zSPLhxsAi9xCgrJczLCHSgEE9BalFuZgmq/CtGcQ5GJWHeRyBTeDLzSuC2vgI6iAnooJYde0A OKklESEk1MGqrtj7x9K978H09R38Hyzkd9z9R65qvbOrysU7SqJQ+Icqt9MJoltbs+fGdUasu bqt/xR0gUOhauTbyQL/cFRcvgZI7+8IUZWZe8gkWvfigu2zdzerZx0pqWRTuf/s+JyD95dPPJ z8mitawNXQcX6Sx+eykah2zUxzPP8pJBrs28Fbaz+P6ocRSnJFoqMVcVJwIAL+0UXLLAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-6.tower-21.messagelabs.com!1505730790!60301954!1 X-Originating-IP: [209.85.192.170] 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 58324 invoked from network); 18 Sep 2017 10:33:11 -0000 Received: from mail-pf0-f170.google.com (HELO mail-pf0-f170.google.com) (209.85.192.170) by server-6.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:11 -0000 Received: by mail-pf0-f170.google.com with SMTP id d187so25280pfg.11 for ; Mon, 18 Sep 2017 03:33:11 -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=Es444/zXtl+Yv9d5Vtzom55XvY4vvXYOEJz1rDGz+K7+FgFM6VTn0P1SstaI3Qz2/9 cNW5DWYyPKmS3OgLulw19kvR8SF98c3cvi9QhI5vFVQGo4FaZxq54iUr3Md1DTazp/qR n2poLHJ5j5sIkyq9hQ5xQji6lMJJbettR7e4k= 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=GIkwjJU5iM9YDi3+ReKtdS0qP4jTKBgb7cGOwMKrd0uPi75kTq9amoJlxFmjyZ2yAq u+QbcJFpbWja1H/hrN1Bsr54xUCI43ntK1x7jBBsVQyHNYpzJIfuVN98wrFURLt1rbFn uuV5fKe2TY94zHRhz6EV8WWU12x1p5BTTeBjcCUozBOfpZLh6gtLw04lKT/ETSKkpGlo sUimcHr+dngPJwdRf32ngGVXuep88QHsPmj4EA3orPFDJlH8Unih5vF3IVucsEVNirRt LLtoWCnNs5AMy6l34yXvvnUzo/QD89vWMDLZg+u21TMpa5RbEt0AI1P+eYcBCSBtDU/i 1VEg== X-Gm-Message-State: AHPjjUgwY+tl7Lt4MbiACIsYpflWDy9P03RU0i5KrOfjYKrtJlAWnca7 tE8NoS57xl6ImkKKxtxwvg== X-Google-Smtp-Source: ADKCNb7wO10aZgvuwVBG8jNK2s/m44WbKrlsBE+Z4D2f/AT2kg5OmVCZmaWvliIcGgxA3RSJ+tdq/Q== X-Received: by 10.84.129.193 with SMTP id b59mr35024711plb.64.1505730789616; Mon, 18 Sep 2017 03:33:09 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:09 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:01 +0530 Message-Id: <1505730731-10947-18-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 17/27 v9] 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 Mon Sep 18 10:32:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112877 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3500989qgf; Mon, 18 Sep 2017 03:34:40 -0700 (PDT) X-Received: by 10.107.132.87 with SMTP id g84mr21249110iod.272.1505730880276; Mon, 18 Sep 2017 03:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730880; cv=none; d=google.com; s=arc-20160816; b=scqAtrgmFs9FMFh5SeCadHwB66Vt5d/T/r7+nsIew88StN1CVQpgwcNEz4lTBqYyHl WZVHJTq+mrssISDOMDOwXqPaeuJEXc3VrxMxXmqW1jZr+qFt2QO/2QoGf/K6BCcJOW7x YNOfn04DjBoMtDNVjRskiGhLyFn1HARrys3ZAyuLe6TdtIBTcsZQz3KKgPbN389N3bKa t5sAkSEMO4rncDO7KE+bazEzOgx/CwE4sStqxwVIrdhlFGZxs+SNtbnIu3IVkqCHU3Tl +O4ycjednDPAOEUIT/hGL35PxFZARm2ETYsMyBHx7kdMP6ckgTIhABUhOFgNnPM3KPaN 8oYA== 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=jNeDlR3nnNIv8C80edgyeQ+8uM/0zvuYTMYZHThRRXlNOkgdM67vA7JJX6MZtgczj8 zVLZECkhTtag9cXDLZcYCWxlVYLTwcpHMPgeDUpxPp43YBcl1jAA7AxafpTov3Dd2sC9 SDcmY/kGV+lpfRXzO7i5ej2457AuBviUSR6dafLn8mVYjNDWGg3vt5xFyLb0yuba/Rfh 66Q50sOwTh9HcTIwJLgMabfMy00Xjd3kq7fns8cEjmBcwBCB053RK0enfYaVzY/OZ7F6 jfym8n3b4qn8ur7FnOLZp2IlvT/6NEaaEPJbIz9JCUKbo40+1lZXYhKu1mEaB7pUODgE u1og== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hCJEldLM; 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 134si5323880iou.189.2017.09.18.03.34.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:40 -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=hCJEldLM; 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 1dttMa-0002Sa-Ut; Mon, 18 Sep 2017 10:33:16 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMZ-0002OZ-AD for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:15 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 22/10-17770-AE0AFB95; Mon, 18 Sep 2017 10:33:14 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRWlGSWpSXmKPExsVyMfTARt1XC/Z HGkz4y2XxfctkJgdGj8MfrrAEMEaxZuYl5VcksGYcX7uMtWAzd8WElZENjM84uxg5OYQEpjNK TH2c3MXIxcEiMI9ZYtrpfhaQhIRAP6vEq+VCXYwcQHaaxKF34hDhNInrT/cwQ9gVEkf/zWGEm KMlcfTUbFaQOUICO5gkDpybzAjSyyZgIjGrQwKkRkRASeLeqslMIDXMAvMZJZom9bKBJIQFoi W2zToItpdFQFVi59YLYHFeAR+JK3d/Qy2Tk7h5rhPM5gSKn1//gBVisbfEvF9XGCcwCi5gZFj FqF6cWlSWWqRrppdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERhqDECwg3HeCf9D jJIcTEqivKKR+yOF+JLyUyozEosz4otKc1KLDzHKcHAoSfCKA0NXSLAoNT21Ii0zBxj0MGkJD h4lEd5184HSvMUFibnFmekQqVOMlhwX7lz6w8RxYM8tINlx8+4fJiGWvPy8VClx3ncgDQIgDR mleXDjYJF5iVFWSpiXEehAIZ6C1KLczBJU+VeM4hyMSsK8ciBX8WTmlcBtfQV0EBPQQS079oA cVJKIkJJqYLR1nljp6O6acObaz2Wq3pGnV77zc5O8VhNb66Ch0lz1WOV9fOva5z8K5FVfb4hN OsayU952Q0GAXQDPagOlU9NLT5bpJge+fBAuXuF4Y4qC0AIT5XtFKfctYrUYrXlLCn8V/dmiv Kjwi83NS4VTdvxkmuzpfChjWYKXyK4tOtd6ecxfCvZMVWIpzkg01GIuKk4EAJqVDsHHAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-21.messagelabs.com!1505730793!83225608!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 5751 invoked from network); 18 Sep 2017 10:33:14 -0000 Received: from mail-pf0-f177.google.com (HELO mail-pf0-f177.google.com) (209.85.192.177) by server-9.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:14 -0000 Received: by mail-pf0-f177.google.com with SMTP id x78so26343pff.10 for ; Mon, 18 Sep 2017 03:33:13 -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=hCJEldLM7jQpF6ZYxcfsTb8JVw7ipfVEr2xIbeMH17aPK2lKttZPTMVvohresDiLJD mbZFRDaJKmUmZNpmbdTcYFMKsZ6ru+unjvt8w/4ja5OfTuGPni8NqcYtd7tIdNEKOvlH ejhi5nU/mhAtk7pjyjzFEg41YRnp+PgqLt3ks= 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=rvdL2SqXDQOjrv/dUZI1GGFO0BtD4Gb24DnXviWzt2J0lU7xUJVH1hFor+qgWxgmOR jaa+4dsIERLDc0rALP5wl4uZLwdd4aMTTMiMNxGVX3XupDa1WNOcFeMig9Z1mSxVpBgl r+b0UuqqHlhasL/ygIyTGV+9eIA5QuaMlar6Xa4khnxMo6JNMNYcraolQG4RWY5G0mwJ cQmlk34qviqwiuyoBE+5pmfdJusOoS+HDe6Y1uP3rKxGffhh/Y/o7yIxy+yhiBoKQQ5P aqLDj228Lt2MIGvJxMEuG+3YuLtRolhHITd6eukyLcKN6MkUxG5WMFotJC1wn+8k/nEy czrw== X-Gm-Message-State: AHPjjUhZuB8VrUP4XKP5+BaGVEJH2BPQGDtHy/Vlhqn5G36qJ7t4dxS/ V65JGuFQa8UDpLLX4fMJUQ== X-Google-Smtp-Source: ADKCNb4ktuImSYdGwbyCrYIJnMzOhxPqaQOJ6WeAvnlvMFJM0T5IVtZOFvUQg+SCc2XyxDmhDlcVXw== X-Received: by 10.98.23.10 with SMTP id 10mr32680703pfx.339.1505730792369; Mon, 18 Sep 2017 03:33:12 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:12 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:02 +0530 Message-Id: <1505730731-10947-19-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 18/27 v9] 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 Mon Sep 18 10:32:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112885 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501115qgf; Mon, 18 Sep 2017 03:34:48 -0700 (PDT) X-Received: by 10.107.23.130 with SMTP id 124mr18823775iox.279.1505730888251; Mon, 18 Sep 2017 03:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730888; cv=none; d=google.com; s=arc-20160816; b=Z2hgrPMGQ3fvCw8fn18WpfDsZYaqr2GfWYOqWr55XZl0Fk447Uz9dB3MHpKYbacihA GpRbRRb9OKVFSHqPxRCz0oNUGqo+JsdV+HHH4bEEEfrHacXiGZ7nPgFXY5iNdjoRZ2eF o1dTFJPclg/5YYRdQ1vD9d6LWRYFXcT761l8uBtetlfdPN8oxS9CG1NiOs5MZiwod/BI 4bBS9LnjoCpvP9YGkUThOUK1wmFV6g2cdUxp80jrHxLQJhcgftdnUs07mzF6knoyFwMl q1Sipdzmp/KYAVcWTQf8fpHT6ZVSSsymdxCIeGhm0YFAUMrMzfhJ8HKcArUJZHpSKTXL PKbQ== 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=T5cA7WbWgDtzGPk/0fv0R8sN+lUF3ko4GpGD0jzj8Zio8GuQOsBmT9WjUHqrzbnTHo a/RmI99sZ1gsMD500J3BYRy3TBHaPNmfWUfUvC/zv3kuOQNkGNdQjRCJsdjuThY9Bzaa BuS5jAFGfJE7EjK0mfoUJb4EIYr/uDDhjeLDGGUsMCnX7wLpIZiDHWEYe+RQXbsKuPeB QgFk+tuai8E/Jf4sBf42Axyn4hDeJTZuoaV8wbSqHyqmwf+630A8/9zqw8Js4t5/Zsa9 oWlFyu0LvX7CcX4eqywsVUgRL0lXxK6bioHsm1Y2dc6zFFMHqUr20Wc5YF4maaIBBzX+ zzpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fWttH9Sq; 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 c189si4536404ite.148.2017.09.18.03.34.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34: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=fWttH9Sq; 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 1dttMh-0002bp-E3; Mon, 18 Sep 2017 10:33:23 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMf-0002Y9-65 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:21 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id 14/BD-03642-0F0AFB95; Mon, 18 Sep 2017 10:33:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsXiVRtspPtmwf5 Ig3kzzC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oy/WzqZCyZzV6xasIWpgfEoZxcjF4eQwFRG iXWzmhm7GDk5WATmMUu821ILkpAQ6GeVmPjiIRNIQkIgTeLsl7ssMPbBa52sEHalxNTeJnYQW 0hAS+LoqdmsEFN3MElMu/sQaCoHB5uAicSsDgmQGhEBJYl7qyYzgdQwC8xnlGia1MsGkhAWiJ G4Mf8aK8QVqhIXPp8DG8or4CMx8eomRohlchI3z3Uyg9icQPHz6x+wQiz2lpj36wrjBEbBBYw Mqxg1ilOLylKLdI0M9JKKMtMzSnITM3N0DQ3M9HJTi4sT01NzEpOK9ZLzczcxAkOOAQh2MP5a FnCIUZKDSUmUVzRyf6QQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd7V84FygkWp6akVaZk5wOCHS Utw8CiJ8K4DSfMWFyTmFmemQ6ROMVpyHNt0+Q8Tx749t4Bkx827f5iEWPLy81KlxHnfgTQIgD RklObBjYNF6CVGWSlhXkagA4V4ClKLcjNLUOVfMYpzMCoJ8z4CmcKTmVcCt/UV0EFMQAe17Ng DclBJIkJKqoHx2I67Zao1y8z/qdyIv2+XFaC5zbj1/Qz+ky7rbm5T2OPRljx36uEg7VWBi3iY NWqn8L3QYDnTfdOpUKTaQ+WpwtKJWxYlrF/++63LtTmb7gZ9nmu5V89jUdfOHVVntnikuO35c cLpRFHtO/45bKXNoomL+C+1LjLb9++h0yLLvJzfRndtff+IKLEUZyQaajEXFScCAI+1RsbLAg AA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-27.messagelabs.com!1505730795!117343795!1 X-Originating-IP: [74.125.83.50] 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 18878 invoked from network); 18 Sep 2017 10:33:16 -0000 Received: from mail-pg0-f50.google.com (HELO mail-pg0-f50.google.com) (74.125.83.50) by server-9.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:16 -0000 Received: by mail-pg0-f50.google.com with SMTP id v66so32322pgb.5 for ; Mon, 18 Sep 2017 03:33:16 -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=fWttH9SqlTBV+dTiGvvx9yMdDFQFlEOY9ta7zwOQDjSy2RtP2FIcrgIBnAP4WdB4df XSC/N3/tRD8Y55iXzIMKPfv865EgeRegbs/l8c/Tb/HGahoCbMofo2k7MCiz/vm9E6M8 MLUzv6oilIKBYlnuT9qbQ/POblIhT0TU3JuYY= 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=tdveItxaH1bhUzy6haYKOKcgz6c9kHkSchLpsICFcoN0RabyzGCZknCVApeMwOg2zz szONZ+RZdXQHIGHsLaZ7g8FRQGkdB06ljf8YFjqFi4oA94mZ1viZntf9JIq+NUjQDRtA Yb//tJNLosxf0XuYFI8c2pojS8OFnie8mdWXl7nh4PQcVhMS71bZcxtLAZDvwujqJFjz 4tIid/KmK35mfKrYltg3C+JQ+h5q4He1lw+TyqyMfyiuMqkCgIrtNhu395Ao289Y2c4K HZsHAEATVgk8/4QR/baySy+u9O6hehBIw3DyTfpQpijROoB74aFMjDHdkgbbP4/HFb/f Pffg== X-Gm-Message-State: AHPjjUiOJU25v9gJlRFq6cs49DXwoTGripNkKZG+S8/2lN6ZwWIVQmZP hH6NVkJ8/0Z9pDvavXScsg== X-Google-Smtp-Source: ADKCNb7gNHzq4HxpbcSu+uUPICpL5e31CGu/g7ub/WF5SeAADq+I/Hkqk8gsgXA0Kp9EcAMBJal0Gg== X-Received: by 10.98.14.213 with SMTP id 82mr33015085pfo.274.1505730795302; Mon, 18 Sep 2017 03:33:15 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:14 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:03 +0530 Message-Id: <1505730731-10947-20-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 19/27 v9] 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 Mon Sep 18 10:32:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112886 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501139qgf; Mon, 18 Sep 2017 03:34:50 -0700 (PDT) X-Received: by 10.36.236.132 with SMTP id g126mr15118210ith.21.1505730890393; Mon, 18 Sep 2017 03:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730890; cv=none; d=google.com; s=arc-20160816; b=u5ZFPLqDZzZc08Yk1J1rD+GRrz85GzQVAnb52g2NP8/1DXOiAmIUbvDkDgHHIbffFB RqvFg52fMTFkwio6xFLVra5VapRUjsEifbZ+YFRaybSxY67yBhFFpVlg6R9QGyx5fYiJ gP0JJVlwTbxk11vvj7w9GaN/fSGrR/TsycZjObqbbgVPz3jKATfCWrHyP3XlfG6JccRz HuruCQ4lhyHdIeQa/fcaomO2+VvTC8/3NljDMesHcVYIvXkdZq6/NEA5pD9YHoSf66Dy CG5hZGm3VAVX2+0poHKCm0m/9yG4QhvPkm20qJoueaWASn7+y91HhXpt4sR15T3MPa6C DgAg== 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=HvBPj5sSV4i1assgmQ8C9D1oEkK34A1sqfPcL5W3mYNT3cwxCnwQ0D8z3Q7jgkvM3c B6FQnk88oQY0AFdqQjun5D+LQnbrp8KNGhkId/m05XCJI2pc4MBOfXrSTGFXIKY37d4C A5col2ethFWB5zxn6KClsM12OEtgaF1EfBBDAFrXsbnfXu4Tgc2+WvJcyc/bIIM1GBMX jrUExZ0Jt4u6LIbKT5u4O3c5fIeR78Izo20QT3wHsZ0s9fjHs6Lu04+WUmMPwzebZWL1 y4pivP/kSHUKZnAlZhxOL7eocfv24XBLvKlVmkfdFvFDlQNe+p+LJzC1x2S8lMU71lNl 7vYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PEr+ahUe; 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 j3si4402897iti.82.2017.09.18.03.34.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:50 -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=PEr+ahUe; 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 1dttMh-0002bJ-7E; Mon, 18 Sep 2017 10:33:23 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMf-0002Xy-4A for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:21 +0000 Received: from [85.158.143.35] by server-7.bemta-6.messagelabs.com id D3/ED-03610-0F0AFB95; Mon, 18 Sep 2017 10:33:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRWlGSWpSXmKPExsXiVRtsqvthwf5 Ig8VGFt+3TGZyYPQ4/OEKSwBjFGtmXlJ+RQJrxuMzF5kKfnNVHF2+n7WB8ShnFyMXh5DANEaJ udd7WUAcFoF5zBLH/sxmB3EkBPpZJb4smsbYxcgJ5KRJ/Dx/mxXGbj7xGyjOAWRXSbz8IAASF hLQkjh6ajYrxNQdTBLTl58Dq2ETMJGY1SEBUiMioCRxb9VkJpAaZoH5jBJNk3rZQGqEBRIkNq 3OBalhEVCV+PdsLtgqXgEfibWvf7NBrJWTuHmukxnE5gSKn1//gBVir7fEvF9XGCcwCi5gZFj FqFGcWlSWWqRraK6XVJSZnlGSm5iZo2toYKaXm1pcnJiempOYVKyXnJ+7iREYbgxAsIPx9saA Q4ySHExKoryikfsjhfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwrp4PlBMsSk1PrUjLzAEGPkxag oNHSYR3HUiat7ggMbc4Mx0idYrRmGPfnlt/mDg6bt79wyTEkpeflyolzvsOpFQApDSjNA9uEC wiLzHKSgnzMgKdJsRTkFqUm1mCKv+KUZyDUUmYNxNkCk9mXgncvldApzABndKyYw/IKSWJCCm pBkauVSu2dj9/v/CKisZRxktnPjL9n9TCfUt+fxsXS/F/TVW7nYl2Txem7bxS4clVWVm9QEQ/ kkWlyH6ulFxb6W+n5bGn8jtimWuueNss8vFf1lUr53bi+fuksvuXuD+d5c21OcCstFIg5cf1D 4fki+tTD6zudp3p0Ciq4fXtWkl8J9/0bZe4XZVYijMSDbWYi4oTAV48ptDDAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-21.messagelabs.com!1505730798!83243641!1 X-Originating-IP: [74.125.83.53] 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 23029 invoked from network); 18 Sep 2017 10:33:19 -0000 Received: from mail-pg0-f53.google.com (HELO mail-pg0-f53.google.com) (74.125.83.53) by server-8.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:19 -0000 Received: by mail-pg0-f53.google.com with SMTP id i130so34899pgc.3 for ; Mon, 18 Sep 2017 03:33:19 -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=PEr+ahUe/jxUOHXSDArrgoNeOPjAuVPosteyEWDHaM8sk8FwtiAaf3xFqvEGK0n6lR kH0+PWp6byRYAPA0KIg5loMAJyQZO57S4HqvHvAFbRYPVuxpqhvptC3SljubDoo2whvu rRzbuOzCiXQvtb+kALCUFGZqevJ2VcxHO/0v8= 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=i2Be6RJzxTPeG34U8pGjrFuIYwxfHAjktVrzjf8ahQx+Hnm1hTg83RC9I/jgN8oi7x hJV6G6wMu0YkJ3PX88nCMBZysW5YWNU7p0kyQS5jnBqKQ1f8lmmf1ZilmnTU0O3HGRAn hRiKVjsrQSoFZVcSrZaeQVREEt2PW/SS1FbtDPwdDnXY+VaMboVqv2BQ2wxQD3AB0ac9 uoNy8ERk3vKF9XrAIr4AOKZ/IzK0XrmEq0gZ4G6zRMDnvGOH43EfT80MJMxsAyFD+3AF 4/aXSQ++N/qC/lDr6AJbj7G4vZTkZhbl1iYGNLx7e/Kp5k9mFpiifluR93c1L5wuWO7y XphA== X-Gm-Message-State: AHPjjUgArMgvnArAdLowbl77aGtGZKQ2qHQYEhCkHoYTQyfaNNzp5Zwq FONXIArdQCBDDvH/FYtlxg== X-Google-Smtp-Source: ADKCNb6kbRRal5h7bQ0z44munpFZJ64DBu1Pr8KvYUY3bYXy+67h4epH/PXXapJZMJqq1UssCALclw== X-Received: by 10.99.160.100 with SMTP id u36mr31936798pgn.22.1505730798136; Mon, 18 Sep 2017 03:33:18 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:17 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:04 +0530 Message-Id: <1505730731-10947-21-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 20/27 v9] 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 Mon Sep 18 10:32:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112893 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501272qgf; Mon, 18 Sep 2017 03:35:00 -0700 (PDT) X-Received: by 10.107.69.7 with SMTP id s7mr4737055ioa.268.1505730900182; Mon, 18 Sep 2017 03:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730900; cv=none; d=google.com; s=arc-20160816; b=ZmZkC388XWhex3hZcXVS0mxF0i2Fuw38A/6NeeSsEbm+TQIg3BigE+KNzybNWX8BGr eslI4RUVBx/muW6L2JMbB+eMxwGbXDmbGfUO5+a6gCRnIhxYXsB+jCyfpqfo7VeFZyxb EwIgI7UO6UonFVyOrKfVpqlA4pT8weUKN2nLl9uuTZ1o99C16a5e/vp6nm7ZlbzvpGre FXSrw1OcoXHhV/Ri8637x8EgJ43X7gHhCSV4I5q9TXZhKQOyr7IkZ0BDnslLxmesFF6e RRsNW7tOJw/cf/T3yGmUTlUUjIZH6YE1jjiPzj5DszjbBBuKnNR1olZwnakrFNzwZhxm JM4Q== 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=BEXUkr5Zmm2R5CF4VsTT0yEmiok+P+hTQjRSaUqD/nuoytQpPO48E7gCeG6c/fGL6G kjz85H8BaYkfVW/ALkZF7CeMeVOxzhVM0W02ZOzNsjnpv/h1ZWcZGDDjbTjYFz2AT7ub 1Lsc5exg5PSNCWjZr/dU44l7FSfwgXF2I2Q8cHf3bwZuS0e5YflgGodN6Chhxf0kHqm4 ys16U5gosQwtNw2DYZFguh54B5gS/hBULGwmgZHrljqdJJH67owiHtX0iMkVDOtPHfvd WCjfnYMBTIvIdrCahhwukazQTSNa4JmWBw/zuLe4VYDanlQX9oB0nEUh2itIs0ur6WLV dKvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Qj4qeEd/; 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 1si4392843itj.128.2017.09.18.03.34.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:35: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=Qj4qeEd/; 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 1dttMq-0002oo-8y; Mon, 18 Sep 2017 10:33:32 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMo-0002kl-P0 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:30 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id C8/B9-03093-AF0AFB95; Mon, 18 Sep 2017 10:33:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsVyMfTABt3PC/Z HGpy8LmzxfctkJgdGj8MfrrAEMEaxZuYl5VcksGacv7+DveCBZ8W9bydZGhjv2nQxcnEICUxj lPi6pJEZxGERmMcscevQPRYQR0Kgn1Xi3ptdTF2MnEBOmsTz+wvZYOwLT6+xQ9hVEidvNoDFh QS0JI6ems0KMXYHk8T1L3uBijg42ARMJGZ1SIDUiAgoSdxbNZkJpIZZYD6jRNOkXrBmYYEoiY 47L8GGsgioSvw+3gYW5xXwkTjTt50RYpmcxM1zncwgNidQ/Pz6B6wQi70l5v26wjiBUXABI8M qRo3i1KKy1CJdIxO9pKLM9IyS3MTMHF1DAzO93NTi4sT01JzEpGK95PzcTYzAoGMAgh2M+z5G HmKU5GBSEuUVjdwfKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mC9918oJxgUWp6akVaZg4w/GHSE hw8SiK860DSvMUFibnFmekQqVOMlhwX7lz6w8RxYM8tINlx8+4fJiGWvPy8VClxiHkCIA0ZpX lw42AxeolRVkqYlxHoQCGegtSi3MwSVPlXjOIcjErCvI9ApvBk5pXAbX0FdBAT0EEtO/aAHFS SiJCSamDkuMzLIyLDOktrZokn15xLaV9vFAtGrpSVnnih6pl+6evkROVXGQavmJJOz7kUJiUq KJ24LWvvLqd9nvk3323amhXg1TbpY1TAv/VvfjjEtRRPmvE0pnFNugXvba79hhxdcn7Zk3db1 iQkTZfpqTgS68DYeuLMTC0BOdbQ/cuvKr+7LDjZK1+JpTgj0VCLuag4EQARxjZrzAIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-13.tower-21.messagelabs.com!1505730802!77486902!1 X-Originating-IP: [209.85.192.176] 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 62281 invoked from network); 18 Sep 2017 10:33:23 -0000 Received: from mail-pf0-f176.google.com (HELO mail-pf0-f176.google.com) (209.85.192.176) by server-13.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:23 -0000 Received: by mail-pf0-f176.google.com with SMTP id q76so35476pfq.2 for ; Mon, 18 Sep 2017 03:33:22 -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=Qj4qeEd/8Jk3RnvOsMJ7kQoPfrRj5t0YZ2x4TU0rRIsrx3VutXMrolmQXy8XWu4YC7 Jqu+/83j0WKNpbiOjONmRY8oUw4hy61tTLp9d3s5QWg7gf8FRjdhTuV9llwnPXlcR5dw qZ5tremSBzVtC5qaa56FLzGy72h5RdCgx1zR4= 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=jTR/jCNBMXw6oYhHZrhIka4agaDondXpjFpCDB1rW3lPM1Ygj6LV3gkW9MWEIKbsX/ QNmDA5cmZaWvDdThkGPqEGfO5f8CkJAFMPbwuUrBHKkNrxxZTIf00iQvVJbPZReYndVV XtpLPa0hzgSG/VbnrDveTNKbs1ExlaaQwFvizVn6lpV+HJbVWCQYzcqjFqTJBcoL4Ho4 ioCmiUtMgt99LIyxsVGwTKykTu919FHdS7BVPDmSaaBVMyFIWZuPwh9sQwGxjbfj/XeL 9bbLUSWPyJWKBjTI+ng9aZ8gmxNbUBBnFoBaqpOLMICajJ19e3hd/767xaozPW6Vj0B+ +tsw== X-Gm-Message-State: AHPjjUi9/3X9ZkYy6sfjlaI/q6x9eaW1SKu6yKZMZ5V7dy1Wt8fjKw1Q 0U9YUQPs5/6zJd9Kzgpn9Q== X-Google-Smtp-Source: ADKCNb7mTTNTKRTPiVdi4rCwdVr4PwMmDPJp9bhtxbnRI26mWwcpBWvmrLZKz2XxdOCPskSFlnZdmQ== X-Received: by 10.101.68.130 with SMTP id l2mr31939247pgq.346.1505730801101; Mon, 18 Sep 2017 03:33:21 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:20 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:05 +0530 Message-Id: <1505730731-10947-22-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 21/27 v9] 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 Mon Sep 18 10:32:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112887 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501146qgf; Mon, 18 Sep 2017 03:34:50 -0700 (PDT) X-Received: by 10.36.223.2 with SMTP id r2mr17762996itg.19.1505730890912; Mon, 18 Sep 2017 03:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730890; cv=none; d=google.com; s=arc-20160816; b=0xhytIB+2SPdcifyRVpK+Q+pZ4L7iQNrBOOv6SQ7DjHtzHMg3r28WLxciDLDo3nG/s ppwLf+kNmA/lVQvFAqEy7bryJninlpnLt6Z+fDVNdR4lFeoQSnolNAqMZdTXv6rpUmJv lntkKuMrUL/jOw0h7BiZCbMLySEem4lgtNxLnyCk6m0ngjnxis5FKYxsy68zCSb2J3io ksBrt/JQipTGxMFG11zZ2jdpbb6Y7R4/oSxHXBMKo0El+r2oQvAMEDcpOdPo318jpm9b 7Rg8evcDkTw2ommPEwXCdpLEsKvlMpiq+ylpz11918MDt36dJGVegFI0VweETidMCY98 OZCg== 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=NtbPnEhAMKIa0TwXLJ31bkWY6N8DP2RCD+y7jj8ouhI=; b=nFeapilCwLeXkkEHGOelPWDCNmiFIyY+vJcv9chldZcoYq2GwWualnKTqQrz+GeyC6 0RN1WC6abnogEEa0tx+TtL4ovSgPdtpZlHAUZlrn2hmZuwB3sIMooYj2Y5NiuSfjO6gy ihq2f1IqKRmkG4PfatWS+7oTOT5ICaWA0jW34fCKJop2ooTJMv6gnXidg6LoRetRD+9L dkHC7EgTxPHZk57m4L5lPS6lFmgnXqBXoHaBesJlJrQ4XFqdj+IYq0h/KovGpQKUrLyR 6jzAMp5lUs2+CC7uENQ22FTTUoG/bPZc80p7z5Eymcv5Yy0XbsCu66lcu8sSBhrTCnci 1c7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=M1kfM9Pm; 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 16si5537401iol.148.2017.09.18.03.34.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:50 -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=M1kfM9Pm; 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 1dttMo-0002lA-Mk; Mon, 18 Sep 2017 10:33:30 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMn-0002jf-U2 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:30 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id 5E/66-03422-9F0AFB95; Mon, 18 Sep 2017 10:33:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsVyMfTABt2vC/Z HGsy5omHxfctkJgdGj8MfrrAEMEaxZuYl5VcksGbMPLuYqaBBoWJTz1HmBsZu6S5GLg4hgWmM Ep/fH2YBcVgE5jFL/L52kL2LkZNDQqCfVWJxXw6EnSbR3vGSqYuRA8xeuTcZwqySmHRSDaRCS EBL4uip2awQM3cwSWw69RisnE3ARGJWhwRIjYiAksS9VZOZQGqYBeYzSvz/eYsFJCEsECZx51 QfI4jNIqAq8XhzIxuIzSvgI7Fk6XkmiBPkJG6e62QGsTmB4ufXP2CFWOwtMe/XFcYJjIILGBl WMWoUpxaVpRbpGhrrJRVlpmeU5CZm5ugaGpjp5aYWFyemp+YkJhXrJefnbmIEhhsDEOxg/LIs 4BCjJAeTkiivaOT+SCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvKvnA+UEi1LTUyvSMnOAgQ+Tl uDgURLhXQeS5i0uSMwtzkyHSJ1itOe4cOfSHyaOY5suA8kDe24ByY6bd/8wCbHk5eelSonzvg NpEwBpyyjNgxsKi9RLjLJSwryMQGcK8RSkFuVmlqDKv2IU52BUEuZdBjKFJzOvBG73K6CzmID OatmxB+SskkSElFQDY/XHg+bMLr99//dPT+r/5Kh672fJxk9GYTovtTf3yef4u9/feqrYs8Lw 1FfGz+8WH1ygWKMsP3fRFnXWs3KrLTYLCIm3LlNw5pu03nfKAivOjtPV8iU3H/n8zAx7krk63 v/NhcdKX3hPJF1R8GJK/eF7U0U9l2Xevintb1YqSHPOUbr8/Pj6ciWW4oxEQy3mouJEAJP0fc nPAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-6.tower-27.messagelabs.com!1505730804!117453157!1 X-Originating-IP: [209.85.192.176] 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 17725 invoked from network); 18 Sep 2017 10:33:25 -0000 Received: from mail-pf0-f176.google.com (HELO mail-pf0-f176.google.com) (209.85.192.176) by server-6.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:25 -0000 Received: by mail-pf0-f176.google.com with SMTP id p87so28135pfj.9 for ; Mon, 18 Sep 2017 03:33: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=Lo4OHtevPukx/SByq0doKClQ+61pfeNZRGftrLJvOWA=; b=M1kfM9PmxDb2QDciFKTDa+pJb34xWT4+3KAGxJcC3pG6aZqaBBJYHQODW5Xw0aEFhP gYwxTPQtISDBYdkb8N96qvcZ+r6TaK2reLGC6v3moBjV+FALIRmT+oOZgkglOvlq/CSt io1c2ArqwfxSOBc1TkH32MXo2QRwaqsE2Kf7E= 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=Lo4OHtevPukx/SByq0doKClQ+61pfeNZRGftrLJvOWA=; b=RiVYlZ/6VNWtBpqRnAblAMO9Hc7TCAfqUAjW3bwzn7RI+enJvI/Lu3MfJV573t4pcF QTHuGq7e9AdSbpeasorzDXnd36L4U+oWdNcR5O/eCTtaUt2SLgp45vS+LKH25n7+/QW/ AnF0QH0Zfhda/jEP2qWV4ZiuFgogoUYw6lXM2IX4EeEMjIkca4p/hqPsiHH68IRHZTNQ n0dsrcKxroe6A0gJqRm79S1OfuFN9M4UjKdAeUFVh48dvEu4wuNSgNKB4o9t61LrT+xM h4lGY0DkmHK/T5fa+KeGG30Ce2FhysMDai2IUyuj5Gpvjl+ceSpjDaZI9wJR+93VI2UC 96XQ== X-Gm-Message-State: AHPjjUiqIruejDYwIIOf1iOth0t4AEtO+8E+OdU7txPb6AqWZKTxzYWY t7nmb7AyWnnm6jvIFD7/iA== X-Google-Smtp-Source: ADKCNb42HRZurlTRMSaIvxt+mcYD6vykpWiMwP7NK33VXtJkfRYYGq9hbFr6jk5VAmOOTZKf/LYuwQ== X-Received: by 10.101.74.129 with SMTP id b1mr31525205pgu.272.1505730804037; Mon, 18 Sep 2017 03:33:24 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:23 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:06 +0530 Message-Id: <1505730731-10947-23-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 22/27 v9] 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 only 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 Mon Sep 18 10:32:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112891 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501244qgf; Mon, 18 Sep 2017 03:34:58 -0700 (PDT) X-Received: by 10.107.32.70 with SMTP id g67mr20132821iog.77.1505730898152; Mon, 18 Sep 2017 03:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730898; cv=none; d=google.com; s=arc-20160816; b=vI7Z/YIFp0MoGfc+xh/PsbsoMY6oG65PLAyS4EZFNOjo38TUnYUfCASdQKuCe56QbM kVfM9T+iPDgWWEdShP1vpo7ojazIz6w+2ljGofm9rVBtC2IJ5ps+AUw2kOXlaNX205Vw Wl3jt73zVIVCWNWLsLzqMzYcQKoWJuyhzlfN8EsCIl2nUCpgg1/CvtlMMm+GwK83rwuw SuDB+cxVYCMzXvG3qtQQRH9FCc+arb0xZtYbTgw5zBWoyGx1wUr8RnUoFVGTydnro17Q He2R1VzbrcmmyenOGi9y7z2Iu01zA/sCUJE+iXn+Qd7xgGQudhm1KkyYdT6kHJkgOoge 9s8A== 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=ie6qGAJUwEgvoQGEwPrrd+1282X+hLWj2ZbAL23mEUeu2jj7RZ6dDR31P8WswQUE2r +tt+fCD0PSV4UwDNtWy3+8BPGRkcob3pu/72GCP0xvWm7tyrc4tKYQNwlSHdLVS/gfwv aZe46mIzdY1oZqi31dnIg74PwfTUxvcfZiN+zeVQgmmOGO/INthHyz+SWJ40PSnAm2iH 0PSwLj1VZcIhlSjAmmrwUE5kKKof0da6v4wstOl3YbdjTqzdyr1OO9FDXTWazr5H/TlG EKuwB07u6/eyZIQ5NQXc2jtXINlq9lQj7/xqHW2Y3SkKtYSPxADHs7T4CKynlpmwiCw8 LZww== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=H229b+2J; 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 g199si4359793itb.97.2017.09.18.03.34.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:58 -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=H229b+2J; 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 1dttMo-0002lj-UI; Mon, 18 Sep 2017 10:33:30 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMn-0002jV-UV for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:30 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id AD/AE-01812-9F0AFB95; Mon, 18 Sep 2017 10:33:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVyMfTAZt0fC/Z HGvx6J2nxfctkJgdGj8MfrrAEMEaxZuYl5VcksGY0zlrNXnBZtOLc0g3sDYyzBbsYuTiEBKYx Skw5spwJxGERmMcs8ezCAlYQR0Kgn1Xi0dq9QBlOICdN4lvnYpYuRg4w+9kXHohwlcTz5yfZQ GwhAS2Jo6dms0JM3cEk0TC9jwmknk3ARGJWhwRIjYiAksS9VZPBljELzGeUaJrUC9YsLBAj8X f+b1aQehYBVYnfV/1AwrwCPhKvF7axQOySk7h5rpMZxOYEip9f/4AVYq+3xLxfVxgnMAouYGR YxahenFpUllqka6yXVJSZnlGSm5iZo2toYKyXm1pcnJiempOYVKyXnJ+7iREYbgxAsIOx+YvT IUZJDiYlUV7RyP2RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4380HygkWpaanVqRl5gADHyYtw cGjJMKbAgx+Id7igsTc4sx0iNQpRkuOC3cu/WHiOLDnFpDsuHn3D5MQS15+XqqUOMQ8AZCGjN I8uHGw6LzEKCslzMsIdKAQT0FqUW5mCar8K0ZxDkYlYV45kLU8mXklcFtfAR3EBHRQy449IAe VJCKkpBoYZ2y+uVtx95Il57K7D65YkPh9T7OFHet6g7+HZ16On7K9d1a6U//SlkOnpq/0u+4m UJkQP8mSQVJjZ6frrKv1DkIanG5bXq23FD6hfaeU/2vTokTVlKYDlx6nfHm31qnT6py3nC/T0 pbgbAdVuUc3j5XxN3Q7P3vQk1eY6n24Q0vCOb7yqbauEktxRqKhFnNRcSIA96s3kckCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-14.tower-31.messagelabs.com!1505730807!115127721!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 62668 invoked from network); 18 Sep 2017 10:33:28 -0000 Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by server-14.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:28 -0000 Received: by mail-pf0-f179.google.com with SMTP id q76so35570pfq.2 for ; Mon, 18 Sep 2017 03:33:28 -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=H229b+2Jdrk+ZMUQ5y+af84pyXhM8Ix2mUUnjnewhYS4qDQB2u7to6t8XrMNREXXBA IzZQb+dQsv7zdw1btt6DgHSd74WSZGO//RSHDQa2s+JZwR55eczi2r2ZJjED0nYQ2Ntp 3ezMkyQq6uUrEPIiR+cPSEh7wWgj6iJ4xhViE= 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=ju2cZJL8kG6ApOvbCHNP73j6kK3ZZdmixcsx+9pTGxnjV6louwY/ibTVt3sQvBmS/X q7rJtniFI04SuR9qRX2Qkg/Rpj3XSL5ld4x29HgwG3pITFC6OPfXwbVrutkguq+resxh 3OPDgTQz45kLd/64HjRNS7f8uGnTglRlVj9r1KXppS7Jg6t2zqWvfEoC8cMRC9Bcq+LL 0aW+Bw8eDldPemaCikZaJbtU8daptAJNI2Lr2HacswcYLv9fGcT3Pi/83/KVXfWqi03X h92es7RzKWXOtO4SMycVoom4GZfJojnxqO8UqTDMX0cpFllk1v8C2DViV1iOUArXCIbU lhag== X-Gm-Message-State: AHPjjUgUmYqo9OC2K8cn9Nkzvld/W6Se2EQDv5uw0Rpp8+PrMa47AVHH pktrU1nXQcOzfpt3rAbm+w== X-Google-Smtp-Source: ADKCNb6fmhoJ4RDwxMiqrPJNREouD+kA2mDiUMPanrxVvzhcz84IHdcIaQ2i0zjhyqc/S5uZ1+/POg== X-Received: by 10.99.117.91 with SMTP id f27mr31357575pgn.376.1505730806723; Mon, 18 Sep 2017 03:33:26 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:26 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:07 +0530 Message-Id: <1505730731-10947-24-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 23/27 v9] 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 Mon Sep 18 10:32:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112896 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501305qgf; Mon, 18 Sep 2017 03:35:03 -0700 (PDT) X-Received: by 10.36.165.8 with SMTP id k8mr16235545itf.83.1505730903110; Mon, 18 Sep 2017 03:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730903; cv=none; d=google.com; s=arc-20160816; b=D06MYcCwYWkNjQK3WHXn7U+xuq1L7Tn7Zi3IIbpdkJ4PudKmgN9D44qJeB1U7CSrph +zrF57PC8ZfZHnaVXU3sQ1liSlr45z4ubDUwqmxbYySkCPzzvdAioadKdLAggAnB/JYf TwGkb04QEbY6DOoGcxkJGvK0FfkKlGvzxO2GpuOhG+Cf2q5Mr/FQr43cyitaUIa0k9CT kIrm7HpIG6/CqLXQkAvXqeUqBNtTq4vgaWXbFXtaVy8kPAimqZjyPCwYfoDttvttQuQk 5DRWlj1Uib3eB4XthSjc0GxjBXiACPqmxp1qtjnjt/amnfdfJaky9Tr3nJpvW9KOgU6u 0zMg== 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=CgIOOnDoeUUy02Kgfx6rxozDor/WqL3SXm4KXSwN0COiecb9NgdCd1N5ZoU484miH7 e4jlqKaaawWeYsX/pgZefwJUvlGm/mz7GcqEH9u+eSoyOq63GVb2vACh4+yILO7pKsYT 9OoYiI+g0tE7HI3Jbj5iQUzrOoHKwkGQaQM6WntRY5DblET4jD0bfMGfQXjWs8ucO4He XZcRxRwz4YgTD3dY3OnC2BJ+IL3xGqq2PZJLxz1M18wFatsXQ+hffLa2IMG4TkCFqTM/ /SHzMRTi+/BPTi4KIamLFUm24i6hx6Z/Y4fHpAFMZPWI08vwawjacNsFoN4NLKHSpRH2 aDJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NU76oGK/; 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 k21si5461251ioe.167.2017.09.18.03.35.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:35: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=NU76oGK/; 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 1dttMr-0002r6-GN; Mon, 18 Sep 2017 10:33:33 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMq-0002ou-Q2 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:32 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 4C/18-02208-BF0AFB95; Mon, 18 Sep 2017 10:33:31 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMIsWRWlGSWpSXmKPExsXiVRusr/t7wf5 IgzXXZSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyND1eyF8xQq9jzfylLA2OfbBcjF4eQwBRG id+fdjKCOCwC85glHr6fzg7iSAj0s0qcmPWGrYuRE8hJk9jydAk7jH1h32smCLtS4sGvS2A1Q gJaEkdPzWaFGLuDSeLw14NACQ4ONgETiVkdEiA1IgJKEvdWTWYCqWEWmM8o0TSpF6xZWCBG4v 2jXcwgNouAqsTR7X2sIDavgI/E1mdHoJbJSdw81wlWwwkUP7/+ASvEYm+Jeb+uME5gFFzAyLC KUaM4tagstUjXyFIvqSgzPaMkNzEzR9fQwFQvN7W4ODE9NScxqVgvOT93EyMw6OoZGBh3MF7e 4neIUZKDSUmUVzRyf6QQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCV5xYBALCRalpqdWpGXmAMMfJ i3BwaMkwrtuPlCat7ggMbc4Mx0idYrRmGPfnlt/mDg6bt79wyTEkpeflyolzvsOpFQApDSjNA 9uECwuLzHKSgnzMjIwMAjxFKQW5WaWoMq/YhTnYFQS5pUDuYcnM68Ebt8roFOYgE5p2bEH5JS SRISUVAOjXZ3O7PQDD4//aPq9qF7BJGdXpem0pWnLI/ZeOLdildV9g9Cb1bMdty9+Olt9wTPf 2+vr58oWLn16xHz+vJLFOl2TvhbqPjaTOqM/STy5alNxZ07rJWtPhsq3szITbrUs23zL74zhl vUaM7aIbCn5cP6Y6PGGuTGG6zjWrzy3p9F5pgTLh41fTZVYijMSDbWYi4oTAZseLsLGAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-16.tower-206.messagelabs.com!1505730810!92023612!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 21585 invoked from network); 18 Sep 2017 10:33:31 -0000 Received: from mail-pg0-f47.google.com (HELO mail-pg0-f47.google.com) (74.125.83.47) by server-16.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:31 -0000 Received: by mail-pg0-f47.google.com with SMTP id 7so23377pgd.13 for ; Mon, 18 Sep 2017 03:33: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=8o2al3bzod4mOOONVe20amJaaulnmm2NgPZDeRZkrVE=; b=NU76oGK/gxNiKk8RxYqDI7PpJkgH3Yjth1u76NwpUcO5Q1fznUuOizz1mjnfjp0kn1 DIeA2pQP1i/NSs1ywY1VZFMT9dGVlm/i0+U4eJdlItDjvuleRez6DuAgJ+tQy4VQudva B+LWLwyy3fobxDVyvmNkF6QdaLyg9dLMiqtM0= 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=FgC+WE10AaOcfSulJJBnxBdqzYGu0AjjCQQPrAenOboa75L57mDisIT4fWc7XI0RkW ESDJ7W45JxWw0IW3RTzmHkSBWPLcISBMuVHyQlCEJhpn9QwnBE1UzeMKuZaNF5ROzOYa THCUyHcOMtLntULOmSJYlOD/DDZeeTrwOX8S2SyOZudMXf76ouAjE0G8+TgKNhE61sBE Pv0bMUct/+WMH5qUrL6CLrRMOL5aZMKm5VNPKDaXdvCgwI6DOWtApomyM8ZGG4D9+dFX 8vKn9sHuTst+GUp0Ua4Ahe9SuD8JOxBhad03hFq16Y3ns9imMYC9zj4vODIkfQjliRBX mUXQ== X-Gm-Message-State: AHPjjUiC2GMwSJT442NdONqpG1Y1NcnqBeaymLJ/+VdK2h725tdFSFEe Q+ZjXJHYTANpBUPm7dl/Xg== X-Google-Smtp-Source: ADKCNb4vHxur5DF6gAbyUXxWpB+GPCPnnVuLgkIm4LQm5QhxJ55KbwYtMfif9ozFQH6kJLpQKFlklA== X-Received: by 10.98.62.80 with SMTP id l77mr32126520pfa.267.1505730809589; Mon, 18 Sep 2017 03:33:29 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:29 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:08 +0530 Message-Id: <1505730731-10947-25-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 24/27 v9] 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 Mon Sep 18 10:32:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112899 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501324qgf; Mon, 18 Sep 2017 03:35:04 -0700 (PDT) X-Received: by 10.36.95.5 with SMTP id r5mr17620419itb.9.1505730904345; Mon, 18 Sep 2017 03:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730904; cv=none; d=google.com; s=arc-20160816; b=zRf8YfF3654RtvqjD+ImDaxd282gNHDMJ7K+fM4gKSn80srbZMhWW49BrJqCxQ4zjv T+9BNRkRzRZX5ctIOeZRd4bYNWnAV2ryjSyYjczkih8Mlfzwp2tH4kVDCNvhGZVtNnro TnTDxiwBF4xv+7fX9+bAV+H8eBT4zQuarzBKuaGpLhu0SExUhcRRFjqlwHMVeverdTnQ VtFgj9fUCgQXqfwR/9r3TNpFvlKLZ5RGDieVBSH8CI9/fuSJPnqolnMLyt31hbBzAqJj zzKpp8pIvZu0C+aPC/+D3/nGacVDdMFDSh3Lw+zTlSvNswI02iYhoiCS9iU8Awx9VM5h mfew== 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=Jh9JAiBeZBB2npviaK4TkMO4wEEJ9zmCBlUtvNuhouk=; b=aQUhrQETHNoyyzlN2KDTRfWm3sRLup9GTPHYLMMOJLtrHlxwsROnQiJdik7Sz3t3Fb v4N32xy1IErHUdS8+3FlvczrNFR9C0H/OSUdaqOLjGDQwonXZYBfezaW7zOkwXKEQXkH owFkWKtaQfNo2s/WeY3VyEnOeimCr8tRUXQ2AO8iMasyYVHohcW1hPrnjEJbyVv+/4He OU1Fr8TDUGt8/VQiswV0qutYBI2p06pBvN2CYkrHUnbi1yEs+PzejrERzqdqjTCfA6tY 9L7hMCfO9X6ExmaaLaxYyNu4W4Ry9WDFgVWxC39tc2oTAVpuXP3g+vKpQ6QdXjIjkogf CbqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e12y4kmP; 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 i191si5525304ioi.410.2017.09.18.03.35.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:35: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=e12y4kmP; 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 1dttMz-00032J-QJ; Mon, 18 Sep 2017 10:33:41 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMy-0002zX-C8 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:40 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id D4/44-27708-301AFB95; Mon, 18 Sep 2017 10:33:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLIsWRWlGSWpSXmKPExsXiVRtsrPt/wf5 IgyU7bSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozdt3kKOjQrWs4cY21g3KDUxcjJISQwhVFi w//0LkYuDhaBecwS8968YwVxJAT6WSW2b5jNBFIlIZAm8ftIFxuMveLzP2YIu0qi+eFSFohJW hJHT80GaxYS2MEk0T55H2MXIwcHm4CJxKwOCZAaEQEliXurJoPNZBZ4ziQx7ZIOiC0sECmx4f RcVpByFgFViW2rmUBMXgEfie/nXSE2yUncPNcJtpUTKHx+/QNWiK3eEvN+XWGcwCi4gJFhFaN 6cWpRWWqRrqFeUlFmekZJbmJmjq6hgalebmpxcWJ6ak5iUrFecn7uJkZgoNUzMDDuYGzqdT7E KMnBpCTKKxq5P1KILyk/pTIjsTgjvqg0J7X4EKMMB4eSBK84MHCFBItS01Mr0jJzgCEPk5bg4 FES4V03HyjNW1yQmFucmQ6ROsVozLFvz60/TBwdN+/+YRJiycvPS5US530HUioAUppRmgc3CB aLlxhlpYR5GRkYGIR4ClKLcjNLUOVfMYpzMCoJ88qB3MOTmVcCt+8V0ClMQKe07NgDckpJIkJ KqoExPPX4ovig6almhzZytIVz/TyzI2eZ/0bGzCAe+eCMs1V8247tcbGdov5libxAxK/dbTL/ O5+k6gn9efbnSr/3okOJJjlXt8e2NYkZlXvs4OpUTMjuEmS91Wx+LM3BZ4pCyec/ekHe3yP// mHNvtDxLEapje+epc7lXNZE+3uPRVcIOMit7FFiKc5INNRiLipOBAB3AF11wAIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-13.tower-206.messagelabs.com!1505730814!96534853!1 X-Originating-IP: [74.125.83.51] 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 47999 invoked from network); 18 Sep 2017 10:33:35 -0000 Received: from mail-pg0-f51.google.com (HELO mail-pg0-f51.google.com) (74.125.83.51) by server-13.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:35 -0000 Received: by mail-pg0-f51.google.com with SMTP id 7so23448pgd.13 for ; Mon, 18 Sep 2017 03:33:35 -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=KRfW1DrdX648dpfpwE74sILFYwEfdW5dUgj501sVT8I=; b=e12y4kmPRWw1BLw0zYTMmg/HyaINx5pUwcQWbUoInMJ5NWYtgbz/aB4L1ESSe+gbSF uKu7OL6Ltwf39dkQY5PvbS66WNZiRogd6UDYFA9qZ22JTKkYR+DGrCoojUeZsd/iwCDX HbD64uBMCl11bGHwKW7Q6IXSX55Flx/bQuENE= 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=KRfW1DrdX648dpfpwE74sILFYwEfdW5dUgj501sVT8I=; b=GYhHDlCjaWIUAJcc7euO7+OMGJmgUbI4cPXURC5C7QDAYRYdix+1UA4M0xqTpd8Mvo 2zNPesEEXfI75MQ83DIbu36wCs6x+Z1gyGGO+n9pUDpF10mOd/xyl/w+pTUFudOkWX7o +1llFxKx+vE+Zy5Jcu7TvrIRoWmegr+17+777HZ20zc1ooGRKlft2sbHYoB2XRU6gmUB F5MWGRIEBMj9IINP5htbqsaq63g4GVgjchhZg0Y+JhPHEq0RSP5qnRZcahdHboRYp4xz N93GL8cDWoARpiqXuUoeoRLhViNbPJ1qrnEmMMw8Kp8klDBImHNkaLpKXmx8nfaS+fVQ rBVw== X-Gm-Message-State: AHPjjUjsiNFMjkSV33Wy3ijRFdU2N0nNDUymPCBZgOa+qEzP4MJsUWj3 aCZMhHdxc69ZHFN4/Ari+Q== X-Google-Smtp-Source: ADKCNb4+5ytWs9ar6IYPajoOptNKGHX70Wyq/eFKcikWKr6eamkyoQILTpdnl1oKRHJ8Zmgs3qOy2A== X-Received: by 10.99.149.28 with SMTP id p28mr32043939pgd.386.1505730813899; Mon, 18 Sep 2017 03:33:33 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:33 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:09 +0530 Message-Id: <1505730731-10947-26-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-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 v9] 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 79cb2ea..21cf43f 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). @@ -2171,6 +2174,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 Mon Sep 18 10:32: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: 112898 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501316qgf; Mon, 18 Sep 2017 03:35:03 -0700 (PDT) X-Received: by 10.36.204.135 with SMTP id x129mr9802866itf.7.1505730903562; Mon, 18 Sep 2017 03:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730903; cv=none; d=google.com; s=arc-20160816; b=x+tSIzEOwXLOlVrzyuL3229/AnRgdKHSM6rctlF7tvCc71EOhaupeeSqtw2yjgj1sv HSsDDKBWMGmXMU+l7vGSa118GKn7uEQb9cmz6NFo7R6BH1mGiwt2Ro74DoS9AOl0onFC edwkoufZH6RV17LDxZp2X9xGBn4zqqVBPtwxWfHnKpsAUfsFYraPc9q/xdBtRuG9yEB7 awoSF1eJojuiXKAJJais4OMpNisvoAHHBeX/fNyw2MBDWvB/Esk4c90BltlgXI04/Sxl VlnBDogx2JwcYhqxBPpI/wxffWwhgINupyz3loKF7EkGHj0kxNbtlqhwaf24q+5URXYM 9utA== 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=lzUDtPIdik4T2hzR+NJMRNepF89i8li9mH15GlJ+ppyZwjNJNbWxp7imQ5zgCL3UQQ adKAB2Rvo/nBM5PeAGZw9Ha/Btz8m+r3Izg1cfhR8Fp98q3FYPYwAOrV01FSbhr8Vacx PIL84XDaOcf1aPoQKFzKAM7YDQLaGaT7isijnM1xKDypgxBStO5/XxAbULBkdIdb0ZoR O9kAS+D3Ydj/iIiSx3V14zvT180I0/DvriqlzgvpZsorP0XU2RxBowFwG7p/e8YnGyUY J3aeZmhyjrpCMGTKMtCXkIe8t8bolOviIPVol7SNM0JfwvsKExt/6Szv31U9iWn5XcP3 kxoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=c9PJe2bG; 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 m123si4607036ite.117.2017.09.18.03.35.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:35: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=c9PJe2bG; 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 1dttN3-00038l-Dv; Mon, 18 Sep 2017 10:33: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 1dttN2-000350-28 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:44 +0000 Received: from [85.158.143.35] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-2.bemta-6.messagelabs.com id 57/44-26922-601AFB95; Mon, 18 Sep 2017 10:33:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsXiVRusqcu6cH+ kQfcMQYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNePArT+MBecEK95/f8jUwDift4uRi0NIYAqj ROeljcwgDovAPGaJ893XWUAcCYF+Vol1N2eydzFyAjlpEs9PHWGDsbufnGCEsCslPv64BGYLC WhJHD01mxVi7A4miVcT5jB1MXJwsAmYSMzqkACpERFQkri3ajITiM0sUC+x7dwvsF5hgTCJ5z 1zweazCKhKbPu1kgWklVfAR2L5tkSIVXISN891MoPYnEDh8+sfsEKs9ZaY9+sK4wRGwQWMDKs YNYpTi8pSi3SNTPSSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQIDjgEIdjDu+xh5 iFGSg0lJlFc0cn+kEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQned/OBcoJFqempFWmZOcDQh0lLc PAoifCuA0nzFhck5hZnpkOkTjFacuzbc+sPE8eK67eBZMfNu3+YhFjy8vNSpcQh5gmANGSU5s GNg8XnJUZZKWFeRqADhXgKUotyM0tQ5V8xinMwKgnzPgKZwpOZVwK39RXQQUxAB7Xs2ANyUEk iQkqqgbE/yKjYws/wkGNYYdH35R9K5RzjJ/2Z+yp+/8xH2R5uixZcfDHfM2i1aMwdp/1PWH26 pPYmlJjtWJgSI9Xmn/ki3lzWRkNvjwP36/0W0V//NApXOumc5Ezm9yqzPbLu3NyCz18XbbNvq z3MtmLrthV5xllOe6b9ThE6uDYp27L9SnDCnbkON5VYijMSDbWYi4oTAUSw2sHKAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-15.tower-21.messagelabs.com!1505730819!83206468!1 X-Originating-IP: [74.125.83.41] 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 20690 invoked from network); 18 Sep 2017 10:33:41 -0000 Received: from mail-pg0-f41.google.com (HELO mail-pg0-f41.google.com) (74.125.83.41) by server-15.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:41 -0000 Received: by mail-pg0-f41.google.com with SMTP id p5so30288pgn.7 for ; Mon, 18 Sep 2017 03:33:41 -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=c9PJe2bGhZemRrbrY+9tkkpqmynCXz8I4lHy+UIZcjljOJhLuUbMIsUlaAIU6Apfk8 cu3Uu5GVI4c8uYX7vzz3eOC3L5GMZ8f1YIAuYC1q21t9/WZa8DIfxyicfT4Mcvx30fCY D09IHobCHflTCh5z/MphrPJPBUVbFZBf4eSAI= 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=KYGZ62Da82tto/fd5SBTM9mu/cGC68wlcvMQw4qZhUYI5KzlYIHWAJFySXmTje5k8M n2kf/RHJmlSfB4D8CUHlTcTURKiiYCHqNF7qLZZGyDpHB4YvC911NyMUjf6y+Yj44flN z2Ob9fGOVdWhk9joO3MPvo6KAfIu12Sv43gVqs2So0yTJ/zVVTMCkzOipB/IUO4NR5kj RWSreQh7DtgXlkoBgwzna1xFBQMNKuKpLE585hk95vLUTDFxhNk7CbW67UDv7EX2AGMe ZME5tIJtay6aZ6jTV5meiu7YAgFsFNuGFyKGjgnCLhgYp6peNCFUuZUmWEqF0m/7c0q3 LjTQ== X-Gm-Message-State: AHPjjUhsn+MmfzZ4om6E/tuQSFWB5vnov1JK79wHjmeQ49c3KjLoqv3C 4d/h8Y4z9y7MFNS8OaP7gQ== X-Google-Smtp-Source: ADKCNb72534LJnfGt3+6/p3b7RfRz6QmEPvRxpX4LXmnZQZq8GpnOwtlNMFahHxFDxfAd9s7+pDGcA== X-Received: by 10.99.3.213 with SMTP id 204mr32057012pgd.274.1505730816172; Mon, 18 Sep 2017 03:33:36 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:35 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:10 +0530 Message-Id: <1505730731-10947-27-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 26/27 v9] 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 Mon Sep 18 10:32: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: 112900 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501340qgf; Mon, 18 Sep 2017 03:35:05 -0700 (PDT) X-Received: by 10.107.131.155 with SMTP id n27mr18291150ioi.200.1505730904967; Mon, 18 Sep 2017 03:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730904; cv=none; d=google.com; s=arc-20160816; b=O+Qu8LFJhdAdWxcOZziih/6BHeoirb9UBFYEdxvOKjZHCQsidYxuZx+JRdrcLQ4AlI mbWstcyMtfL2qwTN8stRNsogXcHWloYl502X/5pD3mBL+Drawe7q0lTLgi4rxB4d9wO0 XIpc10Veo8J8DDqcov64hlKtx2ydRDzJJKhfz4TDgVaUgUtAg4uIMJqC0BvQnYyRyPkB GLgUoFiNz4KEcp1v8KF3kV18NfuVs7WrICa8NT4jj28GqOv3Loy6/WMtL2T0vdPL5PQk rx9ZOQtIS7/gK/kdtqPRArFMPUMyLg2696+nKMiWXJI04BqsE5VsKyUZUdp0x5JI43V2 UcOQ== 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=a40v5+55P180YxPwHwhGDKMxD84rc0WqbBC5mwGwZIo=; b=mwKCp5WAB1xXVf4LM4fhC19fpV1En0LdQ1gZWWrhw8N28osmfwJXanO+XYjS5PFXeT KcggOkMp5Ixw2ZeFPrQSkgOn5UDY6+bLqb4eQHOJf9i7VYT7cVv9/RQRGQm4A2+rs7YE eYR28sApf4Uv4/EOroJLVv7G7ExBX3SUlxxZ+Hg2taNG1xvfL8S57UUTzssRyE4Xoahq DiMRUf0B6Tj715YdFb5KxLtje7IDOWFnZKTD67G+LQKQn4vx3/RMnjGzXZZ1gJ7JtvF9 HK/nT7H+BdCSE1nxuj0rnAEinzKXwRh14TM2ZoFsM88IBLaFdtqgCPL3v6qPWkGXI+hm T93Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RiG/ybc/; 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 m26si5700802ioi.291.2017.09.18.03.35.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:35: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=RiG/ybc/; 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 1dttN3-000389-69; Mon, 18 Sep 2017 10:33: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 1dttN1-000350-JE for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:43 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id C4/44-26922-601AFB95; Mon, 18 Sep 2017 10:33:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsXiVRusr8uycH+ kwfZP1hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aHs+cYC35ZV5zdPYexgbFbp4uRk0NIYCqj xJm9/F2MXBwsAvOYJV6/WM4C4kgI9LNKLFz3iBGkSkIgTWLx21/sMPatf+1QdqXEic6fTBCTt CSOnprNCtIsJLCDSeLs7UlADgcHm4CJxKwOCZAaEQEliXurJoPVMwvUS2w79wtsvrBAnsTX16 /AZrIIqEr8+3SSFcTmFfCRuHbjNhPELjmJm+c6mUFsTqD4+fUPWCH2ekvM+3WFcQKj4AJGhlW MGsWpRWWpRbqGBnpJRZnpGSW5iZk5QJ6ZXm5qcXFiempOYlKxXnJ+7iZGYMAxAMEOxuPv4w4x SnIwKYnyikbujxTiS8pPqcxILM6ILyrNSS0+xCjDwaEkwbt6PlBOsCg1PbUiLTMHGPowaQkOH iUR3nUgad7igsTc4sx0iNQpRkuOfXtu/WHiWHH9NpDsuHn3D5MQS15+XqqUOG8dSIMASENGaR 7cOFh8XmKUlRLmZQQ6UIinILUoN7MEVf4VozgHo5Iw7zKQKTyZeSVwW18BHcQEdFDLjj0gB5U kIqSkGhhV9skeP8p47cyeU3N+vVopqZZV/y959YOd9zn3Sd7hrvjDYWZxT6/mUMCR1v0uN8w8 ZRheynM0dV14Ksuwc03s4423nCr/i56IcD8423Cvp8rGuYKTCzgVIvV6Lz932WtrfXme/ub7w bf/+RyXu//uauTC42skqkpn/Tiss/7k2gB+26yLBy2PK7EUZyQaajEXFScCANUT3nvKAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-4.tower-21.messagelabs.com!1505730819!77164974!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 39507 invoked from network); 18 Sep 2017 10:33:40 -0000 Received: from mail-pg0-f47.google.com (HELO mail-pg0-f47.google.com) (74.125.83.47) by server-4.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:40 -0000 Received: by mail-pg0-f47.google.com with SMTP id v66so32724pgb.5 for ; Mon, 18 Sep 2017 03:33:40 -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=71xGGLc0Xz4xep+AAwWpw9wKhm4rwTN8GTzuJyNx6LE=; b=RiG/ybc/aG/vCGxT/zJXWo4R1llRsfc5BApj2GLhKhS9+pE419VT1qG2Zybcu2mzd0 gFJ3A2S192y23tNIbcs/VotJpPXP4jCnzAq8xRnlFTZcQg8x3bRHILXKBphNZ2SKi0Ke zhTsfWabFbB/nzJ90yr5d7NTca230YInPEqm4= 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=71xGGLc0Xz4xep+AAwWpw9wKhm4rwTN8GTzuJyNx6LE=; b=kZzcKEkpQzMuxBvlgeAzs7nkNHaO9sXnmZ9xB+j2UNE5DHuidAKAe5WhTd6ghB5LeE GDsbGHKoyI3EH8SNd1I9HlRe3p6qgw0RDgVI1zrmeIk05uxjAa44MNRd93ksFLgQ/NH3 wZN0eHYUgFCZ8b53LsGFimNn01HoEECOzGXfh0tD1pBw7sLdiB3kbu0UQFnFNCHmyCaY li/aX1pMQp59RyRbHDvZtMVFkt8Y9+hlKyJCvhE+jwo9GpayQ0e5VZ8nC8Cg+OqZPXrW Wp2lP7bHqjh64QNhuGF7cYr/A5PPMxd7mC/Zv1sYND4GCnAvodGOleQrMEvP+L0K+B2I gQzg== X-Gm-Message-State: AHPjjUj+zpavXTMCVXUnQmJPqnnFQgyshvuh080efwjyxP15TjrXBkwx 78DdxL9VKvc+lHQNHmwGgg== X-Google-Smtp-Source: AOwi7QAqN4n9hPbi6tJKZtYcCbSqnq6adAsFkSnL10HjxUdCMrgft89GRBwIYMMM3bF0GLS0GW9t9A== X-Received: by 10.99.106.67 with SMTP id f64mr5882663pgc.101.1505730819192; Mon, 18 Sep 2017 03:33:39 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id b7sm12937845pge.79.2017.09.18.03.33.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:38 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:11 +0530 Message-Id: <1505730731-10947-28-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 27/27 v9] 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 executing '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 any register where the TX interrupt thresold can be set. 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 (as expected by the SBSA UART driver). 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;