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: 28592 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ED2242188F for ; Thu, 17 Apr 2014 19:16:14 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id b6sf2995003yha.8 for ; Thu, 17 Apr 2014 12:16:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=3etkSepf83n/fmyrH/221I0DBNL0hOSW8iRooL2rmxo=; b=GKAbCye8q2/s0X+vjdk9JcBYyoR+cBMRBPw49DrtAgmZt5a7jacrhaXXL1TcOuk63O ueoVUcnKoaad4VihN9rNMN3Cl8A5zJce0VrTPlbEU1EEIGJYqjzVse6Q/2gk4zM9MVGs K7qLSqY9NlJWCLrXgBsQtb9BvJ74zmkz+OVEkV/NOWEwPZZpjX54iRJOeLEmT/PhYe91 jijDdNgyLHaofvu22Li2ZFehvzm41Q9EJZCQjfQuZWpvaX4e9zTQGrM2iptMnjxEu/aH 65zi4xv1Ab6N/YL95HUtFJKUSwb+Zl+14Kok7A5JgCQrIrQBbxx0jcXcHxFY7IL2GErA pMnA== X-Gm-Message-State: ALoCoQnu8GhwIz6HUSlC00AInVF1xNMoXFwxXcgDEJ1Q0yjgk6tj1NjrKe4FqPLmAVRirSJGy+eG X-Received: by 10.236.21.180 with SMTP id r40mr6688715yhr.48.1397762174737; Thu, 17 Apr 2014 12:16:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.241 with SMTP id n104ls1235622qgd.36.gmail; Thu, 17 Apr 2014 12:16:14 -0700 (PDT) X-Received: by 10.221.58.144 with SMTP id wk16mr9038083vcb.23.1397762174655; Thu, 17 Apr 2014 12:16:14 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id dl6si4608882veb.19.2014.04.17.12.16.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 12:16:14 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id db12so1025469veb.38 for ; Thu, 17 Apr 2014 12:16:14 -0700 (PDT) X-Received: by 10.58.181.170 with SMTP id dx10mr8932923vec.25.1397762174577; Thu, 17 Apr 2014 12:16:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp59336vcb; Thu, 17 Apr 2014 12:16:14 -0700 (PDT) X-Received: by 10.68.196.226 with SMTP id ip2mr17402119pbc.106.1397762173766; Thu, 17 Apr 2014 12:16:13 -0700 (PDT) Received: from mail-pb0-f41.google.com (mail-pb0-f41.google.com [209.85.160.41]) by mx.google.com with ESMTPS id px1si3252250pbb.456.2014.04.17.12.16.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 12:16:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.41 is neither permitted nor denied by best guess record for domain of ashwin.chaugule@linaro.org) client-ip=209.85.160.41; Received: by mail-pb0-f41.google.com with SMTP id jt11so693511pbb.28 for ; Thu, 17 Apr 2014 12:16:13 -0700 (PDT) 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 Cc: linaro-acpi@lists.linaro.org, linux-arm-kernel@lists.infradead.org, rob.herring@linaro.org, christoffer.dall@linaro.org, Marc.Zyngier@arm.com, anup.patel@linaro.org, patches@linaro.org, Ashwin Chaugule 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ashwin.chaugule@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 */