All of lore.kernel.org
 help / color / mirror / Atom feed
* Adding Implementation Defined ARM cpu registers
@ 2023-03-07  1:40 Roque Arcudia Hernandez
  2023-03-07 10:42 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Roque Arcudia Hernandez @ 2023-03-07  1:40 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]

Hello,

I'm dealing with a problem in which I need to add support for some
neoverse-v2 registers defined as implementation defined in the TRM of the
core.

In file helper.c I can see the decision of whether or not a register is
implemented is based mainly in function calls arm_feature(env,
ARM_FEATURE_*) or cpu_isar_feature(<feature>, cpu).

The main feature I'm interested in is actually protected by a call
to cpu_isar_feature but the neoverse-v2 needs extra IMP_ registers for
extra configuration of the feature.

I cannot find any example of a set of registers that depend on a particular
cpu. What I'm currently doing is defining a function to know if it is that
particular core and add more registers for the feature:

    if (cpu_isar_feature(<feature>, cpu)) {
        define_arm_cp_regs(cpu, <feature>_reginfo);
        if (is_neoverse_v2_core(cpu)) {
            /* Add extra registers */
        }
    }

Where my helper function is defined as:

static bool is_neoverse_v2_core(ARMCPU *cpu)
{
    /* Looking for Neoverse-V2 Part Num 0b110101001111 */
    const uint64_t neoverse_v2_partnum = 0xd4f;
    uint64_t partnum = FIELD_EX64(cpu->midr, MIDR_EL1, PARTNUM);
    return (partnum == neoverse_v2_partnum);
}

Is this ok? Otherwise what is your recommendation?

Thanks

Roque

[-- Attachment #2: Type: text/html, Size: 1675 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Adding Implementation Defined ARM cpu registers
  2023-03-07  1:40 Adding Implementation Defined ARM cpu registers Roque Arcudia Hernandez
@ 2023-03-07 10:42 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2023-03-07 10:42 UTC (permalink / raw)
  To: Roque Arcudia Hernandez; +Cc: qemu-devel

On Tue, 7 Mar 2023 at 01:41, Roque Arcudia Hernandez <roqueh@google.com> wrote:
>
> Hello,
>
> I'm dealing with a problem in which I need to add support for some neoverse-v2 registers defined as implementation defined in the TRM of the core.
>
> In file helper.c I can see the decision of whether or not a register is implemented is based mainly in function calls arm_feature(env, ARM_FEATURE_*) or cpu_isar_feature(<feature>, cpu).
>
> The main feature I'm interested in is actually protected by a call to cpu_isar_feature but the neoverse-v2 needs extra IMP_ registers for extra configuration of the feature.
>
> I cannot find any example of a set of registers that depend on a particular cpu. What I'm currently doing is defining a function to know if it is that particular core and add more registers for the feature:
>
>     if (cpu_isar_feature(<feature>, cpu)) {
>         define_arm_cp_regs(cpu, <feature>_reginfo);
>         if (is_neoverse_v2_core(cpu)) {
>             /* Add extra registers */
>         }
>     }
>
> Where my helper function is defined as:
>
> static bool is_neoverse_v2_core(ARMCPU *cpu)
> {
>     /* Looking for Neoverse-V2 Part Num 0b110101001111 */
>     const uint64_t neoverse_v2_partnum = 0xd4f;
>     uint64_t partnum = FIELD_EX64(cpu->midr, MIDR_EL1, PARTNUM);
>     return (partnum == neoverse_v2_partnum);
> }
>
> Is this ok? Otherwise what is your recommendation?

What's the feature that you need to add extra registers for?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-07 10:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07  1:40 Adding Implementation Defined ARM cpu registers Roque Arcudia Hernandez
2023-03-07 10:42 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.