aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2017-08-12 22:49:39 -0400
committerRalf Baechle <ralf@linux-mips.org>2017-08-29 18:57:27 -0400
commit68923cdc2eb34124d77bc27f7945d7ff16b236dd (patch)
tree967332aa37ceb6d533129bec00312b8735eadb9e /arch/mips/include
parent5616897efd1816c18231c9976a6d64392fc6cdee (diff)
MIPS: CM: Add cluster & block args to mips_cm_lock_other()
With CM >= 3.5 we have the notion of multiple clusters & can access their CM, CPC & GIC registers via the apporpriate redirect/other register blocks. In order to allow for this introduce cluster & block arguments to mips_cm_lock_other() which configures the redirect/other region to point at the appropriate cluster, core, VP & register block. Since we now have 4 arguments to mips_cm_lock_other() & a common use is likely to be to target the cluster, core & VP corresponding to a particular Linux CPU number we also add a new mips_cm_lock_other_cpu() helper function which handles that without the caller needing to manually pull out the cluster, core & VP numbers. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/17013/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/mips-cm.h45
1 files changed, 36 insertions, 9 deletions
diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
index 6cfc0cc265d7..d42cc8e76dc2 100644
--- a/arch/mips/include/asm/mips-cm.h
+++ b/arch/mips/include/asm/mips-cm.h
@@ -437,29 +437,56 @@ static inline unsigned int mips_cm_vp_id(unsigned int cpu)
437#ifdef CONFIG_MIPS_CM 437#ifdef CONFIG_MIPS_CM
438 438
439/** 439/**
440 * mips_cm_lock_other - lock access to another core 440 * mips_cm_lock_other - lock access to redirect/other region
441 * @cluster: the other cluster to be accessed
441 * @core: the other core to be accessed 442 * @core: the other core to be accessed
442 * @vp: the VP within the other core to be accessed 443 * @vp: the VP within the other core to be accessed
444 * @block: the register block to be accessed
443 * 445 *
444 * Call before operating upon a core via the 'other' register region in 446 * Configure the redirect/other region for the local core/VP (depending upon
445 * order to prevent the region being moved during access. Must be followed 447 * the CM revision) to target the specified @cluster, @core, @vp & register
446 * by a call to mips_cm_unlock_other. 448 * @block. Must be called before using the redirect/other region, and followed
449 * by a call to mips_cm_unlock_other() when access to the redirect/other region
450 * is complete.
451 *
452 * This function acquires a spinlock such that code between it &
453 * mips_cm_unlock_other() calls cannot be pre-empted by anything which may
454 * reconfigure the redirect/other region, and cannot be interfered with by
455 * another VP in the core. As such calls to this function should not be nested.
447 */ 456 */
448extern void mips_cm_lock_other(unsigned int core, unsigned int vp); 457extern void mips_cm_lock_other(unsigned int cluster, unsigned int core,
458 unsigned int vp, unsigned int block);
449 459
450/** 460/**
451 * mips_cm_unlock_other - unlock access to another core 461 * mips_cm_unlock_other - unlock access to redirect/other region
452 * 462 *
453 * Call after operating upon another core via the 'other' register region. 463 * Must be called after mips_cm_lock_other() once all required access to the
454 * Must be called after mips_cm_lock_other. 464 * redirect/other region has been completed.
455 */ 465 */
456extern void mips_cm_unlock_other(void); 466extern void mips_cm_unlock_other(void);
457 467
458#else /* !CONFIG_MIPS_CM */ 468#else /* !CONFIG_MIPS_CM */
459 469
460static inline void mips_cm_lock_other(unsigned int core, unsigned int vp) { } 470static inline void mips_cm_lock_other(unsigned int cluster, unsigned int core,
471 unsigned int vp, unsigned int block) { }
461static inline void mips_cm_unlock_other(void) { } 472static inline void mips_cm_unlock_other(void) { }
462 473
463#endif /* !CONFIG_MIPS_CM */ 474#endif /* !CONFIG_MIPS_CM */
464 475
476/**
477 * mips_cm_lock_other_cpu - lock access to redirect/other region
478 * @cpu: the other CPU whose register we want to access
479 *
480 * Configure the redirect/other region for the local core/VP (depending upon
481 * the CM revision) to target the specified @cpu & register @block. This is
482 * equivalent to calling mips_cm_lock_other() but accepts a Linux CPU number
483 * for convenience.
484 */
485static inline void mips_cm_lock_other_cpu(unsigned int cpu, unsigned int block)
486{
487 struct cpuinfo_mips *d = &cpu_data[cpu];
488
489 mips_cm_lock_other(cpu_cluster(d), cpu_core(d), cpu_vpe_id(d), block);
490}
491
465#endif /* __MIPS_ASM_MIPS_CM_H__ */ 492#endif /* __MIPS_ASM_MIPS_CM_H__ */