* Re: [PATCH v9 05/10] libata: separate ATAPI code
From: Aaron Lu @ 2012-11-13 12:49 UTC (permalink / raw)
To: Tejun Heo
Cc: Jeff Garzik, James Bottomley, Rafael J. Wysocki, Alan Stern,
Jeff Wu, Aaron Lu, linux-ide, linux-pm, linux-scsi, linux-acpi
In-Reply-To: <20121112185710.GD5560@mtj.dyndns.org>
On Mon, Nov 12, 2012 at 10:57:10AM -0800, Tejun Heo wrote:
> On Fri, Nov 09, 2012 at 02:51:57PM +0800, Aaron Lu wrote:
> > The atapi_eh_tur and atapi_eh_request_sense can be reused by ZPODD
> > code, so separate them out to a file named libata-atapi.c, and the
> > Makefile is modified accordingly. No functional changes should result
> > from this commit.
>
> Why is this change necessary? This doesn't seem to help anything to
> me.
Function zpready introduced in patch 6 used these 2 functions to see if
an ODD is in a zero power ready state.
Thanks,
Aaron
>
> Thanks.
>
> --
> tejun
^ permalink raw reply
* [PATCH v3 2/4] ARM: EXYNOS: pm_domain: Fix power domain name initialization
From: Tomasz Figa @ 2012-11-13 12:51 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
In-Reply-To: <1352811115-1198-1-git-send-email-t.figa@samsung.com>
This patch adds initialization of name field in generic power domain
struct.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
arch/arm/mach-exynos/pm_domains.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index d1abc1a..5b7ce7e 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -98,7 +98,8 @@ static __init int exynos_pm_dt_parse_domains(void)
return -ENOMEM;
}
- pd->name = np->name;
+ pd->pd.name = kstrdup(np->name, GFP_KERNEL);
+ pd->name = pd->pd.name;
pd->base = of_iomap(np, 0);
pd->pd.power_off = exynos_pd_power_off;
pd->pd.power_on = exynos_pd_power_on;
--
1.8.0
^ permalink raw reply related
* [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension
From: Tomasz Figa @ 2012-11-13 12:51 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
This patch series fixes two issues with existing DT support for Exynos
power domains and extends it with the ability of binding devices to domains,
basically making it possible to use power domains with DT.
Based on for-next branch of Kgene's tree.
Changes since v2:
- Rebased to for-next of Kgene's tree.
Changes since v1:
- Added "samsung," prefix to "power-domain" property.
- Added power domain nodes to Exynos4 device tree sources.
Tomasz Figa (4):
ARM: EXYNOS: pm_domain: Detect domain state on registration from DT
ARM: EXYNOS: pm_domain: Fix power domain name initialization
ARM: EXYNOS: pm_domain: Bind devices to power domains using DT
ARM: dts: exynos4: Set up power domains
.../bindings/arm/exynos/power_domain.txt | 15 +++-
arch/arm/boot/dts/exynos4.dtsi | 30 +++++++
arch/arm/boot/dts/exynos4210.dtsi | 5 ++
arch/arm/mach-exynos/pm_domains.c | 93 +++++++++++++++++++++-
4 files changed, 135 insertions(+), 8 deletions(-)
--
1.8.0
^ permalink raw reply
* [PATCH v3 1/4] ARM: EXYNOS: pm_domain: Detect domain state on registration from DT
From: Tomasz Figa @ 2012-11-13 12:51 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
In-Reply-To: <1352811115-1198-1-git-send-email-t.figa@samsung.com>
Initial state of power domains might vary on different boards and with
different bootloaders.
This patch adds detection of initial state of power domains when being
registered from DT.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Documentation/devicetree/bindings/arm/exynos/power_domain.txt | 4 ----
arch/arm/mach-exynos/pm_domains.c | 8 +++++---
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
index 6528e21..843b546 100644
--- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
+++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
@@ -9,10 +9,6 @@ Required Properties:
- reg: physical base address of the controller and length of memory mapped
region.
-Optional Properties:
-- samsung,exynos4210-pd-off: Specifies that the power domain is in turned-off
- state during boot and remains to be turned-off until explicitly turned-on.
-
Example:
lcd0: power-domain-lcd0 {
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index c0bc83a..d1abc1a 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -89,6 +89,7 @@ static __init int exynos_pm_dt_parse_domains(void)
for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
struct exynos_pm_domain *pd;
+ int on;
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd) {
@@ -97,14 +98,15 @@ static __init int exynos_pm_dt_parse_domains(void)
return -ENOMEM;
}
- if (of_get_property(np, "samsung,exynos4210-pd-off", NULL))
- pd->is_off = true;
pd->name = np->name;
pd->base = of_iomap(np, 0);
pd->pd.power_off = exynos_pd_power_off;
pd->pd.power_on = exynos_pd_power_on;
pd->pd.of_node = np;
- pm_genpd_init(&pd->pd, NULL, false);
+
+ on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
+
+ pm_genpd_init(&pd->pd, NULL, !on);
}
return 0;
}
--
1.8.0
^ permalink raw reply related
* [PATCH v3 3/4] ARM: EXYNOS: pm_domain: Bind devices to power domains using DT
From: Tomasz Figa @ 2012-11-13 12:51 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
In-Reply-To: <1352811115-1198-1-git-send-email-t.figa@samsung.com>
This patch adds a way to specify bindings between devices and power
domains using device tree.
A device can be bound to particular power domain by adding a
power-domain property containing a phandle to the domain. The device
will be bound to the domain before binding a driver to it and unbound
after unbinding a driver from it.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
.../bindings/arm/exynos/power_domain.txt | 13 +++-
arch/arm/mach-exynos/pm_domains.c | 82 ++++++++++++++++++++++
2 files changed, 94 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
index 843b546..8ed914f 100644
--- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
+++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
@@ -4,14 +4,25 @@ Exynos processors include support for multiple power domains which are used
to gate power to one or more peripherals on the processor.
Required Properties:
-- compatiable: should be one of the following.
+- compatible: should be one of the following.
* samsung,exynos4210-pd - for exynos4210 type power domain.
- reg: physical base address of the controller and length of memory mapped
region.
+Node of a device using power domains must have a power-domain property defined
+with a phandle to respective power domain.
+
Example:
lcd0: power-domain-lcd0 {
compatible = "samsung,exynos4210-pd";
reg = <0x10023C00 0x10>;
};
+
+Example of the node using power domain:
+
+ node {
+ /* ... */
+ power-domain = <&lcd0>;
+ /* ... */
+ };
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 5b7ce7e..7b3b8a3 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -19,6 +19,8 @@
#include <linux/pm_domain.h>
#include <linux/delay.h>
#include <linux/of_address.h>
+#include <linux/of_platform.h>
+#include <linux/sched.h>
#include <mach/regs-pmu.h>
#include <plat/devs.h>
@@ -83,14 +85,89 @@ static struct exynos_pm_domain PD = { \
}
#ifdef CONFIG_OF
+static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
+ struct device *dev)
+{
+ int ret;
+
+ dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
+
+ while(1) {
+ ret = pm_genpd_add_device(&pd->pd, dev);
+ if (ret != -EAGAIN)
+ break;
+ cond_resched();
+ }
+
+ pm_genpd_dev_need_restore(dev, true);
+}
+
+static void exynos_remove_device_from_domain(struct device *dev)
+{
+ struct generic_pm_domain *genpd = dev_to_genpd(dev);
+ int ret;
+
+ dev_dbg(dev, "removing from power domain %s\n", genpd->name);
+
+ while(1) {
+ ret = pm_genpd_remove_device(genpd, dev);
+ if (ret != -EAGAIN)
+ break;
+ cond_resched();
+ }
+}
+
+static void exynos_read_domain_from_dt(struct device *dev)
+{
+ struct platform_device *pd_pdev;
+ struct exynos_pm_domain *pd;
+ struct device_node *node;
+
+ node = of_parse_phandle(dev->of_node, "power-domain", 0);
+ if (!node)
+ return;
+ pd_pdev = of_find_device_by_node(node);
+ if (!pd_pdev)
+ return;
+ pd = platform_get_drvdata(pd_pdev);
+ exynos_add_device_to_domain(pd, dev);
+}
+
+static int exynos_pm_notifier_call(struct notifier_block *nb,
+ unsigned long event, void *data)
+{
+ struct device *dev = data;
+
+ switch (event) {
+ case BUS_NOTIFY_BIND_DRIVER:
+ if (dev->of_node)
+ exynos_read_domain_from_dt(dev);
+
+ break;
+
+ case BUS_NOTIFY_UNBOUND_DRIVER:
+ exynos_remove_device_from_domain(dev);
+
+ break;
+ }
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block platform_nb = {
+ .notifier_call = exynos_pm_notifier_call,
+};
+
static __init int exynos_pm_dt_parse_domains(void)
{
+ struct platform_device *pdev;
struct device_node *np;
for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
struct exynos_pm_domain *pd;
int on;
+ pdev = of_find_device_by_node(np);
+
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd) {
pr_err("%s: failed to allocate memory for domain\n",
@@ -105,10 +182,15 @@ static __init int exynos_pm_dt_parse_domains(void)
pd->pd.power_on = exynos_pd_power_on;
pd->pd.of_node = np;
+ platform_set_drvdata(pdev, pd);
+
on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
pm_genpd_init(&pd->pd, NULL, !on);
}
+
+ bus_register_notifier(&platform_bus_type, &platform_nb);
+
return 0;
}
#else
--
1.8.0
^ permalink raw reply related
* [PATCH v3 4/4] ARM: dts: exynos4: Set up power domains
From: Tomasz Figa @ 2012-11-13 12:51 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
In-Reply-To: <1352811115-1198-1-git-send-email-t.figa@samsung.com>
This patch adds device tree nodes for power domains available
on Exynos 4 SoCs.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
arch/arm/boot/dts/exynos4.dtsi | 30 ++++++++++++++++++++++++++++++
arch/arm/boot/dts/exynos4210.dtsi | 5 +++++
2 files changed, 35 insertions(+)
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index a26c3dd..0c14f50 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -30,6 +30,36 @@
spi2 = &spi_2;
};
+ pd_mfc: mfc-power-domain@10023C40 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C40 0x20>;
+ };
+
+ pd_g3d: g3d-power-domain@10023C60 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C60 0x20>;
+ };
+
+ pd_lcd0: lcd0-power-domain@10023C80 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C80 0x20>;
+ };
+
+ pd_tv: tv-power-domain@10023C20 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C20 0x20>;
+ };
+
+ pd_cam: cam-power-domain@10023C00 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C00 0x20>;
+ };
+
+ pd_gps: gps-power-domain@10023CE0 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023CE0 0x20>;
+ };
+
gic:interrupt-controller@10490000 {
compatible = "arm,cortex-a9-gic";
#interrupt-cells = <3>;
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 939f639..e31bfc4 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -31,6 +31,11 @@
pinctrl2 = &pinctrl_2;
};
+ pd_lcd1: lcd1-power-domain@10023CA0 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023CA0 0x20>;
+ };
+
gic:interrupt-controller@10490000 {
cpu-offset = <0x8000>;
};
--
1.8.0
^ permalink raw reply related
* Re: [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension
From: Tomasz Figa @ 2012-11-13 13:00 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, tomasz.figa
In-Reply-To: <1352811115-1198-1-git-send-email-t.figa@samsung.com>
Hi,
On Tuesday 13 of November 2012 13:51:51 Tomasz Figa wrote:
> This patch series fixes two issues with existing DT support for Exynos
> power domains and extends it with the ability of binding devices to
> domains, basically making it possible to use power domains with DT.
>
> Based on for-next branch of Kgene's tree.
>
> Changes since v2:
> - Rebased to for-next of Kgene's tree.
> Changes since v1:
> - Added "samsung," prefix to "power-domain" property.
> - Added power domain nodes to Exynos4 device tree sources.
>
> Tomasz Figa (4):
> ARM: EXYNOS: pm_domain: Detect domain state on registration from DT
> ARM: EXYNOS: pm_domain: Fix power domain name initialization
> ARM: EXYNOS: pm_domain: Bind devices to power domains using DT
> ARM: dts: exynos4: Set up power domains
>
> .../bindings/arm/exynos/power_domain.txt | 15 +++-
> arch/arm/boot/dts/exynos4.dtsi | 30 +++++++
> arch/arm/boot/dts/exynos4210.dtsi | 5 ++
> arch/arm/mach-exynos/pm_domains.c | 93
> +++++++++++++++++++++- 4 files changed, 135 insertions(+), 8
> deletions(-)
Sorry, please disregard this series, as I have sent wrong version by
mistake.
I will send correct one later.
Best regards,
--
Tomasz Figa
Samsung Poland R&D Center
SW Solution Development, Linux Platform
^ permalink raw reply
* [PATCH v3 2/4] ARM: EXYNOS: pm_domain: Fix power domain name initialization
From: Tomasz Figa @ 2012-11-13 13:08 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
In-Reply-To: <1352812107-8777-1-git-send-email-t.figa@samsung.com>
This patch adds initialization of name field in generic power domain
struct.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
arch/arm/mach-exynos/pm_domains.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index d1abc1a..5b7ce7e 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -98,7 +98,8 @@ static __init int exynos_pm_dt_parse_domains(void)
return -ENOMEM;
}
- pd->name = np->name;
+ pd->pd.name = kstrdup(np->name, GFP_KERNEL);
+ pd->name = pd->pd.name;
pd->base = of_iomap(np, 0);
pd->pd.power_off = exynos_pd_power_off;
pd->pd.power_on = exynos_pd_power_on;
--
1.8.0
^ permalink raw reply related
* [PATCH v3 3/4] ARM: EXYNOS: pm_domain: Bind devices to power domains using DT
From: Tomasz Figa @ 2012-11-13 13:08 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
In-Reply-To: <1352812107-8777-1-git-send-email-t.figa@samsung.com>
This patch adds a way to specify bindings between devices and power
domains using device tree.
A device can be bound to particular power domain by adding a
power-domain property containing a phandle to the domain. The device
will be bound to the domain before binding a driver to it and unbound
after unbinding a driver from it.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
.../bindings/arm/exynos/power_domain.txt | 13 +++-
arch/arm/mach-exynos/pm_domains.c | 82 ++++++++++++++++++++++
2 files changed, 94 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
index 843b546..5216b41 100644
--- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
+++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
@@ -4,14 +4,25 @@ Exynos processors include support for multiple power domains which are used
to gate power to one or more peripherals on the processor.
Required Properties:
-- compatiable: should be one of the following.
+- compatible: should be one of the following.
* samsung,exynos4210-pd - for exynos4210 type power domain.
- reg: physical base address of the controller and length of memory mapped
region.
+Node of a device using power domains must have a samsung,power-domain property
+defined with a phandle to respective power domain.
+
Example:
lcd0: power-domain-lcd0 {
compatible = "samsung,exynos4210-pd";
reg = <0x10023C00 0x10>;
};
+
+Example of the node using power domain:
+
+ node {
+ /* ... */
+ samsung,power-domain = <&lcd0>;
+ /* ... */
+ };
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 5b7ce7e..4063016 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -19,6 +19,8 @@
#include <linux/pm_domain.h>
#include <linux/delay.h>
#include <linux/of_address.h>
+#include <linux/of_platform.h>
+#include <linux/sched.h>
#include <mach/regs-pmu.h>
#include <plat/devs.h>
@@ -83,14 +85,89 @@ static struct exynos_pm_domain PD = { \
}
#ifdef CONFIG_OF
+static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
+ struct device *dev)
+{
+ int ret;
+
+ dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
+
+ while(1) {
+ ret = pm_genpd_add_device(&pd->pd, dev);
+ if (ret != -EAGAIN)
+ break;
+ cond_resched();
+ }
+
+ pm_genpd_dev_need_restore(dev, true);
+}
+
+static void exynos_remove_device_from_domain(struct device *dev)
+{
+ struct generic_pm_domain *genpd = dev_to_genpd(dev);
+ int ret;
+
+ dev_dbg(dev, "removing from power domain %s\n", genpd->name);
+
+ while(1) {
+ ret = pm_genpd_remove_device(genpd, dev);
+ if (ret != -EAGAIN)
+ break;
+ cond_resched();
+ }
+}
+
+static void exynos_read_domain_from_dt(struct device *dev)
+{
+ struct platform_device *pd_pdev;
+ struct exynos_pm_domain *pd;
+ struct device_node *node;
+
+ node = of_parse_phandle(dev->of_node, "samsung,power-domain", 0);
+ if (!node)
+ return;
+ pd_pdev = of_find_device_by_node(node);
+ if (!pd_pdev)
+ return;
+ pd = platform_get_drvdata(pd_pdev);
+ exynos_add_device_to_domain(pd, dev);
+}
+
+static int exynos_pm_notifier_call(struct notifier_block *nb,
+ unsigned long event, void *data)
+{
+ struct device *dev = data;
+
+ switch (event) {
+ case BUS_NOTIFY_BIND_DRIVER:
+ if (dev->of_node)
+ exynos_read_domain_from_dt(dev);
+
+ break;
+
+ case BUS_NOTIFY_UNBOUND_DRIVER:
+ exynos_remove_device_from_domain(dev);
+
+ break;
+ }
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block platform_nb = {
+ .notifier_call = exynos_pm_notifier_call,
+};
+
static __init int exynos_pm_dt_parse_domains(void)
{
+ struct platform_device *pdev;
struct device_node *np;
for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
struct exynos_pm_domain *pd;
int on;
+ pdev = of_find_device_by_node(np);
+
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd) {
pr_err("%s: failed to allocate memory for domain\n",
@@ -105,10 +182,15 @@ static __init int exynos_pm_dt_parse_domains(void)
pd->pd.power_on = exynos_pd_power_on;
pd->pd.of_node = np;
+ platform_set_drvdata(pdev, pd);
+
on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
pm_genpd_init(&pd->pd, NULL, !on);
}
+
+ bus_register_notifier(&platform_bus_type, &platform_nb);
+
return 0;
}
#else
--
1.8.0
^ permalink raw reply related
* [PATCH v3 RESEND 0/4] ARM: EXYNOS: Power domain DT support extension
From: Tomasz Figa @ 2012-11-13 13:08 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
This patch series fixes two issues with existing DT support for Exynos
power domains and extends it with the ability of binding devices to domains,
basically making it possible to use power domains with DT.
Based on for-next branch of Kgene's tree.
Changes since v2:
- Rebased to for-next of Kgene's tree.
Changes since v1:
- Added "samsung," prefix to "power-domain" property.
- Added power domain nodes to Exynos4 device tree sources.
Tomasz Figa (4):
ARM: EXYNOS: pm_domain: Detect domain state on registration from DT
ARM: EXYNOS: pm_domain: Fix power domain name initialization
ARM: EXYNOS: pm_domain: Bind devices to power domains using DT
ARM: dts: exynos4: Set up power domains
.../bindings/arm/exynos/power_domain.txt | 15 +++-
arch/arm/boot/dts/exynos4.dtsi | 30 +++++++
arch/arm/boot/dts/exynos4210.dtsi | 5 ++
arch/arm/mach-exynos/pm_domains.c | 93 +++++++++++++++++++++-
4 files changed, 135 insertions(+), 8 deletions(-)
--
1.8.0
^ permalink raw reply
* [PATCH v3 1/4] ARM: EXYNOS: pm_domain: Detect domain state on registration from DT
From: Tomasz Figa @ 2012-11-13 13:08 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
In-Reply-To: <1352812107-8777-1-git-send-email-t.figa@samsung.com>
Initial state of power domains might vary on different boards and with
different bootloaders.
This patch adds detection of initial state of power domains when being
registered from DT.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Documentation/devicetree/bindings/arm/exynos/power_domain.txt | 4 ----
arch/arm/mach-exynos/pm_domains.c | 8 +++++---
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
index 6528e21..843b546 100644
--- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
+++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
@@ -9,10 +9,6 @@ Required Properties:
- reg: physical base address of the controller and length of memory mapped
region.
-Optional Properties:
-- samsung,exynos4210-pd-off: Specifies that the power domain is in turned-off
- state during boot and remains to be turned-off until explicitly turned-on.
-
Example:
lcd0: power-domain-lcd0 {
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index c0bc83a..d1abc1a 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -89,6 +89,7 @@ static __init int exynos_pm_dt_parse_domains(void)
for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
struct exynos_pm_domain *pd;
+ int on;
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd) {
@@ -97,14 +98,15 @@ static __init int exynos_pm_dt_parse_domains(void)
return -ENOMEM;
}
- if (of_get_property(np, "samsung,exynos4210-pd-off", NULL))
- pd->is_off = true;
pd->name = np->name;
pd->base = of_iomap(np, 0);
pd->pd.power_off = exynos_pd_power_off;
pd->pd.power_on = exynos_pd_power_on;
pd->pd.of_node = np;
- pm_genpd_init(&pd->pd, NULL, false);
+
+ on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
+
+ pm_genpd_init(&pd->pd, NULL, !on);
}
return 0;
}
--
1.8.0
^ permalink raw reply related
* [PATCH v3 4/4] ARM: dts: exynos4: Set up power domains
From: Tomasz Figa @ 2012-11-13 13:08 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
In-Reply-To: <1352812107-8777-1-git-send-email-t.figa@samsung.com>
This patch adds device tree nodes for power domains available
on Exynos 4 SoCs.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
arch/arm/boot/dts/exynos4.dtsi | 30 ++++++++++++++++++++++++++++++
arch/arm/boot/dts/exynos4210.dtsi | 5 +++++
2 files changed, 35 insertions(+)
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index a26c3dd..0c14f50 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -30,6 +30,36 @@
spi2 = &spi_2;
};
+ pd_mfc: mfc-power-domain@10023C40 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C40 0x20>;
+ };
+
+ pd_g3d: g3d-power-domain@10023C60 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C60 0x20>;
+ };
+
+ pd_lcd0: lcd0-power-domain@10023C80 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C80 0x20>;
+ };
+
+ pd_tv: tv-power-domain@10023C20 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C20 0x20>;
+ };
+
+ pd_cam: cam-power-domain@10023C00 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C00 0x20>;
+ };
+
+ pd_gps: gps-power-domain@10023CE0 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023CE0 0x20>;
+ };
+
gic:interrupt-controller@10490000 {
compatible = "arm,cortex-a9-gic";
#interrupt-cells = <3>;
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 939f639..e31bfc4 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -31,6 +31,11 @@
pinctrl2 = &pinctrl_2;
};
+ pd_lcd1: lcd1-power-domain@10023CA0 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023CA0 0x20>;
+ };
+
gic:interrupt-controller@10490000 {
cpu-offset = <0x8000>;
};
--
1.8.0
^ permalink raw reply related
* Re: [PATCH v9 06/10] ata: zpodd: check zero power ready status
From: Aaron Lu @ 2012-11-13 13:20 UTC (permalink / raw)
To: Tejun Heo
Cc: Jeff Garzik, James Bottomley, Rafael J. Wysocki, Alan Stern,
Jeff Wu, Aaron Lu, linux-ide, linux-pm, linux-scsi, linux-acpi
In-Reply-To: <20121112191303.GE5560@mtj.dyndns.org>
On Mon, Nov 12, 2012 at 11:13:03AM -0800, Tejun Heo wrote:
> Hello,
>
> On Fri, Nov 09, 2012 at 02:51:58PM +0800, Aaron Lu wrote:
> > +/*
> > + * Check ODD's zero power ready status.
> > + *
> > + * This function is called during ATA port's suspend path,
> > + * when the port is not frozen yet, so that we can still make
> > + * some IO to the ODD to decide if it is zero power ready.
> > + *
> > + * The ODD is regarded as zero power ready when it is in zero
> > + * power ready state for some time(defined by POWEROFF_DELAY).
> > + */
> > +void zpodd_check_zpready(struct ata_device *dev)
> > +{
> > + bool zp_ready;
> > + unsigned long expires;
> > + struct zpodd *zpodd = dev->private_data;
> > +
> > + if (!zpodd->status_ready) {
> > + zpodd->last_ready = 0;
> > + return;
> > + }
> > +
> > + if (!zpodd->last_ready) {
> > + zp_ready = zpready(dev);
> > + if (zp_ready)
> > + zpodd->last_ready = jiffies;
> > + return;
> > + }
> > +
> > + expires = zpodd->last_ready + msecs_to_jiffies(POWEROFF_DELAY);
> > + if (time_before(jiffies, expires))
> > + return;
> > +
> > + zpodd->zp_ready = zpready(dev);
> > + if (!zpodd->zp_ready)
> > + zpodd->last_ready = 0;
> > +}
>
> Hmmm... so, the "full" check only happens when autopm kicks in, right?
Yes, and unless the ODD is powered off, autopm can kick in every 2
seconds(together with the events poll).
> Is it really worth avoiding an extra TUR on autopm events? That's not
> really a hot path. It seems a bit over-engineered to me.
I'm not sure...But if issuing TUR every 2 seconds under some condition
is acceptable, I'll be happily removing the snoop thing and use TUR only.
Thanks,
Aaron
^ permalink raw reply
* Re: [BUGFIX] PM: Fix active child counting when disabled and forbidden
From: Alan Stern @ 2012-11-13 16:10 UTC (permalink / raw)
To: Huang Ying; +Cc: Rafael J. Wysocki, linux-kernel, linux-pm
In-Reply-To: <1352783539.7176.212.camel@yhuang-dev>
On Tue, 13 Nov 2012, Huang Ying wrote:
> > This is not quite right. Consider a device that is in runtime suspend
> > when a system sleep starts. When the system sleep ends, the device
> > will be resumed but the PM core will still think its state is
> > SUSPENDED. The subsystem has to tell the PM core that the device is
> > now ACTIVE. Currently, subsystems do this by calling
> > pm_runtime_disable, pm_runtime_set_active, pm_runtime_enable. Under
> > your scheme this wouldn't work; the pm_runtime_set_active call would
> > fail because the device was !forbidden.
>
> Thanks for your information. For this specific situation, is it
> possible to call pm_runtime_resume() or pm_request_resume() for the
> device?
No, because the device already is at full power. The subsystem just
needs to tell the PM core that it is.
> > > PM. Device can always work with full power.
> >
> > It can't if the parent is in SUSPEND. If necessary, the user can write
> > "on" to the parent's power/control attribute first.
>
> Is it possible to call pm_runtime_set_active() for the parent if the
> parent is disabled and SUSPENDED.
Doing that is possible, but it might not work. The parent might
actually be at low power; calling pm_runtime_set_active wouldn't change
the physical power level. Basically, it's not safe to assume anything
about devices that are disabled for runtime PM.
> It appears that there is race condition between this and the
> pm_runtime_disable, pm_runtime_set_active, pm_runtime_enable sequence
> you mentioned ealier.
>
> thread 1 thread 2
> pm_runtime_disable
> pm_runtime_set_active
> pm_runtime_allow
> pm_runtime_set_suspended
> pm_runtime_enable
This can't happen in the situation I described earlier because during
system sleep transitions, no other user threads are allowed to run.
All of them except the one actually carrying out the transition are
frozen.
Alan Stern
^ permalink raw reply
* Re: [PATCH 3/6 v4] cpufreq: tolerate inexact values when collecting stats
From: Borislav Petkov @ 2012-11-13 16:24 UTC (permalink / raw)
To: Mark Langsdorf
Cc: linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org,
linux-pm@vger.kernel.org, MyungJoo Ham
In-Reply-To: <50A12565.4070701@calxeda.com>
On Mon, Nov 12, 2012 at 10:35:49AM -0600, Mark Langsdorf wrote:
> The function is buried pretty deep in the cpufreq_stat code. It didn't
> seem appropriate to make it a function pointer as part of struct
> cpufreq_driver.
Right, what's cpufreq-speak for
if (Calxeda)
shift by 10
?
Better yet, add a flag or a bitfield called "minimize_jitter" or similar
and set it only on your hardware...
Thanks.
--
Regards/Gruss,
Boris.
^ permalink raw reply
* Re: [PATCH 3/6 v4] cpufreq: tolerate inexact values when collecting stats
From: Mark Langsdorf @ 2012-11-13 16:33 UTC (permalink / raw)
To: Borislav Petkov
Cc: linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org,
linux-pm@vger.kernel.org, MyungJoo Ham
In-Reply-To: <20121113162449.GE9327@x1.osrc.amd.com>
On 11/13/2012 10:24 AM, Borislav Petkov wrote:
> On Mon, Nov 12, 2012 at 10:35:49AM -0600, Mark Langsdorf wrote:
>> The function is buried pretty deep in the cpufreq_stat code. It didn't
>> seem appropriate to make it a function pointer as part of struct
>> cpufreq_driver.
>
> Right, what's cpufreq-speak for
>
> if (Calxeda)
> shift by 10
>
> ?
>
> Better yet, add a flag or a bitfield called "minimize_jitter" or similar
> and set it only on your hardware...
Doing it in two passes has a similar effect: systems that have exact
frequencies will get caught in the first pass when the values match. But
adding a flag makes sense.
--Mark Langsdorf
Calxeda, Inc.
^ permalink raw reply
* [GIT] power tools patches for Linux 3.7-rc5
From: Len Brown @ 2012-11-13 17:43 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, Linux PM list
Hi Linus,
Please pull this pair of power tools patches --
a 3.7 regression fix plus a bug fix.
thanks!
Len Brown, Intel Open Source Technology Center
The following changes since commit bc909421a9c7083fcde795846d22b36a51a7be54:
Merge tag 'gpio-fixes-v3.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio (2012-10-30 15:56:22 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git release
for you to fetch changes up to d91bb17c2a874493603c4d99db305d8caf2d180c:
tools/power turbostat: graceful fail on garbage input (2012-11-01 00:22:00 -0400)
----------------------------------------------------------------
Len Brown (2):
tools/power turbostat: Repair Segmentation fault when using -i option
tools/power turbostat: graceful fail on garbage input
tools/power/x86/turbostat/turbostat.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
^ permalink raw reply
* Re: [PATCH -v2] ACPI/PCI: Make PCI devices notified when its power resource turned on
From: Bjorn Helgaas @ 2012-11-13 18:58 UTC (permalink / raw)
To: Huang Ying
Cc: Rafael J. Wysocki, linux-kernel, linux-pci, linux-pm, linux-acpi
In-Reply-To: <1352249879-11406-1-git-send-email-ying.huang@intel.com>
On Tue, Nov 6, 2012 at 5:57 PM, Huang Ying <ying.huang@intel.com> wrote:
> A set of power resources may be shared by multiple devices. When all
> devices share one set of power resources is put into D3_COLD state,
> the power resources will be turned off. When one of the device is
> waked, the power resource will be turned on and all devices share it
> will be powered on to D0uninitialized state. These devices should be
> resumed, so that they can get opportunity to go to low power state
> later.
>
> v2:
>
> - Fix build error
>
> Signed-off-by: Huang Ying <ying.huang@intel.com>
> Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/acpi/pci_bind.c | 2 ++
> 1 file changed, 2 insertions(+)
I applied this to my pci/misc branch as v3.8 material. Thanks!
Bjorn
^ permalink raw reply
* RE: [PATCH 3/6 v4] cpufreq: tolerate inexact values when collecting stats
From: Mark Langsdorf @ 2012-11-13 19:13 UTC (permalink / raw)
To: Mark Langsdorf, Borislav Petkov
Cc: linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org,
linux-pm@vger.kernel.org, MyungJoo Ham
In-Reply-To: <50A2766D.6040008@calxeda.com>
From: linux-pm-owner@vger.kernel.org [linux-pm-owner@vger.kernel.org] On Behalf Of Mark Langsdorf [mark.langsdorf@calxeda.com]
> On 11/13/2012 10:24 AM, Borislav Petkov wrote:
>> On Mon, Nov 12, 2012 at 10:35:49AM -0600, Mark Langsdorf wrote:
>>> The function is buried pretty deep in the cpufreq_stat code. It didn't
>>> seem appropriate to make it a function pointer as part of struct
>>> cpufreq_driver.
>>
>> Better yet, add a flag or a bitfield called "minimize_jitter" or similar
>> and set it only on your hardware...
>
> Doing it in two passes has a similar effect: systems that have exact
> frequencies will get caught in the first pass when the values match. But
> adding a flag makes sense.
I went back and looked at implementing this suggestion.
Although cpufreq_driver has a flag field, no part of cpufreq_driver is directly passed to the cpufreq_stat code. Only cpufreq_policy is. It's cleaner to do passes of the while loop than to copy the cpufreq_driver.flag field into cpufreq_policy and then store it again in cpufreq_stats.
--Mark Langsdorf
Calxeda, Inc.
^ permalink raw reply
* [PATCH v10 01/14] doc: Add x86 CPU0 online/offline feature
From: Fenghua Yu @ 2012-11-13 19:32 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H Peter Anvin, Linus Torvalds,
Andrew Morton, Asit K Mallick, Tony Luck, Arjan Dan De Ven,
Suresh B Siddha, Len Brown, Srivatssa S. Bhat, Randy Dunlap,
Rafael J. Wysocki, Chen Gong, linux-kernel, linux-pm, x86
Cc: Fenghua Yu
In-Reply-To: <1352835171-3958-1-git-send-email-fenghua.yu@intel.com>
From: Fenghua Yu <fenghua.yu@intel.com>
If CONFIG_BOOTPARAM_HOTPLUG_CPU0 is turned on, CPU0 is hotpluggable. Otherwise,
by default CPU0 is not hotpluggable and kernel parameter cpu0_hotplug enables
CPU0 online/offline feature.
The documentations point out two known CPU0 dependencies. First, resume from
hibernate or suspend always starts from CPU0. So hibernate and suspend are
prevented if CPU0 is offline. Another dependency is PIC interrupts always go
to CPU0.
It's said that some machines may depend on CPU0 to poweroff/reboot. But I
haven't seen such dependency on a few tested machines.
Please let me know if you see any CPU0 dependencies on your machine.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
Documentation/cpu-hotplug.txt | 24 ++++++++++++++++++++++++
Documentation/kernel-parameters.txt | 14 ++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index 66ef8f3..9f40135 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -207,6 +207,30 @@ by making it not-removable.
In such cases you will also notice that the online file is missing under cpu0.
+Q: Is CPU0 removable on X86?
+A: Yes. If kernel is compiled with CONFIG_BOOTPARAM_HOTPLUG_CPU0=y, CPU0 is
+removable by default. Otherwise, CPU0 is also removable by kernel option
+cpu0_hotplug.
+
+But some features depend on CPU0. Two known dependencies are:
+
+1. Resume from hibernate/suspend depends on CPU0. Hibernate/suspend will fail if
+CPU0 is offline and you need to online CPU0 before hibernate/suspend can
+continue.
+2. PIC interrupts also depend on CPU0. CPU0 can't be removed if a PIC interrupt
+is detected.
+
+It's said poweroff/reboot may depend on CPU0 on some machines although I haven't
+seen any poweroff/reboot failure so far after CPU0 is offline on a few tested
+machines.
+
+Please let me know if you know or see any other dependencies of CPU0.
+
+If the dependencies are under your control, you can turn on CPU0 hotplug feature
+either by CONFIG_BOOTPARAM_HOTPLUG_CPU0 or by kernel parameter cpu0_hotplug.
+
+--Fenghua Yu <fenghua.yu@intel.com>
+
Q: How do i find out if a particular CPU is not removable?
A: Depending on the implementation, some architectures may show this by the
absence of the "online" file. This is done if it can be determined ahead of
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 4aa9ca0..57a853d6 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1988,6 +1988,20 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
nox2apic [X86-64,APIC] Do not enable x2APIC mode.
+ cpu0_hotplug [X86] Turn on CPU0 hotplug feature when
+ CONFIG_BOOTPARAM_HOTPLUG_CPU0 is off.
+ Some features depend on CPU0. Known dependencies are:
+ 1. Resume from suspend/hibernate depends on CPU0.
+ Suspend/hibernate will fail if CPU0 is offline and you
+ need to online CPU0 before suspend/hibernate.
+ 2. PIC interrupts also depend on CPU0. CPU0 can't be
+ removed if a PIC interrupt is detected.
+ It's said poweroff/reboot may depend on CPU0 on some
+ machines although I haven't seen such issues so far
+ after CPU0 is offline on a few tested machines.
+ If the dependencies are under your control, you can
+ turn on cpu0_hotplug.
+
nptcg= [IA-64] Override max number of concurrent global TLB
purges which is reported from either PAL_VM_SUMMARY or
SAL PALO.
--
1.7.2
^ permalink raw reply related
* [PATCH v10 02/14] x86, Kconfig: Add config switch for CPU0 hotplug
From: Fenghua Yu @ 2012-11-13 19:32 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H Peter Anvin, Linus Torvalds,
Andrew Morton, Asit K Mallick, Tony Luck, Arjan Dan De Ven,
Suresh B Siddha, Len Brown, Srivatssa S. Bhat, Randy Dunlap,
Rafael J. Wysocki, Chen Gong, linux-kernel, linux-pm, x86
Cc: Fenghua Yu
In-Reply-To: <1352835171-3958-1-git-send-email-fenghua.yu@intel.com>
From: Fenghua Yu <fenghua.yu@intel.com>
New config switch CONFIG_BOOTPARAM_HOTPLUG_CPU0 sets default state of whether
the CPU0 hotplug is on or off.
If the switch is off, CPU0 is not hotpluggable by default. But the CPU0 hotplug
feature can still be turned on by kernel parameter cpu0_hotplug at boot.
If the switch is on, CPU0 is always hotpluggable.
The default value of the switch is off.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
arch/x86/Kconfig | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 650e6a4..933ff87 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1730,6 +1730,35 @@ config HOTPLUG_CPU
automatically on SMP systems. )
Say N if you want to disable CPU hotplug.
+config BOOTPARAM_HOTPLUG_CPU0
+ bool "Set default setting of cpu0_hotpluggable"
+ default n
+ depends on HOTPLUG_CPU && EXPERIMENTAL
+ ---help---
+ Set whether default state of cpu0_hotpluggable is on or off.
+
+ Say Y here to enable CPU0 hotplug by default. If this switch
+ is turned on, there is no need to give cpu0_hotplug kernel
+ parameter and the CPU0 hotplug feature is enabled by default.
+
+ Please note: there are two known CPU0 dependencies if you want
+ to enable the CPU0 hotplug feature either by this switch or by
+ cpu0_hotplug kernel parameter.
+
+ First, resume from hibernate or suspend always starts from CPU0.
+ So hibernate and suspend are prevented if CPU0 is offline.
+
+ Second dependency is PIC interrupts always go to CPU0. CPU0 can not
+ offline if any interrupt can not migrate out of CPU0. There may
+ be other CPU0 dependencies.
+
+ Please make sure the dependencies are under your control before
+ you enable this feature.
+
+ Say N if you don't want to enable CPU0 hotplug feature by default.
+ You still can enable the CPU0 hotplug feature at boot by kernel
+ parameter cpu0_hotplug.
+
config COMPAT_VDSO
def_bool y
prompt "Compat VDSO support"
--
1.7.2
^ permalink raw reply related
* [PATCH v10 03/14] x86, topology: Don't offline CPU0 if any PIC irq can not be migrated out of it
From: Fenghua Yu @ 2012-11-13 19:32 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H Peter Anvin, Linus Torvalds,
Andrew Morton, Asit K Mallick, Tony Luck, Arjan Dan De Ven,
Suresh B Siddha, Len Brown, Srivatssa S. Bhat, Randy Dunlap,
Rafael J. Wysocki, Chen Gong, linux-kernel, linux-pm, x86
Cc: Fenghua Yu
In-Reply-To: <1352835171-3958-1-git-send-email-fenghua.yu@intel.com>
From: Fenghua Yu <fenghua.yu@intel.com>
If CONFIG_BOOTPARAM_HOTPLUG_CPU is turned on, CPU0 hotplug feature is enabled
by default.
If CONFIG_BOOTPARAM_HOTPLUG_CPU is not turned on, CPU0 hotplug feature is not
enabled by default. The kernel parameter cpu0_hotplug can enable CPU0 hotplug
feature at boot.
Currently the feature is supported on Intel platforms only.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
arch/x86/kernel/topology.c | 50 +++++++++++++++++++++++++++++++++++++------
1 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 76ee977..0e7b4a7 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -30,23 +30,59 @@
#include <linux/mmzone.h>
#include <linux/init.h>
#include <linux/smp.h>
+#include <linux/irq.h>
#include <asm/cpu.h>
static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
#ifdef CONFIG_HOTPLUG_CPU
+
+#ifdef CONFIG_BOOTPARAM_HOTPLUG_CPU0
+static int cpu0_hotpluggable = 1;
+#else
+static int cpu0_hotpluggable;
+static int __init enable_cpu0_hotplug(char *str)
+{
+ cpu0_hotpluggable = 1;
+ return 1;
+}
+
+__setup("cpu0_hotplug", enable_cpu0_hotplug);
+#endif
+
int __ref arch_register_cpu(int num)
{
+ struct cpuinfo_x86 *c = &cpu_data(num);
+
+ /*
+ * Currently CPU0 is only hotpluggable on Intel platforms. Other
+ * vendors can add hotplug support later.
+ */
+ if (c->x86_vendor != X86_VENDOR_INTEL)
+ cpu0_hotpluggable = 0;
+
/*
- * CPU0 cannot be offlined due to several
- * restrictions and assumptions in kernel. This basically
- * doesn't add a control file, one cannot attempt to offline
- * BSP.
+ * Two known BSP/CPU0 dependencies: Resume from suspend/hibernate
+ * depends on BSP. PIC interrupts depend on BSP.
*
- * Also certain PCI quirks require not to enable hotplug control
- * for all CPU's.
+ * If the BSP depencies are under control, one can tell kernel to
+ * enable BSP hotplug. This basically adds a control file and
+ * one can attempt to offline BSP.
*/
- if (num)
+ if (num == 0 && cpu0_hotpluggable) {
+ unsigned int irq;
+ /*
+ * We won't take down the boot processor on i386 if some
+ * interrupts only are able to be serviced by the BSP in PIC.
+ */
+ for_each_active_irq(irq) {
+ if (!IO_APIC_IRQ(irq) && irq_has_action(irq)) {
+ cpu0_hotpluggable = 0;
+ break;
+ }
+ }
+ }
+ if (num || cpu0_hotpluggable)
per_cpu(cpu_devices, num).cpu.hotpluggable = 1;
return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
--
1.7.2
^ permalink raw reply related
* [PATCH v10 06/14] kernel/cpu.c: Add comment for priority in cpu_hotplug_pm_callback
From: Fenghua Yu @ 2012-11-13 19:32 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H Peter Anvin, Linus Torvalds,
Andrew Morton, Asit K Mallick, Tony Luck, Arjan Dan De Ven,
Suresh B Siddha, Len Brown, Srivatssa S. Bhat, Randy Dunlap,
Rafael J. Wysocki, Chen Gong, linux-kernel, linux-pm, x86
Cc: Fenghua Yu
In-Reply-To: <1352835171-3958-1-git-send-email-fenghua.yu@intel.com>
From: Fenghua Yu <fenghua.yu@intel.com>
cpu_hotplug_pm_callback should have higher priority than
bsp_pm_callback which depends on cpu_hotplug_pm_callback to disable cpu hotplug
to avoid race during bsp online checking.
This is to hightlight the priorities between the two callbacks in case people
may overlook the order.
Ideally the priorities should be defined in macro/enum instead of fixed values.
To do that, a seperate patchset may be pushed which will touch serveral other
generic files and is out of scope of this patchset.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
kernel/cpu.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 42bd331..a2491a2 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -601,6 +601,11 @@ cpu_hotplug_pm_callback(struct notifier_block *nb,
static int __init cpu_hotplug_pm_sync_init(void)
{
+ /*
+ * cpu_hotplug_pm_callback has higher priority than x86
+ * bsp_pm_callback which depends on cpu_hotplug_pm_callback
+ * to disable cpu hotplug to avoid cpu hotplug race.
+ */
pm_notifier(cpu_hotplug_pm_callback, 0);
return 0;
}
--
1.7.2
^ permalink raw reply related
* [PATCH v10 07/14] x86-64, hotplug: Add start_cpu0() entry point to head_64.S
From: Fenghua Yu @ 2012-11-13 19:32 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H Peter Anvin, Linus Torvalds,
Andrew Morton, Asit K Mallick, Tony Luck, Arjan Dan De Ven,
Suresh B Siddha, Len Brown, Srivatssa S. Bhat, Randy Dunlap,
Rafael J. Wysocki, Chen Gong, linux-kernel, linux-pm, x86
Cc: Fenghua Yu
In-Reply-To: <1352835171-3958-1-git-send-email-fenghua.yu@intel.com>
From: Fenghua Yu <fenghua.yu@intel.com>
start_cpu0() is defined in head_64.S for 64-bit. The function sets up stack and
jumps to start_secondary() for CPU0 wake up.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
arch/x86/kernel/head_64.S | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 94bf9cc..980053c 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -252,6 +252,22 @@ ENTRY(secondary_startup_64)
pushq %rax # target address in negative space
lretq
+#ifdef CONFIG_HOTPLUG_CPU
+/*
+ * Boot CPU0 entry point. It's called from play_dead(). Everything has been set
+ * up already except stack. We just set up stack here. Then call
+ * start_secondary().
+ */
+ENTRY(start_cpu0)
+ movq stack_start(%rip),%rsp
+ movq initial_code(%rip),%rax
+ pushq $0 # fake return address to stop unwinder
+ pushq $__KERNEL_CS # set correct cs
+ pushq %rax # target address in negative space
+ lretq
+ENDPROC(start_cpu0)
+#endif
+
/* SMP bootup changes these two */
__REFDATA
.align 8
--
1.7.2
^ permalink raw reply related
* [PATCH v10 08/14] x86-32, hotplug: Add start_cpu0() entry point to head_32.S
From: Fenghua Yu @ 2012-11-13 19:32 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H Peter Anvin, Linus Torvalds,
Andrew Morton, Asit K Mallick, Tony Luck, Arjan Dan De Ven,
Suresh B Siddha, Len Brown, Srivatssa S. Bhat, Randy Dunlap,
Rafael J. Wysocki, Chen Gong, linux-kernel, linux-pm, x86
Cc: Fenghua Yu
In-Reply-To: <1352835171-3958-1-git-send-email-fenghua.yu@intel.com>
From: Fenghua Yu <fenghua.yu@intel.com>
start_cpu0() is defined in head_32.S for 32-bit. The function sets up stack and
jumps to start_secondary() for CPU0 wake up.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
arch/x86/kernel/head_32.S | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 957a47a..a013e73 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -266,6 +266,19 @@ num_subarch_entries = (. - subarch_entries) / 4
jmp default_entry
#endif /* CONFIG_PARAVIRT */
+#ifdef CONFIG_HOTPLUG_CPU
+/*
+ * Boot CPU0 entry point. It's called from play_dead(). Everything has been set
+ * up already except stack. We just set up stack here. Then call
+ * start_secondary().
+ */
+ENTRY(start_cpu0)
+ movl stack_start, %ecx
+ movl %ecx, %esp
+ jmp *(initial_code)
+ENDPROC(start_cpu0)
+#endif
+
/*
* Non-boot CPU entry point; entered from trampoline.S
* We can't lgdt here, because lgdt itself uses a data segment, but
--
1.7.2
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox