From patchwork Thu Mar 27 21:23:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 27238 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 05889202FA for ; Thu, 27 Mar 2014 21:24:14 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id lh14sf9131265vcb.6 for ; Thu, 27 Mar 2014 14:24: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=fvHTLCAf9xI46rYBe9EZTYjkvRL4HfWTC1/fUTl+f6I=; b=BccfXOgvNOMtS4NLC6jqLvxj9068iok3agt8c5gjL3Crkf6IV2DKbBCEFUY9ZfXnrP B5J0ncOpWOlFrLOt2SzB/2ID0T8o28seEm/DZwveaHgKVqMJIIGIXfSttH+pwGzE4Li5 cvPYa0gjtGd8K7MQWPwxU1nfIPWC6bIJZ5qbrhSlOQLKSQ9C+rE022POj79UNbw5ZhO7 xTWYfAPCaayDZhKwj5xxOjOmwrbl/wjkvPJKGnSOCTcGiBpbM3EGC625GjsRTx7N3ory HJhLgH9+olJvKXWbdvdX1NRtTLR6v04qzS8HOpREBEZqqybrCyjI9PdoNx7xsOHd1m9j 7Aow== X-Gm-Message-State: ALoCoQlcfm/liKpaawz7XKE5bqUC2phSPztrZwU8HcHU8yAYoQRGTPzcoQBHLKfh35bzGo87V0ai X-Received: by 10.59.5.193 with SMTP id co1mr420516ved.30.1395955454741; Thu, 27 Mar 2014 14:24:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.210 with SMTP id g76ls1255482qge.69.gmail; Thu, 27 Mar 2014 14:24:14 -0700 (PDT) X-Received: by 10.52.34.137 with SMTP id z9mr2848762vdi.12.1395955454650; Thu, 27 Mar 2014 14:24:14 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id uz9si870320vcb.47.2014.03.27.14.24.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Mar 2014 14:24:14 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 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.173; Received: by mail-ve0-f173.google.com with SMTP id oy12so4861872veb.32 for ; Thu, 27 Mar 2014 14:24:14 -0700 (PDT) X-Received: by 10.58.152.142 with SMTP id uy14mr3437840veb.4.1395955454570; Thu, 27 Mar 2014 14:24: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.78.9 with SMTP id i9csp60309vck; Thu, 27 Mar 2014 14:24:14 -0700 (PDT) X-Received: by 10.140.32.37 with SMTP id g34mr4762782qgg.37.1395955454216; Thu, 27 Mar 2014 14:24:14 -0700 (PDT) Received: from mail-qc0-f178.google.com (mail-qc0-f178.google.com [209.85.216.178]) by mx.google.com with ESMTPS id x8si1682996qar.203.2014.03.27.14.24.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Mar 2014 14:24:14 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.216.178 is neither permitted nor denied by best guess record for domain of ashwin.chaugule@linaro.org) client-ip=209.85.216.178; Received: by mail-qc0-f178.google.com with SMTP id i8so4985685qcq.37 for ; Thu, 27 Mar 2014 14:24:14 -0700 (PDT) X-Received: by 10.140.47.203 with SMTP id m69mr4751269qga.21.1395955454046; Thu, 27 Mar 2014 14:24:14 -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 v3sm6044119qaj.1.2014.03.27.14.24.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Mar 2014 14:24:13 -0700 (PDT) From: Ashwin Chaugule To: linaro-acpi@lists.linaro.org Cc: patches@linaro.org, mark.rutland@arm.com, rob.herring@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, anup.patel@linaro.org, linux-arm-kernel@lists.infradead.org, Ashwin Chaugule Subject: [PATCH v3 3/3] ARM: Check if a CPU has gone offline Date: Thu, 27 Mar 2014 17:23:50 -0400 Message-Id: <1395955430-26050-4-git-send-email-ashwin.chaugule@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395955430-26050-1-git-send-email-ashwin.chaugule@linaro.org> References: <1395955430-26050-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.173 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..4c1adf9 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 err; +} + #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 c523051..2c177f5 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -37,4 +37,9 @@ #define PSCI_RET_EINVAL -2 #define PSCI_RET_EPERM -3 +/* 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 */