From patchwork Fri Sep 22 08:23: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: 113976 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011059qgf; Fri, 22 Sep 2017 01:26:00 -0700 (PDT) X-Received: by 10.36.111.4 with SMTP id x4mr4746441itb.144.1506068760559; Fri, 22 Sep 2017 01:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068760; cv=none; d=google.com; s=arc-20160816; b=fv1+dbKkKBKz84+zcLAq8aGcmZUro57OLf3ZIcBfdn7cuHwde7F3TCIU9B1KH6cxSk 070eimnwUISBNdUlppwjfJDmMffeZ1lOAB7dPzfH1RbZH35HkfkMYy2Gyn6MTiamqPSq 7sjmXBy+Vx5FlFI8MoObqnel6+AjfIGoY692K+gWvYhujy4jl4rthDks3SYd+6n7OEFM HlutLO31ZwKAyel6OClriW3GSfdNsObI9nPsVtnpUWBRQBGKKzPbJ9QgCYBvyEF3QGMQ GcuqbQmCsUbEa6ubDOlJRXwhUOMlGgCQ1eNuIY7wF4RwbgQCFFLrKFyvkK74Y+WOgnqw eGGg== 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=YsaW546s6pwgzhqde3ytLyO9uQIy3UsCYPaqWnVVZNE=; b=dJzlW5OqQdR+QdL3Dc4Cu+8JQdy/eo9alHHKH1nHolP1yunJhkATan7VzkKUFyCmJD 3n2DtujgRCEYurR4wGDdawYI8dPQV95cj4ktIoF/1yfLQ2aBAI1DujuvpaJ55J3KMFwQ BluijDrpnFzLx7s8aqCc6uDUxng6pYhjltuvm+EoUFn48wjwynUQlRBzHIGOSz60fxL3 VOVctvs7xvLP71bnEPnxAOJpptO814S7Dx6pneDPi+cCDL2jgLPBWiM/UpawJpn9p0Te rbJYQP3BFrgWTR/mX5YSz29vyrXwGbUb2I6jBNhTC53OzPkLJtG8L4E8U3jN1pL2fkrU H2ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aNNd7jwe; 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 12si3005031iom.58.2017.09.22.01.26.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26: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=aNNd7jwe; 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 1dvJFN-0003cj-4I; Fri, 22 Sep 2017 08:23:41 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFM-0003cN-2U for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:23:40 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id CC/50-03616-B88C4C95; Fri, 22 Sep 2017 08:23:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTABt2uE0c iDdat07X4vmUykwOjx+EPV1gCGKNYM/OS8isSWDPeTHjKWLBPoGLL/GvsDYxb+LoYOTmEBGYw Sixose9i5OJgEZjHLNFz4ggTiCMh0M8qsXj+UlaQKgmBPImHnz8zQthpEov/XGGHsCsl2mcvY IGYpCVx9NRsVgh7B5NE11zRLkYODjYBE4lZHRIgYREBJYl7qyaDzWcWuMAoMfPvczaQhLBAss S7nhVg81kEVCWOH/rEBGLzCnhL/Lz+FuoGOYmb5zqZQWxOAR+Jtf83QO31lth64yrLBEbBBYw Mqxg1ilOLylKLdA0N9JKKMtMzSnITM3OAPDO93NTi4sT01JzEpGK95PzcTYzAgGMAgh2Mx9/H HWKU5GBSEuV9fORIpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3p3HgXKCRanpqRVpmTnA0IdJS 3DwKInwhoOkeYsLEnOLM9MhUqcY7Tku3Ln0h4nj2KbLQPLAnltAsuPm3T9MQix5+XmpUuK880 HaBEDaMkrz4IbCYvUSo6yUMC8j0JlCPAWpRbmZJajyrxjFORiVhHmvg0zhycwrgdv9CugsJqC zyleDnVWSiJCSamAUED/5bGbF9S07uVYdvR21+7N9PJ+HXPUt9fy1rXoeXQulORX6Fesm1UjK 2ubXlaqf/GElurvuKt/dhw7rPvcyyNu6KrqZrfQ4EjRxhq/yT5uAhBB701jrjFOBbz7eXfB+X lfBZeEapqBtMRYe538diJLm/esvKvxVpVPrCefbGW0Brw9Nf6rEUpyRaKjFXFScCACltGYc0A IAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-21.messagelabs.com!1506068617!83978789!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 62975 invoked from network); 22 Sep 2017 08:23:38 -0000 Received: from mail-pf0-f176.google.com (HELO mail-pf0-f176.google.com) (209.85.192.176) by server-8.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:23:38 -0000 Received: by mail-pf0-f176.google.com with SMTP id x78so231497pff.10 for ; Fri, 22 Sep 2017 01:23: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=m1XrBZB/btmlDP4Ti7Rax30SosocrCyN6adh9O5pCLw=; b=aNNd7jwecMaVyYFf0/x5CcFKXFRX5h3KSg6PkjyuqhjIhPBS9GCo6byqx3iMiz+O+m Rp9mAmfbJ5yaQtlh1iuv0o9JBtcVrhHppb9aLetHShxr/MeeuEhd570iWBdlp88TV4gj +mRpoyIUXF6SCHX+/2hkJWsnXPryL8GwZ61KQ= 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=m1XrBZB/btmlDP4Ti7Rax30SosocrCyN6adh9O5pCLw=; b=eC6sz/tIyfRzUl2B3vv9zplMeGmv1tOg4yAoL9BZpD6shrIeR0LmGTFHOGZmU4j2mt Vg1Fa35AA9dl7ydviQn/yTOvXAbvOe9QGQRgTIF9t1IOnIXKQTdEKQLyclZbWLheH0NU eWBMFy6rbMNE1PRpCL6AKPVAYolctPgggNfJjljHY/Z0dXf53MAhFrmCrqDx+nGL1jQc RLkMj77N2YlnwyYEGG5U6TeyH2tJBzao6kFyho48jVwc4/eOuvi4++MfOGIo3seu7ZTW FEZD66fCzjXGy1Anl7nSnql10Vx9iKYtXAKNYjXTL2dEtxTu/WbQBHd4FuU6fnOF6JN3 MAyA== X-Gm-Message-State: AHPjjUhsUK11r+p4phl0wmTm306VStF8bYTe/JWBwfK6XzmooDoqY4By VwK5qTXWbCGwOgjLPdjzFPuz6gv7kYM= X-Google-Smtp-Source: AOwi7QAM2XWIwE2Nwcja88WDdcgpxichJvlGPvGQKN0hUfHqrY9B9SrlglnfBRLSu5D5xArFVbE0Uw== X-Received: by 10.84.224.136 with SMTP id s8mr8374622plj.324.1506068616999; Fri, 22 Sep 2017 01:23: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 f74sm5569284pfa.36.2017.09.22.01.23.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:23:36 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:00 +0530 Message-Id: <1506068606-17066-2-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 01/27 v10] 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(-) 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 Fri Sep 22 08:23: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: 113971 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3010960qgf; Fri, 22 Sep 2017 01:25:54 -0700 (PDT) X-Received: by 10.107.36.70 with SMTP id k67mr5999509iok.23.1506068753898; Fri, 22 Sep 2017 01:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068753; cv=none; d=google.com; s=arc-20160816; b=H0oOsgRm5JYE6VW+vpDhpymCS2yCn6EnPFuCFsl8DGpUOLg/q377Qk+BFxALREhAav JmrVWMpMaRIxGJnQuNe3kFmJBzsvTioXYiCOcWXGvBNZibLRpu6QGwYyIM/A6D3TRlo3 wV9uWBHEsZptJwkKe3wFLwXxoygllwQo1Stzn8foNfuFMLVx0czGT1ZpeqXA/f7wQ3iX Ao0rkekivf9Zz99FhbXWQPKn+JbVzDZblZa4yfMf7+bBxQN9iEPWPhl1tXot2RQEvokf FYLKHePZYI31hdX7SNdp21p3vs5PJZhE3vgeLfGZhKqaIgHQBCwnvRvSbND0YeZ3h7w3 BEkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=gCQLR2+7QN2q45s5X27tQdIkMlSacKEnQX6ge3WR0Mc=; b=GRvbzK7HuwW7j2/YXZqnfrvj6HzIcWBVl0LIWsCtNrkf45DCMka3J+Rh3NcpsFA53Z 7FqHUtmaHZzJyflqwIex9E5qow4/YPz19ePiqxA5gUyY5Pv5v6mWuAe47lMF40yk5NzR ay0RDpMP6mUKVqdFjEpxnTWkxWo9pDm8VpFLJj+RGWHw0fM+pA4xxVsMECuoS/OzZNjc nyl9I6pNjwLoibLxULOwCrSOY1qFq7RmQzXtCFOmzpqF7rqDPTFyI6FXYhCGQxjYRiTg gJnsQ5yI6SxAd5QPExHycMvevFQFSKYi0hCNfJdjLmVxAibvCXLScW3UWT9y8lt+UilR EeAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=G9jCrjjc; 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 w14si3615716ioe.96.2017.09.22.01.25.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:25: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=G9jCrjjc; 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 1dvJFS-0003dc-Bq; Fri, 22 Sep 2017 08:23:46 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFQ-0003dJ-PA for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:23:44 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id 3A/FA-03642-098C4C95; Fri, 22 Sep 2017 08:23:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKIsWRWlGSWpSXmKPExsXiVRtsqtt34ki kwZRPTBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bxFftYCrYtZ6xoPz2LuYFxeQNjFyMXh5DA NEaJ3Tsms4A4LALzmCU6nx0AcyQE+lklJvRsYuti5ARy8iRW3dnP1MXIAWSnSXzsi4YIl0k8m v2NCcQWEtCSOHpqNivE1B1MEn1nF7GB1LMJmEjM6pAAqRERUJK4t2oyWD2zQL3Eok3bWEBsYQ Evien7GtlBbBYBVYnJ+36AxXkFvCW+Xr7DArFLTuLmuU5mEJtTwEdi7f8NLBB7vSW23rjKMoF RcAEjwypGjeLUorLUIl1DE72kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3k/NxNjMCgYwCC HYzXNwYcYpTkYFIS5X185EikEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQnenceBcoJFqempFWmZO cDwh0lLcPAoifB6AGNAiLe4IDG3ODMdInWK0ZXjwIQrf5g49u25BSQ7bt4FkpvA5IbvD/4wCb Hk5eelSonzioI0C4A0Z5TmwY2Gxe4lRlkpYV5GoGOFeApSi3IzS1DlXzGKczAqCfNeB7mQJzO vBO6CV0DHMQEdV74a7LiSRISUVAPjpSXv7lxjD+1n+P1h67MnTpeqFmV/fNxhm/x6kUP171KH N37RMxc2V+x/vHmaa/Px54J86WduGnzrvJ3s8L86fo7GUYOy9xYd1rXemyeJH4lc/jn0Z6+gl GSSdGJpgUz2wZLwThOrHWs2Oj+7v76FbYI1e3qPpf25vFreo8JXVym8SfbJUeRXYinOSDTUYi 4qTgQAqYP+7dgCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-27.messagelabs.com!1506068620!118084162!1 X-Originating-IP: [74.125.83.53] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32276 invoked from network); 22 Sep 2017 08:23:41 -0000 Received: from mail-pg0-f53.google.com (HELO mail-pg0-f53.google.com) (74.125.83.53) by server-9.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:23:41 -0000 Received: by mail-pg0-f53.google.com with SMTP id j16so254529pga.1 for ; Fri, 22 Sep 2017 01:23: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=FIIEoGYJlDlQOlB1rNCGAkalKS3RzS1n2lan1ceAzBg=; b=G9jCrjjcYpIXUQzZRVQp6gViziHmIwjfhQPkASYo0BVrJ7KX8mFknuzUyDZJotdWfp t3brOax8zus3BpQPiChgzx8lQPkOy0gbVmarSzk63MNXSXxyB+XtwyApXmm1XYlZaknN MUzLWo+4BnBwhCOIHmS191P0dnVrw48dm7ssg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FIIEoGYJlDlQOlB1rNCGAkalKS3RzS1n2lan1ceAzBg=; b=Im/OoGRSpyyoCGHiwkB7eSyub3X8tFP30uHftZhbV5n1P1/MPDtIw73vBdyAxsF7W2 V7iZREIvtIr3/n9Zvm/rrZgUvSB4dQ+5gmk2POV7vtVPAP6hlaHqUitxIzOuc9iesy6R CCmmz2//8pUtb66lL0euL2D6g8M2loRasLmvtNMrqRdktS3n3lMGBx2Dw60VfWgGkKD6 keW3BzCDzXMhOiKM261RlfT7eP0UVYZPfuLQLu7tRqi6e85ndCl5dN5ddFMhcAOoRD1v szzpb8u3pHI8J2vGoT/mXEzxMhecwKXKHOGrKbD905VPNjOw1kQ/9e+Z0dj2dsIUdxEb CbVw== X-Gm-Message-State: AHPjjUgaI8MQRAaEyD87Fg4qeRq+W1+lJTCMYG2NSiZbZCny/0NqFm2r OuKAAnU82D9xbFWf/E46n5xn4rf/lJs= X-Google-Smtp-Source: AOwi7QBEOWyEfFeCmwUJaGJsMps9k+D9y2uAQETq8jSl2j0Af04FVAR+L3gBs1OTNEMft9/gNQF89Q== X-Received: by 10.101.78.7 with SMTP id r7mr8710970pgt.64.1506068620017; Fri, 22 Sep 2017 01:23: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 f74sm5569284pfa.36.2017.09.22.01.23.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:23:39 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:01 +0530 Message-Id: <1506068606-17066-3-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 02/27 v10] xen/arm: vpl011: Add SBSA UART emulation in Xen X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Add emulation code to emulate read/write access to pl011 registers and pl011 interrupts: - Emulate DR read/write by reading and writing from/to the IN and OUT ring buffers and raising an event to the backend when there is data in the OUT ring buffer and injecting an interrupt to the guest when there is data in the IN ring buffer - Other registers are related to interrupt management and essentially control when interrupts are delivered to the guest This patch implements the SBSA Generic UART which is a subset of ARM PL011 UART. The SBSA Generic UART is covered in Appendix B of https://static.docs.arm.com/den0029/a/Server_Base_System_Architecture_v3_1_ARM_DEN_0029A.pdf Signed-off-by: Bhupinder Thakur Acked-by: Julien Grall Reviewed-by: Stefano Stabellini --- CC: Stefano Stabellini CC: Julien Grall CC: Andre Przywara Changes since v7: - Set/clear the TX interrupt status bit based on whether space available for 16 bytes in the ring buffer - Clear the BUSY status bit as soon as space becomes available in the ring buffer Changes since v6: - Removed freeing of mmio_handlers in vpl011_deinit() as the handlers get freed when a domain is destroyed. Since this is a minor change, I have included the reviewed-by and acked-by tags. Changes since v5: - use instead of for including arm specific header files. - renamed shadow_uartris to shadow_uartmis to indicate that it is masked interrupt status. - use smp_mb() instead of smp_rmb() in vpl011_write_data(). Changes since v4: - Renamed vpl011_update() to vpl011_update_interrupt_status() and added logic to avoid raising spurious interrupts. - Used barrier instructions correctly while reading/writing data to the ring buffer. - Proper lock taken before reading ring buffer indices. Changes since v3: - Moved the call to DEFINE_XEN_FLEX_RING from vpl011.h to public/console.h. This macro defines standard functions to operate on the ring buffer. - Lock taken while updating the interrupt mask and clear registers in mmio_write. - Use gfn_t instead of xen_pfn_t. - vgic_free_virq called if there is any error in vpl011 initialization. - mmio handlers freed if there is any error in vpl011 initialization. - Removed vpl011->initialized flag usage as the same check could be done using vpl011->ring-ref. - Used return instead of break in the switch handling of emulation of different pl011 registers. - Renamed vpl011_update_spi() to vpl011_update(). Changes since v2: - Use generic vreg_reg* for read/write of registers emulating pl011. - Use generic ring buffer functions defined using DEFINE_XEN_FLEX_RING. - Renamed the SPI injection function to vpl011_update_spi() to reflect level triggered nature of pl011 interrupts. - The pl011 register access address should always be the base address of the corresponding register as per section B of the SBSA document. For this reason, the register range address access is not allowed. Changes since v1: - Removed the optimiztion related to sendiing events to xenconsole - Use local variables as ring buffer indices while using the ring buffer xen/arch/arm/Kconfig | 7 + xen/arch/arm/Makefile | 1 + xen/arch/arm/vpl011.c | 454 +++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/domain.h | 6 + xen/include/asm-arm/pl011-uart.h | 2 + xen/include/asm-arm/vpl011.h | 72 +++++++ xen/include/public/arch-arm.h | 6 + 7 files changed, 548 insertions(+) create mode 100644 xen/arch/arm/vpl011.c create mode 100644 xen/include/asm-arm/vpl011.h diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index d46b98c..f58019d 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -50,6 +50,13 @@ config HAS_ITS prompt "GICv3 ITS MSI controller support" if EXPERT = "y" depends on HAS_GICV3 +config SBSA_VUART_CONSOLE + bool "Emulated SBSA UART console support" + default y + ---help--- + Allows a guest to use SBSA Generic UART as a console. The + SBSA Generic UART implements a subset of ARM PL011 UART. + endmenu menu "ARM errata workaround via the alternative framework" diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 17bff98..424580b 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_HAS_GICV3) += vgic-v3.o obj-$(CONFIG_HAS_ITS) += vgic-v3-its.o obj-y += vm_event.o obj-y += vtimer.o +obj-$(CONFIG_SBSA_VUART_CONSOLE) += vpl011.o obj-y += vpsci.o obj-y += vuart.o diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c new file mode 100644 index 0000000..56d9cbe --- /dev/null +++ b/xen/arch/arm/vpl011.c @@ -0,0 +1,454 @@ +/* + * arch/arm/vpl011.c + * + * Virtual PL011 UART + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Since pl011 registers are 32-bit registers, all registers + * are handled similarly allowing 8-bit, 16-bit and 32-bit + * accesses except 64-bit access. + */ +static bool vpl011_reg32_check_access(struct hsr_dabt dabt) +{ + return (dabt.size != DABT_DOUBLE_WORD); +} + +static void vpl011_update_interrupt_status(struct domain *d) +{ + struct vpl011 *vpl011 = &d->arch.vpl011; + uint32_t uartmis = vpl011->uartris & vpl011->uartimsc; + + /* + * This function is expected to be called with the lock taken. + */ + ASSERT(spin_is_locked(&vpl011->lock)); + + /* + * TODO: PL011 interrupts are level triggered which means + * that interrupt needs to be set/clear instead of being + * injected. However, currently vGIC does not handle level + * triggered interrupts properly. This function needs to be + * revisited once vGIC starts handling level triggered + * interrupts. + */ + + /* + * Raise an interrupt only if any additional interrupt + * status bit has been set since the last time. + */ + if ( uartmis & ~vpl011->shadow_uartmis ) + vgic_vcpu_inject_spi(d, GUEST_VPL011_SPI); + + vpl011->shadow_uartmis = uartmis; +} + +static uint8_t vpl011_read_data(struct domain *d) +{ + unsigned long flags; + uint8_t data = 0; + struct vpl011 *vpl011 = &d->arch.vpl011; + struct xencons_interface *intf = vpl011->ring_buf; + XENCONS_RING_IDX in_cons, in_prod; + + VPL011_LOCK(d, flags); + + in_cons = intf->in_cons; + in_prod = intf->in_prod; + + smp_rmb(); + + /* + * It is expected that there will be data in the ring buffer when this + * function is called since the guest is expected to read the data register + * only if the TXFE flag is not set. + * If the guest still does read when TXFE bit is set then 0 will be returned. + */ + if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) > 0 ) + { + data = intf->in[xencons_mask(in_cons, sizeof(intf->in))]; + in_cons += 1; + smp_mb(); + intf->in_cons = in_cons; + } + else + gprintk(XENLOG_ERR, "vpl011: Unexpected IN ring buffer empty\n"); + + if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) == 0 ) + { + vpl011->uartfr |= RXFE; + vpl011->uartris &= ~RXI; + } + + vpl011->uartfr &= ~RXFF; + + vpl011_update_interrupt_status(d); + + VPL011_UNLOCK(d, flags); + + /* + * Send an event to console backend to indicate that data has been + * read from the IN ring buffer. + */ + notify_via_xen_event_channel(d, vpl011->evtchn); + + return data; +} + +static void vpl011_write_data(struct domain *d, uint8_t data) +{ + unsigned long flags; + struct vpl011 *vpl011 = &d->arch.vpl011; + struct xencons_interface *intf = vpl011->ring_buf; + XENCONS_RING_IDX out_cons, out_prod; + + VPL011_LOCK(d, flags); + + out_cons = intf->out_cons; + out_prod = intf->out_prod; + + smp_mb(); + + /* + * It is expected that the ring is not full when this function is called + * as the guest is expected to write to the data register only when the + * TXFF flag is not set. + * In case the guest does write even when the TXFF flag is set then the + * data will be silently dropped. + */ + if ( xencons_queued(out_prod, out_cons, sizeof(intf->out)) != + sizeof (intf->out) ) + { + intf->out[xencons_mask(out_prod, sizeof(intf->out))] = data; + out_prod += 1; + smp_wmb(); + intf->out_prod = out_prod; + } + else + gprintk(XENLOG_ERR, "vpl011: Unexpected OUT ring buffer full\n"); + + if ( xencons_queued(out_prod, out_cons, sizeof(intf->out)) == + sizeof (intf->out) ) + { + vpl011->uartfr |= TXFF; + vpl011->uartris &= ~TXI; + } + + vpl011->uartfr |= BUSY; + + vpl011->uartfr &= ~TXFE; + + vpl011_update_interrupt_status(d); + + VPL011_UNLOCK(d, flags); + + /* + * Send an event to console backend to indicate that there is + * data in the OUT ring buffer. + */ + notify_via_xen_event_channel(d, vpl011->evtchn); +} + +static int vpl011_mmio_read(struct vcpu *v, + mmio_info_t *info, + register_t *r, + void *priv) +{ + struct hsr_dabt dabt = info->dabt; + uint32_t vpl011_reg = (uint32_t)(info->gpa - GUEST_PL011_BASE); + struct vpl011 *vpl011 = &v->domain->arch.vpl011; + struct domain *d = v->domain; + unsigned long flags; + + switch ( vpl011_reg ) + { + case DR: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + *r = vreg_reg32_extract(vpl011_read_data(d), info); + return 1; + + case RSR: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + /* It always returns 0 as there are no physical errors. */ + *r = 0; + return 1; + + case FR: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + *r = vreg_reg32_extract(vpl011->uartfr, info); + VPL011_UNLOCK(d, flags); + return 1; + + case RIS: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + *r = vreg_reg32_extract(vpl011->uartris, info); + VPL011_UNLOCK(d, flags); + return 1; + + case MIS: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + *r = vreg_reg32_extract(vpl011->uartris & vpl011->uartimsc, + info); + VPL011_UNLOCK(d, flags); + return 1; + + case IMSC: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + *r = vreg_reg32_extract(vpl011->uartimsc, info); + VPL011_UNLOCK(d, flags); + return 1; + + case ICR: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + /* Only write is valid. */ + return 0; + + default: + gprintk(XENLOG_ERR, "vpl011: unhandled read r%d offset %#08x\n", + dabt.reg, vpl011_reg); + return 0; + } + + return 1; + +bad_width: + gprintk(XENLOG_ERR, "vpl011: bad read width %d r%d offset %#08x\n", + dabt.size, dabt.reg, vpl011_reg); + domain_crash_synchronous(); + return 0; + +} + +static int vpl011_mmio_write(struct vcpu *v, + mmio_info_t *info, + register_t r, + void *priv) +{ + struct hsr_dabt dabt = info->dabt; + uint32_t vpl011_reg = (uint32_t)(info->gpa - GUEST_PL011_BASE); + struct vpl011 *vpl011 = &v->domain->arch.vpl011; + struct domain *d = v->domain; + unsigned long flags; + + switch ( vpl011_reg ) + { + case DR: + { + uint32_t data = 0; + + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + vreg_reg32_update(&data, r, info); + data &= 0xFF; + vpl011_write_data(v->domain, data); + return 1; + } + + case RSR: /* Nothing to clear. */ + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + return 1; + + case FR: + case RIS: + case MIS: + goto write_ignore; + + case IMSC: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + vreg_reg32_update(&vpl011->uartimsc, r, info); + vpl011_update_interrupt_status(v->domain); + VPL011_UNLOCK(d, flags); + return 1; + + case ICR: + if ( !vpl011_reg32_check_access(dabt) ) goto bad_width; + + VPL011_LOCK(d, flags); + vreg_reg32_clearbits(&vpl011->uartris, r, info); + vpl011_update_interrupt_status(d); + VPL011_UNLOCK(d, flags); + return 1; + + default: + gprintk(XENLOG_ERR, "vpl011: unhandled write r%d offset %#08x\n", + dabt.reg, vpl011_reg); + return 0; + } + +write_ignore: + return 1; + +bad_width: + gprintk(XENLOG_ERR, "vpl011: bad write width %d r%d offset %#08x\n", + dabt.size, dabt.reg, vpl011_reg); + domain_crash_synchronous(); + return 0; + +} + +static const struct mmio_handler_ops vpl011_mmio_handler = { + .read = vpl011_mmio_read, + .write = vpl011_mmio_write, +}; + +static void vpl011_data_avail(struct domain *d) +{ + unsigned long flags; + struct vpl011 *vpl011 = &d->arch.vpl011; + struct xencons_interface *intf = vpl011->ring_buf; + XENCONS_RING_IDX in_cons, in_prod, out_cons, out_prod; + XENCONS_RING_IDX in_ring_qsize, out_ring_qsize; + + VPL011_LOCK(d, flags); + + in_cons = intf->in_cons; + in_prod = intf->in_prod; + out_cons = intf->out_cons; + out_prod = intf->out_prod; + + smp_rmb(); + + in_ring_qsize = xencons_queued(in_prod, + in_cons, + sizeof(intf->in)); + + out_ring_qsize = xencons_queued(out_prod, + out_cons, + sizeof(intf->out)); + + /* Update the uart rx state if the buffer is not empty. */ + if ( in_ring_qsize != 0 ) + { + vpl011->uartfr &= ~RXFE; + if ( in_ring_qsize == sizeof(intf->in) ) + vpl011->uartfr |= RXFF; + vpl011->uartris |= RXI; + } + + /* Update the uart tx state if the buffer is not full. */ + if ( out_ring_qsize != sizeof(intf->out) ) + { + vpl011->uartfr &= ~TXFF; + vpl011->uartris |= TXI; + if ( out_ring_qsize == 0 ) + { + vpl011->uartfr &= ~BUSY; + vpl011->uartfr |= TXFE; + } + } + + vpl011_update_interrupt_status(d); + + VPL011_UNLOCK(d, flags); +} + +static void vpl011_notification(struct vcpu *v, unsigned int port) +{ + vpl011_data_avail(v->domain); +} + +int domain_vpl011_init(struct domain *d, struct vpl011_init_info *info) +{ + int rc; + struct vpl011 *vpl011 = &d->arch.vpl011; + + if ( vpl011->ring_buf ) + return -EINVAL; + + /* Map the guest PFN to Xen address space. */ + rc = prepare_ring_for_helper(d, + gfn_x(info->gfn), + &vpl011->ring_page, + &vpl011->ring_buf); + if ( rc < 0 ) + goto out; + + rc = vgic_reserve_virq(d, GUEST_VPL011_SPI); + if ( !rc ) + { + rc = -EINVAL; + goto out1; + } + + rc = alloc_unbound_xen_event_channel(d, 0, info->console_domid, + vpl011_notification); + if ( rc < 0 ) + goto out2; + + vpl011->evtchn = info->evtchn = rc; + + spin_lock_init(&vpl011->lock); + + register_mmio_handler(d, &vpl011_mmio_handler, + GUEST_PL011_BASE, GUEST_PL011_SIZE, NULL); + + return 0; + +out2: + vgic_free_virq(d, GUEST_VPL011_SPI); + +out1: + destroy_ring_for_helper(&vpl011->ring_buf, vpl011->ring_page); + +out: + return rc; +} + +void domain_vpl011_deinit(struct domain *d) +{ + struct vpl011 *vpl011 = &d->arch.vpl011; + + if ( !vpl011->ring_buf ) + return; + + free_xen_event_channel(d, vpl011->evtchn); + destroy_ring_for_helper(&vpl011->ring_buf, vpl011->ring_page); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index b174c65..4c804eb 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -11,6 +11,7 @@ #include #include #include +#include struct hvm_domain { @@ -145,6 +146,11 @@ struct arch_domain struct { uint8_t privileged_call_enabled : 1; } monitor; + +#ifdef CONFIG_SBSA_VUART_CONSOLE + struct vpl011 vpl011; +#endif + } __cacheline_aligned; struct arch_vcpu diff --git a/xen/include/asm-arm/pl011-uart.h b/xen/include/asm-arm/pl011-uart.h index 123f477..57e9ec7 100644 --- a/xen/include/asm-arm/pl011-uart.h +++ b/xen/include/asm-arm/pl011-uart.h @@ -49,6 +49,8 @@ /* FR bits */ #define TXFE (1<<7) /* TX FIFO empty */ #define RXFE (1<<4) /* RX FIFO empty */ +#define TXFF (1<<5) /* TX FIFO full */ +#define RXFF (1<<6) /* RX FIFO full */ #define BUSY (1<<3) /* Transmit is not complete */ /* LCR_H bits */ diff --git a/xen/include/asm-arm/vpl011.h b/xen/include/asm-arm/vpl011.h new file mode 100644 index 0000000..1b583da --- /dev/null +++ b/xen/include/asm-arm/vpl011.h @@ -0,0 +1,72 @@ +/* + * include/xen/vpl011.h + * + * Virtual PL011 UART + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; If not, see . + */ + +#ifndef _VPL011_H_ +#define _VPL011_H_ + +#include +#include +#include +#include + +/* helper macros */ +#define VPL011_LOCK(d,flags) spin_lock_irqsave(&(d)->arch.vpl011.lock, flags) +#define VPL011_UNLOCK(d,flags) spin_unlock_irqrestore(&(d)->arch.vpl011.lock, flags) + +struct vpl011 { + void *ring_buf; + struct page_info *ring_page; + uint32_t uartfr; /* Flag register */ + uint32_t uartcr; /* Control register */ + uint32_t uartimsc; /* Interrupt mask register*/ + uint32_t uarticr; /* Interrupt clear register */ + uint32_t uartris; /* Raw interrupt status register */ + uint32_t shadow_uartmis; /* shadow masked interrupt register */ + spinlock_t lock; + evtchn_port_t evtchn; +}; + +struct vpl011_init_info { + domid_t console_domid; + gfn_t gfn; + evtchn_port_t evtchn; +}; + +#ifdef CONFIG_SBSA_VUART_CONSOLE +int domain_vpl011_init(struct domain *d, + struct vpl011_init_info *info); +void domain_vpl011_deinit(struct domain *d); +#else +static inline int domain_vpl011_init(struct domain *d, + struct vpl011_init_info *info) +{ + return -ENOSYS; +} + +static inline void domain_vpl011_deinit(struct domain *d) { } +#endif +#endif /* _VPL011_H_ */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index 8f9d06e..5708cd2 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -410,6 +410,10 @@ typedef uint64_t xen_callback_t; #define GUEST_ACPI_BASE 0x20000000ULL #define GUEST_ACPI_SIZE 0x02000000ULL +/* PL011 mappings */ +#define GUEST_PL011_BASE 0x22000000ULL +#define GUEST_PL011_SIZE 0x00001000ULL + /* * 16MB == 4096 pages reserved for guest to use as a region to map its * grant table in. @@ -444,6 +448,8 @@ typedef uint64_t xen_callback_t; #define GUEST_TIMER_PHYS_NS_PPI 30 #define GUEST_EVTCHN_PPI 31 +#define GUEST_VPL011_SPI 32 + /* PSCI functions */ #define PSCI_cpu_suspend 0 #define PSCI_cpu_off 1 From patchwork Fri Sep 22 08:23: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: 113977 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011067qgf; Fri, 22 Sep 2017 01:26:01 -0700 (PDT) X-Received: by 10.36.29.199 with SMTP id 190mr5107263itj.78.1506068760996; Fri, 22 Sep 2017 01:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068760; cv=none; d=google.com; s=arc-20160816; b=bufPdBC2rkKIGJn6piNtC3/qVGhzL0Rl+cCs8J/p0ZYSXcgtoLIXSzTrB90MEczMMM pcNP4MTeXpXfoN8x2sryvO5/mnoK3mg9Cfgh1L4/TD9aQVPhnBufEnhKOaMoaAR3xOOF 866P2ywtsWu2GTEwC9/Tqku3kQzGPec8exsOXTSLv3/6X3AgQ7Bzsb60y3Wncrlgq52S 1HggNZLYlph3egmAlntkoLeuj+K4VbQYKRPte/9E8d8wcbZ9lP15eBpVncgpdWFVWLTY NtrnmbGxB7jHTQ2nZzWkSxa6Y6Xj7tR5peQdh7aJnLiHm3gW/k6IvaYbAqZTHvE0ULra MjZw== 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=klGr0wjt/cRXEvifSj+NZKMDEuao7tXzg8ZLaQPXQPEMF8kjM/ZzBRAgu22RuJaJem SSnxi7191Cz6Iisk8B9sjfBbacgYVcnsK+wSRwLO0dzSmyqyZl/rFBUrLLZ9S7SxcGlm aSd+yHcBG2XSegmJlrWokivDSbKp1CXa1eapTIqFez5KJHg8xWFhWzRzq8Ct1MTtivTi Iv3rszu5eg1Ltcf9UXadEzlJygyY7x0MNJYcto2Rb/aryBpjDvKO1aMMNpOjj08BlX2V MgP1L5UzA2Q9c2QF/nWXH+/xlhjoloNMXWf1SZH6F6MsNCddCew8xsrTdCUhOwpTiI7z EMKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=B5WnlwJl; 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 e198si3423503ite.80.2017.09.22.01.26.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26: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=B5WnlwJl; 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 1dvJFU-0003er-NZ; Fri, 22 Sep 2017 08:23:48 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFT-0003eG-JF for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:23:47 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id 18/62-20972-298C4C95; Fri, 22 Sep 2017 08:23:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEIsWRWlGSWpSXmKPExsXiVRtsoDvhxJF Ig1+fFC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozfNxrYC15JVhy+sIStgfGOaBcjF4eQwFRG ieczbrGAOCwC85glNhx8xAziSAj0s0q8vtHE1MXICeTkSTyavYQFwk6T2Lb/LZRdIfFz0TJmE FtIQEvi6KnZrBD2DiaJc5N9uhg5ONgETCRmdUiAhEUElCTurZrMBDKfWWA+o0TTpF42kISwQK TErAWNjCA2i4CqxKUdfWBxXgFviSMHXkDtkpO4ea4TbBengI/E2v8bWCB2eUtsvXGVZQKj4AJ GhlWMGsWpRWWpRbpGhnpJRZnpGSW5iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmbGIEhxwAEOxj/ LAs4xCjJwaQkyvv4yJFIIb6k/JTKjMTijPii0pzU4kOMMhwcShK89seBcoJFqempFWmZOcDgh 0lLcPAoifCGg6R5iwsSc4sz0yFSpxiNOfbtufWHiaPj5t0/TEIsefl5qVLivAEgpQIgpRmleX CDYFF5iVFWSpiXEeg0IZ6C1KLczBJU+VeM4hyMSsK8iiBTeDLzSuD2vQI6hQnolPLVYKeUJCK kpBoYHZKehLVmOdgk25gzHuis/8QuGS6TvC1WJ/kF79QX3Yfn/U/vOaH+TZ2pq26raIib3/VZ jkcq3ier/3/TavGu084uqaPPekYeZ3/KxAnO/8TaVuqoM3ZxJuzhvvy77IjVBM93zodKxdw28 N/+EGh2K3bzKqFpVWddDiZvY9wqlVtoonLFRluJpTgj0VCLuag4EQAxhH6vxQIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-2.tower-27.messagelabs.com!1506068623!58454576!1 X-Originating-IP: [74.125.83.48] 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 12289 invoked from network); 22 Sep 2017 08:23:44 -0000 Received: from mail-pg0-f48.google.com (HELO mail-pg0-f48.google.com) (74.125.83.48) by server-2.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:23:44 -0000 Received: by mail-pg0-f48.google.com with SMTP id 7so238532pgd.13 for ; Fri, 22 Sep 2017 01:23:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1SnejLuK1E7QinOqF2LtaUIP1aM9kOWy3HE1yvqUZqQ=; b=B5WnlwJlaSxYPcojLmUFf2c81f6B+IZ7JbfbqmTbqqmDC/NmX8Z/h3K44UsQ7bQt+3 Lsj8rZsbU1sAaBAjQJ2rTSdH5PrY1A6MutD10daVQ8sOVStF0h+Af5Kdq953xPVE6BC2 8obZTJDmNYOp9SBQLrQA/O0QT80DAlglPJ4WA= 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=JUhPWO1GV3TdD4gHT3jlITQGVdiv+kAomx3V8w8Zlg2P5UqvUlpBUZO8N+PAAjlEDf hp9TgQTmWM/sv2HzUoKPpK+gqlCqYmtH4dADG8Aa1qD3tplaS/bksPTR3FLKTE8NLPk3 JzN55XnSZF4kxpfa76knk/m8dFl7ted1QeqLgHzOw3fVnz9eGQALIOBld34+g2vH28Hj 99D14HFN9UdtEshP8q8re0p3J0pbRR7ftrUna+/7fdWlfOzU5sJJd15UUz0xdCz4ef37 vxSe9WbBM/BlZ/m1xuzIrf9HWWgBv7BNKuHjnHH0nR7/Zllclj8cbCL9WOayO57wHB+x 2Mmw== X-Gm-Message-State: AHPjjUgdG18F1AO66AbYP0sPcBIdi5QsOENY3mcYRlVuYMZ/5mQLC2Lm Imz4oC32aNUQbn9OPeEjNeeC2f6xjk0= X-Google-Smtp-Source: AOwi7QBqd3KGhJUIepJmq4WoT+bs2KW4ZF+cTMFfjs6EYROv9kVc90GB3j2DksaIYfI16hF8M6mOaQ== X-Received: by 10.84.133.66 with SMTP id 60mr8380825plf.386.1506068622923; Fri, 22 Sep 2017 01:23:42 -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 f74sm5569284pfa.36.2017.09.22.01.23.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:23:42 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:02 +0530 Message-Id: <1506068606-17066-4-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 03/27 v10] 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 Fri Sep 22 08:23: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: 113981 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011126qgf; Fri, 22 Sep 2017 01:26:04 -0700 (PDT) X-Received: by 10.36.249.69 with SMTP id l66mr4788466ith.85.1506068764626; Fri, 22 Sep 2017 01:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068764; cv=none; d=google.com; s=arc-20160816; b=TJIggKXYOspT1jIBolwArICY2A94jepYOL2aSQ07AOhGRaHS0yCWdaQ15mOpgSMouZ L6KGfxB3Az55NGmJPgW8K+FoDuScAoeXBMyl6FJeJy0BtCbAl8LIL5ogibNNOuTEe1WU 32woX5euDQcepp18vvPHhsn/Hu8OFP4Nk+QEf9DyTfbry+S9ffxXOTizmURepr4BBy1e SGFbbNV7NzsuCVUMe+GMA1+eba2XieolckRHWE/6ZfjNGhqhYpNvM1gqRvXs3dsFGx40 QwgAFT5XtyMULx/z0fjHR1gqPxJMZ+Tc/Uu3RZVh2lpsCF08hsRUA5y5wtojefCloSWR krPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=CE5Bdy5qyzmR31Oifvf1YJnVhxYEBxdqf0MkgR7yYzw=; b=OCu5Itgj/QcpuoA8EUk4kiKlCaWQu4uKJdz9GYtrNHjjmO4n35DsUDyYtrA27qQqNG L3QQHCTs9JfqNfqVDip7+kf5pOAWwQ/J04q9pO9iDHoDv0EQPOmZLfqB3zzwA6Vq/oY1 pWmMiKx/EPlKJG43sc3q2+d028YF4m7jKWAuL7+dh26tEgcl7jr/WGuaRhXvPHvBV2F+ h25s+8++WpN6oSov3hfElizMRuhRwOWbh8DtDebsEcyvZGQ8vlGmIBq6CnurIzLVjqKZ X80KbzaZcSb0wC9g10vUF++ZCG8zwJ+3bSt8t5MGyuOplvc+bnzSSk+fqDzzZi8aAIsi q8kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MGT5+tW7; 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 s71si3502767itb.75.2017.09.22.01.26.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26: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=MGT5+tW7; 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 1dvJFW-0003h7-Uc; Fri, 22 Sep 2017 08:23:50 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFV-0003en-3p for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:23:49 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id 5B/9C-30935-498C4C95; Fri, 22 Sep 2017 08:23:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRWlGSWpSXmKPExsVyMfTAGt3JJ45 EGkzaqGLxfctkJgdGj8MfrrAEMEaxZuYl5VcksGY0NjWzFmwwqfiwqp25gfGcZhcjF4eQwAxG idlr9rN2MXJysAjMY5ZYtBAsISHQzyrRvu0eE0hCQiBPYu/RPjYIO03iUe8OIJsDyK6UOLugH iQsJKAlcfTUbFYIeweTxK7liSAlbAImErM6JEDCIgJKEvdWTWYCGc8sMJ9RomlSL9hIYQEviV /rTrFA3KAqMXffNEYQm1fAW2LS+05GiLVyEjfPdTKD2JwCPhJr/29ggdjlLbH1xlWWCYyCCxg ZVjGqF6cWlaUW6ZrpJRVlpmeU5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEBhsDEOxgnNrg fIhRkoNJSZT38ZEjkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeO2PA+UEi1LTUyvSMnOAYQ+Tl uDgURLhDQdJ8xYXJOYWZ6ZDpE4x2nNcuHPpDxPHsU2XgeSBPbeAZMfNu3+YhFjy8vNSpcR5A0 DaBEDaMkrz4IbC4vQSo6yUMC8j0JlCPAWpRbmZJajyrxjFORiVhHkVQabwZOaVwO1+BXQWE9B Z5avBzipJREhJNTBatBt/9WJbdVX/LJ/fm936vO93pzYuX2hrqMN1/HHoJL3LYWkfEqYbqf87 w/oh1m1uIF/C9t5nc04ejhEQuzbhZt+rzrM83SV9pvUJphwhzjyFt3n75QqKM4rlO4wctV61N UyWVtqZsIGH7XwQv+LkHpXMbblxCayGVv83HXEXb+jZXvX0rxJLcUaioRZzUXEiAPV3ryHOAg AA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-3.tower-206.messagelabs.com!1506068626!109170707!1 X-Originating-IP: [209.85.192.172] 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 51255 invoked from network); 22 Sep 2017 08:23:47 -0000 Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by server-3.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:23:47 -0000 Received: by mail-pf0-f172.google.com with SMTP id r71so228992pfe.12 for ; Fri, 22 Sep 2017 01:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LGLhx7Och6xef4nWNZ5DPoUrb0BM0rjwbeTkFLXpAzY=; b=MGT5+tW7zQQkMGocLTatgyCg6FUSE0lSfAmIIFSkBgUKDr8L0JHRtuT8KSJqHpB3ea xah2cXPEzC3YCqhfmJSeAcs1JsAiWkTT5jUYoxfdRh3V8aTrDzCiOrZ/uY4Et7Js4sC+ NdaZTc3SMfm6BwxpwPBsSHIHw3g0xwY0r0eCA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LGLhx7Och6xef4nWNZ5DPoUrb0BM0rjwbeTkFLXpAzY=; b=F7fQEIoK/8SjV4lM3hefyY5f7NdWSxca7YW5UfPye1JcSvoOhbs/vUF2p8ZXwnVHGf y5xjjcIJAFFAAIzyGsYxLvH3PIC8MPz5r4feczDsOs7Mn8rZIdJ4taOy995ryaUiOsj+ zenaLDq0Y1pMGgAKic+phQ+1+qT5QdhoLvQGmYyryPIwDZ1FrsrvKld3yCPP+vuaQeuX txjaefV4QpC9XxQolCD24/IE63NqoMDIMf26y21sS+z779uquLmAyI8z5ABywqrGG7dm GRtqzRlpffV8b0x+EHXHYhK0yIjcAfDyI3OjbSqvc+f7pLqbSrNacZti/gK1n8e8gqqz b6Sw== X-Gm-Message-State: AHPjjUgSNQ4aokkKzcQNgY3ueMbHg+sK6j0dmdsi7gKAW0XSVosscc+J oh5GvApRFCIOvslDNvARf/VZpLni8ks= X-Google-Smtp-Source: AOwi7QCjaZab/SP9BQ41exIS3d9OdcYmNUv1pepaQaZcC89HsFUen2auyn9MDGQQrPLkb84/DHIAfg== X-Received: by 10.84.129.226 with SMTP id b89mr8349645plb.42.1506068625759; Fri, 22 Sep 2017 01:23:45 -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 f74sm5569284pfa.36.2017.09.22.01.23.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:23:45 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:03 +0530 Message-Id: <1506068606-17066-5-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 04/27 v10] xen/arm: vpl011: Add support for vuart in libxl X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" An option is provided in libxl to enable/disable SBSA vuart while creating a guest domain. Libxl now supports a generic vuart console and SBSA uart is a specific type. In future support can be added for multiple vuart of different types. User can enable SBSA vuart by adding the following line in the guest configuration file: vuart = "sbsa_uart" Signed-off-by: Bhupinder Thakur Acked-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v4: - Renamed "pl011" to "sbsa_uart". Changes since v3: - Added a new config option CONFIG_VUART_CONSOLE to enable/disable vuart console support. - Moved libxl_vuart_type to arch-arm part of libxl_domain_build_info - Updated xl command help to mention new console type - vuart. Changes since v2: - Defined vuart option as an enum instead of a string. - Removed the domain creation flag defined for vuart and the related code to pass on the information while domain creation. Now vpl011 is initialized independent of domain creation through new DOMCTL APIs. tools/libxl/libxl.h | 7 +++++++ tools/libxl/libxl_console.c | 3 +++ tools/libxl/libxl_dom.c | 1 + tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_types.idl | 7 +++++++ tools/xl/xl_cmdtable.c | 2 +- tools/xl/xl_console.c | 5 ++++- tools/xl/xl_parse.c | 8 ++++++++ 8 files changed, 34 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 7d853ca..9dfd964 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -308,9 +308,16 @@ /* * LIBXL_HAVE_P9S indicates that the p9 field in IDL has been changed to p9s */ + #define LIBXL_HAVE_P9S 1 /* + * LIBXL_HAVE_BUILDINFO_ARM_VUART indicates that the toolstack supports virtual UART + * for ARM. + */ +#define LIBXL_HAVE_BUILDINFO_ARM_VUART 1 + +/* * libxl ABI compatibility * * The only guarantee which libxl makes regarding ABI compatibility diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index 68511d7..f4f64ad 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -67,6 +67,9 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, case LIBXL_CONSOLE_TYPE_SERIAL: cons_type_s = "serial"; break; + case LIBXL_CONSOLE_TYPE_VUART: + cons_type_s = "vuart"; + break; default: goto out; } diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index f54fd49..e0f0d78 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -803,6 +803,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid, if (xc_dom_translated(dom)) { state->console_mfn = dom->console_pfn; state->store_mfn = dom->xenstore_pfn; + state->vuart_gfn = dom->vuart_gfn; } else { state->console_mfn = xc_dom_p2m(dom, dom->console_pfn); state->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 81e87ae..30a5cb2 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1139,6 +1139,9 @@ typedef struct { uint32_t num_vmemranges; xc_domain_configuration_t config; + + xen_pfn_t vuart_gfn; + evtchn_port_t vuart_port; } libxl__domain_build_state; _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid, diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 756e120..37ac8ec 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -105,6 +105,7 @@ libxl_console_type = Enumeration("console_type", [ (0, "UNKNOWN"), (1, "SERIAL"), (2, "PV"), + (3, "VUART"), ]) libxl_disk_format = Enumeration("disk_format", [ @@ -240,6 +241,11 @@ libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (2, "COLO"), ]) +libxl_vuart_type = Enumeration("vuart_type", [ + (0, "unknown"), + (1, "sbsa_uart"), + ]) + # # Complex libxl types # @@ -581,6 +587,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("arch_arm", Struct(None, [("gic_version", libxl_gic_version), + ("vuart", libxl_vuart_type), ])), # Alternate p2m is not bound to any architecture or guest type, as it is # supported by x86 HVM and ARM support is planned. diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 48f0324..2126e70 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -133,7 +133,7 @@ struct cmd_spec cmd_table[] = { &main_console, 0, 0, "Attach to domain's console", "[options] \n" - "-t console type, pv or serial\n" + "-t console type, pv , serial or vuart\n" "-n console number" }, { "vncviewer", diff --git a/tools/xl/xl_console.c b/tools/xl/xl_console.c index 0508dda..4e65d73 100644 --- a/tools/xl/xl_console.c +++ b/tools/xl/xl_console.c @@ -27,6 +27,7 @@ int main_console(int argc, char **argv) uint32_t domid; int opt = 0, num = 0; libxl_console_type type = 0; + char *console_names = "pv, serial, vuart"; SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) { case 't': @@ -34,8 +35,10 @@ int main_console(int argc, char **argv) type = LIBXL_CONSOLE_TYPE_PV; else if (!strcmp(optarg, "serial")) type = LIBXL_CONSOLE_TYPE_SERIAL; + else if (!strcmp(optarg, "vuart")) + type = LIBXL_CONSOLE_TYPE_VUART; else { - fprintf(stderr, "console type supported are: pv, serial\n"); + fprintf(stderr, "console type supported are: %s\n", console_names); return EXIT_FAILURE; } break; diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 0678fbc..edcdd9e 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -965,6 +965,14 @@ void parse_config_data(const char *config_source, if (!xlu_cfg_get_long (config, "maxvcpus", &l, 0)) b_info->max_vcpus = l; + if (!xlu_cfg_get_string(config, "vuart", &buf, 0)) { + if (libxl_vuart_type_from_string(buf, &b_info->arch_arm.vuart)) { + fprintf(stderr, "ERROR: invalid value \"%s\" for \"vuart\"\n", + buf); + exit(1); + } + } + parse_vnuma_config(config, b_info); /* Set max_memkb to target_memkb and max_vcpus to avail_vcpus if From patchwork Fri Sep 22 08:23: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: 113975 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011052qgf; Fri, 22 Sep 2017 01:26:00 -0700 (PDT) X-Received: by 10.107.7.159 with SMTP id g31mr5879920ioi.250.1506068760074; Fri, 22 Sep 2017 01:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068760; cv=none; d=google.com; s=arc-20160816; b=P7eW3CYTWO9uUv9q5/645y//5+IJfY8MRlvI4k6h78OSfsW013Ag1aYMDKZnyboOMH DQVGL89pGMKkiY39az5Co6SoUG40pST69aOtf1jVRJei6f6K3AYLDROaZieBiBn3y7CR VjjFeIGsrrsl6xnH/m1MxEUEip2uD5GIvBtdWdZ46Z6JY92wq1EG6umBwbbv6nRKhEJc E5YYeUxTgUX9zfQoO6Flb9rtDc89B8GDelbKpWuUjmbkyBQTVGJihEZptkO6F+idVNu0 rC+fbGtsuTWUoNEEpd811qAbfFSKtCVuiIex/FA3jXrEvGalpDuEEdQlXNMj+dtbWy/B WC1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=tN08GY3/uorUX4O9GotsstG5RbknWBJ2tiaR4/47ta0=; b=NZbJ9gJ1++TqMlK+bYK8OOeQddzp2tGVT5bN96PQcZI0rXuQ4fykDhTalf9GgUi33B c6NkN6OV5zKDQJxYh2dfibIZP6jWzafIcxo08zTfVn1MMgFwLJa8BMr5XKHqVQPVF6k3 O4oFVBYpx4KhFbRutE+6i4YmLlwDwKxn9Bs08GqV4lUJ6lLdS6MsbXsj3awGHnurL6hD DCIfgVgpsCcePDdlKf8IdnbPPY6nRM/+RlulspQRhDNvQJoI+l9T8qZ19NTO8XaDNMl5 oYKLzBiEbNmSrwV0k+EryOiP5hzR7Ob6I4N6aDA3stFoZmXDbWvqDM9bgu7moEGG3JY0 hRPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UYLO99uy; 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 a66si3265034ite.81.2017.09.22.01.25.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26: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=UYLO99uy; 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 1dvJFX-0003hW-51; Fri, 22 Sep 2017 08:23: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 1dvJFW-0003en-Gq for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:23:50 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id 00/BC-30935-698C4C95; Fri, 22 Sep 2017 08:23:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsVyMfTANt2pJ45 EGky6Z2jxfctkJgdGj8MfrrAEMEaxZuYl5VcksGYsOpRTcIm94v/eW0wNjLfZuhg5OYQEZjBK rJgt2MXIxcEiMI9Z4vXrd6wgjoRAP6vE1ekbwKokBPIkpk15yQxhp0lMmdnIAmGXSzx5MAlqk pbE0VOzwZqFBHYwSWx/cwDI4eBgEzCRmNUhAVIjIqAkcW/VZCYQm1kgVGLq3wdgc4QFsiWer1 8CNp9FQFXi+bwuRhCbV8Bb4umpP4wQu+Qkbp7rBKvhFPCRWPt/AwvEXm+JrTeuskxgFFzAyLC KUaM4tagstUjXyEgvqSgzPaMkNzEzR9fQwFQvN7W4ODE9NScxqVgvOT93EyMw3OoZGBh3MO5p 9zvEKMnBpCTK+/jIkUghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErzfjwPlBItS01Mr0jJzgIEPk 5bg4FES4eUFBr8Qb3FBYm5xZjpE6hSjPceFO5f+MHHceHgdSB7YcwtIdty8+4dJiCUvPy9VSp x3PshUAZC2jNI8uKGwSL3EKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZh3FsgUnsy8Erjdr4D OYgI6q3w12FkliQgpqQbG9KyaBYciXx67Ld/E6LwkZLJ33wSdxYnXtdwXCPfFb2Df1HXGIjvC Mscg5tXnBEb9k92CXjs5VXk2rbl27tAxWaaaFVuePEvZeDqkYe6evDOcCbVd78JqLrHGr3+mN //LnWn2h0OD2dXtIyQ5ZBaYHNmxKDD+QKKJFltpt9evs9oRG+SP7WRSYinOSDTUYi4qTgQA9i Obzs8CAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-13.tower-206.messagelabs.com!1506068628!97252659!1 X-Originating-IP: [209.85.192.182] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56185 invoked from network); 22 Sep 2017 08:23:49 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-13.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:23:49 -0000 Received: by mail-pf0-f182.google.com with SMTP id g65so228382pfe.13 for ; Fri, 22 Sep 2017 01:23:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NcuXv+CZc89ZmONq94DxQZ/VYburH6TvSZVWD6FvN2A=; b=UYLO99uyA1YZ+Gow6iYGP2ur8KK4hN+MZ5UUBhlemuJcNocfd3X2k2uUkCQiNMnQgV HUDX4ft7GI73jwbJqos0w6pmnrlbWp2RG9OLrktVKuH1ozh+crtg+1a8pj5X1yzLJeoI AwueIkIV5gLo0PCEVbFASxciOLQ+cczRRBqEQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NcuXv+CZc89ZmONq94DxQZ/VYburH6TvSZVWD6FvN2A=; b=HM8oOrsciM0486yh5suFjwi7nAbUjD3d5c77nnX+C4Aw0kYOVPQ6R0DubC5AzfeYyk yUgxGGLgpJ/QIMGXADVQI4sEgah6Zct58kOonfvQD+zxBV+vkCpTCS6Bi/hrP0FofL3U 7ODhJfk3kLPiVSmwQd8ts4t7s2OF3jIdv97XNouh8O+i7Gz3TrW60ouepVm6yqgu2OmN 0JHmjI1UnOxAOSB/QkLBt1QGWgX6+Dk4SJiAEMXidil2IVyCS1l1GfDnQJr3KTrwfNkh Sica8VZv83TNS8uG08CPbZynX+6IREn/++TS4JWH7Bn2vqCtuIDF8jc0z0TRvBXzP/X3 g/0Q== X-Gm-Message-State: AHPjjUgreoMPoCtnocsJJVpjxLQj0lgMyyMySj4da9QJcE18pu4qrIUM zmm7ATwChIMX3+UzHpyroioDJV6Ldv8= X-Google-Smtp-Source: AOwi7QAdaWChg4MsmWy5fTgqIVF9D6ak6Dszw8Rmdm2Vvp6wUcbeh71Fsgwv+yWKjP3cjiaddbfhkA== X-Received: by 10.99.119.5 with SMTP id s5mr8797622pgc.344.1506068628087; Fri, 22 Sep 2017 01:23:48 -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 f74sm5569284pfa.36.2017.09.22.01.23.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:23:47 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:04 +0530 Message-Id: <1506068606-17066-6-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 05/27 v10] xen/arm: vpl011: Rearrange xen header includes in alphabetical order in domctl.c X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Rearrange xen header includes in alphabetical order in domctl.c. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Reviewed-by: Julien Grall --- CC: Stefano Stabellini CC: Julien Grall Changes since v5: - Corrected include of in alphabetical order. xen/arch/arm/domctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c index 24bcb55..8232f44 100644 --- a/xen/arch/arm/domctl.c +++ b/xen/arch/arm/domctl.c @@ -4,12 +4,12 @@ * Copyright (c) 2012, Citrix Systems */ -#include -#include #include -#include #include #include +#include +#include +#include #include #include From patchwork Fri Sep 22 08:23: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: 113978 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011082qgf; Fri, 22 Sep 2017 01:26:02 -0700 (PDT) X-Received: by 10.159.48.89 with SMTP id i25mr4576263uab.177.1506068762604; Fri, 22 Sep 2017 01:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068762; cv=none; d=google.com; s=arc-20160816; b=ANnGSeteZDWDJXsTNL7C+ckD0V1TCv2qFcp4lOgyOYvCqFPs6VanU7dsRgamUc9Cyo ueHz2HlaQ8cbAqs2y4+3h80wfQYTyFI6WGuIXOBk7ZrWJ0q1NM1tmkAd0R2Qv0DpGtP+ X4gcmeqLimrXC0wJU7rvFAaP8yGUFplMtL7x1RA66eMOpCR2ofh4Zj02vjaYJVV7EdYW sJmtrT30T9xHt0Qiua9HM6w/3r3HLKvLmguLmGs4qSTWmz/CP0UeeP56D6EgqrCKtJb6 xbxqBIG7MI7lOpTlaFdYFnsbgBHxpV9KAfS6LQtTpDz/QDSJosB+03oOUQ0GYBlIc/M2 2S3A== 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=t+Abz5eD6p/96o6MqNI6vxvbV40bE7e/LusAaiNBg6Q=; b=dfqiWLk1Ogq4nk4yn6F4S546s3/dpvL9d2CUJVVunSz7S20/8TUQOJYmr+193rqNou a/VxpchJ9eMvTgmBl4G9zE7gUfzpfVxzTd/ydIHif2wJLEXmgigBeIswfAvoOg33M88v bPdkDAEGwUF1BcRAGuEj2NVsUnW+EYqKi3V6jCUp+rPPRoX2bvaVqfJ9Db55wCCf4crP fuaFRSj0gFwBNIX7RbMpakuuer2b/aEjTZ9nfd0nhUWy97C6C2OqQmGT++91ndFk4xFy /toob+ZoC8PCbmCzv9l/U4UWUUKVn54KX3Cb5xOUG+o4luMRUEsIcDIpZLMO5eriycdx LL5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kPiGdBmS; 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 r189si1124397vkb.355.2017.09.22.01.26.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26: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=kPiGdBmS; 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 1dvJFd-0003lB-Ct; Fri, 22 Sep 2017 08:23:57 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFc-0003kW-4B for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:23:56 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id DE/36-02202-B98C4C95; Fri, 22 Sep 2017 08:23:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRWlGSWpSXmKPExsVyMfTAVt1ZJ45 EGnxYK23xfctkJgdGj8MfrrAEMEaxZuYl5VcksGZs/7uYqWBBVsX7d+/ZGxiX+3YxcnEICUxj lHj1/AQziMMiMI9Z4tGedUwgjoRAP6tEz98PrF2MnEBOnsSR1nvMEHaaxL+e0ywQdqVE9+upj CC2kICWxNFTs1kh7B1MEnNnenUxcnCwCZhIzOqQAAmLCChJ3Fs1mQnEZhZ4ziQx7ZIOSImwQK jEkwexIGEWAVWJ3713wSbyCnhL3P32DWqrnMTNc51gNqeAj8Ta/xtYIDZ5S2y9cZVlAqPgAka GVYzqxalFZalFukZ6SUWZ6RkluYmZObqGBqZ6uanFxYnpqTmJScV6yfm5mxiBwcYABDsYv/9x OsQoycGkJMr7+MiRSCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvPbHgXKCRanpqRVpmTnAsIdJS 3DwKInwhoOkeYsLEnOLM9MhUqcYLTku3Ln0h4njwJ5bQLLj5t0/TEIsefl5qVLivG+PATUIgD RklObBjYPF5iVGWSlhXkagA4V4ClKLcjNLUOVfMYpzMCoJ88aArOXJzCuB2/oK6CAmoIPKV4M dVJKIkJJqYMw+GRaqsFTjq7tsg+jm4sM9Th9fF6rMcb+/uSug1NxleoyD48LHLSUVKeLKgry/ bmi1Mchksz7kXGzLbh8n+fbk6jM/9T/t//ukceYjxSjOd8myyzdfPql9fXeoPKuhtyHz3Lkll 3192U7/nezq/S+T56qactCuHxefLDs/z2NW6013Obf/pkosxRmJhlrMRcWJALy+CCLIAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-206.messagelabs.com!1506068633!112612442!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 27720 invoked from network); 22 Sep 2017 08:23:54 -0000 Received: from mail-pf0-f181.google.com (HELO mail-pf0-f181.google.com) (209.85.192.181) by server-8.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:23:54 -0000 Received: by mail-pf0-f181.google.com with SMTP id e1so243498pfk.1 for ; Fri, 22 Sep 2017 01:23:54 -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=xAVx/9djSNkNSzEiTUbQdyX+QeiLHt8o6q+CtqQEDmQ=; b=kPiGdBmSsfo/xri9hvrChXOQAuCSzGpyBPRt5NBIWLA0lmKNFdFxqL7u+b4ZGuZRXv RbwgsGb3ZZRBPoSaWK50SD+OBU2Y6IMmoR+mLJfjPTYe9t4AKVh7TTMnCdBrQOgx8LCx Aplil1Fcaj++2RqoAbJMEsZ1OWQr9x0YdsAwY= 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=xAVx/9djSNkNSzEiTUbQdyX+QeiLHt8o6q+CtqQEDmQ=; b=eHZKNFbmdqfxMA7mnyYXa6hCOQol6armI8YMyHr0Ozt9t/2vDIE6n55HNWBuqvKkJS 6OYQJzB4wzW0m1saoN1yeVibN4uE0sqE7X6KlIVUafxLMQYGVYu3CZQf09AIOw05QmlF IDLcceWaVrbxgb+mfx4+ndTsB3yiaFJP6mExYVufZ7Ii9Mf3KuogpMrxNTgr12qBTTkm 9bl7LaXO5ptirvz9FfKBwS8OZMqyOwcFQemNEk2OzhEF5wDtepC3/UEs69D8xxp8rS6n gbxBuYvPRI86ycFm/ilOO0zfBvaI+kKkrXoan9oO/CVlaP91UJMTYu4VFUFcCuW+p4vS l3iA== X-Gm-Message-State: AHPjjUgShA7xc4e2TY99G42skdQcHEU008vZAVfWCnI8IuR/fFJt3PHy JoUav76Oe44c2TAWGkH7smVGBNut31c= X-Google-Smtp-Source: AOwi7QB7rD0MpcyeZvUs1/nDU/QM4LDx31bBDIvIdroYpHZfHyWwHDfstlB1zrZlgg0rNFm+u6tduw== X-Received: by 10.99.114.29 with SMTP id n29mr8547454pgc.218.1506068632552; Fri, 22 Sep 2017 01:23: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 f74sm5569284pfa.36.2017.09.22.01.23.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:23:52 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:05 +0530 Message-Id: <1506068606-17066-7-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-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 v10] xen/arm: vpl011: Add a new domctl API to initialize vpl011 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Add a new domctl API to initialize vpl011. It takes the GFN and console backend domid as input and returns an event channel to be used for sending and receiving events from Xen. Xen will communicate with xenconsole using GFN as the ring buffer and the event channel to transmit and receive pl011 data on the guest domain's behalf. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Andrew Cooper CC: George Dunlap CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Julien Grall Changes since v9: - Initialized local variable in libxl__arch_build_dom_finish - Replaced __copy_to_guest with copy_to_guest - Added comment for console_domid field in vuart_op structure Changes since v8: - Added explicit padding in the vuart_op structure - Moved vuart_op structure after the PSR structure definition - The input fields moved before the output fields in vuart_op structure - Checking explicitly that padding fields are initialized to 0 Changes since v6: - Renamed the vuart initialization function to a generic name xc_dom_vuart_init - Used domid_t as a type instead of uint32_t for domid - Checking the vuart type explicitly against vpl011 enum value Changes since v5: - xc_dom_vpl011_init() will be compiled for both x86/arm architectures as there is nothing architecture specific in this function. This function will return error when called for x86. - Fixed coding style issues in libxl. Changes since v4: - Removed libxl__arch_domain_create_finish(). - Added a new function libxl__arch_build_dom_finish(), which is called at the last in libxl__build_dom(). This function calls the vpl011 initialization function now. Changes since v3: - Added a new arch specific function libxl__arch_domain_create_finish(), which calls the vpl011 initialization function. For x86 this function does not do anything. - domain_vpl011_init() takes a pointer to a structure which contains all the required information such as console_domid, gfn instead of passing parameters separately. - Dropped a DOMCTL API defined for de-initializing vpl011 as that should be taken care when the domain is destroyed (and not dependent on userspace libraries/applications). Changes since v2: - Replaced the DOMCTL APIs defined for get/set of event channel and GFN with a set of DOMCTL APIs for initializing and de-initializing vpl011 emulation. tools/libxc/include/xenctrl.h | 20 +++++++++++++++++ tools/libxc/xc_domain.c | 27 ++++++++++++++++++++++ tools/libxl/libxl_arch.h | 7 ++++++ tools/libxl/libxl_arm.c | 27 ++++++++++++++++++++++ tools/libxl/libxl_dom.c | 4 ++++ tools/libxl/libxl_x86.c | 8 +++++++ xen/arch/arm/domain.c | 6 +++++ xen/arch/arm/domctl.c | 52 +++++++++++++++++++++++++++++++++++++++++++ xen/include/public/domctl.h | 24 ++++++++++++++++++++ 9 files changed, 175 insertions(+) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 073fbc9..2086e71 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -886,6 +886,26 @@ int xc_vcpu_getcontext(xc_interface *xch, vcpu_guest_context_any_t *ctxt); /** + * This function initializes the vuart emulation and returns + * the event to be used by the backend for communicating with + * the emulation code. + * + * @parm xch a handle to an open hypervisor interface + * #parm type type of vuart + * @parm domid the domain to get information from + * @parm console_domid the domid of the backend console + * @parm gfn the guest pfn to be used as the ring buffer + * @parm evtchn the event channel to be used for events + * @return 0 on success, negative error on failure + */ +int xc_dom_vuart_init(xc_interface *xch, + uint32_t type, + domid_t domid, + domid_t console_domid, + xen_pfn_t gfn, + evtchn_port_t *evtchn); + +/** * This function returns information about the XSAVE state of a particular * vcpu of a domain. If extstate->size and extstate->xfeature_mask are 0, * the call is considered a query to retrieve them and the buffer is not diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index f40dc4f..f2e9f0c 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -343,6 +343,33 @@ int xc_domain_get_guest_width(xc_interface *xch, uint32_t domid, return 0; } +int xc_dom_vuart_init(xc_interface *xch, + uint32_t type, + domid_t domid, + domid_t console_domid, + xen_pfn_t gfn, + evtchn_port_t *evtchn) +{ + DECLARE_DOMCTL; + int rc = 0; + + memset(&domctl, 0, sizeof(domctl)); + + domctl.cmd = XEN_DOMCTL_vuart_op; + domctl.domain = domid; + domctl.u.vuart_op.cmd = XEN_DOMCTL_VUART_OP_INIT; + domctl.u.vuart_op.type = type; + domctl.u.vuart_op.console_domid = console_domid; + domctl.u.vuart_op.gfn = gfn; + + if ( (rc = do_domctl(xch, &domctl)) < 0 ) + return rc; + + *evtchn = domctl.u.vuart_op.evtchn; + + return rc; +} + int xc_domain_getinfo(xc_interface *xch, uint32_t first_domid, unsigned int max_doms, diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h index 5e1fc60..784ec7f 100644 --- a/tools/libxl/libxl_arch.h +++ b/tools/libxl/libxl_arch.h @@ -44,6 +44,13 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc, libxl_domain_build_info *info, struct xc_dom_image *dom); +/* perform any pending hardware initialization */ +_hidden +int libxl__arch_build_dom_finish(libxl__gc *gc, + libxl_domain_build_info *info, + struct xc_dom_image *dom, + libxl__domain_build_state *state); + /* build vNUMA vmemrange with arch specific information */ _hidden int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc, diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index d842d88..6f5bc3c 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -1038,6 +1038,33 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc, return 0; } +int libxl__arch_build_dom_finish(libxl__gc *gc, + libxl_domain_build_info *info, + struct xc_dom_image *dom, + libxl__domain_build_state *state) +{ + int rc = 0, ret; + + if (info->arch_arm.vuart != LIBXL_VUART_TYPE_SBSA_UART) { + rc = 0; + goto out; + } + + ret = xc_dom_vuart_init(CTX->xch, + XEN_DOMCTL_VUART_TYPE_VPL011, + dom->guest_domid, + dom->console_domid, + dom->vuart_gfn, + &state->vuart_port); + if (ret < 0) { + rc = ERROR_FAIL; + LOG(ERROR, "xc_dom_vuart_init failed\n"); + } + +out: + return rc; +} + int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc, uint32_t domid, libxl_domain_build_info *info, diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index e0f0d78..5f92023 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -702,6 +702,10 @@ static int libxl__build_dom(libxl__gc *gc, uint32_t domid, LOGE(ERROR, "xc_dom_gnttab_init failed"); goto out; } + if ((ret = libxl__arch_build_dom_finish(gc, info, dom, state)) != 0) { + LOGE(ERROR, "libxl__arch_build_dom_finish failed"); + goto out; + } out: return ret != 0 ? ERROR_FAIL : 0; diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 455f6f0..0aaeded 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -391,6 +391,14 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc, return rc; } +int libxl__arch_build_dom_finish(libxl__gc *gc, + libxl_domain_build_info *info, + struct xc_dom_image *dom, + libxl__domain_build_state *state) +{ + return 0; +} + /* Return 0 on success, ERROR_* on failure. */ int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc, uint32_t domid, diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 784ae39..0779087 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -874,6 +874,12 @@ int domain_relinquish_resources(struct domain *d) if ( ret ) return ret; + /* + * Release the resources allocated for vpl011 which were + * allocated via a DOMCTL call XEN_DOMCTL_vuart_op. + */ + domain_vpl011_deinit(d); + d->arch.relmem = RELMEM_xen; /* Fallthrough */ diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c index 8232f44..4587c75 100644 --- a/xen/arch/arm/domctl.c +++ b/xen/arch/arm/domctl.c @@ -5,9 +5,11 @@ */ #include +#include #include #include #include +#include #include #include #include @@ -20,6 +22,29 @@ void arch_get_domain_info(const struct domain *d, info->flags |= XEN_DOMINF_hap; } +static int handle_vuart_init(struct domain *d, + struct xen_domctl_vuart_op *vuart_op) +{ + int rc; + struct vpl011_init_info info; + + info.console_domid = vuart_op->console_domid; + info.gfn = _gfn(vuart_op->gfn); + + if ( d->creation_finished ) + return -EPERM; + + if ( vuart_op->type != XEN_DOMCTL_VUART_TYPE_VPL011 ) + return -EOPNOTSUPP; + + rc = domain_vpl011_init(d, &info); + + if ( !rc ) + vuart_op->evtchn = info.evtchn; + + return rc; +} + long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) { @@ -119,6 +144,33 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, d->disable_migrate = domctl->u.disable_migrate.disable; return 0; + case XEN_DOMCTL_vuart_op: + { + int rc; + unsigned int i; + struct xen_domctl_vuart_op *vuart_op = &domctl->u.vuart_op; + + /* check that structure padding must be 0. */ + for ( i = 0; i < sizeof(vuart_op->pad); i++ ) + if ( vuart_op->pad[i] ) + return -EINVAL; + + switch( vuart_op->cmd ) + { + case XEN_DOMCTL_VUART_OP_INIT: + rc = handle_vuart_init(d, vuart_op); + break; + + default: + rc = -EINVAL; + break; + } + + if ( !rc ) + rc = copy_to_guest(u_domctl, domctl, 1); + + return rc; + } default: { int rc; diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index e2fd685..9dcc969 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -33,6 +33,7 @@ #endif #include "xen.h" +#include "event_channel.h" #include "grant_table.h" #include "hvm/save.h" #include "memory.h" @@ -1077,6 +1078,27 @@ struct xen_domctl_set_gnttab_limits { uint32_t maptrack_frames; /* IN */ }; +/* XEN_DOMCTL_vuart_op */ +struct xen_domctl_vuart_op { +#define XEN_DOMCTL_VUART_OP_INIT 0 + uint32_t cmd; /* XEN_DOMCTL_VUART_OP_* */ +#define XEN_DOMCTL_VUART_TYPE_VPL011 0 + uint32_t type; /* IN - type of vuart. + * Currently only vpl011 supported. + */ + uint64_aligned_t gfn; /* IN - guest gfn to be used as a + * ring buffer. + */ + domid_t console_domid; /* IN - domid of domain running the + * backend console. + */ + uint8_t pad[2]; + evtchn_port_t evtchn; /* OUT - remote port of the event + * channel used for sending + * ring buffer events. + */ +}; + struct xen_domctl { uint32_t cmd; #define XEN_DOMCTL_createdomain 1 @@ -1155,6 +1177,7 @@ struct xen_domctl { #define XEN_DOMCTL_psr_cat_op 78 #define XEN_DOMCTL_soft_reset 79 #define XEN_DOMCTL_set_gnttab_limits 80 +#define XEN_DOMCTL_vuart_op 81 #define XEN_DOMCTL_gdbsx_guestmemio 1000 #define XEN_DOMCTL_gdbsx_pausevcpu 1001 #define XEN_DOMCTL_gdbsx_unpausevcpu 1002 @@ -1218,6 +1241,7 @@ struct xen_domctl { struct xen_domctl_monitor_op monitor_op; struct xen_domctl_psr_cat_op psr_cat_op; struct xen_domctl_set_gnttab_limits set_gnttab_limits; + struct xen_domctl_vuart_op vuart_op; uint8_t pad[128]; } u; }; From patchwork Fri Sep 22 08:23: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: 113972 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3010992qgf; Fri, 22 Sep 2017 01:25:55 -0700 (PDT) X-Received: by 10.36.20.5 with SMTP id 5mr5222834itg.131.1506068755865; Fri, 22 Sep 2017 01:25:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068755; cv=none; d=google.com; s=arc-20160816; b=AjRMjVG1BLNnVsUoB2p/+n5b3vrwJLE/8wJysYXI1Xy5NZIaAlAif0DLPFUIlQIjys oB48r3HOgZPKyF+8owRf+9xIkwMR1LEccE9jp5tQNGHETJaR67V9Peku3SmSrEO6lLxD v26V+gUJ1B5He9BMqyx75gD0cL9Xo6qBC1/CMINPUosdCq46ADotdJG84bHwByTd1/3O dreg1494q5v50ADenTspMCSLLcLmnptigxnndAAeZ0PetYgLtVrfISG9hUPxtcZ1ewWP z0rZj5vkSc/ZHIB9DvpgA1mrN9TcjG3RPlx+r4CFNVeiqsRcntWDwKsU7LXwBK6C8ByL 672g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=NQu2U2Y0mmfBaEBqfsKZpaOj5vrCPTemt8YZW0wsXZs=; b=n6WxCJFKYcabBJp/mF/+89I1X28VThvQkpyxdqDW8FDXRgd93elFcxTYbEbUoDKhIk dy4PPBKqv6ZJOYNGHPmtZoaGIka2VsDGwD4h1AZlXT/y0tMujM7sUL3wRgMg8CE8vqgu xffmFggU1hWZkrCmKj4WrktMSuWDxm0D50OeifficJ/FR5+XIEYdi1c3SoOIibiRa6j7 mDEmaXtAAwZMEddNvrmWhhnUQZ+wYUS34W4OG24BtsUSvgvIKqwfrJfNXhvt8XIjuOZe 7vIzMdWaDZCb454PT0OTc8i4xoUnaew4Bt2TgwVKaDFg0uHxy4Wdb2BzfVHmoyROcQNa tpFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KblNslOW; 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 u82si3440520itf.123.2017.09.22.01.25.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:25: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=KblNslOW; 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 1dvJFf-0003nY-P8; Fri, 22 Sep 2017 08:23:59 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFe-0003mN-Hw for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:23:58 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id 1E/31-03616-D98C4C95; Fri, 22 Sep 2017 08:23:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVyMfTAWt25J45 EGtx8IWzxfctkJgdGj8MfrrAEMEaxZuYl5VcksGacaOIu+GNVMbH9OHMD4wTdLkYuDiGB6YwS M+a/YgNxWATmMUvc+/WJvYuRk0NCoJ9V4uEHQwg7T2LV7X8sEHaaxIQLC9gg7HKJ1k2bmEFsI QEtiaOnZrNCTN3BJNE25R1jFyMHB5uAicSsDgmQGhEBJYl7qyYzgdQwC8xnlGia1As2SFggQO LzzIlgg1gEVCVWPtsJZvMKeEu863rDCLFMTuLmuU6wOKeAj8Ta/xtYIBZ7S2y9cZVlAqPgAka GVYwaxalFZalFuobGeklFmekZJbmJmTm6hgZmermpxcWJ6ak5iUnFesn5uZsYgQHHAAQ7GL8s CzjEKMnBpCTK+/jIkUghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKEry1x4FygkWp6akVaZk5wNCHS Utw8CiJ8IaDpHmLCxJzizPTIVKnGC05Lty59IeJ48CeW0Cy4+bdP0xCLHn5ealS4rwBIA0CIA 0ZpXlw42DxeYlRVkqYlxHoQCGegtSi3MwSVPlXjOIcjErCvDEgU3gy80rgtr4COogJ6KDy1WA HlSQipKQaGNs/aJ6conRE82auxekn6fy9rHL7b64SjLaaH7f7KOtuE+ajs5T6bk0SE7wy/+SK d2r1PHMnXph105L3Me8mFcal63qYIufd3Bv2PkyV5Wi2+GrVKYsepXPstXqwLe2fu0BmDJ8/5 /xk07jkjFn2XnoFz73Nz22d/+iYjvaj9LuRbWftlpVtk1FiKc5INNRiLipOBABSpvDQygIAAA == X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-6.tower-21.messagelabs.com!1506068636!61035805!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 7119 invoked from network); 22 Sep 2017 08:23:57 -0000 Received: from mail-pf0-f173.google.com (HELO mail-pf0-f173.google.com) (209.85.192.173) by server-6.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:23:57 -0000 Received: by mail-pf0-f173.google.com with SMTP id r68so240531pfj.3 for ; Fri, 22 Sep 2017 01:23: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=4sd+jityzyLKl9T+2Zny6hdYes/xeKdW5J2msJXqt9U=; b=KblNslOWkxWy6W89cBWEbwbozPxp85DrTeeiYLAFTsb2+pMpc387RtqZFRJR6sQ1iu zlvAyHxI/KJhKr0EWOvFnB2jDgZPAUN/qxRuJw/zCT5g5U1nT8b9hs5ZS2Ew7a0mpPmb HgzPHt8+TbG1/U6Y2oYHBwaLv3HMo5n/MXUFU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4sd+jityzyLKl9T+2Zny6hdYes/xeKdW5J2msJXqt9U=; b=X/hPiEj4U/P2VNtefOBG60QWZQf2VJXq87yW8sBSEqGYAcV2mtJPTYkZD2S4V0ZYSa KCO5yEOrbo0FZVB53VEJ3dqCIV1zildG+phLXc7lxAXX7+EVUSeR5ac/CRCjAdzozEp1 JBp2R8Piu+4JKBiZGoIjtDogxXdTNZQ077fRN3L3fQo1K210lWhKXCPPvsqAgZuProna eVc6fyj2bfG3xSpdaOjqWjdoQr4sfcboQjWV0qSZ3Wur5J9/mWE2hy9qipwAC4YgFmu0 DCpqOXWFpR5GkNz+q8LxgScLgECGR8BHvWO3TFqUb0Gz1xVhGtEdp1MVeUCRM5ex/lt0 sm8A== X-Gm-Message-State: AHPjjUh6ITBqj/QpWSiEWqZlrJ34OgcsyL8njuFmp55OwQWGq6UMXAjD fOIkUJpV7u77siloC6YDhdf9DHj0PNw= X-Google-Smtp-Source: AOwi7QBIt05k91mzJiyAg3pG8cqEy3TU/djFu6dTRGwNNU/LpI4y44zhTTHcmyhonSfBHA3AINDtOA== X-Received: by 10.99.108.2 with SMTP id h2mr8368644pgc.371.1506068635550; Fri, 22 Sep 2017 01:23: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 f74sm5569284pfa.36.2017.09.22.01.23.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:23:55 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:06 +0530 Message-Id: <1506068606-17066-8-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 07/27 v10] xen/arm: vpl011: Add a new vuart node in the xenstore X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Add a new vuart console node to xenstore. This node is added at /local/domain/$DOMID/vuart/0. The node contains information such as the ring-ref, event channel, buffer limit and type of console. Xenconsole reads the node information to setup the ring buffer and event channel for sending/receiving vuart data. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v4: - vuart_device moved inside libxl__device_vuart_add() as a local variable. Changes since v3: - Added a backend node for vpl011. - Removed libxl__device_vuart_add() for HVM guest. It is called only for PV guest. tools/libxl/libxl_console.c | 44 ++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_create.c | 9 +++++++- tools/libxl/libxl_device.c | 9 ++++++-- tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_types_internal.idl | 1 + 5 files changed, 63 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index f4f64ad..0db9cd0 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -344,6 +344,50 @@ out: return rc; } +int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, + libxl__device_console *console, + libxl__domain_build_state *state) +{ + libxl__device device; + flexarray_t *ro_front; + flexarray_t *back; + int rc; + + ro_front = flexarray_make(gc, 16, 1); + back = flexarray_make(gc, 16, 1); + + device.backend_devid = console->devid; + device.backend_domid = console->backend_domid; + device.backend_kind = LIBXL__DEVICE_KIND_VUART; + device.devid = console->devid; + device.domid = domid; + device.kind = LIBXL__DEVICE_KIND_VUART; + + flexarray_append(back, "frontend-id"); + flexarray_append(back, GCSPRINTF("%d", domid)); + flexarray_append(back, "online"); + flexarray_append(back, "1"); + flexarray_append(back, "state"); + flexarray_append(back, GCSPRINTF("%d", XenbusStateInitialising)); + flexarray_append(back, "protocol"); + flexarray_append(back, LIBXL_XENCONSOLE_PROTOCOL); + + flexarray_append(ro_front, "port"); + flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port)); + flexarray_append(ro_front, "ring-ref"); + flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn)); + flexarray_append(ro_front, "limit"); + flexarray_append(ro_front, GCSPRINTF("%d", LIBXL_XENCONSOLE_LIMIT)); + flexarray_append(ro_front, "type"); + flexarray_append(ro_front, "xenconsoled"); + + rc = libxl__device_generic_add(gc, XBT_NULL, &device, + libxl__xs_kvs_of_flexarray(gc, back), + NULL, + libxl__xs_kvs_of_flexarray(gc, ro_front)); + return rc; +} + int libxl__init_console_from_channel(libxl__gc *gc, libxl__device_console *console, int dev_num, diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 0ef54d2..9dcbe48 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1370,7 +1370,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, } case LIBXL_DOMAIN_TYPE_PV: { - libxl__device_console console; + libxl__device_console console, vuart; libxl__device device; for (i = 0; i < d_config->num_vfbs; i++) { @@ -1380,6 +1380,13 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, &d_config->vkbs[i]); } + if (d_config->b_info.arch_arm.vuart == LIBXL_VUART_TYPE_SBSA_UART) { + init_console_info(gc, &vuart, 0); + vuart.backend_domid = state->console_domid; + libxl__device_vuart_add(gc, domid, &vuart, state); + libxl__device_console_dispose(&vuart); + } + init_console_info(gc, &console, 0); console.backend_domid = state->console_domid; libxl__device_console_add(gc, domid, &console, state, &device); diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 67b7afb..3473687 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -26,6 +26,9 @@ static char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device) if (device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0) return GCSPRINTF("%s/console", dom_path); + if (device->kind == LIBXL__DEVICE_KIND_VUART) + return GCSPRINTF("%s/vuart/%d", dom_path, device->devid); + return GCSPRINTF("%s/device/%s/%d", dom_path, libxl__device_kind_to_string(device->kind), device->devid); @@ -170,7 +173,8 @@ retry_transaction: * historically contained other information, such as the * vnc-port, which we don't want the guest fiddling with. */ - if (device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0) + if ((device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0) || + (device->kind == LIBXL__DEVICE_KIND_VUART)) xs_set_permissions(ctx->xsh, t, frontend_path, ro_frontend_perms, ARRAY_SIZE(ro_frontend_perms)); else @@ -800,7 +804,8 @@ void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs) dev->domid = domid; dev->kind = kind; dev->devid = atoi(devs[j]); - if (dev->backend_kind == LIBXL__DEVICE_KIND_CONSOLE) { + if (dev->backend_kind == LIBXL__DEVICE_KIND_CONSOLE || + dev->backend_kind == LIBXL__DEVICE_KIND_VUART) { /* Currently console devices can be destroyed * synchronously by just removing xenstore entries, * this is what libxl__device_destroy does. diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 30a5cb2..1f878de 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1206,6 +1206,9 @@ _hidden int libxl__device_console_add(libxl__gc *gc, uint32_t domid, libxl__device_console *console, libxl__domain_build_state *state, libxl__device *device); +_hidden int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, + libxl__device_console *console, + libxl__domain_build_state *state); /* Returns 1 if device exists, 0 if not, ERROR_* (<0) on error. */ _hidden int libxl__device_exists(libxl__gc *gc, xs_transaction_t t, diff --git a/tools/libxl/libxl_types_internal.idl b/tools/libxl/libxl_types_internal.idl index 673a6d5..d144dd6 100644 --- a/tools/libxl/libxl_types_internal.idl +++ b/tools/libxl/libxl_types_internal.idl @@ -27,6 +27,7 @@ libxl__device_kind = Enumeration("device_kind", [ (10, "QUSB"), (11, "9PFS"), (12, "VDISPL"), + (13, "VUART"), ]) libxl__console_backend = Enumeration("console_backend", [ From patchwork Fri Sep 22 08:23: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: 113992 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011364qgf; Fri, 22 Sep 2017 01:26:19 -0700 (PDT) X-Received: by 10.107.158.209 with SMTP id h200mr7270836ioe.145.1506068779177; Fri, 22 Sep 2017 01:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068779; cv=none; d=google.com; s=arc-20160816; b=SlB/C/z3Z3TEw0FM30+xw67hRRUZk6WMY3rXcExFtCcCKutz/UpGbuQuPAIVIxPdfE Z7SR5YdnMCEAoa7DxBt6H1z8s+DZ74j7Eke25BZ7xmyxSTYN/ztR6xW3L08OiGcNpsSC y2uA1yHewHHcJjyISdEXceXbmsb+wWx0eycihBT3Z7/qcTZac86X4/8IK3hPevyn5Sek 3SDVc8WAUKyqT4mocKmEDcPhxXy5z2NywonibDWnpFx+VsAoDWnhMPoBqbggqalxWsL6 RKWHHVBbIn3AbEX30ueEiDPJztDR/0MCX5usFLp/JBivXzWzXdBsFhYAKTzOqpR7KOLt NsIQ== 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=zcjEA//iS1wluOugOLF6wjQNaeSnircil0LzPtIFHCRvJmv9xbtVfh9+c1L6XKYCjJ I5e0kFIRDDkXIFFQrMcJZSE4VVMyS0J+kfqPHh7Wl176e9u7DbVcBk30MntzaVkcpHAu A+UJCS0qudF2EP+1MyRLFFkm6dvi/06cRzPeEYz3Vhcn17mLi3NSIE5F/zV8nzeNnXJf +dIP4gr9JbuWUIpaA37L39oBm8Yl8WeuhWRkTQiTWYoHXzY8fKhdblKxltJb1nHQ8Puz KFeKi5BZ0NUZMmHMPAdVJ8r1qjXpn9IgQgHfqPjtv5xyOLQROGJQv34hyusq5GUJ77qi lKjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=df9NVP7v; 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 a198si3347058itc.70.2017.09.22.01.26.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:19 -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=df9NVP7v; 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 1dvJFk-0003q7-1D; Fri, 22 Sep 2017 08:24:04 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFi-0003pE-NT for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:02 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 6D/F1-02046-1A8C4C95; Fri, 22 Sep 2017 08:24:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAIsWRWlGSWpSXmKPExsVyMfTAet0FJ45 EGlx8b2rxfctkJgdGj8MfrrAEMEaxZuYl5VcksGb8uXmDpWDRYsaKc6tPMjcwLmlh7GLk4hAS mMEo8XrZBRYQh0VgHrPEiT97wTISAv2sEkePL2buYuQEcvIkLpw8xwphp0ks3XGDEcKulFi77 BuYLSSgJXH01GxWiLE7mCS+nPoPNJaDg03ARGJWhwRIjYiAksS9VZOZQGqYBeYzSjRN6mUDSQ gLpEvsPr6FCcRmEVCVODR5LztIL6+At8TS65EQu+Qkbp7rBLuHU8BHYu3/DSwQe70ltt64yjK BUXABI8MqRo3i1KKy1CJdIxO9pKLM9IyS3MTMHF1DA2O93NTi4sT01JzEpGK95PzcTYzAsKtn YGDcwfjquN8hRkkOJiVR3sdHjkQK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuCtPQ6UEyxKTU+tS MvMAUYATFqCg0dJhJcXGAVCvMUFibnFmekQqVOM9hwX7lz6w8RxbNNlIHlgzy0g2XHz7h8mIZ a8/LxUKXHe+SBTBUDaMkrz4IbCIvYSo6yUMC8jAwODEE9BalFuZgmq/CtGcQ5GJWHeGJApPJl 5JXC7XwGdxQR0VvlqsLNKEhFSUg2M4b33Dbxmeolv2fGHX2fX/TUqG3i+XjyZPN/gYY+pMk/R HjPfXfoGN3bdYXA4WWSuL74/xXhf3c1Jp5xbSi4JO+9okq8WaFe4n8+8SnHNsVTxz0fDHbVLy 1MNn2/z3Kv5eaNQdl+F9L49ksk5C+76REavOrZFqr5v0XtZyfeXLxxdH+3pt/CzEktxRqKhFn NRcSIAyhjckdMCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-31.messagelabs.com!1506068639!116086559!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 45059 invoked from network); 22 Sep 2017 08:24:00 -0000 Received: from mail-pf0-f175.google.com (HELO mail-pf0-f175.google.com) (209.85.192.175) by server-8.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:00 -0000 Received: by mail-pf0-f175.google.com with SMTP id x78so231867pff.10 for ; Fri, 22 Sep 2017 01:24:00 -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=df9NVP7v5yXcMJkAGtoKvqIHEbfQtfEqosz0eREXynQ/V11gf436ZgtyfumVWZLzwI D3yKxW0faKDpLoodN671LJmqC12qTKUD33BNg6fVO/PNYtBiKqioVVhrHJ5lxM6fFMNm ZiVQYqmQhkxHzNrfRErErsOD8uxiL7gWnU2co= 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=SNkQAiGkDhmhLBj5Hni6ew0/Y9/KexTIpPMEn+0H048HrQLMStcXM7CHMRDh5RdsrU fzvyycuY+gTT8IZ2JrbBqkdC2Tg3SsBPCXEmeFTl01HGPsK61MZbtWzptY3BeySWjdq8 3GGwQT3VDfockZThWrPgisBrqjm4y34EG94PiF7iBppd3yMRKxHaAbNOzEDscnul2OyZ WQPHRasTvPQ/n89j9cSvX9ngJ/JlyLuMjqQG5fIO/Mrcr3Z50E6W78cIghwxqlJn4PKP S/IkL79pVcw0EJgGe5PJcwzoM9wDe9runDF4IQ301HzKQSJB1F9B4H8csAcLFKzOz1vc JvnQ== X-Gm-Message-State: AHPjjUhQuCFaytQ0PgwMc7cXtEC1DpoJgpbO3/3Z/F3gHb+aumyWIR5i sksONtUolvqXNwdZHjFGRRrhnu5Xx9c= X-Google-Smtp-Source: AOwi7QAM1lCrAHh+VGyDLBrUCWGQXcKyAZPJyO0boIJFBeAsSfgz+HggwMbKqQTBP+y+vMVK+KDc1g== X-Received: by 10.99.144.68 with SMTP id a65mr8815246pge.429.1506068638723; Fri, 22 Sep 2017 01:23:58 -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 f74sm5569284pfa.36.2017.09.22.01.23.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:23:58 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:07 +0530 Message-Id: <1506068606-17066-9-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 08/27 v10] 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 Fri Sep 22 08:23: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: 113986 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011238qgf; Fri, 22 Sep 2017 01:26:10 -0700 (PDT) X-Received: by 10.36.17.200 with SMTP id 191mr5500511itf.37.1506068770452; Fri, 22 Sep 2017 01:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068770; cv=none; d=google.com; s=arc-20160816; b=NPWz2/CfU7z3TOKwiMwjIJRMtClJEKL6eOcI/Sq8LiWlMzggy7LXkWgB74UqTT1f44 f97QDdgkGEdVWa/24qxIjGYaBws0YHz6Fh2g5AlkFGjV4UfYvAL3UoVpgnIACItUZ/GM hY3MMsD59USNQmqUR8n88/Qm51tOrOHYsng3tLL/W6b7CYDk2cQhNnBpJ02AM5xdPAVz bn5sUiKSTrCOAOfESDBoPedfin10D/et5CKBFZMf3DSzYU6oMPltFUn5e5b0PxLxusZI l7xruRBOfsU64UsaMeVecfsbw8Khn0iioiSpQsAUThJ1A7eU3XOcwEoMSNQejjTKDVJv yL3g== 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=eQncT9CQa+OsFOnbI3WEAQCineVqs3+f9OoKnWdiGPveoL76BpeE+UYzG/4lEgOTMR BQPVL8bSV2hMHg9GqGd24yngEqDN/pKomaPO2Mw/uTo9B0IUvMJn/F5q/zW8VwO3T3Ou rJ6+7azyWPAj7AHac4/VJvZSJWI58Xiws4eppOjibc+6ZiVkXM7yGHqnXWn32jNEiAFf GTRTfIb0eIhvJjthS9mb/6vH5ko0LJni/kRF9xtKPluYwQzbhsEIY536573PPEZMMw82 f0k/5jQ8iDqNXl6zXS2rQvUTc3B1TeSMOW5OX44ZUUHkX+ByTI3rz8kmmcfKH1ofoe+u VWKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gnsEl7rJ; 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 y70si3653522ity.2.2017.09.22.01.26.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:10 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gnsEl7rJ; 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 1dvJFm-0003sM-BX; Fri, 22 Sep 2017 08:24:06 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFk-0003r1-Vf for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:05 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id 71/E1-17770-4A8C4C95; Fri, 22 Sep 2017 08:24:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTAZt3FJ45 EGixboGzxfctkJgdGj8MfrrAEMEaxZuYl5VcksGZceN3LXvBXumLDzf+sDYz7xbsYuTiEBGYw SvxatIoNxGERmMcsMfnLB3YQR0Kgn1Vi8eSlLF2MnEBOnsS59r1MEHaaRPvlT2wQdpXEzafr2 EFsIQEtiaOnZrNCjN3BJLFr+2WgIg4ONgETiVkdEiA1IgJKEvdWTWYCqWEWmM8o0TSpF6xGWC BRYtqaGJAaFgFViRcz3oLt5RXwkfh6eQnULjmJm+c6mUFsTqD42v8bWCD2ektsvXGVZQKj4AJ GhlWMGsWpRWWpRbpGpnpJRZnpGSW5iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmbGIEhxwAEOxhX LQg8xCjJwaQkyvv4yJFIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8O48D5QSLUtNTK9Iyc4DBD 5OW4OBREuENB0nzFhck5hZnpkOkTjFacly4c+kPE8eBPbeAZMfNu3+YhFjy8vNSpcR554M0CI A0ZJTmwY2DReglRlkpYV5GoAOFeApSi3IzS1DlXzGKczAqCfNeB5nCk5lXArf1FdBBTEAHla8 GO6gkESEl1cBYz1e4aVddaub+XtvVVZrH1T8ovp8q+e6j4b0qz8BwyRoh67CX1dullNX6uK0Z 7Hc41n9LmPRppQ/TiV+vfhilMS3SEKzq2czy+LlKxgvhVStO2CUdk9z48amu/vyG+R2Kdcedp F1m7nCUOHa6peKHTI5ldlz1hISdudufHN0aY2brLDt343IlluKMREMt5qLiRAAZBNY1ywIAAA == X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-12.tower-27.messagelabs.com!1506068642!116543932!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 14746 invoked from network); 22 Sep 2017 08:24:03 -0000 Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by server-12.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:03 -0000 Received: by mail-pf0-f179.google.com with SMTP id r71so229231pfe.12 for ; Fri, 22 Sep 2017 01:24:03 -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=gnsEl7rJxvAujzAVho4rWTPJHxEAdvi8nlah/+daGXUV7C2EdtOCuNmLDi09cwjlPs gSQJrmC+1z3gArHEmTBmYOBccQSSAMKgmQxDoP4BFax5TzatsuNyZLInX1hUdUk7crSH UVikrXxqmCW2k+9MO2KwPblVtf/vwYS3up7z4= 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=QeKl9EtJ7Q+sQIk2gLPP/utJP/xSPrXczbCqNmvVO9SWafe3rl/bdSXD8OuwY8JI3D aqjcvIqdT7jag+saHnAFSX5lsj/LwI2FDsNvRlciWRYMPcXVJsOl+wDBiN4+GF+x9Fg8 aDr/ZnZl4PWyfsMzhz8eBXs5H5w5265bTwxuFUiWEahHv1fNEPWxMNPTvUJ9yKpjiI5f p7cqR7b06Iq0oxlDbN6DN4RuUcPFncxHE0GM+FFF5OLA7405GgjOYpg52pqxUyT58daK 4V6oYmt+12unOniF812waxunnHEOeYd3yUr44tGZ0oFL/ihHigxyKyLOpl/mTo2QbaSh zblg== X-Gm-Message-State: AHPjjUhr+CqzxqRpMtt23YBGlSh/2eEAB0LAJuxvP4PIifsg70tnNJTz AJLY5ckGjR4ykKJPUm34I2n9LBai1ZY= X-Google-Smtp-Source: AOwi7QCT9oeq60+R3qoycwY1xyk5PV1cqN85ccOHXNsW7rR6BffDbcNF+In/cMlWMPtyzlVU7WJuYg== X-Received: by 10.98.178.204 with SMTP id z73mr8547664pfl.107.1506068641677; Fri, 22 Sep 2017 01:24:01 -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 f74sm5569284pfa.36.2017.09.22.01.23.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:01 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:08 +0530 Message-Id: <1506068606-17066-10-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 09/27 v10] 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 Fri Sep 22 08:23: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: 113990 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011317qgf; Fri, 22 Sep 2017 01:26:16 -0700 (PDT) X-Received: by 10.107.10.9 with SMTP id u9mr7410189ioi.107.1506068775808; Fri, 22 Sep 2017 01:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068775; cv=none; d=google.com; s=arc-20160816; b=0rGjX66vcyr1B1fFRz6esCSF6lOaxoJ2s3VVrEI2/5POQRzGtvJvIVgDkymnp+WiMY ogZbBFt06ARGtdcBNKn2j5d5SUpFlU8ZVItmRyaWYnBhgPAXAGTQwuvjUJvRdOdPW3aq AIi3wOWoSe2rz56DXUnyqNVOfm58B69iQbm7OEOBpjSjFp9cHFKE5b9hYNQcb5fgDdvg zOc+supSK13HM6lknTk0AGE9m8Asl2vkdXkRRJZcNV4QjLjgO5IMVXjTdB5ELasSOAcy u0M0Ymcj3YwVVuMAG7rC0kku1iD3IPlYHfJDhBKOrDgqFNCdLoB65yHuO1T9rjRfCbiK 6NEQ== 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=iAIxzTl2Bz9L+3SOak/xYFnEaJ4c2uORgDiA7krGJflp9skwCAI8KYMxsyiuZmdKQS ZMb/ibdmInIPUwhvLd3k6Y5iwNXYF9Xwasl6FVTXQjBmeUZ8AoD+LWz8cyaWQtAq4dyA neIeI2l3Fftzczarei+FnczsYEbA/Gp1u1fGhnQhPxTD1bSjhss+LbQ+iTI7U5zL1WVJ hRUTlV5NxOziwQnWywg2s+0auRl0xwwDVD3riEGnWYgPNffaT2d9kmRtPNlddvwLwcZl ilQckeF4fUZN9kTeVSMhUfsT3R/eGR0HIGCxlebAGcgianu5TsY7aafnn4V55Cb6AbH8 a/EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=V1Weyo+y; 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 x88si3422362ita.38.2017.09.22.01.26.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:15 -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=V1Weyo+y; 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 1dvJFo-0003uV-It; Fri, 22 Sep 2017 08:24:08 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFn-0003th-Va for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:08 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 0C/5B-02048-7A8C4C95; Fri, 22 Sep 2017 08:24:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMIsWRWlGSWpSXmKPExsXiVRtsprvsxJF Ig/8/FS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyGE2eZC956VnQd2sHYwPjXpouRi0NIYDqj xMsd05hAHBaBecwSu1fcYAdxJAT6WSXWv9zM1sXICeTkSTz4tJsdwk6T+Lf7OZRdKbGp+wJYj ZCAlsTRU7NZIcbuYJK4vLwdyOHgYBMwkZjVIQFSIyKgJHFv1WSwbcwC8xklmib1gjULC2RJ3P r/gBXEZhFQldhxvxkszivgI9F7bxozxDI5iZvnOsFsTqD42v8bWCAWe0tsvXGVZQKj4AJGhlW MGsWpRWWpRbqGhnpJRZnpGSW5iZk5uoYGxnq5qcXFiempOYlJxXrJ+bmbGIFBxwAEOxhX/3Y6 xCjJwaQkyvv4yJFIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8tceBcoJFqempFWmZOcDwh0lLc PAoifCGg6R5iwsSc4sz0yFSpxiNOfbtufWHiaPj5t0/TEIsefl5qVLivPNBSgVASjNK8+AGwe LyEqOslDAvI9BpQjwFqUW5mSWo8q8YxTkYlYR5Y0Cm8GTmlcDtewV0ChPQKeWrwU4pSURISTU wHmINOLex3r9/0kb7mFNZ0xcXmGj9Y+uRlLGVZuRS8djmck/VUXWeo4Rnxj4RpQTG9Xtl27KF PVb2L1l8j/l0xdayCRPlQkxylTmmqM8LX/zzQd+bwPiUP0zefHPEq3e3nv5QnbxW8LdW+eT1C 8JstrN/1xZ+sJp5a1RGbflza6bGdqOm+SJKLMUZiYZazEXFiQB3hPwBxgIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-2.tower-31.messagelabs.com!1506068645!104321874!1 X-Originating-IP: [74.125.83.54] 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 21467 invoked from network); 22 Sep 2017 08:24:06 -0000 Received: from mail-pg0-f54.google.com (HELO mail-pg0-f54.google.com) (74.125.83.54) by server-2.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:06 -0000 Received: by mail-pg0-f54.google.com with SMTP id i195so243628pgd.9 for ; Fri, 22 Sep 2017 01:24:06 -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=V1Weyo+yfUM0Xislyq0iT1T+V0EWz2sdraO4N/eZgQUfoKu4qfxr2wweX0KJwXQJWO hs2qX54aGZUsIUTacr8XNcFE+WUMSiUo+3PBS6VjAReM48D6QFcAKDRQ8KH0YTtMe5dX hRJc/3lqK14d8LQy/MS9b2eFnPKad8dNWMSWk= 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=XAHsBnjGr9dkKI4OVKNBqTweujzKxvKkUdW0jomrtjCXvTmEeECQBpotAZzE03/aQt C53eQp1MJPxSNhm2zd6CwYi24+YcjBMqFeUs7+a3y9+aaBhkhmhqE3cIWpbcwAuXxCYS 3Gkaixp0CMEfE/icuOaX4eyAYb0pZoWH2VJZWR6AV0UqElX8uWXWne996Dq0vju1SEP9 NUPUaw1pzzF0nbeXz4Xpwg+mPc0Maq66kyxARE4uSxLZ/7+6iShOO97lCSC7WmoWJjd2 n970OYCJNO7+5r+TCZYaVen2YGu7SaVoSKYj0nXf1KrilqHM3BVO6H9JAjlOX7fw49OA qvdQ== X-Gm-Message-State: AHPjjUgNIuCaB0si7Lo++n3o4QctpVlnpbqmkwWEN0XQG0PX1UA+wa/N u4NZlMdbUnYfi86Eei6vB3e9SMRhNd4= X-Google-Smtp-Source: AOwi7QA0KkIH29icJCvySw+1cqQh83g5zTp14v0jNcTyuvsJmaDkAlD3Ub8UkiIHeCO2Lui57Hp2+w== X-Received: by 10.98.204.69 with SMTP id a66mr8621969pfg.132.1506068644643; Fri, 22 Sep 2017 01:24:04 -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 f74sm5569284pfa.36.2017.09.22.01.24.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:04 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:09 +0530 Message-Id: <1506068606-17066-11-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 10/27 v10] 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 Fri Sep 22 08:23: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: 113985 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011223qgf; Fri, 22 Sep 2017 01:26:10 -0700 (PDT) X-Received: by 10.36.127.146 with SMTP id r140mr4867114itc.79.1506068769936; Fri, 22 Sep 2017 01:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068769; cv=none; d=google.com; s=arc-20160816; b=slGtURyV3kEMmt0AFoPElo5exIRq6SQ79i4b9b5j7wRtYQEocKy9HMJGyRXTjjLfyw aVjez8hM1+juaZibGm8tTxo2xisayJWBeqLayNq3NWvnRuwHC/fKdcgwuIPeDs42kRgk rnvR4UNigvuEIUn14s9ZnsmL6i48rF9iAvqwDhNkQ4Knd8/ikv/LbIl5/Tz3/R8pKRNx 9W9jJM8yQ4JTw8cJMWgnIvS56TFruraZeELcczDz/Qd+I4wcjzGDQ79kY5zjBl29W4mF Aea96vOMhnsuqhLyMhVLCodVRZiGW29sYe+bbnwS9AWsnSXuld5QcDW0ewcZxlyJB13+ HfEA== 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=vVpLNgnYJZYG/EePF9xymrPT8KaBcohSQRJs5BC/9NyNHfmZ2Dr2UspF0IBSULvVek AqgiTibQwot/tsxH0kaz4xYmLLKjLzfzNtWTgTU/8/+ocNNGOEch9OA05GZSSnRAhFGw cMXPj/PnFFo9nh1+Ji387q73gchDOPaSlUScHoOiJGF/t/dfPfDJh9C6rCDMzKnpkOhJ e163LemW8IBBvP+aMn/lj04E8ijC/t7krqtwKAZ3nqIIFkCe5a5Y29jsCjzSOmtrOpYV adUXZoHqvZrvexIctu/3wC9fl/8UeLku2ZOrajqX6wq7+eZSkz6NqqqH3AmSkL405023 I9ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hGpYig5u; 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 j13si3136322ioi.99.2017.09.22.01.26.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:09 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hGpYig5u; 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 1dvJFr-0003x8-QU; Fri, 22 Sep 2017 08:24: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 1dvJFq-0003w3-Tu for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:11 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 09/5D-02224-AA8C4C95; Fri, 22 Sep 2017 08:24:10 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTAJt2VJ45 EGuw8r2bxfctkJgdGj8MfrrAEMEaxZuYl5VcksGY07OlgLFghXnH0zAnmBsZdwl2MXBxCAtMZ Je6f2cAI4rAIzGOWuHtlNjOIIyHQzyrxcecpli5GTiAnT6Lv7i1GCDtNYt+b/cwQdqXEvJUbw GwhAS2Jo6dms0KM3cEksf3PJPYuRg4ONgETiVkdEiA1IgJKEvdWTWYCqWEWmM8o0TSplw0kIS wQKdH/8QfYMhYBVYm2j4dYQXp5BXwk+p+lQeySk7h5rhNsFydQeO3/DSwQe70ltt64yjKBUXA BI8MqRo3i1KKy1CJdQ0u9pKLM9IyS3MTMHF1DA2O93NTi4sT01JzEpGK95PzcTYzAkKtnYGDc wfj7uN8hRkkOJiVR3sdHjkQK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuC1Pw6UEyxKTU+tSMvMA QY/TFqCg0dJhDccJM1bXJCYW5yZDpE6xWjJceHOpT9MHAf23AKSHTfv/mESYsnLz0uVEucNAG kQAGnIKM2DGweL0EuMslLCvIwMDAxCPAWpRbmZJajyrxjFORiVhHkVQabwZOaVwG19BXQQE9B B5avBDipJREhJNTBWpU5fsZ2bd417PCv34ZWXjtyZHmBjG/A8PrXu5a1Oro/79i9fclkjKji2 NE3jme38tO1zYn05O7fyKW+ZwGT16c5xjVNWbpdPvJrbVVe/+J5D0McvEbWzu2WL7rL9iueen 9vwyLvijobas+d831hCnxx8eX65feh5FwMxSaEYu7g/Ar1HpnIqsRRnJBpqMRcVJwIAC+HjsM sCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-3.tower-31.messagelabs.com!1506068648!116012731!1 X-Originating-IP: [209.85.192.178] 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 33812 invoked from network); 22 Sep 2017 08:24:09 -0000 Received: from mail-pf0-f178.google.com (HELO mail-pf0-f178.google.com) (209.85.192.178) by server-3.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:09 -0000 Received: by mail-pf0-f178.google.com with SMTP id n24so238844pfk.5 for ; Fri, 22 Sep 2017 01:24:09 -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=hGpYig5u1U10wWa4RaO29Ohi47u4ZUih7hZQuS7pyW7OOGPu9kYms1V+GD19xRQmiy egY8GRIhRNpn6Pwfd6rIIvCqSuQlhX48xc6HbRMFa1IdnmwsEHUqZQrpavjyNPq7JF1i K+dTB3dBihFyEOZ9PrC0Ao8Np4FQhFdaFsNsc= 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=M5kg6w+VofQKjyW/86leNSMSP9ZtiucfST4wsjmpxRDQV1c4q6/PCk5/lx3wFGeWX+ RRbwcGJSdjYAC4vvvHwcr3mem56Ub3664QNd8tdvmW/oJXJ7irPA6y1Z0iyR2cgLS18Y 4HiGMT7sM2+oxBiEwhAYC3ghKvrrr1abMylvYbP2DesiKvGQMyysI5fV7qBAaEVBYqqQ AKb28Ivo+IZXjxeCTHfRf6kxZrQ8hjz9G6cekFa13Gtl41Sw/qqpUsI8AGzNV0kMWdT4 tkHLe+pcaVih/Cqp0hJCC2xsL5cS8gj5V5TgCCvbp3VhBfo65yJz0YEP3QSTPfKvnUBJ jk6g== X-Gm-Message-State: AHPjjUgGqcfuVp0btaEW73u8D873K+nahl4/wfYln0sKxiP0kFL/++AV ruaIuoqpOItuxnnpjTsmj4XpfKl9Oc4= X-Google-Smtp-Source: AOwi7QCrNH54Cab4XP9e4v8ANCSSEWsMjWRtiaEci9AlQ1xtO66v1Gpi6bYohkxEM+F/xBXfCSURNQ== X-Received: by 10.84.209.135 with SMTP id y7mr8261403plh.439.1506068647800; Fri, 22 Sep 2017 01:24:07 -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 f74sm5569284pfa.36.2017.09.22.01.24.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:07 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:10 +0530 Message-Id: <1506068606-17066-12-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 11/27 v10] 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 Fri Sep 22 08:23: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: 113983 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011179qgf; Fri, 22 Sep 2017 01:26:07 -0700 (PDT) X-Received: by 10.36.141.67 with SMTP id w64mr5023868itd.8.1506068767706; Fri, 22 Sep 2017 01:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068767; cv=none; d=google.com; s=arc-20160816; b=Hv72jvL5Z31u7xcEuPLGdnVaRMICAO4jS1vcGWPOpj6+hlnXnjuWZ2LcLrCmOofJzG vogYjtbbHArRm3HwRRADgRGYoZvlx8LBFQPDAhUPic47KSlIqwDkNpaVH6tUpF8m4q52 Q+aL5qTEN5AW3Ql+dLg0t+MGpukqivlR9iLUUb99OpnafP+ZoswvgsL9i83fpvWQiIaj Cd3VtpDUJiDX3WuCcGj0JuFKmOT98S0gLxn4gSnIpwP7mL552PXGFRlY4FCwEiaw0zGP ZuDU1M+VhqR9qnOK9S/7B0ksRtZZUse6SkoW1rt0qIDCPJLydV24l8jmr2N+xz7fyn2T G23Q== 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=Qz+z5WFTEFvHO47tmj+Hta7+L4N+D0L6I2TNmCpHA/+jA7t5pYu+5FsjwV7LP12i7Q f9TxZNoUT0WCC4KsApItOWCUC1eI1u8PxnMGcmm1hEue6j2RLNgc5dx9CgPe2AuVjK2F hr3yqrXfY89pxAzX8XYaOeybQkAkHXJgE9sQdx+zSEtlsSciD0iWl+YoG61D/qeJArkE TZy8uzQBvqarUQtNYbxxXFZcG6cxvhvhUmaVOrSAlLuwm4wdja2R8gsj24tu8HkMTIwp PW7nA3mSjEJXmgv2/vEUsjYUVued1/xV9VnWkJgUBf5s+Gq/QKo0koY8F26UXqWevh8k qCUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=B9YJyYU7; 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 j6si3451560ita.115.2017.09.22.01.26.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:07 -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=B9YJyYU7; 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 1dvJFv-000407-1T; Fri, 22 Sep 2017 08:24: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 1dvJFt-0003yV-Jm for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:13 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id CD/EF-03283-CA8C4C95; Fri, 22 Sep 2017 08:24:12 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRWlGSWpSXmKPExsXiVRusrbvmxJF Ig6PbxC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oy9l+8yF3zjqbj4fD1bA+NDri5GLg4hgemM EiubD7GCOCwC85glZix9A+ZICPSzSqz90s3cxcgJ5ORJHD61mBXCTpPYcX0dUJwDyC6XuPi9C iQsJKAlcfTUbFYIeweTxMaJISAlbAImErM6JEDCIgJKEvdWTWYCGc8sMJ9RomlSLxtIQlggVm Ll324mEJtFQFXi5McL7CA2r4CPxI71HVAnyEncPNcJZnMCxdf+38ACsctbYuuNqywTGAUXMDK sYlQvTi0qSy3SNdFLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMNwYg2MHYfdn/ EKMkB5OSKO/jI0cihfiS8lMqMxKLM+KLSnNSiw8xynBwKEnw2h8HygkWpaanVqRl5gADHyYtw cGjJMIbDpLmLS5IzC3OTIdInWI05ti359YfJo6Om3f/MAmx5OXnpUqJ8waAlAqAlGaU5sENgk XkJUZZKWFeRqDThHgKUotyM0tQ5V8xinMwKgnzxoBM4cnMK4Hb9wroFCagU8pXg51SkoiQkmp g1D1ZI/xQTm/6RKd3Xr3ZcmsYWpquFJ3IqFvgzHmDd08gz4fvr6bIKHfwlcjt9V00tXnLCnUR BqWleW4HKqdkTnxsds7mpeP8wPfMSsY/vkse0th0LiXi54nH3rEXWz6nJJwQ+vu+XfdR+jPxr yqJXGahSVmMZXHsdgeWbxMx2aRuaGGU7ZCoxFKckWioxVxUnAgAjiQkvsMCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-10.tower-21.messagelabs.com!1506068651!77458920!1 X-Originating-IP: [74.125.83.43] 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 35191 invoked from network); 22 Sep 2017 08:24:12 -0000 Received: from mail-pg0-f43.google.com (HELO mail-pg0-f43.google.com) (74.125.83.43) by server-10.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:12 -0000 Received: by mail-pg0-f43.google.com with SMTP id i130so250418pgc.3 for ; Fri, 22 Sep 2017 01:24:12 -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=B9YJyYU7/IEx6Dhj1gZ4oUPI0mJVTCUUoK6fEMWIw7nict0ItXb4SWMg7MMwtpg0ek qPteAchjTPVXhiqtmTP5I3TG6D0k6oosj2p5j+QN/8Vpa5kuYsgphfM51KGwVzxBzUlF mFihXqjrE920yBAHuzj3iQchO6iYgCA9lr0V8= 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=Vftw3DsJwJ3KhFsPTgy/ScD3YPoCaSvNM38hnBZ8CxTagZDOvyOMmhKKHd5JiINfSM Kvt75pxKtzdegkWGp0qxlQfHTDv3IBi/ZI1fJoYhSI65fyJxhQHchsEurWZLzdTf27aj cFktetkpeBvPk8XnTngYcJZqYe/Q+PMlWMyF1UkCWvGay5MkFLTRUEqD2df81aXP5FfE QTk1/9yyRCHgDDjDyRoeMwc0FZEwIMP3NW6Henziu5XyaAVJgXYwuCsM7Ofuyt4hsJr/ dnN4A6+YzGPNKlkB7lWlhg6jEqsueLiFD9lkwqkVmH6QTxe1S2eEgvqohUZtkjdbLFmX 4fTg== X-Gm-Message-State: AHPjjUhiMEeQhdmpNO3szOQcntfJgQmiXS1x7pGkekr4V2HKu/9EKLmO 1CgBLiIEkrdhKdlCqjoHPXtgUE37BCY= X-Google-Smtp-Source: AOwi7QCverAJI9lqJJNT2smTQ5PvnTCuWmYf7WPcd//doDvN+rr5z3y9NJ4n7YDA81LV5CZiOC4KgA== X-Received: by 10.101.72.5 with SMTP id h5mr8755840pgs.305.1506068650611; Fri, 22 Sep 2017 01:24:10 -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 f74sm5569284pfa.36.2017.09.22.01.24.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:10 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:11 +0530 Message-Id: <1506068606-17066-13-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 12/27 v10] 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 Fri Sep 22 08:23:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113987 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011258qgf; Fri, 22 Sep 2017 01:26:12 -0700 (PDT) X-Received: by 10.107.21.1 with SMTP id 1mr4548579iov.209.1506068772421; Fri, 22 Sep 2017 01:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068772; cv=none; d=google.com; s=arc-20160816; b=lBmtxR5WlF5JxdoqT7VrGpyf3jxuI9g1cx9hh+3n8R9w4BI4gMRhJMLgoOZ9bDxRzX /83k4OaYLDb7+Ow+oktRYNPAqVftRkNVMgfXdi3OEJe7geeP8Ay7a6H7K9JeZJSJ9bd0 BHI0u9+5E/CdXzhz6TDi9IvXiAUV1Jj7eEhZ/E/aQV3HKdLKKl5xV9jGUTPAw1NF2h8L HFimsMlfHt5yPAe4AeYkTQBou4wK4kmv2iY+Q9vtnhDuOTx+fQCa95cuo+8sYfA+MKj0 IQI3IDcASrgiVXsAgzwH8RdpoK9N5cLR0HGyhhKaQacrvBSN/GnjRmfupeBAjlzg6ET3 4uWg== 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=vyYTQ42ONI5WJMaLA/Koav0DiFraK8SRrKQKe4YGpvUOBfdtfoSWB14Bs22MHoKs+G DdXR/1Uz8BglMYaFXgSkWBz228hrieqELWuxpgKJIcvyb/c1d1F64lcU6Ea939veJ4jp tJoY8cYGdV25mSIh5VOJ8seOKakDQc7WWmtcyu3qEUzNgIsjc+qaVKlkCrDm/hjG79h4 HcJ6/Te4OvzQahPZ1npyc7S6X5KGPJaipsI4ZXrzG1VBMYDhbO0DBQla0vZadIBEN5ht UTyUbboUi3k8/wlbVVyHpfhDLtf5uLF0vuylwKpwjYOgQ53eXVm5/1sZ4mpS3pzbVz4R y2KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Dgq6FM5d; 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 m2si2867789iob.265.2017.09.22.01.26.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:12 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Dgq6FM5d; 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 1dvJFx-00043G-Cl; Fri, 22 Sep 2017 08:24:17 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFw-00041k-C7 for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:16 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id 36/12-03616-FA8C4C95; Fri, 22 Sep 2017 08:24:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVyMfTASt31J45 EGqw+yGfxfctkJgdGj8MfrrAEMEaxZuYl5VcksGZ0b5zBWLBFqOLhhZNsDYz9/F2MXBxCAjMY JXrvr2UHcVgE5jFLzD61gAXEkRDoZ5V4uG8KaxcjJ5CTJ/F1zzm2LkYOIDtNornDCCJcKTH10 GM2EFtIQEvi6KnZrBBTdzBJ7PpyjAmknk3ARGJWhwRIjYiAksS9VZOZQGqYBeYzSjRN6gVrFh bIkFh27T0ziM0ioCrxa+tUsDivgI/E4dUrmCGWyUncPNcJZnMCxdf+38ACsdhbYuuNqywTGAU XMDKsYlQvTi0qSy3SNdZLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMOAYg2MHY 8c/pEKMkB5OSKO/jI0cihfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwfj8OlBMsSk1PrUjLzAGGP kxagoNHSYQ3HCTNW1yQmFucmQ6ROsVoyXHhzqU/TBwH9twCkh037/5hEmLJy89LlRLnnQ/SIA DSkFGaBzcOFp+XGGWlhHkZgQ4U4ilILcrNLEGVf8UozsGoJMx7HWQKT2ZeCdzWV0AHMQEdVL4 a7KCSRISUVAMjl6FR+QqeKT6qv05pLtgjEWfpcdtxj1jSijLJu0qTIh6ci/nXcWVm8Y67Yi/Z i3+EMHg/knjYrma04OVz5+71DzVqNvg1cMVwbF/EHRv33aLLWtFIkOmCTJjVbuYHS5pTeLif3 ro0t/vF++CPL++zliTMF9tzULlpqUCGXaj3Hb4wr9ebT91XYinOSDTUYi4qTgQA8Rl4ZcoCAA A= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-10.tower-21.messagelabs.com!1506068654!77458929!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 35707 invoked from network); 22 Sep 2017 08:24:15 -0000 Received: from mail-pf0-f169.google.com (HELO mail-pf0-f169.google.com) (209.85.192.169) by server-10.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:15 -0000 Received: by mail-pf0-f169.google.com with SMTP id l188so236517pfc.6 for ; Fri, 22 Sep 2017 01:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+Jo1JpAkfFAajaOT3dp6fEfCx26fj20ZkRTJgD45A5A=; b=Dgq6FM5dXh+tR7MJ2xVvxfEihnwqQXU9o+U++27UMVWFwUbLA5Z/19CIo+hH1lr7jJ z5QaePyuOKO0i/Y1E4URv7S0pXw/x88VIGOfeMnZIt3kAR7LKbbDgqBUpgiDBKIFJMd5 2g6WcayyOOHIC/GKS+CgGqBxBg585LB23cw2w= 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=M7m7zzzRuRRT4MulPZR83W1o6oAYxBhEReMPZBSck1/XKMnJg4sL58BdLBKAA2AGIb FcKy///q0DABa+ttrZN/2VaRrwIe8GvEY/E/MCXNxqMOI2YS7nc0fm+Phf/zrDSjxq87 o4Fs2AE7O1aBuXsif/w2Eif55B+6LzT1HM9z+BusL06xYvC/TE2F2sqb0lbDzehgR7qU NKjZvZ8M2Ru6mCgUbSUOC0djG7v+m75cl6HlF5FiOqNXKENviwonr36Te6ZksOmH5MIX 7RccHsNSC07iPh9C7gAQrakoDV15LLEgfq9ApKxvsYagsx7MgmFFnRRePASe2QmCzoE8 MkhA== X-Gm-Message-State: AHPjjUgu67o5lnEY2eNE+CB0vFlY4L00cXvjVytlT5fFuiR0KAt6ykGA /NB/maE5rCTTe0/BLXNMgw9z05G3WNo= X-Google-Smtp-Source: AOwi7QC5uHnxZStSmJt3160o/gRPkDfHN52hJmxo+KHTyt+zSrUMcimBezUMZHsqXgFLJ322dEzruw== X-Received: by 10.99.135.193 with SMTP id i184mr8592058pge.5.1506068653518; Fri, 22 Sep 2017 01:24:13 -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 f74sm5569284pfa.36.2017.09.22.01.24.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:13 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:12 +0530 Message-Id: <1506068606-17066-14-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 13/27 v10] 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 Fri Sep 22 08:23:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113967 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3010848qgf; Fri, 22 Sep 2017 01:25:46 -0700 (PDT) X-Received: by 10.107.175.10 with SMTP id y10mr6078022ioe.222.1506068746900; Fri, 22 Sep 2017 01:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068746; cv=none; d=google.com; s=arc-20160816; b=S46wOLP9pEmgwX3j0Aoe/vpV8cy6tuMZMc5fBIgAVsK7dusEdP4IxLOmc6+DQrp+Xn xTBTMDktzrtTgz+8SGSp6bBF5+uTcGgwlhmilt8FaR3uDlUzkp2bxYHDwDwiqoyDvUt7 PqVZ1aYSnjqr1xFove8ET7ofuMv1hytwVDJ3llKz1JXkdjC9U6fliZp7kT29G5+3CDKe pqLQgiAU7f9Qhgh9r7RAeVXi2ZiOL3DsdBWugyHX/DZVjzBr5g52yrYlxBAl9yPBhEiE 6OrpN7dvKf5x7kj5QLO1/zhPiE+TRnCGQq1Y1hU0CQs3s4bJLzEPZFmubIyhyT9mz+T5 fkVg== 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=oilO83qmAVXk+ovmnw/6SVxxji6CJ0va/U/FDoAHpznyivA5QCcgYY42oeh55wVPU+ OPP16pMH1M5/dlvIWy8A7bor2FBX+Qu4g4ohKbWeivvcGoIAXPVQ0YsQ9g39Z+MR7i7t pvpXhSCqF1HXVu524ZDoyfs/rpXj7NGMvYuFl5ZE5GgRsKBZgsJ9LybCukhoU6a7d+eH 0Hei8Le97p6W38AxoQEuwSP35a/nt5AqPZ/YK1Thk6XSIHYjZIn06WV/NaNS5dwr/1WD JOi5+wKCmz2G32pcGHWHn64cBukRkKZ2JQFgtsCEpDtMK0/iPHJ5HMypBuHGM3xihJvC Gvmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZkdUfrmr; 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 f133si2857736ioa.67.2017.09.22.01.25.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:25: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=ZkdUfrmr; 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 1dvJG2-000492-KZ; Fri, 22 Sep 2017 08:24:22 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJG1-00047b-Ix for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:21 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id DD/50-03283-4B8C4C95; Fri, 22 Sep 2017 08:24:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRWlGSWpSXmKPExsXiVRtsqrvxxJF Ig8vbLS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oy32y6yFrQIVJyc+o+lgXE1bxcjF4eQwDRG ibbHT9hBHBaBecwSa9acZAFxJAT6WSXunvjP1MXICeTkSWy/tp4Zwk6TWN03mQXCrpL4cPc1W I2QgJbE0VOzWSHsHUwS77dFdDFycLAJmEjM6pAACYsIKEncWzWZCWQ+s8B8RommSb1sIDXCAq kSP3tNQGpYBFQlPq36wAhi8wr4SOz/NZMdYpWcxM1znWAncALF1/7fwAKxylti642rLBMYBRc wMqxi1ChOLSpLLdI1MtNLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMOAYg2MF4 ZkHgIUZJDiYlUd7HR45ECvEl5adUZiQWZ8QXleakFh9ilOHgUJLgtT8OlBMsSk1PrUjLzAGGP kxagoNHSYQ3HCTNW1yQmFucmQ6ROsVozLFvz60/TBwdN+/+YRJiycvPS5US5w0AKRUAKc0ozY MbBIvJS4yyUsK8jECnCfEUpBblZpagyr9iFOdgVBLmjQGZwpOZVwK37xXQKUxAp5SvBjulJBE hJdXAuP/D949vXgbxq+/Q1n0WqHsk7vykc8fUXj4quP7h7UKXJ0wr76SVcX+KEXCf3vV5dW9C 3aIMo9V/+jdu/zdbT6FowsEayX7bGS3fjS2abvxdrX74dZq7x2LRh/0bzrzZb7vt9rKZLoXnP v/+Mvdmyr+qXNOIH7ufr+2b2X1dYLeFkIzw7c9CO/4rsRRnJBpqMRcVJwIAUYSeEMQCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-21.messagelabs.com!1506068656!76101097!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 30976 invoked from network); 22 Sep 2017 08:24:17 -0000 Received: from mail-pg0-f53.google.com (HELO mail-pg0-f53.google.com) (74.125.83.53) by server-5.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:17 -0000 Received: by mail-pg0-f53.google.com with SMTP id j16so255109pga.1 for ; Fri, 22 Sep 2017 01:24:17 -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=ZkdUfrmr+17byFQvMWMxfpJjNLLyCvCQ0S1D5Eu+wnPeLw1+l2kqj/pk9TmAx2Yxfb MYaUMWy408OgytN8rHAEObEvYnyT0pbb+J1dEtpTfXL/FQoRidtwLYOwRgmelFZm6OZf buOx1g8P9Wafr8couA0D0cknMW+9x91cH+Zdg= 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=q2OAVxodpKpa16u6hEeettQTD5svZh7XwxqyDqrmANP4NRElCDCfw+Lhnjk1AHjG5H FgOW8rsNZkEjh7JqW6a7Pc3NTsdgEIZZ+/Lz2ak8UVmgGy9WmG6XRW7JKIqgyrrLy8hm IFrD9XB89rtTKQfXvfb9+EC9lVR6GRBilXj0OuFzFTx0sDyN0Q3/viFg2cGeJit32Bn3 bNc5PcfktVCvnGAeb9eaMigQtlQSRSmjzJgOSbfsc6T+CnTqWAQRhp/y1JCmK9x9PNa/ EADT2UwkRdWt5Jb9V8HZfl1cW77hubruaB5x5a+r1qwvrsWreSLRPgbMpmhx0zaCA6FS Kpgw== X-Gm-Message-State: AHPjjUhxpjHQnSmuPMGC8Ut1/T4IZf9K4SeaveZCZ9anmwIymjL6idZS cpX4WetbvxTKGv+bG5b7hqitz/vFFYo= X-Google-Smtp-Source: AOwi7QB8b/NZxqC0J7KXBHP0XEfrbMLxEuae1qWiHXoXZ2ocnPEQy+2Ci04Lo0PvtmVS5jZCNMo8VA== X-Received: by 10.98.102.142 with SMTP id s14mr8333584pfj.174.1506068656364; Fri, 22 Sep 2017 01:24:16 -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 f74sm5569284pfa.36.2017.09.22.01.24.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:16 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:13 +0530 Message-Id: <1506068606-17066-15-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 14/27 v10] 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 Fri Sep 22 08:23:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113988 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011279qgf; Fri, 22 Sep 2017 01:26:14 -0700 (PDT) X-Received: by 10.107.201.15 with SMTP id z15mr7261712iof.267.1506068773954; Fri, 22 Sep 2017 01:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068773; cv=none; d=google.com; s=arc-20160816; b=fuCctZ/eH8eWrGUAC6NzozjYdAJeB1SM8LCDd5nhNIVLoT0iqvgUguB665G9BxCSWj 0j86rj30VdTHejjiTyr5fvPL52ldGC9yWEuwdugGUhSnpkznJP3bK+ELK3IY7/DmWWRi C6LIEJEcbD0gYawZCLPLcJxRoyKaIkqnPUx7XA1U9CH3bB6XK8nPg49S/xwzeAmZecxg XKa5YDFYIdS+dny5azpByG4alGj4S+JNKlaCL4kj3BM4+Fs56BlQESdvOGKDR7fDqlLZ v4BmIzGPnyu9WEKzAj0QvpJwD3XuWVx27NH++8Xe90vR8khFGSGtz9tDp6RCtRYEkHCY yuzA== 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=gi1IC4kJVSIsLwW0bgvpY6fQsQ9WzuOStbF3uCXdWj730wAX786HsiDMqGlDNUAVty S098f9zO1jXxZRHgulXcmQ8QUlqCxlGzITtzuIP3jyN6pEQzNQHzHHzOY7IWvjD4/hA4 7Tn38BWfd/6p7MkGDeIuEu2TikwcIUsI0kc0G1LpWTKWDAifNVMR04CQotDT0fhS6Vfm lkWfMVirzygScc7nk/HedfrVpUKxSiNYDQj6wjwQPMn8ZnJlUbL3NOK9NhNaAOk5NOc8 zvIl3nkDhi/Q5jrt0B6tK8+ccq94MsI6wUn6e6TR1Bi91qtPYj1ejLG3UGiWBwf2+tqM RHnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hJR0WF+L; 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 f63si3476911ite.29.2017.09.22.01.26.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:13 -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=hJR0WF+L; 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 1dvJG3-0004Ap-Rt; Fri, 22 Sep 2017 08:24: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 1dvJG2-00048T-BV for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:22 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id 1F/EC-03422-5B8C4C95; Fri, 22 Sep 2017 08:24:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVyMfTASt0tJ45 EGlyZY2TxfctkJgdGj8MfrrAEMEaxZuYl5VcksGYsfH2fuWC+RMXEPbcZGxh/C3cxcnEICUxn lDgyaQUjiMMiMI9ZYs2baywgjoRAP6vE9xXbgTKcQE6exJL246wQdprE99+zgeIcQHalRPsjb ZCwkICWxNFTs1khpu5gkphx7g87SA2bgInErA4JkBoRASWJe6smM4HUMAvMZ5RomtTLBpIQFk iS2HtpEzuIzSKgKvFz3jowm1fAR+LmyX52iL1yEjfPdTKD2JxA8bX/N7BALPaW2HrjKssERsE FjAyrGNWLU4vKUot0DfWSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQIDjgEIdjDu fO50iFGSg0lJlPfxkSORQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4a48D5QSLUtNTK9Iyc4ChD 5OW4OBREuENB0nzFhck5hZnpkOkTjFacly4c+kPE8eBPbeAZMfNu3+YhFjy8vNSpcR554M0CI A0ZJTmwY2DxeclRlkpYV5GoAOFeApSi3IzS1DlXzGKczAqCfPOApnCk5lXArf1FdBBTEAHla8 GO6gkESEl1cBYHZp1wWE1a07hK5MP0drGAS2a1fevJnj4Stmdm3frnzBTbJ/QjP8V157J+y32 aWVomqf1+V3IL4awd/YHI+SZmkSPL+YV5F5Y7ufOPbfwf8j3OzI3jrJuzd3x/8H5JbJTpvBJr r72QWzLyR1Tsr8+4Ihjlf6+cstDluWfCm5tDRHe2LnUdU6CEktxRqKhFnNRcSIA8i58U8oCAA A= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-27.messagelabs.com!1506068659!118084281!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 37095 invoked from network); 22 Sep 2017 08:24:20 -0000 Received: from mail-pf0-f169.google.com (HELO mail-pf0-f169.google.com) (209.85.192.169) by server-9.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:20 -0000 Received: by mail-pf0-f169.google.com with SMTP id y29so244152pff.0 for ; Fri, 22 Sep 2017 01:24:20 -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=hJR0WF+LQXCHKDSlAsnkrOBUuzHGx/p8j3K4MJWCC7ATaFBJlvqF5A0ocqyw7qOdOJ QLa1zzzn9whI5jmGmdSMY2SCVLcGc3VgKAZmSet4DIAI3Vg9ZoHUE2S5d+b3De9HiXMS fQ0KQTKNfEd3YWKME58Pbbgf6wC4aOE/x9ifY= 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=iN+QSR2GYuEf9+40Vh3uLABLLyV9m0SWinMMrYE5aLWaeA6TWEX8vfC3IH89MCdpPA /ErgNVec5NzKGhHoS41OIYSc7OUbFotVqA283Aqqjnwse2BswYT0NeVS/80HexMC61st 3EHzrB8APBoLe9wbJF4VgioqavcL6TcpFSUUE9/SiZcQx5Z1p177PoRMskNyXDCsNCq9 2kFOLgepGKImXvtvkx1Tb4qr/Vx/GHt+yO5YVDF5JxJx9K83MUgw/2Guo+2fCvRQZXIh 0eE3AxgJbCvGG1npeerP6uDDrB5Pljgo7jPGDke0MhFNUs9rTAzz56/PX3HHGYi7+UQe JEQw== X-Gm-Message-State: AHPjjUgHerowTC4GQGo1PlOdCEW88/KnKbh8oPs3k06LE6um1SDOnPk4 Lq1Th8qwaOFDOShTvevxtaBvQpZ3zxk= X-Google-Smtp-Source: AOwi7QBMtwEwqCIQgtPynAqn5MjesJUAciWeJ7AiJ7BfkHUEjGkH60E8LrKj9jL8zfI68G7ASN5XFg== X-Received: by 10.99.144.68 with SMTP id a65mr8816128pge.429.1506068659075; Fri, 22 Sep 2017 01:24:19 -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 f74sm5569284pfa.36.2017.09.22.01.24.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:18 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:14 +0530 Message-Id: <1506068606-17066-16-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 15/27 v10] 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 Fri Sep 22 08:23:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113968 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3010904qgf; Fri, 22 Sep 2017 01:25:50 -0700 (PDT) X-Received: by 10.36.90.205 with SMTP id v196mr4917395ita.70.1506068750167; Fri, 22 Sep 2017 01:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068750; cv=none; d=google.com; s=arc-20160816; b=CUpPzmjqA+tzuLddz9LnEkZ3tminue2Pr2goVf4zoAgGjdZVMF6+K/otRXDfNcPCSB MXd75HbOtxKbWK7p2cM1+hJs8kZQo1B+jvg6LS7/cf0hO4Ffp860rgqVyxS7SueAMvTV EnLOBVMoVarvZUJo220w5EUkiKjdD2xC+0131MNukhMfAlwULKASUGcL87Xb3ZlOTgxE Kee7IjYOMrMQ9LWdiT6ceJkIK6Z8BSqIeHOaH/HOQAT/y6xjh8nxAaVmdgKjyAEC6/Rz 2uRnGRCH+C8ijKgZntJ2PBRV6QhmP5LdsSgkSXQhhOk81PgG3C3VlEPhWWvnDCmhnQGQ X/fg== 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=W3d7byvFRRmKN1TDLpqNcFnBEPDSt+QXdfNgR+FfJz5z+eRiQUKzw4ilI8npveSCNx gOJsnrWbViDCoTizAqv2hFQ8DpuePgAFScGoiT4F8npNszVOEstC0qXVCgdc2aqmZ+Am HhjsnJm8yTDiBL1q23pZZO0KrDCE/urkQOYaw2xcBcOqXDJb+RFf2eL1FHSpxCn42l54 2bqmmW+CERyh/eQ3zUQVgX+fbRo05hqVIDfgXo4gfGEZldm2/NNX4DPiIEsXpKgSgWs9 G7XQ2Iv+D3JHPEzWEj+Qc180v1+2Hf4W4dlej5PDvgKd1vL4S9SAMxY0GhvzhfIs4PU4 slsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RE8ixN0W; 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 q6si3421408iti.19.2017.09.22.01.25.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:25: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=RE8ixN0W; 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 1dvJG6-0004Ds-34; Fri, 22 Sep 2017 08:24:26 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJG5-0004Bs-0b for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:25 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id 76/A8-01911-8B8C4C95; Fri, 22 Sep 2017 08:24:24 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVyMfTAKt3tJ45 EGjTNlbP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDMubNItmCxesf9DL2MD40+hLkYuDiGB6YwS f/ovsoI4LALzmCW6521iAXEkBPpZJW7fXMzYxcgJ5ORJbPl3kwXCTpP4/fwAexcjB5BdLnH+Z BVIWEhAS+LoqdmsEFN3MEk8XNrGCFLDJmAiMatDAqRGREBJ4t6qyUwgNcwC8xklmib1soHUCA skSPR3FYLUsAioSnz6dhFsLa+Aj0Tv/ImsEGvlJG6e62QGsTmB4mv/b2CB2OstsfXGVZYJjII LGBlWMWoUpxaVpRbpGhvoJRVlpmeU5CZm5ugaGhjr5aYWFyemp+YkJhXrJefnbmIEhls9AwPj DsbOE36HGCU5mJREeR8fORIpxJeUn1KZkVicEV9UmpNafIhRhoNDSYJ353GgnGBRanpqRVpmD jDwYdISHDxKIrzhIGne4oLE3OLMdIjUKUZLjgt3Lv1h4jiw5xaQ7Lh59w+TEEtefl6qlDjvfJ AGAZCGjNI8uHGw6LzEKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZg3BmQKT2ZeCdzWV0AHMQE dVL4a7KCSRISUVAOj6DHW6fGJMx68PG/McOTGwu0fspRFjuZ9ev2S46jJ5fQVfEH888WtV5Sc vjFxZfx7SePs51J2f87r3Ay7k80z4fuSj5f2q99bv/jV9UjPvY73BF9otRn5XFsmlBR/6YZ0C wtHpvTtydVvHsVnPG37VJl2e8rTV1tVu+alRxhzdc5iZjgYFSwppcRSnJFoqMVcVJwIACU1Fr PJAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-10.tower-31.messagelabs.com!1506068662!115313759!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 38639 invoked from network); 22 Sep 2017 08:24:23 -0000 Received: from mail-pf0-f170.google.com (HELO mail-pf0-f170.google.com) (209.85.192.170) by server-10.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:23 -0000 Received: by mail-pf0-f170.google.com with SMTP id b70so233451pfl.8 for ; Fri, 22 Sep 2017 01:24: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=YOnVbf2KQHJUvnXkY+8NWwhSqgBo0gewN4GYDNIiV08=; b=RE8ixN0WuKIcuQ54fVmBBuVqwBEVl9pSfcI4uUXuFklj2rdxEdNM63rjpoXxdCuAgk GDDU3A18QkepfI0d66TCHIGTPDhAZblvUqaWea85HFo/oBVX2cBZt7ZB/MDiv02ru2kz FWy5UHyai7ADjurRm4jx+ttG57ppbn1Rgc1bk= 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=pSwnoqno762PIgZrC12GASeSTRuDeixm61td7VV9Yxp+SJ1lpdCtSVbsVJ/9/35JZx jaY2e79XNlGCdausfFIcL1rJWUBickpbv16xr6/1a+jexIRlL062hwLSO1CqlQ/zVlvm f/k9dqkPdBC1p5mG6Y0cQ3zQuIhGHXy9TDeXomvvFH2zi5A07PBt+LCX/CyEM/3H2oLY 4U67dhRn1VkQgSIySPa51b5CbISR2lzGvbsTQoF9LERC8g+wA4gdhuagcwBwq+qoOPoQ tezmFBA+O4Cy2sZ4m0UHo2eMCzByAsRZ7AccKjpXOdq4eqVloBTtEgjhu70YVmKCG+BH WUZQ== X-Gm-Message-State: AHPjjUj+E/mqMCe0Wa079KvjbCyvkvf2C7+bmymayO1AqTjeHlkV79+S s7VXyt6BhqKfQNc34X9V6Kdb0//pPu0= X-Google-Smtp-Source: AOwi7QCDRpNCJ1VgrpwxnTNqUV5LRfwgvLnkG/rgaZWyX73UuvAzHtbK2MJ4Llk8rsef23WNmghf9A== X-Received: by 10.84.160.6 with SMTP id n6mr8358631pla.393.1506068661796; Fri, 22 Sep 2017 01:24: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 f74sm5569284pfa.36.2017.09.22.01.24.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:21 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:15 +0530 Message-Id: <1506068606-17066-17-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 16/27 v10] 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 Fri Sep 22 08:23:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113982 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011155qgf; Fri, 22 Sep 2017 01:26:06 -0700 (PDT) X-Received: by 10.107.12.198 with SMTP id 67mr7081299iom.189.1506068766439; Fri, 22 Sep 2017 01:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068766; cv=none; d=google.com; s=arc-20160816; b=aba43wFas41GxhTAiZx3SuVK5H7V7qd0XxgcHpth3pbhD2lFVUe6YfFvOwUu1OEGtP TL+IUv20qZJDq4+TYJk2D1gX91txEv5aYmQk0UF7ufS8fOmA/5Gz6+QeUiC29qAPiJ1Y PimkXcUnluWSj/vB2TBJqBOyPdGQ37A4//EuZuFuKYMPaCklG3XnRsUMgTM4z90oSyin rKDZfRoEicEno/HtAVUX+BgzRuG6YVLjRrWMq9GOL+kV0I98l6KnkqvpFQHa3Wx1v4Bd 8Vd53qjqhrjmaR4S5Ks1yKlk8hE1vLltz9McPu+I9t8m+wLBeoy4eyFsNig/2ncE5uxp n4WQ== 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=cs5zwlekSnCU3G+g37O0gxBugFhdx34tc1j/cxNbqpVbrjFi41Cfva5ce0wHpCFKLB Lwngc8fIeEP83O2g9eVhhBZGtDR2LPZcQiL6O66vLEy06GbZCZxwTXhXHfCx/KZlwtiX It8o5I2pqH6G5//9OpQhlzLqt5NdaZ7bUHqH9FkQQ9u+TTgBW2+ZROzdOb9wjTbh/Sdu AJbZNQsFzN4aqQmTxzf6DcEQtmU4l9J9Lx+fTmZXdWGxTSddEwVeb2rQ1Q3bfsZwIqTR 8b/6Vm23mGxQlGi5dwRyLqajNaCibCxAA/zhfiDu8DUY4/d/Nznr2HwadJ0bc+Ha8nlA NOlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PRzoZ+u8; 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 m206si2883495ioa.343.2017.09.22.01.26.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:06 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PRzoZ+u8; 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 1dvJGE-0004Pd-TX; Fri, 22 Sep 2017 08:24:34 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGD-0004Mz-E9 for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:33 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id B6/5D-03642-0C8C4C95; Fri, 22 Sep 2017 08:24:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRWlGSWpSXmKPExsXiVRuso7vrxJF Ig51PxSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxZq66wFEwQqFjxdT9LA+MW3i5GLg4hgRmM Ekd/nWMEcVgE5jFLzFq4j7mLkZNDQqCfVWLWZyYIO0/ixdpDbBB2msS1lp1ANRxAdrXEwU/sI GEhAS2Jo6dms0IM3cEk0bd3MjtIDZuAicSsDgmQGhEBJYl7qyYzgdQwC8xnlGia1As2U1ggXu LGgetgNouAqsSm59PBhvIK+Ei8OjmDHWKvnMTNc51gt3ECxdf+38ACsdhbYuuNqywTGAUXMDK sYlQvTi0qSy3SNddLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMNwYg2ME487L/ IUZJDiYlUd7HR45ECvEl5adUZiQWZ8QXleakFh9ilOHgUJLg3XkcKCdYlJqeWpGWmQMMfJi0B AePkghvOEiat7ggMbc4Mx0idYrRmGPfnlt/mDg6bt79wyTEkpeflyolzjsfpFQApDSjNA9uEC wiLzHKSgnzMgKdJsRTkFqUm1mCKv+KUZyDUUmYdxbIFJ7MvBK4fa+ATmECOqV8NdgpJYkIKak GRt85so/3nS16w7aRg5ftS3BK4925Jt8rhB5OnemjHXV362MdrY1r2SWevX+0cvrmvFa9Qu+b fd+ffA5+F5xjrTpFUic4VnL6iwLJeDnLG2cc1+RU3As+4K2wi/2gdUxM9NeJO50nsjjeu7Jzd voj1j//LW7+UtvrLXPA4mDMuxuLvxc33FqxLUeJpTgj0VCLuag4EQA9wEkpwwIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-21.messagelabs.com!1506068665!83960492!1 X-Originating-IP: [74.125.83.44] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20984 invoked from network); 22 Sep 2017 08:24:26 -0000 Received: from mail-pg0-f44.google.com (HELO mail-pg0-f44.google.com) (74.125.83.44) by server-9.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:26 -0000 Received: by mail-pg0-f44.google.com with SMTP id c137so242214pga.11 for ; Fri, 22 Sep 2017 01:24: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=cKW4VVAXHwcprLM7odui2WUoZIfS5KdXFh4XFIsCHUU=; b=PRzoZ+u81b+kFSx1+TdhY7Xv43CU5Apk3RKwar1KW/xzG3sZAI58UttGpzvFdeUeyQ CZje1XNJAWqIcSjMMui+fZe3vufpHHUFysewkQv6yXnH7xuQmVAfoQ0j7jRR0dCEH6P+ x4SxBFNB2kqclDEtsIK0G6C6lyNK+OMB8E+vg= 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=fJURtziSPDUAR203hXOve1pMIVXbUtok/J6CfPU6Ym5qfoppeeoq43Xp9j62OxXydf h+K4uKwpECULGYiM0BYw9yQkWwmsZqFZyEdDLWqu1Ang8zA6K/MWJXmS68ew45UHB6Pd YTJYYEYVtveIRqDxKsL1wdPirhZGqLBvctKBnRGt1+2VeuOFfNgF/8G+fUCRyA9zY5RK +UyEHOt43GCk4Kn69+t95W/o4/tYCeLS6qa7a3B1cn5dXTb9q7py+fz8hQPZyxthB392 2S3UIME5zitce3SA1kXMYN6HOBtynaMAxIGhPk2hR8MYIyP1oUu6z2XnVLPLftecH6/j nNdA== X-Gm-Message-State: AHPjjUgZgGDG9puOnWUbU+TM22UOEr5M9mVU/q5Sd/Grn56G+n+5oQ43 pQxKFoR/xbEAystKMhhFQNlHmGN1yp0= X-Google-Smtp-Source: AOwi7QBK+qon706fWZCJ74Kcatk5LUr35xQK4ijVdbQWTBwIjSwOkPdVD9kJSF4FsJTVvlsiYFEzrQ== X-Received: by 10.159.204.140 with SMTP id t12mr8443831plo.192.1506068664592; Fri, 22 Sep 2017 01:24: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 f74sm5569284pfa.36.2017.09.22.01.24.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:24 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:16 +0530 Message-Id: <1506068606-17066-18-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 17/27 v10] 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 Fri Sep 22 08:23:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113969 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3010939qgf; Fri, 22 Sep 2017 01:25:52 -0700 (PDT) X-Received: by 10.36.82.145 with SMTP id d139mr5230480itb.86.1506068752567; Fri, 22 Sep 2017 01:25:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068752; cv=none; d=google.com; s=arc-20160816; b=J7/ukz6ALYmm3+qoa8hKXwyc8YI7SK+Yb4Nxx+70ZHtjMsPofYjVARMhUtlca9wpNk Qz1wIQIsgfL14LHASom+fDBWS4rsRYWh/DhmuDEkrFINVPttwJFc6LpxVSvJJvLPTxAx 61RUVYojnGnXWbSAcd58XAH9D4G5WqQhecK9xeqfBK3GdvaChdl6tdi6cfgclkIHAuzd PyiNMiQ1V0pnMGXvODlImefjpKlKknMVZX+km2gi3ANf2S0WISrrf8+5y2BNmHCrIGDp Ri1xLx31JxrM5Ck0xZZGXI+nIPm2F2Ylo59Ux654RzDuaVRFAILLf+BeYizt1CHt0jgX vXSg== 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=iRwI8hER1BQSqrGvLhFSi3kUeESm7WT5KKEor9N7xIUU2ODqxQ/l0qcw2OxYe5sF9Z YTbktGo4eNRC8czZs3Ee5jSxcVwBv3d/jygu7ezAwrFAFy8mZYuH4VFxAiw8u7D+FmOW Fqz1l2+vx53pAEms4w5m3VwH89EeBSDRUv9wAXOfoZRxbu5F7F3uOoJuTw//mNsu738T 9PFaXr93Va3dtDwC+j5YRkTP27jsmCmTlMPItl4wKBayMCPjYge7Q0jCfXlqBV2N4WbD KhOCPt4jKkpZ+DN+4bBI6gu4JhKC8UsIRxSEhXBH60hZnHb0jWrJlnYvH0ggpTwq9/4f B/Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NinKr6Co; 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 s3si3087290ios.70.2017.09.22.01.25.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:25: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=NinKr6Co; 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 1dvJGC-0004LP-AH; Fri, 22 Sep 2017 08:24:32 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGA-0004J2-Fq for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:30 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 08/ED-02224-DB8C4C95; Fri, 22 Sep 2017 08:24:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTAet29J45 EGhyfw2fxfctkJgdGj8MfrrAEMEaxZuYl5VcksGYcX7uMtWAzd8WElZENjM84uxi5OIQEpjNK fL53nwXEYRGYxyyx8d9pMEdCoJ9VYs2KG6xdjJxATp7E7rvX2CDsNIlNB2ZC2RUSvTdug9UIC WhJHD01mxVi7A4miVsNd9m7GDk42ARMJGZ1SIDUiAgoSdxbNZkJpIZZYD6jRNOkXrBBwgIxEj /6H4INYhFQlbh2cysziM0r4CPxc8p6dohlchI3z3WCxTmB4mv/b2CBWOwtsfXGVZYJjIILGBl WMWoUpxaVpRbpGprqJRVlpmeU5CZm5ugaGhjr5aYWFyemp+YkJhXrJefnbmIEhhwDEOxgXLPd 8xCjJAeTkijv4yNHIoX4kvJTKjMSizPii0pzUosPMcpwcChJ8NYeB8oJFqWmp1akZeYAgx8mL cHBoyTCywuMACHe4oLE3OLMdIjUKUZLjgt3Lv1h4jiw5xaQ7Lh59w+TEEtefl6qlDjvfJB5Ai ANGaV5cONgEXqJUVZKmJcR6EAhnoLUotzMElT5V4ziHIxKwryCIGt5MvNK4La+AjqICeig8tV gB5UkIqSkGhgv8TjZZz2wPLuapTjtv9GGRzHVXZln93AFH91h8CN16dLt61c73vHYtV56Terc j0xhZn9n20fMaFpQcs1OOUAuiv3pnU6v24k6HIbT+vYp95vkJC5aI2JXsqPqRUtb2h6xcOW+M 8d+rF+4+ouc7gGGz8XfSuRFl2l5fEp+t/yq86Lnk17Js+YpsRRnJBpqMRcVJwIAd5XAdMsCAA A= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-31.messagelabs.com!1506068668!60527479!1 X-Originating-IP: [209.85.192.175] 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 13305 invoked from network); 22 Sep 2017 08:24:29 -0000 Received: from mail-pf0-f175.google.com (HELO mail-pf0-f175.google.com) (209.85.192.175) by server-9.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:29 -0000 Received: by mail-pf0-f175.google.com with SMTP id n24so239174pfk.5 for ; Fri, 22 Sep 2017 01:24: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=ibyLFSz2OCW5sE3Ydz65ZRFcFBf596L9bo9Hcmr8ZFk=; b=NinKr6CoL0lUA3XITjM3OOoHJpT86Gb+ZujtG53xuCvMBF0uave+Du3j95wxRfme/3 0s95egI5UpqKdJvAh+qMWUdYOIOJB9ogQxPCtmatG1lUVmgBEu7fVOUyowbK8buWmYj2 aHk5KG4FNr4lrKaSnRKSPmbh0S2Vh46fnvmqk= 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=UAT36a35xVHpq74excV/D9V6LgyCMuMVMeNvLPpOvn+AkFxGwJeihxdKJvoijL/vuK vco/Y7ItymI72V1SXR8R/Uc14kJvtom/1zsTzoQ5zTG7bZPXBe2BZBsXiknMu4pP+GHa SiMOX2adXLEeR9J98ipN7/NS7oXCG49dVdTm4lVuzBh2LRJ4+w04IyyYOYK0NHWcq5nh moFqGAPftrNLSk3QfHwxTwIxeluV54Nmsd/pGt6OgtxCohS5aNaB8jr3ymyHd7oAqzEO WykKLUefatoZLQrV3UlBR8yELxhueo16gLnGX5WbXJYfHMqRoVdUBEiqeJ5cymd9Q6yv DkHQ== X-Gm-Message-State: AHPjjUg1Knptgut+q2rsFYp/HV1Z73B3LBXgDX0ZSf2fPoJwetAFbCDu 9ZtItY+51qMzu3WR4w23torcfv42w7s= X-Google-Smtp-Source: AOwi7QCzR372PQiG/gr52LobLp501WXJiM4IGrVyd6SVh5OdYO8kju6qY7fweAck8ApVbis7It128A== X-Received: by 10.98.139.15 with SMTP id j15mr8519473pfe.33.1506068667546; Fri, 22 Sep 2017 01:24: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 f74sm5569284pfa.36.2017.09.22.01.24.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:27 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:17 +0530 Message-Id: <1506068606-17066-19-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 18/27 v10] 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 Fri Sep 22 08:23:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113973 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3010995qgf; Fri, 22 Sep 2017 01:25:56 -0700 (PDT) X-Received: by 10.36.39.142 with SMTP id g136mr5821815ita.73.1506068756013; Fri, 22 Sep 2017 01:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068756; cv=none; d=google.com; s=arc-20160816; b=nBqM0byEVBKJIMTfQPPLvWI5I8Va5M1ihqEDyb6ZCYEckbPbX47YmJpbewqp27+7OR NHavS+8hWFLp78Shwg9HkDhw52AWoPzPiqY/JrC2ha2fh2rcllehn9OQy+FRT05WiOv1 B+kcUxcmnOIxm2qhAyF4NmonPFQMHGuevxHagwuaI06iVsv+P1vKzQLA2Ue9P+Z4w84s SeAsA0L2QdbOJoJeb0Tf6uS1XTfyul77wLkRDMjXJXxVmdXUtzwve0zumEXJHguIzR2i r3In5aOG2Nl4p95vGR+3f6hlSW+GsJBCFFBAv1dHvRVny1Bf6Z+9rMEsO1iKI/Fh7V1Q LmcQ== 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=gJB/xmm6Nk3FI15ApzupCD5FviEQA22dcHH6H3uty8vpMQ0i3pcxvqfZ+yx86DAUP8 iRT7NIaZjlI+ZSRraBfzKAnUsHcwVDEUyGRqTX+MrCuKLH02Jv0noHC7SweHAhD69eQ5 fwlpiT4Pb6CFzAwAfGSn+YPgF+kCjodrVJKluo1D3Qrz95cu3CWF0S07e8VLWW3xjOqn 5ZstHxGQIlzzmcGxdrqJKqVLxcLe2BibRgEwft9pk1nfTwrtptFppE0Wur2sIn8vlQwR szhQ1eOy2kgM7Rdi5YbAl4f20+wVOl2C2WOiwUQSBEYjdkjxFI+MLyWCnOcEkiQRqyL+ n5pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hxllXq5C; 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 h17si2927630iob.122.2017.09.22.01.25.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:25:56 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hxllXq5C; 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 1dvJGE-0004Ot-M5; Fri, 22 Sep 2017 08:24: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 1dvJGD-0004Mo-Ct for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:33 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 10/B7-02023-0C8C4C95; Fri, 22 Sep 2017 08:24:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsXiVRtsonvgxJF Ig8cHeC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oy/WzqZCyZzV6xasIWpgfEoZxcjF4eQwDRG iSMrZ7N0MXJysAjMY5a4e1kIJCEh0M8q0dI9jREkISGQJ3FxWQdrFyMHkJ0m0f2kGiJcKXH+7 nF2EFtIQEvi6KnZrBBDdzBJTP09kQ2knk3ARGJWhwRIjYiAksS9VZOZQGqYBeYzSjRN6mUDSQ gLxEoc2nedHeIIVYkH136AxXkFfCT2fTrADLFMTuLmuU4wmxMovvb/BhaIxd4SW29cZZnAKLi AkWEVo0ZxalFZapGukaVeUlFmekZJbmJmjq6hgalebmpxcWJ6ak5iUrFecn7uJkZgwNUzMDDu YLy8xe8QoyQHk5Io7+MjRyKF+JLyUyozEosz4otKc1KLDzHKcHAoSfB+Pw6UEyxKTU+tSMvMA YY+TFqCg0dJhDccJM1bXJCYW5yZDpE6xWjJcWzT5T9MHPv23AKSHTfv/mESYsnLz0uVEucVBU aYkABIQ0ZpHtw4WHxeYpSVEuZlZGBgEOIpSC3KzSxBlX/FKM7BqCTMex1kLU9mXgnc1ldABzE BHVS+GuygkkSElFQD45IHv089kPsaOcn1+b0ZGbZTyus5/lult2jt+i7N2dg9QVTl0mGG63q7 t/Mk8b5Q3lc0XfSmXkjkscaImY5rju2xnyU0O0Pdil1DQG45M39qfco53jMMZ/7cTM9cV3Sv2 er11BOy/48Gsr7kS/JfXSzx9GS35LPNZSIxt/xcv2t5z07v4U2qUWIpzkg01GIuKk4EAEFVY9 fKAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-10.tower-206.messagelabs.com!1506068671!84325669!1 X-Originating-IP: [74.125.83.52] 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 17349 invoked from network); 22 Sep 2017 08:24:32 -0000 Received: from mail-pg0-f52.google.com (HELO mail-pg0-f52.google.com) (74.125.83.52) by server-10.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:32 -0000 Received: by mail-pg0-f52.google.com with SMTP id v23so249298pgc.5 for ; Fri, 22 Sep 2017 01:24: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=Czel33Q/wCzetrNTUKuMCaNrHbuXAUhTInKJVQs+Ekc=; b=hxllXq5C0y2pehoQwrqUkOa+//nagfU5hBR6vgJZwzWmIIGEMwPvmbAybLl/4hyT6X Sgmf1DSQKRRw2VzkHDzQLlW882yHFWzjk4KLmXGEQXWrm36WoitaKj/6FCrE4lhTAvHE EGKBKKXw25KGoYEPT+f1xSdMpy6kvxhxHo38g= 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=NunMspAuWNDX7HzSgG3kK9aHBRUHk3OdIlilJpINyIuhJlVg9PEh1IHxyMYFv9pwVI LI32OXkG+sraDtCFViQvEVMZexn+e6qrVA0DOxKgqHTv3i/et4HeWsWUtavVC3iH3VJl OnylpGFSq+9C5ZPpvNwOGQV3Bjrd+B6S6H1V9mFIZVNXCHDnUTMVtaJrDq8bhSYhvPLc fXLJUBq/sjORlY5v+5+UyoVJ6Q4Dlsn8dtnMYnht6dnAu/vAEZl8xRSMQxe6u5eGTTLs mjSbb6QuVd0q7V5WXO10yxnVTx8Gbxt/WKATrZRd+3hIba/PaQSUFmGKnYw4q/CY8v2s O4MQ== X-Gm-Message-State: AHPjjUh7UemfFBqfNOrth5VdRYd4Dc5ZITVOTixG+hWK2ZDWgJfQRdFG cz07S73tLtBXbxbhGJ88L/s7Q37zS0s= X-Google-Smtp-Source: AOwi7QBK86UGIcvuHzXYw9XkW2gN2VtX89pcPiqDBPtJ55VI8pqopol42IUZhn8UQjzKpWK5wXm6EQ== X-Received: by 10.98.196.26 with SMTP id y26mr8595201pff.106.1506068670399; Fri, 22 Sep 2017 01:24: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 f74sm5569284pfa.36.2017.09.22.01.24.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:30 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:18 +0530 Message-Id: <1506068606-17066-20-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 19/27 v10] 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 Fri Sep 22 08:23:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113970 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3010955qgf; Fri, 22 Sep 2017 01:25:53 -0700 (PDT) X-Received: by 10.107.8.102 with SMTP id 99mr6301764ioi.105.1506068753600; Fri, 22 Sep 2017 01:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068753; cv=none; d=google.com; s=arc-20160816; b=FuX3dDYxVFa2PBv43yKGRKHaJeLWmh2cs65Oet+bTelyNVBQrEHPrd/8gxP1cOhjRT ro15JgoN5o7+9LRXzaxuoGTGartJMx+a0+aCz/oKqc0q80DACl5QsjHCten4aQlKCnsQ veFRfcHdhuC0Jou2lFOlLvP6CLXAlKpeIsLlwn1BnXU3EFzqw9zVnZdfMfX6WzDj0QbR dt2uyTG42Y8eI3WG9X8K84cTLzBrSRwJbyhianqqsevePWcQ8ZRDBtqN/HEnTVlo/cvY 8ZUmlqoV/w9feILZYyVytCncCcbxU0slbHIRe/DAx1/YQriVoCxGvCt8xnsxBKMVaRpK NQvA== 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=u919AWJy0uFWsa1dlqE1xNjFIaPqp6V0ITP8/usMD6KKha0rkvG4y2+JQGEqNO8I/e uSBz3BtAbiIorqdSK1MuYq558Tzf3R3gvabu/kC0P9DXSpdNL2QF2hw/brJamfrhZNBW fVhszkL6SF+mX4p9sW+xXcsxEJ6xVpQ7YOFTBkwYAwSSgettFlmHzJaMHASoZLLjYkgV spJiAqReYAA3snJse9Ky6fP/47P2AveUHanF9nJaahdzYpsaAQiiCFcNmWafYb+pemIX DubGQhKRb74HnjEB4zuwzkRTHwhRJo5NA4ob/mccZzReV1tgCWyua+GDzb4mzHYsBobq WCqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AxbGmBV+; 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 d39si2975760ioj.319.2017.09.22.01.25.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:25: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=AxbGmBV+; 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 1dvJGJ-0004WN-5k; Fri, 22 Sep 2017 08:24:39 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGI-0004UB-5w for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:38 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id B0/5C-02048-5C8C4C95; Fri, 22 Sep 2017 08:24:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsVyMfTAZt1DJ45 EGvw5aWrxfctkJgdGj8MfrrAEMEaxZuYl5VcksGY8PnORqeA3V8XR5ftZGxiPcnYxcnEICUxn lLiwdzULiMMiMI9Z4nHLTWYQR0Kgn1ViZutR1i5GTiAnT+LKzvtsEHaaRMefW4wQdqXEvt3zW EBsIQEtiaOnZrNCjN3BJNF78C9QAwcHm4CJxKwOCZAaEQEliXurJjOB1DALzGeUaJrUCzZUWC BR4sfPl2DLWARUJa7P+AO2gFfAR2Lm/7dQR8hJ3DzXyQxicwLF1/7fALXYW2LrjassExgFFzA yrGLUKE4tKkst0jUy1EsqykzPKMlNzMzRNTQw1stNLS5OTE/NSUwq1kvOz93ECAy6egYGxh2M PXv9DjFKcjApifI+PnIkUogvKT+lMiOxOCO+qDQntfgQowwHh5IErzEwiIUEi1LTUyvSMnOA4 Q+TluDgURLhDT8OlOYtLkjMLc5Mh0idYrTkuHDn0h8mjgN7bgHJjpt3/zAJseTl56VKifPOB2 kQAGnIKM2DGweL0UuMslLCvIwMDAxCPAWpRbmZJajyrxjFORiVhHkFQa7iycwrgdv6CuggJqC DyleDHVSSiJCSamDsWOHGyXsmcH8gz4yES9X7pxx2/aqRe3Tmmn/9JqsW8nGeifn9u0EtmSNo TjNzzeKwtVvOxiT7KHVp7wphZbzXXOW+Wutc5elH2UteM3arnxS7fEO+vSv0tuBPg87opqCue SYKS4yPenVWMd1OdzlzhHMf32JBRpG1X6YoJ3t/Uby/N6x6vZISS3FGoqEWc1FxIgCRo+LAzA IAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-31.messagelabs.com!1506068673!85071970!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 44627 invoked from network); 22 Sep 2017 08:24:34 -0000 Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by server-11.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:34 -0000 Received: by mail-pf0-f179.google.com with SMTP id r68so241159pfj.3 for ; Fri, 22 Sep 2017 01:24: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=cCjDRmwTdHUYIQiYgejFMteqYI89juGj+je6V6CGGvI=; b=AxbGmBV+BznqaV2h9cZ/LskBq8evgrX4y1JSPVFDmv59UcUjdNV0wgN2plOJewuQZX UNaBAfkLs/9CjMZhGIKjFRr4EoHiRdzNmoP6VSrsURghrE+ch9YmHC4VBTLgD7/H5DgH 2sHVbgTL2OTZrQAPNm1eQdW2yq9UhECQSnU14= 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=dWpf2HuQ5ZhsTxtaSurXS2THnklDNoEwfHcJvbB25/uk1qvJUjQwmutqILdvCHo39p ltETFknQm2/uRUArbGzH29+4rbQboVKFIeL/y6eMJmDddOt2pp547Tfd9odrmpakkhek 8LLQii12Ch0cbJeUt6wHU7Do9vM0PhzZwpWkJ6NcQAKcB3hmxWKE1IAFQdd6LHlSHsbT heOeXMGTwLsI+vpd+0dcz1QP9xM6tHCIBuyox63CPZbF/80awJX17fO8d9gzEZ9tHhCT aUpNzwOLWIdWSw3gpZsarXY7kCL8lIVEhtT31uYFwLizL//EhIWcRmOVuv5eSnfayOMb NjnQ== X-Gm-Message-State: AHPjjUj3Yj3y9fEXp7AV7ZVqb1F4ueJXhVAlvMkUKCaeO80Krx0+oDQg CDp/6H0kjaoT27hdN6zbCAlXK48vCfA= X-Google-Smtp-Source: AOwi7QCCT+M86lOuPK5yTOLzpxj+k+PFMPjoNPCuNcsASLuHLp5asjxWf4lt4e3X90kTj7F3TgojHg== X-Received: by 10.98.245.74 with SMTP id n71mr8536075pfh.102.1506068673202; Fri, 22 Sep 2017 01:24: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 f74sm5569284pfa.36.2017.09.22.01.24.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:32 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:19 +0530 Message-Id: <1506068606-17066-21-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 20/27 v10] 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 Fri Sep 22 08:23:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113980 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011112qgf; Fri, 22 Sep 2017 01:26:03 -0700 (PDT) X-Received: by 10.107.10.77 with SMTP id u74mr6993511ioi.243.1506068763868; Fri, 22 Sep 2017 01:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068763; cv=none; d=google.com; s=arc-20160816; b=V+2gpqL3OIoLe1C+ahH9eT9bRWak9YaQ1AgYw25hvpNVT3jhS2eutBwGu0zBPkqGgk sxsIRwn8UDyKmjyPpG9KszCYShUZH9M7DsZODmQkdVqmYK0WBNi5w4uLiE+fHtySA6h9 vkPT+5ETWygoe2HWHhMnY5GoJ4itTuvsEgluoCQokeoDH4slJY0ZQ10AkNx/IUDfHT6l 0R9kQlU+LLqX6SBuPOKGrvBPY+2l47O5TXR4h4H9x58OTlAO9Fa0X9hjt3Lt+NNJFbeG F7F8+RbQV1Zl+rSrgmevyj1G95KT6KABUvdqLhEGNtAQbcfKb1d20gfejuDS7q3bJhzC BVpg== 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=p1wiLWLI63cKxCs7nlzRy2FyFaYbVhVQnt6b1cv/T4dSo9aMmLBeuRoCuQ+QrdK9YW Q9RwQ7CIYhDEbrs9vkdeQz/yXR42wFVvomggSbqR2y5oyCfhZpLwAXFGr+S/zyI5gEvf N/87jNZ7ubjkc8QY9xJR/Q/3dYST7Pxws4KgkxYZXUtg3qK7isDD3aDLEnZeP1yUjXx3 JufUg8JApyQD7fAJC+ccd41IG+FDSnecWEIF4udrL4QD7ELJyAwjKqqnebUavMjElfH2 V9stdUjThAZtr2I74wgQczZ3fYp4D3gKVG9lTL3CK+Jjf1bffnuUyPOwpdnjq/dXKr/c 574w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RDZ8zUC6; 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 k34si3038819iod.151.2017.09.22.01.26.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26: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=RDZ8zUC6; 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 1dvJGL-0004Zf-Cb; Fri, 22 Sep 2017 08:24: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 1dvJGJ-0004W8-Hn for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:39 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id A2/F7-02023-6C8C4C95; Fri, 22 Sep 2017 08:24:38 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTARt2jJ45 EGszbbWHxfctkJgdGj8MfrrAEMEaxZuYl5VcksGacv7+DveCBZ8W9bydZGhjv2nQxcnEICUxn lDhw6B1zFyMnB4vAPGaJG1O1QRISAv2sEitfHGMFSUgI5Em8/7+QHcJOkzhzvIENwq6QuNf6D MwWEtCSOHpqNivE1B1MErufdgFN5eBgEzCRmNUhAVIjIqAkcW/VZCaQGmaB+YwSTZN6wZqFBa Ilzq05yQZxharE6ba/YDavgI/E2u4XzBDL5CRunusEszlB4v83sEAs9pbYeuMqywRGwQWMDKs YNYpTi8pSi3QNzfWSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKTivWS83M3MQJDjgEIdjBePO15 iFGSg0lJlPfxkSORQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4dx4HygkWpaanVqRl5gCDHyYtw cGjJMIbDpLmLS5IzC3OTIdInWK05Lhw59IfJo4De24ByY6bd/8wCbHk5eelSonzzgdpEABpyC jNgxsHi9BLjLJSwryMQAcK8RSkFuVmlqDKv2IU52BUEuadBTKFJzOvBG7rK6CDmIAOKl8NdlB JIkJKqoExxlvdiF8jz/3Pmot9z1rDDqu99jm71+ZkXJD1RKmENIelR5NPin1M63qR5Rpdl99d ea9gqVepKO8Pjk9K9Yve2q5wLkx5ldb1p+ZGq/8fwd3X7h1QvR/A92CDR11doJJiqVA2Y6pFh +PO+6e95lXuWTqVsTip4+faifkLVA6eUphxrLl1QY8SS3FGoqEWc1FxIgCAVZG3ywIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-15.tower-206.messagelabs.com!1506068676!98732261!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 13833 invoked from network); 22 Sep 2017 08:24:37 -0000 Received: from mail-pf0-f177.google.com (HELO mail-pf0-f177.google.com) (209.85.192.177) by server-15.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:37 -0000 Received: by mail-pf0-f177.google.com with SMTP id y29so244434pff.0 for ; Fri, 22 Sep 2017 01:24:37 -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=RDZ8zUC6jQBuB41uuSuadaJFjmtDw5GU8OKfbZz2zvhWb5qK1A+Stup+LYEGse57LU rmUdfiHTNqpvA1SnOBPRO4Cq23+aALFWt0tt54vJUTaNEqINUSrTKNZNuRJYrvr7SUnX A0sbWdpVW75MUTzwttVk+rIdNlCf/VQagzXUU= 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=Nv0UnEfQOYv5AMbf3YdIwcTuIc/OopUALjyM0p9YA4X+XHxzKadBniln41BEeHmimb ElWcrVl1tVYjweodUaSMA5kYBUTeTPpX9FlCJ8Pg3ALoBN7rqIfIvN84j29SYHh+Ip+s HcXz8YZx/VLixgcRK9Ro+h3u5qU8MCXO2MQ1FVstzGINtswWQp2Pg14Vzq3D7I7v65dt 9VujoCqatJSK+iGkztsNQWRiz+ZYxcWLKCQl8tIESx04zE8UrWOaWJxpB1/bbRdLtZRf w35y8dqCAYqOXagSYwHYYjBaWf50aiTZJkp42SexNVPWPe1TC9+ezOQTJ2jfEKzmpx0s Fsmg== X-Gm-Message-State: AHPjjUiqDZOtKGFuj6sCZJy9zkcHB5DAYkTomOhOzpdtYuqOtWmp/Spn fNsvbqhPklC7QPSwDC5lo7Vdsl0HrDE= X-Google-Smtp-Source: AOwi7QC3wEq9MCSAZLOuzQkJphheta9yvLH1ag1linKa3nuWaLoVitV+kB+RmoxMLQ7Rxm9dneiaHA== X-Received: by 10.98.210.67 with SMTP id c64mr8367173pfg.60.1506068676078; Fri, 22 Sep 2017 01:24: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 f74sm5569284pfa.36.2017.09.22.01.24.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:35 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:20 +0530 Message-Id: <1506068606-17066-22-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 21/27 v10] 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 Fri Sep 22 08:23:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113979 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011093qgf; Fri, 22 Sep 2017 01:26:03 -0700 (PDT) X-Received: by 10.107.78.25 with SMTP id c25mr6101394iob.25.1506068763336; Fri, 22 Sep 2017 01:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068763; cv=none; d=google.com; s=arc-20160816; b=wJgU/D3ila9WzpKKo+j1/MtLEa7aLEI9JNVkuqJ6hxrKifFLM2TiIjnJW12lBl5u7y axVSWBjqQdgDVrVoDlivmJPAAVf6EukM44dTGZN1NZlH/MTSCp+xeO5hYvP8FcdhU/te iUYuoUMjU17lsKceKzNolnUlEKtpauwRAmYTGWoTIez/YPzgPaFDediujaLeet62HqCw 9gkUcS6kkQZdiDLaKifnAEFH6ao7vjYo5CE8WTJpvlYjl+lTrImQ03c73Dtcb1mp8r11 ojvuL65jCfCFh4OHSjXuEGZfYfz5DOIhWAj4rxd7hXqMNjaqxmk9a9iwtdDqfZMLht3I 5EVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=i1DerMoIfoPo/MsSXJfIlpUT2liqezAHI1qr9iqywbA=; b=LWmfCKKXLJy9RLlSvV51TyA5SpPEbDbqTrrBtjHkWXbh0ONKWsdq4ZdrzyBh2+cuZJ rza+bkGPTfD8uiayYVlp1sQNA6my/ifON7Fi2TfhCfIMTtAtCy/1bUSa0lrfapnaPnyt Y5o85+rHUwJ33s27Bu8BxvCSP48a7h4/OknRpRTRQKvuz6prFQ97eoSn7iy1O7EVKKVP ZjDgXNhOIJ6Y1lepDaQEcHg7qxmyFvk+RKfnBTFNcWNk25RZLtETBw3tcFsAqUwFlRmY xE9JNWT5aMCXSo0KII1VaXS8jOV8hJijBOlooCgAYb4EK00MmQdWx3Z6VE164gRWPYZf UxPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=I+tvJPPN; 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 s19si2990743ioa.220.2017.09.22.01.26.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26: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=I+tvJPPN; 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 1dvJGO-0004f7-NC; Fri, 22 Sep 2017 08:24:44 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGM-0004bs-Qc for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:42 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 68/DD-03422-AC8C4C95; Fri, 22 Sep 2017 08:24:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTAat0TJ45 EGixdLmPxfctkJgdGj8MfrrAEMEaxZuYl5VcksGZ8OLeereC/fMWkZ8tZGxi7pLsYuTiEBGYw SjQu/M0G4rAIzGOW6L58iRHEkRDoZ5XY+6eNuYuRE8jJk7j8fycbhJ0mcePHDKA4B5BdLfFyY gpIWEhAS+LoqdmsEFN3MEn0LDvJCFLDJmAiMatDAqRGREBJ4t6qyUwgNcwC8xkl/v+8xQKSEB YIl/g++QSYzSKgKvHmzwl2kF5eAR+JPZtMIdbKSdw81wl2DidQeO3/DSwQe70ltt64yjKBUXA BI8MqRo3i1KKy1CJdIwu9pKLM9IyS3MTMHF1DAzO93NTi4sT01JzEpGK95PzcTYzAgGMAgh2M 59cGHmKU5GBSEuV9fORIpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3u/HgXKCRanpqRVpmTnA0 IdJS3DwKInw8gLDX4i3uCAxtzgzHSJ1itGe48KdS3+YOI5tugwkD+y5BSQ7bt79wyTEkpefly olzisK0iYA0pZRmgc3FBarlxhlpYR5GYHOFOIpSC3KzSxBlX/FKM7BqCTMKwgyhSczrwRu9yu gs5iAzipfDXZWSSJCSqqBMbHyVm1R8rKZDxcpdrd3a+y8nHalhic7Xbb2ge+zbo25X5bNbnye Ic4lfGFqcUqHSnq16rHnKq+nTTkZtdjFsXNWYd6VppZQnj8/Hj7snqLrqDdP+/sEo4X39p36u yzX5/au0988xYNWPymQObHm1bPvapqi7HODT6Wcm1J5fLKGv/p3oUun+5VYijMSDbWYi4oTAS G/MIrQAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-21.messagelabs.com!1506068679!83979000!1 X-Originating-IP: [209.85.192.171] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6240 invoked from network); 22 Sep 2017 08:24:40 -0000 Received: from mail-pf0-f171.google.com (HELO mail-pf0-f171.google.com) (209.85.192.171) by server-8.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:40 -0000 Received: by mail-pf0-f171.google.com with SMTP id g65so229185pfe.13 for ; Fri, 22 Sep 2017 01:24: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=+FatmofrAza4mRjPSInOolFST8U95IIGtc54zK1irIA=; b=I+tvJPPNiwT0XpXbZiQCda2bxiVogLFEW3DF7A0a5qawXn4NTyUmXy7xnT3IOqq5TB wsWnZa220ErfcCqogADao9aWNxX6/09v5TRQklwVWXSptYQIke+aYDf9sXIyAlkeuD9n whG2HQ3O6AdEbRt9YlfTQvmlHybBkT+AnPJAk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+FatmofrAza4mRjPSInOolFST8U95IIGtc54zK1irIA=; b=onRxO4FA/luEWBX5OkOE/NbC+lqCSouvnh2FB+lkLRYXq059JDJiUkAjh4msSWm8dx WJkMUrky8eX+ubW/yBih4GiAyMrRaCgrKu1gRZ8Pg2ocPmYWWygh0ZdU0TXb5ttDOjg4 RCtFGJfsJ05fmW+Q7vL9gmEhQFR9o5pOITxpwfBhrAZiPHzTqRe79i7/H8HH8adxET/G JdVhzbfe8uEL3wPPC4uLvbbxyXM3h+UHNBbXxy69n1ddZvIjuMhkKQH6BviE6XVJNP9J UsWNyDVtYYfWriM5ea7+v/UhKOTvz+662eHQ8p6NeHwZPUepwxee9rpwlCvzoEsCMOcP 7/9Q== X-Gm-Message-State: AHPjjUjHUZ8a8m9IMO3+rT/pFZw77CLjD3Ur+2X9DjVwDRqvXh3+6Q6J 57x2i0oUJkhfPNLsbm7OnvvIlmXo96U= X-Google-Smtp-Source: AOwi7QBUwZcr/z2rhSTojoCerDum2ul/4pLFj1Q7ESdnRPcy7LgMknDbRD4i0bQsq0L2SEn52+4OUg== X-Received: by 10.159.253.148 with SMTP id q20mr8234507pls.308.1506068678684; Fri, 22 Sep 2017 01:24:38 -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 f74sm5569284pfa.36.2017.09.22.01.24.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:38 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:21 +0530 Message-Id: <1506068606-17066-23-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 22/27 v10] xen/arm: vpl011: Add support for vuart console in xenconsole X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" This patch finally adds the support for vuart console. It adds two new fields in the console initialization: - optional - use_gnttab optional flag tells whether the console is optional. use_gnttab tells whether the ring buffer should be allocated using grant table. The VUART console is enabled ony for ARM. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Julien Grall CC: Stefano Stabellini Changes since v8: - Removed CONFIG_VUART_CONSOLE config option - Renamed CFLAGS_vuart-$(CONFIG_VUART_CONSOLE) to CONSOLE_CFLAGS-$(CONFIG_ARM) - I hav retained the acked-by tag as it is a minor change Changes since v6: - Renames prefer_gnttab to use_gnttab Changes since v4: - Renamed VUART_CFLAGS- to CFLAGS_vuart- in the Makefile as per the convention. tools/console/Makefile | 3 ++- tools/console/daemon/io.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/tools/console/Makefile b/tools/console/Makefile index c5f3f5c..84796ea 100644 --- a/tools/console/Makefile +++ b/tools/console/Makefile @@ -11,6 +11,7 @@ LDLIBS += $(SOCKET_LIBS) LDLIBS_xenconsoled += $(UTIL_LIBS) LDLIBS_xenconsoled += -lrt +CONSOLE_CFLAGS-$(CONFIG_ARM) = -DCONFIG_ARM BIN = xenconsoled xenconsole @@ -28,7 +29,7 @@ clean: distclean: clean daemon/main.o: daemon/_paths.h -daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) +daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) $(CONSOLE_CFLAGS-y) xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c)) $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_xenconsoled) $(APPEND_LDFLAGS) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index a198dbb..2615b50 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -107,12 +107,16 @@ struct console { xenevtchn_port_or_error_t remote_port; struct xencons_interface *interface; struct domain *d; + bool optional; + bool use_gnttab; }; struct console_type { char *xsname; char *ttyname; char *log_suffix; + bool optional; + bool use_gnttab; }; static struct console_type console_type[] = { @@ -120,7 +124,18 @@ static struct console_type console_type[] = { .xsname = "/console", .ttyname = "tty", .log_suffix = "", + .optional = false, + .use_gnttab = true, }, +#if defined(CONFIG_ARM) + { + .xsname = "/vuart/0", + .ttyname = "tty", + .log_suffix = "-vuart0", + .optional = true, + .use_gnttab = false, + }, +#endif }; #define NUM_CONSOLE_TYPE (sizeof(console_type)/sizeof(struct console_type)) @@ -654,8 +669,17 @@ static int console_create_ring(struct console *con) "ring-ref", "%u", &ring_ref, "port", "%i", &remote_port, NULL); - if (err) + + if (err) { + /* + * This is a normal condition for optional consoles: they might not be + * present on xenstore at all. In that case, just return without error. + */ + if (con->optional) + err = 0; + goto out; + } snprintf(path, sizeof(path), "%s/type", con->xspath); type = xs_read(xs, XBT_NULL, path, NULL); @@ -669,7 +693,7 @@ static int console_create_ring(struct console *con) if (ring_ref != con->ring_ref && con->ring_ref != -1) console_unmap_interface(con); - if (!con->interface && xgt_handle) { + if (!con->interface && xgt_handle && con->use_gnttab) { /* Prefer using grant table */ con->interface = xengnttab_map_grant_ref(xgt_handle, dom->domid, GNTTAB_RESERVED_CONSOLE, @@ -788,6 +812,8 @@ static int console_init(struct console *con, struct domain *dom, void **data) con->d = dom; con->ttyname = (*con_type)->ttyname; con->log_suffix = (*con_type)->log_suffix; + con->optional = (*con_type)->optional; + con->use_gnttab = (*con_type)->use_gnttab; xsname = (char *)(*con_type)->xsname; xspath = xs_get_domain_path(xs, dom->domid); s = realloc(xspath, strlen(xspath) + From patchwork Fri Sep 22 08:23:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113984 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011183qgf; Fri, 22 Sep 2017 01:26:08 -0700 (PDT) X-Received: by 10.36.185.9 with SMTP id w9mr5757234ite.75.1506068768129; Fri, 22 Sep 2017 01:26:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068768; cv=none; d=google.com; s=arc-20160816; b=V9WIqoHbOQmTEMCJeotbQp6ucMSR30ed2lIh7Xm4e2WnGsCa1VWxT7v1TofPnFk0WC Au9iX3mYp+LWj/m9G70eK2FctAXyUygZ25KkE6nv4wMgAyCpj2+8OjnsgiUMb+xJCs2b bsSXHr7dzFB6q0hhenqlGv1Jo8nAjykYRhC2JgA6RoXdxb07Do1xOEuOs682eti4HEPZ hE+hIwccYi3M6EhkNBrbwL8szPTOpA/sB7/TG96iChu1dWRap6U1sr0lLFBlHfmBpwvs P711PM9e6MF75RUkbLq5GrsOcaI4CHuN6Re732+d23wZg41G+2UqR01GCd2tdLvLVvcN 0jbw== 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=qQi84+2u8txDNnE3H0Ye2xH1pgaqPK8tS3FABaW8J6sEKSydGdcI9gl0WtdlKMofDx N2ru6FLJBvE9yVLCd/f3iY4GF2TBnIAqY4Go1b7FUYXNTqJPA7MvgnPUre0Ae/Ijik+f nubpxIDX1oUv3rwkoebyLIKc2san+KSRU0BsOk3A09LZ3ecm9IDyP3EhL2e9K9v5xZr+ ZshDRj0kCRXWac36uwc+xGpdI6dQvW4RgSF9YiOdy27a57pTbET1LvdXxnf/zQRGxh55 /oG/0H+9uCaOXittV8WR2XrLw5yK/4rlytn2z8QDmastE5i4P3PkQotYFacvZYbMvk66 NCyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SdzE+0SQ; 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 s5si3469472ita.64.2017.09.22.01.26.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:08 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SdzE+0SQ; 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 1dvJGS-0004le-VM; Fri, 22 Sep 2017 08:24:48 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGR-0004iy-LZ for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:47 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id 92/15-03610-FC8C4C95; Fri, 22 Sep 2017 08:24:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTAOt3TJ45 EGhw9LmTxfctkJgdGj8MfrrAEMEaxZuYl5VcksGY0zlrNXnBZtOLc0g3sDYyzBbsYuTiEBGYw SqxYdooZxGERmMcs8WbVTzBHQqCfVWLLwucsXYycQE6exIOJ76DsNIn/C9qZIewKiSXHtrOD2 EICWhJHT81mhRi7g0liUvcvxi5GDg42AROJWR0SIDUiAkoS91ZNZgKpYRaYzyjRNKmXDaRGWC BW4s1+sJksAqoS034+ZwWxeQV8JM7P7oTaJSdx8xyEzQkUX/t/AwvEXm+JrTeuskxgFFzAyLC KUaM4tagstUjX2EgvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMw5BiAYAfj6XWB hxglOZiURHkfHzkSKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCt/Y4UE6wKDU9tSItMwcY/DBpC Q4eJRHecJA0b3FBYm5xZjpE6hSjJceFO5f+MHEc2HMLSHbcvPuHSYglLz8vVUqcNwCkQQCkIa M0D24cLEIvMcpKCfMyAh0oxFOQWpSbWYIq/4pRnINRSZh3FsgUnsy8Eritr4AOYgI6qHw12EE liQgpqQZGi3udc1aJ8fgIlyxt/bV0kub09xuL40wVtVwT+Nbdnv1sQYPAtD77HasZ7ivIOjpl ugvut1ixX9h6t+FXG2M1/oTAonvfo5inxkSqCr2flpMZEJau13dn8/0J1fePWbyb1sSfcMfq2 PmwrvPXdzRNSnizxuQJ/6z81ctttvsumSk9SePr+/A3SizFGYmGWsxFxYkA3P1RYcsCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-27.messagelabs.com!1506068682!118084362!1 X-Originating-IP: [209.85.192.174] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40318 invoked from network); 22 Sep 2017 08:24:43 -0000 Received: from mail-pf0-f174.google.com (HELO mail-pf0-f174.google.com) (209.85.192.174) by server-9.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:43 -0000 Received: by mail-pf0-f174.google.com with SMTP id x78so232544pff.10 for ; Fri, 22 Sep 2017 01:24:43 -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=SdzE+0SQHQbFHtYN+IdY1aUf71UGzhxUigOK8iAwH91nsdHaR48gnBJlINO0zIYTTJ F2afvUej3tQbU1V6j26K8iqTrWTVyklZSIVF0rhXDw1NfSGx1D6I78ZbRyPd6vSF26AJ 5iEuha1ISw1n/USIUBp4ZxwW+5FUf7Xf49Rk4= 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=mgbIKhYvQWn4Klu8xzvILb937pLlGQO2T5K9i8SzJDQ8mxKFXzJvOHnR3ZlOfWqE92 XQ3U7ybAygm39f44Ke8epBUQHQX26Bv3/+gWv8xMei+2JPjAtPvrSL3UPC2xPd0yHq34 OWWNRrQaG9ZloYdH1ouMqQjeqEvzXiaPOrLxHVz0mZx1hANAqHkMfoB9v4ax8Zdzvuhp ojj1AeXICWXHMglRXCE4ncLPgW4R9Z8jPgMb+ZfeKvZD9x7ezQLx6j+TQ3T65O2tGwkb 3ryqQH6t56dBlQFisC7jD5DE91v75MxI2WktsW4abkjLEL0fJFVxV9S5RE+Fsai890I/ s5oA== X-Gm-Message-State: AHPjjUi0Tbkw7P+GbkMpFrhYIDGGu+88lmhYVkap6f2/4tyKBVwQrR0f GDYZ/l+HmLJXm4nAWXG/AmwKB9aIW38= X-Google-Smtp-Source: AOwi7QD83q+Ouua64c3jS8IbZI8ty6L2NeCYWqhboJfhmZzHD6pKVa2cmBg47TXtQAlO7FzC6L9pSw== X-Received: by 10.84.216.94 with SMTP id f30mr8295747plj.80.1506068681514; Fri, 22 Sep 2017 01:24:41 -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 f74sm5569284pfa.36.2017.09.22.01.24.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:41 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:22 +0530 Message-Id: <1506068606-17066-24-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 23/27 v10] 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 Fri Sep 22 08:23:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113989 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011300qgf; Fri, 22 Sep 2017 01:26:15 -0700 (PDT) X-Received: by 10.36.146.196 with SMTP id l187mr5985575itd.85.1506068775058; Fri, 22 Sep 2017 01:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068775; cv=none; d=google.com; s=arc-20160816; b=s80hBmr1bHhJdw6MZFm8EjnK9oEgqSmrosI/zNmVBIpEY8V1o7J2ZGkh06rOmC8mMF UWLbkt4IQb682+3xqbHkqbZU30jOTDUfCE9x+9hbnovcQ7+dbPiYiLPxuUymBXpNWG8z CYTJODoESmq3I4MXMsqciUZk+WY+J+0iggBboZzOIi7YUKiQmE2s41QXfgMmegGNQAGf EEDRxzbqg5tI/rc5Gk5N9tvf1tkNZSInqx+xYMS4DlX6blmTj1jUEo8i+hWYpGBRQcQb IqL3HSj3AtbMU9K00Vuuzo3vakvrsu4aLxV4bHNbRa7t6Dt8v90fLkp5j4JCdnngxOPe rjIQ== 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=fmPkgxJqR5WzzlfsnvrvyM4J++kQYkIshGESmxRzEAkTMgDpkE2gza95UN4hqB0qsD sXoY6P6REgUi13ul5JNC42zM6U47VmuHIYfuaxa4qUyw1K94KS2qna6rI+vbwdMUjhYd 1klnWxc679UUBvr0BLK82sT/46Se1NNe0BkgohLlSqXqZFdOVExg+gE/gzfTIEyIb0ZP 5sO5kurwbIhbvtEC5AxcJicSp0buj9hCgMPFHaL+XpfM9RnBA27wBZbHGCtiQ4VG54/L qeruH2nz26Bon8S4lIYAG1rQpY9q3qAIyGKN826gAHp/fRZHS1FlnvecCkJGpGKv8snZ y7/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Z6tTejsE; 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 m184si2999491ioa.80.2017.09.22.01.26.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:15 -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=Z6tTejsE; 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 1dvJGT-0004mF-68; Fri, 22 Sep 2017 08:24:49 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGS-0004jY-4d for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:48 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id 26/95-25121-FC8C4C95; Fri, 22 Sep 2017 08:24:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRWlGSWpSXmKPExsVyMfTAet1zJ45 EGuybqW7xfctkJgdGj8MfrrAEMEaxZuYl5VcksGZsfLiSvWCGWsWe/0tZGhj7ZLsYOTmEBKYz SuxcIdLFyMXBIjCPWeLx5BfMIAkJgX5WiZ4Tjl2MHEB2nsSpDawQ4TSJNScWsEPYpRKNTY+YI OZoSRw9NZsVZI6QwA4mic7185hBetkETCRmdUiA1IgIKEncWzWZCaSGWWA+o0TTpF42kISwQK zE8YMtjCA2i4CqxIWGrWA38Ar4SFzdvRRqmZzEzXOdYHFOoPja/xtYIBZ7S2y9cZVlAqPgAka GVYzqxalFZalFuiZ6SUWZ6RkluYmZObqGBsZ6uanFxYnpqTmJScV6yfm5mxiBwcYABDsYG784 HWKU5GBSEuV9fORIpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3p3HgXKCRanpqRVpmTnAsIdJS 3DwKInw8gJDX4i3uCAxtzgzHSJ1itGS48KdS3+YOA7suQUkO27e/cMkxJKXn5cqJc4rCtIgAN KQUZoHNw4Wm5cYZaWEeRmBDhTiKUgtys0sQZV/xSjOwagkzHsd5CqezLwSuK2vgA5iAjqofDX YQSWJCCmpBsbaHR3sar0izhV7LR+V7eaOTJBdIj3lofPDlqorTpdV12uvubrqB2O5bG7VtOKj l+wVZ6qosfGpntSbpMDdprFWecJcF62SmVW5/vrnHpssLPxz3C4ojJMr/0Px54e+bD8f9aW+t +CWn+Rx+P8Gu18BcculGZN+XVLgsRTkmH5aMpZ39sGNaUosxRmJhlrMRcWJAOKIYnbIAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-4.tower-31.messagelabs.com!1506068685!57935893!1 X-Originating-IP: [209.85.192.175] 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 17218 invoked from network); 22 Sep 2017 08:24:46 -0000 Received: from mail-pf0-f175.google.com (HELO mail-pf0-f175.google.com) (209.85.192.175) by server-4.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:46 -0000 Received: by mail-pf0-f175.google.com with SMTP id y29so244561pff.0 for ; Fri, 22 Sep 2017 01:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8o2al3bzod4mOOONVe20amJaaulnmm2NgPZDeRZkrVE=; b=Z6tTejsEq/6f3eVFfCvuKpb0VanNa9UzwxOnUvpmBDh0MUbpVzSNCywig7iAE13EUf Y/NM7lI7F97KgV9N5xW2pIUDWlp8KaD2Qcyyaple29IMX/KnZNTiRPmI9JcxKNe+17nJ tdPqwyo7DXLhZOUhGLvQZq+7T6T8zl+8CrLmI= 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=dVtLx/YaDvDXa2BHcXhIZklHFwzj62uyauQ33TLIPanVdaGnps55nsPUReuhLxfp/w I5LAgHRQt0iv9vUo6gt0fFO+FVFq6zVysJvjbxGRilj6CZwwO9knLtGXpK4v36z3pEEN vKD2ozhlnSU4LAspY+Hg8m5tTqQ5y3U+O7/wkxdxljszqXoqHijachFhdxPYf58z+J0t 3UUhuOnHprjxci26gaNxBz2lwxDk+2cRKSZsCO3FvR7yiKOYUOHtceazOk7pETAalTIp xpxaQ2hU9JT7CKEodmoa8uYurCkJ3K+twj4CR1ZxOl2c613seQtKJ0yAFLyL2DXvdAax FOSw== X-Gm-Message-State: AHPjjUjt8zrTU5XuUVVdTKimwrDRzN/pD3X/VQBcvieHZb/zoZ8bder5 ozNbL6E2tGouaNZ5QqYhGuByulmpNvU= X-Google-Smtp-Source: AOwi7QD0l1bh90s6vuSs3nCtWV2Mm/TjsxWnQnibiVaW2pESZv5NYXID2Zskkv1qSzxi568VLLK6Sw== X-Received: by 10.98.89.6 with SMTP id n6mr8325338pfb.27.1506068684761; Fri, 22 Sep 2017 01:24:44 -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 f74sm5569284pfa.36.2017.09.22.01.24.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:44 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:23 +0530 Message-Id: <1506068606-17066-25-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 24/27 v10] 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 Fri Sep 22 08:23:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113994 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011427qgf; Fri, 22 Sep 2017 01:26:25 -0700 (PDT) X-Received: by 10.36.177.9 with SMTP id o9mr5653433itf.44.1506068785324; Fri, 22 Sep 2017 01:26:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068785; cv=none; d=google.com; s=arc-20160816; b=xVyYh4osljyx7bpnR8d8ldurrXlpIlp5iKTnCteh/3R+T4/l4OVarXaVw1fthHfeAp ZTGQ2JaEDR3D4rSssluUUJqLGy/AexNIMIpxbyJcIsiEPpTmOc78HwOYK9e7NIhOQitE clRwlWXDIVr3U7TfNq6sPLjNJbrk7ii52ii6CSFxYbzzFy5+CTNCChkFnXE9IiXSRNuk Cah3OGrPsjK5v9ACYHU5RaEFtJz1B0NotmHb1Q+E4cHF6v7fsT86Bfy2oWRAVTbqDq4n 9YQQosYZ2Sk0YR609occBmSYLjc8ptdHOc1vACRs6QFodLA5ZR/DxLTSTo9cSinH3oB3 pDRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=LDkp4vb2s3MmBG1ZCxeOsr+xia053wtYTgkt6nh0LO4=; b=PSWcxQGqQ0lyZPv/BxizKUHPe+dPRWdcR/hydSM9IQvJMxO5fRf7pefsFesc83qHjv Mf2yoLZu7zdq8Nwwgn8HGAg/AJIWsSJrM3x5C3B+8Vhejsjg73JuSOkIdv2L7QVfWAp/ GTQBpEwxWenjJKjV+JGHAFiIpV+TMjmr1UUgMhIREX5Kw8soksmUaqNHNCxCNJWLHl5V Ze5XLPv1EztnKKSzism/LFCJcXwnmwnFE/qCYExGerFgfbrl12pcQ6y7RAavg+Qydecm sOvi6HOFWBizxQ/sC1UnXdfr9OwK6I8BoNtjPuSwc2k+zzDdn7GYuto/XM5rclx8u5g3 6Qhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=foYITdKr; 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 d184si2061364itg.161.2017.09.22.01.26.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:25 -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=foYITdKr; 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 1dvJGX-0004uW-E5; Fri, 22 Sep 2017 08:24:53 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGW-0004rR-8v for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:52 +0000 Received: from [85.158.139.211] by server-17.bemta-5.messagelabs.com id E3/09-25201-3D8C4C95; Fri, 22 Sep 2017 08:24:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRWlGSWpSXmKPExsVyMfTAOt1LJ45 EGmzbZGDxfctkJgdGj8MfrrAEMEaxZuYl5VcksGbMuXyWuaBDs2L2HJUGxg1KXYxcHEICMxkl Vlw5xgbisAjMY5Z4c2IVO4gjIdDPKnH44GyWLkYOICdP4tBKrS5GTiAzTeJ6z1ZWCLtS4vqrs 2wgtpCAlsTRU7NZIewdTBIN64NBWtkETCRmdUiAhEUElCTurZrMBGIzCzxnkph2SQfEFhaIkv iyowuslUVAVeLc7ptgNbwCPhJzn5xgglglJ3HzXCcziM0JFF/7fwMLxCpvia03rrJMYBRcwMi wilGjOLWoLLVI18hIL6koMz2jJDcxM0fX0MBULze1uDgxPTUnMalYLzk/dxMjMNjqGRgYdzDu afc7xCjJwaQkyvv4yJFIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8348D5QSLUtNTK9Iyc4BhD 5OW4OBREuHlBYa+EG9xQWJucWY6ROoUoyXHhTuX/jBxHNhzC0h23Lz7h0mIJS8/L1VKnHc+yD wBkIaM0jy4cbDYvMQoKyXMy8jAwCDEU5BalJtZgir/ilGcg1FJmPc6yBSezLwSuK2vgA5iAjq ofDXYQSWJCCmpBsaOFVYlOre9VR5ozI5mdXl7PG5W/n7Wc5Z/BFQM5vBu+2NTunn1gZY3SaL2 jvoJtkE+wZ+3TJnT7mZw70Nf9r4b4v+CpboVZi80UC66wMSdqbawZbIe/077PbdKjwtzKwmdE J13cum5yx6LTKOXxPppvP2p9e9LmV5PW6NS77SCjGmxqvEyS5VYijMSDbWYi4oTAR40evXIAg AA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-6.tower-206.messagelabs.com!1506068689!109914456!1 X-Originating-IP: [209.85.192.174] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42201 invoked from network); 22 Sep 2017 08:24:50 -0000 Received: from mail-pf0-f174.google.com (HELO mail-pf0-f174.google.com) (209.85.192.174) by server-6.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:50 -0000 Received: by mail-pf0-f174.google.com with SMTP id d187so231998pfg.11 for ; Fri, 22 Sep 2017 01:24: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=0dDjqhXxWsv/zS1ps0b/tJGOGIRU9n88m8CQHyVX6Ts=; b=foYITdKrvUBzoW7DMuYXaEpjdxTDQ5X4nRAfLMMCCkpk0rHrrbG6UanJnpV3xdvZsk N3LImGmVpUylsvVDgk3unqoq0GQLqr37xHgxC1AK2OncGQv8VBoHUEjIGE9SA4JeQkT5 Y/lEv0uY2cjIRmUk3ARSCgbo4aDOiI5q34Hv0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0dDjqhXxWsv/zS1ps0b/tJGOGIRU9n88m8CQHyVX6Ts=; b=lO3Vygbw+mJT3PiIsoK4PeekPmjV3wVYzxAHylXs8c9okz1vvckXnZswXv072Cs5Ma m8ljM/qI7KRkbaTd9ajQN3VgIKEAeYQHEeEiYORZdusk4UOOR9CjrPxTFJ/hfsFoJOaf 4iVdKYRsvOZNzrYx8P25Yv/34U0XjiJD0D3/RkxzwusMgQLMbTNul8uQY2+vPLrjVIA5 JdHsJnDprECZ3pBWfrZCKRDO1ToIE43Y970NQeu9sUFKCM7NfUUQp+UD98dAJbTfl7bT gcy3CGhhstnloo2xUOHyO7AM9rNQ0G08t1cbeqMGdle83JS6ZR7e9wj8/CEBfMwDfPc3 N7QA== X-Gm-Message-State: AHPjjUjnJu2ZkgSZODKkO8d/DL2ZogzL3WW9CtpIWGk01TOIWWkVrRd8 hJuj2IXFU7NgcsO9bsI1w8oqZRfVhuA= X-Google-Smtp-Source: AOwi7QAviLZN6kQxlSt4vfCDlty+hss08sVFARgSjNlaqWvMvXxue95bNIkEt7ORJ4S6gvMpFkVMSw== X-Received: by 10.98.158.78 with SMTP id s75mr8510573pfd.156.1506068688995; Fri, 22 Sep 2017 01:24:48 -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 f74sm5569284pfa.36.2017.09.22.01.24.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:48 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:24 +0530 Message-Id: <1506068606-17066-26-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-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 v10] xen/arm: vpl011: Update documentation for vuart console support X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" 1. Update documentation for a new vuart option added. 2. Update documentation about SPI irq reserved for vuart. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Andrew Cooper CC: George Dunlap CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Julien Grall Changes since v6: - Added a new section for vuart usage. - I have retained the reviewed-by/acked-by tags as this is a limited change. Kindly review. Changes since v4: - Minor change to rename "pl011" to "sbsa_uart". Since it is a minor change I have retained the reviewed-by and acked-by tags. docs/man/xl.cfg.pod.5.in | 12 ++++++++++++ docs/misc/console.txt | 44 +++++++++++++++++++++++++++++++++----------- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in index 247ae99..f1d2a7a 100644 --- a/docs/man/xl.cfg.pod.5.in +++ b/docs/man/xl.cfg.pod.5.in @@ -1105,6 +1105,9 @@ Allow a guest to access specific physical IRQs. It is recommended to only use this option for trusted VMs under administrator's control. +If vuart console is enabled then irq 32 is reserved for it. See +L to know how to enable vuart console. + =item B Limit the guest to using at most N event channels (PV interrupts). @@ -2220,6 +2223,15 @@ the domain was created. This requires hardware compatibility with the requested version, either natively or via hardware backwards compatibility support. +=item B + +To enable vuart console, user must specify the following option in the +VM config file: + +vuart = "sbsa_uart" + +Currently, only the "sbsa_uart" model is supported for ARM. + =back =head3 x86 diff --git a/docs/misc/console.txt b/docs/misc/console.txt index 16da805..4e180f8 100644 --- a/docs/misc/console.txt +++ b/docs/misc/console.txt @@ -19,7 +19,20 @@ The first PV console path in xenstore remains: /local/domain/$DOMID/console -the other PV consoles follow the conventional xenstore device path and +The virtual UART console path in xenstore is defined as: + +/local/domain/$DOMID/vuart/0 + +The vuart console provides access to a virtual SBSA UART on ARM systems. +To enable vuart the following line has to be added to the guest configuration +file: + +vuart = "sbsa_uart" + +In Linux you can select the virtual SBSA UART by using the "ttyAMA0" +console instead of "hvc0". + +The other PV consoles follow the conventional xenstore device path and live in: /local/domain/$DOMID/device/console/$DEVID. @@ -61,6 +74,14 @@ output = pty The backend will write the pty device name to the "tty" node in the console frontend. +For the PV console the tty node is added at + +/local/domain/$DOMID/console/tty + +For the virtual UART console the tty node is added at + +/local/domain/$DOMID/vuart/0/tty + If the toolstack wants a listening Unix domain socket to be created at path , a connection accepted and data proxied to the console, it will write: @@ -79,8 +100,8 @@ For example: ioemu The supported values are only xenconsoled or ioemu; xenconsoled has -several limitations: it can only be used for the first PV console and it -can only connect to a pty. +several limitations: it can only be used for the first PV or virtual UART +console and it can only connect to a pty. Emulated serials are provided by qemu-dm only to hvm guests; the number of emulated serials depends on how many "-serial" command line options @@ -90,14 +111,15 @@ xenstore in the following path: /local/domain/$DOMID/serial/$SERIAL_NUM/tty -xenconsole is the tool to connect to a PV console or an emulated serial -that has a pty as output. Xenconsole takes a domid as parameter plus an -optional console type (pv for PV consoles or serial for emulated -serials) and console number. Depending on the type and console -number, xenconsole will look for the tty node in different xenstore -paths, as described above. If the user doesn't specify the console type -xenconsole will try to guess: if the guest is a pv guest it defaults to -PV console, if the guest is an hvm guest it defaults to emulated serial. +xenconsole is the tool to connect to a PV or virtual UART console or an +emulated serial that has a pty as output. Xenconsole takes a domid as +parameter plus an optional console type (pv for PV consoles, vuart for +virtual UART or serial for emulated serials) and console number. +Depending on the type and console number, xenconsole will look for the tty +node in different xenstore paths, as described above. If the user doesn't +specify the console type xenconsole will try to guess: if the guest is a pv +guest it defaults to PV console, if the guest is an hvm guest it defaults to +emulated serial. By default xl creates a pv console for hvm guests, plus an emulated serial if the user specified 'serial = "pty"' in the VM config file. From patchwork Fri Sep 22 08:23:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113991 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011344qgf; Fri, 22 Sep 2017 01:26:18 -0700 (PDT) X-Received: by 10.36.69.91 with SMTP id y88mr4707378ita.99.1506068778142; Fri, 22 Sep 2017 01:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068778; cv=none; d=google.com; s=arc-20160816; b=kf94Tpu5V5TaI6+PH/HsaYQUYZZDR+4INAySN6PTq7Q9V9ZUYFzmtuP1eOUTLmoLsE Rgf5RmRZRvOERYFGImYtIBnIGbT8iwwGMS3D0XFzsRvo23mOVAD1mgmLFU407JWw8to0 NbJ3BHcPTnNUYI/8x3YO72yC4PF4K9kU6bT1WvbyO1lsaBCes1nfQIoh+aGDuJyRtkvS VdINgR5c0vAou2OLtZqshUDQtR21UlWle9hkU3oGQrbFb0JdIYRH6liOQIfyGNKghLJO wF/s/5yB1XH4yBg5gunE6uEbrE65wSC+0llhVlSntQ/03KK8DQAIE0fdTTjtkqwifcTS KlSA== 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=H417Iebfz8/38/ixum9LFU0SBL4Mrhy6E3hWB30ugtX0JJqUwBPvwI4qvdtYFz//cD 9Rh4kzpDuJPfSuNqLx1A7hhm4sOuUieH/hUbEA7kL8/eFBWbYL2KC1kNeS1XuBoq4TAS 5m0eM9jQQenHaWQipXZOVj7gxDrP4/Nm/3yx30w71ssIU366Pt9MnpdZlr7vC80lZR+U keKL3rMuDC6o14v1uHV2O4mm8eCgFhRJlE36887NPVWUCyq7UC9P024PVJURRliFqyoL xBRROJ/FOAdqFTAnxR5SzWWAEOyOWU5CDCRwScT0pMt1DBQrxw/0eO0ien7/eHS59UaK ED0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=US8noF1h; 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 z129si3316272itd.107.2017.09.22.01.26.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:18 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=US8noF1h; 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 1dvJGb-00052I-P2; Fri, 22 Sep 2017 08:24: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 1dvJGZ-0004yQ-Qm for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:55 +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 41/A6-20972-6D8C4C95; Fri, 22 Sep 2017 08:24:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsXiVRtsrHv1xJF Ig0UPhS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1owDt/4wFpwTrHj//SFTA+N83i5GLg4hgamM Ele/trGCOCwC85glWh9dZAFxJAT6WSXONj0DynACOXkSB38/ZoKw0ySu3tnEBmFXS7Ts+MkCY gsJaEkcPTWbFWLsDiaJnh9TmLsYOTjYBEwkZnVIgNSICChJ3Fs1GWwOs0C9xLZzvxhBbGGBcI kpf7+C2SwCqhJ3/l4As3kFfCS+be1kgdglJ3HzXCcziM0JFF/7fwPUXm+JrTeuskxgFFzAyLC KUaM4tagstUjX0EwvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMw5BiAYAfj/Y0B hxglOZiURHkfHzkSKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCt/Y4UE6wKDU9tSItMwcY/DBpC Q4eJRHecJA0b3FBYm5xZjpE6hSjJce+Pbf+MHGsuH4bSHbcvPuHSYglLz8vVUqcdz5IgwBIQ0 ZpHtw4WIReYpSVEuZlBDpQiKcgtSg3swRV/hWjOAejkjDvLJApPJl5JXBbXwEdxAR0UPlqsIN KEhFSUg2M5wzqTW16P33NP86yZNLtuEOFdYU6+8w2zK2KY132+/qXmUtWPM6Y8/+q66XMmrJU Q9+/i43PxGap9rw7xrvT7Mq7jZYvWsKu5tV0CHVxlL+ZUGdyOvSUZehXcf4pbvL/LsWctIrwU 7zdOCGiJjPyk0LIlEu5j/i/Hr7xTmOu5DTVvSrfFKVzlViKMxINtZiLihMBssDot8sCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-3.tower-21.messagelabs.com!1506068692!80612577!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 38215 invoked from network); 22 Sep 2017 08:24:53 -0000 Received: from mail-pg0-f51.google.com (HELO mail-pg0-f51.google.com) (74.125.83.51) by server-3.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:53 -0000 Received: by mail-pg0-f51.google.com with SMTP id d8so249577pgt.4 for ; Fri, 22 Sep 2017 01:24: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=2cGA9GWQ2dcLrzuB4im3ko3qiqx5AgeGA+TPbfZsVTY=; b=US8noF1h/JL6o7alss+Tse1vxlcgqY1xYux6hHNESjTWkguGoGc7Psarnm9geEZVyI VsFfXn0FQwg4hhu5KQQnDv+dlI8EUMKAQIPTxIm8nkj2IC/9typIy8yoQfx6zzMZChnM 3p7GCcZqiLirdmGoFL4fMLXLPxemE72XFl8Zw= 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=TGVprVe81o3APczF13qaudjIC55zDqMN+xr8gbTHW3nDnhQziwisBb5lJ00vOHybU4 snZiEXXnnoyO/CzUfBh78KgOCIHUUJrwaWGhRE3aNg8Uvdb4ap0g1ROfBZjMhFtTATym ZLtapW+6A9JxJRqXMYcteXvrI8GLUbZqf+9xL8B91aZJ0TAL2D+NMW0jYO3wiyBsdbYR rdrmkNhB/mGnKzuAan2g8zCRLm5GxwicP7b0S63PXm+a+XsopmSnrW7AfOE7hOtmmAkm 9gQ3U/5Go1mbou1xf1q7FPnIbjX3fh85RklPJJsLgogUuXi0tbOdw+/2LxSKqmQ+lOky nhhw== X-Gm-Message-State: AHPjjUh+kjBKUzC+ITOsaFg8xFveHnCw5BTyXo4d6vZGcp+P6LjZif+Q vN2hRsGjXOyh5GMCkErO7JsIHi6jLas= X-Google-Smtp-Source: AOwi7QCwnaHLafuyZD+Jcwbc+twyUwBjdQGTrzVrqHjIgI2i21mf6ivDbIyR3uoVPHEZ2pOLM8n23w== X-Received: by 10.159.194.140 with SMTP id y12mr8295899pln.262.1506068691607; Fri, 22 Sep 2017 01:24:51 -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 f74sm5569284pfa.36.2017.09.22.01.24.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:51 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:25 +0530 Message-Id: <1506068606-17066-27-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 26/27 v10] 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 Fri Sep 22 08:23:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113993 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011375qgf; Fri, 22 Sep 2017 01:26:19 -0700 (PDT) X-Received: by 10.107.131.77 with SMTP id f74mr6353098iod.215.1506068779863; Fri, 22 Sep 2017 01:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068779; cv=none; d=google.com; s=arc-20160816; b=1JmVI5lPhRM9P/mUhrDt39rhtTuhQzZi57cdr9/RDS4sUdUnXzAUmoX+TRaS+BvytR Q+d9aA+Faux/ML716A+34e5YJpA95JNkDMrQGv79jAMqWPGIV2iCPPseXZIm4FZP1uCQ Sg+oT6ORyJmcUNSonCAGKka0cUgqZ8IHiiA3xBEtxz+A2C3xOh33Uw0AWbCUpMt8zKKE N+sg6E8EqnfPzKyN0zoQ6hvkQ7pK/AGTGIp2DZ/fUjX//HRzi22UboShm2O1Zy6xyMn8 rfP2xQsIA2S9vv56mYOQRMcpA6WWxbc1mQ0Va3oRhNNsZU78hNFcQt9WhCljgqQYZJu4 R2Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=x80X3cVOF2GtV72izfuKrNXUD0dopJtWWYJ3ZCBIDco=; b=URc9yyEEXPZI1kjq6PDQ0T1fsy//peGStlvdj5MRqxxWL3n8vLkgHBEQbVKo0Yc8MR NdKEFznqb/Or/dtUywwR2vVSZacqv+eXaWZF8gq+DZYKNSertf/0z26gdMMc3bLZrJXq 1AgbZeXVxn2YVCRAzRZRTtkwkmMoIS1JL9F9eYXi5FVaa3XBD2K27h2KJAwTv1L3tIJf ThlZ0INNTfddDx5+VlHH0mN3xrtdhu+0KHbjkr6q66TRkskuZqih3H2Pyq/QnPp+NmgC y7lOGdvdHp3YNCV2BuOIPcFBAeQ3r1eC1Z+GsKRUxbMBDwwPyrq8S+vUuejNuaTL7ov0 gNiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UknzJ/Zr; 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 s71si3503133itb.75.2017.09.22.01.26.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:19 -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=UknzJ/Zr; 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 1dvJGe-000589-WD; Fri, 22 Sep 2017 08:25:00 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGe-000577-Nn for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:25:00 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id EB/6C-03454-BD8C4C95; Fri, 22 Sep 2017 08:24:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRWlGSWpSXmKPExsXiVRusrXvjxJF Igze7hCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owd/4ULLllXLLu5gKWB8bV2FyMnh5DAVEaJ Zxvyuxi5OFgE5jFLbD56gAXEkRDoZ5VY+fgVM0iVhECeRMuRXnYIO02i/ex5oDgHkF0hseCnE 8QgLYmjp2azgvQKCexgklgzsZ0JpIZNwERiVocESI2IgJLEvVWTmUBsZoF6iW3nfjGC2MIC+R KHPjwCs1kEVCVe/l3EAmLzCvhINE6fyASxVk7i5rlOsHM4geJr/29ggdjrLbH1xlWWCYyCCxg ZVjGqF6cWlaUW6VroJRVlpmeU5CZm5ugaGpjp5aYWFyemp+YkJhXrJefnbmIEhhoDEOxgnH3Z /xCjJAeTkijv4yNHIoX4kvJTKjMSizPii0pzUosPMcpwcChJ8O48DpQTLEpNT61Iy8wBBj1MW oKDR0mENxwkzVtckJhbnJkOkTrFaMmxb8+tP0wcK67fBpIdN+/+YRJiycvPS5US550P0iAA0p BRmgc3DhaZlxhlpYR5GYEOFOIpSC3KzSxBlX/FKM7BqCTMOwtkCk9mXgnc1ldABzEBHVS+Guy gkkSElFQDY2f8it1bXCpvmv5QmCLqxXEi62OD6+91GW81RZaf44/3n2Scmqy1MHfdheWFK6r7 pxS7xN4sa5vR9euZ7p4zDYYFm2cZdrSem7nq9ar3OUm1TorXnZ4IrLj4RHIm//md1hIM5sdMF IxmMxp9Sbo7ozKeO8LTQaG2OLXvcOTe5OnWVa4H1jCtVGIpzkg01GIuKk4EAJh8POfHAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-14.tower-21.messagelabs.com!1506068695!77432598!1 X-Originating-IP: [74.125.83.43] 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 30530 invoked from network); 22 Sep 2017 08:24:56 -0000 Received: from mail-pg0-f43.google.com (HELO mail-pg0-f43.google.com) (74.125.83.43) by server-14.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:56 -0000 Received: by mail-pg0-f43.google.com with SMTP id 7so239736pgd.13 for ; Fri, 22 Sep 2017 01:24:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ShLFdjyBwOXeMOQr3lQ1MFu6ReaYVbjCfilIir6inKk=; b=UknzJ/Zr3Lv5W7sfQAEulo9lESiXRn1JFf7zCDsJL9/lrD89JRbQAK5iylKqd0kivQ Hf1FCfbIdh25rbZ207H+MxqtUpzqXFGf8F9JknfXXNjTcK36FSyCgmn2W349oogTFN6n nt4mktNP2bNlLbuf4JMj43u7fNzqFfI54RZrg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ShLFdjyBwOXeMOQr3lQ1MFu6ReaYVbjCfilIir6inKk=; b=BN1+UuRo42InaY8iD1H9adV1HF4RoNRC4tGwAYsIxE1+6irtDfF3NkaZSqQ7Jy1Uxd mwSzSS787434UdAeh08jBpoXt3bvTPR8vfKwnaAUETROpLA9EJGhohM3+1Jputt5YVry YdWaOv6iUjhsbqmr+gQCsbf9FCQlS7qtzgupGO6HEqA+MppxBZCcYhWVdYwBkEQKUsYK FDdULpCGqXf9wLEQ1xKD6pSJvYm8LFv07ax7Pp9lQqt550dwPYijtlWxHWkr2xZtCuEe NiahZHKV/Yor3yYZlr9KBJROkSjjoA3mKnQSBZURWItQ+q7ocp00FgbOJqbIfYUzPpB3 ykeA== X-Gm-Message-State: AHPjjUgTq5lau3j/AQ9hL7f1EF+G3pLMHxC1NSOAPQbqgbhnrrSy6M17 uiVUNr/hGmitTbZfm5JRhTJIfY4Yt7Q= X-Google-Smtp-Source: AOwi7QCFENWuKUvOFjczE3xBH6rHXBv+f9H6yMscTglsUUxJI63JVCzAsn18jcLM5UGPuWnl2cvubA== X-Received: by 10.84.129.226 with SMTP id b89mr8044192plb.6.1506068694402; Fri, 22 Sep 2017 01:24:54 -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 f74sm5569284pfa.36.2017.09.22.01.24.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:54 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:26 +0530 Message-Id: <1506068606-17066-28-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 27/27 v10] xen/arm: vpl011: Correct the logic for asserting/de-asserting SBSA UART TX interrupt X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" This patch fixes the issue observed when pl011 patches were tested on the junos hardware by Andre/Julien. It was observed that when large output is generated such as on running 'find /', output was getting truncated intermittently due to OUT ring buffer getting full. This issue was due to the fact that the SBSA UART driver expects that when a TX interrupt is asserted then the FIFO queue should be atleast half empty and that it can write N bytes in the FIFO, where N is half the FIFO queue size, without the bytes getting dropped due to FIFO getting full. The SBSA UART emulation logic was asserting the TX interrupt as soon as any space became available in the FIFO and the SBSA UART driver tried to write more data (upto 16 bytes) in the FIFO expecting that there is enough space available leading to dropped bytes. The SBSA spec [1] does not specify when the TX interrupt should be asserted or de-asserted. Due to lack of clarity on the expected behavior, it is assumed for now that TX interrupt should be asserted only when the FIFO goes half empty. TBD: Once the SBSA spec is updated with the expected behavior, the implementation will be modified to align with the spec requirement. [1] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0183f/DDI0183.pdf Signed-off-by: Bhupinder Thakur --- CC: Julien Grall CC: Andre Przywara CC: Stefano Stabellini Changes since v8: - Used variables fifo_level/fifo_threshold for more clarity - Added a new macro SBSA_UART_FIFO_SIZE instead of using a magic number - Renamed ring_qsize variables to fifo_level for consistency xen/arch/arm/vpl011.c | 87 ++++++++++++++++++++++++++++++-------------- xen/include/asm-arm/vpl011.h | 2 + 2 files changed, 61 insertions(+), 28 deletions(-) diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c index 36794d8..1f97261 100644 --- a/xen/arch/arm/vpl011.c +++ b/xen/arch/arm/vpl011.c @@ -91,20 +91,24 @@ static uint8_t vpl011_read_data(struct domain *d) */ if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) > 0 ) { + unsigned int fifo_level; + data = intf->in[xencons_mask(in_cons, sizeof(intf->in))]; in_cons += 1; smp_mb(); intf->in_cons = in_cons; + + fifo_level = xencons_queued(in_prod, in_cons, sizeof(intf->in)); + + if ( fifo_level == 0 ) + { + vpl011->uartfr |= RXFE; + vpl011->uartris &= ~RXI; + } } else gprintk(XENLOG_ERR, "vpl011: Unexpected IN ring buffer empty\n"); - if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) == 0 ) - { - vpl011->uartfr |= RXFE; - vpl011->uartris &= ~RXI; - } - vpl011->uartfr &= ~RXFF; vpl011_update_interrupt_status(d); @@ -144,28 +148,41 @@ static void vpl011_write_data(struct domain *d, uint8_t data) if ( xencons_queued(out_prod, out_cons, sizeof(intf->out)) != sizeof (intf->out) ) { + unsigned int fifo_level, fifo_threshold; + intf->out[xencons_mask(out_prod, sizeof(intf->out))] = data; out_prod += 1; smp_wmb(); intf->out_prod = out_prod; - } - else - gprintk(XENLOG_ERR, "vpl011: Unexpected OUT ring buffer full\n"); - if ( xencons_queued(out_prod, out_cons, sizeof(intf->out)) == - sizeof (intf->out) ) - { - vpl011->uartfr |= TXFF; - vpl011->uartris &= ~TXI; + fifo_level = xencons_queued(out_prod, out_cons, sizeof(intf->out)); + + if ( fifo_level == sizeof (intf->out) ) + { + vpl011->uartfr |= TXFF; + + /* + * This bit is set only when FIFO becomes full. This ensures that + * the SBSA UART driver can write the early console data as fast as + * possible, without waiting for the BUSY bit to get cleared before + * writing each byte. + */ + vpl011->uartfr |= BUSY; + } /* - * This bit is set only when FIFO becomes full. This ensures that - * the SBSA UART driver can write the early console data as fast as - * possible, without waiting for the BUSY bit to get cleared before - * writing each byte. + * Clear the TXI bit if the fifo level exceeds fifo_size/2 mark which + * is the trigger level for asserting/de-assterting the TX interrupt. */ - vpl011->uartfr |= BUSY; + fifo_threshold = sizeof (intf->out) - SBSA_UART_FIFO_SIZE/2; + + if ( fifo_level <= fifo_threshold ) + vpl011->uartris |= TXI; + else + vpl011->uartris &= ~TXI; } + else + gprintk(XENLOG_ERR, "vpl011: Unexpected OUT ring buffer full\n"); vpl011->uartfr &= ~TXFE; @@ -342,7 +359,7 @@ static void vpl011_data_avail(struct domain *d) struct vpl011 *vpl011 = &d->arch.vpl011; struct xencons_interface *intf = vpl011->ring_buf; XENCONS_RING_IDX in_cons, in_prod, out_cons, out_prod; - XENCONS_RING_IDX in_ring_qsize, out_ring_qsize; + XENCONS_RING_IDX in_fifo_level, out_fifo_level; VPL011_LOCK(d, flags); @@ -353,37 +370,51 @@ static void vpl011_data_avail(struct domain *d) smp_rmb(); - in_ring_qsize = xencons_queued(in_prod, + in_fifo_level = xencons_queued(in_prod, in_cons, sizeof(intf->in)); - out_ring_qsize = xencons_queued(out_prod, + out_fifo_level = xencons_queued(out_prod, out_cons, sizeof(intf->out)); /* Update the uart rx state if the buffer is not empty. */ - if ( in_ring_qsize != 0 ) + if ( in_fifo_level != 0 ) { vpl011->uartfr &= ~RXFE; - if ( in_ring_qsize == sizeof(intf->in) ) + + if ( in_fifo_level == sizeof(intf->in) ) vpl011->uartfr |= RXFF; + vpl011->uartris |= RXI; } /* Update the uart tx state if the buffer is not full. */ - if ( out_ring_qsize != sizeof(intf->out) ) + if ( out_fifo_level != sizeof(intf->out) ) { + unsigned int out_fifo_threshold; + vpl011->uartfr &= ~TXFF; - vpl011->uartris |= TXI; /* - * Clear the BUSY bit as soon as space becomes available + * Clear the BUSY bit as soon as space becomes avaliable * so that the SBSA UART driver can start writing more data * without any further delay. */ vpl011->uartfr &= ~BUSY; - if ( out_ring_qsize == 0 ) + /* + * Set the TXI bit only when there is space for fifo_size/2 bytes which + * is the trigger level for asserting/de-assterting the TX interrupt. + */ + out_fifo_threshold = sizeof(intf->out) - SBSA_UART_FIFO_SIZE/2; + + if ( out_fifo_level <= out_fifo_threshold ) + vpl011->uartris |= TXI; + else + vpl011->uartris &= ~TXI; + + if ( out_fifo_level == 0 ) vpl011->uartfr |= TXFE; } diff --git a/xen/include/asm-arm/vpl011.h b/xen/include/asm-arm/vpl011.h index 1b583da..db95ff8 100644 --- a/xen/include/asm-arm/vpl011.h +++ b/xen/include/asm-arm/vpl011.h @@ -28,6 +28,8 @@ #define VPL011_LOCK(d,flags) spin_lock_irqsave(&(d)->arch.vpl011.lock, flags) #define VPL011_UNLOCK(d,flags) spin_unlock_irqrestore(&(d)->arch.vpl011.lock, flags) +#define SBSA_UART_FIFO_SIZE 32 + struct vpl011 { void *ring_buf; struct page_info *ring_page;