From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kukjin Kim Subject: RE: [PATCH 2/2] ARM: S5PV310: Update CPU hotplug implementation Date: Wed, 29 Sep 2010 20:58:23 +0900 Message-ID: <001901cb5fcd$a0a5b5a0$e1f120e0$%kim@samsung.com> References: <1284700388-9394-1-git-send-email-kgene.kim@samsung.com> <1284700388-9394-3-git-send-email-kgene.kim@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT Return-path: Received: from mailout1.samsung.com ([203.254.224.24]:42233 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752190Ab0I2L6J (ORCPT ); Wed, 29 Sep 2010 07:58:09 -0400 Received: from epmmp1 (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Sun Java(tm) System Messaging Server 7u3-15.01 64bit (built Feb 12 2010)) with ESMTP id <0L9I00L0CBWVHH40@mailout1.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 29 Sep 2010 20:58:07 +0900 (KST) Received: from kgenekim ([12.23.103.96]) by mmp1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0L9I00B4JBWV0A@mmp1.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 29 Sep 2010 20:58:07 +0900 (KST) In-reply-to: <1284700388-9394-3-git-send-email-kgene.kim@samsung.com> Content-language: ko Sender: linux-samsung-soc-owner@vger.kernel.org List-Id: linux-samsung-soc@vger.kernel.org To: 'Kukjin Kim' , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: ben-linux@fluff.org, 'Changhwan Youn' , 'Russell King' , 'Tony Lindgren' , 'Colin Cross' , 'Erik Gilling' , 'Olof Johansson' Kukjin Kim wrote: > > From: Changhwan Youn > > This patch updates CPU hotplug implementation to reduce CPU power > consumption > and will turn off the CPU power when CPU1 is unplugged while previous CPU > hotplug > used CPU idle. > This patch removes init memory freeing code to use CPU boot code when CPU1 is > plugged-in again and adds vfp_enable() call to allow to access CP10 and CP11. > > Signed-off-by: Changhwan Youn > Signed-off-by: Kukjin Kim > Cc: Russell King Cc: Tony Lindgren Cc: Colin Cross Cc: Erik Gilling Cc: Olof Johansson Hi all, Please check changing of arch/arm/mm/init.c and arch/arm/vfp/vfpmodule.c. - Removed init memory freeing code to use CPU boot code when CPU1 is plugged-in again. - Added vfp_enable() call to allow to access CP10 and CP11. > --- > arch/arm/mach-s5pv310/hotplug.c | 12 +++++++----- > arch/arm/mach-s5pv310/platsmp.c | 34 > ++++++++++++++++++++++++++++++++++ > arch/arm/mm/init.c | 2 ++ > arch/arm/vfp/vfpmodule.c | 2 +- > 4 files changed, 44 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/mach-s5pv310/hotplug.c b/arch/arm/mach-s5pv310/hotplug.c > index 03652c3..0e188fe 100644 > --- a/arch/arm/mach-s5pv310/hotplug.c > +++ b/arch/arm/mach-s5pv310/hotplug.c > @@ -14,9 +14,12 @@ > #include > #include > #include > +#include > > #include > > +#include > + > extern volatile int pen_release; > > static DECLARE_COMPLETION(cpu_killed); > @@ -61,12 +64,11 @@ static inline void cpu_leave_lowpower(void) > > static inline void platform_do_lowpower(unsigned int cpu) > { > - /* > - * there is no power-control hardware on this platform, so all > - * we can do is put the core into WFI; this is safe as the calling > - * code will have already disabled interrupts > - */ > for (;;) { > + /* make cpu1 to be turned off at next WFI command */ > + if (cpu == 1) > + __raw_writel(0, S5PV310_ARM_CORE1_CONF); > + > /* > * here's the WFI > */ > diff --git a/arch/arm/mach-s5pv310/platsmp.c b/arch/arm/mach-s5pv310/platsmp.c > index d357c19..d10c4ad 100644 > --- a/arch/arm/mach-s5pv310/platsmp.c > +++ b/arch/arm/mach-s5pv310/platsmp.c > @@ -28,8 +28,10 @@ > > #include > #include > +#include > > extern void s5pv310_secondary_startup(void); > +extern void vfp_enable(void *unused); > > /* > * control for which core is the next to come out of the secondary > @@ -47,6 +49,10 @@ static DEFINE_SPINLOCK(boot_lock); > > void __cpuinit platform_secondary_init(unsigned int cpu) > { > +#ifdef CONFIG_VFP > + vfp_enable(NULL); > +#endif > + > trace_hardirqs_off(); > > /* > @@ -92,6 +98,27 @@ int __cpuinit boot_secondary(unsigned int cpu, struct > task_struct *idle) > __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); > outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); > > + if (!(__raw_readl(S5PV310_ARM_CORE1_STAT) & > S5PV310_CORE_PWR_EN)) { > + __raw_writel(S5PV310_CORE_PWR_EN, > + S5PV310_ARM_CORE1_CONF); > + > + timeout = 10; > + > + /* wait max 10 ms until cpu1 is on */ > + while ((__raw_readl(S5PV310_ARM_CORE1_STAT) > + & S5PV310_CORE_PWR_EN) != > S5PV310_CORE_PWR_EN) { > + if (timeout-- == 0) > + break; > + > + mdelay(1); > + } > + > + if (timeout == 0) { > + printk(KERN_ERR "cpu1 power-up failed"); > + return -ETIMEDOUT; > + } > + } > + > /* > * Send the secondary CPU a soft interrupt, thereby causing > * the boot monitor to read the system wide flags register, > @@ -102,6 +129,13 @@ int __cpuinit boot_secondary(unsigned int cpu, struct > task_struct *idle) > timeout = jiffies + (1 * HZ); > while (time_before(jiffies, timeout)) { > smp_rmb(); > + > + if (!__raw_readl(S5P_VA_SYSRAM)) { > + > __raw_writel(BSYM(virt_to_phys(s5pv310_secondary_startup)), > + S5P_VA_SYSRAM); > + smp_cross_call(cpumask_of(cpu)); > + } > + > if (pen_release == -1) > break; > > diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c > index 7185b00..57c4c5c 100644 > --- a/arch/arm/mm/init.c > +++ b/arch/arm/mm/init.c > @@ -589,10 +589,12 @@ void free_initmem(void) > "TCM link"); > #endif > > +#ifndef CONFIG_HOTPLUG_CPU > if (!machine_is_integrator() && !machine_is_cintegrator()) > totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), > __phys_to_pfn(__pa(__init_end)), > "init"); > +#endif > } > > #ifdef CONFIG_BLK_DEV_INITRD > diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c > index 8063a32..eee8f67 100644 > --- a/arch/arm/vfp/vfpmodule.c > +++ b/arch/arm/vfp/vfpmodule.c > @@ -364,7 +364,7 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs > *regs) > preempt_enable(); > } > > -static void vfp_enable(void *unused) > +void vfp_enable(void *unused) > { > u32 access = get_copro_access(); > > -- Thanks. Best regards, Kgene. -- Kukjin Kim , Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.