Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753878AbbGaX7v (ORCPT ); Fri, 31 Jul 2015 19:59:51 -0400 Received: from mail-by2on0138.outbound.protection.outlook.com ([207.46.100.138]:25776 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752275AbbGaX7t (ORCPT ); Fri, 31 Jul 2015 19:59:49 -0400 Authentication-Results: freescale.com; dkim=none (message not signed) header.d=none; Message-ID: <1438387178.19345.77.camel@freescale.com> Subject: Re: [PATCH 1/3] Powerpc: mpc85xx: refactor the PM operations From: Scott Wood To: CC: , , Tang Yuantian , Chenhui Zhao , Tang Yuantian Date: Fri, 31 Jul 2015 18:59:38 -0500 In-Reply-To: <1438334444-31919-1-git-send-email-b29983@freescale.com> References: <1438334444-31919-1-git-send-email-b29983@freescale.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.0-fta1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [2601:448:8100:f9f:12bf:48ff:fe84:c9a0] X-ClientProxiedBy: BY2PR21CA0031.namprd21.prod.outlook.com (25.162.74.169) To BY1PR03MB1481.namprd03.prod.outlook.com (25.162.210.14) X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1481;2:Yhs/cR/RgR79+FD9h/bjPX5ghyu0D8JLO0yyKm0KZta27QvoLjwOVZ3qOnCkYOz6Y9nEo+yoOJFsVhoG1mugcq1eFmW8O5Z1wpLBIzQ08CJn07wYBOyZ/lSe2LSDPVSX8F5gysce5DjD6DkaeSkH07vw28/e0SLJ2BY7AlPfQXs=;3:JiQVluMppXZima6nuMgx6yplTxva42dCq7lLynQS45hHoJRmsy4cyCB9NJUzfKiMlZm6f7rlbdMJDm787ZzQI/b54smQ4pRm0UBdu5zHfg1fa4h7gQwLPvVh7byFLtENOcKucLqv1r4jCrntr1qY5g==;25:ZuHFHrz51Fn8kr7qUDFgD+QoFO8bp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Wc1noXihW8RCUK28YCv8vxx3yQxeq6wLDCmC6ZQLZlgPjMtvAWsTv0aJs/Xgu8ryfPiFGmfJPgqhsEFUsU/K36A= BY1PR03MB1481: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BY1PR03MB1481;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1481; X-Forefront-PRVS: 0654257CF5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(24454002)(377424004)(23676002)(40100003)(2950100001)(36756003)(5820100001)(2351001)(2371004)(42186005)(33646002)(103116003)(77096005)(19580405001)(62966003)(47776003)(4001450100002)(122386002)(50226001)(46102003)(86362001)(5001960100002)(50466002)(76176999)(77156002)(110136002)(5001920100001)(19580395003)(92566002)(189998001)(50986999)(3826002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR03MB1481;H:[IPv6:2601:448:8100:f9f:12bf:48ff:fe84:c9a0];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1481;23:omcThSv9S7jF+efUqcJsv4Rl6mT7m+siCt9zBrF9SJRAuMcmSOdKCnj1lwN2d68Y3GJFoyGQiELVpHGtDGkVB7laU6fgjsoN4qlAxAdR4e1vrkuYZLkb3L52GfmXFhLrTHD0Aug3jq2zW2PxVlIatERlkyF0NsH5lx6fIVj8naxcnm02Vl+G3BojqUfTogfpRmKgf/mUCeToE/5Jp/H6atkW0abOt5dC3gsgAyt3ubtNWeF/kchx++qr5AITdHTy5hj0JzrqhEX35EdnPagRMoEjiBdAAg1Gl7woTHOYOLN/YZDDPxvjQOMZb+G4ELWyYVvg0m3010C4fCkUYZegzCxtGjGpItQRxaw53dNAt2GyXbeclBbHhKkecqzQkNq8a52TtZViKuIZnxjuhg5SJ3gGjT8uMBxF28JCKHxTP2CFbVoYFm65rL+qVH2fzggJxb78YL09rU36wOxvOozgt2S9ttFuRM1dZOJM3C0r9ylf0OQdyDofDvLeP2DfT2U6OGVeNPYi+hGC0PIgG6KhgnN6RB7gp3btwt5Q7dE3Yzue+LCneklwT7mkgXs2GTOgyuIuRuSMx84rxVfKEzmeIPwp/ywYvTd96OoYKe7+Acma3cMoyYEqQexqbSBow53uSgSUhRPuT79kx8ZYX6aLNg8pwUI/iiS7XcSf2qgbX+LOKDaMx4f5GAeX6Lm3ohk7Wvc3Kzpwb3jI+kevbrjdaoSKgOKUfRaS3uUsB5hm9U5oabXk6Jn+D1A99CW4VGEHTiDblZzgzAiUVxjTUi6YbxYhilpR1NUNaB8+8ilNUsTKBtjgRC8wCWRqySnDjpLKuHZD5mU4So/QlfIjUpr1/sgxIX8smp8GXf249436jFnQ8tmaIOGCySlzTWdYyOerrP961lWXrI4M+7a6Hjr+XQ== X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1481;5:qj4J7pVFjZBoA/mXdR0+YP/LnwSQu8uIXNz5UaKhczhdPugSQ8OQMrg4z9xRK6NQyDhEmMc5x5uIXOmXR5as0s3fdckmrr0f/x+rb85n+HZ/PKdGDh77xNkl0+8MemMr0HI3q3Tp+dpITDbWW127TA==;24:fZtnXXHHL2UbdMK8o59hNxhOoBhubGyQFy1GVv2TpgaMJcXFN9u+0jid+ymf4f0sdyX7cocWll2CvxbuWgZXzXe7MSr3Wze+lsNMDsaDhmA=;20:TpCuqycpX7Yyn6LaahtbpROKSIygQ3APhUhSJcC3ukG3vWXRZIZhZ/0RYpZTqb7wgubZxTjD5mNaqy5KRQT1OQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2015 23:59:47.0908 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1481 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3228 Lines: 108 On Fri, 2015-07-31 at 17:20 +0800, b29983@freescale.com wrote: > @@ -71,7 +56,7 @@ static void mpc85xx_give_timebase(void) > barrier(); > tb_req = 0; > > - mpc85xx_timebase_freeze(1); > + qoriq_pm_ops->freeze_time_base(1); freeze_time_base() takes a bool. Use true/false. > #ifdef CONFIG_PPC64 > /* > * e5500/e6500 have a workaround for erratum A-006958 in place > @@ -104,7 +89,7 @@ static void mpc85xx_give_timebase(void) > while (tb_valid) > barrier(); > > - mpc85xx_timebase_freeze(0); > + qoriq_pm_ops->freeze_time_base(0); > > local_irq_restore(flags); > } > @@ -127,20 +112,10 @@ static void mpc85xx_take_timebase(void) > } > > #ifdef CONFIG_HOTPLUG_CPU > -static void smp_85xx_mach_cpu_die(void) > +static void e500_cpu_idle(void) This is not the function that gets called during normal cpu idle, and it shouldn't be named to look like it is. > { > - unsigned int cpu = smp_processor_id(); > u32 tmp; > > - local_irq_disable(); > - idle_task_exit(); > - generic_set_cpu_dead(cpu); > - mb(); > - > - mtspr(SPRN_TCR, 0); > - > - cur_cpu_spec->cpu_down_flush(); > - > tmp = (mfspr(SPRN_HID0) & ~(HID0_DOZE|HID0_SLEEP)) | HID0_NAP; > mtspr(SPRN_HID0, tmp); > isync(); > @@ -151,6 +126,25 @@ static void smp_85xx_mach_cpu_die(void) > mb(); > mtmsr(tmp); > isync(); > +} > + > +static void qoriq_cpu_dying(void) > +{ > + unsigned int cpu = smp_processor_id(); > + > + hard_irq_disable(); > + /* mask all irqs to prevent cpu wakeup */ > + qoriq_pm_ops->irq_mask(cpu); > + idle_task_exit(); > + > + mtspr(SPRN_TCR, 0); > + mtspr(SPRN_TSR, mfspr(SPRN_TSR)); > + > + cur_cpu_spec->cpu_down_flush(); > + > + generic_set_cpu_dead(cpu); > + > + e500_cpu_idle(); Why is something that claims to be applicable to all qoriq directly calling an e500v2-specific function? Could you explain irq_mask()? Why would there still be IRQs destined for this CPU at this point? @@ -431,21 +415,9 @@ void __init mpc85xx_smp_init(void) > smp_85xx_ops.probe = NULL; > } > > - np = of_find_matching_node(NULL, mpc85xx_smp_guts_ids); > - if (np) { > - guts = of_iomap(np, 0); > - of_node_put(np); > - if (!guts) { > - pr_err("%s: Could not map guts node address\n", > - __func__); > - return; > - } > - smp_85xx_ops.give_timebase = mpc85xx_give_timebase; > - smp_85xx_ops.take_timebase = mpc85xx_take_timebase; > #ifdef CONFIG_HOTPLUG_CPU > - ppc_md.cpu_die = smp_85xx_mach_cpu_die; > + ppc_md.cpu_die = qoriq_cpu_dying; > #endif Shouldn't you make sure there's a valid qoriq_pm_ops before setting cpu_die()? Or make sure that qoriq_cpu_dying() works regardless. -Scott -- 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/