From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21FD8C2BA19 for ; Wed, 15 Apr 2020 13:38:21 +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 E746220767 for ; Wed, 15 Apr 2020 13:38:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="WOM2M1c3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E746220767 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass 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 1jOiF0-0004Kq-3F; Wed, 15 Apr 2020 13:38:10 +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 1jOiEy-0004Kk-3m for xen-devel@lists.xenproject.org; Wed, 15 Apr 2020 13:38:08 +0000 X-Inumbo-ID: 56ce3562-7f1e-11ea-8a4d-12813bfff9fa Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 56ce3562-7f1e-11ea-8a4d-12813bfff9fa; Wed, 15 Apr 2020 13:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=INowOVj9IdoeK+rq17IpDkaPC+/t5lBJg9NrTMbN+Sc=; b=WOM2M1c3XhcWq+XZJdnrN9wWXq LOpwzgUytiY4fi/vFe5qgspnAYNgcatQcb6gsSIuW6huf2rQClZrzdop3tc5RMzhiMEmg6sw3/o0q CVLSyjtpYpRvzZGRj5m7nggfVPnfVUzKzltg7X7uEekAWJqTYdUNVWmsG60cvoinpFKc=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jOiEv-000407-M3; Wed, 15 Apr 2020 13:38:05 +0000 Received: from [54.239.6.177] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jOiEv-0007Wo-DC; Wed, 15 Apr 2020 13:38:05 +0000 Subject: Re: [PATCH 06/12] xen/arm: reserve 1:1 memory for direct_map domUs To: Stefano Stabellini , xen-devel@lists.xenproject.org References: <20200415010255.10081-6-sstabellini@kernel.org> From: Julien Grall Message-ID: <5647e3b8-4ade-70e8-273c-8ee54f9614ee@xen.org> Date: Wed, 15 Apr 2020 14:38:03 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200415010255.10081-6-sstabellini@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit 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: Stefano Stabellini , Volodymyr_Babchuk@epam.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 15/04/2020 02:02, Stefano Stabellini wrote: > Use reserve_domheap_pages to implement the direct-map ranges allocation > for DomUs. > > Signed-off-by: Stefano Stabellini > --- > xen/arch/arm/domain_build.c | 37 +++++++++++++++++++++++++++++++++++-- > 1 file changed, 35 insertions(+), 2 deletions(-) > > diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c > index a2bb411568..627e0c5e8e 100644 > --- a/xen/arch/arm/domain_build.c > +++ b/xen/arch/arm/domain_build.c > @@ -198,6 +198,40 @@ fail: > return false; > } > > +static void __init reserve_memory_11(struct domain *d, > + struct kernel_info *kinfo, > + struct membank *banks, > + unsigned int nr_banks) Can we stop introduce more void function and properly return an error? > +{ > + unsigned int i, order; > + struct page_info *pg; > + > + kinfo->mem.nr_banks = 0; > + > + for ( i = 0; i < nr_banks; i++ ) > + { > + order = get_order_from_bytes(banks[i].size); > + pg = reserve_domheap_pages(d, banks[i].start, order, 0); > + if ( pg == NULL || !insert_11_bank(d, kinfo, pg, order) ) > + { > + printk(XENLOG_ERR > + "%pd: cannot reserve memory start=%#"PRIpaddr" size=%#"PRIpaddr"\n", > + d, banks[i].start, banks[i].size); > + BUG(); > + } > + } > + > + for( i = 0; i < kinfo->mem.nr_banks; i++ ) > + { > + printk("BANK[%d] %#"PRIpaddr"-%#"PRIpaddr" (%ldMB)\n", > + i, > + kinfo->mem.bank[i].start, > + kinfo->mem.bank[i].start + kinfo->mem.bank[i].size, > + /* Don't want format this as PRIpaddr (16 digit hex) */ > + (unsigned long)(kinfo->mem.bank[i].size >> 20)); > + } > +} > + > /* > * This is all pretty horrible. > * > @@ -2477,8 +2511,7 @@ static int __init construct_domU(struct domain *d, > banks[i].start, banks[i].size); > } > > - /* reserve_memory_11(d, &kinfo, &banks[0], i); */ > - BUG(); > + reserve_memory_11(d, &kinfo, &banks[0], i); If you fold this in #3 and re-order the patches then you don't need the the commented code + BUG(). > } > > rc = prepare_dtb_domU(d, &kinfo); > Cheers, -- Julien Grall