[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: "Orzel, Michal" <Michal.Orzel@xxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Mon, 17 Nov 2025 14:20:57 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=amd.com 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=arm.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=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=QlIPpS5/9FnSYrrAmyhu4WvPH+6rexsPF7h1Tg5kqa4=; b=jecBaVe/ZJE96+pulB80ppLHcHepXaA9UTCskImXprtPQ6nxE1qI6ZNoeBj4/ulT4B5OusC+kBIoIx4M7SHv+hilleummS0j0tJsJh1d+SqhFMeFdUrLxnpsL1AEKmvACNCoQfwudkKKYsbXSlkpAfKk66cQRBoQNU+9G3xMFJLhUvIn9oG9NhwARMYYR8Nxm5kQ359Oeh7w86+p3Xh9JOTixEkwa8jWc5g8HP7ddnsfdrNouNZsQXHfKimhMX3lYPDfvZVMnuVR5duD3DStpdhJoAOWQXpahuQOi6ctfGNOHTfBaqdu1RxDydUFceyufdejws3ezYpMc9o3YxIeaA==
  • 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=QlIPpS5/9FnSYrrAmyhu4WvPH+6rexsPF7h1Tg5kqa4=; b=iC55M7Yyg2HNHX+q9pMOz+sAEZTWK6XITw55qPmRT0lXgj8lZXo0i230/S2nU+suIbclug/Nh0ovVpXtk8uem2CQuewXG8+tQhX4gQcTCYd9fCzrkovWl6CwTfM79eRITZKsU4wEftia2fCQ8wCb3woVk9vnV43EFDnaWNKR7OXw5OI8k4m39mpIhD07TNqWMnZ3B20aazoY4mg/xhX8/q++cexgSkV/XHBgpPLOaxZzPE3b4sb7YyhxRoljFeuOyFgI6LxV0uGNlx8tuhchM/3f/QDyI45UkRpMOY/c3gXqjIU3S4cHe4wEEaBcvu6bYfRcD2jtvAq47Y4U9CT4Ow==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=HPY0HH4QMgPEUREeTyLODd+wXVatVI6nuTl0kjZ1Kwqlbr3KVG8juH2ScTlzV5pIotx95syr6Y29vMR0zehRnBsB+qZKahDlv6iYDnkw5M19STnQB0wtZDIHk9Hu+CiG0suzdk9USGP1n0uJr1nw968Ggm4zrPxdkv8NJh9Rxanemry+siP/5v4HtFEbjkNL4lzsNcDprtIfJ0du5DCbNVNATLyntaVIaXJGaxTO+VFfpRdl29iSYI6ZrnmTsDOENp9rQwC8TVIHNpLzR9U9d/zvAgxcRE/tFmOYbAj9RKAeWPbAb0kWVzm/YK9yg9in+bulptGAGI1Kc1By+ylszQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AfZM5EN/LZbDoX+8h4wE/jX3n8ni2/xVVzPN8gWS/0mx0g5FIbgSz1/YBX0Bz50er6wswbUERKidWoBKM84vRLw3bKj9rQFC4rpH/UVWezn1fnNv6CLB8sGOwi88wZu63Ak4giFGQs6/9G+cGp/sVty2qztVVXnYZGa8oa1ppY+z68Fb5UzOeYTBNXpKySJfxyLC+uAikWPv5fdv7UIT/AIOyleUgT1fkBivQP+4/roHI+6TN8aR5N10zC8fkTMZbZEBJFUkJ2myErVXCwSvUYjt7C5xUPiolyWPLe7NSJQmTzC7vdxLQyshGnqDSrwdiOJey3a38oiPUlMXKdHdQQ==
  • 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>, 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 14:21:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHcU9GZpx9Ewja+9EW1e1HUZJtzELTvMOuAgAAD+oCAB6VIAIAAGNOA
  • Thread-topic: [PATCH v2 1/3] arm/mpu: Implement setup_mm for MPU systems

HI Michal,

> On 17 Nov 2025, at 12:51, Orzel, Michal <Michal.Orzel@xxxxxxx> wrote:
> 
> 
> 
> 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.

ok sounds good, we can avoid mentioning the MPU section all together.

Cheers,
Luca




 


Rackspace

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