* [PATCH 00/20] powerpc: Convert power off logic to pm_power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
The generic Linux framework to power off the machine is a function pointer
called pm_power_off. The trick about this pointer is that device drivers can
potentially implement it rather than board files.
Today on PowerPC we set pm_power_off to invoke our generic full machine power
off logic which then calls ppc_md.power_off to invoke machine specific power
off.
However, when we want to add a power off GPIO via the "gpio-poweroff" driver,
this card house falls apart. That driver only registers itself if pm_power_off
is NULL to ensure it doesn't override board specific logic. However, since we
always set pm_power_off to the generic power off logic (which will just not
power off the machine if no ppc_md.power_off call is implemented), we can't
implement power off via the generic GPIO power off driver.
To fix this up, let's get rid of the ppc_md.power_off logic and just always use
pm_power_off as was intended. Then individual drivers such as the GPIO power off
driver can implement power off logic via that function pointer.
With this patch set applied and a few patches on top of QEMU that implement a
power off GPIO on the virt e500 machine, I can successfully turn off my virtual
machine after halt.
Alex
Alexander Graf (20):
powerpc: Support override of pm_power_off
powerpc/xmon: Support either ppc_md.power_off or pm_power_off
powerpc/47x: Use pm_power_off rather than ppc_md.power_off
powerpc/52xx/efika: Use pm_power_off rather than ppc_md.power_off
powerpc/mpc8349emitx: Use pm_power_off rather than ppc_md.power_off
powerpc/corenet: Use pm_power_off rather than ppc_md.power_off
powerpc/85xx/sgy_cts1000: Use pm_power_off rather than
ppc_md.power_off
powerpc/celleb: Use pm_power_off rather than ppc_md.power_off
powerpc/cell/qpace: Use pm_power_off rather than ppc_md.power_off
powerpc/cell: Use pm_power_off rather than ppc_md.power_off
powerpc/chrp: Use pm_power_off rather than ppc_md.power_off
powerpc/6xx/gamecube: Use pm_power_off rather than ppc_md.power_off
powerpc/6xx/linkstation: Use pm_power_off rather than ppc_md.power_off
powerpc/6xx/wii: Use pm_power_off rather than ppc_md.power_off
powerpc/maple: Use pm_power_off rather than ppc_md.power_off
powerpc/powermac: Use pm_power_off rather than ppc_md.power_off
powerpc/powernv: Use pm_power_off rather than ppc_md.power_off
powerpc/ps3: Use pm_power_off rather than ppc_md.power_off
powerpc/pseries: Use pm_power_off rather than ppc_md.power_off
powerpc: Remove ppc_md.power_off
arch/powerpc/include/asm/machdep.h | 1 -
arch/powerpc/kernel/setup-common.c | 6 +-
arch/powerpc/platforms/44x/ppc476.c | 2 +-
arch/powerpc/platforms/52xx/efika.c | 3 +-
arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c | 8 +-
arch/powerpc/platforms/85xx/corenet_generic.c | 2 +-
arch/powerpc/platforms/85xx/sgy_cts1000.c | 4 +-
arch/powerpc/platforms/cell/celleb_setup.c | 4 +-
arch/powerpc/platforms/cell/qpace_setup.c | 3 +-
arch/powerpc/platforms/cell/setup.c | 2 +-
arch/powerpc/platforms/chrp/setup.c | 3 +-
arch/powerpc/platforms/embedded6xx/gamecube.c | 3 +-
arch/powerpc/platforms/embedded6xx/linkstation.c | 3 +-
arch/powerpc/platforms/embedded6xx/wii.c | 3 +-
arch/powerpc/platforms/maple/setup.c | 4 +-
arch/powerpc/platforms/powermac/setup.c | 147 ++++++++++++-----------
arch/powerpc/platforms/powernv/setup.c | 4 +-
arch/powerpc/platforms/ps3/setup.c | 3 +-
arch/powerpc/platforms/pseries/setup.c | 59 ++++-----
arch/powerpc/sysdev/fsl_soc.c | 2 +-
arch/powerpc/xmon/xmon.c | 3 +-
21 files changed, 139 insertions(+), 130 deletions(-)
--
1.8.1.4
^ permalink raw reply
* [PATCH 18/20] powerpc/ps3: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/ps3/setup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 3f509f8..ce3b455 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -223,6 +223,8 @@ static void __init ps3_setup_arch(void)
ppc_md.power_save = ps3_power_save;
ps3_os_area_init();
+ pm_power_off = ps3_power_off;
+
DBG(" <- %s:%d\n", __func__, __LINE__);
}
@@ -278,7 +280,6 @@ define_machine(ps3) {
.calibrate_decr = ps3_calibrate_decr,
.progress = ps3_progress,
.restart = ps3_restart,
- .power_off = ps3_power_off,
.halt = ps3_halt,
#if defined(CONFIG_KEXEC)
.kexec_cpu_down = ps3_kexec_cpu_down,
--
1.8.1.4
^ permalink raw reply related
* [PATCH 17/20] powerpc/powernv: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/powernv/setup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 5a0e2dc..60d137b 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -260,7 +260,7 @@ static void __init pnv_setup_machdep_opal(void)
ppc_md.get_rtc_time = opal_get_rtc_time;
ppc_md.set_rtc_time = opal_set_rtc_time;
ppc_md.restart = pnv_restart;
- ppc_md.power_off = pnv_power_off;
+ pm_power_off = pnv_power_off;
ppc_md.halt = pnv_halt;
ppc_md.machine_check_exception = opal_machine_check;
ppc_md.mce_check_early_recovery = opal_mce_check_early_recovery;
@@ -277,7 +277,7 @@ static void __init pnv_setup_machdep_rtas(void)
ppc_md.set_rtc_time = rtas_set_rtc_time;
}
ppc_md.restart = rtas_restart;
- ppc_md.power_off = rtas_power_off;
+ pm_power_off = rtas_power_off;
ppc_md.halt = rtas_halt;
}
#endif /* CONFIG_PPC_POWERNV_RTAS */
--
1.8.1.4
^ permalink raw reply related
* [PATCH 15/20] powerpc/maple: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/maple/setup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index cb1b0b3..34a08db 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -169,7 +169,7 @@ static void __init maple_use_rtas_reboot_and_halt_if_present(void)
if (rtas_service_present("system-reboot") &&
rtas_service_present("power-off")) {
ppc_md.restart = rtas_restart;
- ppc_md.power_off = rtas_power_off;
+ pm_power_off = rtas_power_off;
ppc_md.halt = rtas_halt;
}
}
@@ -189,6 +189,7 @@ void __init maple_setup_arch(void)
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
+ pm_power_off = maple_power_off;
maple_use_rtas_reboot_and_halt_if_present();
printk(KERN_DEBUG "Using native/NAP idle loop\n");
@@ -325,7 +326,6 @@ define_machine(maple) {
.pci_irq_fixup = maple_pci_irq_fixup,
.pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq,
.restart = maple_restart,
- .power_off = maple_power_off,
.halt = maple_halt,
.get_boot_time = maple_get_boot_time,
.set_rtc_time = maple_set_rtc_time,
--
1.8.1.4
^ permalink raw reply related
* [PATCH 11/20] powerpc/chrp: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/chrp/setup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 7044fd3..f9ad816 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -356,6 +356,8 @@ void __init chrp_setup_arch(void)
pci_create_OF_bus_map();
+ pm_power_off = rtas_power_off,
+
/*
* Print the banner, then scroll down so boot progress
* can be printed. -- Cort
@@ -597,7 +599,6 @@ define_machine(chrp) {
.show_cpuinfo = chrp_show_cpuinfo,
.init_IRQ = chrp_init_IRQ,
.restart = rtas_restart,
- .power_off = rtas_power_off,
.halt = rtas_halt,
.time_init = chrp_time_init,
.set_rtc_time = chrp_set_rtc_time,
--
1.8.1.4
^ permalink raw reply related
* [PATCH 01/20] powerpc: Support override of pm_power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The pm_power_off callback is what drivers are supposed to modify when they
implement power off support for the system.
Support a modified callback on powerpc. That way power off support code can
now either override ppc_md.power_off or pm_power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/kernel/setup-common.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 1b0e260..5dfcb28 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -140,6 +140,8 @@ void machine_power_off(void)
machine_shutdown();
if (ppc_md.power_off)
ppc_md.power_off();
+ if (pm_power_off != machine_power_off)
+ pm_power_off();
#ifdef CONFIG_SMP
smp_send_stop();
#endif
--
1.8.1.4
^ permalink raw reply related
* [PATCH 09/20] powerpc/cell/qpace: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/cell/qpace_setup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/cell/qpace_setup.c b/arch/powerpc/platforms/cell/qpace_setup.c
index 6e3409d..8488094 100644
--- a/arch/powerpc/platforms/cell/qpace_setup.c
+++ b/arch/powerpc/platforms/cell/qpace_setup.c
@@ -117,6 +117,8 @@ static void __init qpace_setup_arch(void)
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
+
+ pm_power_off = rtas_power_off;
}
static int __init qpace_probe(void)
@@ -137,7 +139,6 @@ define_machine(qpace) {
.setup_arch = qpace_setup_arch,
.show_cpuinfo = qpace_show_cpuinfo,
.restart = rtas_restart,
- .power_off = rtas_power_off,
.halt = rtas_halt,
.get_boot_time = rtas_get_boot_time,
.get_rtc_time = rtas_get_rtc_time,
--
1.8.1.4
^ permalink raw reply related
* [PATCH 06/20] powerpc/corenet: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/85xx/corenet_generic.c | 2 +-
arch/powerpc/sysdev/fsl_soc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index d22dd85..89fd568 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -156,7 +156,7 @@ static int __init corenet_generic_probe(void)
ppc_md.get_irq = ehv_pic_get_irq;
ppc_md.restart = fsl_hv_restart;
- ppc_md.power_off = fsl_hv_halt;
+ pm_power_off = fsl_hv_halt;
ppc_md.halt = fsl_hv_halt;
#ifdef CONFIG_SMP
/*
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index ffd1169..1e04568 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -238,7 +238,7 @@ void fsl_hv_restart(char *cmd)
/*
* Halt the current partition
*
- * This function should be assigned to the ppc_md.power_off and ppc_md.halt
+ * This function should be assigned to the pm_power_off and ppc_md.halt
* function pointers, to shut down the partition when we're running under
* the Freescale hypervisor.
*/
--
1.8.1.4
^ permalink raw reply related
* [PATCH 13/20] powerpc/6xx/linkstation: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/embedded6xx/linkstation.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index 455e7c08..e397e36 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -70,6 +70,8 @@ static void __init linkstation_setup_arch(void)
for_each_compatible_node(np, "pci", "mpc10x-pci")
linkstation_add_bridge(np);
+ pm_power_off = linkstation_power_off;
+
printk(KERN_INFO "BUFFALO Network Attached Storage Series\n");
printk(KERN_INFO "(C) 2002-2005 BUFFALO INC.\n");
}
@@ -158,7 +160,6 @@ define_machine(linkstation){
.show_cpuinfo = linkstation_show_cpuinfo,
.get_irq = mpic_get_irq,
.restart = linkstation_restart,
- .power_off = linkstation_power_off,
.halt = linkstation_halt,
.calibrate_decr = generic_calibrate_decr,
};
--
1.8.1.4
^ permalink raw reply related
* [PATCH 02/20] powerpc/xmon: Support either ppc_md.power_off or pm_power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
Xmon can manually turn off the machine. We now have 2 code paths for this:
1) ppc_md.power_off
2) pm_power_off
This patch allows xmon to support both and makes sure it graciously allows
a path to not be implemented.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/xmon/xmon.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index b988b5a..531f649 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -981,7 +981,10 @@ static void bootcmds(void)
else if (cmd == 'h')
ppc_md.halt();
else if (cmd == 'p')
- ppc_md.power_off();
+ if (ppc_md.power_off)
+ ppc_md.power_off();
+ if (pm_power_off)
+ pm_power_off();
}
static int cpu_cmd(void)
--
1.8.1.4
^ permalink raw reply related
* [PATCH 03/20] powerpc/47x: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/44x/ppc476.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/44x/ppc476.c b/arch/powerpc/platforms/44x/ppc476.c
index 33986c1..7027015 100644
--- a/arch/powerpc/platforms/44x/ppc476.c
+++ b/arch/powerpc/platforms/44x/ppc476.c
@@ -94,7 +94,7 @@ static int avr_probe(struct i2c_client *client,
{
avr_i2c_client = client;
ppc_md.restart = avr_reset_system;
- ppc_md.power_off = avr_power_off_system;
+ pm_power_off = avr_power_off_system
return 0;
}
--
1.8.1.4
^ permalink raw reply related
* [PATCH 04/20] powerpc/52xx/efika: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/52xx/efika.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 3feffde..485a470 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -194,6 +194,8 @@ static void __init efika_setup_arch(void)
mpc52xx_pm_init();
#endif
+ pm_power_off = rtas_power_off;
+
if (ppc_md.progress)
ppc_md.progress("Linux/PPC " UTS_RELEASE " running on Efika ;-)\n", 0x0);
}
@@ -225,7 +227,6 @@ define_machine(efika)
.init_IRQ = mpc52xx_init_irq,
.get_irq = mpc52xx_get_irq,
.restart = rtas_restart,
- .power_off = rtas_power_off,
.halt = rtas_halt,
.set_rtc_time = rtas_set_rtc_time,
.get_rtc_time = rtas_get_rtc_time,
--
1.8.1.4
^ permalink raw reply related
* [PATCH 08/20] powerpc/celleb: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/cell/celleb_setup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/cell/celleb_setup.c b/arch/powerpc/platforms/cell/celleb_setup.c
index 1d5a4d8..011cc88 100644
--- a/arch/powerpc/platforms/cell/celleb_setup.c
+++ b/arch/powerpc/platforms/cell/celleb_setup.c
@@ -130,6 +130,7 @@ static void __init celleb_setup_arch_beat(void)
#endif
celleb_setup_arch_common();
+ pm_power_off = beat_power_off;
}
static int __init celleb_probe_beat(void)
@@ -178,6 +179,7 @@ static void __init celleb_setup_arch_native(void)
/* XXX: nvram initialization should be added */
celleb_setup_arch_common();
+ pm_power_off = rtas_power_off;
}
static int __init celleb_probe_native(void)
@@ -204,7 +206,6 @@ define_machine(celleb_beat) {
.setup_arch = celleb_setup_arch_beat,
.show_cpuinfo = celleb_show_cpuinfo,
.restart = beat_restart,
- .power_off = beat_power_off,
.halt = beat_halt,
.get_rtc_time = beat_get_rtc_time,
.set_rtc_time = beat_set_rtc_time,
@@ -230,7 +231,6 @@ define_machine(celleb_native) {
.setup_arch = celleb_setup_arch_native,
.show_cpuinfo = celleb_show_cpuinfo,
.restart = rtas_restart,
- .power_off = rtas_power_off,
.halt = rtas_halt,
.get_boot_time = rtas_get_boot_time,
.get_rtc_time = rtas_get_rtc_time,
--
1.8.1.4
^ permalink raw reply related
* [PATCH 07/20] powerpc/85xx/sgy_cts1000: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/85xx/sgy_cts1000.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c
index bb75add..33f16bb 100644
--- a/arch/powerpc/platforms/85xx/sgy_cts1000.c
+++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c
@@ -120,7 +120,7 @@ static int gpio_halt_probe(struct platform_device *pdev)
/* Register our halt function */
ppc_md.halt = gpio_halt_cb;
- ppc_md.power_off = gpio_halt_cb;
+ pm_power_off = gpio_halt_cb;
printk(KERN_INFO "gpio-halt: registered GPIO %d (%d trigger, %d"
" irq).\n", gpio, trigger, irq);
@@ -137,7 +137,7 @@ static int gpio_halt_remove(struct platform_device *pdev)
free_irq(irq, halt_node);
ppc_md.halt = NULL;
- ppc_md.power_off = NULL;
+ pm_power_off = NULL;
gpio_free(gpio);
--
1.8.1.4
^ permalink raw reply related
* [PATCH 05/20] powerpc/mpc8349emitx: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>
The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index e238b6a..a3b7a1f 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -166,10 +166,10 @@ static int mcu_probe(struct i2c_client *client, const struct i2c_device_id *id)
if (ret)
goto err;
- /* XXX: this is potentially racy, but there is no lock for ppc_md */
- if (!ppc_md.power_off) {
+ /* XXX: this is potentially racy, but there is no lock for pm_power_off */
+ if (!pm_power_off) {
glob_mcu = mcu;
- ppc_md.power_off = mcu_power_off;
+ pm_power_off = mcu_power_off;
dev_info(&client->dev, "will provide power-off service\n");
}
@@ -196,7 +196,7 @@ static int mcu_remove(struct i2c_client *client)
device_remove_file(&client->dev, &dev_attr_status);
if (glob_mcu == mcu) {
- ppc_md.power_off = NULL;
+ pm_power_off = NULL;
glob_mcu = NULL;
}
--
1.8.1.4
^ permalink raw reply related
* Re: [PATCH v2 13/17] cxl: Add base builtin support
From: Michael Ellerman @ 2014-10-01 12:00 UTC (permalink / raw)
To: Michael Neuling, greg, arnd, mpe, benh
Cc: cbe-oss-dev, mikey, Aneesh Kumar K.V, imunsie, linux-kernel,
linuxppc-dev, jk, anton
In-Reply-To: <1412073306-13812-14-git-send-email-mikey@neuling.org>
On Tue, 2014-30-09 at 10:35:02 UTC, Michael Neuling wrote:
> This also adds the cxl_ctx_in_use() function for use in the mm code to see if
> any cxl contexts are currently in use. This is used by the tlbie() to
> determine if it can do local TLB invalidations or not. This also adds get/put
> calls for the cxl driver module to refcount the active cxl contexts.
> diff --git a/drivers/misc/cxl/base.c b/drivers/misc/cxl/base.c
> new file mode 100644
> index 0000000..f4cbcfb
> --- /dev/null
> +++ b/drivers/misc/cxl/base.c
> @@ -0,0 +1,102 @@
> +/*
> + * Copyright 2014 IBM Corp.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/rcupdate.h>
> +#include <asm/errno.h>
> +#include <misc/cxl.h>
> +#include "cxl.h"
> +
> +/* protected by rcu */
> +static struct cxl_calls *cxl_calls;
> +
> +static atomic_t use_count = ATOMIC_INIT(0);
...
> +void cxl_ctx_get(void)
> +{
> + atomic_inc(&use_count);
> +}
> +EXPORT_SYMBOL(cxl_ctx_get);
> +
> +void cxl_ctx_put(void)
> +{
> + atomic_dec(&use_count);
> +}
> +EXPORT_SYMBOL(cxl_ctx_put);
> +
> +bool cxl_ctx_in_use(void)
> +{
> + return (atomic_read(&use_count) != 0);
> +}
> +EXPORT_SYMBOL(cxl_ctx_in_use);
So as written this results in a function call for every tlbie(), even when no
one has ever used a CAPI adapter, or when none are even in the machine.
I think the patch below is a better trade off. It makes the use_count global,
but that's not a biggy. The benefit is that the additional code in tlbie()
becomes:
ld r10,-29112(r2)
lwz r10,0(r10)
cmpwi cr7,r10,0
Which is about as good as it can get.
cheers
diff --git a/drivers/misc/cxl/base.c b/drivers/misc/cxl/base.c
index f4cbcfbd8dbc..4401d1c2dd33 100644
--- a/drivers/misc/cxl/base.c
+++ b/drivers/misc/cxl/base.c
@@ -16,7 +16,7 @@
/* protected by rcu */
static struct cxl_calls *cxl_calls;
-static atomic_t use_count = ATOMIC_INIT(0);
+atomic_t cxl_use_count = ATOMIC_INIT(0);
#ifdef CONFIG_CXL_MODULE
@@ -65,24 +65,6 @@ void cxl_slbia(struct mm_struct *mm)
}
EXPORT_SYMBOL(cxl_slbia);
-void cxl_ctx_get(void)
-{
- atomic_inc(&use_count);
-}
-EXPORT_SYMBOL(cxl_ctx_get);
-
-void cxl_ctx_put(void)
-{
- atomic_dec(&use_count);
-}
-EXPORT_SYMBOL(cxl_ctx_put);
-
-bool cxl_ctx_in_use(void)
-{
- return (atomic_read(&use_count) != 0);
-}
-EXPORT_SYMBOL(cxl_ctx_in_use);
-
int register_cxl_calls(struct cxl_calls *calls)
{
if (cxl_calls)
diff --git a/include/misc/cxl.h b/include/misc/cxl.h
index bde46a330881..6e43dca6a792 100644
--- a/include/misc/cxl.h
+++ b/include/misc/cxl.h
@@ -18,12 +18,24 @@ struct cxl_irq_ranges {
};
#ifdef CONFIG_CXL_BASE
+extern atomic_t cxl_use_count;
void cxl_slbia(struct mm_struct *mm);
-void cxl_ctx_get(void);
-void cxl_ctx_put(void);
-bool cxl_ctx_in_use(void);
+static inline bool cxl_ctx_in_use(void)
+{
+ return (atomic_read(&cxl_use_count) != 0);
+}
+
+static inline void cxl_ctx_get(void)
+{
+ atomic_inc(&cxl_use_count);
+}
+
+static inline void cxl_ctx_put(void)
+{
+ atomic_dec(&cxl_use_count);
+}
#else /* CONFIG_CXL_BASE */
#define cxl_slbia(...) do { } while (0)
^ permalink raw reply related
* Re: [PATCH v2 07/17] cxl: Add new header for call backs and structs
From: Michael Ellerman @ 2014-10-01 12:00 UTC (permalink / raw)
To: Michael Neuling, greg, arnd, mpe, benh
Cc: cbe-oss-dev, mikey, Aneesh Kumar K.V, imunsie, linux-kernel,
linuxppc-dev, jk, anton
In-Reply-To: <1412073306-13812-8-git-send-email-mikey@neuling.org>
On Tue, 2014-30-09 at 10:34:56 UTC, Michael Neuling wrote:
> From: Ian Munsie <imunsie@au1.ibm.com>
>
> This new header add defines for callbacks and structs needed by the rest of the
adds
> kernel to hook into the cxl infrastructure.
>
> Empty functions are provided when CONFIG CXL_BASE is not enabled.
>
> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
> include/misc/cxl.h | 34 ++++++++++++++++++++++++++++++++++
include/misc is kind of weird. I guess it's a misc device.
Any reason not to have it in arch/powerpc/include ?
> diff --git a/include/misc/cxl.h b/include/misc/cxl.h
> new file mode 100644
> index 0000000..bde46a3
> --- /dev/null
> +++ b/include/misc/cxl.h
> @@ -0,0 +1,34 @@
> +/*
> + * Copyright 2014 IBM Corp.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#ifndef _MISC_ASM_CXL_H
No ASM.
> +#define _MISC_ASM_CXL_H
> +
> +#define CXL_IRQ_RANGES 4
> +
> +struct cxl_irq_ranges {
> + irq_hw_number_t offset[CXL_IRQ_RANGES];
> + irq_hw_number_t range[CXL_IRQ_RANGES];
> +};
> +
> +#ifdef CONFIG_CXL_BASE
> +
> +void cxl_slbia(struct mm_struct *mm);
> +void cxl_ctx_get(void);
> +void cxl_ctx_put(void);
> +bool cxl_ctx_in_use(void);
> +
> +#else /* CONFIG_CXL_BASE */
> +
> +#define cxl_slbia(...) do { } while (0)
> +#define cxl_ctx_in_use(...) false
Any reason these shouldn't be static inlines?
cheers
^ permalink raw reply
* Re: [PATCH v2 02/17] powerpc/cell: Move data segment faulting code out of cell platform
From: Michael Neuling @ 2014-10-01 11:10 UTC (permalink / raw)
To: Aneesh Kumar K.V
Cc: cbe-oss-dev, arnd, greg, linux-kernel, linuxppc-dev, anton,
imunsie, jk
In-Reply-To: <8738b8nmwr.fsf@linux.vnet.ibm.com>
On Wed, 2014-10-01 at 15:15 +0530, Aneesh Kumar K.V wrote:
> Michael Neuling <mikey@neuling.org> writes:
>=20
> > From: Ian Munsie <imunsie@au1.ibm.com>
> >
> > __spu_trap_data_seg() currently contains code to determine the VSID and=
ESID
> > required for a particular EA and mm struct.
> >
> > This code is generically useful for other co-processors. This moves th=
e code
> > of the cell platform so it can be used by other powerpc code. It also =
adds 1TB
> > segment handling which Cell didn't have.
> >
> > Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
> > Signed-off-by: Michael Neuling <mikey@neuling.org>
> > ---
> > arch/powerpc/include/asm/mmu-hash64.h | 7 ++++-
> > arch/powerpc/mm/copro_fault.c | 48 ++++++++++++++++++++++++++=
++++++++
> > arch/powerpc/mm/slb.c | 3 ---
> > arch/powerpc/platforms/cell/spu_base.c | 41 +++-----------------------=
---
> > 4 files changed, 58 insertions(+), 41 deletions(-)
> >
> > diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/inclu=
de/asm/mmu-hash64.h
> > index d765144..6d0b7a2 100644
> > --- a/arch/powerpc/include/asm/mmu-hash64.h
> > +++ b/arch/powerpc/include/asm/mmu-hash64.h
> > @@ -189,7 +189,12 @@ static inline unsigned int mmu_psize_to_shift(unsi=
gned int mmu_psize)
> > #define LP_MASK(i) ((0xFF >> (i)) << LP_SHIFT)
> > =20
> > #ifndef __ASSEMBLY__
> > -
> > +static inline int slb_vsid_shift(int ssize)
> > +{
> > + if (ssize =3D=3D MMU_SEGSIZE_256M)
> > + return SLB_VSID_SHIFT;
> > + return SLB_VSID_SHIFT_1T;
> > +}
> > static inline int segment_shift(int ssize)
> > {
> > if (ssize =3D=3D MMU_SEGSIZE_256M)
> > diff --git a/arch/powerpc/mm/copro_fault.c b/arch/powerpc/mm/copro_faul=
t.c
> > index ba7df14..b865697 100644
> > --- a/arch/powerpc/mm/copro_fault.c
> > +++ b/arch/powerpc/mm/copro_fault.c
> > @@ -90,3 +90,51 @@ out_unlock:
> > return ret;
> > }
> > EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
> > +
> > +int copro_data_segment(struct mm_struct *mm, u64 ea, u64 *esid, u64 *v=
sid)
> > +{
> > + int psize, ssize;
> > +
> > + *esid =3D (ea & ESID_MASK) | SLB_ESID_V;
> > +
> > + switch (REGION_ID(ea)) {
> > + case USER_REGION_ID:
> > + pr_devel("copro_data_segment: 0x%llx -- USER_REGION_ID\n", ea);
> > +#ifdef CONFIG_PPC_MM_SLICES
> > + psize =3D get_slice_psize(mm, ea);
> > +#else
> > + psize =3D mm->context.user_psize;
> > +#endif
>=20
> We don't really need that as explained in last review.
That cleanup is in patch 10. I avoided changing it here so it's clearer
that what is being removed is the same as what is being added.
Mikey
^ permalink raw reply
* Re: [PATCH v2 03/17] powerpc/cell: Make spu_flush_all_slbs() generic
From: Michael Neuling @ 2014-10-01 10:51 UTC (permalink / raw)
To: Michael Ellerman
Cc: cbe-oss-dev, arnd, Aneesh Kumar K.V, greg, linux-kernel, imunsie,
linuxppc-dev, anton, jk
In-Reply-To: <20141001071330.E4262140174@ozlabs.org>
On Wed, 2014-10-01 at 17:13 +1000, Michael Ellerman wrote:
> On Tue, 2014-30-09 at 10:34:52 UTC, Michael Neuling wrote:
> > diff --git a/arch/powerpc/include/asm/copro.h b/arch/powerpc/include/as=
m/copro.h
> > index 2858108..f3d338f 100644
> > --- a/arch/powerpc/include/asm/copro.h
> > +++ b/arch/powerpc/include/asm/copro.h
> > @@ -15,4 +15,10 @@ int copro_handle_mm_fault(struct mm_struct *mm, unsi=
gned long ea,
> > =20
> > int copro_data_segment(struct mm_struct *mm, u64 ea, u64 *esid, u64 *v=
sid);
> > =20
> > +
> > +#ifdef CONFIG_PPC_COPRO_BASE
> > +void copro_flush_all_slbs(struct mm_struct *mm);
> > +#else
> > +#define copro_flush_all_slbs(mm) do {} while(0)
>=20
> This can be a static inline, so it should be. That way you get type check=
ing on
> the argument for CONFIG_PPC_COPRO_BASE=3Dn.
OK, I'll update.
Mikey
^ permalink raw reply
* Re: [PATCH v2 10/17] powerpc/mm: Merge vsid calculation in hash_page() and copro_data_segment()
From: Aneesh Kumar K.V @ 2014-10-01 9:55 UTC (permalink / raw)
To: Michael Neuling, greg, arnd, mpe, benh
Cc: cbe-oss-dev, mikey, linux-kernel, linuxppc-dev, jk, imunsie,
anton
In-Reply-To: <1412073306-13812-11-git-send-email-mikey@neuling.org>
Michael Neuling <mikey@neuling.org> writes:
> From: Ian Munsie <imunsie@au1.ibm.com>
>
> The vsid calculation between hash_page() and copro_data_segment() are very
> similar. This merges these two different versions.
>
> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
> arch/powerpc/include/asm/mmu-hash64.h | 2 ++
> arch/powerpc/mm/copro_fault.c | 45 ++++++--------------------
> arch/powerpc/mm/hash_utils_64.c | 61 ++++++++++++++++++++++-------------
> 3 files changed, 50 insertions(+), 58 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
> index f84e5a5..bf43fb0 100644
> --- a/arch/powerpc/include/asm/mmu-hash64.h
> +++ b/arch/powerpc/include/asm/mmu-hash64.h
> @@ -322,6 +322,8 @@ extern int __hash_page_64K(unsigned long ea, unsigned long access,
> unsigned int local, int ssize);
> struct mm_struct;
> unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap);
> +int calculate_vsid(struct mm_struct *mm, u64 ea,
> + u64 *vsid, int *psize, int *ssize);
> extern int hash_page_mm(struct mm_struct *mm, unsigned long ea, unsigned long access, unsigned long trap);
> extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap);
> int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
> diff --git a/arch/powerpc/mm/copro_fault.c b/arch/powerpc/mm/copro_fault.c
> index 939abdf..ba8bf8e 100644
> --- a/arch/powerpc/mm/copro_fault.c
> +++ b/arch/powerpc/mm/copro_fault.c
> @@ -94,45 +94,18 @@ EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
>
> int copro_data_segment(struct mm_struct *mm, u64 ea, u64 *esid, u64 *vsid)
> {
> - int psize, ssize;
> + int psize, ssize, rc;
>
> *esid = (ea & ESID_MASK) | SLB_ESID_V;
>
> - switch (REGION_ID(ea)) {
> - case USER_REGION_ID:
> - pr_devel("copro_data_segment: 0x%llx -- USER_REGION_ID\n", ea);
> -#ifdef CONFIG_PPC_MM_SLICES
> - psize = get_slice_psize(mm, ea);
> -#else
> - psize = mm->context.user_psize;
> -#endif
> - ssize = user_segment_size(ea);
> - *vsid = (get_vsid(mm->context.id, ea, ssize)
> - << slb_vsid_shift(ssize)) | SLB_VSID_USER;
> - break;
> - case VMALLOC_REGION_ID:
> - pr_devel("copro_data_segment: 0x%llx -- VMALLOC_REGION_ID\n", ea);
> - if (ea < VMALLOC_END)
> - psize = mmu_vmalloc_psize;
> - else
> - psize = mmu_io_psize;
> - ssize = mmu_kernel_ssize;
> - *vsid = (get_kernel_vsid(ea, mmu_kernel_ssize)
> - << SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
> - break;
> - case KERNEL_REGION_ID:
> - pr_devel("copro_data_segment: 0x%llx -- KERNEL_REGION_ID\n", ea);
> - psize = mmu_linear_psize;
> - ssize = mmu_kernel_ssize;
> - *vsid = (get_kernel_vsid(ea, mmu_kernel_ssize)
> - << SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
> - break;
> - default:
> - /* Future: support kernel segments so that drivers can use the
> - * CoProcessors */
> - pr_debug("invalid region access at %016llx\n", ea);
> - return 1;
> - }
> + rc = calculate_vsid(mm, ea, vsid, &psize, &ssize);
> + if (rc)
> + return rc;
> + if (REGION_ID(ea) == USER_REGION_ID)
> + *vsid = (*vsid << slb_vsid_shift(ssize)) | SLB_VSID_USER;
> + else
> + *vsid = (*vsid << SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
> +
> *vsid |= mmu_psize_defs[psize].sllp |
> ((ssize == MMU_SEGSIZE_1T) ? SLB_VSID_B_1T : 0);
>
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> index 0a5c8c0..3fa81ca 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -983,6 +983,38 @@ static void check_paca_psize(unsigned long ea, struct mm_struct *mm,
> }
> }
>
> +int calculate_vsid(struct mm_struct *mm, u64 ea,
> + u64 *vsid, int *psize, int *ssize)
> +{
> + switch (REGION_ID(ea)) {
> + case USER_REGION_ID:
> + pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea);
> + *psize = get_slice_psize(mm, ea);
> + *ssize = user_segment_size(ea);
> + *vsid = get_vsid(mm->context.id, ea, *ssize);
> + return 0;
> + case VMALLOC_REGION_ID:
> + pr_devel("%s: 0x%llx -- VMALLOC_REGION_ID\n", __func__, ea);
> + if (ea < VMALLOC_END)
> + *psize = mmu_vmalloc_psize;
> + else
> + *psize = mmu_io_psize;
> + *ssize = mmu_kernel_ssize;
> + *vsid = get_kernel_vsid(ea, mmu_kernel_ssize);
> + return 0;
> + case KERNEL_REGION_ID:
> + pr_devel("%s: 0x%llx -- KERNEL_REGION_ID\n", __func__, ea);
> + *psize = mmu_linear_psize;
> + *ssize = mmu_kernel_ssize;
> + *vsid = get_kernel_vsid(ea, mmu_kernel_ssize);
> + return 0;
> + default:
> + pr_debug("%s: invalid region access at %016llx\n", __func__, ea);
> + return 1;
> + }
> +}
> +EXPORT_SYMBOL_GPL(calculate_vsid);
> +
> /* Result code is:
> * 0 - handled
> * 1 - normal page fault
> @@ -993,7 +1025,7 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea, unsigned long access, u
> {
> enum ctx_state prev_state = exception_enter();
> pgd_t *pgdir;
> - unsigned long vsid;
> + u64 vsid;
> pte_t *ptep;
> unsigned hugeshift;
> const struct cpumask *tmp;
> @@ -1003,35 +1035,20 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea, unsigned long access, u
> DBG_LOW("%s(ea=%016lx, access=%lx, trap=%lx\n",
> __func__, ea, access, trap);
>
> - /* Get region & vsid */
> - switch (REGION_ID(ea)) {
> - case USER_REGION_ID:
> + /* Get region */
> + if (REGION_ID(ea) == USER_REGION_ID) {
> user_region = 1;
> if (! mm) {
> DBG_LOW(" user region with no mm !\n");
> rc = 1;
> goto bail;
> }
> - psize = get_slice_psize(mm, ea);
> - ssize = user_segment_size(ea);
> - vsid = get_vsid(mm->context.id, ea, ssize);
> - break;
> - case VMALLOC_REGION_ID:
> + } else
> mm = &init_mm;
> - vsid = get_kernel_vsid(ea, mmu_kernel_ssize);
> - if (ea < VMALLOC_END)
> - psize = mmu_vmalloc_psize;
> - else
> - psize = mmu_io_psize;
> - ssize = mmu_kernel_ssize;
> - break;
> - default:
> - /* Not a valid range
> - * Send the problem up to do_page_fault
> - */
> - rc = 1;
That part is different now. We now handle kernel_region_id in case of
hash_page. Earlier we used consider it a problem.
> + rc = calculate_vsid(mm, ea, &vsid, &psize, &ssize);
> + if (rc)
> goto bail;
> - }
> +
> DBG_LOW(" mm=%p, mm->pgdir=%p, vsid=%016lx\n", mm, mm->pgd, vsid);
>
> /* Bad address. */
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: [PATCH v2 02/17] powerpc/cell: Move data segment faulting code out of cell platform
From: Aneesh Kumar K.V @ 2014-10-01 9:53 UTC (permalink / raw)
To: Michael Neuling, greg, arnd, mpe, benh
Cc: cbe-oss-dev, mikey, linux-kernel, linuxppc-dev, jk, imunsie,
anton
In-Reply-To: <1412073306-13812-3-git-send-email-mikey@neuling.org>
Michael Neuling <mikey@neuling.org> writes:
> From: Ian Munsie <imunsie@au1.ibm.com>
>
> __spu_trap_data_seg() currently contains code to determine the VSID and ESID
> required for a particular EA and mm struct.
>
> This code is generically useful for other co-processors. This moves the code
> of the cell platform so it can be used by other powerpc code. It also adds 1TB
> segment handling which Cell didn't have.
>
> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
> arch/powerpc/include/asm/mmu-hash64.h | 7 ++++-
> arch/powerpc/mm/copro_fault.c | 48 ++++++++++++++++++++++++++++++++++
> arch/powerpc/mm/slb.c | 3 ---
> arch/powerpc/platforms/cell/spu_base.c | 41 +++--------------------------
> 4 files changed, 58 insertions(+), 41 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
> index d765144..6d0b7a2 100644
> --- a/arch/powerpc/include/asm/mmu-hash64.h
> +++ b/arch/powerpc/include/asm/mmu-hash64.h
> @@ -189,7 +189,12 @@ static inline unsigned int mmu_psize_to_shift(unsigned int mmu_psize)
> #define LP_MASK(i) ((0xFF >> (i)) << LP_SHIFT)
>
> #ifndef __ASSEMBLY__
> -
> +static inline int slb_vsid_shift(int ssize)
> +{
> + if (ssize == MMU_SEGSIZE_256M)
> + return SLB_VSID_SHIFT;
> + return SLB_VSID_SHIFT_1T;
> +}
> static inline int segment_shift(int ssize)
> {
> if (ssize == MMU_SEGSIZE_256M)
> diff --git a/arch/powerpc/mm/copro_fault.c b/arch/powerpc/mm/copro_fault.c
> index ba7df14..b865697 100644
> --- a/arch/powerpc/mm/copro_fault.c
> +++ b/arch/powerpc/mm/copro_fault.c
> @@ -90,3 +90,51 @@ out_unlock:
> return ret;
> }
> EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
> +
> +int copro_data_segment(struct mm_struct *mm, u64 ea, u64 *esid, u64 *vsid)
> +{
> + int psize, ssize;
> +
> + *esid = (ea & ESID_MASK) | SLB_ESID_V;
> +
> + switch (REGION_ID(ea)) {
> + case USER_REGION_ID:
> + pr_devel("copro_data_segment: 0x%llx -- USER_REGION_ID\n", ea);
> +#ifdef CONFIG_PPC_MM_SLICES
> + psize = get_slice_psize(mm, ea);
> +#else
> + psize = mm->context.user_psize;
> +#endif
> + ssize = user_segment_size(ea);
> + *vsid = (get_vsid(mm->context.id, ea, ssize)
> + << slb_vsid_shift(ssize)) | SLB_VSID_USER;
> + break;
> + case VMALLOC_REGION_ID:
> + pr_devel("copro_data_segment: 0x%llx -- VMALLOC_REGION_ID\n", ea);
> + if (ea < VMALLOC_END)
> + psize = mmu_vmalloc_psize;
> + else
> + psize = mmu_io_psize;
> + ssize = mmu_kernel_ssize;
> + *vsid = (get_kernel_vsid(ea, mmu_kernel_ssize)
> + << SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
why not
*vsid = (get_kernel_vsid(ea, mmu_kernel_ssize)
<< slb_vsid_shift(ssize)) | SLB_VSID_KERNEL;
for vmalloc and kernel region ? We could end up using 1T segments for kernel mapping too.
-aneesh
^ permalink raw reply
* Re: [PATCH v2 02/17] powerpc/cell: Move data segment faulting code out of cell platform
From: Aneesh Kumar K.V @ 2014-10-01 9:45 UTC (permalink / raw)
To: Michael Neuling, greg, arnd, mpe, benh
Cc: cbe-oss-dev, mikey, linux-kernel, linuxppc-dev, jk, imunsie,
anton
In-Reply-To: <1412073306-13812-3-git-send-email-mikey@neuling.org>
Michael Neuling <mikey@neuling.org> writes:
> From: Ian Munsie <imunsie@au1.ibm.com>
>
> __spu_trap_data_seg() currently contains code to determine the VSID and ESID
> required for a particular EA and mm struct.
>
> This code is generically useful for other co-processors. This moves the code
> of the cell platform so it can be used by other powerpc code. It also adds 1TB
> segment handling which Cell didn't have.
>
> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
> arch/powerpc/include/asm/mmu-hash64.h | 7 ++++-
> arch/powerpc/mm/copro_fault.c | 48 ++++++++++++++++++++++++++++++++++
> arch/powerpc/mm/slb.c | 3 ---
> arch/powerpc/platforms/cell/spu_base.c | 41 +++--------------------------
> 4 files changed, 58 insertions(+), 41 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
> index d765144..6d0b7a2 100644
> --- a/arch/powerpc/include/asm/mmu-hash64.h
> +++ b/arch/powerpc/include/asm/mmu-hash64.h
> @@ -189,7 +189,12 @@ static inline unsigned int mmu_psize_to_shift(unsigned int mmu_psize)
> #define LP_MASK(i) ((0xFF >> (i)) << LP_SHIFT)
>
> #ifndef __ASSEMBLY__
> -
> +static inline int slb_vsid_shift(int ssize)
> +{
> + if (ssize == MMU_SEGSIZE_256M)
> + return SLB_VSID_SHIFT;
> + return SLB_VSID_SHIFT_1T;
> +}
> static inline int segment_shift(int ssize)
> {
> if (ssize == MMU_SEGSIZE_256M)
> diff --git a/arch/powerpc/mm/copro_fault.c b/arch/powerpc/mm/copro_fault.c
> index ba7df14..b865697 100644
> --- a/arch/powerpc/mm/copro_fault.c
> +++ b/arch/powerpc/mm/copro_fault.c
> @@ -90,3 +90,51 @@ out_unlock:
> return ret;
> }
> EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
> +
> +int copro_data_segment(struct mm_struct *mm, u64 ea, u64 *esid, u64 *vsid)
> +{
> + int psize, ssize;
> +
> + *esid = (ea & ESID_MASK) | SLB_ESID_V;
> +
> + switch (REGION_ID(ea)) {
> + case USER_REGION_ID:
> + pr_devel("copro_data_segment: 0x%llx -- USER_REGION_ID\n", ea);
> +#ifdef CONFIG_PPC_MM_SLICES
> + psize = get_slice_psize(mm, ea);
> +#else
> + psize = mm->context.user_psize;
> +#endif
We don't really need that as explained in last review.
-aneesh
^ permalink raw reply
* Re: [PATCH v2 09/17] powerpc/mm: Add new hash_page_mm()
From: Aneesh Kumar K.V @ 2014-10-01 9:43 UTC (permalink / raw)
To: Michael Neuling, greg, arnd, mpe, benh
Cc: cbe-oss-dev, mikey, linux-kernel, linuxppc-dev, jk, imunsie,
anton
In-Reply-To: <1412073306-13812-10-git-send-email-mikey@neuling.org>
Michael Neuling <mikey@neuling.org> writes:
> From: Ian Munsie <imunsie@au1.ibm.com>
>
> This adds a new function hash_page_mm() based on the existing hash_page().
> This version allows any struct mm to be passed in, rather than assuming
> current. This is useful for servicing co-processor faults which are not in the
> context of the current running process.
>
> We need to be careful here as the current hash_page() assumes current in a few
> places.
It would be nice to document the rules here. So when we try to add a hash
page entry, and if that result in demotion of the segment are we suppose to
flush slbs ? Also why would one want to hash anything other
than current->mm ? How will this get called ?
May be they are explained in later patches. But can we also explain it
here.
>
> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
> arch/powerpc/include/asm/mmu-hash64.h | 1 +
> arch/powerpc/mm/hash_utils_64.c | 22 ++++++++++++++--------
> 2 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
> index 6d0b7a2..f84e5a5 100644
> --- a/arch/powerpc/include/asm/mmu-hash64.h
> +++ b/arch/powerpc/include/asm/mmu-hash64.h
> @@ -322,6 +322,7 @@ extern int __hash_page_64K(unsigned long ea, unsigned long access,
> unsigned int local, int ssize);
> struct mm_struct;
> unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap);
> +extern int hash_page_mm(struct mm_struct *mm, unsigned long ea, unsigned long access, unsigned long trap);
> extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap);
> int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
> pte_t *ptep, unsigned long trap, int local, int ssize,
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> index bbdb054..0a5c8c0 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -904,7 +904,7 @@ void demote_segment_4k(struct mm_struct *mm, unsigned long addr)
> return;
> slice_set_range_psize(mm, addr, 1, MMU_PAGE_4K);
> copro_flush_all_slbs(mm);
> - if (get_paca_psize(addr) != MMU_PAGE_4K) {
> + if ((get_paca_psize(addr) != MMU_PAGE_4K) && (current->mm == mm)) {
> get_paca()->context = mm->context;
> slb_flush_and_rebolt();
> }
> @@ -989,26 +989,24 @@ static void check_paca_psize(unsigned long ea, struct mm_struct *mm,
> * -1 - critical hash insertion error
> * -2 - access not permitted by subpage protection mechanism
> */
> -int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> +int hash_page_mm(struct mm_struct *mm, unsigned long ea, unsigned long access, unsigned long trap)
> {
> enum ctx_state prev_state = exception_enter();
> pgd_t *pgdir;
> unsigned long vsid;
> - struct mm_struct *mm;
> pte_t *ptep;
> unsigned hugeshift;
> const struct cpumask *tmp;
> int rc, user_region = 0, local = 0;
> int psize, ssize;
>
> - DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n",
> - ea, access, trap);
> + DBG_LOW("%s(ea=%016lx, access=%lx, trap=%lx\n",
> + __func__, ea, access, trap);
>
> /* Get region & vsid */
> switch (REGION_ID(ea)) {
> case USER_REGION_ID:
> user_region = 1;
> - mm = current->mm;
> if (! mm) {
> DBG_LOW(" user region with no mm !\n");
> rc = 1;
> @@ -1104,7 +1102,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> WARN_ON(1);
> }
> #endif
> - check_paca_psize(ea, mm, psize, user_region);
> + if (current->mm == mm)
> + check_paca_psize(ea, mm, psize, user_region);
>
> goto bail;
> }
> @@ -1145,7 +1144,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> }
> }
>
> - check_paca_psize(ea, mm, psize, user_region);
> + if (current->mm == mm)
> + check_paca_psize(ea, mm, psize, user_region);
> #endif /* CONFIG_PPC_64K_PAGES */
>
> #ifdef CONFIG_PPC_HAS_HASH_64K
> @@ -1180,6 +1180,12 @@ bail:
> exception_exit(prev_state);
> return rc;
> }
> +EXPORT_SYMBOL_GPL(hash_page_mm);
> +
> +int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> +{
> + return hash_page_mm(current->mm, ea, access, trap);
> +}
> EXPORT_SYMBOL_GPL(hash_page);
>
> void hash_preload(struct mm_struct *mm, unsigned long ea,
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: [PATCH v4 01/10] tools/perf: support parsing parameterized events
From: Jiri Olsa @ 2014-10-01 9:06 UTC (permalink / raw)
To: Sukadev Bhattiprolu
Cc: ak, Michael Ellerman, peterz, linux-kernel, eranian, dev,
Arnaldo Carvalho de Melo, Paul Mackerras, linuxppc-dev,
Ingo Molnar, Anshuman Khandual
In-Reply-To: <20140926022520.GA8997@us.ibm.com>
On Thu, Sep 25, 2014 at 07:25:20PM -0700, Sukadev Bhattiprolu wrote:
> Jiri Olsa [jolsa@redhat.com] wrote:
> | On Wed, Sep 24, 2014 at 12:27:15PM -0700, Sukadev Bhattiprolu wrote:
> | > From: Cody P Schafer <cody@linux.vnet.ibm.com>
> | >
> | > Enable event specification like:
> | >
> | > pmu/event_name,param1=0x1,param2=0x4/
> | >
> | > Assuming that
> | >
> | > /sys/bus/event_source/devices/pmu/events/event_name
> | >
> | > Contains something like
> | >
> | > param2=foo,bar=1,param1=baz
> |
> | hum, so what happened to the '?' ... AFAIU from out last discussion,
> | you wanted to mark terms which are mandatory and user must provide
> | values for them.. and I thought the decision was to have following
> | alias record:
> |
> | $ cat /sys/bus/event_source/devices/pmu/events/event_name
> | param2=?,bar=1,param1=?
> |
> | while perf would scream if any of param1/2 wasnt filled like for:
> | pmu/event_name,param1=0x1/
>
> Sorry, I meant to make perf list consistent with sysfs.
>
> Consider these two sysfs entries:
>
> $ cat HPM_0THRD_NON_IDLE_CCYC__PHYS_CORE
> domain=0x2,offset=0xe0,starting_index=core,lpar=0x0
>
> $ cat HPM_0THRD_NON_IDLE_CCYC__VCPU_HOME_CORE
> domain=0x3,offset=0xe0,starting_index=vcpu,lpar=sibling_guest_id
>
> In the first one, starting_index refers to a 'core' while in the second
> it refers to a vcpu. This serves as a "hint" for the parameter's meaning.
>
> By replacing both with 'starting_index=?' we lose that hint.
>
> Should we fix both sysfs and 'perf list' to say
>
> starting_index=?core
Peter, Ingo,
any opinions on this? Overall explanation is in here:
http://marc.info/?l=linux-kernel&m=141158688307356&w=2
thanks,
jirka
^ permalink raw reply
* Re: [PATCH 4/4] sounds/hda/radeon: Disable 64-bit DMA on radeon
From: Takashi Iwai @ 2014-10-01 8:30 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc-dev, Dave Airlie, linux-pci, Brian King, Anton Blanchard,
Bjorn Helgaas, Yijing Wang, Alex Deucher
In-Reply-To: <s5hr3ys43ev.wl-tiwai@suse.de>
At Wed, 01 Oct 2014 10:09:28 +0200,
Takashi Iwai wrote:
>
> At Wed, 01 Oct 2014 17:41:29 +1000,
> Benjamin Herrenschmidt wrote:
> >
> > On Wed, 2014-10-01 at 09:38 +0200, Takashi Iwai wrote:
> >
> > > > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> > > > index 3e6d22d..2b679d5 100644
> > > > --- a/sound/pci/hda/hda_intel.c
> > > > +++ b/sound/pci/hda/hda_intel.c
> > > > @@ -297,7 +297,7 @@ enum {
> > > > /* quirks for ATI/AMD HDMI */
> > > > #define AZX_DCAPS_PRESET_ATI_HDMI \
> > > > (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\
> > > > - AZX_DCAPS_NO_MSI64)
> > > > + AZX_DCAPS_NO_MSI64 | AZX_DCAPS_NO_64BIT)
> > >
> > > The only concern is that this will disable 64bit DMA also on x86 where
> > > it has been working fine. Can we add an ifdef CONFIG_PPC for this?
> >
> > I don't like that approach because technically the chip doesn't do
> > 64-bit DMA ... it does something like 40 or 48 (might actually depend on
> > the chip version) and for all I know it will break on future x86 with
> > more memory or other platforms with similar address encodings as
> > powerpc...
> >
> > The right thing might be to get the exact number of bits and do the
> > appropriate dma_set_mask() like the graphics driver does, but that's a
> > bit tricky unless we add a DMA mask field in that big array of chips in
> > there...
>
> I think setting the dma mask explicitly would be a better approach
> although it results in a bit bigger change. At least, it would impact
> less than forcing 32bit DMA, as most desktop machines have less than
> 40bit address. How about a patch like below?
Oops, it obviously doesn't work with AMD ID... Fixed in below.
Takashi
-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH v2] ALSA: hda - Limit 40bit DMA for AMD HDMI controllers
AMD/ATI HDMI controller chip models, we already have a filter to lower
to 32bit DMA, but the rest are supposed to be working with 64bit
although the hardware doesn't really work with 63bit but only with 40
or 48bit DMA. In this patch, we take 40bit DMA for safety for the
AMD/ATI controllers as the graphics drivers does.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/hda/hda_intel.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index aa302fb03fc5..99b367bd9b1b 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1482,6 +1482,7 @@ static int azx_first_init(struct azx *chip)
struct snd_card *card = chip->card;
int err;
unsigned short gcap;
+ unsigned int dma_bits = 64;
#if BITS_PER_LONG != 64
/* Fix up base address on ULI M5461 */
@@ -1518,9 +1519,14 @@ static int azx_first_init(struct azx *chip)
gcap = azx_readw(chip, GCAP);
dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap);
+ /* AMD devices support 40 or 48bit DMA, take the safe one */
+ if (chip->pci->vendor == PCI_VENDOR_ID_AMD)
+ dma_bits = 40;
+
/* disable SB600 64bit support for safety */
if (chip->pci->vendor == PCI_VENDOR_ID_ATI) {
struct pci_dev *p_smbus;
+ dma_bits = 40;
p_smbus = pci_get_device(PCI_VENDOR_ID_ATI,
PCI_DEVICE_ID_ATI_SBX00_SMBUS,
NULL);
@@ -1550,9 +1556,11 @@ static int azx_first_init(struct azx *chip)
}
/* allow 64bit DMA address if supported by H/W */
- if ((gcap & AZX_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
- pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64));
- else {
+ if (!(gcap & AZX_GCAP_64OK))
+ dma_bits = 32;
+ if (!pci_set_dma_mask(pci, DMA_BIT_MASK(dma_bits))) {
+ pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(dma_bits));
+ } else {
pci_set_dma_mask(pci, DMA_BIT_MASK(32));
pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32));
}
--
2.1.0
^ 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