From patchwork Tue Oct 17 16:46:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 116148 Delivered-To: patch@linaro.org Received: by 10.80.163.170 with SMTP id s39csp1438448edb; Tue, 17 Oct 2017 09:48:41 -0700 (PDT) X-Received: by 10.107.6.15 with SMTP id 15mr17451729iog.204.1508258920786; Tue, 17 Oct 2017 09:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508258920; cv=none; d=google.com; s=arc-20160816; b=r9Y52Q3Sp04BIC4DLPf3zubtLtnW0PEYBwrhCznP+hJPH0XlC2iRiZQ593QKz7MIoH Ix3ufvbkO239qt7scFoEW1jF2yToISVfzbLjutpc5TYJbc52LbDChSRWmcW6MYrc4+aA NmRkavHhh5x6IhO3JCndYGeJ4784QfNa7rtFqYzGcfqWrRiazFDnFk03/FSCHrZ2moFG b62/mryyjjSVtpX4QiLstKdlDBHl9wbjL+YJmMKNdrnJRIJAnQ1Bu/gCRbZ+CDzPVLm8 oPHo9iNsp1y8x+ostJukQWxxiKZPcNoNT+mgrPOTxELwa5z5YrbfppgjYQVlcEBVX2BK cL+w== 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=rfP/Qs6JtOHpikuJ4WTeeZ3y1ImjqhPap59XG4ilOeg=; b=DwP/OugLJWsn5byMaJ0j/0m4Q9N6BsVFHLcHBWf/cLv30RuXKEofpSDwYlNNgwWkXB vAL6Gtva/b44z5Ayocs5Sf10LwP+2H1V1GqikLydk2xvtbaNFk4rFDEvXirDR78D6/Iv sSLfKhw9ytDMQI7IIZjCr0nLWKf005aG7NGY3ktmh5ZtbHuYI7nNxVUOi61p+STwalBB c1OG4+ORGxYRSlvLVg7ICW9slXiyf/ndcKrTbZjKgD/g8SCd1pUoB0Tb6Vc3jti1Rf0Y WzwRShecV9Hfc1ld9hh+bDMHImypcDTU/V3JnCAInXN28ErutJmJR5CdVeeJIgGXWJmN Wy9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XeB96m5Y; 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 l125si6973180ite.60.2017.10.17.09.48.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Oct 2017 09:48:40 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XeB96m5Y; 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 1e4V17-0001pF-SX; Tue, 17 Oct 2017 16:46: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 1e4V16-0001on-Od for xen-devel@lists.xenproject.org; Tue, 17 Oct 2017 16:46:56 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id F0/55-20813-00436E95; Tue, 17 Oct 2017 16:46:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRWlGSWpSXmKPExsXiVRusrfvf+Fm kwfpX3Bbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8ahd7eZCraJVNx628ncwHhcsIuRi0NIYAaj xPdTbxhBHBaBecwSD5bcZuti5OSQEOhnlfj7xgnCzpP48uE3VDxNouXeURYIu0qi4fo9VhBbS EBL4uip2awQU1uYJNZMvgU0lYODTcBEYlaHBEiNiICSxL1Vk5lAapgFzjBJTLi9DKxZWMBTYt L3O+wgNouAqsTa2fsZQWxeAS+J52d+Qy2Tk7h5rpMZxOYU8JZ4/mYSE8h8IaCaWbv1JjAKLmB kWMWoUZxaVJZapGtoopdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERhwDECwg/H6 xoBDjJIcTEqivM6GTyKF+JLyUyozEosz4otKc1KLDzHKcHAoSfDeMHoWKSRYlJqeWpGWmQMMf Zi0BAePkgjvZGD4C/EWFyTmFmemQ6ROMRpz7Ntz6w8TR8fNu3+YhFjy8vNSpcR5GUFKBUBKM0 rz4AbBYvISo6yUMC8j0GlCPAWpRbmZJajyrxjFORiVhHmfgtzDk5lXArfvFdApTECnrHN6AnJ KSSJCSqqBkWd5cmE9o6BjRXpluRd/8GtG85L78zx3vnnze/1Jr58CkZs36985oaMT3OWX6nhg l2VvxLZExjexJ7iWvdlubd2kYnHZ9Kx8DlP2l4jYiBLtVxMnH9Y6wRI3rfemUiJLmmaIaNBZa 0unyz6OgoY5b2SymhYz7yvhu/pepzB6lw5z7b+NvTOVWIozEg21mIuKEwGNHQlkxAIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-13.tower-21.messagelabs.com!1508258814!71753374!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 52013 invoked from network); 17 Oct 2017 16:46:55 -0000 Received: from mail-pg0-f43.google.com (HELO mail-pg0-f43.google.com) (74.125.83.43) by server-13.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Oct 2017 16:46:55 -0000 Received: by mail-pg0-f43.google.com with SMTP id b192so1869125pga.2 for ; Tue, 17 Oct 2017 09:46: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=FoG9cGS0CTbpMBoY4QvTPQDqrXB72X/mNpLyilvhGAA=; b=XeB96m5YoXyC5/mCziW/vT1UYgNNb+epTDYYvMq8AHzta0oKhtHntEa51kUijSk5c9 cO7As9pVkwLg1rnx/lj6hWOT8l/yLOVnw2diSg8RDuuxl1zaNQhu8sxKNJxeKnQXigLG 7LBsDD8yH1FgJ0BHVxCyqUCLXTspQ4eGoabnY= 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=FoG9cGS0CTbpMBoY4QvTPQDqrXB72X/mNpLyilvhGAA=; b=cK4VkOddMgmh43yNnw5W6e3ga0QsvWAUxJlomBomjOAI7sO3/BDjQ/s7xC/Mz+TfDb wZqG/FBxJLWt/6GRiMacun31Fz2VXJLVW5YVYfdmPqilMFeUa2Lpww3QTv+eJVbD+b5i jarOMC+IJS3uZ7W6ofi4V2qPG1GEawzfqyCsN/bNlcnrjN+dRHkBLu+aPuIIuy0o3diB H4yyFtlY6ecKfdOJmu0dFG4vMjrkWvb7g+fQAR+XVMc0/cifLlwlvS0FG2qBj/K1HnQ1 6vyxS+1rkrlIxvqs4NJI598k3d15Hc/Dzskdt/ewWTunyj7MX3i9EkrTfDcdRhTQq/SC wyaQ== X-Gm-Message-State: AMCzsaXH11Ll3R6VBTOkyvFbxXXN4a4GpuGRx27gYASmHZJHa/BQ/uIQ Rerd3Wb+0LkVBYF3R1A0itJLSN/ixAo= X-Google-Smtp-Source: AOwi7QDR/bj3XIDqG/Y4nNKKQqxWjmXzbOytuHkGTQwNdGIb3CvZImBpUiluZz7iU8RsKJ7m42/00Q== X-Received: by 10.84.130.108 with SMTP id 99mr12662331plc.343.1508258813579; Tue, 17 Oct 2017 09:46:53 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id b3sm17926225pgr.81.2017.10.17.09.46.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Oct 2017 09:46:53 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 17 Oct 2017 22:16:33 +0530 Message-Id: <1508258793-5690-5-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508258793-5690-1-git-send-email-bhupinder.thakur@linaro.org> References: <1508258793-5690-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Julien Grall , Jan Beulich Subject: [Xen-devel] xenconsole: Define and use a macro INVALID_XEN_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 INVALID_XEN_PFN instead of -1 for initializing ring-ref. Signed-off-by: Bhupinder Thakur --- CC: Ian Jackson CC: Wei Liu CC: Andrew Cooper CC: George Dunlap CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Julien Grall tools/console/daemon/io.c | 10 +++++----- xen/include/public/xen.h | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 1839973..9129f5a 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -658,12 +658,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 == INVALID_XEN_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 = INVALID_XEN_PFN; } static int console_create_ring(struct console *con) @@ -698,7 +698,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 != INVALID_XEN_PFN) console_unmap_interface(con); if (!con->interface && xgt_handle && con->use_gnttab) { @@ -706,7 +706,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 = INVALID_XEN_PFN; } if (!con->interface) { /* Fall back to xc_map_foreign_range */ @@ -812,7 +812,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 = INVALID_XEN_PFN; con->local_port = -1; con->remote_port = -1; con->xce_pollfd_idx = -1; diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index 308109f..fc383ca 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -37,6 +37,8 @@ #error "Unsupported architecture" #endif +#define INVALID_XEN_PFN (~(xen_pfn_t)0) + #ifndef __ASSEMBLY__ /* Guest handles for primitive C types. */ DEFINE_XEN_GUEST_HANDLE(char);