All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org
Cc: devicetree@vger.kernel.org,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Charles Garcia Tobin <Charles.Garcia-Tobin@arm.com>,
	Nicolas Pitre <nico@linaro.org>, Rob Herring <robh+dt@kernel.org>,
	Grant Likely <grant.likely@linaro.org>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amit.kucheria@linaro.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Antti Miettinen <ananaza@iki.fi>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Kevin Hilman <khilman@linaro.org>,
	Sebastian Capella <sebcape@gmail.com>,
	Tomasz Figa <t.figa@samsung.com>, Mark Brown <broonie@kernel.org>,
	Paul Walmsley <paul@pwsan.com>,
	Chander Kashyap <chander.kashyap@linaro.org>,
	Geoff
Subject: [PATCH v6 3/7] arm64: kernel: introduce cpu_init_idle CPU operation
Date: Mon, 21 Jul 2014 17:06:22 +0100	[thread overview]
Message-ID: <1405958786-17243-4-git-send-email-lorenzo.pieralisi@arm.com> (raw)
In-Reply-To: <1405958786-17243-1-git-send-email-lorenzo.pieralisi@arm.com>

The CPUidle subsystem on ARM64 machines requires the idle states
implementation back-end to initialize idle states parameter upon
boot. This patch adds a hook in the CPU operations structure that
should be initialized by the CPU operations back-end in order to
provide a function that initializes cpu idle states.

This patch also adds the infrastructure to arm64 kernel required
to export the CPU operations based initialization interface, so
that drivers (ie CPUidle) can use it when they are initialized
at probe time.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
 arch/arm64/include/asm/cpu_ops.h |  1 +
 arch/arm64/include/asm/cpuidle.h | 13 +++++++++++++
 arch/arm64/kernel/Makefile       |  1 +
 arch/arm64/kernel/cpuidle.c      | 27 +++++++++++++++++++++++++++
 4 files changed, 42 insertions(+)
 create mode 100644 arch/arm64/include/asm/cpuidle.h
 create mode 100644 arch/arm64/kernel/cpuidle.c

diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h
index d7b4b38..c156498 100644
--- a/arch/arm64/include/asm/cpu_ops.h
+++ b/arch/arm64/include/asm/cpu_ops.h
@@ -47,6 +47,7 @@ struct device_node;
 struct cpu_operations {
 	const char	*name;
 	int		(*cpu_init)(struct device_node *, unsigned int);
+	int		(*cpu_init_idle)(struct device_node *, unsigned int);
 	int		(*cpu_prepare)(unsigned int);
 	int		(*cpu_boot)(unsigned int);
 	void		(*cpu_postboot)(void);
diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h
new file mode 100644
index 0000000..b52a993
--- /dev/null
+++ b/arch/arm64/include/asm/cpuidle.h
@@ -0,0 +1,13 @@
+#ifndef __ASM_CPUIDLE_H
+#define __ASM_CPUIDLE_H
+
+#ifdef CONFIG_CPU_IDLE
+extern int cpu_init_idle(unsigned int cpu);
+#else
+static inline int cpu_init_idle(unsigned int cpu)
+{
+	return -EOPNOTSUPP;
+}
+#endif
+
+#endif
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index cdaedad..7b0c068 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -26,6 +26,7 @@ arm64-obj-$(CONFIG_PERF_EVENTS)		+= perf_regs.o
 arm64-obj-$(CONFIG_HW_PERF_EVENTS)	+= perf_event.o
 arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= hw_breakpoint.o
 arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND)	+= sleep.o suspend.o
+arm64-obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 arm64-obj-$(CONFIG_JUMP_LABEL)		+= jump_label.o
 arm64-obj-$(CONFIG_KGDB)		+= kgdb.o
 arm64-obj-$(CONFIG_EFI)			+= efi.o efi-stub.o efi-entry.o
diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c
new file mode 100644
index 0000000..46eb3ea
--- /dev/null
+++ b/arch/arm64/kernel/cpuidle.c
@@ -0,0 +1,27 @@
+/*
+ * ARM64 CPU idle arch support
+ *
+ * Copyright (C) 2014 ARM Ltd.
+ * Author: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <asm/cpu_ops.h>
+
+int cpu_init_idle(unsigned int cpu)
+{
+	struct device_node *cpu_node = of_cpu_device_node_get(cpu);
+
+	if (!cpu_node)
+		return -ENODEV;
+
+	if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_init_idle)
+		return cpu_ops[cpu]->cpu_init_idle(cpu_node, cpu);
+
+	return -EOPNOTSUPP;
+}
-- 
1.9.1



WARNING: multiple messages have this Message-ID (diff)
From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 3/7] arm64: kernel: introduce cpu_init_idle CPU operation
Date: Mon, 21 Jul 2014 17:06:22 +0100	[thread overview]
Message-ID: <1405958786-17243-4-git-send-email-lorenzo.pieralisi@arm.com> (raw)
In-Reply-To: <1405958786-17243-1-git-send-email-lorenzo.pieralisi@arm.com>

The CPUidle subsystem on ARM64 machines requires the idle states
implementation back-end to initialize idle states parameter upon
boot. This patch adds a hook in the CPU operations structure that
should be initialized by the CPU operations back-end in order to
provide a function that initializes cpu idle states.

This patch also adds the infrastructure to arm64 kernel required
to export the CPU operations based initialization interface, so
that drivers (ie CPUidle) can use it when they are initialized
at probe time.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
 arch/arm64/include/asm/cpu_ops.h |  1 +
 arch/arm64/include/asm/cpuidle.h | 13 +++++++++++++
 arch/arm64/kernel/Makefile       |  1 +
 arch/arm64/kernel/cpuidle.c      | 27 +++++++++++++++++++++++++++
 4 files changed, 42 insertions(+)
 create mode 100644 arch/arm64/include/asm/cpuidle.h
 create mode 100644 arch/arm64/kernel/cpuidle.c

diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h
index d7b4b38..c156498 100644
--- a/arch/arm64/include/asm/cpu_ops.h
+++ b/arch/arm64/include/asm/cpu_ops.h
@@ -47,6 +47,7 @@ struct device_node;
 struct cpu_operations {
 	const char	*name;
 	int		(*cpu_init)(struct device_node *, unsigned int);
+	int		(*cpu_init_idle)(struct device_node *, unsigned int);
 	int		(*cpu_prepare)(unsigned int);
 	int		(*cpu_boot)(unsigned int);
 	void		(*cpu_postboot)(void);
diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h
new file mode 100644
index 0000000..b52a993
--- /dev/null
+++ b/arch/arm64/include/asm/cpuidle.h
@@ -0,0 +1,13 @@
+#ifndef __ASM_CPUIDLE_H
+#define __ASM_CPUIDLE_H
+
+#ifdef CONFIG_CPU_IDLE
+extern int cpu_init_idle(unsigned int cpu);
+#else
+static inline int cpu_init_idle(unsigned int cpu)
+{
+	return -EOPNOTSUPP;
+}
+#endif
+
+#endif
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index cdaedad..7b0c068 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -26,6 +26,7 @@ arm64-obj-$(CONFIG_PERF_EVENTS)		+= perf_regs.o
 arm64-obj-$(CONFIG_HW_PERF_EVENTS)	+= perf_event.o
 arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= hw_breakpoint.o
 arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND)	+= sleep.o suspend.o
+arm64-obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 arm64-obj-$(CONFIG_JUMP_LABEL)		+= jump_label.o
 arm64-obj-$(CONFIG_KGDB)		+= kgdb.o
 arm64-obj-$(CONFIG_EFI)			+= efi.o efi-stub.o efi-entry.o
diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c
new file mode 100644
index 0000000..46eb3ea
--- /dev/null
+++ b/arch/arm64/kernel/cpuidle.c
@@ -0,0 +1,27 @@
+/*
+ * ARM64 CPU idle arch support
+ *
+ * Copyright (C) 2014 ARM Ltd.
+ * Author: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <asm/cpu_ops.h>
+
+int cpu_init_idle(unsigned int cpu)
+{
+	struct device_node *cpu_node = of_cpu_device_node_get(cpu);
+
+	if (!cpu_node)
+		return -ENODEV;
+
+	if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_init_idle)
+		return cpu_ops[cpu]->cpu_init_idle(cpu_node, cpu);
+
+	return -EOPNOTSUPP;
+}
-- 
1.9.1

  parent reply	other threads:[~2014-07-21 16:06 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 16:06 [PATCH v6 0/7] ARM generic idle states Lorenzo Pieralisi
2014-07-21 16:06 ` Lorenzo Pieralisi
2014-07-21 16:06 ` [PATCH v6 1/7] Documentation: arm: define DT idle states bindings Lorenzo Pieralisi
2014-07-21 16:06   ` Lorenzo Pieralisi
2014-07-21 22:40   ` Nicolas Pitre
2014-07-21 22:40     ` Nicolas Pitre
2014-07-22 12:38   ` Rob Herring
2014-07-22 12:38     ` Rob Herring
2014-07-23 15:52   ` Daniel Lezcano
2014-07-23 15:52     ` Daniel Lezcano
2014-07-21 16:06 ` [PATCH v6 2/7] drivers: cpuidle: implement DT based idle states infrastructure Lorenzo Pieralisi
2014-07-21 16:06   ` Lorenzo Pieralisi
2014-07-23 16:07   ` Daniel Lezcano
2014-07-23 16:07     ` Daniel Lezcano
2014-07-23 17:19     ` Lorenzo Pieralisi
2014-07-23 17:19       ` Lorenzo Pieralisi
2014-07-23 16:34   ` Ashwin Chaugule
2014-07-23 16:34     ` Ashwin Chaugule
2014-07-23 17:32     ` Lorenzo Pieralisi
2014-07-23 17:32       ` Lorenzo Pieralisi
2014-07-23 19:08       ` Ashwin Chaugule
2014-07-23 19:08         ` Ashwin Chaugule
2014-07-21 16:06 ` Lorenzo Pieralisi [this message]
2014-07-21 16:06   ` [PATCH v6 3/7] arm64: kernel: introduce cpu_init_idle CPU operation Lorenzo Pieralisi
2014-07-21 22:55   ` Stephen Boyd
2014-07-21 22:55     ` Stephen Boyd
2014-07-22  9:12     ` Lorenzo Pieralisi
2014-07-22  9:12       ` Lorenzo Pieralisi
     [not found] ` <1405958786-17243-1-git-send-email-lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>
2014-07-21 16:06   ` [PATCH v6 4/7] arm64: add PSCI CPU_SUSPEND based cpu_suspend support Lorenzo Pieralisi
2014-07-21 16:06     ` Lorenzo Pieralisi
2014-07-23 16:15     ` Ashwin Chaugule
2014-07-23 16:15       ` Ashwin Chaugule
2014-07-21 16:06 ` [PATCH v6 5/7] drivers: cpuidle: CPU idle ARM64 driver Lorenzo Pieralisi
2014-07-21 16:06   ` Lorenzo Pieralisi
2014-07-23 16:34   ` Ashwin Chaugule
2014-07-23 16:34     ` Ashwin Chaugule
2014-07-21 16:06 ` [PATCH v6 6/7] drivers: cpuidle: initialize big.LITTLE driver through DT Lorenzo Pieralisi
2014-07-21 16:06   ` Lorenzo Pieralisi
2014-07-23 16:26   ` Catalin Marinas
2014-07-23 16:26     ` Catalin Marinas
2014-08-06  9:02     ` Lorenzo Pieralisi
2014-08-06  9:02       ` Lorenzo Pieralisi
2014-07-21 16:06 ` [PATCH v6 7/7] drivers: cpuidle: initialize Exynos " Lorenzo Pieralisi
2014-07-21 16:06   ` Lorenzo Pieralisi

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=1405958786-17243-4-git-send-email-lorenzo.pieralisi@arm.com \
    --to=lorenzo.pieralisi@arm.com \
    --cc=Charles.Garcia-Tobin@arm.com \
    --cc=amit.kucheria@linaro.org \
    --cc=ananaza@iki.fi \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=chander.kashyap@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=khilman@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nico@linaro.org \
    --cc=paul@pwsan.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=robh+dt@kernel.org \
    --cc=santosh.shilimkar@ti.com \
    --cc=sboyd@codeaurora.org \
    --cc=sebcape@gmail.com \
    --cc=sudeep.holla@arm.com \
    --cc=t.figa@samsung.com \
    --cc=vincent.guittot@linaro.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.