From patchwork Thu Nov 29 17:46:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 152439 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2672395ljp; Thu, 29 Nov 2018 09:47:34 -0800 (PST) X-Received: by 2002:a2e:1f01:: with SMTP id f1-v6mr1706033ljf.129.1543513654866; Thu, 29 Nov 2018 09:47:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543513654; cv=none; d=google.com; s=arc-20160816; b=n4ZIQrnpNKi4h74Yv9TUUy6N2bf866+iOlhbrcx7IgIPZGloCWwXcBbj2KVcz7ShwK Yy6nGLg7UdKORc0VeuQabk0xS11rH4xYa3UbrqjSjj1wd7hZOkWHNr6e0ZvA039YRXim qTdorlqnPWV7Ue5EyI4GURvxc44og9n4JygQJ2amGpBS5XnB7KRTblPExkxbpkmjCjlS dMIUX85dnTc5OV488zWH1pCZuIfe0fO6VoLJr3eOc9xscfwowcjwZZPenwU5ybgiMi/p 3zBnRoPbF9e1KEPHCvOPq6U7jLl1blP8PKZSYW+uEaDVE7VWKGJHotEWCdU5+pNrqCnO 7fWQ== 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; bh=RtdXqoS3gVAQPCLor+MB+aJuhRHlqOlmuJfNLhUnBd0=; b=RULuGDufBJeYpoVL0NrueTqZm8koU3ZPNuOrfKJ9TqSMKtbuSCNNJLAS6xVvCfDw6E 5IycDsQ6nqfVdCDaHy0hu6kmaftTDOkmaaOcN6zgXeg6NH1NieSHUXlbqjBUKF1wmzCc QFT4C2bZYjzlK+ausW7p0P51ijuuq4tufLSqUjkv/n+jxMiLk75hPLCJAoxcRnnuqmn/ 1TbdmspMNfq/p23e3Lvrg089ovvAF3V+iIrlM+BkN646lzGAnOi2Y2IEq0ARc3P4EHHt gqQxdjR5hfmHPkZR6Tgc8miDQQ+XeK50a0laGL2G4oLCioQVE+cjlA6tD8dgbQNYb3M+ z5gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HC6R7vkB; 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 y86-v6sor1832612lje.18.2018.11.29.09.47.34 for (Google Transport Security); Thu, 29 Nov 2018 09:47:34 -0800 (PST) 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=HC6R7vkB; 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=RtdXqoS3gVAQPCLor+MB+aJuhRHlqOlmuJfNLhUnBd0=; b=HC6R7vkBxIVeReHiAW/l7VN+GiG5KttIpTe0k0AqV1hXefU42ypirVgAKNl6NVij5H txPNau3G5O/NCT/MuPS2rUKWtErXXmXXxcxlO5t0f/UEPJlhLfvbS7G+VZYr4xUJL7tJ ay4ymuPR6i7iB28pio0Hym1SmYgxxpasGofW8= 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=RtdXqoS3gVAQPCLor+MB+aJuhRHlqOlmuJfNLhUnBd0=; b=Hv2VRjviDhyRR/omJhzm3w/BLF1HCJugLtH9TMK1ETn4nBJLJQ1tXA5+A7It4jfLRI tR16mbMSo7fzq+IAsxO0S1v4/LALwQ1QwOZreUBHCVJmiJIdQfyXPIwWGlKs4Qmo4h3W 0vc4udsT9e7yDwQDKnvHrheZpw43fhMIIP+rkgXd5PDkvcQMclWoVpv3UP1VSIgRyPMB 9lttprg0PpeogGrJScJ3zjAgAaTNL+nkkpvT1EWMEEpOlf6V6HdxOmgbu+BE7ubqe+lj ite771LHf5fciB6VvyY6EXimQupNQ8o8GHcNqEuV8w5XJ+XVssfQhmS4vqATGMeE0W/3 F8Ow== X-Gm-Message-State: AA+aEWYt5Aly3pdipcKMwxiZOflzqfnET5BkZlWITEoxcRgI3qLKTS+3 dVIGwC3kkOcvcoC9GubzCtLK8XoR X-Google-Smtp-Source: AFSGD/UoOMLd8KL9ke7+41ey3VhAhq3w0txzumISXYpr0GGW8iXSuRUe08J7o+7bUUEIF8A7rc1LPA== X-Received: by 2002:a2e:1241:: with SMTP id t62-v6mr1548248lje.171.1543513654558; Thu, 29 Nov 2018 09:47:34 -0800 (PST) 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 j76-v6sm393983ljb.12.2018.11.29.09.47.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 09:47:33 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Cc: "Raju P . L . S . S . S . N" , Stephen Boyd , Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 15/27] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Thu, 29 Nov 2018 18:46:48 +0100 Message-Id: <20181129174700.16585-16-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181129174700.16585-1-ulf.hansson@linaro.org> References: <20181129174700.16585-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 --- Changes in v10: - None. --- drivers/firmware/psci/psci.c | 21 ++++++++++++++++++++- include/uapi/linux/psci.h | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Daniel Lezcano diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 6bfa47cbd174..4f0cbc95e41b 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() ? @@ -659,10 +664,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