From patchwork Thu Apr 12 11:14:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 133256 Delivered-To: patches@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1573861ljb; Thu, 12 Apr 2018 04:15:10 -0700 (PDT) X-Received: by 10.46.135.7 with SMTP id m7mr409211lji.106.1523531710330; Thu, 12 Apr 2018 04:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523531710; cv=none; d=google.com; s=arc-20160816; b=z4t97xRRr+72n8PjiU/mUgmTobKsYmRiJ4PVwfKOJIDF7qMGhAVp8o6/XQLGNPDOpP 7Xb64qZeLbLYR/ti3Umnf4ZfG6QUFjE4lDttOlvhlKNSvoiItygpACHwxMBbEHEJHopY N+ZiiSSaYWuSul3Kh7HW4vimaQSulG43oJj2x9sny7IQ+rAAk2ZY65BCqZDOzC9dvCin Oe8dPro2pJ6CNNhBtKshl0SQRopBKPwrtrEdLUdc019CgHM5mJ9oMugWnUx8yy6WekO9 tPtRLO6BXKoXxH8IOsE9Al6bIJJNulu5fhYBSdOijlNJc/2rIm5brznh/GptrMjC96t8 RI3w== 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=1DBONOHXXjX8Kaigqhj/3cmJ8OlitzG5zYoiAvHZb/g=; b=ANoUL16UAta9SqxCK4DAT9hyKJw9Umfo9i/VVwikKwx7wLjUZ585uFzFtP0exgAKyw dOc1F62nmR1XHWAg6Nh2+7lxBmKYEoB3QY7UwIE2YW4I2P4IFvpc1ocxdq8RgQ/1Sn46 +mLk2v3cKt2J2NIhGk7EzcnUH8UsVIUoFHyVW0uBuzs6k/R3ipuQwuW9fyz0ff2RRU+o lW7WzvePYkfUIsvR2CIVQZ11zhoKdOGQNm1+nQo3ARgjD5YZtiGYJkQzP0QUvKzRFX3P rd8WEg626ArBy1AskzpEQXeQQQkoiycB+gUy8mr1qm/QRjWuHrcsAHCWDHnM3+qeVWh6 kXSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U/r3NZCa; 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 v13sor886749ljj.66.2018.04.12.04.15.10 for (Google Transport Security); Thu, 12 Apr 2018 04:15:10 -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=U/r3NZCa; 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=1DBONOHXXjX8Kaigqhj/3cmJ8OlitzG5zYoiAvHZb/g=; b=U/r3NZCa8C12Vf+V2Y2qSJLRsq0st4u+0Qx0lsIRU8x8Vm1luctSw+eJ3gPaGTcLSd TOTI29yOiI/e3UxFMTk/1QrydsLBBglFduaENCpCVgn1SIlU0APEY65uskvtbuHIOLFx g4yxfbdPrRO8ykq3EYCUGFS8g2EHhdxeTtvd4= 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=1DBONOHXXjX8Kaigqhj/3cmJ8OlitzG5zYoiAvHZb/g=; b=Y9bcYif5X4OywN4Z76AKRNSru5ETE1wgrTTsDAy4+wbXRVYRjpwTdO/PjIBsBYh8r3 0CGevvgLXlZ8bl/6IvZefLRSWfVufSzi3F3tz57V7DOKJKnk+wF46wkHYWvL2al57BK2 YGcjUklPa0lxVdaAiHBrlHZrR05HTn4rR2upDuVTrmDADRPE9STDvgmEkWSJP3VKUj6X kOTtUncWD7zz1K1iHUNZQLbhKWeiUo/iyDbA7KolqfKuK8rQ9Yd62rV2Up9B+Q5vQ8mA J/Rhm/LIi79IWVdxa30DHdLI5ZpvETgsZSHqo1qiOrqsbaWG/3CVjn6dB9wcfMd+SZ+9 /r+w== X-Gm-Message-State: ALQs6tACk7nPCZ1jpaqAsVeQ8HfZbwiDmCezvQs51raIg3a0jzEiS6jA +liR8JkMs7YHv4Ggra1hX9YrgOFP X-Google-Smtp-Source: AIpwx48Sp/tWcEjzQqkAvrBqtKm9Rg/ZeTNvMLFDQdCNp6JnMaDEqmLfajm7tK3Pe3AwidGQ9kBB/w== X-Received: by 10.46.131.86 with SMTP id l22mr387680ljh.82.1523531710097; Thu, 12 Apr 2018 04:15:10 -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 r29sm543187lje.72.2018.04.12.04.15.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Apr 2018 04:15:09 -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 v7 18/26] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Thu, 12 Apr 2018 13:14:23 +0200 Message-Id: <1523531671-27491-19-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> References: <1523531671-27491-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/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/psci.c b/drivers/firmware/psci/psci.c index 3888100..e8f4f84 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 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