From patchwork Mon Jan 16 20:57:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 715920 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v2QZX1nyzz9s3s for ; Tue, 17 Jan 2017 07:59:00 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cTEMk-0007y3-O5; Mon, 16 Jan 2017 20:58:58 +0000 Received: from smtprelay.synopsys.com ([198.182.60.111]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cTEMh-0007sY-KI for linux-snps-arc@lists.infradead.org; Mon, 16 Jan 2017 20:58:57 +0000 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id E2E2A10C0E4A; Mon, 16 Jan 2017 12:58:35 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id CF8AB592; Mon, 16 Jan 2017 12:58:35 -0800 (PST) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id C4416591; Mon, 16 Jan 2017 12:58:35 -0800 (PST) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 16 Jan 2017 12:58:35 -0800 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.266.1; Tue, 17 Jan 2017 02:28:34 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.10.161.70) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Tue, 17 Jan 2017 02:28:33 +0530 From: Vineet Gupta To: , Subject: [PATCH 4/4] ARCv2: smp-boot: MCIP: use Inter-Core-Debug unit to kick start non master cpus Date: Mon, 16 Jan 2017 12:57:57 -0800 Message-ID: <1484600277-32345-5-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484600277-32345-1-git-send-email-vgupta@synopsys.com> References: <1484600277-32345-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.10.161.70] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170116_125855_687978_994EA0A9 X-CRM114-Status: UNSURE ( 9.02 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.1 (-----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-5.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.182.60.111 listed in wl.mailspike.net] -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] -3.2 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 , linux-kernel@vger.kernel.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This essentially converts a run-on-reset to halt-on-reset - so non masters self halt in early boot code. And later they are resumed from halted PC using MCIP ICD assist. As mentioned in prev commits, this paves way for radio silence on coherency unit, while master is setting up IOC and such. Signed-off-by: Vineet Gupta --- arch/arc/include/asm/mcip.h | 1 + arch/arc/kernel/mcip.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/arch/arc/include/asm/mcip.h b/arch/arc/include/asm/mcip.h index c8fbe4114bad..a6ae4363c388 100644 --- a/arch/arc/include/asm/mcip.h +++ b/arch/arc/include/asm/mcip.h @@ -36,6 +36,7 @@ struct mcip_cmd { #define CMD_SEMA_CLAIM_AND_READ 0x11 #define CMD_SEMA_RELEASE 0x12 +#define CMD_DEBUG_RUN 0x33 #define CMD_DEBUG_SET_MASK 0x34 #define CMD_DEBUG_SET_SELECT 0x36 diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c index 933382e0edd0..0a1822d2fe52 100644 --- a/arch/arc/kernel/mcip.c +++ b/arch/arc/kernel/mcip.c @@ -103,12 +103,43 @@ static void mcip_probe_n_setup(void) cpuinfo_arc700[0].extn.gfrc = mp.gfrc; } +static void __init mcip_cpu_wait(int cpu) +{ + struct mcip_bcr mp; + + READ_BCR(ARC_REG_MCIP_BCR, mp); + + /* + * self halt for waiting as Master will resume us using MCIP ICD assist + * Note: if ICD is not configured, we are hosed, but panic here is + * not going to help as UART access might not even work + */ + if (mp.dbg) + asm volatile("flag 1 \n"); +} + +static void __init mcip_cpu_kick(int cpu, unsigned long pc) +{ + struct mcip_bcr mp; + + READ_BCR(ARC_REG_MCIP_BCR, mp); + + if (mp.dbg) + __mcip_cmd_data(CMD_DEBUG_RUN, 0, (1 << cpu)); + else + panic("SMP boot issues: MCIP lacks ICD\n"); +} + struct plat_smp_ops plat_smp_ops = { .info = smp_cpuinfo_buf, .init_early_smp = mcip_probe_n_setup, .init_per_cpu = mcip_setup_per_cpu, .ipi_send = mcip_ipi_send, .ipi_clear = mcip_ipi_clear, + .cpu_kick = mcip_cpu_kick, +#ifndef CONFIG_ARC_SMP_HALT_ON_RESET + .cpu_wait = mcip_cpu_wait, +#endif }; #endif