From patchwork Mon Mar 31 19:40:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 27505 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 01514202E0 for ; Mon, 31 Mar 2014 19:40:30 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id a108sf12359825qge.4 for ; Mon, 31 Mar 2014 12:40:30 -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=A+R17Gc5gMPKP5hXk6L7w+wzBoxxPtmx/lIIA9C5KGgAmZ78Fg1s3kcyKH/DVQC+ra rq2Puya3XZ7RxlMs9EopltDL12fGTgvMvCWRi96DvaNYwN2DiQN4JINw9uUM7rB2Yt+W K9gMMzbCF5vkAGf6xqv7tiLxLbVoEO3riZzXiY8vp8A0un6Chbr5GubXrBcbtr78Xqr+ 4iiQWua1o8hTbPUOTga1/prynIK4NbpYyINX7dgL153tl3G3a0cXEEK2zoS1q7kzcXk8 7e+h73V5avdbiZdoMfJ+jci0gGzXfitttPgvE3FEIIWIorPK2Ig7E7mv7lDqjRNi7Sq6 tDDw== X-Gm-Message-State: ALoCoQmwrV8d3/Okb2KaJTV9khIBkZzNWq1Gy4xqlpZLrWGdRCce8CAXcE9Me2giX/O+4vAi3Z07 X-Received: by 10.58.41.39 with SMTP id c7mr10007602vel.25.1396294830639; Mon, 31 Mar 2014 12:40:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.98.68 with SMTP id n62ls399674qge.28.gmail; Mon, 31 Mar 2014 12:40:30 -0700 (PDT) X-Received: by 10.52.130.225 with SMTP id oh1mr20858274vdb.8.1396294830564; Mon, 31 Mar 2014 12:40:30 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id ww7si3147467vec.156.2014.03.31.12.40.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 12:40:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.178 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.178; Received: by mail-ve0-f178.google.com with SMTP id jw12so8372110veb.23 for ; Mon, 31 Mar 2014 12:40:30 -0700 (PDT) X-Received: by 10.221.20.199 with SMTP id qp7mr2291520vcb.24.1396294830491; Mon, 31 Mar 2014 12:40:30 -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 v8csp169684vcv; Mon, 31 Mar 2014 12:40:30 -0700 (PDT) X-Received: by 10.66.163.138 with SMTP id yi10mr27164856pab.95.1396294829522; Mon, 31 Mar 2014 12:40:29 -0700 (PDT) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by mx.google.com with ESMTPS id yx10si1397554pab.138.2014.03.31.12.40.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 12:40:29 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.52 is neither permitted nor denied by best guess record for domain of ashwin.chaugule@linaro.org) client-ip=209.85.220.52; Received: by mail-pa0-f52.google.com with SMTP id rd3so8730091pab.11 for ; Mon, 31 Mar 2014 12:40:29 -0700 (PDT) X-Received: by 10.68.233.200 with SMTP id ty8mr26729215pbc.1.1396294829119; Mon, 31 Mar 2014 12:40:29 -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 np9sm45069800pbc.31.2014.03.31.12.40.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 12:40:28 -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 v5 3/3] ARM: Check if a CPU has gone offline Date: Mon, 31 Mar 2014 15:40:15 -0400 Message-Id: <1396294815-12019-4-git-send-email-ashwin.chaugule@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1396294815-12019-1-git-send-email-ashwin.chaugule@linaro.org> References: <1396294815-12019-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.178 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 */