diff mbox series

[v2,1/9] target/arm: Replicate TBI/TBID bits for single range regimes

Message ID 20200302175829.2183-2-richard.henderson@linaro.org
State Superseded
Headers show
Series target/arm: Misc cleanups surrounding TBI | expand

Commit Message

Richard Henderson March 2, 2020, 5:58 p.m. UTC
Replicate the single TBI bit from TCR_EL2 and TCR_EL3 so that
we can unconditionally use pointer bit 55 to index into our
composite TBI1:TBI0 field.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/arm/helper.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Philippe Mathieu-Daudé March 2, 2020, 11:51 p.m. UTC | #1
On 3/2/20 6:58 PM, Richard Henderson wrote:
> Replicate the single TBI bit from TCR_EL2 and TCR_EL3 so that

> we can unconditionally use pointer bit 55 to index into our

> composite TBI1:TBI0 field.

> 

> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

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

>   1 file changed, 4 insertions(+), 2 deletions(-)

> 

> diff --git a/target/arm/helper.c b/target/arm/helper.c

> index 6be9ffa09e..37ffe06c05 100644

> --- a/target/arm/helper.c

> +++ b/target/arm/helper.c

> @@ -10316,7 +10316,8 @@ static int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx)

>       } else if (mmu_idx == ARMMMUIdx_Stage2) {

>           return 0; /* VTCR_EL2 */

>       } else {

> -        return extract32(tcr, 20, 1);

> +        /* Replicate the single TBI bit so we always have 2 bits.  */

> +        return extract32(tcr, 20, 1) * 3;

>       }

>   }

>   

> @@ -10327,7 +10328,8 @@ static int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx)

>       } else if (mmu_idx == ARMMMUIdx_Stage2) {

>           return 0; /* VTCR_EL2 */

>       } else {

> -        return extract32(tcr, 29, 1);

> +        /* Replicate the single TBID bit so we always have 2 bits.  */

> +        return extract32(tcr, 29, 1) * 3;

>       }

>   }

>   

> 


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 6be9ffa09e..37ffe06c05 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -10316,7 +10316,8 @@  static int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx)
     } else if (mmu_idx == ARMMMUIdx_Stage2) {
         return 0; /* VTCR_EL2 */
     } else {
-        return extract32(tcr, 20, 1);
+        /* Replicate the single TBI bit so we always have 2 bits.  */
+        return extract32(tcr, 20, 1) * 3;
     }
 }
 
@@ -10327,7 +10328,8 @@  static int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx)
     } else if (mmu_idx == ARMMMUIdx_Stage2) {
         return 0; /* VTCR_EL2 */
     } else {
-        return extract32(tcr, 29, 1);
+        /* Replicate the single TBID bit so we always have 2 bits.  */
+        return extract32(tcr, 29, 1) * 3;
     }
 }