All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: linux-parisc@vger.kernel.org
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	John David Anglin <dave.anglin@bell.net>
Subject: [PATCH 11/12] parisc: Rewrite arch_cpu_idle_dead() for CPU hotplugging
Date: Fri, 25 Mar 2022 15:38:32 +0100	[thread overview]
Message-ID: <20220325143833.402631-11-deller@gmx.de> (raw)
In-Reply-To: <20220325143833.402631-1-deller@gmx.de>

Let the PDC firmware put the CPU into firmware idle loop with
pdc_cpu_rendezvous() function.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 arch/parisc/kernel/process.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index ea3d83b6fb62..44fa89fbb280 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -38,6 +38,7 @@
 #include <linux/rcupdate.h>
 #include <linux/random.h>
 #include <linux/nmi.h>
+#include <linux/sched/hotplug.h>

 #include <asm/io.h>
 #include <asm/asm-offsets.h>
@@ -46,6 +47,7 @@
 #include <asm/pdc_chassis.h>
 #include <asm/unwind.h>
 #include <asm/sections.h>
+#include <asm/cacheflush.h>

 #define COMMAND_GLOBAL  F_EXTEND(0xfffe0030)
 #define CMD_RESET       5       /* reset any module */
@@ -158,10 +160,35 @@ void release_thread(struct task_struct *dead_task)
 int running_on_qemu __ro_after_init;
 EXPORT_SYMBOL(running_on_qemu);

-void __cpuidle arch_cpu_idle_dead(void)
+/*
+ * Called from the idle thread for the CPU which has been shutdown.
+ */
+void arch_cpu_idle_dead(void)
 {
-	/* nop on real hardware, qemu will offline CPU. */
-	asm volatile("or %%r31,%%r31,%%r31\n":::);
+#ifdef CONFIG_HOTPLUG_CPU
+	idle_task_exit();
+
+	local_irq_disable();
+
+	/*
+	 * Tell __cpu_die() that this CPU is now safe to dispose of.
+	 */
+	(void)cpu_report_death();
+
+	/*
+	 * Ensure that the cache lines are written out.
+	 */
+	flush_cache_all_local();
+	flush_tlb_all_local(NULL);
+
+	/*
+	 * Let PDC firmware put CPU into firmware idle loop.
+	 */
+	__pdc_cpu_rendezvous();
+
+	pr_warn("PDC does not provide rendezvous function.\n");
+#endif
+	while (1);
 }

 void __cpuidle arch_cpu_idle(void)
--
2.35.1


  parent reply	other threads:[~2022-03-25 14:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 14:38 [PATCH 01/12] parisc: Switch from GENERIC_CPU_DEVICES to GENERIC_ARCH_TOPOLOGY Helge Deller
2022-03-25 14:38 ` [PATCH 02/12] parisc: Add __cpuinit section for HOTPLUG_CPU Helge Deller
2022-03-25 14:38 ` [PATCH 03/12] parisc: Move store_cpu_topology() into __cpuinit section Helge Deller
2022-03-25 16:52   ` Rolf Eike Beer
2022-03-25 17:12     ` Helge Deller
2022-03-25 14:38 ` [PATCH 04/12] parisc: Move start_cpu_itimer() " Helge Deller
2022-03-25 16:53   ` Rolf Eike Beer
2022-03-25 17:13     ` Helge Deller
2022-03-25 14:38 ` [PATCH 05/12] parisc: Move init_per_cpu() init " Helge Deller
2022-03-25 14:38 ` [PATCH 06/12] parisc: Move disable_sr_hashing_asm() into " Helge Deller
2022-03-25 14:38 ` [PATCH 07/12] parisc: Move disable_sr_hashing() " Helge Deller
2022-03-25 14:38 ` [PATCH 08/12] parisc: Move init_IRQ() " Helge Deller
2022-03-25 14:38 ` [PATCH 09/12] parisc: Ensure set_firmware_width() is called only once Helge Deller
2022-03-26  8:58   ` Rolf Eike Beer
2022-03-25 14:38 ` [PATCH 10/12] parisc: Move common_stext into text section when CONFIG_HOTPLUG_CPU=y Helge Deller
2022-03-25 14:38 ` Helge Deller [this message]
2022-03-25 16:56   ` [PATCH 11/12] parisc: Rewrite arch_cpu_idle_dead() for CPU hotplugging Rolf Eike Beer
2022-03-25 17:14     ` Helge Deller
2022-03-25 14:38 ` [PATCH 12/12] parisc: Implement __cpu_die() and __cpu_disable() " Helge Deller
2022-03-25 17:10   ` Rolf Eike Beer
2022-03-25 18:00     ` Helge Deller
2022-03-25 14:53 ` [PATCH 01/12] parisc: Switch from GENERIC_CPU_DEVICES to GENERIC_ARCH_TOPOLOGY Helge Deller
2022-03-25 16:46 ` Rolf Eike Beer

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=20220325143833.402631-11-deller@gmx.de \
    --to=deller@gmx.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=linux-parisc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.