From patchwork Wed Jun 20 17:22:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 139386 Delivered-To: patches@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1050894lji; Wed, 20 Jun 2018 10:23:08 -0700 (PDT) X-Received: by 2002:a19:3b81:: with SMTP id d1-v6mr9650976lfl.111.1529515388276; Wed, 20 Jun 2018 10:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515388; cv=none; d=google.com; s=arc-20160816; b=ZMKbLDKdsieVdsz5bz1cqWSfb2g89v4HaRK5mmaUog/zz8PGPuMIz9BfMi5/FbsKJX YBT0vAGBlShWi1FJlOuuhbyLPwM2AKtZwJ9ywZYV0wRqsiQ4CHL7JI5Gs2MPOMlQtAS/ rdyQYSXr3zEjrti76+HIs06F1yHWlyeNuWdAAO2VozAcr/xBs682jZ0eKHTrnDVpBzEq gYAOSFcxIVXtUkY4lqvqGsJZbZWZPoLh/QDaqD1UtCqKyYhFc5JydlxBShBwBIFiZyPS 805aqvRwFjsIP1N0b8I39gI/sxjDBT+G/A/V7lPtD2btqB5OebvATQj5vISW0y5nV6Nu /pMQ== 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=5c12PoaPayFjQRFBN/FJeDZsu2cQBeSb29KIyIwynIE=; b=rGn/Z7Wj16CdtiJBig71qaABYGG5f2S/JLlRCv+LWMBoKC3MksUOx5D/WOjMfX3Ib1 E10ayhX8SswzG2S9bRef+5Anhkjf4a0oDpje2h//Yq5Dps3teaguGM8eTDRcysVF+mTu 1876kefxjvjb6xww02wST+4lHdhf9SzIwmufPawODya+hJKNKFoYKXpxny8HRZVyv0Ko ZRo2QD5IOxf+S8a7Jf6WoNKiIuLKO8rY1xLg1pNOKaHVMPOJJC/vMBV3TVjkPXSyssCo +fsNyEhXSjSfgzVZ3EWkIfrVJ9Ydc9/grqcCXcOCDa6gWUMLPutTNVy4MnEMGNDPu+Bh aafw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fNMEG9yx; 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 x28-v6sor730200ljb.114.2018.06.20.10.23.08 for (Google Transport Security); Wed, 20 Jun 2018 10:23:08 -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=fNMEG9yx; 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=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=a2eR6LNxK/5InlqM3PtXiWjDakPtvXZiifSjTvuVrZdnpP4LVKygsuOrqCsDQif0tM fvfBTAvlUqDUUkewfP4+Y4EAz7JBmQVsdvncTe6YtzGbd6bfMm/8HYPDZrHyThfGlDss c5gTldtmGlj8A0W3DLGSh33fBJD43Yq+2oZxmC3LKiIG1od+UQK4X85z8qOtX3lEm8Dr EfPAKy2FVuWWPdNX1HKCSOP19dQRa23XijV8otxbAatOpCEJie61H3qtVPSZ8lkT3rC4 QPoX/laVR5pZwFtXkdnXMR+dl1JMHJnm9ooFptu+OuTog2XwhAa0K9wD5LYpceOeCill gKGg== X-Gm-Message-State: APt69E2BMsEhZPqSRHygjEu3l/wfRhiRZ23EnSuwEfGnJKQlExWyygIM 86DzasFwSsORlCa2hb9tCPWshJKv X-Google-Smtp-Source: ADUXVKLXnbEUhvdJrQNRK3z6KOMETfpBUAn8KW5mZVmF80413yeBds/6zQjy2v73Bo8Bct0QemdGUQ== X-Received: by 2002:a2e:3613:: with SMTP id d19-v6mr14809658lja.31.1529515388105; Wed, 20 Jun 2018 10:23:08 -0700 (PDT) Return-Path: 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> 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(-) -- 2.17.1 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