From patchwork Thu Feb 12 11:19:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 44619 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 230442151D for ; Thu, 12 Feb 2015 11:21:05 +0000 (UTC) Received: by labgm9 with SMTP id gm9sf6075965lab.2 for ; Thu, 12 Feb 2015 03:21:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=4LLkRlcDBhvmkr9SlF1Ayr0TxnAhEqAqoOwkb19FxJE=; b=Y6FsHz57RcujIrN/ndcuKDgGtROuk87i12zlL5A7hxdXlpJSI9RZK5CmptTVOLaSZO eSvskvTE/HS/sCddHExBZIkbpSeNg0V8uBrW1++xaqlmvaVQKq+0UwDuahQTpwoYVjR4 +mg1NcKF3/S4Wk9i12FBtvrztDRgReOkyXNgKFik8o7PMOYxMYynYzQJpJecrxUNoWtm f1W9FL3eNY+8DAe4oMYqxEA4mMvhPcK5+XHKhcJjZZMzvz9r4uwVNnXkCZzFiaJHdJus Ds7BrVVwURiI+50bgzQiSwPEA3Sugelg5C1mEuKVWCInr6h810CuvDk0t7c/rANciDnS Khog== X-Gm-Message-State: ALoCoQmHUOX6qfduY+kP4BiXhypcjgksitO2kyAj+g4GZfRHrV/oaMbjKaagiwvbvIstQcS/wz10 X-Received: by 10.180.13.83 with SMTP id f19mr400303wic.7.1423740064123; Thu, 12 Feb 2015 03:21:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.5.9 with SMTP id ci9ls184195lad.40.gmail; Thu, 12 Feb 2015 03:21:04 -0800 (PST) X-Received: by 10.112.163.229 with SMTP id yl5mr2824357lbb.60.1423740063961; Thu, 12 Feb 2015 03:21:03 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id l8si2671027lbp.127.2015.02.12.03.21.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Feb 2015 03:21:03 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id z12so8846370lbi.11 for ; Thu, 12 Feb 2015 03:21:03 -0800 (PST) X-Received: by 10.152.179.172 with SMTP id dh12mr302620lac.76.1423740063860; Thu, 12 Feb 2015 03:21:03 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp378585lbj; Thu, 12 Feb 2015 03:21:03 -0800 (PST) X-Received: by 10.107.165.4 with SMTP id o4mr3907742ioe.84.1423740058634; Thu, 12 Feb 2015 03:20:58 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id rq10si1081369igb.10.2015.02.12.03.20.57 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 12 Feb 2015 03:20:58 -0800 (PST) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YLrpD-0003kD-PN; Thu, 12 Feb 2015 11:20:51 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YLrpD-0003k6-4l for edk2-devel@lists.sourceforge.net; Thu, 12 Feb 2015 11:20:51 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.192.171 as permitted sender) client-ip=209.85.192.171; envelope-from=ard.biesheuvel@linaro.org; helo=mail-pd0-f171.google.com; Received: from mail-pd0-f171.google.com ([209.85.192.171]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YLrpC-0004k0-8z for edk2-devel@lists.sourceforge.net; Thu, 12 Feb 2015 11:20:51 +0000 Received: by pdjy10 with SMTP id y10so11298085pdj.13 for ; Thu, 12 Feb 2015 03:20:44 -0800 (PST) X-Received: by 10.70.132.71 with SMTP id os7mr5716299pdb.94.1423740044615; Thu, 12 Feb 2015 03:20:44 -0800 (PST) Received: from ards-macbook-pro.local ([210.177.145.249]) by mx.google.com with ESMTPSA id n4sm3554887pdl.12.2015.02.12.03.20.41 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Feb 2015 03:20:44 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, olivier.martin@arm.com, lersek@redhat.com, roy.franz@linaro.org, leif.lindholm@linaro.org, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, anthony.perard@citrix.com, xen-devel@lists.xen.org, julien.grall@linaro.org, jordan.l.justen@intel.com, michael.d.kinney@intel.com, feng.tian@intel.com Date: Thu, 12 Feb 2015 19:19:08 +0800 Message-Id: <1423739961-5945-17-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1423739961-5945-1-git-send-email-ard.biesheuvel@linaro.org> References: <1423739961-5945-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1YLrpC-0004k0-8z Subject: [edk2] [PATCH v4 16/29] Ovmf/Xen: fix pointer to int cast in XenBusDxe X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On ARM, xen_pfn_t is 64 bits but the size of a pointer is only 32 bits, so casting between them needs to go via (UINTN). Also move the xen_pfn_t cast outside the shift so that we can avoid shifting 64-bit quantities on 32-bit architectures, which may require runtime library support. Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Stefano Stabellini Reviewed-by: Laszlo Ersek Signed-off-by: Ard Biesheuvel --- OvmfPkg/XenBusDxe/GrantTable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/XenBusDxe/GrantTable.c b/OvmfPkg/XenBusDxe/GrantTable.c index 37d3bf786c64..8405edc51bc4 100644 --- a/OvmfPkg/XenBusDxe/GrantTable.c +++ b/OvmfPkg/XenBusDxe/GrantTable.c @@ -160,7 +160,7 @@ XenGrantTableInit ( Parameters.domid = DOMID_SELF; Parameters.idx = Index; Parameters.space = XENMAPSPACE_grant_table; - Parameters.gpfn = (((xen_pfn_t) GrantTable) >> EFI_PAGE_SHIFT) + Index; + Parameters.gpfn = (xen_pfn_t) ((UINTN) GrantTable >> EFI_PAGE_SHIFT) + Index; ReturnCode = XenHypercallMemoryOp (Dev, XENMEM_add_to_physmap, &Parameters); if (ReturnCode != 0) { DEBUG ((EFI_D_ERROR, "Xen GrantTable, add_to_physmap hypercall error: %d\n", ReturnCode)); @@ -182,7 +182,7 @@ XenGrantTableDeinit ( for (Index = NR_GRANT_FRAMES - 1; Index >= 0; Index--) { Parameters.domid = DOMID_SELF; - Parameters.gpfn = (((xen_pfn_t) GrantTable) >> EFI_PAGE_SHIFT) + Index; + Parameters.gpfn = (xen_pfn_t) ((UINTN) GrantTable >> EFI_PAGE_SHIFT) + Index; DEBUG ((EFI_D_INFO, "Xen GrantTable, removing %X\n", Parameters.gpfn)); ReturnCode = XenHypercallMemoryOp (Dev, XENMEM_remove_from_physmap, &Parameters); if (ReturnCode != 0) {