From patchwork Fri Dec 12 04:53:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 5478961 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 D46CDBEEA8 for ; Fri, 12 Dec 2014 04:57:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5963201D3 for ; Fri, 12 Dec 2014 04:57:53 +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 DF5BC201BB for ; Fri, 12 Dec 2014 04:57:51 +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 1XzIFX-0002hs-Gh; Fri, 12 Dec 2014 04:54:43 +0000 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XzIFT-0002f0-GF for linux-arm-kernel@lists.infradead.org; Fri, 12 Dec 2014 04:54:40 +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 E2345803EB; Fri, 12 Dec 2014 17:54:07 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail; t=1418360047; bh=LU6n2Nxlol1y0+FEQISys5NsWcI1/0MuLCIQe9RSQK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=J8xr6XfzaIiapkCHs5C0y+ctUKAUeC1JMr5xVs8JL06O8XEOg2X7uO0E896V9GyLF OWJrT8RLDGt0hxslYQzOrTo6OKTLrk5Tnr5UXvBPVQQNyAilLIqfycRGvDDoT2TgOp 7AuGJmbX7tf0mQ9r2SGt0k60YdLDrTJaqgASUo/E= Received: from alliedtelesyn.co.nz (Not Verified[10.32.16.32]) by mmarshal3.atlnz.lc with MailMarshal (v7, 1, 0, 4874) id ; Fri, 12 Dec 2014 17:54:07 +1300 Received: from MAIL/SpoolDir by alliedtelesyn.co.nz (Mercury 1.48); 12 Dec 14 17:54:44 +1300 Received: from SpoolDir by MAIL (Mercury 1.48); 12 Dec 14 17:54:40 +1300 Received: from chrisp-dl.ws.atlnz.lc (10.33.22.30) by alliedtelesyn.co.nz (Mercury 1.48) with ESMTP; 12 Dec 14 17:54:37 +1300 Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 05A6180D9C; Fri, 12 Dec 2014 17:54:01 +1300 (NZDT) From: Chris Packham To: Arnd Bergmann , Subject: Re: [RFC/PATCH 1/4 PATCH] ARM: mvebu: use dt_fixup to provide fallback for enable-method Date: Fri, 12 Dec 2014 17:53:55 +1300 Message-Id: <1418360035-27975-1-git-send-email-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.2.0.rc0 In-Reply-To: <5488A2C0.5040804@alliedtelesis.co.nz> References: <5488A2C0.5040804@alliedtelesis.co.nz> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141211_205439_991806_C8840EE4 X-CRM114-Status: GOOD ( 20.57 ) X-Spam-Score: -0.1 (/) Cc: Chris Packham 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=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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 Hi Arnd, > On 12/10/2014 10:44 PM, Arnd Bergmann wrote: >> On Wednesday 10 December 2014 15:39:44 Chris Packham wrote: >>> >>> +static void __init armada_370_xp_dt_fixup(void) >>> +{ >>> + smp_set_ops(smp_ops(armada_xp_smp_ops)); >>> +} >>> + >>> >> >> The dt_fixup callback pointer is meant to fix up a legacy dtb file in >> memory. I think this would be fairly easy in this case, just add in the >> missing enable-method property here to make the normal boot path >> work for old dtbs. >> >> Arnd >> > > I briefly explored that approach here[1]. The tricky part would be > handling the fact that the enable method can be attached to either the > /cpus node or and individual /cpu entry (or is that something I can > ignore?). > > In the end I thought that the unconditional setting of smp_ops was > easier to implement and would achieve the same result. Actually as it turns out it's not that hard to implement something that checks both /cpus and /cpus/cpu@n. I'll include this with the next round after I've waited for anymore feedback. ---8<--- Subject: [PATCH] ARM: mvebu: use dt_fixup to provide fallback for enable-method When the device tree doesn't define an enable-method insert a property into the flattened device tree. arm_dt_init_cpu_maps() will then parse this an set smp_ops appropriately. Now that we have this fallback it is no longer necessary to set .smp in the DT_MACHINE definition. Signed-off-by: Chris Packham --- arch/arm/mach-mvebu/Makefile | 2 ++ arch/arm/mach-mvebu/board-v7.c | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index e24136b..68310f8 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile @@ -14,3 +14,5 @@ endif obj-$(CONFIG_MACH_DOVE) += dove.o obj-$(CONFIG_MACH_KIRKWOOD) += kirkwood.o kirkwood-pm.o obj-$(CONFIG_MACH_NETXBIG) += netxbig.o + +CFLAGS_board-v7.o = -I$(src)/../../../scripts/dtc/libfdt \ No newline at end of file diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index d0d39f1..0592c76 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include #include @@ -198,6 +200,39 @@ static void __init mvebu_dt_init(void) of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } +static void __init armada_370_xp_dt_fixup(void) +{ + int offset, node; + int i, len; + void *prop; + char buffer[20]; + + offset = fdt_path_offset(initial_boot_params, "/cpus"); + if (offset < 0) + return; + + prop = fdt_getprop(initial_boot_params, offset, "enable-method", &len); + if (prop) + return; + + for (i = 0; i < NR_CPUS; i++) { + snprintf(buffer, sizeof(buffer), "cpu@%d", i); + node = fdt_subnode_offset(initial_boot_params, offset, buffer); + if (node < 0) + break; + prop = fdt_getprop(initial_boot_params, node, + "enable-method", &len); + if (prop) + return; + } + + pr_info("No enable-method defined. " + "Falling back to \"marvell,armada-xp-smp\"\n"); + + fdt_setprop(initial_boot_params, offset, "enable-method", + "marvell,armada-xp-smp", sizeof("marvell,armada-xp-smp")); +} + static const char * const armada_370_xp_dt_compat[] = { "marvell,armada-370-xp", NULL, @@ -206,11 +241,11 @@ 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 = smp_ops(armada_xp_smp_ops), .init_machine = mvebu_dt_init, .init_irq = mvebu_init_irq, .restart = mvebu_restart, .dt_compat = armada_370_xp_dt_compat, + .dt_fixup = armada_370_xp_dt_fixup, MACHINE_END static const char * const armada_375_dt_compat[] = {