Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752743AbbHCLdH (ORCPT ); Mon, 3 Aug 2015 07:33:07 -0400 Received: from mail-bl2on0117.outbound.protection.outlook.com ([65.55.169.117]:61067 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751549AbbHCLdF (ORCPT ); Mon, 3 Aug 2015 07:33:05 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; feescale.com; dkim=none (message not signed) header.d=none; Date: Mon, 3 Aug 2015 19:32:58 +0800 From: Chenhui Zhao Subject: Re: [PATCH 1/3] Powerpc: mpc85xx: refactor the PM operations To: Scott Wood CC: , , , Tang Yuantian , Tang Yuantian Message-ID: <1438601578.7515.2@remotesmtp.freescale.net> In-Reply-To: <1438387178.19345.77.camel@freescale.com> References: <1438334444-31919-1-git-send-email-b29983@freescale.com> <1438387178.19345.77.camel@freescale.com> X-Mailer: geary/0.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD010;1:IAnrh5t6w/8wC42SGk54G25skh6XSMNpcBUWegZkIQUTwff0B/RdhQuIXbBebGMLVp0BfSTJ1GsZA7CuDqZ+cJYt80vQst6YIiJY06FeZ560PabxNFm12TjBXycwRcgoGnbgKyUsSjxoq/2wcbZNk/Lr/zN2KB0chK61Qo8vpb8ZDYDckWNEFthrGXNPpqNGF2HwFtpHgjQ4Vj2rd/PeahFDEDyEsIhJsUVWMHP5zctpdPLlAs+/ZfPCdFaroBsbj+kQNGQuzwFb626QX7airnfI39HdiyelLi3R6B24TIkiu1Au425MjHU/bo3EJsd3yIZ21ikiSkfp6MEKqCrcAA== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(189002)(24454002)(377424004)(377454003)(19580405001)(19580395003)(110136002)(77096005)(5001960100002)(50226001)(6806004)(46102003)(92566002)(86362001)(104016003)(88526003)(4001450100002)(189998001)(85426001)(76176999)(50466002)(62966003)(23676002)(50986999)(47776003)(2950100001)(87936001)(105606002)(77156002)(106466001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR03MB1488;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB1488;2:EWc8BWcoiNdT9PJMbM0HD2XZSOk+3bZO08LilVUVJfMMlpoNGqsShOXDJROXihmf2yMESUp++wvW4K33a8FbgSbyfomFbE+IO7jD6zuD9c6goJcNcnWPB9DsKMpTRt4bZ8wpwzYHLO9Z50jeqnL/WdDCfRnb69RoM/wuTv8fBFw=;3:/xWqujG69nIy2HF1QfoIjS+ZjHHhehq95osR+8s+cCI0pW+K7GOVuF32iKVbAcrsqFY5HeslcM5mbp0zT2GJczRD7kEqYlmaF18TmLZYNHeVBeeN93w+zb0dQSOyOTFAxzXSX42IUL6tWsrl57OMrBvf3Jc2Yw9VLceNdvvo4hEyfm5Ka/bqxSt21AhYtgp65jFEtQH3yp4tGL8ZN1q1aiLFVH/Q9CzfZ6ebXQIi4w0=;25:xumQQHtEczj5K8XV2Vbu5TZctNPgm9bqgTtHk0ACmyCDDHGCftZiPXh92V0LhU+x/cnhEpCD0dOj7l5Qk/ULTO2/I9Eolp3+/049pYW2k9y4NIsOltO8DES47IM12JmJgN4xO9aFKVoWw7Du0hO4Uq5BOi2LkXRNRI8RMooX3tjQFrePUOUGyXvkHIEdw/vx8Xb7cDx7NnfD9LxNntQFkM/L4raSuN+PMQ8nfRvqa3s9zwHwneS4GGiOM447u0jrRb3wjpyZo23YvZFLb9oiqw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1488; X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB1488;20:iWioNdoYtOzzJo2+xiYTMdM/t2tdXgtgf7aK5BvOZwAlGLeXn7OeKnkzO6LrvetR8XqW6mJ/Hxko1eMJWNOE0Bwom7iMwkjz1doH6uvsVY4XCQiMTWboqrwUztn0lJcxOooL6WO3NplU+bGH2d9zDk5dnARAazm+Z/mzI6kGgSwdW3jMS9DBbY4eu1Etn63VijXsgv/CnqMnxR9jvFx7wXQPJyaM7tJ3JLkgQd4ftN+k2wCyOCtuX+bkiFKpS01KiHWx1F9zWqdNqITKkClS9fSpw56rIQ4F9gUEJahEk6qWG7enFNxaoEGTY5uFokaiz3kgksFcxaPzlS6xRfjSAs+LEJWqBg0LAhBsluTva2c=;4:w9EF57PMCqDvacPbRahf+u4ZGFOAPo9m/5aROiVJ2ZQdOjfZ3hBOROQwE+tet5lB7tB8MQwx+eskqB/ZwXsyi+KGMYKTvpuJ23CyNc1T/fC/Xnh0e3mQmrx7LXiix9I0091j5yhon9fIFHLD+ooyBQdelM1JCj2IMXAQWah3YZDLTLckg+z46E51ypXWw5Q09HpDIG/9/1KcubEu1HJgd4btLYWx+uKbtvO3hVty8hJLlWPJQt5PiNjiMhvgr6SEfT3hyA/2jPRoxXuS+ykYP/MSTbwNkK2yXNV7EgtGOlo= CY1PR03MB1488: 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:CY1PR03MB1488;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1488; X-Forefront-PRVS: 0657D528EC X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB1488;23:2r6H8mye4qTtlLzsU28R6HgFV46/kY3A1hF8/JZELH4nojy4vbFzr4ShHevtwptJfIksv3FW/g1m83Fx8M+71VMGiNSqoy/sTzWiJ6dzUVRccHRONBvqaBFuKM1jyCwL4oJqLLHENcupvXAC488QPGKQym8A7P1ARL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k3Yq9fMeE=;20:JiojzIPNoGjpgGN6mmWJ3Z90xlCkk2Jbkcc/XJ44SX32BoJZylZw1yq5QG7Lrh+LV0yR3Bo8qTBWt0cadVZxSQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2015 11:33:01.3504 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1488 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3919 Lines: 137 On Sat, Aug 1, 2015 at 7:59 AM, Scott Wood wrote: > 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. OK. > > >> #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. Sorry, it's a typo. It shoule be "e500_cpu_die". > >> { >> - 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? Added "#ifndef CONFIG_PPC_E500MC" in the following patch. > > Could you explain irq_mask()? Why would there still be IRQs destined > for > this CPU at this point? This function just masks irq by setting the registers in RCPM (for example, RCPM_CPMIMR, RCPM_CPMCIMR). Actually, all irqs to this CPU have been migrated to other CPUs. > > @@ -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 This patch is just for e500v2. The following patches will handle the case of e500mc, e5500 and e6500. -Chenhui -- 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/