From patchwork Wed Mar 14 16:58:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10283087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2478F60621 for ; Wed, 14 Mar 2018 17:15:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 149E028517 for ; Wed, 14 Mar 2018 17:15:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 093E52851A; Wed, 14 Mar 2018 17:15:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 783C228517 for ; Wed, 14 Mar 2018 17:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=soJ4ohvROWuRaYVB+JuOwIyUOCnZSCLtwo/ztDV+rYg=; b=iwgobgjifZ9dTBMWNW2UB/9eT9 LC3ZTd3ZxtToOHB0KsTfXawihaoOnkTbLIAVrCIKsNmYPo5AfMrr75i19lmHQaha/X4b6DQEMRZ+P Tq1NYA+KFwwbxYVu+vjbUiprhhV/heWpx8VenyPg9QlZrThzP9n/qTdszV6kN+tSd6oJh7AV1hE7c zetLVDa37mZJvPfhpWo9t62iTDElbDxhr1I+Dl3zsd/cBaARXFZtZEVjhP8+OIF0XaeR2oy06LoDw QI4uavPQ+3S8RNnPD3CLrFSgIqM1p7gKv2N3wzPvGosSRAoemKSxKbfSpkGji5lDZluxAIRdHYhby nxBSy7lw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ew9zk-0002IF-4x; Wed, 14 Mar 2018 17:15:20 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ew9sA-0004Fg-C3 for linux-arm-kernel@bombadil.infradead.org; Wed, 14 Mar 2018 17:07:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SySSK6DMRtLpXyqRBoBk0LQnN5iJN9xKHJ4VsqkK6dg=; b=BL5kA93aQSP5nbIvquSinW9kI qCBAei5MukC5F33ZO+iCVtS7NfZZSN72o+i4ExnDWxSvBKXIGoXUGP5LQ6KTovhsi+moudBIcwpRt mkVuvZrSrtOcMiM0T8iJgQkuevl4Aj6tTrZYW8hXbPXe4vJL0LxlCctj3Dq8fTUNshvKiNc5jXfej z5VdiVVaPrukaZFWjYy5XIwr9o4Tk3hsIZmNmawC1cqF+0fx19ZAP+uiRByEc/GCiveWAFSNaDKH3 +d7LDCOFkXGN0xlBbG7WzC/B7FFScZPOWqTbYhwj65g5oyxBHqP1jQfVWJM7dbteIf0QEn4Yrx24u 8WBvo6imQ==; Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ew9kW-0000pu-A3 for linux-arm-kernel@lists.infradead.org; Wed, 14 Mar 2018 16:59:37 +0000 Received: by mail-lf0-x244.google.com with SMTP id e5-v6so1844139lfb.7 for ; Wed, 14 Mar 2018 09:59:32 -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=SySSK6DMRtLpXyqRBoBk0LQnN5iJN9xKHJ4VsqkK6dg=; b=DeF9GBnbhyXegN4b0D3/VxRW7yyr/9r+6ByZLHDRLlYlfDjleobyZxBm49lcd++JeV jhoc61gcdqZncLD17+WJDzjrqutDrNd2C8K4ZLabaXt0Xxo68LO6LwOOCugI0hnMQxBu VO5O95DLbShXMmdtZuizcIaDX3/WAM5YKxwc0= 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=SySSK6DMRtLpXyqRBoBk0LQnN5iJN9xKHJ4VsqkK6dg=; b=ctFRN1+fDswavFXBFyGZ2+4JDZt3G8NqmTh3e+wJujJxs1wbPdoNAHUh8PnloImvbQ UED2naoy3/PFmyjwDhhCYsOQpEFjhQxbrNnaka90nlWyZIHv7xZhxxQ2jqnwPg4KMx6U X8o84FBwj8TOzErvkAoRO8o0dm1kBxIYIS/zE1XKNA5SmpIYXccSHR8AzoydihwdzwRb Pd1e2P8NLbJID+MkiuR7YICwo2ERQeQIgubZ3Jd3YfrZ8ynciyOBXFDv3/hjh64mZWme VNvJJ2LQ9CXwVoVVyMAJF2I1qinrGxns7WiAAhA2CkBNXU9F+WZiZ0L9WiGqXW5wjXDG F1SA== X-Gm-Message-State: AElRT7Gp7MqnAQnyv663MvVwO+zU0I2ontOUfHPcOEjJzAFLucGxN6jm GQ4bkgGPbdi4mXGPN4zf/ZdR0w== X-Google-Smtp-Source: AG47ELvE116t+UR8Ob2pk1XrYKZ4gudkGLGZ4Pb1UcQV1Cc77C37Rxtx5mz6KzoSE3Z+ZGqEeaSQCA== X-Received: by 2002:a19:de0c:: with SMTP id v12-v6mr3496072lfg.133.1521046771347; Wed, 14 Mar 2018 09:59:31 -0700 (PDT) Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t24-v6sm724849lfi.30.2018.03.14.09.59.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 09:59:30 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Subject: [PATCH v6 16/25] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Wed, 14 Mar 2018 17:58:26 +0100 Message-Id: <1521046715-30683-17-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> References: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180314_165936_353013_4BA61694 X-CRM114-Status: GOOD ( 20.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Juri Lelli , Geert Uytterhoeven , Kevin Hilman , Stephen Boyd , linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-kernel@lists.infradead.org, Thomas Gleixner , Lina Iyer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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.c | 21 ++++++++++++++++++++- include/uapi/linux/psci.h | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 3888100..e8f4f84 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/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 b3bcabe..581f720 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