From patchwork Thu Feb 28 13:59:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 159376 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp671412jad; Thu, 28 Feb 2019 05:59:35 -0800 (PST) X-Received: by 2002:ac2:411a:: with SMTP id b26mr4532007lfi.169.1551362375698; Thu, 28 Feb 2019 05:59:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551362375; cv=none; d=google.com; s=arc-20160816; b=BDfrZqXpQuFaF08fGeAcEuQUkEH65fvmfFg4TPwng6uet4qn8zsEyVanJcPWXrF+mz b5tUG1l2wWYP5tHQ8ZSuxRvxp+lvINk3KCcUs5Y0v42V3KxZZYGDhMn4Xc0TMqvQ653B 1ksrXBq8OLmqEPChQnFVQbtV+YxMMmgjKJhn2+XgFTVaieputN6zCHF/Hepuz+vNTyqX 1J1OB/pemO6hJnnJ5kUwxZr/psWIODg4OQomE8/Vjavmzj7wN9C8HFstrUqxny8PpZWT h7iOj7r5WRuJ3pcaFR8vIz6DxRb7bTr9IsWSSwNQgGiK1I9do80v66NkZvjKQ7OX0Ote EDEA== 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=GD//s0JqI+KeAlnmxGXuzGHGexOP9orqqmZkOhYLw7U=; b=r5zHSWIgoqbA+L1TDEYHI3g0rmIZEM6r27A2jl1QyUBa516WaBw83uQ9uXBMo/4BHb Qh1alW5UC/wpVVBSuKwT9t3oVg0yOzxioVhXq+HzbJUE0zvQfQoerhQAeWio2vTaXJzA O5sMTA4UgBLSXP02u5aVWVqARavZMKxpTWRjdAOu7jxWThJ33Ea5QBLe/uEqceYXXHud Hhh8ec+xXnImXN5IxofrqIgF2yI11qvvawqQiyFuZhXMgGL7l/jdHXWmOFf4qn48VftG J7Je5NGs0VcGrT1M1QIfjvk/EiFkSxdzGAlSJY8QOUJ/4xh+GUiWJefJGXvlzZZdvqKF 0UEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bxKCWV0p; 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 l15sor11133342ljg.34.2019.02.28.05.59.35 for (Google Transport Security); Thu, 28 Feb 2019 05:59:35 -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=bxKCWV0p; 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=GD//s0JqI+KeAlnmxGXuzGHGexOP9orqqmZkOhYLw7U=; b=bxKCWV0plbqK1C5WfZfPpwf6fpbP94JQ/X271V/yQ5/QjJlyWO+wSIazjrGUubTSBD QreM+rLgJtP3DejcY1iHhPkN9dEh9EeG6CY0HTwy+GBS0MGSX/Dp/EOzA/WWQyhkuBzZ wtYAG9J2Rrkvxle66XhIqeoI2kF038iqHWp3k8aol4M2xcvcrWxY/e4swHu+Wn8OdaFt TPxsXx0d8oKTgHlOFo56ALs+JLy1b36GwFDgtIMSD+zRls/6y5/Y5BJlW4BzDFwYbz/F D67bwwhIV5FNqWH+Xg2NdwvzFQMVohZb+YVTD5ZBV3sLP7pMAOG/bbjFCEwWH9klV2LX 7Tbw== 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=GD//s0JqI+KeAlnmxGXuzGHGexOP9orqqmZkOhYLw7U=; b=fdk9NYBSghm4KfaM+c8c6X6nRDQuZUWI8p5u7sCNYJ9yPam0LQSZDPUx8eL4Y7IJyI ILUzZW3MbhNLHC2KFc2Bv/0llwhsQBnmsC4hcobhtlyDvVagFPTu9auyy51IySexW+hP QRTjdHF4nARACmGo0PtzAj+6XcYq2f2iMDxQmNa21LrJk0gGSJTt4gY98nhL42tLw3gP gI+h373d1a9z/1fJI84oBtYjYDix/Pp4dYhAbma6ZGvvqfTkz3VJWIhN8Fv4GEZguZCf 1sgXy2YPkuTKT4NuRKvSzH1xQdmPrud8eGJny2cdWT6UMi7dCDr5oQdTuQmNUa4AXX+3 l+uA== X-Gm-Message-State: AHQUAubuhVUqYmX34fxQm4VjDiE8JzvfT0WbxsBRC1crQASJPc91Y+4s xiWe75dGi0D5vLBMytP+4YDbkaxo X-Google-Smtp-Source: APXvYqwLBvpBuNN3H00hxi679411B3GMNc7DVG02j7EI5Mmnve0xO8zse4d3ORBN/k59dI+VI1ByKg== X-Received: by 2002:a2e:8694:: with SMTP id l20mr4846832lji.152.1551362375281; Thu, 28 Feb 2019 05:59:35 -0800 (PST) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v20sm4090265ljv.83.2019.02.28.05.59.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:59:34 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland Cc: Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Thu, 28 Feb 2019 14:59:19 +0100 Message-Id: <20190228135919.3747-8-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190228135919.3747-1-ulf.hansson@linaro.org> References: <20190228135919.3747-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 (OSI) mode is optional. In some cases it's interesting for the user/developer to know if the OSI mode is supported by the PSCI FW. Therefore, let's print a message to the log, if that is the case. Cc: Lina Iyer Co-developed-by: Lina Iyer Reviewed-by: Daniel Lezcano 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 14d25b54b9f2..417d43886948 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