From patchwork Tue Oct 31 06:55: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: 117518 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3524124qgn; Mon, 30 Oct 2017 23:57:26 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RVeK/ymfz83sr8/4RHOzUzZd4GqBduQiuoXRl3BmGDx8T6bwcwAB23GrJPcw5D7Wh7jBoX X-Received: by 10.36.208.210 with SMTP id m201mr1750304itg.152.1509433046149; Mon, 30 Oct 2017 23:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509433046; cv=none; d=google.com; s=arc-20160816; b=0Oe8nHOBFnJuHcqzVRdXZD9x81uiM0bk9+p2MgGAcOlv8H6Xp3xkQLdr3JMG4mdzC0 qyaYHwbOAyEvtyGsbW936t2INVccC66Gwcv/4VvzsbBFFkwN6WkXWVqvo1mJPcQKQrdT XOmJrT2YsiiWGNIxNuJJYo5mE9+JCR3WB6tt554sUVh4cQxZN2jBnFPFFnsCrGiNQzBN nwHZhONpoQX1m1usmbD1zlqAOLpLKQ1WU/GzieOhi9KonZuFd4aWbu5ovD1CIANbzoxt Zyp4ebsy7QaDl7Ws77uIBGJ50KpLXhtG+2pxP0CYCeQGSBaNj1bJOU/FneWyNqZyvlR8 2EVQ== 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=mIcuvFjGUjSaLyvYjiOLYD0Kttafzr1jeCK3NQ32Tqc=; b=0BTqIWgMsEwx8kgtMLNtEDS9mGD4FAvR750Th9u8gO1dnJPAUU2GoctSiEO4UAOdbK FdadJJdlfd6FMzDIXrgkUpc1JBzlk3SyasMWobykfzrkDzBKt1HVJ0EliE4lBOs7bcQw mmHs9sYlpgNBif7OPOXpUVV/DSFXaxAJI7W09DGp8BInmTc2fo0cgYvn48QwKvTHLVCs fjpF6M8KoaUmBEXfn8edYllBC/IkjTEM6uiM76NNndXCXyLWTvd2Hsb/0pegd4ke3bE0 oFDb25XsUhmJ+dtMZviIkkt8E1TSXscMun9l5adLtnnw7sYLtv6cKpWxisGlztV6Qpsz 1cbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RLm89RZQ; 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 y40si927854ioi.306.2017.10.30.23.57.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 23:57:26 -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=RLm89RZQ; 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 1e9QSM-0002zQ-V8; Tue, 31 Oct 2017 06:55:26 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9QSL-0002z7-Qr for xen-devel@lists.xenproject.org; Tue, 31 Oct 2017 06:55:25 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id EA/FC-19067-D5E18F95; Tue, 31 Oct 2017 06:55:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsXiVRvsohsj9yP SoHOtnMX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmrHlwkuWgjvCFe075rM2MF4X6GLk4hASmMko cXnzSRYQh0VgHrPE0flt7CCOhEA/q8Sutb/Yuhg5gZw8ic23DzBD2GkSh/9sgIpXSrx7084IY gsJaEkcPTWbFWLsDiaJ09s2AhVxcLAJmEjM6pAAqRERUJK4t2oyE0gNs8B8RommSb1gNcICER IPzwSA1LAIqEqs+neLCcTmFfCWuPvhEjvELjmJm+c6wW7gFPCR6G7ug9rrLdH3agrLBEbBBYw MqxjVi1OLylKLdC30kooy0zNKchMzc3QNDUz1clOLixPTU3MSk4r1kvNzNzECA44BCHYwHmx2 PsQoycGkJMq70/F7pBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3iLZH5FCgkWp6akVaZk5wNCHS Utw8CiJ8OrKAKV5iwsSc4sz0yFSpxgtOfbtufWHiaPj5l0g+Wzm6wZmIZa8/LxUKXFeZ5B5Ai ANGaV5cONg8XmJUVZKmJcR6EAhnoLUotzMElT5V4ziHIxKwrycIFN4MvNK4La+AjqICeggLwm wg0oSEVJSDYyiU79f2nw4yOWww0lzL4VJE5YnrCiI6F858ay18O3Xd04Jeeg5hjLw6pzxvTIx ZO8kTQ7r1582qEasWnNdMSZ+8YuqvT3ixyd8mvaUSWSTWeaSWHMTkc/3bBe4froiesF266dnC UeONmxw/7HE7U5Hzn/ZVUsm3ih8+reDVXq7/GWxVWfC71+6r8RSnJFoqMVcVJwIAM+99w7KAg AA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-16.tower-206.messagelabs.com!1509432923!93509784!1 X-Originating-IP: [74.125.83.68] 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 42082 invoked from network); 31 Oct 2017 06:55:24 -0000 Received: from mail-pg0-f68.google.com (HELO mail-pg0-f68.google.com) (74.125.83.68) by server-16.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 31 Oct 2017 06:55:24 -0000 Received: by mail-pg0-f68.google.com with SMTP id b192so13867321pga.2 for ; Mon, 30 Oct 2017 23:55:24 -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=KhnRUWiyJ6fZsSgqIeM3B2+RlXLztB0R09bNfCpKLf0=; b=RLm89RZQqN1t8c3qitm9Z9NDGtdHOSU8PDWkdDaBhQ1IR2GcxQmco8aSP4IYVSGs5f AJwEy8t7Nh0GcXzo+BoYW2jeY7YwCp82zlBv7bK5/o5Gl7oBJKWi7pmd/Peb84XUkwQF 6CoVnXuGZO0hfLbOA32HXrmU+AJSxMZtE+YNg= 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=KhnRUWiyJ6fZsSgqIeM3B2+RlXLztB0R09bNfCpKLf0=; b=sO+KQ81OCXSZ8c/i2rWFslyGFVhfAI0fyJDCGV9uwN5TMQZsBkwrNcGnwz62g3rtXV 59PPoLyoejP7+op6jXWrEzupzV143TBO3vBePOEq1UxUNoyo8X1zSEPOR+DJ2uKLUNBG fEYV4uMdLuOJPemanTqwsQQI+qUpnPIYcrQg0pga0NiWeWY0zcm7zyHNoeYcFSeImQNg wtbNtaT1qvlR9ewCFyW2S8TuiBZ5WLwFWJIOU7waLOx9i0AzY5ZLXDHkKuErCl9EXp9f 4UcpdN5CQ4GqEhbbm0VPzuMOA3UemkLdF57odCRe43qR26tPLx35ftFgOmW8duebU4C/ gYhQ== X-Gm-Message-State: AMCzsaU58cjF/Uqnt3IRGPCjn+1/XQYCqdSFsMx0rQ6ypBoT9TrZpxgF FArMxGJGqvIXp6wfQVifKovm1PZxQ3g= X-Received: by 10.98.150.19 with SMTP id c19mr1023187pfe.239.1509432921299; Mon, 30 Oct 2017 23:55: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 g16sm1517127pfd.87.2017.10.30.23.55.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Oct 2017 23:55:20 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 31 Oct 2017 12:25:08 +0530 Message-Id: <1509432908-17449-4-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509432908-17449-1-git-send-email-bhupinder.thakur@linaro.org> References: <1509432908-17449-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 4/4 v3] xenconsole: Define and use a macro XEN_INVALID_PFN instead of -1 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 will use a new macro XEN_INVALID_PFN instead of -1 for initializing ring-ref. Since the type of ring_ref is changed to xen_pfn_t (which is an unsigned value) assigning -1 appeared to be confusing. For clarity, XEN_INVALID_PFN is introduced. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall This patch is as per the review of commit fa1f157 libxl: Fix the bug introduced in commit "libxl: use correct type tools/console/daemon/io.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 1839973..aa291db 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -62,6 +62,8 @@ /* Duration of each time period in ms */ #define RATE_LIMIT_PERIOD 200 +#define XEN_INVALID_PFN (~(xen_pfn_t)0) + extern int log_reload; extern int log_guest; extern int log_hv; @@ -658,12 +660,12 @@ static void console_unmap_interface(struct console *con) { if (con->interface == NULL) return; - if (xgt_handle && con->ring_ref == -1) + if (xgt_handle && con->ring_ref == XEN_INVALID_PFN) xengnttab_unmap(xgt_handle, con->interface, 1); else munmap(con->interface, XC_PAGE_SIZE); con->interface = NULL; - con->ring_ref = -1; + con->ring_ref = XEN_INVALID_PFN; } static int console_create_ring(struct console *con) @@ -698,7 +700,7 @@ static int console_create_ring(struct console *con) free(type); /* If using ring_ref and it has changed, remap */ - if (ring_ref != con->ring_ref && con->ring_ref != -1) + if (ring_ref != con->ring_ref && con->ring_ref != XEN_INVALID_PFN) console_unmap_interface(con); if (!con->interface && xgt_handle && con->use_gnttab) { @@ -706,7 +708,7 @@ static int console_create_ring(struct console *con) con->interface = xengnttab_map_grant_ref(xgt_handle, dom->domid, GNTTAB_RESERVED_CONSOLE, PROT_READ|PROT_WRITE); - con->ring_ref = -1; + con->ring_ref = XEN_INVALID_PFN; } if (!con->interface) { /* Fall back to xc_map_foreign_range */ @@ -812,7 +814,7 @@ static int console_init(struct console *con, struct domain *dom, void **data) con->master_pollfd_idx = -1; con->slave_fd = -1; con->log_fd = -1; - con->ring_ref = -1; + con->ring_ref = XEN_INVALID_PFN; con->local_port = -1; con->remote_port = -1; con->xce_pollfd_idx = -1;