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

Re: [PATCH v3 2/7] arm/mpu: Provide access to the MPU region from the C code


  • To: Julien Grall <julien@xxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Tue, 15 Apr 2025 08:08:55 +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=xen.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=ZKGb6NygjL8lFl5nXyYcS71WTk3eOUwMF+6mEdFecqw=; b=y7WS4Il1MlEE4SmEM38T89CvLt58AM0M6vzNSI8kThU1rP5ies1Pu+doaQFU2Qff8UJuOF0ne1dsxjnGsEpFrzm0ZR1Xq1GDU+I5kPcnqX7zPPAEKKIGMj4M79MZMhbY2+h/4qYWW4tkiIbgXmQ/PlyKXI4r/jpS3qAln7LXI+hKucaejTwAlLekz/BrccOm+bdZQFEajVnba7zorwTuO1oQE6t+AHFIMATCswkZevsYT7wBJsuo/2W2nQyFXzu3LM1p7+JNuqYT0Iglm4AKecZGW8UIlLg9D6mOTB26yX6dNv7XonIqez/AgiXkxVi8n6BhhOCOi/JokkDfFhwu2g==
  • 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=ZKGb6NygjL8lFl5nXyYcS71WTk3eOUwMF+6mEdFecqw=; b=AkqUa4nQFpGw5GNoEjiwn3mIJvSX110e3hUNduBAB3dUiGW9ptfEqTAz9j1dy0FKdobS2SgUNPAPGg9h8t3fnEkFfbq/peKqgT5CEKYDYDq74PDiNkY0hIvtP4hVKEzlvM6SHfef5aRc7bBtdtwAVNNP5ubUdBBAIr3NyTrJAN4Ba6BrOmI7rAjdTNqwRC0YnraHbNWBQLH4FdK8O2HclkicQKCpcP36F4QwnMl+yBlcegW+GRVCNqCJOEXhLnPsPp4Spcwzl2Es+N3CZfkOc5EugocCUe/Z0L/tObvtvjiNB2+id/dcAUCeoQnhiLYM3OtZ2hk4gLEHJ21jyINl3Q==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=N2Nicq9j83ZjtCMZQoFgIE3oxFBVHZ10L/f3Kc3O3X1qoHrUnh+/KX+UrNbyYopnwZ8t8koLb4nr+hqFvtUxzKQKAxT7B+txW/SiICX9a8DOYcBzMRNPqQYP+B5pD3awmmCLR94RLr4ufBfsHgNd2cM5Kz5QcWOTtaewRPO2yWbuxBS6mWKdVAGoNnjHawxc0nrz2ll8OZBpLl1iy+IkyMBTThS0qQcFSd3W8QlxBcuf+q/OT0qpdXwcAgcfINhQz8A/HsXpiUurBihl/IRWUogsK9SLJhMIyZ25k6w8lodXGYF1b4pmStWBll1cJh09+Z7mWU36O76RSmb0KP5Vhg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d0Cn7p6O732AGoB43xD0EMn00kj7Dj8DvdFEB2ZqsEfVgpQHf2NfovwfvKzb6sZ+j2/+qn76ZlKS6SWTbdfOfTRip8nP4GIz3QPctpio6drPAklofOxxWSTrMHXbCpyiX2rJqSd7Hl+dBueuACrqBLosOIRn6dqvXbdq5f/BN3gw8w4X3NNdVDsZPhdvAbFiW7o8WzWgiEZZSIiAYCmhESm3ed7g3HxdZMKkbE746Q2J16PmYPYlJ/ei5M7sqNdG1VqZtMgxKgDG3C3XlhzaWSpSfe8vDTnzRF3Xa6X7H2GHmlWyh2wSfRlKrpF66SfvUkFm0r3JeWsHH0gej0jxiQ==
  • 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>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 15 Apr 2025 08:09:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHbqvIQLPZqfCHfmUu6hn1OCHotk7OjDmYAgAA5foCAAJw1AIAAgSKA
  • Thread-topic: [PATCH v3 2/7] arm/mpu: Provide access to the MPU region from the C code

Hi Julien,

>>>>  +/*
>>>> + * The following are needed for the case generators 
>>>> GENERATE_WRITE_PR_REG_CASE
>>>> + * and GENERATE_READ_PR_REG_CASE with num==0
>>>> + */
>>>> +#define PRBAR0_EL2 PRBAR_EL2
>>>> +#define PRLAR0_EL2 PRLAR_EL2
>>> 
>>> Rather than aliasing, shouldn't we just rename PR{B,L}AR_EL2 to 
>>> PR{B,L}AR0_EL2? This would the code mixing between the two.
>> PR{B,L}AR0_ELx does not exists really, the PR{B,L}AR<n>_ELx exists for 
>> n=1..15, here I’m only using this “alias” for the generator,
>> but PR{B,L}AR_EL2 are the real register.
> 
> In this case, can PR{B,L}AR0_EL2 defined in mm.c so they are not used 
> anywhere else?

So this was the case in my previous serie, but Ayan asked me to put them in
here because PRBAR_EL2 is arm64 specific, not sure now, shall we move it back
and protect it with CONFIG_ARM_64?

>>>> 
>>>>  }
>>>>  +/* Utility function to be used whenever MPU regions are modified */
>>>> +static inline void context_sync_mpu(void)
>>>> +{
>>>> +    /*
>>>> +     * ARM DDI 0600B.a, C1.7.1
>>>> +     * Writes to MPU registers are only guaranteed to be visible 
>>>> following a
>>>> +     * Context synchronization event and DSB operation.
>>> 
>>> I know we discussed about this before. I find odd that the specification 
>>> says "context synchronization event and DSB operation". At least to me, it 
>>> implies "isb + dsb" not the other way around. Has this been clarified in 
>>> newer version of the specification?
>> unfortunately no, I’m looking into the latest one (Arm® Architecture 
>> Reference Manual Supplement Armv8, for R-profile AArch64 architecture 
>> 0600B.a) but it has the same wording, however
>> I spoke internally with Cortex-R architects and they told me to use DSB+ISB
> 
> So you didn't speak with the ArmV8-R architects? Asking because we are 
> writing code for ArmV8-R (so not only Cortex-R).
> 
> In any case, I still think this is something that needs to be clarified
> in the specification. So people that don't have access to the Arm internal 
> architects know the correct sequence. Is this something you can follow-up on?

Yes I will follow up this one

Cheers,
Luca

 


Rackspace

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