Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Definitions specific to SMP platforms.
0004  *
0005  * Copyright (C) 2013 ARM Ltd.
0006  */
0007 
0008 #ifndef __ASM_SMP_PLAT_H
0009 #define __ASM_SMP_PLAT_H
0010 
0011 #include <linux/cpumask.h>
0012 
0013 #include <asm/smp.h>
0014 #include <asm/types.h>
0015 
0016 struct mpidr_hash {
0017     u64 mask;
0018     u32 shift_aff[4];
0019     u32 bits;
0020 };
0021 
0022 extern struct mpidr_hash mpidr_hash;
0023 
0024 static inline u32 mpidr_hash_size(void)
0025 {
0026     return 1 << mpidr_hash.bits;
0027 }
0028 
0029 /*
0030  * Retrieve logical cpu index corresponding to a given MPIDR.Aff*
0031  *  - mpidr: MPIDR.Aff* bits to be used for the look-up
0032  *
0033  * Returns the cpu logical index or -EINVAL on look-up error
0034  */
0035 static inline int get_logical_index(u64 mpidr)
0036 {
0037     int cpu;
0038     for (cpu = 0; cpu < nr_cpu_ids; cpu++)
0039         if (cpu_logical_map(cpu) == mpidr)
0040             return cpu;
0041     return -EINVAL;
0042 }
0043 
0044 #endif /* __ASM_SMP_PLAT_H */