From patchwork Thu Mar 27 15:38:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 3898371 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 209A79F2E8 for ; Thu, 27 Mar 2014 15:40:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 542B020240 for ; Thu, 27 Mar 2014 15:40:22 +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 66A7820237 for ; Thu, 27 Mar 2014 15:40:21 +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 1WTCPA-0005QF-Dy; Thu, 27 Mar 2014 15:39:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WTCP0-0001NF-Rt; Thu, 27 Mar 2014 15:39:34 +0000 Received: from mail-qa0-f48.google.com ([209.85.216.48]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WTCOj-0001Km-Be for linux-arm-kernel@lists.infradead.org; Thu, 27 Mar 2014 15:39:19 +0000 Received: by mail-qa0-f48.google.com with SMTP id m5so3929354qaj.7 for ; Thu, 27 Mar 2014 08:38:56 -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=zaxopfDg1r2V4WWj8BNHIRP+EuKrm9YoIIQ3ooKr7dg=; b=K8CCYo8yJJwRP9dNk5m5N530Hd4HEN3m/Bw4AqQWr3RSlEFGhQMmfv3KuJ69RGRLOC TFClzInt7E8zDpsXZhx9kFIQwljY9GSO0c8pxvW0iYsjjgYnfIrMG042NR93ZH0pztPi 6c6JbZ5MRqPE9reuntr5J/Jl81FHgVxtELOJIGpwQo2v/q1BxiPt9+md1gQC64vCi9Sx 6eJoGisrI5UQFfCrAWMPTnwUT1F/po5tJmn34MvJXyIhqg43jLLRiKn3tfi0MbdqmzFE MKSpJ+Wcg5Ngoop8zxsyEtbBb5lg4oW6n95Zr12uk0PqsldElecYSrf0eT9zJR9pPG4f ARlA== X-Gm-Message-State: ALoCoQmOJsVNPLJpT8aFKL1rR0EVmyoaqMuaDdLeSDv1r5Okt/Dx+kL+WH0veBDfeBFh9A13zS5J X-Received: by 10.224.80.201 with SMTP id u9mr2912235qak.5.1395934735293; Thu, 27 Mar 2014 08:38:55 -0700 (PDT) Received: from localhost.localdomain (cpe-098-027-049-158.nc.res.rr.com. [98.27.49.158]) by mx.google.com with ESMTPSA id g7sm1499522qaf.14.2014.03.27.08.38.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Mar 2014 08:38:54 -0700 (PDT) From: Ashwin Chaugule To: mark.rutland@arm.com Subject: [PATCH v2 3/3] ARM: Check if a CPU has gone offline Date: Thu, 27 Mar 2014 11:38:35 -0400 Message-Id: <1395934715-31348-3-git-send-email-ashwin.chaugule@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395934715-31348-1-git-send-email-ashwin.chaugule@linaro.org> References: <1395934715-31348-1-git-send-email-ashwin.chaugule@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140327_113917_501526_80DDDAF1 X-CRM114-Status: GOOD ( 13.34 ) X-Spam-Score: -2.6 (--) 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=-4.6 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 --- arch/arm/kernel/psci_smp.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/kernel/psci_smp.c b/arch/arm/kernel/psci_smp.c index 570a48c..2407843 100644 --- a/arch/arm/kernel/psci_smp.c +++ b/arch/arm/kernel/psci_smp.c @@ -66,6 +66,24 @@ 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 = 0; + + if (psci_ops.affinity_info) { + err = psci_ops.affinity_info(cpu, 0); + + if (err != 1) { + pr_err("psci: Cannot kill CPU:%d, psci ret val: %d\n", + cpu, err); + /* Make platform_cpu_kill() fail. */ + return 0; + } + } + return err; +} + #endif bool __init psci_smp_available(void) @@ -78,5 +96,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 };