From patchwork Mon Jan 26 19:03:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 43788 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 38C3420D5D for ; Mon, 26 Jan 2015 19:05:04 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id b6sf5298380lbj.0 for ; Mon, 26 Jan 2015 11:05:03 -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=Bbs7GwfUBTkepapViMOLaYWyhxvwEbOY75u3Ib7cJis=; b=gslX+mUKWe/owpuTNpYY0L00dcR6S6Vscr0ZHSdqwlvH2vUjO5hagZr3GxtmWnoy0u gk5d7vJn9iYJk6WH3hOvccGVEZFxUFvFOR86Fc5V3TCdtuatYyVpvZABLqfGPCQQLtz7 g+DQxVATB5jrG0O2WFsFnONTqVveNZdoB95Abp6JwJqQzmml8yWlJVzj7SwUYiz8qCRy H3uw+Wz/N3uqBuAaojW5m9iREJghWRE2tYYzzMtiOVs1xY+vbc1xpaDO02NBZqEhw6yA LKw5NFrc8acVPzZ0xEZ6jaDQRu0fALi5PCUP8rBgsk+oEf96rtpUNMl0gjDWgafIIj1E stbA== X-Gm-Message-State: ALoCoQnPt/BpibXZasrjY8mdGuNKlkoLGjGh4cxBcCTiFtMx3E+QWko5PRQoFMIXSWtRKRbVfEbp X-Received: by 10.180.87.72 with SMTP id v8mr2070430wiz.3.1422299103147; Mon, 26 Jan 2015 11:05:03 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.220.164 with SMTP id px4ls518979lac.34.gmail; Mon, 26 Jan 2015 11:05:03 -0800 (PST) X-Received: by 10.152.3.70 with SMTP id a6mr22987198laa.71.1422299102994; Mon, 26 Jan 2015 11:05:02 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id b1si9798183lab.72.2015.01.26.11.05.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:05:02 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id q1so9433203lam.2 for ; Mon, 26 Jan 2015 11:05:02 -0800 (PST) X-Received: by 10.112.52.229 with SMTP id w5mr22958021lbo.52.1422299102874; Mon, 26 Jan 2015 11:05:02 -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 h5csp870461lbj; Mon, 26 Jan 2015 11:05:02 -0800 (PST) X-Received: by 10.50.7.34 with SMTP id g2mr18275993iga.36.1422299101222; Mon, 26 Jan 2015 11:05:01 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id q66si8017361ioe.75.2015.01.26.11.05.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:05:01 -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-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YFoxv-00031J-0X; Mon, 26 Jan 2015 19:04:51 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YFoxs-000318-W2 for edk2-devel@lists.sourceforge.net; Mon, 26 Jan 2015 19:04:49 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.181 as permitted sender) client-ip=209.85.212.181; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f181.google.com; Received: from mail-wi0-f181.google.com ([209.85.212.181]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YFoxq-00077F-6J for edk2-devel@lists.sourceforge.net; Mon, 26 Jan 2015 19:04:50 +0000 Received: by mail-wi0-f181.google.com with SMTP id fb4so291572wid.2 for ; Mon, 26 Jan 2015 11:04:41 -0800 (PST) X-Received: by 10.180.101.73 with SMTP id fe9mr15841640wib.15.1422299078152; Mon, 26 Jan 2015 11:04:38 -0800 (PST) Received: from ards-macbook-pro.local ([197.129.8.190]) by mx.google.com with ESMTPSA id fo17sm15471007wjc.19.2015.01.26.11.04.35 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:37 -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 Date: Mon, 26 Jan 2015 19:03:18 +0000 Message-Id: <1422299011-2409-17-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1422299011-2409-1-git-send-email-ard.biesheuvel@linaro.org> References: <1422299011-2409-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: 1YFoxq-00077F-6J Subject: [edk2] [PATCH v2 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.215.43 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 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) {