[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/9] arm/mpu: Provide a constructor for pr_t type
- To: Ayan Kumar Halder <ayankuma@xxxxxxx>
- From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
- Date: Tue, 4 Mar 2025 12:25:01 +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=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=PUXASoFvT8QNz1iYsJkSzJtF9FnIbYk6CIDd1DEbxf4=; b=cyzygds+YjCEIdXJ+cjgCXCPX/3eVSU+YymXEHe1VBw8l+SFXwb2RSYMZzXC7e/J24tvH1ZTgCVr9DGqqLSnrSs7W3//S4geIba1LAckPJCo5tdB1Lj5PUQ5cryNIKE+oUvAaxc+BVawIjRXfBzp9bwnQp5ScqEMq7KKoHLcsXBANNZlBdbZX2hdvXANFmdlBw71iWEbHzEVf4tGFtEMyz32TBxLIyS955U5B+A9SgYX92vvfAi+QO45Tv6ma959i545xq5grnZWF97aAobhAnjLX2RWvHzA5reg7nT4ZugMRqxMLaZpuOs8CY/uxHaMLkL4BT8AQftEXgsuin7MMA==
- 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=PUXASoFvT8QNz1iYsJkSzJtF9FnIbYk6CIDd1DEbxf4=; b=OWMkqNuiELZ/AsLkvxxnCvQF0n18BkRIL1cN3hSrDQ2kOQ+X9JBdDvCBGlGrvBLs6wQ5ig00GdSrSV4sjrsoS7epEmUPyiW4UTBdp87+i3HceSeXKXhE1B93B/g11SmR734VtHx/iHJkBu4TFWKeGATc8HGVo5Wr4bMjh8rlS+RWuSJuPkEDLN7tZjkAlTCdQ3Ly/bswG44T5KD/DfnbXr6LLUGRKVpc/EmAsFlVBnzCpW0/gnoQGdqucLgr7tm5TV7sTzOpIEI8U8gcenqwv1Uwrs3zEFBOt+J72JpCTndwtuc4XyLgZqRJRBYuCsQM4ZFcjLtknnOuGGLUKcnGTA==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=b/T969pjixUMrXguOMJ+tVOvzMxUxikwvtldPBu9+yUKSbKRQavaznwpjXd0FOitG9wYpGVhxOQOvniuFcjEB78AgFgCLj1jm1WVdThrZvx3wfuyOytBU2ifQ4396H13MSwp3PGBNe7VUfFPW8OzHUcxxXRAcII1GVccDD4ku6WmOJ0O36uoj33sR9u5DwHTm/EkV/a48mLuNECGhGpDn329BKTIkU6hqjiR9UmBaUaYcwwn/196bS1EOost+MBbKNSblrpBB4v7h93fEinrRRJb77anCWF2mRHliqZ+nHbCqKeOgcq+e4c92ByXQDJeRBRqUr0mBTSMdEy+KqidRg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=miHSg7AkyhePTt6ga3YE0J47cTakNkC/xJ1WjaclW9nuab6jVni8D4MdwaICs1kVLKz9VxmlTRfFmv0RkK+tcLYI6LAO9eQ4ivE/Qc8mE7E662Sa6fch1pbWE8yjNnST8tKPbb8wbNTw1wKVu1RoqFQyvtYlnD5sYuOD/Wx6Kqgrq43+m4iBD+KHGodF5EnwGYfY12pHOiTyTO1lVf19mJOHQ6q1Km8xitwOcbXrf23mNzMN/b/DkEixiclZ67wo5ywRtIdLoS6dVRETlUF+sQmlAxeL3VQEoaqGgFetHaygnMPvYvvM7mVC1CxkbOmtkzrPX4Gau0iKqzZuJdlnOg==
- 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>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Tue, 04 Mar 2025 12:25:39 +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: AQHbifx0LOex0WH/OkCl0iSW7rfY57Ni4d+AgAAK6oA=
- Thread-topic: [PATCH 6/9] arm/mpu: Provide a constructor for pr_t type
> On 4 Mar 2025, at 11:45, Ayan Kumar Halder <ayankuma@xxxxxxx> wrote:
>
> Hi Luca,
>
> On 28/02/2025 16:18, Luca Fancellu wrote:
>> CAUTION: This message has originated from an External Source. Please use
>> proper judgment and caution when opening attachments, clicking links, or
>> responding to this email.
>>
>>
>> Provide a function that creates a pr_t object from a memory
>> range and some attributes.
>>
>> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
>> ---
>> xen/arch/arm/include/asm/arm64/mpu.h | 15 ++++++
>> xen/arch/arm/include/asm/mpu/mm.h | 3 ++
>> xen/arch/arm/mpu/mm.c | 73 ++++++++++++++++++++++++++++
>> 3 files changed, 91 insertions(+)
>>
>> diff --git a/xen/arch/arm/include/asm/arm64/mpu.h
>> b/xen/arch/arm/include/asm/arm64/mpu.h
>> index 3a09339818a0..dce77da60110 100644
>> --- a/xen/arch/arm/include/asm/arm64/mpu.h
>> +++ b/xen/arch/arm/include/asm/arm64/mpu.h
>> @@ -17,6 +17,21 @@
>>
>> #define MAX_MPU_REGIONS NUM_MPU_REGIONS_MASK
>>
>> +/* Access permission attributes. */
>> +/* Read/Write at EL2, No Access at EL1/EL0. */
>> +#define AP_RW_EL2 0x0
> This is common as well between arm64 and arm32.
>> +
>> +/*
>> + * Excute never.
>> + * Stage 1 EL2 translation regime.
>> + * XN[1] determines whether execution of the instruction fetched from the
>> MPU
>> + * memory region is permitted.
>> + * Stage 2 EL1/EL0 translation regime.
>> + * XN[0] determines whether execution of the instruction fetched from the
>> MPU
>> + * memory region is permitted.
>> + */
>> +#define XN_ENABLED 0x2
>
> This seems incorrect.
>
> As per ARM DDI 0600A.d ID120821, G1.3.19 PRBAR<n>_EL2 (armv8 R64 supplement)
>
> 0b00 Execution of instructions fetched from the region is permitted.
>
> 0b01 Execution of instructions fetched from the region is not permitted.
>
> This holds true for 32-bit as well (except for the fact that XN is denoted by
> 1-bit).
>
> So the correct definition is
>
> #define XN_ENABLED 0x0
>
> And this is common between arm32/64 , thus it can be moved to common file as
> well.
Ok maybe my understanding is wrong, but from the specifications:
XN, bits [1:0]
Execute Never. For
• Stage 1 EL2 translation regime and
• Stage 2 EL1&0 translation regime when FEAT_XNX is not implemented
XN[1] determines whether execution of the instructions fetched from the MPU
memory region is
permitted. In this case, XN[0] is RES0
For stage 2 EL1&0 translation regime when FEAT_XNX is implemented, the behavior
of XN[1:0]
is same as that defined by VMSAv8-64 for EL1&0 stage 2 translation table
XN[1:0],bits[54:53]
field in Armv8-A architecture.
0b00 Execution of instructions fetched from the region is permitted.
0b01 Execution of instructions fetched from the region is not permitted.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
So my understanding is that Stage 1 EL2 regime XN=1 means execution of
instructions fetched
from the region is not permitted, and when that bit is 1, the XN[0] is RES0
Cheers,
Luca
|