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

Re: [PATCH v2 1/3] arm/mpu: Implement setup_mm for MPU systems


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Mon, 17 Nov 2025 13:51:36 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=qgIa7eJUcJy0L797JuXOlZcWIxafwc3mfLGn2Bbocrk=; b=d3QYYbaSoaC6Nv67HuIuAteOiYSCh3IPJzd/0LTUSzxYQbKgkgYp0HuYQUKvnyru5CoCFZLfrEVjrovoPlwZNyPwjBCM/YPzkwELVzIdL/flxwdwZ0JMOU+DL5/OvvGqmQa40lKbr1CdDCYBrY56/y9KeOkhazlzDn9Jp0ZD9ND9ZiiacW9YU8e8K54mdZRcu59EqcaU6ek53J39lry5wigT5czeyyRmYWslykJbKzow7CZI6dlh2tTZsfjuaXtPHAdo3lS82n0LCqZAVkXclhn1qZGFD+UphMI/k7PGuCU2mr11htKtAeNpff+jwNyPW+83mIWy0jDP6PsqG6sDGA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SnMPRtSv4NCr7m8Utrdm82tIQnGq+7E4acJjyr8KHZ5Qxz0ph7WPXOyNV5kn0hIIUOLLfjF+mBshcuJm6qXh+8ytGH1yiwuwCjyMhc39mpP/IW3nTOwWyIB2aSoxkKZjeiJ02Xp5AU0xAVQEiMuZLz5iSv+pkInINzcrNnxo/qMp4gyFfzUznNQEEXPeWDny4lJO2EWIL0jj9tAXycFHU7RDAGMAEyy/CifT1F3ago7A5oDm3wtyjKzlBz8zOvZXMR/ieZIpR7xlmQZrD0iiYtK585w0iwlfiasVqAHbJMzF2duIfpH4ZCrabYyRpTENKBgrt6JRJbER1Nf3aJvk0Q==
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Bertrand Marquis" <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Harry Ramsey <Harry.Ramsey@xxxxxxx>
  • Delivery-date: Mon, 17 Nov 2025 12:51:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 12/11/2025 17:06, Luca Fancellu wrote:
> Hi Michal,
> 
>>>> +void __init setup_mm(void)
>>>> +{
>>>> +    const struct membanks *banks = bootinfo_get_mem();
>>>> +    paddr_t ram_start = INVALID_PADDR;
>>>> +    paddr_t ram_end = 0;
>>>> +    paddr_t ram_size = 0;
>>>> +    unsigned int i;
>>>> +
>>>> +    init_pdx();
>>>> +
>>>> +    for ( i = 0; i < banks->nr_banks; i++ )
>>>> +    {
>>>> +        const struct membank *bank = &banks->bank[i];
>>>> +        paddr_t bank_end = bank->start + bank->size;
>>>> +
>>>> +        ram_size = ram_size + bank->size;
>>>> +        ram_start = min(ram_start, bank->start);
>>>> +        ram_end = max(ram_end, bank_end);
>>>> +    }
>>>> +
>>>> +    total_pages = ram_size >> PAGE_SHIFT;
>>>> +
>>>> +    /*
>>>> +     * On MMU systems we need some memory to allocate the page-tables 
>>>> used for
>>>> +     * the directmap mappings.  But some regions may contain memory 
>>>> already
>>>> +     * allocated for other uses (e.g. modules, reserved-memory...).
>>>> +     *
>>>> +     * On MPU systems we need to pre-reserve regions that were allocated 
>>>> for
>>>> +     * other uses (e.g. modules, reserved-memory...).
>>> I'm not sure I understand this part of the comment with regards to
>>> populate_boot_allocator(). Could you please explain?
> 
> Maybe here we should just write that on MPU system we are populating the boot 
> allocator with the
> static heap region, since static heap is mandatory for MPU.
> 
> What do you think?
The reason for the original comment was to explain why we need to call
populate_boot_allocator() that early (i.e. before setting up direct map and not
before setting up frametable). It's not about explaining why we need to populate
boot allocator because that is rather clear. In case of MPU I don't think there
is a reason for doing that early, so we might not need any reasoning.

~Michal




 


Rackspace

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