mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: <linuxppc-dev@lists.ozlabs.org>
Cc: <linux-kernel@vger.kernel.org>, <jk@ozlabs.org>, <arnd@arndb.de>,
	<geoff@infradead.org>
Subject: [RFC PATCH 05/20] powerpc/cell: Remove CBE_CPUFREQ_SPU_GOVERNOR
Date: Thu, 14 Nov 2024 23:50:54 +1100	[thread overview]
Message-ID: <20241114125111.599093-5-mpe@ellerman.id.au> (raw)
In-Reply-To: <20241114125111.599093-1-mpe@ellerman.id.au>

Although this driver is still buildable, it can't actually do anything
in practice now that the low-level cpufreq driver for Cell has been
disabled due to the removal of CBE_RAS.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/platforms/cell/Kconfig           |   9 --
 arch/powerpc/platforms/cell/Makefile          |   2 -
 .../platforms/cell/cpufreq_spudemand.c        | 134 ------------------
 3 files changed, 145 deletions(-)
 delete mode 100644 arch/powerpc/platforms/cell/cpufreq_spudemand.c

diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 758dc08a6dde..db65bfcd1e74 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -21,13 +21,4 @@ config SPU_BASE
 	bool
 	select PPC_COPRO_BASE
 
-config CBE_CPUFREQ_SPU_GOVERNOR
-	tristate "CBE frequency scaling based on SPU usage"
-	depends on SPU_FS && CPU_FREQ
-	default m
-	help
-	  This governor checks for spu usage to adjust the cpu frequency.
-	  If no spu is running on a given cpu, that cpu will be throttled to
-	  the minimal possible frequency.
-
 endmenu
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index 1d85c41939f9..7e5ff239c376 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -1,6 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_CBE_CPUFREQ_SPU_GOVERNOR)	+= cpufreq_spudemand.o
-
 obj-$(CONFIG_SPU_BASE)			+= spu_callbacks.o spu_base.o \
 					   spu_syscalls.o \
 					   spufs/
diff --git a/arch/powerpc/platforms/cell/cpufreq_spudemand.c b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
deleted file mode 100644
index 79172ba36eca..000000000000
--- a/arch/powerpc/platforms/cell/cpufreq_spudemand.c
+++ /dev/null
@@ -1,134 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * spu aware cpufreq governor for the cell processor
- *
- * © Copyright IBM Corporation 2006-2008
- *
- * Author: Christian Krafft <krafft@de.ibm.com>
- */
-
-#include <linux/cpufreq.h>
-#include <linux/sched.h>
-#include <linux/sched/loadavg.h>
-#include <linux/module.h>
-#include <linux/timer.h>
-#include <linux/workqueue.h>
-#include <linux/atomic.h>
-#include <asm/machdep.h>
-#include <asm/spu.h>
-
-#define POLL_TIME	100000		/* in µs */
-#define EXP		753		/* exp(-1) in fixed-point */
-
-struct spu_gov_info_struct {
-	unsigned long busy_spus;	/* fixed-point */
-	struct cpufreq_policy *policy;
-	struct delayed_work work;
-	unsigned int poll_int;		/* µs */
-};
-static DEFINE_PER_CPU(struct spu_gov_info_struct, spu_gov_info);
-
-static int calc_freq(struct spu_gov_info_struct *info)
-{
-	int cpu;
-	int busy_spus;
-
-	cpu = info->policy->cpu;
-	busy_spus = atomic_read(&cbe_spu_info[cpu_to_node(cpu)].busy_spus);
-
-	info->busy_spus = calc_load(info->busy_spus, EXP, busy_spus * FIXED_1);
-	pr_debug("cpu %d: busy_spus=%d, info->busy_spus=%ld\n",
-			cpu, busy_spus, info->busy_spus);
-
-	return info->policy->max * info->busy_spus / FIXED_1;
-}
-
-static void spu_gov_work(struct work_struct *work)
-{
-	struct spu_gov_info_struct *info;
-	int delay;
-	unsigned long target_freq;
-
-	info = container_of(work, struct spu_gov_info_struct, work.work);
-
-	/* after cancel_delayed_work_sync we unset info->policy */
-	BUG_ON(info->policy == NULL);
-
-	target_freq = calc_freq(info);
-	__cpufreq_driver_target(info->policy, target_freq, CPUFREQ_RELATION_H);
-
-	delay = usecs_to_jiffies(info->poll_int);
-	schedule_delayed_work_on(info->policy->cpu, &info->work, delay);
-}
-
-static void spu_gov_init_work(struct spu_gov_info_struct *info)
-{
-	int delay = usecs_to_jiffies(info->poll_int);
-	INIT_DEFERRABLE_WORK(&info->work, spu_gov_work);
-	schedule_delayed_work_on(info->policy->cpu, &info->work, delay);
-}
-
-static void spu_gov_cancel_work(struct spu_gov_info_struct *info)
-{
-	cancel_delayed_work_sync(&info->work);
-}
-
-static int spu_gov_start(struct cpufreq_policy *policy)
-{
-	unsigned int cpu = policy->cpu;
-	struct spu_gov_info_struct *info = &per_cpu(spu_gov_info, cpu);
-	struct spu_gov_info_struct *affected_info;
-	int i;
-
-	if (!cpu_online(cpu)) {
-		printk(KERN_ERR "cpu %d is not online\n", cpu);
-		return -EINVAL;
-	}
-
-	if (!policy->cur) {
-		printk(KERN_ERR "no cpu specified in policy\n");
-		return -EINVAL;
-	}
-
-	/* initialize spu_gov_info for all affected cpus */
-	for_each_cpu(i, policy->cpus) {
-		affected_info = &per_cpu(spu_gov_info, i);
-		affected_info->policy = policy;
-	}
-
-	info->poll_int = POLL_TIME;
-
-	/* setup timer */
-	spu_gov_init_work(info);
-
-	return 0;
-}
-
-static void spu_gov_stop(struct cpufreq_policy *policy)
-{
-	unsigned int cpu = policy->cpu;
-	struct spu_gov_info_struct *info = &per_cpu(spu_gov_info, cpu);
-	int i;
-
-	/* cancel timer */
-	spu_gov_cancel_work(info);
-
-	/* clean spu_gov_info for all affected cpus */
-	for_each_cpu (i, policy->cpus) {
-		info = &per_cpu(spu_gov_info, i);
-		info->policy = NULL;
-	}
-}
-
-static struct cpufreq_governor spu_governor = {
-	.name = "spudemand",
-	.start = spu_gov_start,
-	.stop = spu_gov_stop,
-	.owner = THIS_MODULE,
-};
-cpufreq_governor_init(spu_governor);
-cpufreq_governor_exit(spu_governor);
-
-MODULE_DESCRIPTION("SPU-aware cpufreq governor for the cell processor");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Christian Krafft <krafft@de.ibm.com>");
-- 
2.47.0


  parent reply	other threads:[~2024-11-14 12:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14 12:50 [RFC PATCH 01/20] powerpc/cell: Remove support for IBM Cell Blades Michael Ellerman
2024-11-14 12:50 ` [RFC PATCH 02/20] powerpc: Remove some Cell leftovers Michael Ellerman
2024-11-14 12:50 ` [RFC PATCH 03/20] powerpc: Remove PPC_PMI and driver Michael Ellerman
2024-11-14 12:50 ` [RFC PATCH 04/20] powerpc: Remove IBM_CELL_BLADE & SPIDER_NET references Michael Ellerman
2024-11-14 12:50 ` Michael Ellerman [this message]
2024-11-14 12:50 ` [RFC PATCH 06/20] powerpc/xmon: Remove SPU debug and disassembly Michael Ellerman
2024-11-14 12:50 ` [RFC PATCH 07/20] powerpc: Remove DCR_MMIO and the DCR generic layer Michael Ellerman
2024-11-14 12:50 ` [RFC PATCH 08/20] powerpc: Remove PPC_OF_PLATFORM_PCI Michael Ellerman
2024-11-14 12:50 ` [RFC PATCH 09/20] powerpc/io: Remove PPC_IO_WORKAROUNDS Michael Ellerman
2024-11-14 12:50 ` [RFC PATCH 10/20] powerpc/io: Remove PPC_INDIRECT_MMIO Michael Ellerman
2024-11-14 14:41   ` Arnd Bergmann
2024-11-14 12:51 ` [RFC PATCH 11/20] powerpc/io: Remove PCI_FIX_ADDR Michael Ellerman
2024-11-14 14:50   ` Arnd Bergmann
2024-11-14 12:51 ` [RFC PATCH 12/20] powerpc/io: Unhook MMIO accessors Michael Ellerman
2024-11-14 12:51 ` [RFC PATCH 13/20] powerpc/io: Remove unnecessary indirection Michael Ellerman
2024-11-14 15:24   ` Arnd Bergmann
2024-11-14 12:51 ` [RFC PATCH 14/20] powerpc: Remove UDBG_RTAS_CONSOLE Michael Ellerman
2024-11-14 12:51 ` [RFC PATCH 15/20] cpufreq: ppc_cbe: Remove powerpc Cell driver Michael Ellerman
2024-11-14 12:51 ` [RFC PATCH 16/20] EDAC/cell: " Michael Ellerman
2024-11-14 12:51 ` [RFC PATCH 17/20] net: spider_net: " Michael Ellerman
2024-11-14 14:55   ` Arnd Bergmann
2024-11-14 12:51 ` [RFC PATCH 18/20] net: toshiba: Remove reference to PPC_IBM_CELL_BLADE Michael Ellerman
2024-11-14 12:51 ` [RFC PATCH 19/20] docs: Remove reference to removed CBE_CPUFREQ_SPU_GOVERNOR Michael Ellerman
2024-11-14 12:51 ` [RFC PATCH 20/20] genirq: Remove IRQ_EDGE_EOI_HANDLER Michael Ellerman
2024-11-26 17:41   ` Thomas Gleixner
2024-11-14 15:28 ` [RFC PATCH 01/20] powerpc/cell: Remove support for IBM Cell Blades Arnd Bergmann
2024-11-15  0:30 ` Jeremy Kerr
2024-11-27 21:27 ` Segher Boessenkool

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=20241114125111.599093-5-mpe@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=arnd@arndb.de \
    --cc=geoff@infradead.org \
    --cc=jk@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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

all inboxes | Powered by JetHome®