Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: Stuart Menefy <stuart.menefy@mathembedded.com>
To: Russell King <linux@armlinux.org.uk>,
	Arnd Bergmann <arnd@arndb.de>, Will Deacon <will.deacon@arm.com>,
	Nicolas Pitre <nico@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: [PATCH] ARM: MCPM: Add provision for platform specific wfi alternative
Date: Sun, 10 Feb 2019 23:12:12 +0000
Message-ID: <20190210231212.20470-1-stuart.menefy@mathembedded.com> (raw)

On some platforms (in particular the Exynos5260) the wfi is not
executed directly by the operating system but by trapping into the
secure monitor. This allows us to replicate the behaviour of the
vendor supplied kernel using the MCPM framework.

Signed-off-by: Stuart Menefy <stuart.menefy@mathembedded.com>
---
 arch/arm/common/mcpm_entry.c | 8 ++++++--
 arch/arm/include/asm/mcpm.h  | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c
index ad574d20415c..524be627c87e 100644
--- a/arch/arm/common/mcpm_entry.c
+++ b/arch/arm/common/mcpm_entry.c
@@ -289,8 +289,12 @@ void mcpm_cpu_power_down(void)
 	__mcpm_cpu_down(cpu, cluster);
 
 	/* Now we are prepared for power-down, do it: */
-	if (cpu_going_down)
-		wfi();
+	if (cpu_going_down) {
+		if (platform_ops->wfi_alternative)
+			platform_ops->wfi_alternative(last_man);
+		else
+			wfi();
+	}
 
 	/*
 	 * It is possible for a power_up request to happen concurrently
diff --git a/arch/arm/include/asm/mcpm.h b/arch/arm/include/asm/mcpm.h
index acd4983d9b1f..96fdb41ac626 100644
--- a/arch/arm/include/asm/mcpm.h
+++ b/arch/arm/include/asm/mcpm.h
@@ -223,6 +223,7 @@ struct mcpm_platform_ops {
 	int (*cluster_powerup)(unsigned int cluster);
 	void (*cpu_suspend_prepare)(unsigned int cpu, unsigned int cluster);
 	void (*cpu_powerdown_prepare)(unsigned int cpu, unsigned int cluster);
+	void (*wfi_alternative)(bool last_man);
 	void (*cluster_powerdown_prepare)(unsigned int cluster);
 	void (*cpu_cache_disable)(void);
 	void (*cluster_cache_disable)(void);
-- 
2.13.6


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-10 23:12 Stuart Menefy [this message]
2019-02-11 13:53 ` Stuart Menefy
2019-02-11 14:12   ` Russell King - ARM Linux admin
2019-02-11 15:57   ` Nicolas Pitre

Reply instructions:

You may reply publically 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=20190210231212.20470-1-stuart.menefy@mathembedded.com \
    --to=stuart.menefy@mathembedded.com \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nico@linaro.org \
    --cc=will.deacon@arm.com \
    /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

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org infradead-linux-arm-kernel@archiver.kernel.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox