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: 27421 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0414C202E0 for ; Mon, 31 Mar 2014 15:04:05 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf29704432oag.6 for ; Mon, 31 Mar 2014 08:04:05 -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=VCQQFHwHm145EGFnVfyzAfl9pHeO0DI+TTFJ4JFC038=; b=d8nNoFz3YVaQg+PobzoVUvCEbGbVEffHaqkxmvlzEGwkb4FuI4PHsH0Df/PqeU6ayP 0FI5nlmKft9jBXJe9F3vxnM5De/bwp5Ql92z7voqBI0kUY+HoXbHnzmDWfyCgmiTflzW X1gyagPJ77gXI7VHMpgj95tVVFTwQBD5SvMiJqNizH18N0NbwjhPgQK0836+OTE/toHB b4B3xMXrdZiSzM7htSkmMFhubucH7jkUQv8dTJgY9nzcwMvFjUhwLS/BU9HhGl8M+HFk 4La7g2a8mcPBI9mrrRwp/g6Ia/AiAr/LiaCZ2Ux+3Fj5Xo1u4H38gjFHJSs4UTSEUA7M g90g== X-Gm-Message-State: ALoCoQnw68mwK7fnjMBxIqkajw4Ij/RGkaUyQE7oMXRtiLTyFPRa6NvsH4JwmlAiNf21tFHvldkP X-Received: by 10.182.109.200 with SMTP id hu8mr10495076obb.20.1396278245565; Mon, 31 Mar 2014 08:04:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.76 with SMTP id b70ls2462707qgd.97.gmail; Mon, 31 Mar 2014 08:04:05 -0700 (PDT) X-Received: by 10.58.243.39 with SMTP id wv7mr5116vec.51.1396278245387; Mon, 31 Mar 2014 08:04:05 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id gs7si3018361vdc.56.2014.03.31.08.04.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 08:04:05 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id id10so8221539vcb.40 for ; Mon, 31 Mar 2014 08:04:05 -0700 (PDT) X-Received: by 10.59.7.102 with SMTP id db6mr8237091ved.17.1396278245311; Mon, 31 Mar 2014 08:04:05 -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.12.8 with SMTP id v8csp149632vcv; Mon, 31 Mar 2014 08:04:04 -0700 (PDT) X-Received: by 10.224.29.4 with SMTP id o4mr9095224qac.55.1396278233001; Mon, 31 Mar 2014 08:03:53 -0700 (PDT) Received: from mail-qg0-f46.google.com (mail-qg0-f46.google.com [209.85.192.46]) by mx.google.com with ESMTPS id d8si6253848qao.253.2014.03.31.08.03.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 08:03:52 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.46 is neither permitted nor denied by best guess record for domain of ashwin.chaugule@linaro.org) client-ip=209.85.192.46; Received: by mail-qg0-f46.google.com with SMTP id 63so3846168qgz.5 for ; Mon, 31 Mar 2014 08:03:52 -0700 (PDT) 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 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 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-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.220.181 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 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 */