[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/23] target/arm: Drop always-true test in define_arm_vh_e2h_redi
From: |
Peter Maydell |
Subject: |
[PULL 11/23] target/arm: Drop always-true test in define_arm_vh_e2h_redirects_aliases |
Date: |
Thu, 5 May 2022 10:11:35 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
The new_key field is always non-zero -- drop the if.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20220501055028.646596-11-richard.henderson@linaro.org
[PMM: reinstated dropped PL3_RW mask]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/helper.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 50ad2e3e37b..70dc1482dd7 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -5914,7 +5914,9 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU
*cpu)
for (i = 0; i < ARRAY_SIZE(aliases); i++) {
const struct E2HAlias *a = &aliases[i];
- ARMCPRegInfo *src_reg, *dst_reg;
+ ARMCPRegInfo *src_reg, *dst_reg, *new_reg;
+ uint32_t *new_key;
+ bool ok;
if (a->feature && !a->feature(&cpu->isar)) {
continue;
@@ -5933,19 +5935,16 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU
*cpu)
g_assert(src_reg->opaque == NULL);
/* Create alias before redirection so we dup the right data. */
- if (a->new_key) {
- ARMCPRegInfo *new_reg = g_memdup(src_reg, sizeof(ARMCPRegInfo));
- uint32_t *new_key = g_memdup(&a->new_key, sizeof(uint32_t));
- bool ok;
+ new_reg = g_memdup(src_reg, sizeof(ARMCPRegInfo));
+ new_key = g_memdup(&a->new_key, sizeof(uint32_t));
- new_reg->name = a->new_name;
- new_reg->type |= ARM_CP_ALIAS;
- /* Remove PL1/PL0 access, leaving PL2/PL3 R/W in place. */
- new_reg->access &= PL2_RW | PL3_RW;
+ new_reg->name = a->new_name;
+ new_reg->type |= ARM_CP_ALIAS;
+ /* Remove PL1/PL0 access, leaving PL2/PL3 R/W in place. */
+ new_reg->access &= PL2_RW | PL3_RW;
- ok = g_hash_table_insert(cpu->cp_regs, new_key, new_reg);
- g_assert(ok);
- }
+ ok = g_hash_table_insert(cpu->cp_regs, new_key, new_reg);
+ g_assert(ok);
src_reg->opaque = dst_reg;
src_reg->orig_readfn = src_reg->readfn ?: raw_read;
--
2.25.1
- [PULL 02/23] target/arm: Split out cpregs.h, (continued)
- [PULL 02/23] target/arm: Split out cpregs.h, Peter Maydell, 2022/05/05
- [PULL 05/23] target/arm: Make some more cpreg data static const, Peter Maydell, 2022/05/05
- [PULL 06/23] target/arm: Reorg ARMCPRegInfo type field bits, Peter Maydell, 2022/05/05
- [PULL 08/23] target/arm: Change cpreg access permissions to enum, Peter Maydell, 2022/05/05
- [PULL 07/23] target/arm: Avoid bare abort() or assert(0), Peter Maydell, 2022/05/05
- [PULL 10/23] target/arm: Name CPSecureState type, Peter Maydell, 2022/05/05
- [PULL 09/23] target/arm: Name CPState type, Peter Maydell, 2022/05/05
- [PULL 04/23] target/arm: Replace sentinels with ARRAY_SIZE in cpregs.h, Peter Maydell, 2022/05/05
- [PULL 13/23] target/arm: Merge allocation of the cpreg and its name, Peter Maydell, 2022/05/05
- [PULL 15/23] target/arm: Consolidate cpreg updates in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 11/23] target/arm: Drop always-true test in define_arm_vh_e2h_redirects_aliases,
Peter Maydell <=
- [PULL 17/23] target/arm: Hoist isbanked computation in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 18/23] target/arm: Perform override check early in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 19/23] target/arm: Reformat comments in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 12/23] target/arm: Store cpregs key in the hash table directly, Peter Maydell, 2022/05/05
- [PULL 14/23] target/arm: Hoist computation of key in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 16/23] target/arm: Use bool for is64 and ns in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 20/23] target/arm: Remove HOST_BIG_ENDIAN ifdef in add_cpreg_to_hashtable, Peter Maydell, 2022/05/05
- [PULL 22/23] target/arm: Add isar_feature_{aa64,any}_ras, Peter Maydell, 2022/05/05
- [PULL 23/23] target/arm: read access to performance counters from EL0, Peter Maydell, 2022/05/05
- [PULL 21/23] target/arm: Add isar predicates for FEAT_Debugv8p2, Peter Maydell, 2022/05/05