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: 131685 Delivered-To: patches@linaro.org Received: by 10.80.210.197 with SMTP id q5csp410683edg; Wed, 14 Mar 2018 09:59:31 -0700 (PDT) X-Received: by 10.46.81.73 with SMTP id b9mr3806284lje.9.1521046771644; Wed, 14 Mar 2018 09:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521046771; cv=none; d=google.com; s=arc-20160816; b=k2lDS8D/7Pj/jTjCNJ+fqNian/18LVm07mce4tMfgiZqz1KK83gVlr4ocyCGHUcdCJ AXew320au526jCwUvSLWlKzwpMHgmahXBPB214taUaIRSTj0sFVwIuzgnHeqEl+FRpsl VRsnuKmqltDBfJFUPo8l3/Rmhkd4Ek6TpdWaxUJXh2o12JM3Zp+4wvGjXlX+nS9B7X2B wReNk2m7DdT20jh3H2RirMGWwTk6Y+0+/28oFgdBZraBVAyw22P/MxgCiPbZNBVYB5UD hgpynuG3pq37kG1d4bJp+VqiWGjVznqwjX9HdB/lYcG85QVE2drTB227fCStQgKvzxh+ i8Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=SySSK6DMRtLpXyqRBoBk0LQnN5iJN9xKHJ4VsqkK6dg=; b=NKuXXSAAM7iwGJI+cA3GJS0cehGbBtVmELIFH6QKo1qDwsm7qH8r/T65J8IBlGj3mR i1b1XuL4KCJxJLWe6/wxFOHn6S6VPnCWJuaVSZeTWAhp+8UoRXa/4akrzDUFHJ/0WLuU 1FiYLHA3H8OQ8Rz+0xUZOZK978C/SIrmfrRz0/74ExxHC1c28cThNAmrJnhS3j3fT3l9 dZUa1edMpW7zqdlxm84C2Ns5Zc4FjsfJ3Zs4DOXmFOMV4EfBRvrEVbJasMCKEPIw9Jtz ix4oNhgjnhN5b7mvtXmbE17iCHkzxyNnA+SnfyKz7vh7ZuFUiw0Idjdxma35cApC66Hm mvaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DeF9GBnb; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 63-v6sor867238lfs.57.2018.03.14.09.59.31 for (Google Transport Security); Wed, 14 Mar 2018 09:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DeF9GBnb; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=FPposG8McXQYhbitUNy47xVeMzc8WxEWstm2ovf382oFH6UOtHbXWAXGLJvx8QLIix emoFyGeRhp0rANKY+3y20QUD3NDPaizNxRorVbYTpa6jnSyxuOestw1yxyHDt8Na7HMW VqdTwOw61/qvhsGvNtP0sfk5iq3wwaZ7J33f40w8HhcCBhtctLFkPtsxxAUbKCIgHRtf P6wQIAaZnX5yEfVuPdpdiyXtxBeeV1hE+vDDmzBIPx8ojejRDxzT5/G3uAcQiLFB75Xr n6wu+GAtfST7b3nRNKH96Xy3SnFQOoc+zImuIaujDHTrn9Zx2UFUABKl/fUMpYdXdsSG ZdPA== X-Gm-Message-State: AElRT7GxQAiCirZxYRXY62H5odrfH5A2irE7zAp4XfJJI+Fc8zT8yLvR Fp081MnHUqOcg0x9dCQR+LiYKbda 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) Return-Path: 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 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 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> 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(-) -- 2.7.4 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