From patchwork Tue Oct 31 06:55: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: 117521 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3524203qgn; Mon, 30 Oct 2017 23:57:32 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SZRghj/oo/I9/h+3zMbZLKl1i8DsAB7RKdpsWr3+ZQO91YxkeGH4QJ5uDtga2W1lW4OkQ0 X-Received: by 10.36.198.196 with SMTP id j187mr1685080itg.149.1509433052205; Mon, 30 Oct 2017 23:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509433052; cv=none; d=google.com; s=arc-20160816; b=LOzltyQiOZmVAyzQYbqu7BPZ6ZxdzEQyHvhFvN9xs+Vun3cry+G9u8nuE0NujayUWl RNIUHX5RmL7BzojA1GJT+SLHtnN6zJh/GlRSRfXBSapJFU476xg8iU+HoswjFnIt1DoX 6qwNDU5rDWdLF74Zz9kNGNYuNkB6uza8Grcr8WiQh9lQT9QgT9+MEmwd4sZQbu57pWDH vanMYAmWHSqWTgJBXvw8KaGuFAVMLLh2eYy0wPZWsNlXW+EDB3n/ZiQL989klnbKhqgP yYRQX3yT66Ret43k1hgwSTNf+txkgjQQHZXbtFkcUmhaGutCPqaPf44As5eGS6gvooyG sq/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:message-id:date:to:from:dkim-signature :arc-authentication-results; bh=UxXlZSuDuVTtjtV8y7g9eTnj4NQQmoj47ze93vuoYOo=; b=QvscTjC16uSlswjkNEh890htVwmG3CwXjSQCfeQacNvD/dkcuGaygCU44HExQFBPTD 8dyQWv5VPIAqV9dk12u44xyeKf+lV4eDibgRhAx1PFE3xmPdP1NJuyBHGAGYTiAOS2BS E9eXnEKcEKk9TrdAOOPm53WYVaha1rmxEHftD+XH8V0Y9m1UxtWkIIeF+KcTL8XPWXNY FARZ5lx363JA+TlGxaUj+ktDVjhxqOX//uvCFUchZ03T8On0oNGL6xtPvIP7LAcnbiE1 /MLHOmionLJsMvJj+GdUhD73WbQP2BZ4yCNjKsDcvXd/STJgERQef9AnZy7HeWuahStl 3Gxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AMYZ+jq/; 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 q74si841074iod.22.2017.10.30.23.57.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 23:57:32 -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=AMYZ+jq/; 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 1e9QSE-0002xs-4q; Tue, 31 Oct 2017 06:55:18 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9QSC-0002xm-P0 for xen-devel@lists.xenproject.org; Tue, 31 Oct 2017 06:55:17 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id 6E/3D-29911-45E18F95; Tue, 31 Oct 2017 06:55:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRWlGSWpSXmKPExsVyMfTAEd1guR+ RBhsWKlt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmnXv1iKTgiXPG3bRJbA+NMwS5GLg4hgVmM Env+N7KDOCwC7cwS6+ZOZwVxJATesUhcbNnF0sXICeTkScw5sJq5i5EDyE6TOLwoFyJcKbH3y h02EFtIQEvi6KnZrBBTdzBJzGifwg5SzyZgIjGrQwKkRkRASeLeqslMIDXMAm8ZJRbuuckKkh AWKJB4d/YyK0g9i4CqxLXNFSBhXgFvifs/fzFD7JKTuHmuk3kCI/8CRoZVjBrFqUVlqUW6hoZ 6SUWZ6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiBAcQABDsYPy0LOMQoycGkJMq70/F7 pBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3iLZH5FCgkWp6akVaZk5wFCGSUtw8CiJ8OrKAKV5i wsSc4sz0yFSpxjtOS7cufSHiePAnltAsuPmXSD5bObrBmYhlrz8vFQpcV5nkKkCIG0ZpXlwQ2 Gxd4lRVkqYlxHoTCGegtSi3MwSVPlXjOIcjErCvJwgU3gy80rgdr8COosJ6CwvCbCzShIRUlI NjG6/OyZFxcR1dKev675d0XFzzrEDh2yS61pv/LWJ/Bb//79kbVRRJ++jm03b7q9dn/yzh9tG xn59pjgrv7uX8p7eqJsS11k+RS/T2sNk+uHolQ0fXn7bxKLHe1Zth6Wz7nElw7w9L/0sAtn2d RbNdQmZmmpvPctpfZaOdr3ars+rNt7YXmYip8RSnJFoqMVcVJwIAJmaGA+4AgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-2.tower-27.messagelabs.com!1509432914!54619544!1 X-Originating-IP: [209.85.192.196] 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 39617 invoked from network); 31 Oct 2017 06:55:15 -0000 Received: from mail-pf0-f196.google.com (HELO mail-pf0-f196.google.com) (209.85.192.196) by server-2.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 31 Oct 2017 06:55:15 -0000 Received: by mail-pf0-f196.google.com with SMTP id b85so13017859pfj.13 for ; Mon, 30 Oct 2017 23:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=zy8Xnw6+aLmA1Y3jl9pWt1In8uySHj6pszzVRcxZ49A=; b=AMYZ+jq/Hs2ntFlzIxB5/UBpIfycTe1yJ/5kW+KHLhpJVhb9WQsfTnjQPkin+cqP9n ZRjknvEsk7QJdBBECH2jhVHaGayA3nPxPWD7CgsFqaM1Z6CPkBmNRFO7rnLXnfPPZgPp AI/h7mzAq6q/OLigi48QgxDISLRM01vMOoib4= 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; bh=zy8Xnw6+aLmA1Y3jl9pWt1In8uySHj6pszzVRcxZ49A=; b=dHmbjdvM3xD3RvDJD6vtfP9GpdqmB42xzAeD3DGobMkC9Suu/KvG3AyascdJjUHcok DsRbYE9dN7nEe+eWZpXdPVrxK96yb/Om0SXN6o7tzgjX+JeQgoXUP6WXL5kTjCGt0mIy 8z4nAzttvE56B4+qgtFk/Y6tqmOplTcIuq/l5oDSeajX95UktobYQHrAGBM/j9Gq5Bnj gIpLWuf5xHZz8+WTEKd+2JJ6lhxaModTGel4eOrZQ13fRDjthTMB1EEoRgMVmTUQN44s T4RjSgHr5kns2xOklI3dTccgeqO3OsMNfy8cLqBU5Ep+U18WOEjnfzFP894fBU5XImYl WUkw== X-Gm-Message-State: AMCzsaXxpZeZIoKpvwwRvxvzjwlM609z28D7s8tsS533et24LzcAz7UL yIuMoqofj5chpeGSS8cuc5i5w6nGEJ4= X-Received: by 10.159.198.131 with SMTP id g3mr983204plo.337.1509432913840; Mon, 30 Oct 2017 23:55: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 g16sm1517127pfd.87.2017.10.30.23.55.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Oct 2017 23:55:13 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 31 Oct 2017 12:25:05 +0530 Message-Id: <1509432908-17449-1-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Stefano Stabellini , Wei Liu , Andrew Cooper , Ian Jackson , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH 1/4 v3] libxl: Fix the bug introduced in commit "libxl: use correct type modifier for vuart_gfn" 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" In libxl__device_vuart_add vuart_gfn is getting stored as a hex value: > flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn)); However, xenstore reads this value as a decimal value and tries to map the wrong address and fails. This patch introduces a new format specifier "PRIu_xen_pfn" which formats the value as a decimal value. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Jan Beulich CC: Andrew Cooper tools/libxl/libxl_console.c | 2 +- xen/include/public/arch-arm.h | 1 + xen/include/public/arch-x86/xen.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index c05dc28..6bfc0e5 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -376,7 +376,7 @@ int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, 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("%"PRI_xen_pfn, state->vuart_gfn)); + flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->vuart_gfn)); flexarray_append(ro_front, "limit"); flexarray_append(ro_front, GCSPRINTF("%d", LIBXL_XENCONSOLE_LIMIT)); flexarray_append(ro_front, "type"); diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index 5708cd2..05fd11c 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -274,6 +274,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t); typedef uint64_t xen_pfn_t; #define PRI_xen_pfn PRIx64 +#define PRIu_xen_pfn PRIu64 /* Maximum number of virtual CPUs in legacy multi-processor guests. */ /* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */ diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h index ff91831..3b0b1d6 100644 --- a/xen/include/public/arch-x86/xen.h +++ b/xen/include/public/arch-x86/xen.h @@ -75,6 +75,7 @@ __DeFiNe__ __DECL_REG_LO16(name) e ## name #ifndef __ASSEMBLY__ typedef unsigned long xen_pfn_t; #define PRI_xen_pfn "lx" +#define PRIu_xen_pfn "lu" #endif #define XEN_HAVE_PV_GUEST_ENTRY 1 From patchwork Tue Oct 31 06:55: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: 117520 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3524152qgn; Mon, 30 Oct 2017 23:57:28 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TO6KDCldbHmYAAmdz7i1DfarCOW7FICDMwa9vYT+hDBiZk0jz72xZdjiSTWid5jPfvZXTS X-Received: by 10.36.67.141 with SMTP id s135mr1829820itb.142.1509433048787; Mon, 30 Oct 2017 23:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509433048; cv=none; d=google.com; s=arc-20160816; b=jDoEU0ybdJXYMmhANH/QhFXuTv9JOx2M2q5uibOUlhEOu8wBnCuEEEq0/E9b9+Cvr3 10lJLngcXod6+epmCFUkUhPTwel2wZBH0YJ9MnEyXiCg5/bTcwht7f+wyfPpP97Pdtme tQuWerG5kaM0ZuWM7uF54QkZdKBIsFmGX+rHb04FgUMWQ2uOKt45QB5zozhcw/h6loh3 OIzmg8SI310FaoDUyZJNInvtg9yPi6eakbcdZ4WCRKJJWwdQdPTJwTXh/RxWhQxOcD3o GEGTx380xkWqxIKTtKeEgWA/2WcGV/er8hMo9tjfQB82yCEiemr0TCq6FcW/THK4HWkj xUlg== 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=MM0QypTS1k4iyMkY6yCZiB0dgC7PaqO87MbDjNTKuQA=; b=tiogyVjByyK94jOvQ85gg2wfCa48LyZgCUnOPVlHqIKbDqRI4/o+UurowD1cDixLnw Cfhnta8T2zsc+XWxMvKqGMagLrChadxGkbUn8PGWIR5+ohnavW+Rz/K/UOe6iJZvfspB /y2fJUgGAt2/rXWiv12m3Ua+ACDSd5rGAYdjiNwZ/Up0FCE5HdiOSlmPO7RLSu0SMw6x wIZGfWIqN8LGUfVffzxdZI6Rc1DhtRNTKkWAjaVfSpS+SCkfR/uQxIVTY+uNPKC4323S I8abtPwbn2B0vnf5JqjNV5ECmTx/70pYzpglcnkf1TbO+zrRsDNhz74cal/K2F+9Q3Qr TZSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JHZFeZQS; 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 e2si1197746itc.83.2017.10.30.23.57.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 23:57:28 -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=JHZFeZQS; 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 1e9QSG-0002yD-CD; Tue, 31 Oct 2017 06:55:20 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9QSF-0002y7-Nc for xen-devel@lists.xenproject.org; Tue, 31 Oct 2017 06:55:19 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id C9/85-01785-65E18F95; Tue, 31 Oct 2017 06:55:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRWlGSWpSXmKPExsXiVRvsqBsm9yP S4MJUfovvWyYzOTB6HP5whSWAMYo1My8pvyKBNePb2WWMBT+cK943+jcwTjTuYuTiEBKYyShx fOYSJhCHRWAes0TftvWsII6EQD+rxNnnfUAOJ5CTJ/Fn1kV2CDtNYtu6J0AdHEB2hcSGk6YgY SEBLYmjp2azQkzdwSRx+89DZpAaNgETiVkdEiA1IgJKEvdWTQZbxiwwn1GiaVIvG0hCWMBLor FnFhOIzSKgKvGx5yQrSC+vgLfE+1+OEGvlJG6e62QGsTkFfCS6m/sYIfZ6S/S9msIygVFwASP DKkb14tSistQiXWO9pKLM9IyS3MTMHF1DA1O93NTi4sT01JzEpGK95PzcTYzAYGMAgh2Me/85 HWKU5GBSEuXd6fg9UogvKT+lMiOxOCO+qDQntfgQowwHh5IEr5Xsj0ghwaLU9NSKtMwcYNjDp CU4eJREeHVlgNK8xQWJucWZ6RCpU4z2HMc2Xf7DxLFvzy0g2XHzLpB8NvN1A7MQS15+XqqUOK 8zyFQBkLaM0jy4obA4vcQoKyXMywh0phBPQWpRbmYJqvwrRnEORiVh3n0gU3gy80rgdr8COos J6CwvCbCzShIRUlINjFbO0kvcg1J36+RN9fvJ1zql7o3k3Z/vD85IunWwLXv/p2fFeaHsr5vX HFz7RiJrOde0D3rzQ+ZIzLq26b9XYnrnNNu+4tbC6LOxf1v0XdjmLGc8uH+Hl1W33oGPk79yd Ee26hWwT1n8sdX98apgNdePhn4Rp1m4mm4bun/5crBH/aHK5Czjf0osxRmJhlrMRcWJAJLimh jOAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-206.messagelabs.com!1509432917!89607455!1 X-Originating-IP: [74.125.83.65] 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 18530 invoked from network); 31 Oct 2017 06:55:17 -0000 Received: from mail-pg0-f65.google.com (HELO mail-pg0-f65.google.com) (74.125.83.65) by server-11.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 31 Oct 2017 06:55:17 -0000 Received: by mail-pg0-f65.google.com with SMTP id l24so13846379pgu.11 for ; Mon, 30 Oct 2017 23:55: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=R5hNAH30cZfYDouNEHa7dp2B5+pAu8phJUwXkMy6jtQ=; b=JHZFeZQS4D3HDtmSblka5OJrRozY5uUH8P08yThMPuPPhdu/aUJtC6120MPlTBmsZv MpPpegCxIltosj32iWMZElwclqzdLc59YScAow8Gd/Nfu2YPi4Irr5VxJ0vK1iPx5pt5 UxSlCzBwCcOpON3C1lsVByXHwGOJk/ZQbpfOU= 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=R5hNAH30cZfYDouNEHa7dp2B5+pAu8phJUwXkMy6jtQ=; b=TsXWvwiMnRmw37i5tqLl4dxTnuDIe+Psdty2gT0LnhydCHy/KFbI9lZwZJ1woJH4a7 4eMhNybNU+ZSINm0fDOp6+CLSoV3N04pExnuB6uPuV0HAfcyfvk6Xzt1NYZBj/YaC0Lw zfsQmsNIo8DwJOGL3oczJQND1wj2Bg8Hk061swBXyo7rTgGLVa2S1OhyC5Q5mxI4i8lk LiMp8QhAnHgnxJo8H9oHEYP0zmPO6ukcl+jwmZhMUnJuNEMNs239l0XgGQ/tgxI8SHXz 0p1Rvb0JrRzLBupmwMwLs9JgAuz6cFDc9T7jEm9SPrXBQylVYJoYk6X73GK6Eyv69B7P NJNg== X-Gm-Message-State: AMCzsaV+94tPhEyoDtb/YZKJMnzBC3BW2UF9ua1tmdysn1M0prHB3HmD avHO/0KLnLQN6gkU8Yg3nFIWzzQ56IA= X-Received: by 10.84.168.69 with SMTP id e63mr989916plb.340.1509432916319; Mon, 30 Oct 2017 23:55: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 g16sm1517127pfd.87.2017.10.30.23.55.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Oct 2017 23:55:15 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 31 Oct 2017 12:25:06 +0530 Message-Id: <1509432908-17449-2-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 2/4 v3] libxl: Change the type of console_mfn to xen_pfn_t 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" Currently the type of console mfn is unsigned long in libxl. This may be an issue for 32-bit toolstack running on 64-bit Xen, where the pfn are 64 bit. To ensure that console_mfn can hold any valid 64-bit pfn, the type of console_mfn is changed to xen_pfn_t. Also the name console_mfn is misleading as it is actually a gfn. This patch also modifies the name to console_gfn. 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/libxc/include/xenctrl_compat.h | 2 +- tools/libxc/xc_foreign_memory.c | 4 ++-- tools/libxl/libxl_console.c | 2 +- tools/libxl/libxl_create.c | 10 +++++----- tools/libxl/libxl_dom.c | 12 ++++++------ tools/libxl/libxl_internal.h | 2 +- tools/libxl/libxl_save_helper.c | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tools/libxc/include/xenctrl_compat.h b/tools/libxc/include/xenctrl_compat.h index a655e47..5ee72bf 100644 --- a/tools/libxc/include/xenctrl_compat.h +++ b/tools/libxc/include/xenctrl_compat.h @@ -26,7 +26,7 @@ */ void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, int size, int prot, - unsigned long mfn ); + xen_pfn_t pfn); void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot, const xen_pfn_t *arr, int num ); diff --git a/tools/libxc/xc_foreign_memory.c b/tools/libxc/xc_foreign_memory.c index 4053d26..c1f114a 100644 --- a/tools/libxc/xc_foreign_memory.c +++ b/tools/libxc/xc_foreign_memory.c @@ -33,7 +33,7 @@ void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot, void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, int size, int prot, - unsigned long mfn) + xen_pfn_t pfn) { xen_pfn_t *arr; int num; @@ -46,7 +46,7 @@ void *xc_map_foreign_range(xc_interface *xch, return NULL; for ( i = 0; i < num; i++ ) - arr[i] = mfn + i; + arr[i] = pfn + i; ret = xc_map_foreign_pages(xch, dom, prot, arr, num); free(arr); diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index 6bfc0e5..f2ca689 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -329,7 +329,7 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid, flexarray_append(ro_front, "port"); flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port)); flexarray_append(ro_front, "ring-ref"); - flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn)); + flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->console_mfn)); } else { flexarray_append(front, "state"); flexarray_append(front, GCSPRINTF("%d", XenbusStateInitialising)); diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index f15fb21..26870ca 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1134,7 +1134,7 @@ static void domcreate_bootloader_done(libxl__egc *egc, } void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn, - xen_pfn_t console_mfn, void *user) + xen_pfn_t console_gfn, void *user) { libxl__save_helper_state *shs = user; libxl__domain_create_state *dcs = shs->caller_state; @@ -1142,7 +1142,7 @@ void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn, libxl__domain_build_state *const state = &dcs->build_state; state->store_mfn = store_mfn; - state->console_mfn = console_mfn; + state->console_gfn = console_gfn; shs->need_results = 0; } @@ -1740,7 +1740,7 @@ static int do_domain_soft_reset(libxl_ctx *ctx, libxl__domain_create_state *dcs; libxl__domain_build_state *state; libxl__domain_save_state *dss; - const char *console_tty, *xs_store_mfn, *xs_console_mfn; + const char *console_tty, *xs_store_mfn, *xs_console_gfn; char *dom_path; uint32_t domid_out; int rc; @@ -1781,12 +1781,12 @@ static int do_domain_soft_reset(libxl_ctx *ctx, rc = libxl__xs_read_checked(gc, XBT_NULL, GCSPRINTF("%s/console/ring-ref", dom_path), - &xs_console_mfn); + &xs_console_gfn); if (rc) { LOGD(ERROR, domid_soft_reset, "failed to read console/ring-ref."); goto out; } - state->console_mfn = xs_console_mfn ? atol(xs_console_mfn): 0; + state->console_gfn = xs_console_gfn ? atol(xs_console_gfn): 0; rc = libxl__xs_read_mandatory(gc, XBT_NULL, GCSPRINTF("%s/console/tty", dom_path), diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index ef834e6..647dbf7 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -852,11 +852,11 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid, goto out; if (xc_dom_translated(dom)) { - state->console_mfn = dom->console_pfn; + state->console_gfn = 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->console_gfn = xc_dom_p2m(dom, dom->console_pfn); state->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn); } @@ -869,7 +869,7 @@ out: static int hvm_build_set_params(xc_interface *handle, uint32_t domid, libxl_domain_build_info *info, int store_evtchn, unsigned long *store_mfn, - int console_evtchn, unsigned long *console_mfn, + int console_evtchn, xen_pfn_t *console_gfn, domid_t store_domid, domid_t console_domid) { struct hvm_info_table *va_hvm; @@ -901,9 +901,9 @@ static int hvm_build_set_params(xc_interface *handle, uint32_t domid, xc_hvm_param_set(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn); *store_mfn = str_mfn; - *console_mfn = cons_mfn; + *console_gfn = cons_mfn; - xc_dom_gnttab_hvm_seed(handle, domid, *console_mfn, *store_mfn, console_domid, store_domid); + xc_dom_gnttab_hvm_seed(handle, domid, *console_gfn, *store_mfn, console_domid, store_domid); return 0; } @@ -1270,7 +1270,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid, rc = hvm_build_set_params(ctx->xch, domid, info, state->store_port, &state->store_mfn, state->console_port, - &state->console_mfn, state->store_domid, + &state->console_gfn, state->store_domid, state->console_domid); if (rc != 0) { LOG(ERROR, "hvm build set params failed"); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index bfa95d8..49f7966 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1129,7 +1129,7 @@ typedef struct { uint32_t console_port; uint32_t console_domid; - unsigned long console_mfn; + xen_pfn_t console_gfn; char *console_tty; char *saved_state; diff --git a/tools/libxl/libxl_save_helper.c b/tools/libxl/libxl_save_helper.c index 38089a0..bf50ec8 100644 --- a/tools/libxl/libxl_save_helper.c +++ b/tools/libxl/libxl_save_helper.c @@ -284,17 +284,17 @@ int main(int argc, char **argv) helper_setcallbacks_restore(&helper_restore_callbacks, cbflags); unsigned long store_mfn = 0; - unsigned long console_mfn = 0; + unsigned long console_gfn = 0; startup("restore"); setup_signals(SIG_DFL); r = xc_domain_restore(xch, io_fd, dom, store_evtchn, &store_mfn, - store_domid, console_evtchn, &console_mfn, + store_domid, console_evtchn, &console_gfn, console_domid, hvm, pae, stream_type, &helper_restore_callbacks, send_back_fd); - helper_stub_restore_results(store_mfn,console_mfn,0); + helper_stub_restore_results(store_mfn,console_gfn,0); complete(r); } else { From patchwork Tue Oct 31 06:55: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: 117519 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3524141qgn; Mon, 30 Oct 2017 23:57:28 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Qiz13Ah3p5kyin/KnwinVlwAUdCULP71pkIcuZ3qQOak7G8pV9r+KPzyG1OJpMi0tPuqD5 X-Received: by 10.107.46.8 with SMTP id i8mr1188513ioo.298.1509433048252; Mon, 30 Oct 2017 23:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509433048; cv=none; d=google.com; s=arc-20160816; b=SCqchoqmyEPBBmhb9QZ3r1Mfkr9kvLZPXwdYLALTh9av50IKqcbJOVr2oKQJbe+zFx t/41AzPDVGBgUdEM0HHYIQ9iaC271bb+/yzx93uqNViRlI8cbvJREiuFvXsv1HQ1rDDE Y46dvk3e4VckS3xo9nuEy7CMST2g2s22KdzU3KtE5zSkI3rzciZ0MCrw1HHIcxLSDjcN DUpSeqRM9vBffJEuEOv3WQM1mFLzWBnGAWEOrrzvjkoE02XFr6R5ZMYHsGuWpHKa6puu Gvj0XI/r/6n9JI0GTdkAqjTdnAUB7t8vqWEWjZLInyfCN3tn9zZC57DPXX05rx/XIu6l oD6w== 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=R+MdG78Jdu6jssvP98KJ9sNPvunp6JeChv+D38CvJwg=; b=WV9eQlLeH53UmhyU2z3Wzhr/lJYEv0sNgaiL7p9FnEQ/tfExY5BDROxbpB4BMUchom t20Y3E+ZB5+GFH2LjbYdMjfhlswqP4T+sgI9oU6TuKW2MQxvD7UCjbsYFvOq7qbHrbv6 r+aiAxMCksbE7JCMXp02l16jBtV80nwzqkDh4yxzisGN9C2FonNpuLZuqiO6OpkRlB1y pQS+SFpf0DEsV9KBD56lt4Gf5Acse5xXDTiziZNl/wnuXRF1v//rygdEv9WxeUyGvq4J PxeP7MxB0CJOqHLOLdkvZ849cD4aalzrxOXNaFYpPv0+tYsiCBwBtAN9n0pMUaZdA7gZ 98cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XnpYia5G; 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 t15si1199889iti.159.2017.10.30.23.57.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 23:57:28 -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=XnpYia5G; 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 1e9QSJ-0002yv-Nt; Tue, 31 Oct 2017 06:55:23 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9QSI-0002yh-Dg for xen-devel@lists.xenproject.org; Tue, 31 Oct 2017 06:55:22 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 7D/52-23269-95E18F95; Tue, 31 Oct 2017 06:55:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRWlGSWpSXmKPExsVyMfTAQd1IuR+ RBseesFh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnn2t+yF/wSrOib3crSwNjK38XIxSEkMJNR YsWMVUwgDovAPGaJfbdeAjmcHBIC/awS/5YGQ9h5Eu/uTmLtYuQAstMkru3RgTArJfqmR4JUC AloSRw9NZsVwt7BJPH8lyJICZuAicSsDgmQsIiAksS9VZPBNjELzGeUaJrUywaSEBZIlph/qp cZxGYRUJXY8vs8I4jNK+AtMfnEDqhr5CRunusEq+EU8JHobu5jhNjlLdH3agrLBEbBBYwMqxg 1ilOLylKLdI1M9ZKKMtMzSnITM3N0DQ1M9XJTi4sT01NzEpOK9ZLzczcxAoOtnoGBcQfjrna/ Q4ySHExKorw7Hb9HCvEl5adUZiQWZ8QXleakFh9ilOHgUJLg/S3zI1JIsCg1PbUiLTMHGPYwa QkOHiURXl2QNG9xQWJucWY6ROoUoz3HhTuX/jBxHNhzC0h23LwLJJ/NfN3ALMSSl5+XKiXO6y wL1CYA0pZRmgc3FBanlxhlpYR5GRkYGIR4ClKLcjNLUOVfMYpzMCoJ83KCTOHJzCuB2/0K6Cw moLO8JMDOKklESEk1MM7jEDsYtGh6TcbJG7/uF4UqLHn4Zu8Bh9maxaaNtQkfPoXb/eJZX7DL a9N2sS+nqq67RffU739/Vuq1v57vQdsnBf79Jydyu1wr/XlDsuBcW+JUrTNiP3xn7vh8u8lo5 gnZomWTE4yWi25+EaCSEvzbgWn2Rd9r6c91NrUuyrrdUhyY+XArzzYlluKMREMt5qLiRAAw8j AGzgIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-13.tower-206.messagelabs.com!1509432920!93894547!1 X-Originating-IP: [209.85.192.193] 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 29275 invoked from network); 31 Oct 2017 06:55:20 -0000 Received: from mail-pf0-f193.google.com (HELO mail-pf0-f193.google.com) (209.85.192.193) by server-13.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 31 Oct 2017 06:55:20 -0000 Received: by mail-pf0-f193.google.com with SMTP id p87so13035986pfj.3 for ; Mon, 30 Oct 2017 23:55: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=ZIrhgrb9ZENT2mHVadcLYu6cjupeJkWyILO8AFM17h0=; b=XnpYia5G10e1eA0Yy0FkMQSqmrwObL9mV1Yv/ywhppSYe6RXUC6uWsAcPBfB+YbQAq C5ySj0KUcbseAAxnj+K7QOZGn2cEtm5Q34bSOrwsR30WYHIppAs4dxedn/ywRoAZd5xt OQg5nuXPD3mjBMcCkUGXHqFntmmNwOr7gBfCM= 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=ZIrhgrb9ZENT2mHVadcLYu6cjupeJkWyILO8AFM17h0=; b=sX3L2tKz66inOmBHxZkSsHpsjB+OrRYYG9HSuO1HUsPkxjjVYnnVjteFHorN00OLvK rkQgyyWddMjbUwV6NAMCYFx4dvw6kQnoSPgj7GfKnMcGxCF5rfQ4E7brZ6RSraTCqCja kKLNnSin37VHTEdPJkxpjVAajrp0lsEVJgAS5z7bWd0CPISGeKNoObrPs0z9RIfozPvd Xnuru8KmhRw1iFw0n8qqvDWOVVCi+tVw7/M2MGrMOtp9Bn3K27FX46nDvnz6v5moHZ9R ikAdjrCAOzxUTxlZPzOhryMG40CLcq2Ov+y/JaL3LQPVIK12VS06m2tX4J6G0Beamb5m MLvg== X-Gm-Message-State: AMCzsaVsm9V3llNu0XKbq0QVesFrpMISXjf8JcUYLuCXyQfs/zQr2tJI 896cRIRCAKP37hzlUOtc7iDoc87pv+o= X-Received: by 10.98.93.148 with SMTP id n20mr1030454pfj.247.1509432918821; Mon, 30 Oct 2017 23:55:18 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id g16sm1517127pfd.87.2017.10.30.23.55.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Oct 2017 23:55:18 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 31 Oct 2017 12:25:07 +0530 Message-Id: <1509432908-17449-3-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 3/4 v3] xenconsole: Change the type of ring_ref to xen_pfn_t in console_create_ring 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" Currently, ring_ref is read as an integer in console_create_ring which could lead to truncation of the value as it is reading a 64-bit value. The fix is to modify the type of ring_ref to xen_pfn_t and use the correct format specifier to read the value correctly for all architectures. 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 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index e22009a..1839973 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -19,6 +19,7 @@ #define _GNU_SOURCE +#include #include "utils.h" #include "io.h" #include @@ -81,6 +82,12 @@ static unsigned int nr_fds; #define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1)) +#if defined(CONFIG_ARM) +# define SCNi_xen_pfn SCNi64 +#else +# define SCNi_xen_pfn "li" +#endif + struct buffer { char *data; size_t consumed; @@ -98,7 +105,7 @@ struct console { struct buffer buffer; char *xspath; char *log_suffix; - int ring_ref; + xen_pfn_t ring_ref; xenevtchn_handle *xce_handle; int xce_pollfd_idx; int event_count; @@ -661,12 +668,13 @@ static void console_unmap_interface(struct console *con) static int console_create_ring(struct console *con) { - int err, remote_port, ring_ref, rc; + int err, remote_port, rc; + xen_pfn_t ring_ref; char *type, path[PATH_MAX]; struct domain *dom = con->d; err = xs_gather(xs, con->xspath, - "ring-ref", "%u", &ring_ref, + "ring-ref", "%"SCNi_xen_pfn, &ring_ref, "port", "%i", &remote_port, NULL); @@ -705,7 +713,7 @@ static int console_create_ring(struct console *con) con->interface = xc_map_foreign_range( xc, dom->domid, XC_PAGE_SIZE, PROT_READ|PROT_WRITE, - (unsigned long)ring_ref); + ring_ref); if (con->interface == NULL) { err = EINVAL; goto out; 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;