qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: tobias.roehmel@rwth-aachen.de
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH v3 3/9] target/arm: Make RVBAR available for all ARMv8 CPUs
Date: Tue, 27 Sep 2022 14:01:13 +0100	[thread overview]
Message-ID: <CAFEAcA8kw9-2eqNVANxc6h9LisuqKsaNGY6aZEmaLBc_p7Ag_A@mail.gmail.com> (raw)
In-Reply-To: <20220820141914.217399-4-tobias.roehmel@rwth-aachen.de>

On Sat, 20 Aug 2022 at 15:19, <tobias.roehmel@rwth-aachen.de> wrote:
>
> From: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
>
> RVBAR shadows RVBAR_ELx where x is the highest exception
> level if the highest EL is not EL3. This patch also allows
> ARMv8 CPUs to change the reset address to be changed with
> the rvbar property.
>
> Signed-off-by: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>

> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index b9547594ae..23461397e0 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -7954,13 +7954,20 @@ void register_cp_regs_for_features(ARMCPU *cpu)
>          /* RVBAR_EL1 is only implemented if EL1 is the highest EL */
>          if (!arm_feature(env, ARM_FEATURE_EL3) &&
>              !arm_feature(env, ARM_FEATURE_EL2)) {
> -            ARMCPRegInfo rvbar = {
> -                .name = "RVBAR_EL1", .state = ARM_CP_STATE_AA64,
> -                .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 1,
> -                .access = PL1_R,
> -                .fieldoffset = offsetof(CPUARMState, cp15.rvbar),
> +            ARMCPRegInfo rvbar[] = {
> +                {
> +                    .name = "RVBAR_EL1", .state = ARM_CP_STATE_AA64,
> +                    .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 1,
> +                    .access = PL1_R,
> +                    .fieldoffset = offsetof(CPUARMState, cp15.rvbar),
> +                },
> +                {   .name = "RVBAR", .type = ARM_CP_ALIAS,
> +                    .cp = 15, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 1,
> +                    .access = PL1_R,
> +                    .fieldoffset = offsetof(CPUARMState, cp15.rvbar),
> +                },

Because the encodings here match, you don't need a separate
struct for the AArch32 RVBAR -- you can just change
the ARM_CP_STATE_AA64 to ARM_CP_STATE_BOTH.

>              };
> -            define_one_arm_cp_reg(cpu, &rvbar);
> +            define_arm_cp_regs(cpu, rvbar);
>          }
>          define_arm_cp_regs(cpu, v8_idregs);
>          define_arm_cp_regs(cpu, v8_cp_reginfo);
> @@ -8022,13 +8029,20 @@ void register_cp_regs_for_features(ARMCPU *cpu)
>          }
>          /* RVBAR_EL2 is only implemented if EL2 is the highest EL */
>          if (!arm_feature(env, ARM_FEATURE_EL3)) {
> -            ARMCPRegInfo rvbar = {
> -                .name = "RVBAR_EL2", .state = ARM_CP_STATE_AA64,
> -                .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 1,
> -                .access = PL2_R,
> -                .fieldoffset = offsetof(CPUARMState, cp15.rvbar),
> +            ARMCPRegInfo rvbar[] = {
> +                {
> +                    .name = "RVBAR_EL2", .state = ARM_CP_STATE_AA64,
> +                    .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 1,
> +                    .access = PL2_R,
> +                    .fieldoffset = offsetof(CPUARMState, cp15.rvbar),
> +                },
> +                {   .name = "RVBAR", .type = ARM_CP_ALIAS,
> +                    .cp = 15, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 1,
> +                    .access = PL2_R,
> +                    .fieldoffset = offsetof(CPUARMState, cp15.rvbar),
> +                },

(Here we do need the second struct, beacuse the opc1 fields don't line up.)

Preferred ordering for the encoding fields in a cp struct is
 .cp .opc1 .crn .crm .opc2
(ie in order as used in the asm instruction).

Otherwise this patch looks good.

thanks
-- PMM


  reply	other threads:[~2022-09-27 14:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-20 14:19 [PATCH v3 0/9] Add ARM Cortex-R52 cpu tobias.roehmel
2022-08-20 14:19 ` [PATCH v3 1/9] target/arm: Add ARM_FEATURE_V8_R tobias.roehmel
2022-08-20 14:19 ` [PATCH v3 2/9] target/arm: Don't add all MIDR aliases for cores that immplement PMSA tobias.roehmel
2022-09-27 16:29   ` Peter Maydell
2022-08-20 14:19 ` [PATCH v3 3/9] target/arm: Make RVBAR available for all ARMv8 CPUs tobias.roehmel
2022-09-27 13:01   ` Peter Maydell [this message]
2022-08-20 14:19 ` [PATCH v3 4/9] target/arm: Make stage_2_format for cache attributes optional tobias.roehmel
2022-09-27 12:52   ` Peter Maydell
2022-08-20 14:19 ` [PATCH v3 5/9] target/arm: Add ARMCacheAttrs to the signature of pmsav8_mpu_lookup tobias.roehmel
2022-09-27 13:05   ` Peter Maydell
2022-08-20 14:19 ` [PATCH v3 6/9] target/arm: Enable TTBCR_EAE for ARMv8-R AArch32 tobias.roehmel
2022-09-27 13:20   ` Peter Maydell
2022-08-20 14:19 ` [PATCH v3 7/9] target/arm: Add PMSAv8r registers tobias.roehmel
2022-09-27 13:50   ` Peter Maydell
2022-10-15 13:07     ` Tobias Roehmel
2022-10-20 15:02       ` Peter Maydell
2022-08-20 14:19 ` [PATCH v3 8/9] target/arm: Add PMSAv8r functionality tobias.roehmel
2022-09-27 16:23   ` Peter Maydell
2022-08-20 14:19 ` [PATCH v3 9/9] target/arm: Add ARM Cortex-R52 cpu tobias.roehmel
2022-09-27 16:31 ` [PATCH v3 0/9] " Peter Maydell

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=CAFEAcA8kw9-2eqNVANxc6h9LisuqKsaNGY6aZEmaLBc_p7Ag_A@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=tobias.roehmel@rwth-aachen.de \
    /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).