Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2764818imu; Thu, 29 Nov 2018 09:51:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/W0I2I3ijDH6P6HI35IOpzECyhGlgnzoumBoSfdzSfqujFs7GWw89bT3mOOUmZVV1B//099 X-Received: by 2002:a63:d604:: with SMTP id q4mr1999271pgg.175.1543513893273; Thu, 29 Nov 2018 09:51:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543513893; cv=none; d=google.com; s=arc-20160816; b=Sx4Bv9uJx4QqDeCON6P8ZXIH1+M50A76iMEqiP0R4Z4u7tu4KN6z+WocCmB+wiQ8wp XyA5x9EXfsV/zMtNz+u5RJtOF6ZhKyTYZFD09Ula6MhOUCMgv/4ZYvQKWSv0kWFRdxHh Swkt3ZIImcNmEmzKY1yhiFSnpFduQACWmhJg4BUzZlEhlf/L8ov8c9cmdj0zHcRv/lPL 3GtEZ1Y9I5Lmsbn7ane0t7QRAinUhDOjjQzogtIwuWY5Q9Go/+agPX5NGSn9EEd3czVa oIP6RrDbLG7pIFIWRZqhM+6aGh5X9Qb2yi+9okqPj56kXk0RLtJFfoQSxxcQw6WLsyRe b13g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=RtdXqoS3gVAQPCLor+MB+aJuhRHlqOlmuJfNLhUnBd0=; b=Qj7ZFoV0MMDpaKSAKQh8XeYQbHjZ2algWMwy+TmtLLxMx97hsYH5s9aVziq7fnvLcw SM3Wurrtl8osMawiByIqkWy7Ckjh4Pj9GsmsXdzHFdm/wikHWYuFAZJueV6ICLSOXp6s Rj6x4CwbDX/hbId0UpxKwddlorFqOm5DaVSspsxP1JFjauB5CFxrmdbpNiR+AsiXb+64 wFHW3QRtbaYcMMjZd733l0/5ZMZqmYS4AsDFUl0a2ta6uPSldNrDxazoE1AhEWlkIaln HnIzj8jyO5f7xxak98JtDfN5sb0CnlqIu64R/gi8ha/n0Rzg/AqH4uXtAtiZsMmD72T3 ncMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HC6R7vkB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si1322473plt.189.2018.11.29.09.51.18; Thu, 29 Nov 2018 09:51:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HC6R7vkB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731008AbeK3Exr (ORCPT + 99 others); Thu, 29 Nov 2018 23:53:47 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:33102 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730941AbeK3Exq (ORCPT ); Thu, 29 Nov 2018 23:53:46 -0500 Received: by mail-lj1-f193.google.com with SMTP id v1-v6so2548698ljd.0 for ; Thu, 29 Nov 2018 09:47:35 -0800 (PST) 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=E0ONDlymoU6czMHtIHAKf8sjf2A373Ze1nr6HW4Xe+DbrVsggvq+j2sidkd5DEDa9G Mo4Q0I0SZao7+ygRreV2eRDDdnngb6UY937GZmYXm00cE0AEmJZDJ8P6YztYMAliz6FO vUIa691XhRjYiGht/p+8+NaNlZfb++zoXksxRJ/9+Tt3/0Jun4QhT4HyEEsaLINK+q0Q Dnptbq7QgDl+4KyzeSnsRNhO/kJzIJQFAr2XwEe5UrPENHsajcW7S/LuO2jZoJeg6Gqj eigly/0KjIHh9p+F5pjNK+bbwKu3VBsRkQY9bNhtBQRPSaOlCWmDXDBCchWlW0oOF1eT 9jfA== X-Gm-Message-State: AA+aEWaNjQRpBwOCNcoDYcU5yXSsbj3zhT5diJqD701J6AdQ1N7GJsrC 47wf/F2b5KophNKY9uKu7q2eEg== X-Received: by 2002:a2e:1241:: with SMTP id t62-v6mr1548248lje.171.1543513654558; Thu, 29 Nov 2018 09:47:34 -0800 (PST) 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) 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 -- 2.17.1