From patchwork Tue Feb 24 18:02:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 44971 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 494F62029F for ; Tue, 24 Feb 2015 18:06:11 +0000 (UTC) Received: by labgm9 with SMTP id gm9sf18345489lab.2 for ; Tue, 24 Feb 2015 10:06:10 -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:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=NeQYdcDYus+fynC6dksZ2P4Q8EFGt3v0cFgq5mqayZ0=; b=KvCFHzQm7LU4s/SM0Kxz5ugpwn2esiFehYid9324OYN3vJ3jkp2gaxJ9ybPP9dpilW XBfit42e4XI2HRuYBOnMbWhrPb6cL2/C3y3G7RcqAbCxLjCfzngpzP37baTkFG79XRx9 Ebgc2V6uDe9uYXWaJ8/yF9m2KDdvvhEdYhdRuQ9r8w/imZIFEk8lF1Tduei4CoHnHv5G iHLUoJurQK02hi+AX67JIFyQx5WJaAvD/YYjn4zgQepfuxNLrBfzNot6aiyEOPPJ60nc W6nMGxG45kSXhgshSiwC576ldOA+Qu2de7r95QbnDl4ZQmc31c1ujB5LX/C/uT9W5/lH zUTA== X-Gm-Message-State: ALoCoQmhzZlu75fWpNLnfngFXxCYT2qenD32PzGDNBDjpbmwnT1lN7j9DnvEcHrVoqDDwuQFK44w X-Received: by 10.112.174.36 with SMTP id bp4mr2298644lbc.15.1424801170151; Tue, 24 Feb 2015 10:06:10 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.140 with SMTP id jo12ls716396lab.19.gmail; Tue, 24 Feb 2015 10:06:10 -0800 (PST) X-Received: by 10.112.134.167 with SMTP id pl7mr15129805lbb.63.1424801170013; Tue, 24 Feb 2015 10:06:10 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id f6si11244007lbd.92.2015.02.24.10.06.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 10:06:10 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbvn10 with SMTP id n10so26737151lbv.6 for ; Tue, 24 Feb 2015 10:06:09 -0800 (PST) X-Received: by 10.112.14.196 with SMTP id r4mr15511126lbc.86.1424801169920; Tue, 24 Feb 2015 10:06:09 -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 h5csp2079001lbj; Tue, 24 Feb 2015 10:06:09 -0800 (PST) X-Received: by 10.52.108.71 with SMTP id hi7mr18048418vdb.87.1424801163528; Tue, 24 Feb 2015 10:06:03 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id kx7si19112031vdb.107.2015.02.24.10.06.02 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 24 Feb 2015 10:06:03 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YQJr8-0002eD-Kg; Tue, 24 Feb 2015 18:05:14 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YQJr6-0002az-Rb for xen-devel@lists.xen.org; Tue, 24 Feb 2015 18:05:12 +0000 Received: from [193.109.254.147] by server-15.bemta-14.messagelabs.com id 6C/AD-02770-85DBCE45; Tue, 24 Feb 2015 18:05:12 +0000 X-Env-Sender: ard.biesheuvel@linaro.org X-Msg-Ref: server-2.tower-27.messagelabs.com!1424801111!12554746!1 X-Originating-IP: [209.85.212.178] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28295 invoked from network); 24 Feb 2015 18:05:11 -0000 Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by server-2.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 24 Feb 2015 18:05:11 -0000 Received: by mail-wi0-f178.google.com with SMTP id em10so27173834wid.5 for ; Tue, 24 Feb 2015 10:05:11 -0800 (PST) X-Received: by 10.194.186.200 with SMTP id fm8mr35031903wjc.138.1424801111205; Tue, 24 Feb 2015 10:05:11 -0800 (PST) Received: from ards-macbook-pro.lan (bl11-65-113.dsl.telepac.pt. [85.244.65.113]) by mx.google.com with ESMTPSA id w8sm12792521wja.4.2015.02.24.10.05.05 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Feb 2015 10:05:10 -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 Date: Tue, 24 Feb 2015 18:02:57 +0000 Message-Id: <1424800990-15777-17-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1424800990-15777-1-git-send-email-ard.biesheuvel@linaro.org> References: <1424800990-15777-1-git-send-email-ard.biesheuvel@linaro.org> Cc: wei.liu2@citrix.com, Ard Biesheuvel Subject: [Xen-devel] [PATCH v5 16/29] Ovmf/Xen: fix pointer to int cast in XenBusDxe X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org 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.176 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 List-Archive: 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 Reviewed-by: Anthony PERARD 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) {