From patchwork Wed Feb 21 09:40:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniy Paltsev X-Patchwork-Id: 876023 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="lGLDv4Zp"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="ZYnMDJhz"; 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 3zmYvc47Mmz9ryJ for ; Wed, 21 Feb 2018 21:42:04 +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=qtuZ7T0TAnd0b3pjHd7HmnhQXZN81LuDm/cBLokgUWU=; b=lGL Dv4ZpT0vgA4anHjb4JIq4ek1xDJsdGCmiNycD0lGQiC1Tct1mV0kNnE7LW6es5/sMBpvu3+11aVjx L2qbIb0q6P1T0lVLmLmc/g8m7GZyBFzRnRKz26hyV2Gx1EB9h08Vf4J/4tTZ2CHeC7TuKYsOkcdko BNUvHajfx3f1tO0oZ3u9EMr700b6pJmbCDHHDgs/UPcgOhIW5b3JpjAxZ/BKCz+dMdE5Qh1dmn9qB Gx13zB+ldgag2rFGIhGhw6+p2NbbzDa+3K3m7VaFIl0Rcx/reygsC1c5DHYxkHfy3MOCJcKLlNrtP XsgAabFpMFjVqkrbtjiE1tbviITncFw==; 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 1eoRqZ-0002Fu-DT; Wed, 21 Feb 2018 10:41:59 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eoRqE-000258-LR for linux-snps-arc@bombadil.infradead.org; Wed, 21 Feb 2018 10:41:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DLL5bHmfRtD8a71kDx8KDrJnqu8+0bKqYyCbngcgkmk=; b=ZYnMDJhzHMxPP/s9Wqbt6ZfI7 B6QL2ot9/0nsd9j+qDu+zvvg7C8MQmbFGsClS55CQMPhP82P9axh9RNPja6k8UD6OV0nKiAZK5c8C a7vOxbTONOLnqHtbWCOWmjcjoZgckHgRp0B8m9ClTu9UqS6xVdeolu8s7a2LDVEegagDvGFS5pYFe vbP+T0vz6FUU5bOYH6bXRLAAugiOunt4tmytOxt7CnPi1IxgOkj/aJjX0+1Qcrh9u2tfu6i7Inod/ fz/l1p3X/YMhpaD9uhTJrB7IHQvqaUfqNEvcUFU59fM8tqXSYcYOaQv9k7yTGcVL2uk2xvMHgXGlL 0ShZTDS/Q==; Received: from smtprelay2.synopsys.com ([198.182.60.111] helo=smtprelay.synopsys.com) by merlin.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eoQtX-00070o-4z for linux-snps-arc@lists.infradead.org; Wed, 21 Feb 2018 09:41:00 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180221_044059_265280_B442FC71 X-CRM114-Status: GOOD ( 10.48 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on merlin.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.60.111 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [198.182.60.111 listed in wl.mailspike.net] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -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 , Eugeniy Paltsev , 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. 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