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: 159370 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp671282jad; Thu, 28 Feb 2019 05:59:26 -0800 (PST) X-Received: by 2002:a19:6454:: with SMTP id b20mr4509570lfj.150.1551362366339; Thu, 28 Feb 2019 05:59:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551362366; cv=none; d=google.com; s=arc-20160816; b=Nlgt/ZesveSgtNfOlsV/WjBnM/Rse6rCgqttWD2WZIprfgKxUz6Yc/lK91IKm3eil5 W2pIiLE2AYv3p7hf5BU8c3ybO3RGZHXXDiRKCx0uTauSh/YpsoR8Ms1gjyaLmDMnr5oE Y6UtKuHUafHW3i8fZfOG/cHspgCrNuK4rq1Wl8X0PiP9OnK5L3ZeD+VAWvkGvbC3ViPh LRqNx3xqUvtfSgiBGZbBEc+9vbRFi1CviwxomjXfK8WaU1APVsLyr7LTSVf1IyDkSj8o PINoYZAdTcpLJscSR8L+6in/m8HDddYZQDuRe+hXUYHXPqBkuIbFFhVIxqYSYW5L8E9M UaNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GI6XZmnxcYO/CY+bl29qXuso3VQMluSDkZvmK3rltbA=; b=R1Ro18luYEJXhF1fHyqbIKt6WaPHL28CE7mVcxwYEHd4cVJLMbGCeYdr/ho8mVA3Qq CQ3cOAQVUQFjSsmut2NZRyMcaWOsnIhF54AolUVPBFf62aoNPaF/xh27GxOSe1ErVmun 8uO6ARhKwXepSa9lVvMDCbUfjDcHPNABRE8lw25TyxSWMqEqY4WoQ64rOWkrv7jlrfdP mzdw3ArwQjvT+mQXf+ZcfUtr25/FR7w/3IojpS/u5XSMXhi5iUzGm36WvBh1HEUz8uMD AlTBvcrJbRYRFYY9Sbg44Yff0qHnntSisKGZkI6vxi93c2HCUccjfWrrcgO/AkyKxDOk YHZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ECdGhCwn; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id t10sor11183839ljd.5.2019.02.28.05.59.26 for (Google Transport Security); Thu, 28 Feb 2019 05:59:26 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ECdGhCwn; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=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=O5qY8vX9/AcCcWPC4ugYYHLIoxsK+hFJbg9HCfat3Efmjq4DqPnCi23FdoU8k7sGJt D8vWxWTiP8N7SfjEvmrRDi2AUWyb1r2hcqS3tfgWNx787GR9RAAW1l34+kK/5yDT3AtY Z4LnmD2GByKDI2JDAMvYcmlqzGtPDiQWz4oL5KGmCJ8ciXrTvdhIsEoWjbqAvxRY80Gi ezvRJk3EmyDb5r+s4S0ZHKqLl3IyBi9qgKEi6CeRMJ5n539I3/+s0IuBxK2p0PQwFRwT w5NSc5T1DJGanKWN+ATAfsGtUWUxK1p8RCjf4sm0fZiCDz37AaJJZ1cTtn295+yO+X22 hEJQ== X-Gm-Message-State: APjAAAX8UFSCXm5IRhDxC4jyxqELJc8DZM0qo2I4iw8KypY5TPFbD2EF qk2syC7KmVlBBUHUBA2PiidAR5hL 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) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v20sm4090265ljv.83.2019.02.28.05.59.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 Cc: Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 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> 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 --- 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%) -- 2.17.1 Acked-by: Daniel Lezcano 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: 159371 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp671310jad; Thu, 28 Feb 2019 05:59:28 -0800 (PST) X-Received: by 2002:ac2:559b:: with SMTP id v27mr4292570lfg.164.1551362368521; Thu, 28 Feb 2019 05:59:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551362368; cv=none; d=google.com; s=arc-20160816; b=FBijpQNiYzzAz56a8Iv9xZAhDkJPQ7VZD7pjmwQ7bC/fthMX43jixIUbQq3L7DBL/S stcV/Gqvr/CJcDYNOuRRHrKpenXTQXdoSkwABQtK0XyuYAqvbMKK/Q4veNQ0nIErt7S7 TkS5CYFWByxqurVS6JwggX0fryiEnJLaFmlL8c5Eesk4jVgJCXbjF6G8+N1EHtmrealV YEG7VmCh7fRBgfvHYpO8UGf2m2CxxBkXj3K8fcw/8e6DscPvqe3J1vlro6GC7jf1xYoq WHB+1oRXQKqc/DUnMQuNc07EIQUzFdzP7U16/lx8d757nRI/n98hx+eCNLcJsR0YLcJZ 4ZUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2BruUQQ7aW9EaagD7/EmEPsgX/D81d/9BI5IBra5MPM=; b=RljpoW9CcT1WbbIqDpQUr7WsX65mCYN1DF/+rgZb0CRIY+1MahJOwXRaZNVsHX6sXC QHHB1tc6tKB6c8qvYC0xVCV7qOBRvvST0jF/WlUMgOnf8ap+Zn5JcUI+6hCnMR1/MRRg o+hz0KLkDD8e3hX6hDPfFAz7Vjn3cgOVbqJYubdMH5DN+r6Q++Sd7enSXzTrnp3Yj6eC THdU3gF1O921a07tP9+XgUl4Am2UmkStZu8tvL4n33siLwW0HvgNA0KF3ADw4QBGxDk/ 1tyOWHDbh5YQIHjdMQfxPLK5kXYzq1yWiFoYBpvEDoBj73XA+my5zZxztKUkwvhvU2zT EuWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uqYkkokA; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 4sor11651468ljs.30.2019.02.28.05.59.28 for (Google Transport Security); Thu, 28 Feb 2019 05:59:28 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uqYkkokA; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=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=FjtR8Fqgt2zyE7JMqXyqCsLflGmD2urwrizO+k9JbVzpvBiyOD5uNQLUqxurAmIeQi x4fHDY6SeSga59sF8vnVGWE/72BWpLCCXRunDo9Hx07zrxIQ8EccOZPDjfhWhFZXhEaM BfddiCH/goh0UdADQdEVxTjQWWn3M9dtQqBoFowzfzydacleXnmF+grMS91ex0SYE+rR J+w8Ksuhw3d7/XhY8O1qLe3yvx2HAQt6m3y8cZ/jdQIoS5A7xxiPEkw5DSIL0bOiK+c1 v9PD6899Iuk4ilp8AyRnQDA4k0D32BSX1eXToNgent+puKVczQeFN62W8xf+1Yr9E+o/ ze1w== X-Gm-Message-State: AHQUAuayIMHFa7oYHCIWtyWUgzkdl+uKMyysGqed02a+aNzLfsnfCSog 8hYc/OkIm6HM9hTJXe6Ush0hrEg8 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) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v20sm4090265ljv.83.2019.02.28.05.59.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 Cc: Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 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> 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 --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 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: 159372 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp671330jad; Thu, 28 Feb 2019 05:59:30 -0800 (PST) X-Received: by 2002:a2e:968c:: with SMTP id q12mr4947783lji.95.1551362370336; Thu, 28 Feb 2019 05:59:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551362370; cv=none; d=google.com; s=arc-20160816; b=N1J4NTkfAZm8oJq6+FaPAEmp0o1nE+OhE5gugugckJ0HFDLMB1g2bsXNgA/m63bV21 iyQxnk9ucehWnRly4rhWjY5JacaRGi3g5xG5HnSS+DFB9zb7Ldh4hAOckQQ/OwWAMkdh IXaNp4IzH78fivC2dHwTGfQg/l02siFisk19EQHKRID0UA8f1U+BROqBwRk1ZHovPbzV fQtg1srZxEbAcNg+OEnbO1CgRQEuID70Kgnif1IZ9o3FfVnprvQeAMnJZxnOR3cOHp6d 684usiXUe9UWfJGga0o1O3FlTLMm++KqhgtKqKnmQ5E9cHbxc98DuagVX9tLwgS4kW2c FcUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XTL5kvu2ODR6s8WzbGt1Q9EGWFN00ZZECyFc5WKOL08=; b=gTkprByiPs1ZoxlntMZsCcvDqbWkEyJFJtChJ0iW3shMiQMN9AnCvdGTbYkPH32wQh JNgxhd3m4uvDBNPSvX9IUvwMTwm/Qe5hnqhAa4F0l4kcLdjyKLR3fQ2Ns5W0Ro4L1Kpr K1UBV66m/EaUnwiZhEbCujhOVK9mGzSItRGFQ4jNsYli3FPmTvhMHSCfhZdtTcpbFqPI iUOA7dtFXToU9ahfLqKgRD79SkVYn9Aye3kR2WVrulp1eGgXIKYe2Akd3/wekeYvq6xW oCS2kfomrZweGWfUmDT4DPPkRz3EXUBdw/a0+F1zsA/XQSiT3/N2hBq91Lt2f6WbZ8fr dWVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v5dc9YJ2; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y89sor3610354lje.18.2019.02.28.05.59.30 for (Google Transport Security); Thu, 28 Feb 2019 05:59:30 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v5dc9YJ2; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=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=ImfLsQ/hHGjp+YXHxoR/juKD5wA8PjDZUoZ4vHz7MD2ggGgw/rkRB78d6xA2VOAc0M 8rBhnaMUh8N7o9Ulix9TIt30anFZ1fDUOJ/+KyMxJSqv0P7C5OmFLc76kq8Sr+yFhGuI PqhnIWueau4CVKVY/KFGKdBrPK23at8ByfxbCkR4oEMEKRd+e7N/608wRf0c16J2GcJY VeOYcWsdBa1l2KglKI05vNs3h91hRAb/0/6GJ7BQKFuVxeFivMJHzMc2kpYIPrHCZwwO NU3hkrPv5w8uKeD5wUYsclpccEMAhQ7u+BwwTHbgbNbr6JwPj0jJX6ql99QHHRK7E1FW jhSQ== X-Gm-Message-State: AHQUAuYmZByWw3Z5ZcmbzoBSR5kcVRR4GvCfCeOEEzen7QGUZQMkE8z0 bvZv+glIOK2hxaXdYiMulGteBFw0 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) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v20sm4090265ljv.83.2019.02.28.05.59.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 Cc: Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 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> 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 --- drivers/firmware/psci/psci.c | 42 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) -- 2.17.1 Acked-by: Mark Rutland 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: 159373 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp671358jad; Thu, 28 Feb 2019 05:59:32 -0800 (PST) X-Received: by 2002:a2e:9f0b:: with SMTP id u11mr5044071ljk.64.1551362371953; Thu, 28 Feb 2019 05:59:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551362371; cv=none; d=google.com; s=arc-20160816; b=SI8n7kL9Y6LF14cHg7b7zeagJ7p80BpsymZd9dWDxoGGk9Hcw3PUke8AgA744xYpuX aZSuhvHOQwutllFdcMvWDV+bZXNdi3776c2lO7akWLbT0aebO5SVchJmjC3GbqNUPq6J TLu+mLrnQoyeWfmKWCfe/Pd5QRYRgAaBkezt2aL5/WpJesYZwF/LAH20Qxat3+gBLtBu 40ogyCniEQbJxsqvwiPHBGVpBsszBnNSkUTiIN0kM5BTqFvXOUsOuA3jexGkrr49t8VK jm8PraFuTUFuUTPxjzCbXssL9pQV3VwFn5pttXP1+tcEWOEyb4gsJ4o4iIrhuzi5taYa /SDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FA47iBYE1/jKqUXLlbljtr1jgxnROrzBgQH0oOLCPjk=; b=KU7ubS5xg+zUEBPKQrEBswk3LHzJYVpNaWNGtsLQiqYag5cDKXdYRGbSSWwJNVvGog HNpF8f0gD7ikk3n7kYidovK5xEK3AdI3nbjRl45P2q9kZc0hXUlyGbKfsmPbJPuu93Gl Q8q22QcC4afx1WREu6cJCh+0iDztaIHgeKOAt4mOrusuTrzEo+GlIqaDHeS6kdcGgqU5 Ke+0jeWhOi7npNwfbdLl9TMeVnWWzxdC4jbJt1g5q2+g54Ae7snMYj2ZVvUVKNBLgWz/ fhIDG7n+sT9FiqAyuSDX+rVK/24Z74GJ+uO7urpP2NtfOGvMxR9MFfj5f2teO05uQ5Lm Qmfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xt6KpU1G; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id t78sor11660209lje.29.2019.02.28.05.59.31 for (Google Transport Security); Thu, 28 Feb 2019 05:59:31 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xt6KpU1G; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=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=DMp3byBYD2Iy2BiUmw0NHt73XDaOH/RcfdluXiyphimAzYbmtMvR4xiq1Rmq5j4uZo /WQzUkLjvP6U4MQpA9T2SRksFb8t/cVHgUxQ7aRZb305jwjWnB4PNwpUZc4Uhhi128AG H9GdY7ltn1dbAA1nDf7tieUy8Yf8S8fg6YtOx1tT2h+dqqmU0mU3wVEz5HHqYJt7/Xre MUIsA/+vbIihcWl3ZbFfhL3IVJB5TU1d4QF1mY9NSwzQeYXw9EbKXpkcWpPfK/Iza8sB b3kybEuL2ULd9eQhPrpVMnyOfxKuds20u93pa8UJejtJ+UnKyZHztZYt5mPXAGKZRVuT HWlA== X-Gm-Message-State: AHQUAuYn2UFJEnZKcHYsqtLMW/ZG/Lr1wnhqvcjEngEWzxFbM7q3Od+n Iz1mybC8aJH9QJnShmuEHcNgkf8K 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) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v20sm4090265ljv.83.2019.02.28.05.59.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 Cc: Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Russell King , Catalin Marinas , Will Deacon , Andy Gross , David Brown 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> 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 --- 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(-) -- 2.17.1 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: 159374 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp671371jad; Thu, 28 Feb 2019 05:59:33 -0800 (PST) X-Received: by 2002:a2e:9f49:: with SMTP id v9mr4712103ljk.77.1551362373120; Thu, 28 Feb 2019 05:59:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551362373; cv=none; d=google.com; s=arc-20160816; b=xRx+dD9oAqh5kwePZQfGS88senQnLSCM+wnAkvZsGX+zsgeLpo2HFIO+nfdv0Bbgxn IQAtuZv+96zURUM/hh9CjPksGM65ugfdNeRz/qJFsRNTGBBY9xBdQo54VnCqfSd9+6Wp +Z1I8oPDg3dof9PXtpDgwURgKM2wUHOhJh1XDgB2AE+0Trg2VHms/h2fZBRz3XZqa7+A 5Xy8mkLZNE0aS3yX0elZcO4lPtQ0UZLxvNqacZ7j8HUe/siw2jvppcBBQvzdFu/9+V4N iPBjLwhJpvewPQaV9HDpzwH52bQxFVBZlfd5JYFdZc6iOTo5DccNkU6Bm48B+ad7aueE MFTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tetivCWSellxrqLjg5oJkokMZQX4qsIXobIakEVk0Q0=; b=altputKFkcfUP6PVMjU6+hrnXfgEkTuVZ7qnKBdIdV12cHBLy02xQfy70/xzhVq6xg TNMLp1WexMJwcXmTd1dgvGHCXndRR9pWLITtGlWub1M5L6ZrztVhS6671KiwsqgeylEy kk//M6jxTAC51v9OLtudPeAuR6RDPTqbKs7jx2enRcWNUmDnzP4rhKVDXkUfSWo3tpE7 nJtNm8DtWkE2CyXSOWB9ppIhJz6zs7HJJ7hKqEkSkGxKTlJHoyJn+yWwl9P2VOGVBdSq zJBwleDyuycS94S+cDXZ+m5q6E7SG4UBUDNIJ8MkSDjfvPGzIJ+7vmvKGUCvaxiNB36v EQ+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VNKVdDKp; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y89sor3610463lje.18.2019.02.28.05.59.32 for (Google Transport Security); Thu, 28 Feb 2019 05:59:33 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VNKVdDKp; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=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=ht7p3JnTVVR0Q1fNII+EOxFO8Bx+186BQCMrCLrQ1MOprTkDmPG8cZxvyUuf3q2qaV MbkftpTugm9KxCe3aKszFwR5ljwi7Y4s7Dp7bVxfn2HL9SB+J2UaM4Om0uwZTB572K5Y d/EL7Yg0q413m/kcx9QUBlX1BzHkTSO8bwKJoUiLKhL3k4fNKiMdTrFWxSFYib7XPNnA yJ6asLAtxc57LP+wXNkjifE9lc3ZLFEI46EOpNznSeV8O6bEIyteOVc/JpHM8cn2SRBX dMjsFFyh6xpHRpH+VIoSqCd2DjEEKqeYHg1jTGeKE5S+ErU8jifZsi0dNf1S2E1LzkUB 3p+A== X-Gm-Message-State: APjAAAU0DQT+uZqEwTYuU1F7YjxCWIrzGVy9sZbWxC4gP0uFBx9jj8Hd 9V4lW8ZkvmaAWEkyrBuZmVo1OhtL 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) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v20sm4090265ljv.83.2019.02.28.05.59.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 Cc: Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 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> 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 --- drivers/firmware/psci/psci.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) -- 2.17.1 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: 159375 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp671390jad; Thu, 28 Feb 2019 05:59:34 -0800 (PST) X-Received: by 2002:a2e:8157:: with SMTP id t23mr4613791ljg.195.1551362374432; Thu, 28 Feb 2019 05:59:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551362374; cv=none; d=google.com; s=arc-20160816; b=la+jbMdBCy1bPosyEjI+DcxElDbRqJjjIAa/UwYe4CvcMW6k+QNi3hOPn07ekSoewp q9AuLqTKsF+pz2oHuxHJV0apMgpUBnso33CuTmI6g4Aii8/LGNZuD9+ABlXi0eNSLtn6 dx1lGxdj9br4i0ao6vAwooKsU8xBzP4r5csdBBo6qTm4V8jrCywmUvKNOAugNnP0ecCa lmsdrQmGzKerMem15GH1QdyqRUdt7A0SrKmrbCnTChuECLiXgfWpdrLQbofMWgyFz/P8 l3dK2Vc8GSybUMiAtezXndanpMrzLoF0Pv9+zX3nXLoKTBz1ztDmTn3RqNBZzkK7L4Ot BpEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hYUbL8LbBo82QhtQinEvxE8lGJZ9H5Ith2yhnCB+jfs=; b=MzwXRieMUxLAm5PlIFXAd+z3Bmz0ovKvGQOH3Xb0T7ShTrwkb54uHTvCCd/B1G4bLq ze76r7AHutTijfYguZPz4vj4G+oQfqtT7hqScy2MTl4b1C043C0JAmSOAsRsnZbtkoA/ o9DMQxsHlipjNCLMa3UR9lUjz82ohQlIYUYHlSHrfVRCIojx2svcizvJcjyHEp7Pmj9n wyJHJoYgTfWdIjJRtihYuGszt7emcK+jcm/khBFHb1L745cTL8cfKm57nkN1M8J8sDEe UT8kK28ggtHbAqkXrQaopL+MeHXZnbHHjn6t8vv2O7uY2KkiOG13UHgxw11dNpiS+By5 T1OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVXnHtLF; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w12sor11455444ljw.31.2019.02.28.05.59.34 for (Google Transport Security); Thu, 28 Feb 2019 05:59:34 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVXnHtLF; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=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=jzwQhhrHsMN2L+6bxEB/8PGnswzx5mPIZqZo6LCZoZFdSdPx5jWH1pJF4arzvC0i3X 0n0oa7n2ikTOhVOVlC+sb9Z+DpIlXhcY0zlMmOWCxXZav6PANBvG+lQjTHD1OSbUbawA YTzqCADEYP2DOA7jJTZo5CvfhGc6P3vV32SC0S/EAMstoDoZnjDQ41HzJQHP1QMBYSNr qAkVz3OJaWWGwNK+Mwk3Xr5cgpthv8+wHTSknHGlb6wrnAeuDUv87hn3PdveZ3LRoxSY kkw12xBGps8pcHboDuXGXXolta7rCBxrOzj5vKl2WNWf8xXj9z2gOakxxN+gWr7mHgg5 qjPg== X-Gm-Message-State: AHQUAuY7uD5pMoXJMi7UaStNnYserB0+h/z3cOG0eeB4GKjLLutkCoYP ZikfluY/u7GyzBJ2MC9nUaHmNfzx6US2Xw== 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) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v20sm4090265ljv.83.2019.02.28.05.59.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 Cc: Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 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> 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(-) -- 2.17.1 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: 159376 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp671412jad; Thu, 28 Feb 2019 05:59:35 -0800 (PST) X-Received: by 2002:ac2:411a:: with SMTP id b26mr4532007lfi.169.1551362375698; Thu, 28 Feb 2019 05:59:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551362375; cv=none; d=google.com; s=arc-20160816; b=BDfrZqXpQuFaF08fGeAcEuQUkEH65fvmfFg4TPwng6uet4qn8zsEyVanJcPWXrF+mz b5tUG1l2wWYP5tHQ8ZSuxRvxp+lvINk3KCcUs5Y0v42V3KxZZYGDhMn4Xc0TMqvQ653B 1ksrXBq8OLmqEPChQnFVQbtV+YxMMmgjKJhn2+XgFTVaieputN6zCHF/Hepuz+vNTyqX 1J1OB/pemO6hJnnJ5kUwxZr/psWIODg4OQomE8/Vjavmzj7wN9C8HFstrUqxny8PpZWT h7iOj7r5WRuJ3pcaFR8vIz6DxRb7bTr9IsWSSwNQgGiK1I9do80v66NkZvjKQ7OX0Ote EDEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GD//s0JqI+KeAlnmxGXuzGHGexOP9orqqmZkOhYLw7U=; b=r5zHSWIgoqbA+L1TDEYHI3g0rmIZEM6r27A2jl1QyUBa516WaBw83uQ9uXBMo/4BHb Qh1alW5UC/wpVVBSuKwT9t3oVg0yOzxioVhXq+HzbJUE0zvQfQoerhQAeWio2vTaXJzA O5sMTA4UgBLSXP02u5aVWVqARavZMKxpTWRjdAOu7jxWThJ33Ea5QBLe/uEqceYXXHud Hhh8ec+xXnImXN5IxofrqIgF2yI11qvvawqQiyFuZhXMgGL7l/jdHXWmOFf4qn48VftG J7Je5NGs0VcGrT1M1QIfjvk/EiFkSxdzGAlSJY8QOUJ/4xh+GUiWJefJGXvlzZZdvqKF 0UEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bxKCWV0p; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id l15sor11133342ljg.34.2019.02.28.05.59.35 for (Google Transport Security); Thu, 28 Feb 2019 05:59:35 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bxKCWV0p; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GD//s0JqI+KeAlnmxGXuzGHGexOP9orqqmZkOhYLw7U=; b=bxKCWV0plbqK1C5WfZfPpwf6fpbP94JQ/X271V/yQ5/QjJlyWO+wSIazjrGUubTSBD QreM+rLgJtP3DejcY1iHhPkN9dEh9EeG6CY0HTwy+GBS0MGSX/Dp/EOzA/WWQyhkuBzZ wtYAG9J2Rrkvxle66XhIqeoI2kF038iqHWp3k8aol4M2xcvcrWxY/e4swHu+Wn8OdaFt TPxsXx0d8oKTgHlOFo56ALs+JLy1b36GwFDgtIMSD+zRls/6y5/Y5BJlW4BzDFwYbz/F D67bwwhIV5FNqWH+Xg2NdwvzFQMVohZb+YVTD5ZBV3sLP7pMAOG/bbjFCEwWH9klV2LX 7Tbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GD//s0JqI+KeAlnmxGXuzGHGexOP9orqqmZkOhYLw7U=; b=fdk9NYBSghm4KfaM+c8c6X6nRDQuZUWI8p5u7sCNYJ9yPam0LQSZDPUx8eL4Y7IJyI ILUzZW3MbhNLHC2KFc2Bv/0llwhsQBnmsC4hcobhtlyDvVagFPTu9auyy51IySexW+hP QRTjdHF4nARACmGo0PtzAj+6XcYq2f2iMDxQmNa21LrJk0gGSJTt4gY98nhL42tLw3gP gI+h373d1a9z/1fJI84oBtYjYDix/Pp4dYhAbma6ZGvvqfTkz3VJWIhN8Fv4GEZguZCf 1sgXy2YPkuTKT4NuRKvSzH1xQdmPrud8eGJny2cdWT6UMi7dCDr5oQdTuQmNUa4AXX+3 l+uA== X-Gm-Message-State: AHQUAubuhVUqYmX34fxQm4VjDiE8JzvfT0WbxsBRC1crQASJPc91Y+4s xiWe75dGi0D5vLBMytP+4YDbkaxo X-Google-Smtp-Source: APXvYqwLBvpBuNN3H00hxi679411B3GMNc7DVG02j7EI5Mmnve0xO8zse4d3ORBN/k59dI+VI1ByKg== X-Received: by 2002:a2e:8694:: with SMTP id l20mr4846832lji.152.1551362375281; Thu, 28 Feb 2019 05:59:35 -0800 (PST) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v20sm4090265ljv.83.2019.02.28.05.59.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:59:34 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland Cc: Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Thu, 28 Feb 2019 14:59:19 +0100 Message-Id: <20190228135919.3747-8-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190228135919.3747-1-ulf.hansson@linaro.org> References: <20190228135919.3747-1-ulf.hansson@linaro.org> PSCI firmware v1.0+, supports two different modes for CPU_SUSPEND. The Platform Coordinated mode, which is the default and mandatory mode, while support for the OS initiated (OSI) mode is optional. In some cases it's interesting for the user/developer to know if the OSI mode is supported by the PSCI FW. Therefore, let's print a message to the log, if that is the case. Cc: Lina Iyer Co-developed-by: Lina Iyer Reviewed-by: Daniel Lezcano Signed-off-by: Ulf Hansson --- drivers/firmware/psci/psci.c | 21 ++++++++++++++++++++- include/uapi/linux/psci.h | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 14d25b54b9f2..417d43886948 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -95,6 +95,11 @@ static inline bool psci_has_ext_power_state(void) PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK; } +static inline bool psci_has_osi_support(void) +{ + return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED; +} + static inline bool psci_power_state_loses_context(u32 state) { const u32 mask = psci_has_ext_power_state() ? @@ -659,10 +664,24 @@ static int __init psci_0_1_init(struct device_node *np) return 0; } +static int __init psci_1_0_init(struct device_node *np) +{ + int err; + + err = psci_0_2_init(np); + if (err) + return err; + + if (psci_has_osi_support()) + pr_info("OSI mode supported.\n"); + + return 0; +} + static const struct of_device_id psci_of_match[] __initconst = { { .compatible = "arm,psci", .data = psci_0_1_init}, { .compatible = "arm,psci-0.2", .data = psci_0_2_init}, - { .compatible = "arm,psci-1.0", .data = psci_0_2_init}, + { .compatible = "arm,psci-1.0", .data = psci_1_0_init}, {}, }; diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index b3bcabe380da..581f72085c33 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -49,6 +49,7 @@ #define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10) #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) +#define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15) #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) @@ -97,6 +98,10 @@ #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK \ (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT) +#define PSCI_1_0_OS_INITIATED BIT(0) +#define PSCI_1_0_SUSPEND_MODE_PC 0 +#define PSCI_1_0_SUSPEND_MODE_OSI 1 + /* PSCI return values (inclusive of all PSCI versions) */ #define PSCI_RET_SUCCESS 0 #define PSCI_RET_NOT_SUPPORTED -1