From patchwork Mon Jan 16 20:57:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 715917 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 3v2QZQ5Z7jz9t17 for ; Tue, 17 Jan 2017 07:58:54 +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 1cTEMf-0007v8-7c; Mon, 16 Jan 2017 20:58:53 +0000 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cTEMc-0007sD-GD for linux-snps-arc@lists.infradead.org; Mon, 16 Jan 2017 20:58:52 +0000 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id F2FF424E0189; Mon, 16 Jan 2017 12:58:30 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id DAE5B517; Mon, 16 Jan 2017 12:58:30 -0800 (PST) Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id C9386513; Mon, 16 Jan 2017 12:58:30 -0800 (PST) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by us01wehtc1.internal.synopsys.com (10.12.239.235) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 16 Jan 2017 12:58:30 -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:29 +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:28 +0530 From: Vineet Gupta To: , Subject: [PATCH 2/4] ARC: smp-boot: run-on-reset: add callback to allow non masters to wait Date: Mon, 16 Jan 2017 12:57:55 -0800 Message-ID: <1484600277-32345-3-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_125850_599066_01C81293 X-CRM114-Status: GOOD ( 11.24 ) 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_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.182.47.9 listed in wl.mailspike.net] -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 Currently for halt-on-reset, non masters spin on a shared memory which is wiggled by Master at right time. This is not efficient when hardware support exists to stop and resume them from Master (using an external IP block). More importantly Master might be setting up SLC or IO-Coherency aperutes in early boot duting which other cores need NOT perturb the coherency unit, thus need a mechanism that doesn't rely on polling memory. This just adds infrastructure for next patch which will add the hardware support (MCIP Inter Core Debug Unit). Signed-off-by: Vineet Gupta --- arch/arc/include/asm/smp.h | 3 +++ arch/arc/kernel/smp.c | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/arch/arc/include/asm/smp.h b/arch/arc/include/asm/smp.h index 0861007d9ef3..6187b9d14b03 100644 --- a/arch/arc/include/asm/smp.h +++ b/arch/arc/include/asm/smp.h @@ -50,6 +50,8 @@ extern int smp_ipi_irq_setup(int cpu, irq_hw_number_t hwirq); * mach_desc->init_early() * @init_per_cpu: Called for each core so SMP h/w block driver can do * any needed setup per cpu (e.g. IPI request) + * @cpu_wait: Non masters wait to be resumed later by master (to avoid + * perturbing SLC / cache coherency in early boot) * @cpu_kick: For Master to kickstart a cpu (optionally at a PC) * @ipi_send: To send IPI to a @cpu * @ips_clear: To clear IPI received at @irq @@ -58,6 +60,7 @@ struct plat_smp_ops { const char *info; void (*init_early_smp)(void); void (*init_per_cpu)(int cpu); + void (*cpu_wait)(int cpu); void (*cpu_kick)(int cpu, unsigned long pc); void (*ipi_send)(int cpu); void (*ipi_clear)(int irq); diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c index 44a0d21ed342..e60c11b8f4b9 100644 --- a/arch/arc/kernel/smp.c +++ b/arch/arc/kernel/smp.c @@ -96,16 +96,25 @@ static void arc_default_smp_cpu_kick(int cpu, unsigned long pc) wake_flag = cpu; } +static void arc_default_smp_wait_to_boot(int cpu) +{ + while (wake_flag != cpu) + ; + + wake_flag = 0; +} + void arc_platform_smp_wait_to_boot(int cpu) { /* for halt-on-reset, we've waited already */ if (IS_ENABLED(CONFIG_ARC_SMP_HALT_ON_RESET)) return; - while (wake_flag != cpu) - ; - - wake_flag = 0; + /* platform callback might fail */ + if (plat_smp_ops.cpu_wait) + plat_smp_ops.cpu_wait(cpu); + else + arc_default_smp_wait_to_boot(cpu); } const char *arc_platform_smp_cpuinfo(void)