From patchwork Mon Feb 19 11:38:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 875091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TpawiwD6"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zlMGK4xjRz9s0l for ; Mon, 19 Feb 2018 22:39:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=G2ksdmA0mJADDzr2+bHY8zKxjfYS+rfLGuTZOXV5Pr4=; b=Tpa wiwD6jAGeD6zccm65AxPtfLioGtdQhnKKe/6BY44G45HuMnJGKLZ6eq0f6i/X4suDpvHbtfJIX/O8 qLic2cJrlOriMCoMuQpkX8EySdE87WrF1ODfMGZ4bk6GPERgtjmwnEfPPV4pemHjW1ilKkhRpUX+w 0F0vmZVaZNb9FUlEqGNPj+65eYdZRSy6+k+sM8emDVgY70mkgFstu8j8fkOkVjf4CsaB9LH3/LT5H xIDurM3aDizjYzTgNuMRNxqDOZcREnYJ2oO37fhiMzjz4Q+JeOM2UDVRZDmZpdA1V0W2x0Eq+opA3 RWkIOYpLN8rrHdLaJE3DwQa1ldk16iw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1enjmi-0002ML-50; Mon, 19 Feb 2018 11:39:04 +0000 Received: from smtprelay.synopsys.com ([198.182.47.9]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1enjmf-0002LC-U6 for linux-snps-arc@lists.infradead.org; Mon, 19 Feb 2018 11:39:03 +0000 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 575A024E10D1; Mon, 19 Feb 2018 03:38:50 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 445333649; Mon, 19 Feb 2018 03:38:50 -0800 (PST) Received: from abrodkin-7480l.internal.synopsys.com (abrodkin-7480l.internal.synopsys.com [10.121.8.86]) by mailhost.synopsys.com (Postfix) with ESMTP id 1B8EA3646; Mon, 19 Feb 2018 03:38:48 -0800 (PST) From: Alexey Brodkin To: linux-snps-arc@lists.infradead.org Subject: [PATCH] clocksource/arc_timer: Halt GFRC together with ARC cores Date: Mon, 19 Feb 2018 14:38:46 +0300 Message-Id: <20180219113846.2312-1-abrodkin@synopsys.com> X-Mailer: git-send-email 2.14.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180219_033901_986152_54AF3198 X-CRM114-Status: GOOD ( 13.82 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [198.182.47.9 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vineet Gupta , Alexey Brodkin , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Currently GFRC is running regardless state of ARC cores in the SMP cluster. That means even if ARC cores are halted when doing JTAG debugging GFRC [our source of wall-time] continues to run giving us unexpected warnings once we allow ARC cores to run due to some tasks being stuck for too long. Starting from ARC HS v3.0 it's possible to tie GFRC to state of up-to 4 ARC cores with help of GFRC's CORE register where we set a mask for cores which state we need to rely on. For now we set GFRC to be halted whenever either of 4 ARC cores (currently max number of ARC cores in SMP cluster) is halted. That setting is safe for clusters with fewer ARC cores as well because bits for missign cores won't be written anyways. Signed-off-by: Alexey Brodkin --- drivers/clocksource/arc_timer.c | 7 +++++++ include/soc/arc/mcip.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/clocksource/arc_timer.c b/drivers/clocksource/arc_timer.c index 4927355f9cbe..6c21b3634be0 100644 --- a/drivers/clocksource/arc_timer.c +++ b/drivers/clocksource/arc_timer.c @@ -93,6 +93,13 @@ static int __init arc_cs_setup_gfrc(struct device_node *node) return -ENXIO; } + /* + * Halt GFRC if either of 4 cores in SMP cluster is halted. + * Only works for ARC HS v3.0+, on earlier versions has no effect. + * TODO: set mask only for used cores. + */ + __mcip_cmd_data(CMD_GFRC_SET_CORE, 0, 0xf); + ret = arc_get_timer_clk(node); if (ret) return ret; diff --git a/include/soc/arc/mcip.h b/include/soc/arc/mcip.h index c2d1b15da136..1dd1d1317907 100644 --- a/include/soc/arc/mcip.h +++ b/include/soc/arc/mcip.h @@ -40,6 +40,7 @@ struct mcip_cmd { #define CMD_GFRC_READ_LO 0x42 #define CMD_GFRC_READ_HI 0x43 +#define CMD_GFRC_SET_CORE 0x47 #define CMD_IDU_ENABLE 0x71 #define CMD_IDU_DISABLE 0x72