diff options
-rw-r--r-- | arch/arm/common/bL_switcher.c | 20 | ||||
-rw-r--r-- | arch/arm/include/asm/bL_switcher.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c index f4878a36047a..63bbc4f70564 100644 --- a/arch/arm/common/bL_switcher.c +++ b/arch/arm/common/bL_switcher.c | |||
@@ -532,6 +532,26 @@ static int bL_switcher_halve_cpus(void) | |||
532 | return 0; | 532 | return 0; |
533 | } | 533 | } |
534 | 534 | ||
535 | /* Determine the logical CPU a given physical CPU is grouped on. */ | ||
536 | int bL_switcher_get_logical_index(u32 mpidr) | ||
537 | { | ||
538 | int cpu; | ||
539 | |||
540 | if (!bL_switcher_active) | ||
541 | return -EUNATCH; | ||
542 | |||
543 | mpidr &= MPIDR_HWID_BITMASK; | ||
544 | for_each_online_cpu(cpu) { | ||
545 | int pairing = bL_switcher_cpu_pairing[cpu]; | ||
546 | if (pairing == -1) | ||
547 | continue; | ||
548 | if ((mpidr == cpu_logical_map(cpu)) || | ||
549 | (mpidr == cpu_logical_map(pairing))) | ||
550 | return cpu; | ||
551 | } | ||
552 | return -EINVAL; | ||
553 | } | ||
554 | |||
535 | static void bL_switcher_trace_trigger_cpu(void *__always_unused info) | 555 | static void bL_switcher_trace_trigger_cpu(void *__always_unused info) |
536 | { | 556 | { |
537 | trace_cpu_migrate_current(get_ns(), read_mpidr()); | 557 | trace_cpu_migrate_current(get_ns(), read_mpidr()); |
diff --git a/arch/arm/include/asm/bL_switcher.h b/arch/arm/include/asm/bL_switcher.h index 8ada5a885c70..1714800fa113 100644 --- a/arch/arm/include/asm/bL_switcher.h +++ b/arch/arm/include/asm/bL_switcher.h | |||
@@ -55,6 +55,7 @@ bool bL_switcher_get_enabled(void); | |||
55 | void bL_switcher_put_enabled(void); | 55 | void bL_switcher_put_enabled(void); |
56 | 56 | ||
57 | int bL_switcher_trace_trigger(void); | 57 | int bL_switcher_trace_trigger(void); |
58 | int bL_switcher_get_logical_index(u32 mpidr); | ||
58 | 59 | ||
59 | #else | 60 | #else |
60 | static inline int bL_switcher_register_notifier(struct notifier_block *nb) | 61 | static inline int bL_switcher_register_notifier(struct notifier_block *nb) |
@@ -70,6 +71,7 @@ static inline int bL_switcher_unregister_notifier(struct notifier_block *nb) | |||
70 | static inline bool bL_switcher_get_enabled(void) { return false; } | 71 | static inline bool bL_switcher_get_enabled(void) { return false; } |
71 | static inline void bL_switcher_put_enabled(void) { } | 72 | static inline void bL_switcher_put_enabled(void) { } |
72 | static inline int bL_switcher_trace_trigger(void) { return 0; } | 73 | static inline int bL_switcher_trace_trigger(void) { return 0; } |
74 | static inline int bL_switcher_get_logical_index(u32 mpidr) { return -EUNATCH; } | ||
73 | #endif /* CONFIG_BL_SWITCHER */ | 75 | #endif /* CONFIG_BL_SWITCHER */ |
74 | 76 | ||
75 | #endif | 77 | #endif |