From patchwork Sun Sep 29 15:56:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 174672 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6088905ill; Sun, 29 Sep 2019 08:58:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyP2+7cPRUdc+95NIjearKKSuG5hO2mSvyR6XpMLdvP/yYYkABvSk6UBTsQSbaA4/Dnguf4 X-Received: by 2002:a05:6638:681:: with SMTP id i1mr16736795jab.127.1569772686297; Sun, 29 Sep 2019 08:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569772686; cv=none; d=google.com; s=arc-20160816; b=O2o21/pUNDvtVCTp24uNAVF7H841T8AmzNLLHpFgxzVA8zPgKx6diyzTT5FowEf8Dg zQubh6gmpAkh0YuE5C/0lsv2bnogpFRGWOegcLc7VEE+QLxc7oKumxK88eFIh5d+op+s ikPlNnfk94TFy95A7CfsM+DNS6JvAWsnUJwjbvfw05ssBuX848EvetOyZPXnmuJsHP8T sxqlkC4B4uGMQ7ojEGZ+8VkPPc/KMXd0dFEwyPtXDy2LM3ow/yv+O1eBRvpFomh/WsbY 8DZSXk+QiVIhxkxp+A/KxGr4MUg1jgAfd+T5qfm/fnzNF2Id5l4W7uOYlx6eM2btyb6p IMkQ== 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:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=h4VfsarHP7iRtdS7PycbvJFEdqF2kbAjfiBA++KVgoY=; b=i0Pv2p5ck6uSojgBYGiQw9sghZJrosbOk+KHphDvy14bwFcFMxGGNR7uWirIvMrhLv /ocWmDwrhmppWJ6qJi+3im5ZS0UbM45GN+mPlkVr0Fi1JFVzPE0D85mwTbomWDy9kefp GTJ9EOMhHZcYPrOQVw4aeDh3G1IMJ2bGUpPpQH7FMIbvRX7HNvKRMh6bnRWTtuTSLA0z plVZ5k+SC0CAllVtllOYvj63KeqdhWqw8G5uOkfejB175f5DL22CRNh49+lbb/bYSsQt QR1c4qFF75NrhUWs6RcCjGNh7I5Mmx70pIzvrNPs5PzzNXjrwk3rdCzuc9OrNZwjdw0N MakA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id l24si9153689iok.118.2019.09.29.08.58.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Sep 2019 08:58:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iEbYt-0002O0-Lf; Sun, 29 Sep 2019 15:56:39 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iEbYr-0002Nu-PC for xen-devel@lists.xenproject.org; Sun, 29 Sep 2019 15:56:37 +0000 X-Inumbo-ID: b53c931c-e2d1-11e9-96b9-12813bfff9fa Received: from foss.arm.com (unknown [217.140.110.172]) by localhost (Halon) with ESMTP id b53c931c-e2d1-11e9-96b9-12813bfff9fa; Sun, 29 Sep 2019 15:56:32 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 815E51570; Sun, 29 Sep 2019 08:56:32 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B51DC3F706; Sun, 29 Sep 2019 08:56:31 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Sun, 29 Sep 2019 16:56:26 +0100 Message-Id: <20190929155627.23493-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190929155627.23493-1-julien.grall@arm.com> References: <20190929155627.23493-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-4.13 1/2] xen/arm: domain_build: Avoid implicit conversion from ULL to UL X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Julien Grall , Stefano Stabellini , Volodymyr Babchuk MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Clang 8.0 will fail to build domain_build.c on Arm32 because of the following error: domain_build.c:448:21: error: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 1090921693184 to 0 [-Werror,-Wconstant-conversion] bank_size = MIN(GUEST_RAM1_SIZE, kinfo->unassigned_mem); Arm32 is able to support more than 4GB of physical memory, so it would be theorically possible to create domian with more the 4GB of RAM. Therefore, the size of a bank may not fit in 32-bit. This can be resolved by switch the variable bank_size and the parameter tot_size to "paddr_t". Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Cc: Juergen Gross I am not aware of any users trying to allocate more than 4GB VM for 32-bit (there more it is in the dom0less path). Nonetheless, it would be best to fix it as soon as possible. Only built test it. --- xen/arch/arm/domain_build.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 337a89e518..b791e4b512 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -377,7 +377,7 @@ static void __init allocate_memory_11(struct domain *d, static bool __init allocate_bank_memory(struct domain *d, struct kernel_info *kinfo, gfn_t sgfn, - unsigned long tot_size) + paddr_t tot_size) { int res; struct page_info *pg; @@ -433,7 +433,7 @@ static bool __init allocate_bank_memory(struct domain *d, static void __init allocate_memory(struct domain *d, struct kernel_info *kinfo) { unsigned int i; - unsigned long bank_size; + paddr_t bank_size; printk(XENLOG_INFO "Allocating mappings totalling %ldMB for %pd:\n", /* Don't want format this as PRIpaddr (16 digit hex) */