[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 13/16] xen/arm32: setup: Move out the code to populate the boot allocator


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Tue, 24 May 2022 07:57:07 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W0qOPSP/92e9WvU4SB1dIpIgF+8Pln2gu2b2iLIzsRc=; b=Sdw/LTMWWS1L6TTowA934KiwFuXApBlTwdi3crfI9BhpJYe6ks8qVJRaRpMPlXmGk59TPODlUmtrAM4zIPCxIBb7Kqu9F++p7822YTyOAL5ObsRvQm1jKRwR/jLVZa4/VXlJsz7DsomoHkbQXEGLKx4Cq7MGA2QInX8mfc3F8kmhQwAcFp4y4IXmOqAL8LPuUZPeHOQiPjO4sykiJvmkIY6Nz17ihrVpFhCZs+3GW3AYFeBJ5SAAKdfi4uTPKaIM9vR2XLXpSVFNib8+ymOLIAhwF3ZUozIITfMcevwPfIlpLZwN/squmzcacMHa91teJBQE39DJUHBu8SpQWxmoWA==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W0qOPSP/92e9WvU4SB1dIpIgF+8Pln2gu2b2iLIzsRc=; b=Tr0CMC2AUSd3/MLMD+bBETXQeDX1igQRLMgFrLzCTPgsuqI+RBMwhxngsVbQOh1kbuoo03l1u2TxV7s1fGuyuFdZI5lbvOirFAZdHJOB39YFSpEoEau04by8D0WdBcyU/XQBF3KMo8NcAdgyH7HV5hOaUzch01Iyk4ntFfM8Pqf1JBJkBq04JlZVzEPVEUG9vy0Kva/lFvWBiDgqKLvsA22rQMo5U2ACuQiasLZs8qC3YnO9xdizd6jusjja9swyaAx7UG++k7Hq0A6yNeusWSr6pvBGBqyR6g8NGbNkF12wz/2em+p+bgjm90B/uIb329xn4Rtvq0naaslXG24Rkg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Rv8IqnQFB4cQPQZByAlCIMpXbMWBaECc5VVPRoNfdggsqdcz1ay5JrZfu9EkkxW7xE9TRDyljI/zrLh2bosq2kd4lCJhEZgHsBVYMTqUb7VgPpysGQWx/xuzJCawfiovNk9iw6kkllHpxs0jhQB3lr7KSnIUw161YemdqqRK9dHfdhskrGpuBDWwMADnRjfbZK2n+oUWU0M5QO+kkfw8LWlB53UaO6WAnn2X9fz/E4V+6PB5pa0H1ei7PHcvltvcJsWXXYiEpJ6rySyVrXhsqAsZPGbZ6rSS+NRGdeLl+ZHwHUedzFg8yX3reAndP0tHIrenLr29qxVbliJ98BKgtA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TkM5yv0S+1TT25tp/ADlXE1unjN611043EgnSM0KhABBsjB4bLn8RFHdlz+D12L/iR4IJfjYLKTUfyKw1fDoNHH1Bte8LmEgvOiH552iSo+5JS3z36D/Zpv1/cBFgtwQbpgPZ7Z5xBQHVCrf55vbscUI4DOgXT+ScAdeEVpH1L3ej1Z+9fOgQFW08BeNt1w3KX7wxGjiqn3ltas5pa1ycAS0BVDVvK1h8vRsk4JEHz5oet0pHD0ETxx3pXX9DK5KwbvYWgPuFy72IjZSPOGMDpdpPVhStui53IXalGYbKAyau0nh/c9BwHZ3eZc0Nb6VdsO3sQSTiebH2E8Z4yXXfA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 24 May 2022 07:57:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYbEM1B6bUo5tusEemzGRhWNTewq0trzOA
  • Thread-topic: [PATCH 13/16] xen/arm32: setup: Move out the code to populate the boot allocator

Hi Julien,

> On 20 May 2022, at 13:09, Julien Grall <julien@xxxxxxx> wrote:
> 
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> In a follow-up patch, we will want to populate the boot allocator
> separately for arm64. The code will end up to be very similar to the one
> on arm32. So move out the code in a new helper populate_boot_allocator().
> 
> For now the code is still protected by CONFIG_ARM_32 to avoid any build
> failure on arm64.
> 
> Take the opportunity to replace mfn_add(xen_mfn_start, xenheap_pages) with
> xenheap_mfn_end as they are equivalent.
> 
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> 
> ---
> 
>    Changes in v4:
>        - Patch added
> ---
> xen/arch/arm/setup.c | 90 +++++++++++++++++++++++++-------------------
> 1 file changed, 51 insertions(+), 39 deletions(-)
> 
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index d5d0792ed48a..3d5a2283d4ef 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -637,10 +637,58 @@ static void __init init_staticmem_pages(void)
> }
> 
> #ifdef CONFIG_ARM_32
> +/*
> + * Populate the boot allocator. All the RAM but the following regions
> + * will be added:
> + *  - Modules (e.g., Xen, Kernel)
> + *  - Reserved regions
> + *  - Xenheap
> + */
> +static void __init populate_boot_allocator(void)
> +{
> +    unsigned int i;
> +    const struct meminfo *banks = &bootinfo.mem;
> +
> +    for ( i = 0; i < banks->nr_banks; i++ )
> +    {
> +        const struct membank *bank = &banks->bank[i];
> +        paddr_t bank_end = bank->start + bank->size;
> +        paddr_t s, e;
> +
> +        s = bank->start;
> +        while ( s < bank_end )
> +        {
> +            paddr_t n = bank_end;
> +
> +            e = next_module(s, &n);
> +
> +            if ( e == ~(paddr_t)0 )
> +                e = n = bank_end;
> +
> +            /*
> +             * Module in a RAM bank other than the one which we are
> +             * not dealing with here.
> +             */
> +            if ( e > bank_end )
> +                e = bank_end;
> +
> +            /* Avoid the xenheap */
> +            if ( s < mfn_to_maddr(xenheap_mfn_end) &&
> +                 mfn_to_maddr(xenheap_mfn_start) < e )
> +            {
> +                e = mfn_to_maddr(xenheap_mfn_start);
> +                n = mfn_to_maddr(xenheap_mfn_end);
> +            }
> +
> +            fw_unreserved_regions(s, e, init_boot_pages, 0);
> +            s = n;
> +        }
> +    }
> +}
> +
> static void __init setup_mm(void)
> {
> -    paddr_t ram_start, ram_end, ram_size;
> -    paddr_t s, e;
> +    paddr_t ram_start, ram_end, ram_size, e;
>     unsigned long ram_pages;
>     unsigned long heap_pages, xenheap_pages, domheap_pages;
>     int i;
> @@ -718,43 +766,7 @@ static void __init setup_mm(void)
>     setup_xenheap_mappings((e >> PAGE_SHIFT) - xenheap_pages, xenheap_pages);
> 
>     /* Add non-xenheap memory */
> -    for ( i = 0; i < bootinfo.mem.nr_banks; i++ )
> -    {
> -        paddr_t bank_start = bootinfo.mem.bank[i].start;
> -        paddr_t bank_end = bank_start + bootinfo.mem.bank[i].size;
> -
> -        s = bank_start;
> -        while ( s < bank_end )
> -        {
> -            paddr_t n = bank_end;
> -
> -            e = next_module(s, &n);
> -
> -            if ( e == ~(paddr_t)0 )
> -            {
> -                e = n = ram_end;
> -            }
> -
> -            /*
> -             * Module in a RAM bank other than the one which we are
> -             * not dealing with here.
> -             */
> -            if ( e > bank_end )
> -                e = bank_end;
> -
> -            /* Avoid the xenheap */
> -            if ( s < mfn_to_maddr(mfn_add(xenheap_mfn_start, xenheap_pages))
> -                 && mfn_to_maddr(xenheap_mfn_start) < e )
> -            {
> -                e = mfn_to_maddr(xenheap_mfn_start);
> -                n = mfn_to_maddr(mfn_add(xenheap_mfn_start, xenheap_pages));
> -            }
> -
> -            fw_unreserved_regions(s, e, init_boot_pages, 0);
> -
> -            s = n;
> -        }
> -    }
> +    populate_boot_allocator();
> 
>     /* Frame table covers all of RAM region, including holes */
>     setup_frametable_mappings(ram_start, ram_end);
> -- 
> 2.32.0
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.