Re: [PATCH v6 32/37] arm: Implement read_mpidr on armv7

From: Simon Glass
Date: Wed Oct 02 2024 - 18:55:59 EST


On Wed, 2 Oct 2024 at 03:57, Patrick Rudolph
<patrick.rudolph@xxxxxxxxxxxxx> wrote:
>
> Implement read_mpidr() on armv7 to make use of it in generic
> code that compiles on both armv7 and armv8.
>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@xxxxxxxxxxxxx>
> ---
> arch/arm/include/asm/system.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>

Reviewed-by: Simon Glass <sjg@xxxxxxxxxxxx>


> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> index 7e30cac32a..94c6f8f134 100644
> --- a/arch/arm/include/asm/system.h
> +++ b/arch/arm/include/asm/system.h
> @@ -384,6 +384,15 @@ void switch_to_hypervisor_ret(void);
> #define wfi()
> #endif
>
> +static inline unsigned long read_mpidr(void)
> +{
> + unsigned long val;
> +
> + asm volatile("mrc p15, 0, %0, c0, c0, 5" : "=r" (val));
> +
> + return val;
> +}
> +
> static inline unsigned long get_cpsr(void)
> {
> unsigned long cpsr;
> --
> 2.46.2
>