mbox series

[0/3] target/arm: MTE fixes

Message ID 20201008162155.161886-1-richard.henderson@linaro.org
Headers show
Series target/arm: MTE fixes | expand

Message

Richard Henderson Oct. 8, 2020, 4:21 p.m. UTC
One code cleanup and two bug fixes for MTE.

Vincenzo, thanks for the clear report.  Can you please run
this through your test case?


r~


Richard Henderson (3):
  target/arm: Remove redundant mmu_idx lookup
  target/arm: Fix reported EL for mte_check_fail
  target/arm: Ignore HCR_EL2.ATA when {E2H,TGE} != 11

 target/arm/internals.h  |  9 +++++----
 target/arm/helper.c     |  9 +++++----
 target/arm/mte_helper.c | 13 ++++---------
 3 files changed, 14 insertions(+), 17 deletions(-)

Comments

Vincenzo Frascino Oct. 9, 2020, 11:10 a.m. UTC | #1
On 10/8/20 5:21 PM, Richard Henderson wrote:
> The reporting in AArch64.TagCheckFail only depends on PSTATE.EL,
> and not the AccType of the operation.  There are two guest
> visible problems that affect LDTR and STTR because of this:
> 
> (1) Selecting TCF0 vs TCF1 to decide on reporting,
> (2) Report "data abort same el" not "data abort lower el".
> 
> Reported-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Tested-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

> ---
>  target/arm/mte_helper.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c
> index 734cc5ca67..153bd1e9df 100644
> --- a/target/arm/mte_helper.c
> +++ b/target/arm/mte_helper.c
> @@ -525,14 +525,10 @@ static void mte_check_fail(CPUARMState *env, uint32_t desc,
>      reg_el = regime_el(env, arm_mmu_idx);
>      sctlr = env->cp15.sctlr_el[reg_el];
>  
> -    switch (arm_mmu_idx) {
> -    case ARMMMUIdx_E10_0:
> -    case ARMMMUIdx_E20_0:
> -        el = 0;
> +    el = arm_current_el(env);
> +    if (el == 0) {
>          tcf = extract64(sctlr, 38, 2);
> -        break;
> -    default:
> -        el = reg_el;
> +    } else {
>          tcf = extract64(sctlr, 40, 2);
>      }
>  
>
Vincenzo Frascino Oct. 9, 2020, 11:11 a.m. UTC | #2
Hi Richard,

On 10/8/20 5:21 PM, Richard Henderson wrote:
> One code cleanup and two bug fixes for MTE.

> 

> Vincenzo, thanks for the clear report.  Can you please run

> this through your test case?

> 

> 


No problem, thank you for addressing the issues quickly. I did run my tests and
added my tags to the relevant patches.

> r~

> 

> 

> Richard Henderson (3):

>   target/arm: Remove redundant mmu_idx lookup

>   target/arm: Fix reported EL for mte_check_fail

>   target/arm: Ignore HCR_EL2.ATA when {E2H,TGE} != 11

> 

>  target/arm/internals.h  |  9 +++++----

>  target/arm/helper.c     |  9 +++++----

>  target/arm/mte_helper.c | 13 ++++---------

>  3 files changed, 14 insertions(+), 17 deletions(-)

> 


-- 
Regards,
Vincenzo
Peter Maydell Oct. 20, 2020, 2:35 p.m. UTC | #3
On Thu, 8 Oct 2020 at 17:21, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> One code cleanup and two bug fixes for MTE.
>
> Vincenzo, thanks for the clear report.  Can you please run
> this through your test case?
>
>
> r~
>
>
> Richard Henderson (3):
>   target/arm: Remove redundant mmu_idx lookup
>   target/arm: Fix reported EL for mte_check_fail
>   target/arm: Ignore HCR_EL2.ATA when {E2H,TGE} != 11



Applied to target-arm.next, thanks.

-- PMM