From patchwork Wed Oct 7 03:48:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 527088 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 394CF140D95 for ; Wed, 7 Oct 2015 14:49:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753040AbbJGDtA (ORCPT ); Tue, 6 Oct 2015 23:49:00 -0400 Received: from mail-bn1bon0132.outbound.protection.outlook.com ([157.56.111.132]:52544 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752963AbbJGDs7 (ORCPT ); Tue, 6 Oct 2015 23:48:59 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=scottwood@freescale.com; Received: from snotra.am.freescale.net (192.88.168.49) by BY1PR03MB1483.namprd03.prod.outlook.com (10.162.210.141) with Microsoft SMTP Server (TLS) id 15.1.286.20; Wed, 7 Oct 2015 03:48:55 +0000 From: Scott Wood To: CC: Tiejun Chen , Michael Ellerman , , Scott Wood , Subject: [PATCH v2 15/18] powerpc/book3e-64/kexec: Enable SMP release Date: Tue, 6 Oct 2015 22:48:19 -0500 Message-ID: <1444189702-17241-16-git-send-email-scottwood@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1444189702-17241-1-git-send-email-scottwood@freescale.com> References: <1444189702-17241-1-git-send-email-scottwood@freescale.com> MIME-Version: 1.0 X-Originating-IP: [192.88.168.49] X-ClientProxiedBy: BLUPR08CA0034.namprd08.prod.outlook.com (10.141.200.14) To BY1PR03MB1483.namprd03.prod.outlook.com (25.162.210.141) X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1483; 2:p4VkUv3od4Edv8uvf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SskHsr/oEGzJMx2pFyeXZ988iT2jnQGE3yR0bjHioWBlZsomeQKctWVqT5tr+l1C4etoMb3wjGfp7YynTKePlWWUviHUu2CfLBTO98vq8mFWOPU+nfG2OXCO; 4:Fw/2dRPZvVfX85J1WYVE11wQ6Y5Jxi5add3uU9NNGU1lv47IZ+WRDAZXL/s5t2e+9doN9NKkNFGQzkWs1fL7VX+xHA7ItWvJfuJP2WcxidvkVDI/C6YHrDxzBARry24cLt9lNRp+TME+kpXhlcGQXdOPcR+rCTGtKOx3jr6I7NgPAeDA9NOnkj1UGvDQmyyGE4c8euj4Tnmj5d2xfHz0PmmTy+s8/Q0/MNo+2/ibBYerO7ZpPmIX7BZJGjjT++KJVWgKf4K9TLHQG8Mw8tpVwMponLVOBfC4XS+jiE+043kftgWuLNolsJHZuk6zQjseehSsiNslT4LCTlbc7ooMPU3sM1PdnF2yzpcGcRXOUuI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001); SRVR:BY1PR03MB1483; BCL:0; PCL:0; RULEID:; SRVR:BY1PR03MB1483; X-Forefront-PRVS: 0722981D2A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(122386002)(19580395003)(5007970100001)(5003940100001)(189998001)(19580405001)(105586002)(46102003)(106356001)(50466002)(77096005)(15975445007)(40100003)(2351001)(110136002)(50986999)(64706001)(42186005)(87976001)(86362001)(5004730100002)(47776003)(5001960100002)(76176999)(229853001)(101416001)(50226001)(92566002)(5008740100001)(2950100001)(66066001)(33646002)(36756003)(81156007)(5001920100001)(97736004)(48376002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR03MB1483; H:snotra.am.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: freescale.com does not designate permitted sender hosts) X-Microsoft-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9LuIqpXz7nymOJ2J5IzhWr99qd1ILkjpmbVqjTq?= =?us-ascii?Q?Z6y+n7CKBHNpsfTln5FLWVkrUSrrxC52IBBRRH0rbGPR0UBFqzy6XULJQDuJ?= =?us-ascii?Q?UAVZBRQyF7fEuipBnjtgXiC18gbO2ySwLHwaHM64b4EBQJ4KgA/V0buV4EOI?= =?us-ascii?Q?oJz9/mWAUUy+HflGS4y5oyCcTkRXMNrEAlOVcI4szCEWP1DxIUF8JrZ+gYal?= =?us-ascii?Q?kIgW+XZI9q6zjSrcbpQmlwytrDVXFCbpdMzGF9Vtf3YCNTNHg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1483; 5:2DiJGjGp0jemH+VKTagjBMuko+ddk4PdfbmnUHN0iO1aNRxawKEdK1U8DU7jBh9rs6nILqxzd00rLNeXj1p7Aby86dAaQaw9DoQWbjnEZEgwDLI19wH29W/SBvXRtiz+RurMckKRfK7wHqef08Prrg==; 24:d5sD4MADeUpVDG8IPMea0pc8S9tmeHRk+ZdwnxjkBPdp9XaMJ2bls3eGaUW5VYgE2aXRxYbxFDJA8uuqy83Ef/W0LBbA7GiwLm6r8MPFZt8=; 20:pIGaf+K0dgcVMyLuFq9Bmg69glJ3whXic5fX2/X8FD/UQ+wB6K8zPLURK0SatlmlVF0YLsM9VF3kf6EhuGW/NQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2015 03:48:55.0920 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1483 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The SMP release mechanism for FSL book3e is different from when booting with normal hardware. In theory we could simulate the normal spin table mechanism, but not at the addresses U-Boot put in the device tree -- so there'd need to be even more communication between the kernel and kexec to set that up. Instead, kexec-tools will set a boolean property linux,booted-from-kexec in the /chosen node. Signed-off-by: Scott Wood Cc: devicetree@vger.kernel.org --- v2: Use a device tree property instead of a flag in the kernel image This depends on the kexec-tools patch v2 "ppc64: Add a flag to tell the kernel it's booting from kexec": http://patchwork.ozlabs.org/patch/527050/ --- Documentation/devicetree/bindings/chosen.txt | 8 ++++++++ arch/powerpc/kernel/setup_64.c | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/chosen.txt b/Documentation/devicetree/bindings/chosen.txt index ed838f4..6ae9d82 100644 --- a/Documentation/devicetree/bindings/chosen.txt +++ b/Documentation/devicetree/bindings/chosen.txt @@ -44,3 +44,11 @@ Implementation note: Linux will look for the property "linux,stdout-path" or on PowerPC "stdout" if "stdout-path" is not found. However, the "linux,stdout-path" and "stdout" properties are deprecated. New platforms should only use the "stdout-path" property. + +linux,booted-from-kexec +----------------------- + +This property is set (currently only on PowerPC, and only needed on +book3e) by some versions of kexec-tools to tell the new kernel that it +is being booted by kexec, as the booting environment may differ (e.g. +a different secondary CPU release mechanism) diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 505ec2c..5c03a6a 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -340,11 +340,26 @@ void early_setup_secondary(void) #endif /* CONFIG_SMP */ #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) +static bool use_spinloop(void) +{ + if (!IS_ENABLED(CONFIG_PPC_BOOK3E)) + return true; + + /* + * When book3e boots from kexec, the ePAPR spin table does + * not get used. + */ + return of_property_read_bool(of_chosen, "linux,booted-from-kexec"); +} + void smp_release_cpus(void) { unsigned long *ptr; int i; + if (!use_spinloop()) + return; + DBG(" -> smp_release_cpus()\n"); /* All secondary cpus are spinning on a common spinloop, release them @@ -524,7 +539,7 @@ void __init setup_system(void) * Freescale Book3e parts spin in a loop provided by firmware, * so smp_release_cpus() does nothing for them */ -#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_FSL_BOOK3E) +#if defined(CONFIG_SMP) /* Release secondary cpus out of their spinloops at 0x60 now that * we can map physical -> logical CPU ids */