From patchwork Mon Mar 31 15:02:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 3915371 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 58EBE9F2B6 for ; Mon, 31 Mar 2014 15:05:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8EDDD20364 for ; Mon, 31 Mar 2014 15:05:28 +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 813EF20259 for ; Mon, 31 Mar 2014 15:05:27 +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 1WUdlW-0002HV-Bj; Mon, 31 Mar 2014 15:04:46 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WUdlL-0003iO-PZ; Mon, 31 Mar 2014 15:04:35 +0000 Received: from mail-qg0-f51.google.com ([209.85.192.51]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WUdkz-0003fr-Qo for linux-arm-kernel@lists.infradead.org; Mon, 31 Mar 2014 15:04:15 +0000 Received: by mail-qg0-f51.google.com with SMTP id q108so3963394qgd.38 for ; Mon, 31 Mar 2014 08:03:52 -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=Af7YStCvGcl84K/+ceCF/RsUhwbwvmEXvyNXlrocilw7HXX02ApQL3kOBjPcDfYMwS 2FF/NlDbK1Ng5mfUrGaLvNfvoV/kjfg5LYLurKBOPTZl2Qm+vX4w3Gj+Mle6RmGH/Mkm tMEdqkH+OGifjSWhc7LLa5WMF0SaqLICNPOh6wDMLIX/wbWho8QHpf2uG8424+Ltx+j5 OiseV/IituKVsLV+trNaLQjjOW7ou64VVQpdhY3KXO38wbYdTBRFbS4yVPKISsAdYKf7 araJlHnIfun9GeTwXfC3qLQVUXlQsn1CDYKnwvcXyPa+leaqCCc2ZcPlOVxqYncNxH/Z 8vVA== X-Gm-Message-State: ALoCoQlkYWAna0mAWu9TESiF4TJEHRNkV9HOh3s/wJcRke0MIEliXG3jUjdSbl3S1DGqa9sHwPji X-Received: by 10.140.18.174 with SMTP id 43mr2567974qgf.105.1396278232830; Mon, 31 Mar 2014 08:03:52 -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 p2sm28847450qah.38.2014.03.31.08.03.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 08:03:52 -0700 (PDT) From: Ashwin Chaugule To: linaro-acpi@lists.linaro.org Subject: [PATCH v4 3/3] ARM: Check if a CPU has gone offline Date: Mon, 31 Mar 2014 11:02:59 -0400 Message-Id: <1396278179-28181-4-git-send-email-ashwin.chaugule@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1396278179-28181-1-git-send-email-ashwin.chaugule@linaro.org> References: <1396278179-28181-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_110413_962064_4B6C8EE3 X-CRM114-Status: GOOD ( 13.76 ) X-Spam-Score: -1.9 (-) 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 */