From patchwork Tue Apr 9 16:30:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 2415891 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id DFA3C3FD8C for ; Tue, 9 Apr 2013 16:30:55 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UPbRa-00028O-FD; Tue, 09 Apr 2013 16:30:50 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UPbRX-0007Ra-SW; Tue, 09 Apr 2013 16:30:47 +0000 Received: from mail-qc0-x236.google.com ([2607:f8b0:400d:c01::236]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UPbRU-0007R1-1d for linux-arm-kernel@lists.infradead.org; Tue, 09 Apr 2013 16:30:44 +0000 Received: by mail-qc0-f182.google.com with SMTP id k19so3143297qcs.27 for ; Tue, 09 Apr 2013 09:30:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type:x-gm-message-state; bh=Zzjvsde3u4ubEjwfyS2/KoH6tRweyR/lICCm9iAn2N4=; b=ThdzDqWAmz6WpdGA8mfEH/+ZlTf+EV6742Ds8sEKqVvwvv2cnYyHcEeZm8Ne+N3oJx 1x+T/rB9bf0Q1cLENrYgBKVO6Y01ahkMtcmlK3fM2N1+7KEs9+duYhyZRlkGOuWrJx7N J+vAqz9m6tABYwY9EUExQNxFumMEoRoRTsxrCuEQR8jvBLFwvsTliA/YGdNHFI7m70vq lPBrNTn67eNc/gEQFgdHFEnbXuJAfxU+Wus7EvhXacRBMBSRANI0H1qMQ40QYQuW6vOm ZF97dWjy31U58TP5rEU2JIXAqT85N6eDPwVlIuzfxDIPy2KyyoXdl3kYD0AfLvNFg7tn uhTg== X-Received: by 10.49.6.2 with SMTP id w2mr16923568qew.0.1365525040374; Tue, 09 Apr 2013 09:30:40 -0700 (PDT) Received: from xanadu.home (modemcable139.65-203-24.mc.videotron.ca. [24.203.65.139]) by mx.google.com with ESMTPS id dl6sm19722883qab.12.2013.04.09.09.30.38 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 09 Apr 2013 09:30:39 -0700 (PDT) Date: Tue, 9 Apr 2013 12:30:37 -0400 (EDT) From: Nicolas Pitre To: Jon Medhurst Subject: Re: [PATCH v4 14/15] ARM: Enable selection of SMP operations at boot time In-Reply-To: <1360041732-17936-15-git-send-email-nicolas.pitre@linaro.org> Message-ID: References: <1360041732-17936-1-git-send-email-nicolas.pitre@linaro.org> <1360041732-17936-15-git-send-email-nicolas.pitre@linaro.org> User-Agent: Alpine 2.03 (LFD 1266 2009-07-14) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQm9EHd/dgonwmV5oTDfGM/oab/adLJF8/NWkSFvCeUC+AxHZ+T3kKWGZvT2aKGb8dCkd66K X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130409_123044_167117_79EC296E X-CRM114-Status: GOOD ( 17.33 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Dave Martin , lorenzo.pieralisi@arm.com, pawel.moll@arm.com, Catalin Marinas , Will Deacon , santosh.shilimkar@ti.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Tue, 5 Feb 2013, Nicolas Pitre wrote: > From: Jon Medhurst > > Add a new 'smp_init' hook to machine_desc so platforms can specify a > function to be used to setup smp ops instead of having a statically > defined value. > > Signed-off-by: Jon Medhurst > Signed-off-by: Nicolas Pitre > Reviewed-by: Santosh Shilimkar I've slightly amended this patch to make its usage more flexible, please see below. > diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h > index 917d4fcfd9..3d01c6d6c3 100644 > --- a/arch/arm/include/asm/mach/arch.h > +++ b/arch/arm/include/asm/mach/arch.h > @@ -17,8 +17,10 @@ struct pt_regs; > struct smp_operations; > #ifdef CONFIG_SMP > #define smp_ops(ops) (&(ops)) > +#define smp_init_ops(ops) (&(ops)) > #else > #define smp_ops(ops) (struct smp_operations *)NULL > +#define smp_init_ops(ops) (void (*)(void))NULL > #endif > > struct machine_desc { > @@ -42,6 +44,7 @@ struct machine_desc { > unsigned char reserve_lp2 :1; /* never has lp2 */ > char restart_mode; /* default restart mode */ > struct smp_operations *smp; /* SMP operations */ > + void (*smp_init)(void); > void (*fixup)(struct tag *, char **, > struct meminfo *); > void (*reserve)(void);/* reserve mem blocks */ > diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c > index 3f6cbb2e3e..41edca8582 100644 > --- a/arch/arm/kernel/setup.c > +++ b/arch/arm/kernel/setup.c > @@ -768,7 +768,10 @@ void __init setup_arch(char **cmdline_p) > arm_dt_init_cpu_maps(); > #ifdef CONFIG_SMP > if (is_smp()) { > - smp_set_ops(mdesc->smp); > + if(mdesc->smp_init) > + (*mdesc->smp_init)(); > + else > + smp_set_ops(mdesc->smp); > smp_init_cpus(); > } > #endif I've amended it with the following changes to deal with an issue highlighted by Tixy. If the runtime hook does not initialize the smp ops, the core may continue with a default. That should let MCPM, PSCI and Xen play well together. Nicolas Reviewed-by: Jon Medhurst diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index c01bf53b85..af8c54c6c6 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h @@ -19,7 +19,7 @@ struct smp_operations; #define smp_init_ops(ops) (&(ops)) #else #define smp_ops(ops) (struct smp_operations *)NULL -#define smp_init_ops(ops) (void (*)(void))NULL +#define smp_init_ops(ops) (bool (*)(void))NULL #endif struct machine_desc { @@ -43,7 +43,7 @@ struct machine_desc { unsigned char reserve_lp2 :1; /* never has lp2 */ char restart_mode; /* default restart mode */ struct smp_operations *smp; /* SMP operations */ - void (*smp_init)(void); + bool (*smp_init)(void); void (*fixup)(struct tag *, char **, struct meminfo *); void (*reserve)(void);/* reserve mem blocks */ diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index e69c580c6f..cf4b08c0f9 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -768,9 +768,7 @@ void __init setup_arch(char **cmdline_p) arm_dt_init_cpu_maps(); #ifdef CONFIG_SMP if (is_smp()) { - if (mdesc->smp_init) - mdesc->smp_init(); - else + if (!mdesc->smp_init || !mdesc->smp_init()) smp_set_ops(mdesc->smp); smp_init_cpus(); }