Received: by 10.223.185.116 with SMTP id b49csp911897wrg; Fri, 23 Feb 2018 08:43:03 -0800 (PST) X-Google-Smtp-Source: AH8x225Ms3dic3D94pGPgMAYvBoHBCRoN0cKxvjqfp3T/l9dfttw79sPEJOYv/xWdaCMV5Wsl050 X-Received: by 10.101.96.73 with SMTP id b9mr1303228pgv.339.1519404183032; Fri, 23 Feb 2018 08:43:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519404182; cv=none; d=google.com; s=arc-20160816; b=d2YrwGlfXzx/g7Nhj8TzRznopuz6/BdLDf4tQdEsraN4tGQqMeN+/0CZu/iNwSjXdu j4QC6MQCaWiiKVH6gW4C2AHjy8zsZUl6eOORuJuX5V6mJMptVzG5msEKlqWkdlPJK7Mu NXzLNjPeNTk6EDUUEaoSg3Kb6BT1+rX0JCN7so5SwgbAl612KP5hNJEIVKOc9zF0ERhp AxQjF1R5pMjRAYWVkSHlUk5HjMuAWz3DHzl3EgqFaiDmhQoZxCo4lPvg2rTS6Ltfbg4m 6xKa4HiL/tlxyhfnEJ9xogj1GD0VkIcqHImh5hS/osVBlKFcvOtxFnsAWpFedyAhJw8K XV0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=MkSFwPtG0HLhwqPMqVvHYjeBoKDJeTzSraTYl5TWCeA=; b=R1mZkct6BdemwGHw9s7uF4M2ifjuscZMriLE10D4ZUFVuq+56MbpdDYwJe7Ecn4X5B D6IGv3OCaZLNTfkAGRUYTHwtMZRXaEHa4a9laRSpGNW8ypQFYOazUo8EVUG6LVaPdaEa 3GL0ZclYt5BB0a62MbhK6hMMyUpxpIqgax/g5TFRzH5eCLT4yXYInK11jaVq3ZsIq43D Q7hzsIOLfGi34kHspcnh+eHdy0AQXMT9zNTLICgrl2LQpqrX7Rthx0s1IrDSCTNh8WaY Ag/Ulil6ulbKYhStMD8J2NMlQ1QDpLmMInFcRniYqqJrYMQs9o4A24DXQcgUt88qjVmE Vljw== 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 y13-v6si1995539plr.10.2018.02.23.08.42.48; Fri, 23 Feb 2018 08:43:02 -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 S1752089AbeBWQmE (ORCPT + 99 others); Fri, 23 Feb 2018 11:42:04 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:52016 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752049AbeBWQmA (ORCPT ); Fri, 23 Feb 2018 11:42:00 -0500 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 9B44524E0D7F; Fri, 23 Feb 2018 08:42:00 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 886B71766; Fri, 23 Feb 2018 08:42:00 -0800 (PST) Received: from localhost.internal.synopsys.com (unknown [10.121.3.43]) by mailhost.synopsys.com (Postfix) with ESMTP id 2ED201756; Fri, 23 Feb 2018 08:41:58 -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 v2 2/3] ARC: mcip: update MCIP debug mask when the new cpu came online Date: Fri, 23 Feb 2018 19:41:53 +0300 Message-Id: <20180223164154.22377-2-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180223164154.22377-1-Eugeniy.Paltsev@synopsys.com> References: <20180223164154.22377-1-Eugeniy.Paltsev@synopsys.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As of today we use hardcoded MCIP debug mask, so if we launch kernel via debugger and kick fever cores than HW has all cpus hang at the momemt of setup MCIP debug mask. So update MCIP debug mask when the new cpu came online, instead of use hardcoded MCIP debug mask. Signed-off-by: Eugeniy Paltsev --- Changes v1->v2: * update MCIP debug mask when the new cpu came online instead of using MCIP debug mask generated from "possible_cpus" mask. arch/arc/kernel/mcip.c | 37 ++++++++++++++++++++++++++++++++----- include/soc/arc/mcip.h | 2 ++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c index 1119029..5fe84e4 100644 --- a/arch/arc/kernel/mcip.c +++ b/arch/arc/kernel/mcip.c @@ -51,6 +51,34 @@ static void mcip_update_gfrc_halt_mask(int cpu) raw_spin_unlock_irqrestore(&mcip_lock, flags); } +static void mcip_update_debug_halt_mask(int cpu) +{ + u32 mcip_mask = 0; + unsigned long flags; + + raw_spin_lock_irqsave(&mcip_lock, flags); + + /* + * mcip_mask is same for CMD_DEBUG_SET_SELECT and CMD_DEBUG_SET_MASK + * commands. So read it once instead of reading both CMD_DEBUG_READ_MASK + * and CMD_DEBUG_READ_SELECT. + */ + __mcip_cmd(CMD_DEBUG_READ_SELECT, 0); + mcip_mask = read_aux_reg(ARC_REG_MCIP_READBACK); + + mcip_mask |= BIT(cpu); + + __mcip_cmd_data(CMD_DEBUG_SET_SELECT, 0, mcip_mask); + /* + * Parameter specified halt cause: + * STATUS32[H]/actionpoint/breakpoint/self-halt + * We choose all of them (0xF). + */ + __mcip_cmd_data(CMD_DEBUG_SET_MASK, 0xF, mcip_mask); + + raw_spin_unlock_irqrestore(&mcip_lock, flags); +} + static void mcip_setup_per_cpu(int cpu) { struct mcip_bcr mp; @@ -63,6 +91,10 @@ static void mcip_setup_per_cpu(int cpu) /* Update GFRC halt mask as new CPU came online */ if (mp.gfrc) mcip_update_gfrc_halt_mask(cpu); + + /* Update MCIP debug mask as new CPU came online */ + if (mp.dbg) + mcip_update_debug_halt_mask(cpu); } static void mcip_ipi_send(int cpu) @@ -138,11 +170,6 @@ static void mcip_probe_n_setup(void) IS_AVAIL1(mp.gfrc, "GFRC")); cpuinfo_arc700[0].extn.gfrc = mp.gfrc; - - if (mp.dbg) { - __mcip_cmd_data(CMD_DEBUG_SET_SELECT, 0, 0xf); - __mcip_cmd_data(CMD_DEBUG_SET_MASK, 0xf, 0xf); - } } struct plat_smp_ops plat_smp_ops = { diff --git a/include/soc/arc/mcip.h b/include/soc/arc/mcip.h index 1138da5..a91f251 100644 --- a/include/soc/arc/mcip.h +++ b/include/soc/arc/mcip.h @@ -37,7 +37,9 @@ struct mcip_cmd { #define CMD_SEMA_RELEASE 0x12 #define CMD_DEBUG_SET_MASK 0x34 +#define CMD_DEBUG_READ_MASK 0x35 #define CMD_DEBUG_SET_SELECT 0x36 +#define CMD_DEBUG_READ_SELECT 0x37 #define CMD_GFRC_READ_LO 0x42 #define CMD_GFRC_READ_HI 0x43 -- 2.9.3