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: 11165673 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1ECA7112B for ; Sun, 29 Sep 2019 15:58:02 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 00CCE217F5 for ; Sun, 29 Sep 2019 15:58:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00CCE217F5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none 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) */ From patchwork Sun Sep 29 15:56:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 11165669 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E31BA17D4 for ; Sun, 29 Sep 2019 15:58:00 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C6FCF217F5 for ; Sun, 29 Sep 2019 15:58:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6FCF217F5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none 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 1iEbYy-0002Pg-4G; Sun, 29 Sep 2019 15:56:44 +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 1iEbYw-0002PT-R7 for xen-devel@lists.xenproject.org; Sun, 29 Sep 2019 15:56:42 +0000 X-Inumbo-ID: b53c931d-e2d1-11e9-96b9-12813bfff9fa Received: from foss.arm.com (unknown [217.140.110.172]) by localhost (Halon) with ESMTP id b53c931d-e2d1-11e9-96b9-12813bfff9fa; Sun, 29 Sep 2019 15:56:33 +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 67F0D1597; Sun, 29 Sep 2019 08:56:33 -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 B69533F706; Sun, 29 Sep 2019 08:56:32 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Sun, 29 Sep 2019 16:56:27 +0100 Message-Id: <20190929155627.23493-3-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 2/2] xen/arm: domain_build: Indent correctly parameters of alloc_bank_memory() 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: Julien Grall , Stefano Stabellini , Volodymyr Babchuk MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- xen/arch/arm/domain_build.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index b791e4b512..268e074af7 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -375,9 +375,9 @@ 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, - paddr_t tot_size) + struct kernel_info *kinfo, + gfn_t sgfn, + paddr_t tot_size) { int res; struct page_info *pg;