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

Re: [PATCH v3 1/7] arm/mpu: Introduce MPU memory region map structure


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Mon, 14 Apr 2025 17:01:07 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • 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=30Gw0EOu8RcewQf3B3k1hxG965TJxUvi9TbFYyyZxl4=; b=ac4rQTAvEOW4LeacAWsxqxPf8hXCHezZ7oGhHlJ+Vns0BEAeKQgVSQSYsOCSA+C5eQvRcgpnpLwVIubHctZU7cA7+NM8Tw3sPyTW3pBLzESb0wlzfyMNjyJSJqOGYbFHHBYCALD02aUBGkMK7eTBcFAeFRFwZeaAAwRuxN/CZPRTZl/kS+G5KC6oiI6umnkCT2Vdnow3VJaW95CBoGO8zZS+ug4Oj6xlRnGvlfZJD5yKFxDKWx8J0KpDnCp/wvtqkcoNVyHrh6ktUmTT3UXqRTnFU92UxHe1OBmM0JHAxc/+XFmF8EDftwAL7Wxq80Lp+b2Lr1DfLsrQR6JUPN+J/A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LLqqCA2vduWnFXtHCVS1+suG9zW48ukq3bCsTFd+o+V8ZgTkAQJR1BSu17bt8QClGw/MBW2cICgU3oErAdQRoloBtz1A38niZDO7iXjimy1a9v7DHvHATBlCZ3ZAbKLswDSMt//56EJ3dW1QWhcT6bu21NsQgl1QYulf0hUDN5/K8hUEgV1KHTfSadL7Y+RciDHP1bArGga+86RJgj5slLejfapB79E6KBp8myTcPai4TeMHxRRzzk8FqrwvyY3+L6bOOL6GLm09C4WNncPQSSk+ZZAlhabHx3jDQdcxR1aUIhOOrK/mUDNzhkTIY9pz049YBCSa/itKkRnl+UQ3Xw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>
  • Delivery-date: Mon, 14 Apr 2025 15:01:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 14/04/2025 16:50, Luca Fancellu wrote:
> Hi Michal,
> 
>> On 14 Apr 2025, at 11:17, Orzel, Michal <michal.orzel@xxxxxxx> wrote:
>>
>>
>>
>> On 11/04/2025 16:56, Luca Fancellu wrote:
>>> From: Penny Zheng <Penny.Zheng@xxxxxxx>
>>>
>>> Introduce pr_t typedef which is a structure having the prbar
>>> and prlar members, each being structured as the registers of
>>> the aarch64 armv8-r architecture.
>>>
>>> Introduce the array 'xen_mpumap' that will store a view of
>>> the content of the MPU regions.
>>>
>>> Introduce MAX_MPU_REGIONS macro that uses the value of
>>> NUM_MPU_REGIONS_MASK just for clarity, because using the
>>> latter as number of elements of the xen_mpumap array might
>>> be misleading.
>> What should be the size of this array? I thought NUM_MPU_REGIONS indicates 
>> how
>> many regions there can be (i.e. 256) and this should be the size. Yet you use
>> MASK for size which is odd.
> 
> So the maximum number of regions for aarch64 armv8-r are 255, 
> MPUIR_EL2.REGION is an
> 8 bit field advertising the number of region supported.
So there can be max 255 regions. Ok.

> 
> Is it better if I use just the below?
> 
> #define MAX_MPU_REGIONS 255
If there are 255 regions, what NUM_MPU_REGIONS macro is for which stores 256?
These two macros confuse me. Or is it that by your macro you want to denote the
max region number? In that case, the macro should be named MAX_MPU_REGION_NR or
alike.

> 
>>
>>>
>>> Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
>>> Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
>>> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
>>> ---
>>> xen/arch/arm/include/asm/arm64/mpu.h | 44 ++++++++++++++++++++++++++++
>>> xen/arch/arm/include/asm/mpu.h       |  5 ++++
>>> xen/arch/arm/mpu/mm.c                |  4 +++
>>> 3 files changed, 53 insertions(+)
>>> create mode 100644 xen/arch/arm/include/asm/arm64/mpu.h
>>>
>>> diff --git a/xen/arch/arm/include/asm/arm64/mpu.h 
>>> b/xen/arch/arm/include/asm/arm64/mpu.h
>>> new file mode 100644
>>> index 000000000000..4d2bd7d7877f
>>> --- /dev/null
>>> +++ b/xen/arch/arm/include/asm/arm64/mpu.h
>>> @@ -0,0 +1,44 @@
>>> +/* SPDX-License-Identifier: GPL-2.0-only */
>>> +/*
>>> + * mpu.h: Arm Memory Protection Unit definitions for aarch64.
>> NIT: Do we really see the benefit in having such generic comments? What if 
>> you
>> add a prototype of some function here. Will it fit into a definition scope?
> 
> I can remove the comment, but I would say that if I put some function 
> prototype here
> it should be related to arm64, being this file under arm64.
Sorry, I don't see why you mention arm64 here. It is under arm64 directory, so
it's clear. I was referring to the word "definition".

~Michal




 


Rackspace

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