From patchwork Thu Apr 17 19:15:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 4010441 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9191C9F2BA for ; Thu, 17 Apr 2014 19:20:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B345120259 for ; Thu, 17 Apr 2014 19:20:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 C9005201F9 for ; Thu, 17 Apr 2014 19:20:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Warne-0006Li-HI; Thu, 17 Apr 2014 19:16:42 +0000 Received: from mail-pb0-f52.google.com ([209.85.160.52]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WarnW-0006Im-Cf for linux-arm-kernel@lists.infradead.org; Thu, 17 Apr 2014 19:16:34 +0000 Received: by mail-pb0-f52.google.com with SMTP id rr13so694198pbb.11 for ; Thu, 17 Apr 2014 12:16:13 -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=3etkSepf83n/fmyrH/221I0DBNL0hOSW8iRooL2rmxo=; b=I6MOodEs5dTiKnfLLvp+UY33ufiRKCEELXsK7sFS2wvDAjsX8nUDcyuDacSYh0RvRn GsC+zTBEg2GmUWjJSv6kRqpfwnx8Mi22i9OwCn4/pJal01frwePuMf2g3W3HOZD6hD/d 7zFVP8Tp505ET9rxGVpBsUYhjT25K9aEgOLptqrXuJF+OYi6WOROqycDxbGVXnK74THp GN80aaruRN7CI4Ug0etMDGjIaOsj0lHtLRuoyITAj2zC20j3noQi5zNtn3RVVXrtgsoY 9kLKjCmcyEIHYTqwiJhppVie1PsqrUfA5XxR0lDFreug7ac50QkqVtr/wNj6ozH35bEI z2nw== X-Gm-Message-State: ALoCoQkze+RkH6UkKnT19yojJBxLeqC64wSkpnygfYg/vWzq0wMSWtDtIX0JI1gIueVV4U86wszN X-Received: by 10.66.141.165 with SMTP id rp5mr17673169pab.90.1397762173299; Thu, 17 Apr 2014 12:16:13 -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 et3sm55157855pbc.52.2014.04.17.12.16.11 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 12:16:12 -0700 (PDT) From: Ashwin Chaugule To: mark.rutland@arm.com Subject: [PATCH v6 3/3] ARM: Check if a CPU has gone offline Date: Thu, 17 Apr 2014 15:15:46 -0400 Message-Id: <1397762146-8337-4-git-send-email-ashwin.chaugule@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1397762146-8337-1-git-send-email-ashwin.chaugule@linaro.org> References: <1397762146-8337-1-git-send-email-ashwin.chaugule@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140417_121634_446474_7B70CE4F X-CRM114-Status: GOOD ( 12.99 ) X-Spam-Score: -0.7 (/) Cc: rob.herring@linaro.org, anup.patel@linaro.org, linaro-acpi@lists.linaro.org, Marc.Zyngier@arm.com, patches@linaro.org, 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=-2.6 required=5.0 tests=BAYES_00,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 a4136c3..857209b 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -74,4 +74,9 @@ #define PSCI_RET_NOT_PRESENT -7 #define PSCI_RET_DISABLED -8 +/* 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 */