Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1039710imm; Wed, 20 Jun 2018 10:32:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIJDeSA+tCippHVLQ+xUrkww63F8uxR5D9pbtZ9W/fcbrXNogWNykKZhA/AWlhZ/etGH62C X-Received: by 2002:a62:2044:: with SMTP id g65-v6mr23862857pfg.40.1529515925623; Wed, 20 Jun 2018 10:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515925; cv=none; d=google.com; s=arc-20160816; b=Feq6SPN9E/waflxpx4NsKZP1WT+fsALqLyYsF6YKNuzv8NWGtL5dmFVkFLhUXUaBmp ZNMYSY31FF/hPr1tcO1jpMKqk5ZXrCZFTynl9JLTr6noPULmJlobrRDA9mR4tbQPZ9q3 Y+5omY/P1ZRfkH4LYwjsorJ2XvK74jCwOncmJUaf5+YZpmOJKGsuE/p9QLUZbubXJc71 44JKRcR7iC3Ps75b7a0IrOsG70zc7Lk36HiqaQXZDELTWOrgbCtU06/v9Rvt0XMa7yS+ qzkFxBpmIlyyEPeohIPZNi3nL+ECrMeXtsYeOSpiktxzEvw3tJupAs/XaaQqJ9vgGNcU 5ROA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=5c12PoaPayFjQRFBN/FJeDZsu2cQBeSb29KIyIwynIE=; b=u3lqkyoLj6mMAxOc/SvHrJ/n/DKr/mYKViiZTtf7x3qze41g1WqMArCxuPmHlGBQ8Q s99iB44Tx6nHKkuXdp759JClsVPQ4QeZmD76qXKQ9gonDEkKdu5K8FEUW14aGetzFwhz QA2lN/Tmhq8ebZld6p6aaueOQJ5v5ygN8YjADfHIdI2w9BAmzizW/uQrSbJoPbQ+fNbK 1sGr9UQ37KgUX7RmS1N1pRTLGpJlVvnSFUPRCO/s25gFE9FM1a3BtPsTm/eXOgJeGKn8 cN9OPiavsE7kEvwypgtuGT9RDQIFCoQj8SeJuRakEHN8S5nqzYPsPF+tQKXEIB5qlQl2 TbMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fNMEG9yx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7-v6si81543pls.405.2018.06.20.10.31.21; Wed, 20 Jun 2018 10:32:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fNMEG9yx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933070AbeFTRZ2 (ORCPT + 99 others); Wed, 20 Jun 2018 13:25:28 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:38634 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754597AbeFTRXJ (ORCPT ); Wed, 20 Jun 2018 13:23:09 -0400 Received: by mail-lf0-f65.google.com with SMTP id i83-v6so481177lfh.5 for ; Wed, 20 Jun 2018 10:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5c12PoaPayFjQRFBN/FJeDZsu2cQBeSb29KIyIwynIE=; b=fNMEG9yxB1x3uNbnRxEi56bcFRcCmaoR6Yq8DZbX198JH13Yvc6OshNhATfGUoTPNU rcWDutQB8eDtpnXaKF98ag5WBNOEsuCTzbjaoF4Rn+S+MT+4uK6tpg6VCjYphHSCl5qt I4mu1VwZAJ6u0lwrfKG5OGZ2hRzl+Ce0CWEVA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5c12PoaPayFjQRFBN/FJeDZsu2cQBeSb29KIyIwynIE=; b=nQ3qeGM352GY7jM+KlYYXtRUvlopVHTizVZiCQbQzqnyHMjhj1zFrWTEv4G/bZp54m 99RgE9ydWxWrDNY4Dj39ONlszdVmc7wVvZdi3pxsgu4z3slstiwnQggy8P7AFgprlOU3 AFehnFQi64+aabu9b5rNdt3r9FY/9sokouuINLLjn8gi1TXqgJXo3SNIioG+hwbUEiV9 y1XjUSU5PPDxlSyBGYfBGBYnSyTrrkwcSPDl5kW/2zZnJsR7Sa0+ouLYwKQD9A2N3ubt 6SoIhMvFZHqjox77u+qi+wR7NsECmCC99i2TXSe/oWz142V9LzFb9yTifhBdpkr1HOgP jyXQ== X-Gm-Message-State: APt69E1Yrd1Hjj0F9DWOJ9uDmOfa7839u3hEWk8NzpuJ8JKFD5snAGXO Ym+yXRJ/rNiQWWs+ul+SsJQgPQ== X-Received: by 2002:a2e:3613:: with SMTP id d19-v6mr14809658lja.31.1529515388105; Wed, 20 Jun 2018 10:23:08 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b2-v6sm514441lji.85.2018.06.20.10.23.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 10:23:07 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Cc: Kevin Hilman , Lina Iyer , Lina Iyer , Ulf Hansson , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 18/26] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Wed, 20 Jun 2018 19:22:18 +0200 Message-Id: <20180620172226.15012-19-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620172226.15012-1-ulf.hansson@linaro.org> References: <20180620172226.15012-1-ulf.hansson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PSCI firmware v1.0+, supports two different modes for CPU_SUSPEND. The Platform Coordinated mode, which is the default and mandatory mode, while support for the OS initiated mode is optional. This change introduces initial support for the OS initiated mode, in way that it adds the related PSCI bits from the spec and prints a message in the log to inform whether the mode is supported by the PSCI FW. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson --- drivers/firmware/psci/psci.c | 21 ++++++++++++++++++++- include/uapi/linux/psci.h | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 38881007584e..e8f4f8444ff1 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -95,6 +95,11 @@ static inline bool psci_has_ext_power_state(void) PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK; } +static inline bool psci_has_osi_support(void) +{ + return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED; +} + static inline bool psci_power_state_loses_context(u32 state) { const u32 mask = psci_has_ext_power_state() ? @@ -658,10 +663,24 @@ static int __init psci_0_1_init(struct device_node *np) return 0; } +static int __init psci_1_0_init(struct device_node *np) +{ + int err; + + err = psci_0_2_init(np); + if (err) + return err; + + if (psci_has_osi_support()) + pr_info("OSI mode supported.\n"); + + return 0; +} + static const struct of_device_id psci_of_match[] __initconst = { { .compatible = "arm,psci", .data = psci_0_1_init}, { .compatible = "arm,psci-0.2", .data = psci_0_2_init}, - { .compatible = "arm,psci-1.0", .data = psci_0_2_init}, + { .compatible = "arm,psci-1.0", .data = psci_1_0_init}, {}, }; diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index b3bcabe380da..581f72085c33 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -49,6 +49,7 @@ #define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10) #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) +#define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15) #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) @@ -97,6 +98,10 @@ #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK \ (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT) +#define PSCI_1_0_OS_INITIATED BIT(0) +#define PSCI_1_0_SUSPEND_MODE_PC 0 +#define PSCI_1_0_SUSPEND_MODE_OSI 1 + /* PSCI return values (inclusive of all PSCI versions) */ #define PSCI_RET_SUCCESS 0 #define PSCI_RET_NOT_SUPPORTED -1 -- 2.17.1