Received: by 10.192.165.156 with SMTP id m28csp210377imm; Tue, 17 Apr 2018 08:54:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/PUy09ptVdGKWoyMXyRPk9EsMw9iRmr3Ak3KrHQPf2XMw8PASeYOggiZXajFi/YRRJ8odQ X-Received: by 2002:a17:902:b082:: with SMTP id p2-v6mr2552779plr.11.1523980450452; Tue, 17 Apr 2018 08:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523980450; cv=none; d=google.com; s=arc-20160816; b=YNBNxJ2KxnTRAr1UhRhoGO8iNLgSZ9YoibWcrLGpmMyafIlgIdqoAcF74+bcdSkkUB gzmz7G3meOYut9kxVTUeruQ5XvhiPpX/yNTgr+Ym1w9Jus3IA7lJ3v/fbjhPrz9uVCF3 UeQf2odlfaz9TBIGCFsRiQ7+1VsNnz4S1XbJdNNfVj5+BrplwxYYR+OSSo2vi+kN2YZS qG0mzTqEAxV2fI0PLS6HI56tp24BdiEvl4WGMm9yc4qLdaZVU3TmJaQbenjs+F8Pk1sz 7LphXvE7f8/wM82Eh4bTa+YRJgzirqFtbKec22VMVDOdIoDTqTfgkk2qLdKRbICBHfNX aPQw== 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=YoQxZJK5jgEwZKrSn9ofMuImeUeIGRvD62FLeGGvJkg=; b=BLuddC7Cb95a78NgIy6TiGuYuNTRUo0jIc6YKesXfhYmYzaDbDF8/eLsaO0XfelQiL HrU5wJI8EbJJgUD5OXU+nqhlWBhwwZJS9K11pG+IT26Lar9hEzTChSQ3aJKXnfuWckBr MYf+svmL5cg/ypXtMn/lLlalqSzz6tK0XJrI4I7pbPcBznYTLbz2d04UYYOZNDsCoc2C 2Cfjf4ce67ycKzS+kZTYi0qCIbEDYaPYBF6eoFs7Giw67wh/TfV8RjtC/KuzJtmd98u4 EUh6l7X1ltHi4/Ue8llKkGg/z0Cl5u7md1NR6N59wrk64MKg3GiTE7XQ4WsiZcAlC12/ ssyQ== 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 w7si8611018pfn.363.2018.04.17.08.53.56; Tue, 17 Apr 2018 08:54:10 -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 S1752792AbeDQPwn (ORCPT + 99 others); Tue, 17 Apr 2018 11:52:43 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:55704 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752658AbeDQPwk (ORCPT ); Tue, 17 Apr 2018 11:52:40 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 244DD10C04BF; Tue, 17 Apr 2018 08:52:40 -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 ED17132F6; Tue, 17 Apr 2018 08:52:37 -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] clocksource: arc_timer: add comments about locking while read GFRC Date: Tue, 17 Apr 2018 18:52:32 +0300 Message-Id: <20180417155232.4989-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. Signed-off-by: Eugeniy Paltsev --- drivers/clocksource/arc_timer.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/clocksource/arc_timer.c b/drivers/clocksource/arc_timer.c index 4927355f9cbe..b594c373debc 100644 --- a/drivers/clocksource/arc_timer.c +++ b/drivers/clocksource/arc_timer.c @@ -61,6 +61,19 @@ static u64 arc_read_gfrc(struct clocksource *cs) unsigned long flags; u32 l, h; + /* + * MCIP_CMD/MCIP_READBACK registers are allocated + * 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 support 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