From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
To: qemu-devel@nongnu.org, Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-arm@nongnu.org
Subject: Re: [PATCH 18/61] target/arm: Remove cp argument to ENCODE_AA64_CP_REG
Date: Fri, 29 Aug 2025 10:36:29 +0300 [thread overview]
Message-ID: <t1qvyy.1vq9bulelbzvf@linaro.org> (raw)
In-Reply-To: <20250827010453.4059782-23-richard.henderson@linaro.org>
On Wed, 27 Aug 2025 04:04, Richard Henderson <richard.henderson@linaro.org> wrote:
>All invocations were required to pass the same value,
>CP_REG_ARM64_SYSREG_CP. Bake that in to the result directly.
>Remove CP_REG_ARM64_SYSREG_CP as unused.
>
>Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>---
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> target/arm/cpregs.h | 5 ++---
> target/arm/kvm-consts.h | 3 ---
> target/arm/helper.c | 11 +++++------
> target/arm/hvf/hvf.c | 3 +--
> target/arm/tcg/translate-a64.c | 6 ++----
> 5 files changed, 10 insertions(+), 18 deletions(-)
>
>diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
>index 7ebe404163..95b0b9c78e 100644
>--- a/target/arm/cpregs.h
>+++ b/target/arm/cpregs.h
>@@ -187,9 +187,8 @@ enum {
> ((is64) << CP_REG_AA32_64BIT_SHIFT) | \
> ((cp) << 16) | ((crn) << 11) | ((crm) << 7) | ((opc1) << 3) | (opc2))
>
>-#define ENCODE_AA64_CP_REG(cp, crn, crm, op0, op1, op2) \
>- (CP_REG_AA64_MASK | \
>- ((cp) << CP_REG_ARM_COPROC_SHIFT) | \
>+#define ENCODE_AA64_CP_REG(crn, crm, op0, op1, op2) \
>+ (CP_REG_AA64_MASK | CP_REG_ARM64_SYSREG | \
> ((op0) << CP_REG_ARM64_SYSREG_OP0_SHIFT) | \
> ((op1) << CP_REG_ARM64_SYSREG_OP1_SHIFT) | \
> ((crn) << CP_REG_ARM64_SYSREG_CRN_SHIFT) | \
>diff --git a/target/arm/kvm-consts.h b/target/arm/kvm-consts.h
>index fdb305eea1..54ae5da7ce 100644
>--- a/target/arm/kvm-consts.h
>+++ b/target/arm/kvm-consts.h
>@@ -160,9 +160,6 @@ MISMATCH_CHECK(QEMU_KVM_ARM_TARGET_CORTEX_A53, KVM_ARM_TARGET_CORTEX_A53);
> #define CP_REG_ARM64_SYSREG_OP2_MASK 0x0000000000000007
> #define CP_REG_ARM64_SYSREG_OP2_SHIFT 0
>
>-/* No kernel define but it's useful to QEMU */
>-#define CP_REG_ARM64_SYSREG_CP (CP_REG_ARM64_SYSREG >> CP_REG_ARM_COPROC_SHIFT)
>-
> MISMATCH_CHECK(CP_REG_ARM64, KVM_REG_ARM64);
> MISMATCH_CHECK(CP_REG_ARM_COPROC_MASK, KVM_REG_ARM_COPROC_MASK);
> MISMATCH_CHECK(CP_REG_ARM_COPROC_SHIFT, KVM_REG_ARM_COPROC_SHIFT);
>diff --git a/target/arm/helper.c b/target/arm/helper.c
>index 268cad905f..93cae888e2 100644
>--- a/target/arm/helper.c
>+++ b/target/arm/helper.c
>@@ -4527,7 +4527,7 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu)
> };
>
> #define K(op0, op1, crn, crm, op2) \
>- ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, crn, crm, op0, op1, op2)
>+ ENCODE_AA64_CP_REG(crn, crm, op0, op1, op2)
>
> static const struct E2HAlias aliases[] = {
> { K(3, 0, 1, 0, 0), K(3, 4, 1, 0, 0), K(3, 5, 1, 0, 0),
>@@ -7297,10 +7297,9 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
> * in their AArch64 view (the .cp value may be non-zero for the
> * benefit of the AArch32 view).
> */
>- if (cp == 0 || r->state == ARM_CP_STATE_BOTH) {
>- cp = CP_REG_ARM64_SYSREG_CP;
>- }
>- key = ENCODE_AA64_CP_REG(cp, r->crn, crm, r->opc0, opc1, opc2);
>+ assert(cp == 0 || r->state == ARM_CP_STATE_BOTH);
>+ cp = 0;
>+ key = ENCODE_AA64_CP_REG(r->crn, crm, r->opc0, opc1, opc2);
> break;
> default:
> g_assert_not_reached();
>@@ -7525,7 +7524,7 @@ void define_one_arm_cp_reg(ARMCPU *cpu, const ARMCPRegInfo *r)
> }
> break;
> case ARM_CP_STATE_AA64:
>- assert(r->cp == 0 || r->cp == CP_REG_ARM64_SYSREG_CP);
>+ assert(r->cp == 0);
> break;
> default:
> g_assert_not_reached();
>diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
>index 9dffa99ed1..af03fc7fc1 100644
>--- a/target/arm/hvf/hvf.c
>+++ b/target/arm/hvf/hvf.c
>@@ -1124,8 +1124,7 @@ static bool is_id_sysreg(uint32_t reg)
>
> static uint32_t hvf_reg2cp_reg(uint32_t reg)
> {
>- return ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP,
>- (reg >> SYSREG_CRN_SHIFT) & SYSREG_CRN_MASK,
>+ return ENCODE_AA64_CP_REG((reg >> SYSREG_CRN_SHIFT) & SYSREG_CRN_MASK,
> (reg >> SYSREG_CRM_SHIFT) & SYSREG_CRM_MASK,
> (reg >> SYSREG_OP0_SHIFT) & SYSREG_OP0_MASK,
> (reg >> SYSREG_OP1_SHIFT) & SYSREG_OP1_MASK,
>diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
>index dbf47595db..743c5a10e1 100644
>--- a/target/arm/tcg/translate-a64.c
>+++ b/target/arm/tcg/translate-a64.c
>@@ -2466,8 +2466,7 @@ static void handle_sys(DisasContext *s, bool isread,
> unsigned int op0, unsigned int op1, unsigned int op2,
> unsigned int crn, unsigned int crm, unsigned int rt)
> {
>- uint32_t key = ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP,
>- crn, crm, op0, op1, op2);
>+ uint32_t key = ENCODE_AA64_CP_REG(crn, crm, op0, op1, op2);
> const ARMCPRegInfo *ri = get_arm_cp_reginfo(s->cp_regs, key);
> bool need_exit_tb = false;
> bool nv_trap_to_el2 = false;
>@@ -2603,8 +2602,7 @@ static void handle_sys(DisasContext *s, bool isread,
> * We don't use the EL1 register's access function, and
> * fine-grained-traps on EL1 also do not apply here.
> */
>- key = ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP,
>- crn, crm, op0, 0, op2);
>+ key = ENCODE_AA64_CP_REG(crn, crm, op0, 0, op2);
> ri = get_arm_cp_reginfo(s->cp_regs, key);
> assert(ri);
> assert(cp_access_ok(s->current_el, ri, isread));
>--
>2.43.0
>
>
next prev parent reply other threads:[~2025-08-30 15:18 UTC|newest]
Thread overview: 94+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 1:03 [RFC PATCH 00/61] target/arm: Implement FEAT_SYSREG128 Richard Henderson
2025-08-27 1:03 ` [PATCH 01/61] target/arm: Introduce KVMID_AA64_SYS_REG64 Richard Henderson
2025-08-27 1:03 ` [PATCH 02/61] target/arm: Move compare_u64 to helper.c Richard Henderson
2025-08-28 12:19 ` Manos Pitsidianakis
2025-08-27 1:03 ` [PATCH 03/61] target/arm/hvf: Split out sysreg.c.inc Richard Henderson
2025-08-29 6:58 ` Manos Pitsidianakis
2025-08-27 1:03 ` [PATCH 4/7] target/arm/hvf: Add KVMID_TO_HVF, HVF_TO_KVMID Richard Henderson
2025-08-28 12:22 ` Manos Pitsidianakis
2025-08-27 1:03 ` [PATCH 04/61] target/arm/hvf: Reorder DEF_SYSREG arguments Richard Henderson
2025-08-28 12:17 ` Manos Pitsidianakis
2025-08-27 1:03 ` [PATCH 05/61] target/arm/hvf: Add KVMID_TO_HVF, HVF_TO_KVMID Richard Henderson
2025-08-29 6:59 ` Manos Pitsidianakis
2025-08-27 1:03 ` [PATCH 5/7] target/arm/hvf: Remove hvf_sreg_match.key Richard Henderson
2025-08-27 1:03 ` [PATCH 06/61] " Richard Henderson
2025-08-29 7:00 ` Manos Pitsidianakis
2025-08-27 1:03 ` [PATCH 6/7] target/arm/hvf: Replace hvf_sreg_match with hvf_sreg_list Richard Henderson
2025-08-27 1:03 ` [PATCH 07/61] " Richard Henderson
2025-08-27 1:03 ` [PATCH 7/7] target/arm/hvf: Sort the cpreg_indexes array Richard Henderson
2025-08-27 1:03 ` [PATCH 08/61] " Richard Henderson
2025-08-27 1:04 ` [PATCH 09/61] target/arm/hvf: Use raw_read, raw_write to access Richard Henderson
2025-08-27 1:04 ` [PATCH 10/61] target/arm: Use raw_write in cp_reg_reset Richard Henderson
2025-08-29 7:05 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 11/61] target/arm: Rename all ARMCPRegInfo from opaque to ri Richard Henderson
2025-08-28 12:41 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 12/61] target/arm: Drop define_one_arm_cp_reg_with_opaque Richard Henderson
2025-08-29 7:06 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 13/61] target/arm: Restrict the scope of CPREG_FIELD32, CPREG_FIELD64 Richard Henderson
2025-08-29 7:09 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 14/61] target/arm: Replace cpreg_field_is_64bit with cpreg_field_type Richard Henderson
2025-08-29 7:13 ` Manos Pitsidianakis
2025-09-03 4:48 ` Richard Henderson
2025-08-27 1:04 ` [PATCH 15/61] target/arm: Add CP_REG_AA32_64BIT_{SHIFT,MASK} Richard Henderson
2025-08-29 7:27 ` Manos Pitsidianakis
2025-08-29 13:55 ` Richard Henderson
2025-08-27 1:04 ` [PATCH 16/61] target/arm: Rename CP_REG_AA32_NS_{SHIFT,MASK} Richard Henderson
2025-08-29 7:30 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 17/61] target/arm: Convert init_cpreg_list to g_hash_table_foreach Richard Henderson
2025-08-27 1:04 ` [PATCH 18/61] target/arm: Remove cp argument to ENCODE_AA64_CP_REG Richard Henderson
2025-08-29 7:36 ` Manos Pitsidianakis [this message]
2025-08-27 1:04 ` [PATCH 19/61] target/arm: Reorder ENCODE_AA64_CP_REG arguments Richard Henderson
2025-08-29 7:40 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 20/61] target/arm: Split out add_cpreg_to_hashtable_aa{32,64} Richard Henderson
2025-08-27 1:04 ` [PATCH 21/61] target/arm: Improve asserts in define_one_arm_cp_reg Richard Henderson
2025-08-27 1:04 ` [PATCH 22/61] target/arm: Move cp processing to define_one_arm_cp_reg Richard Henderson
2025-08-27 1:04 ` [PATCH 23/61] target/arm: Move cpreg elimination " Richard Henderson
2025-08-27 1:04 ` [PATCH 24/61] target/arm: Add key parameter to add_cpreg_to_hashtable Richard Henderson
2025-08-27 1:04 ` [PATCH 25/61] target/arm: Split out alloc_cpreg Richard Henderson
2025-08-27 1:04 ` [PATCH 26/61] target/arm: Hoist the allocation of ARMCPRegInfo Richard Henderson
2025-08-27 1:04 ` [PATCH 27/61] target/arm: Remove name argument to alloc_cpreg Richard Henderson
2025-08-27 1:04 ` [PATCH 28/61] target/arm: Move alias setting for wildcards Richard Henderson
2025-08-27 1:04 ` [PATCH 29/61] target/arm: Move writeback of CP_ANY fields Richard Henderson
2025-08-27 1:04 ` [PATCH 30/61] target/arm: Move endianness fixup for 32-bit registers Richard Henderson
2025-08-27 1:04 ` [PATCH 31/61] target/arm: Rename TBFLAG_A64_NV2_MEM_E20 with *_E2H Richard Henderson
2025-08-27 1:04 ` [PATCH 32/61] target/arm: Split out redirect_cpreg Richard Henderson
2025-08-27 1:04 ` [PATCH 33/61] target/arm: Redirect VHE FOO_EL1 -> FOO_EL2 during translation Richard Henderson
2025-08-28 12:39 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 34/61] target/arm: Redirect VHE FOO_EL12 to FOO_EL1 " Richard Henderson
2025-08-27 1:04 ` [PATCH 35/61] target/arm: Rename some cpreg to their aarch64 names Richard Henderson
2025-09-01 6:53 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 36/61] target/arm: Remove define_arm_vh_e2h_redirects_aliases Richard Henderson
2025-08-27 1:04 ` [PATCH 37/61] target/arm: Implement isar tests for FEAT_SYSREG128, FEAT_SYSINSTR128 Richard Henderson
2025-09-01 6:55 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 38/61] target/arm: Define CP_REG_SIZE_U128 Richard Henderson
2025-09-01 6:55 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 39/61] target/arm: Update ARMCPRegInfo for 128-bit sysregs Richard Henderson
2025-09-01 6:56 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 40/61] target/arm: Assert ARM_CP_128BIT only with ARM_CP_STATE_AA64 Richard Henderson
2025-09-01 6:58 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 41/61] target/arm: Split add_cpreg_to_hashtable_aa64 Richard Henderson
2025-08-27 1:04 ` [PATCH 42/61] target/arm: Add raw_read128, raw_write128 Richard Henderson
2025-09-01 7:02 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 43/61] target/arm: Add read_raw_cp_reg128, write_raw_cp_reg128 Richard Henderson
2025-09-01 7:05 ` Manos Pitsidianakis
2025-08-27 1:04 ` [PATCH 44/61] target/arm: Put 128-bit sysregs into a separate list Richard Henderson
2025-08-27 1:04 ` [PATCH 45/61] target/arm/kvm: Assert no 128-bit sysregs in kvm_arm_init_cpreg_list Richard Henderson
2025-08-27 1:04 ` [PATCH 46/61] target/arm/hvf: Assert no 128-bit sysregs in hvf_arch_init_vcpu Richard Henderson
2025-08-27 1:04 ` [PATCH 47/61] migration: Add vmstate_info_int128 Richard Henderson
2025-08-27 1:04 ` [PATCH 48/61] target/arm: Migrate cpreg128 registers Richard Henderson
2025-08-27 1:04 ` [PATCH 49/61] target/arm: Add syn_aa64_sysreg128trap Richard Henderson
2025-08-27 1:04 ` [PATCH 50/61] target/arm: Introduce helper_{get,set}_cp_reg128 Richard Henderson
2025-08-27 1:04 ` [PATCH 51/61] target/arm: Implement MRRS, MSRR, SYSP Richard Henderson
2025-08-27 1:04 ` [PATCH 52/61] include/qemu/compiler: Introduce HOST_ENDIAN_FIELDS Richard Henderson
2025-08-27 1:04 ` [PATCH 53/61] include/hw/core/cpu: Use HOST_ENDIAN_FIELDS in IcountDecr Richard Henderson
2025-08-27 1:04 ` [PATCH 54/61] include/qemu/host-utils: Use HOST_ENDIAN_FIELDS in muldiv64_rounding Richard Henderson
2025-08-27 1:04 ` [PATCH 55/61] target/arm: Use HOST_ENDIAN_FIELDS in CPUARMState Richard Henderson
2025-08-27 1:04 ` [PATCH 56/61] target/arm: Consolidate definitions of PAR Richard Henderson
2025-08-27 1:04 ` [PATCH 57/61] target/arm: Extend PAR_EL1 to 128-bit Richard Henderson
2025-08-27 1:04 ` [PATCH 58/61] target/arm: Consolidate definitions of TTBR[01] Richard Henderson
2025-08-27 1:04 ` [PATCH 59/61] target/arm: Split out flush_if_asid_change Richard Henderson
2025-08-27 1:04 ` [PATCH 60/61] target/arm: Use flush_if_asid_change in vmsa_ttbr_write Richard Henderson
2025-08-27 1:04 ` [PATCH 61/61] target/arm: Extend TTBR system registers to 128-bit Richard Henderson
2025-08-27 2:36 ` [RFC PATCH 00/61] target/arm: Implement FEAT_SYSREG128 Richard Henderson
2025-09-16 12:14 ` Peter Maydell
2025-09-16 12:29 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=t1qvyy.1vq9bulelbzvf@linaro.org \
--to=manos.pitsidianakis@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).