From patchwork Thu Apr 12 11:14:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10338391 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 5C172604D4 for ; Thu, 12 Apr 2018 11:25:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BCF8287D2 for ; Thu, 12 Apr 2018 11:25:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40230287D5; Thu, 12 Apr 2018 11:25:11 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI 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 89EB3287D2 for ; Thu, 12 Apr 2018 11:25:10 +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=ERCNI9xub3Dl6yHXqioxc+iLpst/fjrBCJK4NwpkQzY=; b=nRTPGPO2P/d0GK3NuKHiCO1R/M y3hGQufDnlLwbUN0/YouibZAsGfzav3kfFwi4k3IUnkBzAYsQqFV+C8t5W5b7D/mXdfXQ3yWXp1RM svsn1dGIjHoIlXDjaZQGvlAixuS8vpI0hMXxK3aXpq/JzHPfKRKfirpVFQP9C+nof5AhQYANvZhcf x0jrujAqoKIz8ywuxMddhmK1oK7d9nP5LrnkAsKSV4Jgjx17uDScpTHfwe+DBCx6CeCfuICZme9Sf 8o83Rh31BkOIuz7tXzu7F4mu8gQ0vMh/osWmg9q/bsC+6i49uw82CP1zgXgL+9ek5Mrr3OhK0S9Fk 90zb6GrA==; 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 1f6aLX-0004UA-BH; Thu, 12 Apr 2018 11:24:55 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6aC9-0006BU-RA for linux-arm-kernel@lists.infradead.org; Thu, 12 Apr 2018 11:15:17 +0000 Received: by mail-lf0-x244.google.com with SMTP id e5-v6so7126748lfb.7 for ; Thu, 12 Apr 2018 04:15:11 -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=1DBONOHXXjX8Kaigqhj/3cmJ8OlitzG5zYoiAvHZb/g=; b=U/r3NZCa8C12Vf+V2Y2qSJLRsq0st4u+0Qx0lsIRU8x8Vm1luctSw+eJ3gPaGTcLSd TOTI29yOiI/e3UxFMTk/1QrydsLBBglFduaENCpCVgn1SIlU0APEY65uskvtbuHIOLFx g4yxfbdPrRO8ykq3EYCUGFS8g2EHhdxeTtvd4= 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=1DBONOHXXjX8Kaigqhj/3cmJ8OlitzG5zYoiAvHZb/g=; b=HD6wD5TCRErPjU2IparapcvYtm7OBqX7r7uJ9NgKr7vI8MPdF21VlPX6L6vOuh/6NN eCNppm5Yv08kP2GhzyDz3ztOAwoW5QqVbPJxCmK7xoyxtt2+XDHkLk8eAbkCWDzQrDt1 0dleRgeZGXiK02XoPj9+lI+y0haNWRla9NlP6Y9L3Gr1753p5ktwGVoduhzbZ9VmPNRO mxCL3CzeAYaRXpH6aeXg6BFB4r7q4jHT7Hb5tIiUdIOW9mOwT0/CCRgB3W/smuzUpPvF fehfs/1zkdXFggDHAgZOI/k+IAFZITas2UUobcZjZXE6xUvOaaC+fVb5VESVFcf4s6Df WWlA== X-Gm-Message-State: ALQs6tApsLirl/bRbRLNbpmdZ/avF9Tg1uYCr2nJlpC5KuX1w000WfEW ggSRG4HxLvMhUCuhQa67RMGzxA== X-Google-Smtp-Source: AIpwx48Sp/tWcEjzQqkAvrBqtKm9Rg/ZeTNvMLFDQdCNp6JnMaDEqmLfajm7tK3Pe3AwidGQ9kBB/w== X-Received: by 10.46.131.86 with SMTP id l22mr387680ljh.82.1523531710097; Thu, 12 Apr 2018 04:15:10 -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 r29sm543187lje.72.2018.04.12.04.15.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Apr 2018 04:15:09 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Subject: [PATCH v7 18/26] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Thu, 12 Apr 2018 13:14:23 +0200 Message-Id: <1523531671-27491-19-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> References: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180412_041513_915416_C5C6A9EB X-CRM114-Status: GOOD ( 17.54 ) 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/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 3888100..e8f4f84 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 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