Received: by 10.192.165.156 with SMTP id m28csp871063imm; Thu, 19 Apr 2018 08:54:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx49gXtspMZ2nFN0prz3TKs5dqG9LhSF98stwl1riBH6F2DRUQ82igmXuuS63a1lguV+xf+T5 X-Received: by 10.99.96.193 with SMTP id u184mr2177282pgb.122.1524153287934; Thu, 19 Apr 2018 08:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524153287; cv=none; d=google.com; s=arc-20160816; b=nj7FBwofVzZTrNK/s+dOvPyJ6jgUj9CgY+dmi3D9rPitQLcJAVTR7EnSQ4XavLcYy5 pGxrRsVEfEnCkF/H13liTQIZbpnpg5k5jPnecGPaBMDURJRD4G92IEAs0ck5pUqUf5/J nHCfOAT3oEUbZm2yFg7iydlDE4+IJoXbX9wufs5s+xkkPKtGa3YL2zvzOM2P4J36qrh0 N6yVN/D/e5TqpGxK78QNr6rCAzCBJDyU5rsFfSl2UAxWpo1G5E3sogMq+3BTJjKIRN4/ pDBpv58J4e24iWrY19pdFOd+iW3NdMeMxGnSKK2/6w492IeNHQOJPy1/BeJiAuzBZ0il AdEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Q5j/g3sc/56kg4rQiHjvnI1jtvNnKc2TZir1o9r1I8c=; b=sOSr6QkCDIbUe0qfuZZK2amW3SaazDYkwNCLKRcP1KRr420U3+3FsXtBrjas6tB/zS EhGVvaGCmntRHy1mUNNB7KlBg1ZY7+YS2L1kcSkyx2qfByahvFM7H5c6AlFg4QkHE4Wm kn66R6PVptRyu2dai9dmuuR3sAi6Dq02dSTgj/e3LDDlZpt22YaDr8cp1notj+llJPP3 st9EeDI2Kc+U11fmRDBgbLoM9L/xa8eL2gWWdldaZhIZUDIj3J1rKHyu9gfN0Iis02Av Fdq6qRzcf4Obma8IoNe4qMVT3eHbQxph5Ij/bduzzlkdI58HGh1r1ERcyD5cMHKb8Ghz Gs6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e17si3089067pgt.179.2018.04.19.08.54.32; Thu, 19 Apr 2018 08:54:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753107AbeDSPxN (ORCPT + 99 others); Thu, 19 Apr 2018 11:53:13 -0400 Received: from smtprelay.synopsys.com ([198.182.47.9]:48744 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752514AbeDSPxM (ORCPT ); Thu, 19 Apr 2018 11:53:12 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id AFDE524E063D; Thu, 19 Apr 2018 08:53:11 -0700 (PDT) Received: from paltsev-e7480.internal.synopsys.com (paltsev-e7480.internal.synopsys.com [10.121.3.53]) by mailhost.synopsys.com (Postfix) with ESMTP id 4D8B13CE0; Thu, 19 Apr 2018 08:53:08 -0700 (PDT) From: Eugeniy Paltsev To: linux-snps-arc@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Vineet Gupta , Alexey Brodkin , Daniel Lezcano , Thomas Gleixner , Eugeniy Paltsev Subject: [PATCH v2] clocksource: arc_timer: add comments about locking while read GFRC Date: Thu, 19 Apr 2018 18:53:05 +0300 Message-Id: <20180419155305.32402-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.14.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 + */ local_irq_save(flags); __mcip_cmd(CMD_GFRC_READ_LO, 0); -- 2.14.3