[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 10/45] target/arm: Drop always-true test in define_arm_vh_e2h_
From: |
Richard Henderson |
Subject: |
[PATCH v4 10/45] target/arm: Drop always-true test in define_arm_vh_e2h_redirects_aliases |
Date: |
Sat, 30 Apr 2022 22:49:52 -0700 |
The new_key field is always non-zero -- drop the if.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
v4: Drop change to crn et al.
---
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 50ad2e3e37..e5fc22bb69 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;
- 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.34.1
- [PATCH v4 26/45] target/arm: Update qemu-system-arm -cpu max to cortex-a57, (continued)
- [PATCH v4 26/45] target/arm: Update qemu-system-arm -cpu max to cortex-a57, Richard Henderson, 2022/05/01
- [PATCH v4 12/45] target/arm: Merge allocation of the cpreg and its name, Richard Henderson, 2022/05/01
- [PATCH v4 14/45] target/arm: Consolidate cpreg updates in add_cpreg_to_hashtable, Richard Henderson, 2022/05/01
- [PATCH v4 18/45] target/arm: Reformat comments in add_cpreg_to_hashtable, Richard Henderson, 2022/05/01
- [PATCH v4 39/45] target/arm: Enable FEAT_IESB for -cpu max, Richard Henderson, 2022/05/01
- [PATCH v4 34/45] target/arm: Add minimal RAS registers, Richard Henderson, 2022/05/01
- [PATCH v4 10/45] target/arm: Drop always-true test in define_arm_vh_e2h_redirects_aliases,
Richard Henderson <=
- [PATCH v4 27/45] target/arm: Set ID_DFR0.PerfMon for qemu-system-arm -cpu max, Richard Henderson, 2022/05/01
- [PATCH v4 22/45] target/arm: Merge zcr reginfo, Richard Henderson, 2022/05/01
- [PATCH v4 31/45] target/arm: Enable FEAT_Debugv8p2 for -cpu max, Richard Henderson, 2022/05/01
- [PATCH v4 24/45] target/arm: Adjust definition of CONTEXTIDR_EL2, Richard Henderson, 2022/05/01
- [PATCH v4 38/45] target/arm: Enable FEAT_RAS for -cpu max, Richard Henderson, 2022/05/01
- [PATCH v4 07/45] target/arm: Change cpreg access permissions to enum, Richard Henderson, 2022/05/01
- [PATCH v4 28/45] target/arm: Split out aa32_max_features, Richard Henderson, 2022/05/01
- [PATCH v4 33/45] target/arm: Add isar_feature_{aa64,any}_ras, Richard Henderson, 2022/05/01