From patchwork Mon Mar 31 19:40:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 3917601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1FD9EBF540 for ; Mon, 31 Mar 2014 19:41:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4430A203AB for ; Mon, 31 Mar 2014 19:41:05 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C95720386 for ; Mon, 31 Mar 2014 19:41:04 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WUi4n-0007XD-6K; Mon, 31 Mar 2014 19:40:57 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WUi4k-0005Ml-OG; Mon, 31 Mar 2014 19:40:54 +0000 Received: from mail-pa0-f46.google.com ([209.85.220.46]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WUi4h-0005MP-2I for linux-arm-kernel@lists.infradead.org; Mon, 31 Mar 2014 19:40:51 +0000 Received: by mail-pa0-f46.google.com with SMTP id kx10so3195692pab.33 for ; Mon, 31 Mar 2014 12:40:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VCQQFHwHm145EGFnVfyzAfl9pHeO0DI+TTFJ4JFC038=; b=XBDUS2PLYuOIKNiAPD3kO5euem1RAvgKj0wIE31jy2h0hZ4g/HhfLYifL+y7xdDhWs PCF6dMjZJ8H2haFZdYu2wwsgygtvtbdqoBRrFWlrY0S+L4YHd1g7hvMbTQObGZoJM/e2 r0iFPlN1iEROKpr45SO8Yfmg3FEJbR5b3MAPsFyopc5RKHAiD6gX9I5cWLT6IPvlckQi hwzw6HU8lB/mDabna9OPvBH6qkAINPIBKKHBjYZzHx4HYhvKIMRY9NWhQMZoaee47bLq LDiANNmJl1t6NCQ08rb+fNcfUjX0xzFtMNG4uP/ze9gTO9QLlhMiXb4U4z1GQk4XOEG4 dq4g== X-Gm-Message-State: ALoCoQnr50BqbltA7tnJiyo13c8YnwKwrfFeDqrHN6SSqVD0BoQgewreygj11gF0Exxsk8AC20PC X-Received: by 10.68.233.200 with SMTP id ty8mr26729215pbc.1.1396294829119; Mon, 31 Mar 2014 12:40:29 -0700 (PDT) Received: from linaro5.qualcomm.com (rrcs-67-52-130-30.west.biz.rr.com. [67.52.130.30]) by mx.google.com with ESMTPSA id np9sm45069800pbc.31.2014.03.31.12.40.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 12:40:28 -0700 (PDT) From: Ashwin Chaugule To: linaro-acpi@lists.linaro.org Subject: [PATCH v5 3/3] ARM: Check if a CPU has gone offline Date: Mon, 31 Mar 2014 15:40:15 -0400 Message-Id: <1396294815-12019-4-git-send-email-ashwin.chaugule@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1396294815-12019-1-git-send-email-ashwin.chaugule@linaro.org> References: <1396294815-12019-1-git-send-email-ashwin.chaugule@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140331_154051_195846_CCA6BBE5 X-CRM114-Status: GOOD ( 13.87 ) X-Spam-Score: -2.6 (--) Cc: mark.rutland@arm.com, rob.herring@linaro.org, anup.patel@linaro.org, patches@linaro.org, marc.zyngier@arm.com, Ashwin Chaugule , linux-arm-kernel@lists.infradead.org, christoffer.dall@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PSCIv0.2 adds a new function called AFFINITY_INFO, which can be used to query if a specified CPU has actually gone offline. Calling this function via cpu_kill ensures that a CPU has quiesced after a call to cpu_die. Signed-off-by: Ashwin Chaugule Reviewed-by: Rob Herring --- arch/arm/kernel/psci_smp.c | 21 +++++++++++++++++++++ include/uapi/linux/psci.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/arch/arm/kernel/psci_smp.c b/arch/arm/kernel/psci_smp.c index 570a48c..c6f1420 100644 --- a/arch/arm/kernel/psci_smp.c +++ b/arch/arm/kernel/psci_smp.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -66,6 +67,25 @@ void __ref psci_cpu_die(unsigned int cpu) /* We should never return */ panic("psci: cpu %d failed to shutdown\n", cpu); } + +int __ref psci_cpu_kill(unsigned int cpu) +{ + int err; + + if (!psci_ops.affinity_info) + return 1; + + err = psci_ops.affinity_info(cpu_logical_map(cpu), 0); + + if (err != PSCI_AFFINITY_INFO_RET_OFF) { + pr_err("psci: Cannot kill CPU:%d, psci ret val: %d\n", + cpu, err); + /* Make platform_cpu_kill() fail. */ + return 0; + } + return 1; +} + #endif bool __init psci_smp_available(void) @@ -78,5 +98,6 @@ struct smp_operations __initdata psci_smp_ops = { .smp_boot_secondary = psci_boot_secondary, #ifdef CONFIG_HOTPLUG_CPU .cpu_die = psci_cpu_die, + .cpu_kill = psci_cpu_kill, #endif }; diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index 0354bb1..65b4878 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -58,4 +58,9 @@ ((ver & PSCI_VER_MAJOR_MASK) >> PSCI_VER_MAJOR_SHIFT) #define PSCI_VER_MINOR(ver) (ver & PSCI_VER_MINOR_MASK) +/* Return values from the PSCI_ID_AFFINITY_INFO Function. */ +#define PSCI_AFFINITY_INFO_RET_ON 0 +#define PSCI_AFFINITY_INFO_RET_OFF 1 +#define PSCI_AFFINITY_INFO_RET_ON_PENDING 2 + #endif /* _UAPI_LINUX_PSCI_H */