From patchwork Sun Nov 16 22:40:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 5315151 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1951EC11AC for ; Sun, 16 Nov 2014 22:43:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 210352012F for ; Sun, 16 Nov 2014 22:43:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8763E2012D for ; Sun, 16 Nov 2014 22:43:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xq8VR-0007Ns-Ty; Sun, 16 Nov 2014 22:41:17 +0000 Received: from gate2.alliedtelesis.co.nz ([2001:df5:b000:5::4]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xq8VN-0007Ct-EF for linux-arm-kernel@lists.infradead.org; Sun, 16 Nov 2014 22:41:14 +0000 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 7349C844D0; Mon, 17 Nov 2014 11:40:41 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail; t=1416177641; bh=9utMUjDHhaYlWDPCfntiiyLUkdVR1hbU3hG/OeYtGFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0MOXb1mXra3NQ6Td3AQQ6U3wqJdDXOQx0ldzGEph5jcdaJ4jGdLIaZ+MI4k4ovkDe i/FTxIfuyZUBhw00XjHxT5TM+64fP9nTfFIF2bo/oCeGfErACJQvjCxfdNfW7BZI3o 4FiPRGeiYjcEPGgvv/jDVj+/WkgdxlL7YvMzl+oI= Received: from alliedtelesyn.co.nz (Not Verified[10.32.16.32]) by mmarshal3.atlnz.lc with MailMarshal (v7, 1, 0, 4874) id ; Mon, 17 Nov 2014 11:40:40 +1300 Received: from MAIL/SpoolDir by alliedtelesyn.co.nz (Mercury 1.48); 17 Nov 14 11:41:10 +1300 Received: from SpoolDir by MAIL (Mercury 1.48); 17 Nov 14 11:41:00 +1300 Received: from chrisp-dl.ws.atlnz.lc (10.33.22.20) by alliedtelesyn.co.nz (Mercury 1.48) with ESMTP; 17 Nov 14 11:40:55 +1300 Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 1E235C1C46; Mon, 17 Nov 2014 11:40:26 +1300 (NZDT) From: Chris Packham To: Subject: [RFC PATCHv3] ARM: mvebu: Let the device-tree determine smp_ops Date: Mon, 17 Nov 2014 11:40:07 +1300 Message-Id: <1416177607-11305-1-git-send-email-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.2.0.rc0 In-Reply-To: <1415327626-16079-1-git-send-email-chris.packham@alliedtelesis.co.nz> References: <1415327626-16079-1-git-send-email-chris.packham@alliedtelesis.co.nz> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141116_144113_988878_F2543527 X-CRM114-Status: GOOD ( 18.41 ) X-Spam-Score: -0.1 (/) Cc: Thomas Petazzoni , Andrew Lunn , Jason Cooper , Boris Brezillon , Chris Packham , Ezequiel Garcia , Gregory Clement , Sebastian Hesselbarth X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The machine specific SMP operations can be configured either via setup_arch or via arm_dt_init_cpu_maps. For the ARMADA_370_XP_DT devices both of these are called and setup_arch wins because it is called last. This means that it is not possible to substitute a different set of SMP operations via the device-tree. Add a new smp_ops_is_set API that tells us if something else has already set smp_ops. Use this new API in a smp_init function for the ARMADA_370_XP_DT compatible devices to prevent setup_arch from overriding the operations configured earlier. Signed-off-by: Chris Packham --- Hi, I didn't see any comment's on v2[1]. I'm not sure if I should take this as disapproval with that approach or just a sign that people are busy. This is an alternative solution that addresses one issue I had with the v2 implementation namely we now know whether smp_ops have been set or not and can use this information to avoid setting them again. The downside is I'm now modifying core code. Thanks, Chris -- [1] - http://lists.infradead.org/pipermail/linux-arm-kernel/2014-November/300480.html arch/arm/include/asm/smp.h | 1 + arch/arm/kernel/smp.c | 10 +++++++++- arch/arm/mach-mvebu/board-v7.c | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h index 18f5a55..aa55889 100644 --- a/arch/arm/include/asm/smp.h +++ b/arch/arm/include/asm/smp.h @@ -122,5 +122,6 @@ struct of_cpu_method { * set platform specific SMP operations */ extern void smp_set_ops(struct smp_operations *); +extern bool smp_ops_is_set(void); #endif /* ifndef __ASM_ARM_SMP_H */ diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 13396d3..f303655 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -77,13 +77,21 @@ enum ipi_msg_type { static DECLARE_COMPLETION(cpu_running); static struct smp_operations smp_ops; +static bool smp_ops_set = false; void __init smp_set_ops(struct smp_operations *ops) { - if (ops) + if (ops) { smp_ops = *ops; + smp_ops_set = true; + } }; +bool smp_ops_is_set(void) +{ + return smp_ops_set; +} + static unsigned long get_arch_pgd(pgd_t *pgd) { phys_addr_t pgdir = virt_to_idmap(pgd); diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index 6478626..86b4b5d 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c @@ -198,6 +198,11 @@ static void __init mvebu_dt_init(void) of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } +static bool __init armada_smp_init(void) +{ + return smp_ops_is_set(); +} + static const char * const armada_370_xp_dt_compat[] = { "marvell,armada-370-xp", NULL, @@ -206,6 +211,7 @@ static const char * const armada_370_xp_dt_compat[] = { DT_MACHINE_START(ARMADA_370_XP_DT, "Marvell Armada 370/XP (Device Tree)") .l2c_aux_val = 0, .l2c_aux_mask = ~0, + .smp_init = armada_smp_init, .smp = smp_ops(armada_xp_smp_ops), .init_machine = mvebu_dt_init, .init_irq = mvebu_init_irq,