From patchwork Wed Mar 13 08:36:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10850939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E29E1575 for ; Wed, 13 Mar 2019 10:40:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26052299B6 for ; Wed, 13 Mar 2019 10:40:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24667299C4; Wed, 13 Mar 2019 10:40:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3B45299B6 for ; Wed, 13 Mar 2019 10:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=JJAQqFp1dX5s+QmJQcAmUNXZDsa6V0HX7yS0I87HaP8=; b=XmOjc0ateqxdKEeTfo80OcngNP S0F45lGF956N711XFIstcBnwWdbvu2XgDxBOY/6m6CVU5Qrl0z8DuhlsHWk9Ev+9YVK8I0WihCFgF M/13GFZ0FK9QYXxD/sjkGq2AllU8jvagZpnvrubotuGjexngLnnb8orZeaoaf29EBxB056dnfmumO psN97Ex30DdsWxAprhmnudKKMxRNqCc5PILB2qwR/kA177iYB05ZUc+hP1Bc1pumbK4hIcQQeHTZB PGcVqEQz4kBqOfZ7TY4mmWxIjsfpnd2nbBvZmdX/5kdT66C+4DsVKUh/TPixhWB0nRJaZYxYec2GH fUWwGQFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h41Ja-0005mI-2h; Wed, 13 Mar 2019 10:40:50 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h41JW-0005lz-DT for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2019 10:40:48 +0000 Received: by mail-lj1-x242.google.com with SMTP id t13so1081316lji.2 for ; Wed, 13 Mar 2019 03:40:45 -0700 (PDT) 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=LNxQpIwxT1JmfOXeE0uJOYnKkmng1Hu5UTgquERxi8o=; b=tZIJkwo07TH515pYyq6fdHyj8nNsF8M7volhDW+9uQJPXoCKRDiow3wgQxWyGbI/gZ bnk3xttzrBR2ClU+9V3ogfOgLSJd1LYML8VR08sqhCk6NALiUz4Vj9m5wsphnqDlarEo 8XaE2kI5j97n0znAGpiTWmDDQTgIbvEX4BMsJQH9k1DpD0pofARDiNFSwa5/N3i/V+LF UGGgy7Vsd/k3Nb2/qra1YmdkgB+MmpR11S/bEI/2fKV9NGTGY85b5bfhNebj1VRwhu8Y lp+dmpbDpNkHXHFTL3I9BLxgpbBVuiSiKP5ct6xk3ka47aUwqSYErW0XOVpggsksUQJ5 Djlg== 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=LNxQpIwxT1JmfOXeE0uJOYnKkmng1Hu5UTgquERxi8o=; b=KuKRrdFQHOcFnJQ10YecEIW4HPwYCzCr7NHiKD+UxtVaCnUwkDc5cuSOnqRHIlMYSn 3pPr4cGiTvwXbkcR1jRR6s5jCSS62mbBSlMF+64P+dVbrUhRtX3NI+hKjOFmR0Mn0fXA glYyJmewrYrt4poN27Ys1Gta1u7cSSdLIHvHQE8e9AFnGWfBUv13pyu+xTWEVXkVihVl W2bfQgE8Y8ZDHOhjdVITTanE8XzcY/mKHwwGBOsEazLJzne5DCrUUajJftjsZ+JnbqKi aFI5rt/wjU4P7v5nCC2BzVLPnb+5Vk+jlzbAfs31cnjpQvpZpujBIe0oOPV/WQ9E1zxl N6sw== X-Gm-Message-State: APjAAAWVXtGnO0D+dZV0o072wz/z+FVY1yYyRv25PXeN7ERLSEJHG5eM bD62lcO62QmhHovm6bnnCDhAPvlFIOY= X-Google-Smtp-Source: APXvYqydQnmbrxfgJzVE90WxzKNbqOoGEA003+fAU9hhkh3M/4lap/JSdMvH1gYnL14y6xthxlUlQA== X-Received: by 2002:a2e:9dda:: with SMTP id x26mr22258657ljj.53.1552466226627; Wed, 13 Mar 2019 01:37:06 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id a23sm1707716ljd.20.2019.03.13.01.37.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 01:37:06 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Lorenzo Pieralisi Subject: [PATCH v2 1/5] drivers: firmware: psci: Move psci to separate directory Date: Wed, 13 Mar 2019 09:36:55 +0100 Message-Id: <20190313083659.7100-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190313083659.7100-1-ulf.hansson@linaro.org> References: <20190313083659.7100-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190313_034046_462264_89DFE195 X-CRM114-Status: GOOD ( 14.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , Sudeep Holla , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some following changes extends the PSCI driver with some additional new files. Let's avoid to continue cluttering the toplevel firmware directory and first move the PSCI files into a PSCI sub-directory. Suggested-by: Mark Rutland Signed-off-by: Ulf Hansson Acked-by: Daniel Lezcano Acked-by: Mark Rutland Acked-by: Lorenzo Pieralisi --- drivers/firmware/Kconfig | 15 +-------------- drivers/firmware/Makefile | 3 +-- drivers/firmware/psci/Kconfig | 13 +++++++++++++ drivers/firmware/psci/Makefile | 4 ++++ drivers/firmware/{ => psci}/psci.c | 0 drivers/firmware/{ => psci}/psci_checker.c | 0 6 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 drivers/firmware/psci/Kconfig create mode 100644 drivers/firmware/psci/Makefile rename drivers/firmware/{ => psci}/psci.c (100%) rename drivers/firmware/{ => psci}/psci_checker.c (100%) diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index f754578414f0..e1385f47d4ac 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -5,20 +5,6 @@ menu "Firmware Drivers" -config ARM_PSCI_FW - bool - -config ARM_PSCI_CHECKER - bool "ARM PSCI checker" - depends on ARM_PSCI_FW && HOTPLUG_CPU && CPU_IDLE && !TORTURE_TEST - help - Run the PSCI checker during startup. This checks that hotplug and - suspend operations work correctly when using PSCI. - - The torture tests may interfere with the PSCI checker by turning CPUs - on and off through hotplug, so for now torture tests and PSCI checker - are mutually exclusive. - config ARM_SCMI_PROTOCOL bool "ARM System Control and Management Interface (SCMI) Message Protocol" depends on ARM || ARM64 || COMPILE_TEST @@ -270,6 +256,7 @@ config TI_SCI_PROTOCOL config HAVE_ARM_SMCCC bool +source "drivers/firmware/psci/Kconfig" source "drivers/firmware/broadcom/Kconfig" source "drivers/firmware/google/Kconfig" source "drivers/firmware/efi/Kconfig" diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 80feb635120f..9a3909a22682 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -2,8 +2,6 @@ # # Makefile for the linux kernel. # -obj-$(CONFIG_ARM_PSCI_FW) += psci.o -obj-$(CONFIG_ARM_PSCI_CHECKER) += psci_checker.o obj-$(CONFIG_ARM_SCPI_PROTOCOL) += arm_scpi.o obj-$(CONFIG_ARM_SCPI_POWER_DOMAIN) += scpi_pm_domain.o obj-$(CONFIG_ARM_SDE_INTERFACE) += arm_sdei.o @@ -25,6 +23,7 @@ CFLAGS_qcom_scm-32.o :=$(call as-instr,.arch armv7-a\n.arch_extension sec,-DREQU obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o obj-$(CONFIG_ARM_SCMI_PROTOCOL) += arm_scmi/ +obj-y += psci/ obj-y += broadcom/ obj-y += meson/ obj-$(CONFIG_GOOGLE_FIRMWARE) += google/ diff --git a/drivers/firmware/psci/Kconfig b/drivers/firmware/psci/Kconfig new file mode 100644 index 000000000000..26a3b32bf7ab --- /dev/null +++ b/drivers/firmware/psci/Kconfig @@ -0,0 +1,13 @@ +config ARM_PSCI_FW + bool + +config ARM_PSCI_CHECKER + bool "ARM PSCI checker" + depends on ARM_PSCI_FW && HOTPLUG_CPU && CPU_IDLE && !TORTURE_TEST + help + Run the PSCI checker during startup. This checks that hotplug and + suspend operations work correctly when using PSCI. + + The torture tests may interfere with the PSCI checker by turning CPUs + on and off through hotplug, so for now torture tests and PSCI checker + are mutually exclusive. diff --git a/drivers/firmware/psci/Makefile b/drivers/firmware/psci/Makefile new file mode 100644 index 000000000000..1956b882470f --- /dev/null +++ b/drivers/firmware/psci/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 +# +obj-$(CONFIG_ARM_PSCI_FW) += psci.o +obj-$(CONFIG_ARM_PSCI_CHECKER) += psci_checker.o diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci/psci.c similarity index 100% rename from drivers/firmware/psci.c rename to drivers/firmware/psci/psci.c diff --git a/drivers/firmware/psci_checker.c b/drivers/firmware/psci/psci_checker.c similarity index 100% rename from drivers/firmware/psci_checker.c rename to drivers/firmware/psci/psci_checker.c From patchwork Wed Mar 13 08:36:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10850865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6343C17DF for ; Wed, 13 Mar 2019 10:14:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C522287EF for ; Wed, 13 Mar 2019 10:14:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40A2828A2D; Wed, 13 Mar 2019 10:14:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D2B6287EF for ; Wed, 13 Mar 2019 10:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=JkUOk5JCUcKAL57FCXH2lnGJFvgZn/t9W1yOv9i2Nd0=; b=L9yhy/KzDlJ8N6LaEamCX8Uu9h f3oAO0v5jMOFSZ0AkElhK16aayjQoNJMabeanCzR35eLHAYg0RrMLh5M7Od0440CJKzFcXVT+OFK3 n5ZbEW6tqY9jWeQzGPtpWpR5mD6AAJo55jkbAotk2n3vAs4azczqy/8/eOm5KSnU2NP5RxkUKRYT8 1+jD4xFkj2msczwbLVz2894UVEDgd63WBXkDMOGt8nFPFpUDWS6rozC1sbf23WCOYjeRpHt8/aXzE ONZoyJZNW0LOmqLNCsSw2RY9YluWRsKUXDPuBiM5KcR6SK/E6YnzE9b9eh7k+vQS842EqVUXSc/9i jLlIhTqA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h40th-0007QM-VO; Wed, 13 Mar 2019 10:14:06 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h40oz-0000Sq-Fg for linux-arm-kernel@bombadil.infradead.org; Wed, 13 Mar 2019 10:09:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wXapuDJ/TxdZdSmwteecFqdWBuQB0h5GI4Aq0atblIM=; b=JF+1bHOVdS9bKUrDj0HekKhUw Tj1QAnSmyS7DbkwRGNICve2P4v5V0aycTfeGgLUu0PZE7FaIPKSrEubTrZL0XI8F8Rd8KgwQFBQ/3 I1xYh61fqAYxPlEZfsIZiJhoIhEIDFGzRrSCfeGvthH8n3uEOHyEnFM6NZi1culoRv2NfdGGv81ZX DANpazURTBT1yDsIjW5+bdhwnM8sno6BnzMDttTWBw87XufN0Cuca1Q6bKH+YLo96/vfi21oqYzqc sBsRE3e/SAlBK0l3gVldQEM/BN4ZIYlp9sS99DUJPcDf/SK43hxT+BcpejxbrgrbYilhIbhbREU6z HM+ySLSFQ==; Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3zOF-0003B9-O2 for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2019 08:37:33 +0000 Received: by mail-lf1-x143.google.com with SMTP id y18so821463lfe.1 for ; Wed, 13 Mar 2019 01:37:31 -0700 (PDT) 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=wXapuDJ/TxdZdSmwteecFqdWBuQB0h5GI4Aq0atblIM=; b=UG03IFrKLS7qPDvXkQBipZ6olkkLjZGtf4y+g0vP284yEVpeIs/wpf6sRS0z0823Xs sETGgK3VJV+7FMAU6xhjQNBGEZKt9d+iiMycQNBY6+5PsbGyEpz5erpt6rIAMtNMvWIe 5R56zDmn4LfUEBoJRdEmB4THA3UvcoySX5zw4KjUHJ2rbMcgmBGxczxp/HY6KfTQiETz 9egy4TJVt/uT2x04XyYl5gfs26iHyNJVLRsGCjzT1grANTqHgBw3wKejcu8diRfVLP3+ OV8vxv5QiKTtks1ZrMb9eGrhKO3IvPE3AyH15KJMQFgkILQY/HDJHssAOoYlBUIutF0q vLzg== 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=wXapuDJ/TxdZdSmwteecFqdWBuQB0h5GI4Aq0atblIM=; b=Vj8R1RTxRlAPiMX6KFLyeNOTjRdlYUGCkx+mYk8cZMhL3/2GLAbNj+8BEUBtECDmj7 P4a56SaZEz/qlrfKPdT02Vb4PXKEjUtnoVJvP/6NOeflTVQePH6KebeORS7U/Hc3aW4i wrNfiXOJkxd8vga6RQn+Ke8+VX34uCMbppfJPp9+3+Cqvc9y3nRt6t8GcVXRtwYaCxfS rWsgGitHCDgMOKpo3MI4kawbgCaXowKF3V/RwA6wnQ73UAA8W5XKVXJB9CknFkPoTpIR 0VylcGye8lkorbAgdLZDTjvs/v5PwjTs75h6QWEyY+U1Zd5crwJOZeyr9JMPSXrPt8Fj ZK3w== X-Gm-Message-State: APjAAAV+MQBv9pvzgcELblpXEBetnSA0Bf1+DdXms1XQnS0L1LNZUHQO JhNEG1UGdWZiMuDEs4OsncXBJA== X-Google-Smtp-Source: APXvYqwxT83yk6AKKclQYQDujXakyrFGedrnLmXS0kqchel5AWw9xTEJiEzzask6eDWiGid8xcWJRQ== X-Received: by 2002:ac2:4355:: with SMTP id o21mr20467825lfl.85.1552466228116; Wed, 13 Mar 2019 01:37:08 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id a23sm1707716ljd.20.2019.03.13.01.37.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 01:37:07 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Lorenzo Pieralisi Subject: [PATCH v2 2/5] MAINTAINERS: Update files for PSCI Date: Wed, 13 Mar 2019 09:36:56 +0100 Message-Id: <20190313083659.7100-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190313083659.7100-1-ulf.hansson@linaro.org> References: <20190313083659.7100-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190313_083731_861254_187DD8C0 X-CRM114-Status: GOOD ( 13.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , Sudeep Holla , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The files for the PSCI firmware driver were moved to a sub-directory, let's update MAINTAINERS to reflect that. Suggested-by: Mark Rutland Signed-off-by: Ulf Hansson Acked-by: Daniel Lezcano Acked-by: Mark Rutland Acked-by: Lorenzo Pieralisi --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a419acaa01c5..97dcec6fc877 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12257,7 +12257,7 @@ M: Mark Rutland M: Lorenzo Pieralisi L: linux-arm-kernel@lists.infradead.org S: Maintained -F: drivers/firmware/psci*.c +F: drivers/firmware/psci/ F: include/linux/psci.h F: include/uapi/linux/psci.h From patchwork Wed Mar 13 08:36:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10850927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F6191515 for ; Wed, 13 Mar 2019 10:34:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82C59296C2 for ; Wed, 13 Mar 2019 10:34:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 729B929988; Wed, 13 Mar 2019 10:34:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 110C6296C2 for ; Wed, 13 Mar 2019 10:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hNUewP667wAlTMwpavedQ2d4mOOCvpEJZNFndRqXM5s=; b=JCmam9GiA1cwfPnyJxcTAzTlr7 cr8wzEv8UU8txfES6MspPb+pOLbM594o2VzToZbdSeIPwCXwqzrgKjifl8+eKJlpQdGKGobGfhM50 aS5LQ56ZF35KSdZuRAzAxVMTLGTxwtWJ8QFLlHiF13/8hO+feZ/fzadrv/1Ik/Rdm0w+V0UP+4NrF wJfcfUrCK6W5jeENqmBmXhfjItvtamaaeXiC1JN7MN9Vq2bTs9UQG7R1Co/5OUa7Mv07r4AryPWEg hUz6yoLLLhlTgvnBhraMscjTCiwIH8OhShNuMcZB4v+ZXkjZaYe+TH6pa4DdekWjYL+dtGG7vXRab vCWyVC0Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h41Dk-0005gM-1T; Wed, 13 Mar 2019 10:34:48 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h41Ae-0001eR-T4 for linux-arm-kernel@bombadil.infradead.org; Wed, 13 Mar 2019 10:31:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fqLAcdPj/NLZOrfZZI3kgT4b9oSplDLhcdYfEWYk7f0=; b=KO4brJdRlV2ERGn4UWPKCRi8V CFLfvkdXGcf1SGbi0R4A2lbwS4654ImJLVTVPT2ssRk0WA9Woxankrr4eQW0CdIUKBfz1TTX6Wxln roazcOCXnXWXqeRF5nCDoiYU04XeWilLwOapoonQbwKT/J09gPHECAmOSdYmeOTNTk2qX5M4VijlR crVt3uwOLIKJ/Mg8EvPzQOJrznr+zqVHegGpkcv2YvyrduPjfrppIEL40gM3jsFj5VVFrfumzEOip rrN7JmlB1F4Nw5PLOij5tpqRIVOKl+5kw3T4WQFEtuJrdUEquJFQiFgWqrz0Lkl3uTQWKj+UKkRPA Wc12BI4lA==; Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3zOL-00076s-PL for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2019 08:37:38 +0000 Received: by mail-lf1-x144.google.com with SMTP id v14so267009lfi.0 for ; Wed, 13 Mar 2019 01:37:35 -0700 (PDT) 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=fqLAcdPj/NLZOrfZZI3kgT4b9oSplDLhcdYfEWYk7f0=; b=PZKTNnD2nwwHzJ7qoJoJQv4NDheskpbJ1YxcSM9eJF4owUl/WfZng6DstF/znQ8x8B pDEo/pJ61thVr5M/+qqLUAkj0+OBtXQmLuwrGxf8WSVHw+IiaOlDqV1fsXTjNCKgAnQb TJzEXazOl8YtWqn5cOuHlqSFQO2jQXIoQrLaXx9VcX1FNUp8cauGDy/4rLGCUvJ8sxZ0 yxM5fF/CvN6YRxRRiq8FvpO/JGQb9QX2B1LfzOKTw7H1qQlBUuh408M+G0j74Gxi+xsP Tj/lfMCSQb/y/txQziLhAwYHSbtcWmjdMsHdd5LP0Jn9TS5jwo4vy2Z9wpRpmN50a57J jIDw== 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=fqLAcdPj/NLZOrfZZI3kgT4b9oSplDLhcdYfEWYk7f0=; b=DFjzU2vbOk36eCvfWvN3jzBYj9iJzs7wj4KCixnlsUSImLQX0RZ+Brq7KdRu2i76dQ bCI6z1li/2FGftY655PVisN648I7Ttk/5dCQTC/lXJVv+UH7L+V/e8dNhbXSPq+NemYb rBONwpVwzdYIxdx8Qyjj+rMXIh20A8wc11IAXCkPv+CquZOhDA85TX/lPSJuSae90Got E028mLXnn2UjZcX/1nWxB71nK/B2lcT6g2HOvXk4b9hyMOlehKHMlGcT8e7ipt42qU/j y2/hThjhtkzf3WhS+Psp4H1DqSNTsPNKr3DUzbEMQ4Oxy7HI+hY0d94InJ9JaBKMzmxm v48A== X-Gm-Message-State: APjAAAWTgll7To3qC0NpKrpMK1gAV4gL2yHM1sfRu65L75sTp9C+fn6t a/i2WyFwfriUbFg3CSScNCdTGw== X-Google-Smtp-Source: APXvYqw0YNNaw6inULtc2yUsTyMmfoNTgmT4UYRb7G0yq3HhG73gLEOmrT21PpBm2ilWoX4z2aWjGw== X-Received: by 2002:ac2:51a1:: with SMTP id f1mr1139636lfk.25.1552466229393; Wed, 13 Mar 2019 01:37:09 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id a23sm1707716ljd.20.2019.03.13.01.37.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 01:37:08 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Lorenzo Pieralisi Subject: [PATCH v2 3/5] drivers: firmware: psci: Split psci_dt_cpu_init_idle() Date: Wed, 13 Mar 2019 09:36:57 +0100 Message-Id: <20190313083659.7100-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190313083659.7100-1-ulf.hansson@linaro.org> References: <20190313083659.7100-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190313_043737_854941_F0F4A804 X-CRM114-Status: GOOD ( 15.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , Sudeep Holla , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Let's split the psci_dt_cpu_init_idle() function into two functions. This makes the code clearer and provides better re-usability. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson Acked-by: Daniel Lezcano Acked-by: Mark Rutland Acked-by: Lorenzo Pieralisi --- drivers/firmware/psci/psci.c | 42 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index c80ec1d03274..9788bfc1cf8b 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -270,9 +270,26 @@ static int __init psci_features(u32 psci_func_id) #ifdef CONFIG_CPU_IDLE static DEFINE_PER_CPU_READ_MOSTLY(u32 *, psci_power_state); +static int psci_dt_parse_state_node(struct device_node *np, u32 *state) +{ + int err = of_property_read_u32(np, "arm,psci-suspend-param", state); + + if (err) { + pr_warn("%pOF missing arm,psci-suspend-param property\n", np); + return err; + } + + if (!psci_power_state_is_valid(*state)) { + pr_warn("Invalid PSCI power state %#x\n", *state); + return -EINVAL; + } + + return 0; +} + static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) { - int i, ret, count = 0; + int i, ret = 0, count = 0; u32 *psci_states; struct device_node *state_node; @@ -291,29 +308,16 @@ static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) return -ENOMEM; for (i = 0; i < count; i++) { - u32 state; - state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i); + ret = psci_dt_parse_state_node(state_node, &psci_states[i]); + of_node_put(state_node); - ret = of_property_read_u32(state_node, - "arm,psci-suspend-param", - &state); - if (ret) { - pr_warn(" * %pOF missing arm,psci-suspend-param property\n", - state_node); - of_node_put(state_node); + if (ret) goto free_mem; - } - of_node_put(state_node); - pr_debug("psci-power-state %#x index %d\n", state, i); - if (!psci_power_state_is_valid(state)) { - pr_warn("Invalid PSCI power state %#x\n", state); - ret = -EINVAL; - goto free_mem; - } - psci_states[i] = state; + pr_debug("psci-power-state %#x index %d\n", psci_states[i], i); } + /* Idle states parsed correctly, initialize per-cpu pointer */ per_cpu(psci_power_state, cpu) = psci_states; return 0; From patchwork Wed Mar 13 08:36:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10850863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 478DC1390 for ; Wed, 13 Mar 2019 10:13:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 312B929A3C for ; Wed, 13 Mar 2019 10:13:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F55629AC2; Wed, 13 Mar 2019 10:13:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D066329A3C for ; Wed, 13 Mar 2019 10:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=n6fbf9ciMjmkAg4xL11yO+mwmZUguqagvB2Lm3l1xUw=; b=bUOspx8T8HittxP/VQuduEMp3a GPvjtpC2lldluHROEGxiBfDX0ihipyogslRAcQBADk3ZUMtyfT0MAu6+PORSmXgGoUcekZIq6LvhZ 3iSlldLKk1g0dAZY6X8ORxB4WeNqScAzzyVkSUvhj+A7z/DaSLoehqzHGK4vFdW4L8wxSOrAbsh4W nYDx6NHLc9DPUNYOLjA7Bk8nC1fkoA0r6rIAB5ZiGcRlkd8HwUiDnnk4yXQX6Ql1i0urv+2yHVQre ArpauXn7UbUJf+bzTX1nKxa0AkWucugL0vRupjoqcDKimw89vqqzQyIQZzU6DWArrC7c52ZvO8l1Z sNAlOeIA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h40tP-0006rc-HB; Wed, 13 Mar 2019 10:13:47 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h40oz-0000Jq-Ee for linux-arm-kernel@bombadil.infradead.org; Wed, 13 Mar 2019 10:09:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/i1P7RcZS0nPamy0F7apI0HkwNW2ZATDEDVSzcyhElI=; b=if2y1B7xhf6N10hg1ZDM9ALPq iypqcIvsqAOza0QU3kzgBwjkuVyTw2NYTTQoO7CMVB78VbbA+a6a3FM2MCPnRiwm1ExXUB1HjcroA x4fxrIBTG8nk9maFmglF5EZ35NH0CIA+GgKehLrbsHccUtklHZoE+UNlHbiSTn1MQ/Omsd2R3LfzD /knXtOehsZZemaMhxZeXox3z9ZywJpwx2vCuyqKu6vr8SzeBOc6gFrZKA6hdwnBBiEWHmBMR7wvF+ 2cRH5wcrKFGsqwVbOOM/j/fchkXnIqvLrTrWbOU0JXAr2Do+1ijtA/kL4vDFi9tQpOVnL8+KFI92x 5PYX01ufA==; Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3zOJ-0003BQ-8V for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2019 08:37:36 +0000 Received: by mail-lj1-x241.google.com with SMTP id z20so738021ljj.10 for ; Wed, 13 Mar 2019 01:37:35 -0700 (PDT) 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=/i1P7RcZS0nPamy0F7apI0HkwNW2ZATDEDVSzcyhElI=; b=LNCVQhFpUnIOYlMOLUOr9mSM5ufWoZgXkbtMcNfVpkPXTftWr8Gw2KduEBb2OJid0k ZgI5gQqetdcd8ZwZ1dlP8lp+5epDmkQqxiM58kUOir8YdPU8LMaLu9ZgY+uGi/9ErKiD zEAy7Ub8jGCrBlsroVQjdMIu8iAXfQhexCgYPSAekZIXCy4cAX3QVSDP3Vf6oS4pm0i7 RFkyE2vlRtqKEUq5AQJgmmnpEzPpn36k1ycO26wqVnn0ANSUeg3NhwmtMtoMy151QESE JJ03Nj4v4PLn9wg+fjV/QDj3/tUG1hFiqfV8AyxkgpkWyB1OCeoj83ql5ucPdrULMyg3 gtcA== 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=/i1P7RcZS0nPamy0F7apI0HkwNW2ZATDEDVSzcyhElI=; b=LRqW3EZKFekAciEX34D4CKjG3X4LPXGZhsCxQZjNfeBQPVPnKFh0XXQpsg9W/q749y tZz/U1n0xAp/gp0YvXBC0EsqupcaB6oFpkJV818HlKI84Du1HgBxqEJPbVYAtrofyVnj 6+MwOautdKEmZ+OZw/0WpScJ+9ECJ5wCw1HjCXILWYHFSvfLT0JqEKls/+04ygopqbba 2ssnQLOzzx+uSR7spYWw/OaIQP2Cc8IrHHe6dOEUD+nzGSi8CkzuXvLUof5i9TFeGNwi BVe4ZHtOE7IrRfS4/DdQnyuIaCMfglKDGbrPULl7NkvRFvR2bJZn7mfBYjOPcc7ynDAz F/8A== X-Gm-Message-State: APjAAAXAi29EdUACBiwvTJxPl8Q8SrtMiyqqerPwmZ5Kq7qq7t2XZJBR 8Db9W3l8eoBVElH8DTzXwvWjsg== X-Google-Smtp-Source: APXvYqyz0xVl/9wVKjxyA7k3YPcw6zwyqcIHTFAw+4Quuz1CFeIEK39/+Z84eyG9JSC3B7vo5kED9Q== X-Received: by 2002:a2e:80cd:: with SMTP id r13mr22164205ljg.34.1552466231095; Wed, 13 Mar 2019 01:37:11 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id a23sm1707716ljd.20.2019.03.13.01.37.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 01:37:10 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Lorenzo Pieralisi Subject: [PATCH v2 4/5] drivers: firmware: psci: Simplify error path of psci_dt_init() Date: Wed, 13 Mar 2019 09:36:58 +0100 Message-Id: <20190313083659.7100-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190313083659.7100-1-ulf.hansson@linaro.org> References: <20190313083659.7100-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190313_083735_337168_D018F043 X-CRM114-Status: GOOD ( 15.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , Sudeep Holla , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of having each psci init function taking care of the of_node_put(), let's deal with that from psci_dt_init(), as this enables a bit simpler error path for each psci init function. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson Acked-by: Mark Rutland Reviewed-by: Daniel Lezcano Acked-by: Lorenzo Pieralisi --- drivers/firmware/psci/psci.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 9788bfc1cf8b..e480e0af632c 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -609,9 +609,9 @@ static int __init psci_0_2_init(struct device_node *np) int err; err = get_set_conduit_method(np); - if (err) - goto out_put_node; + return err; + /* * Starting with v0.2, the PSCI specification introduced a call * (PSCI_VERSION) that allows probing the firmware version, so @@ -619,11 +619,7 @@ static int __init psci_0_2_init(struct device_node *np) * can be carried out according to the specific version reported * by firmware */ - err = psci_probe(); - -out_put_node: - of_node_put(np); - return err; + return psci_probe(); } /* @@ -635,9 +631,8 @@ static int __init psci_0_1_init(struct device_node *np) int err; err = get_set_conduit_method(np); - if (err) - goto out_put_node; + return err; pr_info("Using PSCI v0.1 Function IDs from DT\n"); @@ -661,9 +656,7 @@ static int __init psci_0_1_init(struct device_node *np) psci_ops.migrate = psci_migrate; } -out_put_node: - of_node_put(np); - return err; + return 0; } static const struct of_device_id psci_of_match[] __initconst = { @@ -678,6 +671,7 @@ int __init psci_dt_init(void) struct device_node *np; const struct of_device_id *matched_np; psci_initcall_t init_fn; + int ret; np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np); @@ -685,7 +679,10 @@ int __init psci_dt_init(void) return -ENODEV; init_fn = (psci_initcall_t)matched_np->data; - return init_fn(np); + ret = init_fn(np); + + of_node_put(np); + return ret; } #ifdef CONFIG_ACPI From patchwork Wed Mar 13 08:36:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10850861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C44AA1390 for ; Wed, 13 Mar 2019 10:13:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC5B12923B for ; Wed, 13 Mar 2019 10:13:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A776B29A5D; Wed, 13 Mar 2019 10:13:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4AE1A29A39 for ; Wed, 13 Mar 2019 10:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=EMq37olOPA83EAQWuNB8Wxr0e6l0oXIGgGRIPnuPKvc=; b=To3uokoFf96iI4p0+5GA1qkWI3 K6hUaT3N48VrMxHj5cqRiF7cigyi9iQZJ9ikxdbaMkni0IGyWtFVv79by162j/FbPI66UtJuQByIu XRDiCw6uc/iNuJu89FFpOUlIpHebe2FqYfpesJk16C5+Wsnkd2GTMNpfyMeT9V4O/lHocI/WHY5dx k4I9UKQ9X1tOV9+9Hvzu/fuj3YoYLGU30SSeOw2ct1Y2jGNoMG3Bf+kyam9P5QFt4GAdmR5GNtpLh oqeHicPEpY/lPjwRS72iYySCXX7a0g+DpsLrp/wnqZAYFhc/Mw7TCWFRRodkFWXH8GKOvHzXK4YV9 5AK1NzZg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h40t1-0006Qm-GE; Wed, 13 Mar 2019 10:13:23 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h40oy-0007jP-Rb for linux-arm-kernel@bombadil.infradead.org; Wed, 13 Mar 2019 10:09:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=49oAUcefl7Qs60t5vd0C3ulsmkkBE/5vo7x8P2YQaHM=; b=b/8vSH7ipnPMKzDSAl3efRjv1 +yD2HeYoWWcvnNabKI5BLmVq27coGLsXnVxa9QFyO/kKl5JzSI/2LD57g1ou/1AihMCj1dRoej3aY 3hezFt8sI523qTKeEXn8hoCgkvBkP3k141rkIxiso+oPGNPNsZ34k6z6arceD7T8DrYv1lsQPaf+1 mHYvWIaKgC9m6D8dckkBJ/BUD/5/gMnupV7FhVNSFDvWFa6H9EZ4Dshxe3kj8y6JD6refQSoJZCh2 Q2DWEFOpckQXP1IWnMrLoAld/IT9MWRWRHffxxtaDypRE3FyRHMgQkh6O0o5v46P/ZFBheUuUQq6K xkw+YSRhg==; Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3zOS-0003Bl-0X for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2019 08:37:45 +0000 Received: by mail-lj1-x241.google.com with SMTP id w6so747792ljd.7 for ; Wed, 13 Mar 2019 01:37:43 -0700 (PDT) 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=49oAUcefl7Qs60t5vd0C3ulsmkkBE/5vo7x8P2YQaHM=; b=AaW900pJqH+ZvraqyUDS8w9k7SNv6l9CJOI6zb+S6ZGSC+ZtfC3ivkC+d1hO8U7zeF vWZvnMcRTcLkzbe0HB8fZu9dSaZQtPfSiFc+vkeFKKEHasb4AkRFa8BwFAiTGsFw7wHw u5wXvEwgKu2yP6sjiYHUjL63Nw4xsq2+SC5c7SIuURaiClnK8+SUcTg54Inu2H+FkAm4 bHO8PPsXCEW3QDaaJ34JrQlPQ9GBrHBj7CtfWCIQ4zM6cXVgj41lCL2Jak84pnuXvkS/ 5lEKE86L+2wi3J2SNJmSryHE+qBIqdZCpyD3Xdx0VLeVRenmgE6jVZeqboxv0xzU7/Uu mj4A== 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=49oAUcefl7Qs60t5vd0C3ulsmkkBE/5vo7x8P2YQaHM=; b=mlRD/ZS3yRKjvoVXRq/nNPn3HpQRqIGRlsEz/R9OhjV/vLPGUirX7RLxp94HKs9wmk ouARUsoQfF8E8VmrMffk1EMtN0s9U29rwXC38tq4pR/TYCDNm0y2exwrxQmSonCIzfCO oDUi5i4NVos0KY1BGKLcHkVVSzL8ENASDRnH/j9ffzskSikLqYIgRdp5q/BO7xOdXblj 8lud/PSMSQ4jevwpkIkf5K6LB7ASp/Bh05CH7FU+6OlJjbjhpwj5WJjQ+Ov1/PmOgCLC QkICs7BYsvOgYpLZ8Ie7h6YVNeUfQexFxVToAy4SaKarDYX++irXDt6/4TbMZB+e6o/l yCXQ== X-Gm-Message-State: APjAAAWrdHrJgU2/xvJyEVxKSV1gEb3QpZvp0sI+jMFgp3KGrykFiHln fPsziaISsRHlUTqkfhPlH/ALOw== X-Google-Smtp-Source: APXvYqwM1UOmFchmb8FVNYUvMVbDbX1oYR4zYTRQUF7J3df0h9Vim0zVOeF0kvjf7PGcN1Mbj1ABKg== X-Received: by 2002:a2e:9204:: with SMTP id k4mr17998616ljg.0.1552466232444; Wed, 13 Mar 2019 01:37:12 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id a23sm1707716ljd.20.2019.03.13.01.37.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 01:37:11 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Lorenzo Pieralisi Subject: [PATCH v2 5/5] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Wed, 13 Mar 2019 09:36:59 +0100 Message-Id: <20190313083659.7100-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190313083659.7100-1-ulf.hansson@linaro.org> References: <20190313083659.7100-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190313_083744_156463_C53BF11F X-CRM114-Status: GOOD ( 18.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , Sudeep Holla , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Ulf Hansson Reviewed-by: Daniel Lezcano Acked-by: Mark Rutland Acked-by: Lorenzo Pieralisi --- 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 e480e0af632c..eabd01383cd6 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