From patchwork Thu Feb 28 13:59:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10833123 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 549311390 for ; Thu, 28 Feb 2019 14:00:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 412DB2EEA2 for ; Thu, 28 Feb 2019 14:00:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B6D42EED0; Thu, 28 Feb 2019 14:00:06 +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 6D4B22EEA2 for ; Thu, 28 Feb 2019 14:00:05 +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=PrG8EWO812e0drog8wjfIlkzGTjyIruXSlzZKZLwVno=; b=jqxO6mx1zC8uW7tRiTdO7yuE8B o6c7rhZL9QxchwJ6yOx26LYlab3Biv1tLSKLMiDsNjLXzKqz8Mj9lczJGL+YASfNwq9On4nBBghKn usMz+wwGA/LJz2VoKbDsnP2Z/a+jYxINfdgvbv5whkKo1J4dCqGwW++i1VOjMC8VK4Fqxl0FVaJe0 qBPg1ho1etU6otZCnefcVnGDkCTKmAAnTX/2p2N67p1wJw8h5Vi6d4ox7wXBDX8+xiepcLrtqTh0b 7MX3EQmD4leQ7rmCJsbhEXVQy7F9Vku1j9zddqccp5gOGqQU7TLIrdJITvGoZXmcDcHqs+qrItHCB op025d5g==; 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 1gzME4-0006o3-Nx; Thu, 28 Feb 2019 13:59:52 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzMDf-0006Na-Mv for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 13:59:32 +0000 Received: by mail-lj1-x243.google.com with SMTP id z25so17199650ljk.8 for ; Thu, 28 Feb 2019 05:59:27 -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=GI6XZmnxcYO/CY+bl29qXuso3VQMluSDkZvmK3rltbA=; b=ECdGhCwn8eiyl27bdwu/8OOk2JAEI2UoSPCIsVrC3N7eNNOSfQ2l/na89v/Lm9AwVD 0V8Ojda8kJ9Xlal+TeCeQ0r4Tbt0Bp7IF0Yd636JSJwcRZBKt7ZLUKJ2eYulJMrEIb6a Q9Whg3t6AB0qxd+TdYsJoI4h3g3BloVn1eflb5M1XEnTH9xs32iAJSF/a5cxFtY74Skn AcGhFatt+MNORl3p4bmUcp33sVPH3FkJiLX1emaeYI1Fvme3AK/VIpMi3eG7XqGGHwub bRcYjUIaZWfG9uL5VhlxW+UTrO7KDaTWU2F1T3Amxetd7eWoeNUJhf0qbm0ODJR5Nil1 Tf5A== 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=GI6XZmnxcYO/CY+bl29qXuso3VQMluSDkZvmK3rltbA=; b=e/uWEKF8OcluunBO2FS09EZ/AFhtkQhs9J2vZ/PwBEWtBkNSHiMwoez6e9YLCH+24w LSMJHSrFGnwolAvMLV/Hd6ij+ZPnaeyKjFU7y6ilNpV5xr5iNIRlpKzBRzK7/r3KeV3v Av3SuFQyD1M+SjtKTR7Su7cN5rfWjgsaERsQEs/dOtd/4SQa3Oq+0Vi0xXXDda33WuTu 0uS+coHwS4Zh1B3WJ7Wuf3FpMZr8HySURDyZt6DzxmE+iQLySklSv4aCt1w7MjOfdEDN XJqjCGMh46MBm2Ajdo4A3T/lybYVGv4eAgXnmPKfHhIZRhXB5vR5hlK76592OokVIo5g +AwA== X-Gm-Message-State: APjAAAVwADXFyti+an4rd7XCLa1eYgUST4fBQ87vqcdSbUvThHXzb8yr 7lpQ+lqfB+a5Slsf/Rlwy7kpXw== X-Google-Smtp-Source: AHgI3IbeIXk8Cl8KhHC8bomqccjeVUdmfRBg8eJwL/dSo1Ys7nWisrbAqtKKDv+6q3D0f/fTDczaGw== X-Received: by 2002:a2e:80cd:: with SMTP id r13mr4832648ljg.34.1551362365801; Thu, 28 Feb 2019 05:59:25 -0800 (PST) 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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:59:25 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland Subject: [PATCH 1/7] drivers: firmware: psci: Move psci to separate directory Date: Thu, 28 Feb 2019 14:59:13 +0100 Message-Id: <20190228135919.3747-2-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_055928_276265_FB9047FA X-CRM114-Status: GOOD ( 14.50 ) 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: Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , 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 --- 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 Thu Feb 28 13:59:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10833137 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 C10FB1390 for ; Thu, 28 Feb 2019 14:00:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8CE52EF42 for ; Thu, 28 Feb 2019 14:00:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A67202EF5A; Thu, 28 Feb 2019 14:00:25 +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 43F4C2EF42 for ; Thu, 28 Feb 2019 14:00:25 +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=fRzdKKYzAwuKCcgujC+Nf/ZmKE2kNVGoqQ6tVyE+kYA=; b=fp0hDxCEWm3YJcc/p8jWNfgXm9 HxVJcvvZhqNzQS6ZdSWlvBxv4B4U2SE03lEH+755j0d8eN+qtjpq8x9Y1bJy8zRqyVNnbeJVJjegj sP9a1ZjlV6VHik8FU4olQLSvJRjqmGquOIfc8sxlFwLwRKf/tOSRhc1b1EAreA72h04cdN4orpY0v H92ZvTYmEMS3OUHbWUJxmoHYrnEPCjVZ5b6AJQ//CD+ep/WI8IesaNUxehHYrW1QStluNq3MVAf/d gS44wZcmMquDl+LZA2/iPKOiUnNBGaOI3iuJwkdX/XnWGUk0zezbUi1kK3V/16gc/51quaK0yYRZb 2WihoiQg==; 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 1gzMEV-0008Cs-6j; Thu, 28 Feb 2019 14:00:19 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzMDh-0006Qn-To for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 13:59:33 +0000 Received: by mail-lj1-x244.google.com with SMTP id d14so17186164ljl.9 for ; Thu, 28 Feb 2019 05:59:29 -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=2BruUQQ7aW9EaagD7/EmEPsgX/D81d/9BI5IBra5MPM=; b=uqYkkokAa+r7JCLMxm0hjne5g4aALwkukVEoYxwsWieJd65XUqpe/xT05mFKyU4ETu /j7xYRxWRYy8CYwB/WOGFMUC9v7DTuYHpqNeihCKdXdTTPwZmB/9STwM1CPfCf1b5GZB 6OJ5OZ5uYtGMGi/GTVaVIIPjaEEnvJjQcb18EmCJy+x026RWta1Pd8pXfaG/uEK66fAQ /kuDTo1nGn8mTKuYcJFZHg8wlo7vlIoPNXNe0LWIm2eGVnw0G944PG+s7KkOkpSDhssW e/oT4Djp0KEcoaIuUpzFmATtlBXBfNsru9aa2AsPvvpXEZEtWw1Mq6rxE9Bqcf58N1Kx eUAA== 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=2BruUQQ7aW9EaagD7/EmEPsgX/D81d/9BI5IBra5MPM=; b=WK0wjBNiHUFKMrmvsPNDatGnxFBRV+7pb2UVgPyjZwV070o7UlFrerl6gpD7EhTn77 yJlVSU6mzjoUnJSZaFkaM6LNMO68dSivO4cfNl9EuCzzxisRc68y/2tyVLAky9wxmP0x UFt48mbl2A9iDN9BuK3UIZY2pniWTueAZrwv5vz+XYSGUAVJeivJItkwky7LaWqpEYRE 2YoLZoDqCJuperIM4ls96dE4L+lJv8tVa6Fz5bTN7T1fC3gEDsQgYCg1Vrhe80y23/Ch ockA0X6e3tCYuQGClzhMPvLlYav9A8USUOiTlCjbqoybqUBxc0C7cAlsmqyn919kM+UQ ySoA== X-Gm-Message-State: AHQUAuY93hsnSPcX3b+o7Qqq1DVwAkoqVI4fYBjBDn8kax5vON4VZcFP aWXsdAz2cASQ+Yo/A+VdNKabPQ== X-Google-Smtp-Source: AHgI3Ia4KoBvSdBieOMCmVGsDRu9l4UaY/6HlXoArsaw2oUwTLF8t/J3LQb9JhW62pMGDKeI6dRweg== X-Received: by 2002:a2e:5cc1:: with SMTP id q184mr4742565ljb.123.1551362368019; Thu, 28 Feb 2019 05:59:28 -0800 (PST) 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.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:59:27 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland Subject: [PATCH 2/7] MAINTAINERS: Update files for PSCI Date: Thu, 28 Feb 2019 14:59:14 +0100 Message-Id: <20190228135919.3747-3-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_055930_289112_0562B7DC X-CRM114-Status: GOOD ( 12.88 ) 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: Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , 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 --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 32b76cb95f57..ff998605b773 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12182,7 +12182,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 Thu Feb 28 13:59:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10833141 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 186B815AC for ; Thu, 28 Feb 2019 14:00:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 026212EF4C for ; Thu, 28 Feb 2019 14:00:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F414A2EF61; Thu, 28 Feb 2019 14:00:37 +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 9D5E62EF4C for ; Thu, 28 Feb 2019 14:00:37 +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=PymY04qfjKQ0nnW9Nfjx3dHr+uDe+Lf7Wy+12h16Gas=; b=DgZrNVOcDU/oYd4u1EAGLsZdHz j3rIWJ3rVzRwlCqiRutxJAU+ICTqy/kwoawBo/8/6Le47bBAxbJByrr4fFuA0s0MSemjRLU9U4Fn6 liua9zh/1AuT2B/9FbJ7afut9I6j9GvdZnER+CvZXfi6i3ypbqNWHzrY6WjySZ+rt8dEWrjp0a3jT e/H990GRvUbE3ND/js5/kO+rzS8SYQ2w1wno04wMX0C95c4E4bBKvNpshdKvYXHf74ZUBxkLmeirt UC114W0/MscstFvCx69uD5o+ORypz3V3UJPAoK3uP29vzfiRjKrj5xlEcWlZv3BoLCnaHRSxftUOA rXAbNiKA==; 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 1gzMEg-000067-88; Thu, 28 Feb 2019 14:00:30 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzMDj-0006TS-PQ for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 13:59:34 +0000 Received: by mail-lj1-x241.google.com with SMTP id j19so17216079ljg.5 for ; Thu, 28 Feb 2019 05:59:31 -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=XTL5kvu2ODR6s8WzbGt1Q9EGWFN00ZZECyFc5WKOL08=; b=v5dc9YJ2CfLXA88Ddg4mdr8OXTZWdV8R70YevFWUfu2VAN9Rybotd5gA5nzXDb6gT7 ZLoVqbpcCW68+/GbRxNIeO0Q/qO9KbPtG3wwIVHw/xiMXN3fm+eI9683YYbfZGfdwZ94 4KxI094X2myvVe84L6FSjJSGiwzf8aSQCuFCQKcOGtknhZ3BKbkNK30++qMcxYHYsXIJ LvLezvV4gropCpiWw7dRzW/ni27ZK0rip3bjrOw/g83OAkknUrab1jGopnDuHV+iRGIe tbP7xRud7elrzW1PRRsugDFX0ZmQhUqrwFq7W4Q95XsIG4QbZ4S9fS7eKK63VCw3QULE 0t/g== 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=XTL5kvu2ODR6s8WzbGt1Q9EGWFN00ZZECyFc5WKOL08=; b=l6grKUgAhPvRXn+dRZBjRtt4vGqDwYoraS8vt4UPpYwL23Ts4yGHEhcNrV7OLI2UYJ AKpWYa6FSIf+FAJ7qoZCCgvpJY/IbchUEYF1XlmtGDF97DZCKYNkfddYixMccvlV819P RQfManCyzpbTEKLCKJMhLZXHvVDFnFXKVmzlzVSDhqfX6ZFlCqspJXLv3ZFKkjUhBu/X l0FuTa87HdcxQLtY/B+uUilRQq0yBVvq0S6a8hoQOpeRiJBRf8E0yh1XKHVubdxXlowr EAjRIoxzthCTw+RZm30F5n4a8QV+PJvoo+oFyEyVMQIwOz+kFidW2jgNN6sLmxa+VORM b1Tg== X-Gm-Message-State: AHQUAuacxIqJFFnKuByMAQlHxiWVF98+V3ARfom1F2XYBrVEu0oghAkx prRppOXE4fFj/y1wwG23lzP8gg== X-Google-Smtp-Source: AHgI3IY2ox/XeGe6KsY5KJUJU6v/IZ2wfliDAnc848cYmdj8zrb5B2R5Xl4tkL4goYIX7vfo9L+BDw== X-Received: by 2002:a2e:21d2:: with SMTP id h79mr4411563lji.39.1551362369923; Thu, 28 Feb 2019 05:59:29 -0800 (PST) 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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:59:29 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland Subject: [PATCH 3/7] drivers: firmware: psci: Split psci_dt_cpu_init_idle() Date: Thu, 28 Feb 2019 14:59:15 +0100 Message-Id: <20190228135919.3747-4-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_055932_135024_EFF8B93A X-CRM114-Status: GOOD ( 15.33 ) 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: Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , 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 --- 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 Thu Feb 28 13:59:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10833145 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 24AA715AC for ; Thu, 28 Feb 2019 14:00:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DF4C2EF5B for ; Thu, 28 Feb 2019 14:00:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0897F2EF42; Thu, 28 Feb 2019 14:00:58 +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 CB1A42EF23 for ; Thu, 28 Feb 2019 14:00:56 +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=50fhTSOZqL7bO5IxHEYpADmi2SJ+M/lvKZf3AafLSo8=; b=biqXfojgu0DVx1GFHZDwDpBihF ZDeWUsEejsImAEskIxzz/GuawdO2+E6wlkzmsl3f3EXCkVBss2rBSHEXQInHdGCdYse+1Rp+4Mq/g lgJNxgNuqjHqQk37RQZ0Ng/cC4dqfolAX1LbAHiIHGqq2E1wIh10/SxC6ARw7p8fojipbYcZFU8ve 6vQdf8GuSzAfSY0LmnH0+AS0TmYLx3trcUf1XgO6zg27FEWvY5UHqr/d4TrbXq2PBqXC7IzaNdoRy 90TxStjiPekijvGT2k7c8+efDqPafDt1D1dO5teEpuv+nsJswNthuC7uSrujHh9QsPa3ryLr5mOiY 4x+Qiwyw==; 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 1gzMF1-0000ZP-8C; Thu, 28 Feb 2019 14:00:51 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzMDl-0006W2-4u for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 13:59:36 +0000 Received: by mail-lj1-x244.google.com with SMTP id v10so17235627lji.3 for ; Thu, 28 Feb 2019 05:59:33 -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=FA47iBYE1/jKqUXLlbljtr1jgxnROrzBgQH0oOLCPjk=; b=xt6KpU1G9lmV1j8e10sBfnzKKNq34qFfGySFP/7hgcLyp1k0oI7awNlqSc5ZB4hBPm 9kKDXb6ErSS26McY9/gBlFxZRRVJElzgwdWOrvx3xkARZgCxFraDG3kVhxkOGXsWybqf fOZnbwG/oWpxQyIfumUSqnR1Ed7wzOnxrL9TGRCNR8TwaxM/yWXwnS6NkisSdGEYUJyp OcJmBpQX6yNWydSWVEQOVgrPQ3Qn/5v/OR5WT4R+hJ+jjoH40dd2yrjG664sI3Mn0IwU wR0wxJITZUUQym0Y31vITo/WBeUIpGs9HQG1COvZN4D8FMucqACS2juk7vR8NmXsV55j QbAA== 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=FA47iBYE1/jKqUXLlbljtr1jgxnROrzBgQH0oOLCPjk=; b=OPSRK33CEnwe/HxRuRwxKarc5sBZWo3kDwg50l4F6+nE3bJa5pXfooTnv1xz/gQDIv 3nKOI/73ep/pP9xkawF0OOJIAD2oXa0JH2doJI00L7f2jANsWiXteF+k5QAwms+mI0FC fVNHw8MEc123Ke0XdYm6gYrMJ96qiRkvt5lTk4gziNfsmQHpdcr0vs+8siMCUZaiKiMW RqxJkEiXbnAV1CGxk7k4unDGAcpKDcrwtM6JUwK7rXkea46HeZj8iae4/Gh+LXmCJW9f qPrsA8ZOD1IvR0iibnVnwZ9No1A9Kx3N4qXfmkvjSSBnTp8piGtHwLUf4OKtO/E1LFC0 c/aw== X-Gm-Message-State: AHQUAubgaS0mObwUnCBCx2FfjM5GKLUIGWNd87/AArWh+mZG8KdpOIWY enkzQuthfmWInQCkbU1mRsRYDw== X-Google-Smtp-Source: AHgI3Ia5N0tWMr+1rxIh3kePdQxvG+xtPG7wKv9iWaNFa1EY39c1DCNuTvsuCpd2X+rYVZhocWIphA== X-Received: by 2002:a2e:81c1:: with SMTP id s1mr4438726ljg.29.1551362371517; Thu, 28 Feb 2019 05:59:31 -0800 (PST) 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.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:59:30 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland Subject: [PATCH 4/7] ARM/ARM64: cpuidle: Let back-end init ops take the driver as input Date: Thu, 28 Feb 2019 14:59:16 +0100 Message-Id: <20190228135919.3747-5-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_055933_377979_E1605864 X-CRM114-Status: GOOD ( 21.81 ) 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: Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , Will Deacon , linux-kernel@vger.kernel.org, Lina Iyer , Russell King , David Brown , Catalin Marinas , Andy Gross , 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 To allow arch back-end init ops to operate on the cpuidle driver for the corresponding CPU, let's pass along a pointer to the struct cpuidle_driver* and forward it the relevant layers of callbacks for ARM/ARM64. Following changes for the PSCI firmware driver starts making use of this. Cc: Lina Iyer Cc: Daniel Lezcano Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Andy Gross Cc: David Brown Signed-off-by: Ulf Hansson Acked-by: Daniel Lezcano --- arch/arm/include/asm/cpuidle.h | 4 ++-- arch/arm/kernel/cpuidle.c | 5 +++-- arch/arm64/include/asm/cpu_ops.h | 4 +++- arch/arm64/include/asm/cpuidle.h | 6 ++++-- arch/arm64/kernel/cpuidle.c | 6 +++--- drivers/cpuidle/cpuidle-arm.c | 2 +- drivers/firmware/psci/psci.c | 7 ++++--- drivers/soc/qcom/spm.c | 3 ++- include/linux/psci.h | 4 +++- 9 files changed, 25 insertions(+), 16 deletions(-) diff --git a/arch/arm/include/asm/cpuidle.h b/arch/arm/include/asm/cpuidle.h index 6b2ff7243b4b..bee0a7847733 100644 --- a/arch/arm/include/asm/cpuidle.h +++ b/arch/arm/include/asm/cpuidle.h @@ -32,7 +32,7 @@ struct device_node; struct cpuidle_ops { int (*suspend)(unsigned long arg); - int (*init)(struct device_node *, int cpu); + int (*init)(struct cpuidle_driver *, struct device_node *, int cpu); }; struct of_cpuidle_method { @@ -47,6 +47,6 @@ struct of_cpuidle_method { extern int arm_cpuidle_suspend(int index); -extern int arm_cpuidle_init(int cpu); +extern int arm_cpuidle_init(struct cpuidle_driver *drv, int cpu); #endif diff --git a/arch/arm/kernel/cpuidle.c b/arch/arm/kernel/cpuidle.c index fda5579123a8..43778c9b373d 100644 --- a/arch/arm/kernel/cpuidle.c +++ b/arch/arm/kernel/cpuidle.c @@ -122,6 +122,7 @@ static int __init arm_cpuidle_read_ops(struct device_node *dn, int cpu) /** * arm_cpuidle_init() - Initialize cpuidle_ops for a specific cpu + * @drv: the drv to be initialized * @cpu: the cpu to be initialized * * Initialize the cpuidle ops with the device for the cpu and then call @@ -137,7 +138,7 @@ static int __init arm_cpuidle_read_ops(struct device_node *dn, int cpu) * -ENXIO if the HW reports a failure or a misconfiguration, * -ENOMEM if the HW report an memory allocation failure */ -int __init arm_cpuidle_init(int cpu) +int __init arm_cpuidle_init(struct cpuidle_driver *drv, int cpu) { struct device_node *cpu_node = of_cpu_device_node_get(cpu); int ret; @@ -147,7 +148,7 @@ int __init arm_cpuidle_init(int cpu) ret = arm_cpuidle_read_ops(cpu_node, cpu); if (!ret) - ret = cpuidle_ops[cpu].init(cpu_node, cpu); + ret = cpuidle_ops[cpu].init(drv, cpu_node, cpu); of_node_put(cpu_node); diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h index 8f03446cf89f..8db870c29f1b 100644 --- a/arch/arm64/include/asm/cpu_ops.h +++ b/arch/arm64/include/asm/cpu_ops.h @@ -19,6 +19,8 @@ #include #include +struct cpuidle_driver; + /** * struct cpu_operations - Callback operations for hotplugging CPUs. * @@ -58,7 +60,7 @@ struct cpu_operations { int (*cpu_kill)(unsigned int cpu); #endif #ifdef CONFIG_CPU_IDLE - int (*cpu_init_idle)(unsigned int); + int (*cpu_init_idle)(struct cpuidle_driver *, unsigned int); int (*cpu_suspend)(unsigned long); #endif }; diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h index 3c5ddb429ea2..3fd3efb61649 100644 --- a/arch/arm64/include/asm/cpuidle.h +++ b/arch/arm64/include/asm/cpuidle.h @@ -4,11 +4,13 @@ #include +struct cpuidle_driver; + #ifdef CONFIG_CPU_IDLE -extern int arm_cpuidle_init(unsigned int cpu); +extern int arm_cpuidle_init(struct cpuidle_driver *drv, unsigned int cpu); extern int arm_cpuidle_suspend(int index); #else -static inline int arm_cpuidle_init(unsigned int cpu) +static inline int arm_cpuidle_init(struct cpuidle_driver *drv, unsigned int cpu) { return -EOPNOTSUPP; } diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c index f2d13810daa8..aaf9dc5cb87a 100644 --- a/arch/arm64/kernel/cpuidle.c +++ b/arch/arm64/kernel/cpuidle.c @@ -18,13 +18,13 @@ #include #include -int arm_cpuidle_init(unsigned int cpu) +int arm_cpuidle_init(struct cpuidle_driver *drv, unsigned int cpu) { int ret = -EOPNOTSUPP; if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_suspend && cpu_ops[cpu]->cpu_init_idle) - ret = cpu_ops[cpu]->cpu_init_idle(cpu); + ret = cpu_ops[cpu]->cpu_init_idle(drv, cpu); return ret; } @@ -51,7 +51,7 @@ int arm_cpuidle_suspend(int index) int acpi_processor_ffh_lpi_probe(unsigned int cpu) { - return arm_cpuidle_init(cpu); + return arm_cpuidle_init(NULL, cpu); } int acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi) diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index 3a407a3ef22b..39413973b21d 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -106,7 +106,7 @@ static int __init arm_idle_init_cpu(int cpu) * Call arch CPU operations in order to initialize * idle states suspend back-end specific data */ - ret = arm_cpuidle_init(cpu); + ret = arm_cpuidle_init(drv, cpu); /* * Allow the initialization to continue for other CPUs, if the reported diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 9788bfc1cf8b..d50b46a0528f 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -287,7 +287,8 @@ static int psci_dt_parse_state_node(struct device_node *np, u32 *state) return 0; } -static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) +static int psci_dt_cpu_init_idle(struct cpuidle_driver *drv, + struct device_node *cpu_node, int cpu) { int i, ret = 0, count = 0; u32 *psci_states; @@ -375,7 +376,7 @@ static int __maybe_unused psci_acpi_cpu_init_idle(unsigned int cpu) } #endif -int psci_cpu_init_idle(unsigned int cpu) +int psci_cpu_init_idle(struct cpuidle_driver *drv, unsigned int cpu) { struct device_node *cpu_node; int ret; @@ -394,7 +395,7 @@ int psci_cpu_init_idle(unsigned int cpu) if (!cpu_node) return -ENODEV; - ret = psci_dt_cpu_init_idle(cpu_node, cpu); + ret = psci_dt_cpu_init_idle(drv, cpu_node, cpu); of_node_put(cpu_node); diff --git a/drivers/soc/qcom/spm.c b/drivers/soc/qcom/spm.c index 53807e839664..6e967f0a8608 100644 --- a/drivers/soc/qcom/spm.c +++ b/drivers/soc/qcom/spm.c @@ -208,7 +208,8 @@ static const struct of_device_id qcom_idle_state_match[] __initconst = { { }, }; -static int __init qcom_cpuidle_init(struct device_node *cpu_node, int cpu) +static int __init qcom_cpuidle_init(struct cpuidle_driver *drv, + struct device_node *cpu_node, int cpu) { const struct of_device_id *match_id; struct device_node *state_node; diff --git a/include/linux/psci.h b/include/linux/psci.h index 8b1b3b5935ab..4f29a3bff379 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -20,9 +20,11 @@ #define PSCI_POWER_STATE_TYPE_STANDBY 0 #define PSCI_POWER_STATE_TYPE_POWER_DOWN 1 +struct cpuidle_driver; + bool psci_tos_resident_on(int cpu); -int psci_cpu_init_idle(unsigned int cpu); +int psci_cpu_init_idle(struct cpuidle_driver *drv, unsigned int cpu); int psci_cpu_suspend_enter(unsigned long index); enum psci_conduit { From patchwork Thu Feb 28 13:59:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10833143 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 82E391390 for ; Thu, 28 Feb 2019 14:00:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B9312EF1C for ; Thu, 28 Feb 2019 14:00:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 699962EF2E; Thu, 28 Feb 2019 14:00:45 +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 AE59C2EF1C for ; Thu, 28 Feb 2019 14:00:44 +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=LXzWD7OyMJY0aPCAiW7WGwyaBQ4fEcRPlPMMgAeiXZg=; b=HxVelHMzYytPGCVkhvGjSmfpdt wWGjGW6vFWvAOndc+gtNZH8CIhehkdpUzWl3YONpuJIttWv9+uuukXxXfAS9ZcMuVSVc8wCrzD4z/ Ww9TbrZS4nzygFwkImbLyyDa2VVt6OzE3OOP9/6u/tG3rL/u/1HlP6EsxE8KnIKTaF5N9sN2pTp6X OrziP0IjQIv2Ezz5Stqt/iZJafWwiTWyPnryaeTFI9i3X8fxcTdUkSrKmhiDhdnbjH57xz4lm3xiq J1FAvNGSuqe/3ewtdvS58G+WKiJVTWbO0ESZ/DBaPFtRA31ynhTOdn5JnXqTOubGJV1Q0zGY+Lr2i V6Qb0uXw==; 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 1gzMEp-0000Jh-Tl; Thu, 28 Feb 2019 14:00:39 +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 1gzMDm-0006Xf-DS for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 13:59:36 +0000 Received: by mail-lj1-x242.google.com with SMTP id g80so17201923ljg.6 for ; Thu, 28 Feb 2019 05:59:34 -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=tetivCWSellxrqLjg5oJkokMZQX4qsIXobIakEVk0Q0=; b=VNKVdDKp77nYxziG1tXDB+1+YC00/86ektZ137JuDXUybb+p7BQWP/4Nds+yqaWlib rDjw3j1RqlhfUzBaH0AhhEP3Oal0r0XwMCa89QOTJGA8qt68/R7WnvbQg23bXvoPHmA1 /+bIe0i+NlwTCQ1sv6umubGa15+P+2rAGbGXpMzM50QabTblZh6vh0GLMy2yhKPIinTK gvv1liY4PiqHQoOL24Lc50pUtriYV8B+8xRnBMe9TWpLa8IR32lR+o4JoTVyrb+DLU6P 45yDEaBHUzdwLkw7YMe5csbeq8sqZ1TXrTHoviYLSuzSWdtpnTLoVac9lYSgmfg65C0L p1lw== 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=tetivCWSellxrqLjg5oJkokMZQX4qsIXobIakEVk0Q0=; b=cIebdtwS93AVkT51remS70t22z7D0+jlvGJwNohnjeqSl3sRunNt8w5Xa+uEirXd5C eU7TyG95CG9lWyj6h6sNX1QlSCc1hVws+uZRGSJNmtnEEKj/IDa69fPZGOU7F+HPqHWg L6AoJSCSOcZ0IYRHQwM4TtPyoPMOMQ63E8K2kCC2Nrg1b4xnBw5gG5RoL7jQ4GWSFuTv WnJC2xpOx5eAzLW/r+MAZxBC+BALBkj5DJLaH5xqXXAArXVe6bFOd/os2JTxynR5uO83 K8POfYoNliwrVcx8vJfqAWyWqEE/my+XnrnDvsrsy9DcdEa5Yec4WLVfDRUuYGbTLwi9 I9qQ== X-Gm-Message-State: APjAAAVDuDqoVEQGJ7cOUQNzQWtVaOen75lx2k+oqNOboSemc9JcmG2R WcghUeLaQci5QOA7piUom211cw== X-Google-Smtp-Source: APXvYqx5P/Vqp+ogLd3hKLL4ats904OggXBtyJF+UQCD1hAYH52E0UWO5ytjMCr4hSE78iI1sOvulQ== X-Received: by 2002:a2e:2c0d:: with SMTP id s13mr5097543ljs.96.1551362372749; Thu, 28 Feb 2019 05:59:32 -0800 (PST) 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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:59:32 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland Subject: [PATCH 5/7] drivers: firmware: psci: Simplify state node parsing Date: Thu, 28 Feb 2019 14:59:17 +0100 Message-Id: <20190228135919.3747-6-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_055934_644818_CA121047 X-CRM114-Status: GOOD ( 15.92 ) 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: Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , 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 iterating through all the state nodes in DT, to find out how many states that needs to be allocated, let's use the number already known by the cpuidle driver. In this way we can drop the iteration altogether. Signed-off-by: Ulf Hansson Acked-by: Daniel Lezcano --- drivers/firmware/psci/psci.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index d50b46a0528f..cbfc936d251c 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -290,26 +290,20 @@ static int psci_dt_parse_state_node(struct device_node *np, u32 *state) static int psci_dt_cpu_init_idle(struct cpuidle_driver *drv, struct device_node *cpu_node, int cpu) { - int i, ret = 0, count = 0; + int i, ret = 0, num_state_nodes = drv->state_count - 1; u32 *psci_states; struct device_node *state_node; - /* Count idle states */ - while ((state_node = of_parse_phandle(cpu_node, "cpu-idle-states", - count))) { - count++; - of_node_put(state_node); - } - - if (!count) - return -ENODEV; - - psci_states = kcalloc(count, sizeof(*psci_states), GFP_KERNEL); + psci_states = kcalloc(num_state_nodes, sizeof(*psci_states), + GFP_KERNEL); if (!psci_states) return -ENOMEM; - for (i = 0; i < count; i++) { + for (i = 0; i < num_state_nodes; i++) { state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i); + if (!state_node) + break; + ret = psci_dt_parse_state_node(state_node, &psci_states[i]); of_node_put(state_node); @@ -319,6 +313,11 @@ static int psci_dt_cpu_init_idle(struct cpuidle_driver *drv, pr_debug("psci-power-state %#x index %d\n", psci_states[i], i); } + if (i != num_state_nodes) { + ret = -ENODEV; + goto free_mem; + } + /* Idle states parsed correctly, initialize per-cpu pointer */ per_cpu(psci_power_state, cpu) = psci_states; return 0; From patchwork Thu Feb 28 13:59:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10833149 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 994D915AC for ; Thu, 28 Feb 2019 14:01:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85B5F2EF44 for ; Thu, 28 Feb 2019 14:01:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 840032EF62; Thu, 28 Feb 2019 14:01:04 +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 290952EF56 for ; Thu, 28 Feb 2019 14:01:04 +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=nKDQiJ4u6GD4YPJ3AdLKKHZUPa5FK/ZqzfjeBSmUrmQ=; b=aeWxhcpCOurZrYZzxdgbr40+uF cwuo/T/N4Vw4zFMSSxpEUpfe+RGYNYDSfzwJ/kXrhaBhtShfa92zRboIT4Mpa6Z7zEh+0vSZ4Pe0h cF3zzOHOo12IHsvMc8txSujwPtI6DOAa7g6xRv/V0RxHoxCyrFJRUc7qMkWKEvPmAVpfKCBCghmLo /jtHI7oNR4dxhRIi/PCjJmcPH/NAnf/WhhDs0LpHuvirEkQfr4q9XUVSyDuTFMlNQmVUGfnWi/vKy 2tK/HQ05EOnXmnVJ5ptOx6z9H5DYW9OA0XyNJHFgtcW7nltFK5XuCZSIp57AZlS8IKExWi3FSFNRw 6yrKPQ/g==; 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 1gzMFC-0000oc-QO; Thu, 28 Feb 2019 14:01:02 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzMDn-0006ZL-KZ for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 13:59:37 +0000 Received: by mail-lj1-x241.google.com with SMTP id q128so17180878ljb.11 for ; Thu, 28 Feb 2019 05:59: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=hYUbL8LbBo82QhtQinEvxE8lGJZ9H5Ith2yhnCB+jfs=; b=FVXnHtLFTrcIsi6QjOHvDk72G+oUmcjjHSBm6gOpkR8yahj/V1QIS1G5ehizJn1wuA 6WDxEgGJRdSbqz4DDEbcVpENyPnwXeqdMWWNAFf9lN+6qzc9QRoeSDhIWF+icNXyz6fW UQYxOWQ4ENTXypM11P/07ftev62Jo66OAGARyGbzZPAlGiLw1OnYzQa9rghzecD48VB6 cBpxHW47WDo70pErlO17ptrY7aJUSIdPaZ0DoE7aUGropbrhf5DwN3jkIUXNm1Aj6hXX xnXciiS5mAPAWRrtfhwI6rkU1IsSbT5aiYPp1XShUC+jNSV0amTsj6e+DCLyveFBNam8 2A5Q== 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=hYUbL8LbBo82QhtQinEvxE8lGJZ9H5Ith2yhnCB+jfs=; b=BBI4PhpXQJIjRVV3O6+GofCJ+WJEfBK8tN4Q8AbniA7/uyFHUuqxtqFEXFmyOHcIN7 Qq5v15palbRbOTONBhlEXtaa2bFYjLWmJemDgdskfrRgang65fLonWrj/7HxcJAsZ0uL ED9P0MUVGT9KOwal4w2wj/eA+6LCvd4EFzcEETdYzyZ5ZdhNKhQ/a7RgWiosoLIuTHN6 WNk9p7Vc5z9eNJ/JKJKoBqJm98XsQ1YzUyDk2KZ0Js1AZoiSIF/Wmh4BYc7lD8eaeHWL 7t5Rit3NenqZ/FJ3FZ+Wd4DdOOfMERiJrygY/2TimaycDGY5kkyi90i49lDYwH2dVwyn oegw== X-Gm-Message-State: AHQUAuar9fEjNHzdG4phTzevh1ZtEZ/3LHA97Z+QRZOpV/IDv7Kr6MxF pMAaE2NruWt/zyqU6ydE5VwQIA== X-Google-Smtp-Source: AHgI3IZO2Wq9Mtzo7x2cc9k3I15Qn/9ArqedLsbZ57QDgmSES47es6+2O5q3dGm9ObdOHf0PNMrJ8w== X-Received: by 2002:a2e:2202:: with SMTP id i2mr5173940lji.170.1551362374036; Thu, 28 Feb 2019 05:59:34 -0800 (PST) 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.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:59:33 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland Subject: [PATCH 6/7] drivers: firmware: psci: Simplify error path of psci_dt_init() Date: Thu, 28 Feb 2019 14:59:18 +0100 Message-Id: <20190228135919.3747-7-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_055935_674151_2C647497 X-CRM114-Status: GOOD ( 15.29 ) 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: Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , 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 Acked-by: Mark Rutland Reviewed-by: Daniel Lezcano Signed-off-by: Ulf Hansson --- 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 cbfc936d251c..14d25b54b9f2 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 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: 10833151 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 26ACD1390 for ; Thu, 28 Feb 2019 14:01:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1531E2EF62 for ; Thu, 28 Feb 2019 14:01:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 135452EF84; Thu, 28 Feb 2019 14:01:19 +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 A16AF2EF62 for ; Thu, 28 Feb 2019 14:01:18 +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=E08AVgyxKqp440UX9UKGFODnUMy8EaCVSY7WajN1yo8=; b=BYyumTYpJtbOeJiMYTjXZCKTID Bp5t72qEiqL4sTMMsBrabyMpvdyxAOM5x7WzuH4d3guqGi9MawIJcWtPfEvruXdSNUvLlE3fD9ZdZ smq/xLfUmVsQzdFsgP54D2kpovv93N0FBn/3/DFs6N60vtCqYxXpTFc7dub7CaCK0Cnwb8sGOrJ9Y 3Y2p4+tPqnzsOSZrcdRnfXWGYAm30e+Xgbp8aPXcNVdgv8Y6tTPROPTOdlb3eDUibpok34wbKL61O 4Ozvap+jgxuf2Rt9IM6BKq5R7R22IpiDUce8NsUF+XGSeo5lFmK6OwH7kELoRvIpu96DipNkb5oIL 140zOc/Q==; 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 1gzMFO-00012K-8U; Thu, 28 Feb 2019 14:01:14 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzMDo-0006ai-Ro for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 13:59:38 +0000 Received: by mail-lj1-x244.google.com with SMTP id g80so17202047ljg.6 for ; Thu, 28 Feb 2019 05:59:36 -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=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=a8cIbhHMdumEG/tVwpSzqnsgs8Glp7EfnlF5SKIImu/UPrBYONNJ1jAGlJu98ReIiJ 8+hY5kPiQeSYi3nV+wzgN+1lgbu1pwzDvL4OMuk+LhdttHJMXBgYMWhcYAWXZfBVL34F wSVlY/gXrrrVvOXDAtpTo/NHhLozKdK4lGJzbDX8aKQL9vEwi/qbcKWRuussZ1emc9lM +gtGjdswSpSI8Vr8UjOh+Z/ySAJPw39TEeMIJGsl/j4aW5UvjMHatWsIkzqx3n3KJe3n aEp5a0cUDspwYU53C7OotE064eGFMFSAHTq/UO2lCERgFriR2PQRClTBeLzVrxIjSTCI QhmA== X-Gm-Message-State: AHQUAuZ2mT4uYQOqPUqWvyI7E6i8yoIxGLLfcn4v5soc8IUSbQL0dpd6 BrVrRaX82Oz3cY5SolhVJySoFg== 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) 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_055936_932955_7ACA9638 X-CRM114-Status: GOOD ( 14.95 ) 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: Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , 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 Reviewed-by: Daniel Lezcano Signed-off-by: Ulf Hansson Acked-by: Mark Rutland --- 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 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