linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: chris.packham@alliedtelesis.co.nz (Chris Packham)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCHv3] ARM: mvebu: Let the device-tree determine smp_ops
Date: Mon, 17 Nov 2014 11:40:07 +1300	[thread overview]
Message-ID: <1416177607-11305-1-git-send-email-chris.packham@alliedtelesis.co.nz> (raw)
In-Reply-To: <1415327626-16079-1-git-send-email-chris.packham@alliedtelesis.co.nz>

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 <chris.packham@alliedtelesis.co.nz>
---
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,
-- 
2.2.0.rc0

  reply	other threads:[~2014-11-16 22:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06  4:49 [RFC PATCH] ARM: mvebu: Let the device-tree determine smp_ops Chris Packham
2014-11-06 14:49 ` Andrew Lunn
2014-11-06 19:49   ` Chris Packham
2014-11-06 20:03     ` Andrew Lunn
2014-11-06 14:58 ` Thomas Petazzoni
2014-11-06 15:21   ` Andrew Lunn
2014-11-06 15:33     ` Thomas Petazzoni
2014-11-06 19:56   ` Chris Packham
2014-11-06 20:16     ` Andrew Lunn
2014-11-07  2:33       ` [RFC PATCHv2] " Chris Packham
2014-11-16 22:40         ` Chris Packham [this message]
2014-11-17  8:45         ` Thomas Petazzoni
2014-11-17  8:56         ` Thomas Petazzoni
2014-11-17 20:46           ` Chris Packham
2014-11-17 23:34           ` Chris Packham
2014-11-18  0:31             ` Chris Packham
2014-11-18  8:21               ` Maxime Ripard
2014-11-18 19:43                 ` Chris Packham
2014-11-18 23:37                 ` [RFC PATCHv4] ARM: mvebu: use dt_fixup to provide fallback for enable-method Chris Packham
2014-11-18  8:16             ` [RFC PATCHv2] ARM: mvebu: Let the device-tree determine smp_ops Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416177607-11305-1-git-send-email-chris.packham@alliedtelesis.co.nz \
    --to=chris.packham@alliedtelesis.co.nz \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).