From patchwork Tue Feb 3 19:19:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 44293 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8C8B72034D for ; Tue, 3 Feb 2015 19:21:42 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id h11sf27237006wiw.1 for ; Tue, 03 Feb 2015 11:21:41 -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=Z821Ew+54xLqld78CPG9PHR+IZMSvSpP9l7qnGGdnm7wzWB5Kizwk1D8dAAy+JrpVA kVja2s3Hry4MhoA9uB1e8YZ966EYKmXCmEiaTqrthBmha0CIL3ntP+iCQJX94nDSbEzq SPRBl6KWTyFQwxALNwkociQ6FKQWBfHfakzBIRMlNYBP0aRTfR92DwArVahT/dVmXk5N pL/xMUhe87Pm2cAbxMgDrhybR4PoLDAsTE2j7B9Lnmg8nyN5E+8Que5ceaAmqKB/fsyX /NYgH0QdxwZoWOl/4LfsKS3N6SiJhDZylbbeqoOMhfv9naM3URiREpxsW4Ss8a+OjIf6 2ziA== X-Gm-Message-State: ALoCoQljYuV36ZCuMlSPbDdkY/5/BXaFjUFBfN/ImLftEZsx70NXv8WXqIlSHG5iZLey0g2jN5fA X-Received: by 10.152.87.15 with SMTP id t15mr3344207laz.9.1422991301776; Tue, 03 Feb 2015 11:21:41 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.113 with SMTP id v17ls239910lal.3.gmail; Tue, 03 Feb 2015 11:21:41 -0800 (PST) X-Received: by 10.152.37.165 with SMTP id z5mr3388889laj.88.1422991301665; Tue, 03 Feb 2015 11:21:41 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id lv1si9865749lac.49.2015.02.03.11.21.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 11:21:41 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id hv19so53987384lab.13 for ; Tue, 03 Feb 2015 11:21:41 -0800 (PST) X-Received: by 10.112.122.52 with SMTP id lp20mr20097377lbb.98.1422991301547; Tue, 03 Feb 2015 11:21:41 -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 h5csp34081lbj; Tue, 3 Feb 2015 11:21:40 -0800 (PST) X-Received: by 10.107.13.76 with SMTP id 73mr30636018ion.24.1422991298960; Tue, 03 Feb 2015 11:21:38 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id x18si6647844iod.36.2015.02.03.11.21.38 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 11:21:38 -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-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YIj2R-0000D9-Da; Tue, 03 Feb 2015 19:21:31 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YIj2Q-0000D4-Vq for edk2-devel@lists.sourceforge.net; Tue, 03 Feb 2015 19:21:30 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.52 as permitted sender) client-ip=74.125.82.52; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wg0-f52.google.com; Received: from mail-wg0-f52.google.com ([74.125.82.52]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YIj2Q-0007gn-1t for edk2-devel@lists.sourceforge.net; Tue, 03 Feb 2015 19:21:30 +0000 Received: by mail-wg0-f52.google.com with SMTP id y19so46391150wgg.11 for ; Tue, 03 Feb 2015 11:21:24 -0800 (PST) X-Received: by 10.181.13.232 with SMTP id fb8mr36892912wid.69.1422991284122; Tue, 03 Feb 2015 11:21:24 -0800 (PST) Received: from ards-macbook-pro.local (73.233.28.37.rev.vodafone.pt. [37.28.233.73]) by mx.google.com with ESMTPSA id eb7sm25860139wic.11.2015.02.03.11.21.20 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 11:21:23 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com, roy.franz@linaro.org, leif.lindholm@linaro.org, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, anthony.perard@citrix.com, christoffer.dall@linaro.org, xen-devel@lists.xen.org, ilias.biris@linaro.org, julien.grall@linaro.org Date: Tue, 3 Feb 2015 19:19:59 +0000 Message-Id: <1422991212-9257-15-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1422991212-9257-1-git-send-email-ard.biesheuvel@linaro.org> References: <1422991212-9257-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 -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1YIj2Q-0007gn-1t Subject: [edk2] [PATCH v3 14/27] 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.215.54 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) {