LKML Archive on
help / color / mirror / Atom feed
* [PATCH v2] clocksource: arc_timer: add comments about locking while read GFRC
@ 2018-04-19 15:53 Eugeniy Paltsev
  0 siblings, 0 replies; only message in thread
From: Eugeniy Paltsev @ 2018-04-19 15:53 UTC (permalink / raw)
  To: linux-snps-arc
  Cc: linux-kernel, Vineet Gupta, Alexey Brodkin, Daniel Lezcano,
	Thomas Gleixner, Eugeniy Paltsev

This came to light in some internal discussions and it is nice to have
this documented rather than digging up the PRM (Prog Ref Manual) again.

Acked-by: Vineet Gupta <>

Signed-off-by: Eugeniy Paltsev <>
Changes v1->v2:
 * Minor comment fix.

 drivers/clocksource/arc_timer.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/clocksource/arc_timer.c b/drivers/clocksource/arc_timer.c
index 4927355f9cbe..e997e2be6287 100644
--- a/drivers/clocksource/arc_timer.c
+++ b/drivers/clocksource/arc_timer.c
@@ -61,6 +61,20 @@ static u64 arc_read_gfrc(struct clocksource *cs)
 	unsigned long flags;
 	u32 l, h;
+	/*
+	 * From a programming model pov, there seems to be just one instance of
+	 * MCIP_CMD/MCIP_READBACK however micro-architecturally there's
+	 * an instance PER ARC CORE (not per cluster), and there are dedicated
+	 * hardware decode logic (per core) inside ARConnect to handle
+	 * simultaneous read/write accesses from cores via those two registers.
+	 * So several concurrent commands to ARConnect are OK if they are
+	 * trying to access two different sub-components (like GFRC,
+	 * inter-core interrupt, etc...). HW also supports simultaneously
+	 * accessing GFRC by multiple cores.
+	 * That's why it is safe to disable hard interrupts on the local CPU
+	 * before access to GFRC instead of taking global MCIP spinlock
+	 * defined in arch/arc/kernel/mcip.c
+	 */
 	__mcip_cmd(CMD_GFRC_READ_LO, 0);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-19 15:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19 15:53 [PATCH v2] clocksource: arc_timer: add comments about locking while read GFRC Eugeniy Paltsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).