[PATCH 07/20] target/arm: Convert v8m_is_sau_exempt to access_perm

Richard Henderson posted 20 patches 5 months, 1 week ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>
There is a newer version of this series
[PATCH 07/20] target/arm: Convert v8m_is_sau_exempt to access_perm
Posted by Richard Henderson 5 months, 1 week ago
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/ptw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index a11df31b18..78a9c21fab 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -2754,14 +2754,14 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
 }
 
 static bool v8m_is_sau_exempt(CPUARMState *env,
-                              uint32_t address, MMUAccessType access_type)
+                              uint32_t address, unsigned access_perm)
 {
     /*
      * The architecture specifies that certain address ranges are
      * exempt from v8M SAU/IDAU checks.
      */
     return
-        (access_type == MMU_INST_FETCH && m_is_system_region(env, address)) ||
+        ((access_perm & PAGE_EXEC) && m_is_system_region(env, address)) ||
         (address >= 0xe0000000 && address <= 0xe0002fff) ||
         (address >= 0xe000e000 && address <= 0xe000efff) ||
         (address >= 0xe002e000 && address <= 0xe002efff) ||
@@ -2798,7 +2798,7 @@ void v8m_security_lookup(CPUARMState *env, uint32_t address,
         return;
     }
 
-    if (idau_exempt || v8m_is_sau_exempt(env, address, access_type)) {
+    if (idau_exempt || v8m_is_sau_exempt(env, address, 1 << access_type)) {
         sattrs->ns = !is_secure;
         return;
     }
-- 
2.43.0
Re: [PATCH 07/20] target/arm: Convert v8m_is_sau_exempt to access_perm
Posted by Peter Maydell 5 months, 1 week ago
On Mon, 7 Jul 2025 at 21:58, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  target/arm/ptw.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/target/arm/ptw.c b/target/arm/ptw.c
> index a11df31b18..78a9c21fab 100644
> --- a/target/arm/ptw.c
> +++ b/target/arm/ptw.c
> @@ -2754,14 +2754,14 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
>  }
>
>  static bool v8m_is_sau_exempt(CPUARMState *env,
> -                              uint32_t address, MMUAccessType access_type)
> +                              uint32_t address, unsigned access_perm)
>  {
>      /*
>       * The architecture specifies that certain address ranges are
>       * exempt from v8M SAU/IDAU checks.
>       */
>      return
> -        (access_type == MMU_INST_FETCH && m_is_system_region(env, address)) ||
> +        ((access_perm & PAGE_EXEC) && m_is_system_region(env, address)) ||
>          (address >= 0xe0000000 && address <= 0xe0002fff) ||
>          (address >= 0xe000e000 && address <= 0xe000efff) ||

This also is conflating "don't check access permissions" with
"access is data, not insn".

-- PMM
Re: [PATCH 07/20] target/arm: Convert v8m_is_sau_exempt to access_perm
Posted by Richard Henderson 5 months, 1 week ago
On 7/10/25 06:01, Peter Maydell wrote:
> On Mon, 7 Jul 2025 at 21:58, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>   target/arm/ptw.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/target/arm/ptw.c b/target/arm/ptw.c
>> index a11df31b18..78a9c21fab 100644
>> --- a/target/arm/ptw.c
>> +++ b/target/arm/ptw.c
>> @@ -2754,14 +2754,14 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
>>   }
>>
>>   static bool v8m_is_sau_exempt(CPUARMState *env,
>> -                              uint32_t address, MMUAccessType access_type)
>> +                              uint32_t address, unsigned access_perm)
>>   {
>>       /*
>>        * The architecture specifies that certain address ranges are
>>        * exempt from v8M SAU/IDAU checks.
>>        */
>>       return
>> -        (access_type == MMU_INST_FETCH && m_is_system_region(env, address)) ||
>> +        ((access_perm & PAGE_EXEC) && m_is_system_region(env, address)) ||
>>           (address >= 0xe0000000 && address <= 0xe0002fff) ||
>>           (address >= 0xe000e000 && address <= 0xe000efff) ||
> 
> This also is conflating "don't check access permissions" with
> "access is data, not insn".

Yes.  We don't (yet) have a need for "don't check access permissions" for m-profile.

Talking a-profile for a moment, in order to match the pseudocode we would have the 
AccessType_* enumerators.  The two relevant enumerators are AccessType_IFETCH and 
AccessType_AT, which means that all of the probing that we want to do is !IFETCH.


r~