Received: by 10.223.185.116 with SMTP id b49csp862041wrg; Wed, 21 Feb 2018 08:06:39 -0800 (PST) X-Google-Smtp-Source: AH8x227ixrB4nxH1fPXbyvOZBztvva4+Vu5cuwImYwx0PAcNlc9v3GB4OILqWIHB86dvVmAtVFuw X-Received: by 10.99.56.77 with SMTP id h13mr3155882pgn.1.1519229199313; Wed, 21 Feb 2018 08:06:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519229199; cv=none; d=google.com; s=arc-20160816; b=cVkIRuUk1MJQUhZYnej9HFDWia5h6QVFmGz+vPVW2Jh0GEgs+W+MQXGFsYkIUIJyEI WimX6Pxngbp5fLFJJ6+ktfbXEaEzmuhMgm3X2wwrntuCromRVHsTgJRyWYikihKMFqtc gH5WD+FUyoUsLs97gM2x6e66hyKKqGg0mLvDvejEUZHfQsz9OPpQsiysofHeZuufr3H8 ky/KgGrCKsRsCoW6hT/JQLnczfZgzyzQqhIoJQBP+W3T/z/fox2NDJIDOi4Ttmwv6Mbh HcqjXZYwiYt16o3RdEbtACK0M9elZhYV0eKxyTc/OQ34YBWSuWN6aEzSsrXDUghf/Y2G d4Xg== 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=DLL5bHmfRtD8a71kDx8KDrJnqu8+0bKqYyCbngcgkmk=; b=RyxLfWiUrLDhs/I8alwlK9hiA3JkJmQQxBgeHQ+4Kltj+pn5E90S64j/1Mk3DJkZHR 4dRhtiCMZoRYJUxHyK5NBDQHszIV6DdWCsFYeZ0KahO04sDbr+wFFxb77+J/7fCnytma x87LjKvB75FSwIeYUvHwIiuPuctIHEx3pcRZM0zvhC7mUYH72f8Mojc8lvIdifg+6uDP HAAFvlmNPpWhTclu/i5fZ4XmjE0yu9IdbADSNa6uCw5yM95133qo+KAgEfTdE/mBICOF u5WfLyrwcZceNbRaJPj7mJ8fyNBVwdlgFP33vFW9N8aWuCHdqOQRnwJFSEOWktKoPVCB pBYQ== 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 62si2402465pgd.45.2018.02.21.08.06.23; Wed, 21 Feb 2018 08:06:39 -0800 (PST) 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 S932566AbeBUJkp (ORCPT + 99 others); Wed, 21 Feb 2018 04:40:45 -0500 Received: from smtprelay.synopsys.com ([198.182.60.111]:55952 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932349AbeBUJkn (ORCPT ); Wed, 21 Feb 2018 04:40:43 -0500 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 70AAC10C10D2; Wed, 21 Feb 2018 01:40:43 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 5D5383411; Wed, 21 Feb 2018 01:40:43 -0800 (PST) Received: from localhost.internal.synopsys.com (unknown [10.121.3.43]) by mailhost.synopsys.com (Postfix) with ESMTP id 034FB3409; Wed, 21 Feb 2018 01:40:41 -0800 (PST) From: Eugeniy Paltsev To: linux-snps-arc@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Vineet Gupta , Alexey Brodkin , Eugeniy Paltsev Subject: [PATCH 1/3] ARC: mcip: halt GFRC together with ARC cores Date: Wed, 21 Feb 2018 12:40:25 +0300 Message-Id: <20180221094027.12674-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. Signed-off-by: Eugeniy Paltsev Signed-off-by: Alexey Brodkin --- NOTE: with this patch previous patch is not required: http://patchwork.ozlabs.org/patch/875091/ arch/arc/kernel/mcip.c | 23 +++++++++++++++++++++++ include/soc/arc/mcip.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c index f61a52b..e87a4ea 100644 --- a/arch/arc/kernel/mcip.c +++ b/arch/arc/kernel/mcip.c @@ -22,10 +22,33 @@ static DEFINE_RAW_SPINLOCK(mcip_lock); static char smp_cpuinfo_buf[128]; +/* + * Set mask to halt GFRC if any online core in SMP cluster is halted. + * Only works for ARC HS v3.0+, on earlier versions has no effect. + */ +static void mcip_update_gfrc_halt_mask(int cpu) +{ + struct mcip_bcr mp; + u32 gfrc_halt_mask; + + READ_BCR(ARC_REG_MCIP_BCR, mp); + + if (!mp.gfrc) + return; + + __mcip_cmd(CMD_GFRC_READ_CORE, 0); + gfrc_halt_mask = read_aux_reg(ARC_REG_MCIP_READBACK); + gfrc_halt_mask |= BIT(cpu); + __mcip_cmd_data(CMD_GFRC_SET_CORE, 0, gfrc_halt_mask); +} + static void mcip_setup_per_cpu(int cpu) { smp_ipi_irq_setup(cpu, IPI_IRQ); smp_ipi_irq_setup(cpu, SOFTIRQ_IRQ); + + /* Update GFRC halt mask as new CPU came online */ + mcip_update_gfrc_halt_mask(cpu); } static void mcip_ipi_send(int cpu) diff --git a/include/soc/arc/mcip.h b/include/soc/arc/mcip.h index c2d1b15..a156fa5 100644 --- a/include/soc/arc/mcip.h +++ b/include/soc/arc/mcip.h @@ -40,6 +40,8 @@ struct mcip_cmd { #define CMD_GFRC_READ_LO 0x42 #define CMD_GFRC_READ_HI 0x43 +#define CMD_GFRC_SET_CORE 0x47 +#define CMD_GFRC_READ_CORE 0x48 #define CMD_IDU_ENABLE 0x71 #define CMD_IDU_DISABLE 0x72 -- 2.9.3