From patchwork Wed Mar 27 17:24:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 2352181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 7FECDDFE82 for ; Wed, 27 Mar 2013 17:27:41 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UKu5s-0005w3-9q; Wed, 27 Mar 2013 17:25:00 +0000 Received: from mail-qc0-x232.google.com ([2607:f8b0:400d:c01::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UKu5o-0005v5-MG for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2013 17:24:57 +0000 Received: by mail-qc0-f178.google.com with SMTP id d10so3062216qca.23 for ; Wed, 27 Mar 2013 10:24:54 -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=LwJ0A1JLsQ2CH8MocZF9k7YolSlct7nplckh3Ke0E7U=; b=SLTk1UTX0S+N2Ytm/JAAV2OniErj0+HWKtr+xZ0dmLz+HfPIGZymKia2w5JtBIGgsx VrqUQLCFY2ibu2s1MHVphcr7R/96boJOwn2pjw1+B9FE4iRepi/vavmpsFLm1PyqvixT su51ykxE+F2IlH0HM0DOn7I5WgYjkBw+7GNKS3R6mBsydDILAYtGc1e22U4FKPmYXC8C uJsCx5RFQCCIjmJibZNrZmdjdqWhLe5ZJ1WZ3dK//am/MLMkE+VYGXhWXv954nDWhT4o 5dPG6lHMQRwTifvTx00Ic9SjdKXwJXP8mi34O7/iq0iobkzGL+B8Xzncg40WzKSXOGl3 TqkA== X-Received: by 10.49.94.238 with SMTP id df14mr16293908qeb.44.1364405094154; Wed, 27 Mar 2013 10:24:54 -0700 (PDT) Received: from xanadu.home (modemcable139.65-203-24.mc.videotron.ca. [24.203.65.139]) by mx.google.com with ESMTPS id dt10sm18149772qab.0.2013.03.27.10.24.52 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 27 Mar 2013 10:24:53 -0700 (PDT) Date: Wed, 27 Mar 2013 13:24:51 -0400 (EDT) From: Nicolas Pitre To: Stefano Stabellini Subject: Re: [PATCH v3] [RFC] arm: use PSCI if available In-Reply-To: Message-ID: References: <1364388639-11210-1-git-send-email-stefano.stabellini@eu.citrix.com> <20130327133811.GE18429@mudshark.cambridge.arm.com> <51531FE3.8010905@gmail.com> User-Agent: Alpine 2.03 (LFD 1266 2009-07-14) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQltSFSAy1rGd9WEsxAB5W37WPV9NZ8DNFPbbbZRdScrqVz4AQhT70gfb6DVDpuu1CcmDhBS X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130327_132456_851935_C8503AB5 X-CRM114-Status: GOOD ( 24.72 ) 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: "xen-devel@lists.xensource.com" , "linux@arm.linux.org.uk" , "arnd@arndb.de" , Marc Zyngier , Will Deacon , "linux-kernel@vger.kernel.org" , "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 Wed, 27 Mar 2013, Stefano Stabellini wrote: > On Wed, 27 Mar 2013, Rob Herring wrote: > > On 03/27/2013 11:23 AM, Stefano Stabellini wrote: > > > Would you agree on a patch that moves virt_smp_ops out of mach-virt and > > > renames them to psci_smp_ops (maybe to arch/arm/kernel/psci_smp_ops.c)? > > > > > > Would you agree on initializing psci from setup_arch, right after the > > > call to arm_dt_init_cpu_maps()? > > > > > > Finally the most controversial point: would you agree on using > > > psci_smp_ops by default if they are available? > > > If not, would you at least agree on letting Xen overwrite the default > > > machine smp_ops? > > > We need one or the other for dom0 support. > > > > It should not be *always* use PSCI smp ops if available, but use them > > only if the platform does not define its own smp ops. > > Well, that is the one additional problem that we have on Xen. > > On x86 Xen replaces a lot of core native function calls with its own > implementations (see paravirt_ops). > On ARM we only need *one* set of calls: the smp_ops calls. > > So if we don't want to give priority to PSCI over the platform smp_ops, > then we need a simple workaround just for Xen in common code like the > one appended below. > Not pretty, but at least small: [...] What about the patch below that I'm carying in my MCPM branch which has been posted here already: From: Jon Medhurst Date: Thu, 13 Dec 2012 13:23:13 +0000 Subject: [PATCH] ARM: Enable selection of SMP operations at boot time 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 diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 308ad7d6f9..c01bf53b85 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h @@ -16,8 +16,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 { @@ -41,6 +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); 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