From patchwork Wed Mar 13 08:36:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 160207 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp14045710jad; Wed, 13 Mar 2019 01:37:07 -0700 (PDT) X-Received: by 2002:ac2:548a:: with SMTP id t10mr13958680lfk.115.1552466227030; Wed, 13 Mar 2019 01:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552466227; cv=none; d=google.com; s=arc-20160816; b=lRViILUlZKK+hiebl32TTmKfM7czzRVGEWaR1NGe/IQQNj5p1Q07IeYXiDlfBQY4/e CRs1334EK7eaPfmBUGXT3WIggLvaj9eQ5zbZZ7p4Jx61V5k9kHZ1brBTi9wag1pymA1v fiyLJKhnPcBoc2f78qM0QUag09Y//WMuG0OsZtNAUOwzWDjFEqse8ZcizjWjMRtgYQE/ Zx5xPhkKztKqbCoEDqkFBJbbPqvh1mxW3P6+m2owzO8dhoJnspjtTrwff9qmzMuQarWL +nsEwLT5Bov7saenLBBxLXi+aZ8FDpNC6M/V/bdKuqx1LnXEqxjvKRvCQrlOYsXZLYuI Pe6w== 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=LNxQpIwxT1JmfOXeE0uJOYnKkmng1Hu5UTgquERxi8o=; b=ljr9GkgOK1ENLhqOlHOtWSRdniYFcRhlVbg+Ws5izZFweOYDSFGYxas0d2BsHPa0R/ 6OJBGsyL/3HvCAUF3v0rM0CJ5VyLVebece+Kbcj9A7Q3D/wSWoArhHfgCBBiwyWpAc5e oQJiR5a6PmrZnlsdJsw1HcgmHQ5FeipKGFB3y7x3vzs1Ar4dY683eYzi9HYqS3ept3vI Gi+5bw4IedEUiR1T4hoW80ALuy5ygjTpb8qVXZgpJVDfkgy/npgD+SqcAj8Mt+1fG8Hs 7IdwTbggfEye7c2HJ22tWr7YMEuZG6srqx412T9br8vx0Tc+eeYTmHlJsYL6IQk9aiRb YKyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tZIJkwo0; 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 s19sor6660763ljs.28.2019.03.13.01.37.06 for (Google Transport Security); Wed, 13 Mar 2019 01:37:07 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tZIJkwo0; 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=LNxQpIwxT1JmfOXeE0uJOYnKkmng1Hu5UTgquERxi8o=; b=tZIJkwo07TH515pYyq6fdHyj8nNsF8M7volhDW+9uQJPXoCKRDiow3wgQxWyGbI/gZ bnk3xttzrBR2ClU+9V3ogfOgLSJd1LYML8VR08sqhCk6NALiUz4Vj9m5wsphnqDlarEo 8XaE2kI5j97n0znAGpiTWmDDQTgIbvEX4BMsJQH9k1DpD0pofARDiNFSwa5/N3i/V+LF UGGgy7Vsd/k3Nb2/qra1YmdkgB+MmpR11S/bEI/2fKV9NGTGY85b5bfhNebj1VRwhu8Y lp+dmpbDpNkHXHFTL3I9BLxgpbBVuiSiKP5ct6xk3ka47aUwqSYErW0XOVpggsksUQJ5 Djlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LNxQpIwxT1JmfOXeE0uJOYnKkmng1Hu5UTgquERxi8o=; b=SfI22dtFN83JFZCjcYKA+b7Ur4nvz/d4qUyamGHXaMU4UOyhd/AfpTAzQtOPTeqSxH 0acWS7qIBN2gRrEnqCEX9ruOXSKI8nUZQ7agPRVuBNYdhb1s6haCXYk+BmiCrK1tHJpB AhyFQ4ad+tuU3j1XMt2GeqB2exT+9dZsQwtdsx26hlA/zpJTw4PHFi2P9FGKWTr2Aa7r bJQW+9WZXTFGPKSwEZltkiYihtqbQuhAwgYNoby97N1vz3SiIzckwzAF38rPaybMDzNn VPiisiS5OFox+p2MEiOKyNmM7OVlxvIyBQF6BV8zwRu5mxqRPoP+d/YA9INa5gzrsxrl bl+Q== X-Gm-Message-State: APjAAAWaahfyyZLrkF+HxJFPh7iD4nQFvagp68IA1c73gbM1FTj3pSL0 ahJ5WKcHDIVzxa4n9yFoLyqSL+Na X-Google-Smtp-Source: APXvYqydQnmbrxfgJzVE90WxzKNbqOoGEA003+fAU9hhkh3M/4lap/JSdMvH1gYnL14y6xthxlUlQA== X-Received: by 2002:a2e:9dda:: with SMTP id x26mr22258657ljj.53.1552466226627; Wed, 13 Mar 2019 01:37:06 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id a23sm1707716ljd.20.2019.03.13.01.37.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 01:37:06 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Lorenzo Pieralisi Cc: Sudeep Holla , Mark Rutland , 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 v2 1/5] drivers: firmware: psci: Move psci to separate directory Date: Wed, 13 Mar 2019 09:36:55 +0100 Message-Id: <20190313083659.7100-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190313083659.7100-1-ulf.hansson@linaro.org> References: <20190313083659.7100-1-ulf.hansson@linaro.org> Some following changes extends the PSCI driver with some additional new files. Let's avoid to continue cluttering the toplevel firmware directory and first move the PSCI files into a PSCI sub-directory. Suggested-by: Mark Rutland Signed-off-by: Ulf Hansson Acked-by: Daniel Lezcano Acked-by: Mark Rutland Acked-by: Lorenzo Pieralisi --- drivers/firmware/Kconfig | 15 +-------------- drivers/firmware/Makefile | 3 +-- drivers/firmware/psci/Kconfig | 13 +++++++++++++ drivers/firmware/psci/Makefile | 4 ++++ drivers/firmware/{ => psci}/psci.c | 0 drivers/firmware/{ => psci}/psci_checker.c | 0 6 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 drivers/firmware/psci/Kconfig create mode 100644 drivers/firmware/psci/Makefile rename drivers/firmware/{ => psci}/psci.c (100%) rename drivers/firmware/{ => psci}/psci_checker.c (100%) -- 2.17.1 diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index f754578414f0..e1385f47d4ac 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -5,20 +5,6 @@ menu "Firmware Drivers" -config ARM_PSCI_FW - bool - -config ARM_PSCI_CHECKER - bool "ARM PSCI checker" - depends on ARM_PSCI_FW && HOTPLUG_CPU && CPU_IDLE && !TORTURE_TEST - help - Run the PSCI checker during startup. This checks that hotplug and - suspend operations work correctly when using PSCI. - - The torture tests may interfere with the PSCI checker by turning CPUs - on and off through hotplug, so for now torture tests and PSCI checker - are mutually exclusive. - config ARM_SCMI_PROTOCOL bool "ARM System Control and Management Interface (SCMI) Message Protocol" depends on ARM || ARM64 || COMPILE_TEST @@ -270,6 +256,7 @@ config TI_SCI_PROTOCOL config HAVE_ARM_SMCCC bool +source "drivers/firmware/psci/Kconfig" source "drivers/firmware/broadcom/Kconfig" source "drivers/firmware/google/Kconfig" source "drivers/firmware/efi/Kconfig" diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 80feb635120f..9a3909a22682 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -2,8 +2,6 @@ # # Makefile for the linux kernel. # -obj-$(CONFIG_ARM_PSCI_FW) += psci.o -obj-$(CONFIG_ARM_PSCI_CHECKER) += psci_checker.o obj-$(CONFIG_ARM_SCPI_PROTOCOL) += arm_scpi.o obj-$(CONFIG_ARM_SCPI_POWER_DOMAIN) += scpi_pm_domain.o obj-$(CONFIG_ARM_SDE_INTERFACE) += arm_sdei.o @@ -25,6 +23,7 @@ CFLAGS_qcom_scm-32.o :=$(call as-instr,.arch armv7-a\n.arch_extension sec,-DREQU obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o obj-$(CONFIG_ARM_SCMI_PROTOCOL) += arm_scmi/ +obj-y += psci/ obj-y += broadcom/ obj-y += meson/ obj-$(CONFIG_GOOGLE_FIRMWARE) += google/ diff --git a/drivers/firmware/psci/Kconfig b/drivers/firmware/psci/Kconfig new file mode 100644 index 000000000000..26a3b32bf7ab --- /dev/null +++ b/drivers/firmware/psci/Kconfig @@ -0,0 +1,13 @@ +config ARM_PSCI_FW + bool + +config ARM_PSCI_CHECKER + bool "ARM PSCI checker" + depends on ARM_PSCI_FW && HOTPLUG_CPU && CPU_IDLE && !TORTURE_TEST + help + Run the PSCI checker during startup. This checks that hotplug and + suspend operations work correctly when using PSCI. + + The torture tests may interfere with the PSCI checker by turning CPUs + on and off through hotplug, so for now torture tests and PSCI checker + are mutually exclusive. diff --git a/drivers/firmware/psci/Makefile b/drivers/firmware/psci/Makefile new file mode 100644 index 000000000000..1956b882470f --- /dev/null +++ b/drivers/firmware/psci/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 +# +obj-$(CONFIG_ARM_PSCI_FW) += psci.o +obj-$(CONFIG_ARM_PSCI_CHECKER) += psci_checker.o diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci/psci.c similarity index 100% rename from drivers/firmware/psci.c rename to drivers/firmware/psci/psci.c diff --git a/drivers/firmware/psci_checker.c b/drivers/firmware/psci/psci_checker.c similarity index 100% rename from drivers/firmware/psci_checker.c rename to drivers/firmware/psci/psci_checker.c From patchwork Wed Mar 13 08:36:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 160208 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp14045729jad; Wed, 13 Mar 2019 01:37:08 -0700 (PDT) X-Received: by 2002:a2e:3a0c:: with SMTP id h12mr1111436lja.183.1552466228542; Wed, 13 Mar 2019 01:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552466228; cv=none; d=google.com; s=arc-20160816; b=QwaI2x0lEW+e1niSu+kXHdbkA9oA0lBFs7fQH3EDzRJUpTM2sgfHGKkHv178J5Qum7 qhpBUjd51sOj2BeisJqxiA1llqssfA2NAsgQ7AMOUqD5bVwtMHR7GONm9eT+TNbbOncg mVnV/Fuve8y9jzPH7gyPyQ6mPTq6plHy8TR1/U1DnMVXvmb0XbLGd8SQ4F0t4FFoGNN7 2S0MddyJ0Vl1E4xIrBmNepH4YQ/EqBC6byS1cUafr0fqxb/1lB8a8ccciLxjRt74WRL7 YO0dDGXHJoem3aaEmJlBkomWXMXRwqxTlCa+Q4YkIGqyKGyDc4uRO9es6WKN1yKFtlsI Q5fA== 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=wXapuDJ/TxdZdSmwteecFqdWBuQB0h5GI4Aq0atblIM=; b=baCZnrJICrcpUdOYROMgTzs+hv5R3v5pItNyz/UyJMngwvn0MK4vyKApiMj9KIHS6Y WkkxPdre30AZYbeKWV4+YVD1Q01lCD394MSgvWB1EXq4gxa1mCuYaePZGottfFooVLlW IQZXBFC7LRhw87lGuIBNeUPv+0IWlgpiGnGxSJ/xaq9Inw/rDecFBWLegYs1EoMAQjrn gz/kqdhp1x1ze68Pn5Fn5IWUrQEI2kUU+t8Osczza5ZfWjFP5cufMiHBRFdZ8wbLuXo3 nyx61iFStlbQU9WvvqqvsctPfdqA5MoOCVB9YAahibIuZsEvo2trhBsd9okQ+oG6Xpxe AtSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UG03IFrK; 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 h20sor2993616lfj.23.2019.03.13.01.37.08 for (Google Transport Security); Wed, 13 Mar 2019 01:37:08 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UG03IFrK; 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=wXapuDJ/TxdZdSmwteecFqdWBuQB0h5GI4Aq0atblIM=; b=UG03IFrKLS7qPDvXkQBipZ6olkkLjZGtf4y+g0vP284yEVpeIs/wpf6sRS0z0823Xs sETGgK3VJV+7FMAU6xhjQNBGEZKt9d+iiMycQNBY6+5PsbGyEpz5erpt6rIAMtNMvWIe 5R56zDmn4LfUEBoJRdEmB4THA3UvcoySX5zw4KjUHJ2rbMcgmBGxczxp/HY6KfTQiETz 9egy4TJVt/uT2x04XyYl5gfs26iHyNJVLRsGCjzT1grANTqHgBw3wKejcu8diRfVLP3+ OV8vxv5QiKTtks1ZrMb9eGrhKO3IvPE3AyH15KJMQFgkILQY/HDJHssAOoYlBUIutF0q vLzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wXapuDJ/TxdZdSmwteecFqdWBuQB0h5GI4Aq0atblIM=; b=bzljafXP0CfftQIAM3mISbxd3VtWvjg7fzOPlg0XUkQMN1Y/sFw9SEWfGVzUV3yXL0 UAXG9UZLMQcfFxq2szLziOJV9LuVlZcqRudgI5pT0tP1cb0S0tE+bg6U5KhBbEKziRk3 9B8uJEzWLkTSY36JsksO4Sm+P3OdPtKyZLoXnxng4S63lHvDNKB/Ho0xIqRvVklyJeVb FzK7jBj6Ss7E1L+XUj9LidLBHVRSvjFjbY95e7ZiwtDaga6e5dx9i/ppoYcBxBA/dHZS MRTHkrkDoeuJfbtXqfDcnvjotJXBjcJr5bbYRx18GpH73eDc+eFWYTIcK5Tj3ajo2oS4 lbvA== X-Gm-Message-State: APjAAAWMGYbEk9h1vznb7aw15U1CxshPck8bguWZCtAPBYpGdxE+U5UQ btqfgY8zDnoGo0IZ87/duObFfgsHRqLiCA== X-Google-Smtp-Source: APXvYqwxT83yk6AKKclQYQDujXakyrFGedrnLmXS0kqchel5AWw9xTEJiEzzask6eDWiGid8xcWJRQ== X-Received: by 2002:ac2:4355:: with SMTP id o21mr20467825lfl.85.1552466228116; Wed, 13 Mar 2019 01:37:08 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id a23sm1707716ljd.20.2019.03.13.01.37.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 01:37:07 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Lorenzo Pieralisi Cc: Sudeep Holla , Mark Rutland , 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 v2 2/5] MAINTAINERS: Update files for PSCI Date: Wed, 13 Mar 2019 09:36:56 +0100 Message-Id: <20190313083659.7100-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190313083659.7100-1-ulf.hansson@linaro.org> References: <20190313083659.7100-1-ulf.hansson@linaro.org> The files for the PSCI firmware driver were moved to a sub-directory, let's update MAINTAINERS to reflect that. Suggested-by: Mark Rutland Signed-off-by: Ulf Hansson Acked-by: Daniel Lezcano Acked-by: Mark Rutland Acked-by: Lorenzo Pieralisi --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/MAINTAINERS b/MAINTAINERS index a419acaa01c5..97dcec6fc877 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12257,7 +12257,7 @@ M: Mark Rutland M: Lorenzo Pieralisi L: linux-arm-kernel@lists.infradead.org S: Maintained -F: drivers/firmware/psci*.c +F: drivers/firmware/psci/ F: include/linux/psci.h F: include/uapi/linux/psci.h From patchwork Wed Mar 13 08:36:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 160209 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp14045752jad; Wed, 13 Mar 2019 01:37:09 -0700 (PDT) X-Received: by 2002:ac2:5638:: with SMTP id b24mr6784348lff.18.1552466229770; Wed, 13 Mar 2019 01:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552466229; cv=none; d=google.com; s=arc-20160816; b=VEJYipOvVhyW3WV6CZoujpyo71HphUS14dGJ2RKiLIogCRz10g3c6cYqTd+Uv1mK6Y Tn9rP/IM7cOZnC57hmvSOmKDcUzhuLbtpiZ1BPdiZztBk8SK9kk7PXCDEv7YHH/rTZ3Y fxzTL2TyMMWi8TfyXjttOmiPjrnbICJV4jBNZV8j+s+EF8tEB41daizwJINHwpGN4c3k Ug6Ysz2em1S33f/AEhcAUIYb/y+5XQbnIA3CFjj3CUrepPsUGqOp9Pe8b6BlXlvWe/fi DybKvocsdFXuc573r9cQgPqAujNLIBGkkpCxXD28g7If+Vc6w5/6w9L4n9ds7v6YENrO Xmzw== 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=fqLAcdPj/NLZOrfZZI3kgT4b9oSplDLhcdYfEWYk7f0=; b=c6Nww1Ppwo/2oE8zUVxVTlCPKXWu/I6WqItIVOVq0Z9X0u+qxUDwkqCDsGePxOxfL0 p+T0k+NXLYv2840EC17ri09p/nuNlrbLIrH9KE0aY/yKBsSbADtfuWgxYaUTRTzl/DBM 0tDXqtSHHlO+KBvKOcE9f/RmrqWU960AapgzheCvGphanECka8upYU9C+MMvS2vCe/uV LU5z1ULAFohtefPWGuERx0IDQoDAtMi9Dcvp0vuTUeyOIwz9qFoYzSyBO3WSe4r9YmVe uB0qn7nj6KqB42WnUdcIiXTVutCHPqrx/hdmz/vOEWMdWbBRQP6IjHBACmw4uHt4eDAD O+yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PZKTNnD2; 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 q5sor2989799lfc.64.2019.03.13.01.37.09 for (Google Transport Security); Wed, 13 Mar 2019 01:37:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PZKTNnD2; 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=fqLAcdPj/NLZOrfZZI3kgT4b9oSplDLhcdYfEWYk7f0=; b=PZKTNnD2nwwHzJ7qoJoJQv4NDheskpbJ1YxcSM9eJF4owUl/WfZng6DstF/znQ8x8B pDEo/pJ61thVr5M/+qqLUAkj0+OBtXQmLuwrGxf8WSVHw+IiaOlDqV1fsXTjNCKgAnQb TJzEXazOl8YtWqn5cOuHlqSFQO2jQXIoQrLaXx9VcX1FNUp8cauGDy/4rLGCUvJ8sxZ0 yxM5fF/CvN6YRxRRiq8FvpO/JGQb9QX2B1LfzOKTw7H1qQlBUuh408M+G0j74Gxi+xsP Tj/lfMCSQb/y/txQziLhAwYHSbtcWmjdMsHdd5LP0Jn9TS5jwo4vy2Z9wpRpmN50a57J jIDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fqLAcdPj/NLZOrfZZI3kgT4b9oSplDLhcdYfEWYk7f0=; b=KwdM7pUKCZOetjD1707OuuqSNwpyWjuAPRLuDNomQ/IWrkjoyx1RLVjIn06u+EfcO3 DTxbvu9J0D2lodMRWQUBpJW2odoOnrDhkB1WLqNuJhDIghKb9TVl1rkU0VzVwGMwHhJg 7BhKS4M9D7LHel8vXkaPElarvq9RBL5NgqFF724qywObObySYpZUgQ0nayxB25HQsY20 XEg5KOTfeKP0MS6L3E9vL7DDj247tXR68m5QtiqTAqg5kOgtiINwymW/fj+NwvXdcodI 58AONuM4NAiMXClJ/2axtHqYb8dAx7xVLs6wL9YvhczUIGEIjP8LTNwnXXvHsWZbyKAO l6yg== X-Gm-Message-State: APjAAAXaRSPbIT5wmp7drYRqxyN7k+Uq1ZCDJ1wNKHbgf7antZHF/eqU XyO6DZwXADhSjLMIrAWaCgub5Uma X-Google-Smtp-Source: APXvYqw0YNNaw6inULtc2yUsTyMmfoNTgmT4UYRb7G0yq3HhG73gLEOmrT21PpBm2ilWoX4z2aWjGw== X-Received: by 2002:ac2:51a1:: with SMTP id f1mr1139636lfk.25.1552466229393; Wed, 13 Mar 2019 01:37:09 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id a23sm1707716ljd.20.2019.03.13.01.37.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 01:37:08 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Lorenzo Pieralisi Cc: Sudeep Holla , Mark Rutland , 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 v2 3/5] drivers: firmware: psci: Split psci_dt_cpu_init_idle() Date: Wed, 13 Mar 2019 09:36:57 +0100 Message-Id: <20190313083659.7100-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190313083659.7100-1-ulf.hansson@linaro.org> References: <20190313083659.7100-1-ulf.hansson@linaro.org> Let's split the psci_dt_cpu_init_idle() function into two functions. This makes the code clearer and provides better re-usability. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson Acked-by: Daniel Lezcano Acked-by: Mark Rutland Acked-by: Lorenzo Pieralisi --- drivers/firmware/psci/psci.c | 42 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index c80ec1d03274..9788bfc1cf8b 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -270,9 +270,26 @@ static int __init psci_features(u32 psci_func_id) #ifdef CONFIG_CPU_IDLE static DEFINE_PER_CPU_READ_MOSTLY(u32 *, psci_power_state); +static int psci_dt_parse_state_node(struct device_node *np, u32 *state) +{ + int err = of_property_read_u32(np, "arm,psci-suspend-param", state); + + if (err) { + pr_warn("%pOF missing arm,psci-suspend-param property\n", np); + return err; + } + + if (!psci_power_state_is_valid(*state)) { + pr_warn("Invalid PSCI power state %#x\n", *state); + return -EINVAL; + } + + return 0; +} + static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) { - int i, ret, count = 0; + int i, ret = 0, count = 0; u32 *psci_states; struct device_node *state_node; @@ -291,29 +308,16 @@ static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) return -ENOMEM; for (i = 0; i < count; i++) { - u32 state; - state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i); + ret = psci_dt_parse_state_node(state_node, &psci_states[i]); + of_node_put(state_node); - ret = of_property_read_u32(state_node, - "arm,psci-suspend-param", - &state); - if (ret) { - pr_warn(" * %pOF missing arm,psci-suspend-param property\n", - state_node); - of_node_put(state_node); + if (ret) goto free_mem; - } - of_node_put(state_node); - pr_debug("psci-power-state %#x index %d\n", state, i); - if (!psci_power_state_is_valid(state)) { - pr_warn("Invalid PSCI power state %#x\n", state); - ret = -EINVAL; - goto free_mem; - } - psci_states[i] = state; + pr_debug("psci-power-state %#x index %d\n", psci_states[i], i); } + /* Idle states parsed correctly, initialize per-cpu pointer */ per_cpu(psci_power_state, cpu) = psci_states; return 0; From patchwork Wed Mar 13 08:36:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 160210 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp14045765jad; Wed, 13 Mar 2019 01:37:11 -0700 (PDT) X-Received: by 2002:a2e:7816:: with SMTP id t22mr597629ljc.25.1552466231467; Wed, 13 Mar 2019 01:37:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552466231; cv=none; d=google.com; s=arc-20160816; b=G3GVI9OoZi+ROHv01ja8QxLQQ+O6uuzDLnUY0lQf3ZkpYGpguBzudzfSBukaRgrnfO 8didn7o/bKu53HTzw7O7ON2Dv5aYj0sDgyNfSjqWNrLrg3g9lZkaiY/P9/zwciNTZrmY ajK50yONqivTwxjRWrWek0rEXFUl9n6CZy5rEInLCT/w9Zyu9PXITVBjHOYz0/u1fLv6 zy3GbaOsbJFDEp/9w+f31DKXZdy7/T5FhPpHL9iIs8EAWrXO34y9KrBDh2Zlifp1AC3q w4/Wolli5hdxpKRkq+ssLkpWCuKGKeFPhUYq+Ydj5Qzbq+JaDLtRWLh8GLem3zAgPFfk venQ== 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=/i1P7RcZS0nPamy0F7apI0HkwNW2ZATDEDVSzcyhElI=; b=DV5mcsOFQXqZ2zxbi/G6DEVF/K2aifALIu62KDHZmIQ57yDMPu7SQa+UyayTfkz94O zt7nys2rWF/Z9ebxRDszCXmOwSwKlWDARle7D8SJeMPYinGrnh8HaL7ncWchMQ42F50a 4VeyN/jHgJ0R1ENNA/lag89zyAgSGbLphSJPfclyIbI/IL/cX9BPz0yufp1QO7r3stF8 vxE7l9KQtPxWSfRCJOxPcusoQxixKPm+9yMgrszGPCwDtRqJR8Z4Y3dqgT/hXm6UmR8I qfYF33yPr3iZ8bWp5oFuO8SDEFaT03+F9v4RU9Lk4eT80JIaXL61GfCEQ2iDQJyukpXT yYlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LNCVQhFp; 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 f75sor6460073lji.38.2019.03.13.01.37.11 for (Google Transport Security); Wed, 13 Mar 2019 01:37:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LNCVQhFp; 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=/i1P7RcZS0nPamy0F7apI0HkwNW2ZATDEDVSzcyhElI=; b=LNCVQhFpUnIOYlMOLUOr9mSM5ufWoZgXkbtMcNfVpkPXTftWr8Gw2KduEBb2OJid0k ZgI5gQqetdcd8ZwZ1dlP8lp+5epDmkQqxiM58kUOir8YdPU8LMaLu9ZgY+uGi/9ErKiD zEAy7Ub8jGCrBlsroVQjdMIu8iAXfQhexCgYPSAekZIXCy4cAX3QVSDP3Vf6oS4pm0i7 RFkyE2vlRtqKEUq5AQJgmmnpEzPpn36k1ycO26wqVnn0ANSUeg3NhwmtMtoMy151QESE JJ03Nj4v4PLn9wg+fjV/QDj3/tUG1hFiqfV8AyxkgpkWyB1OCeoj83ql5ucPdrULMyg3 gtcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/i1P7RcZS0nPamy0F7apI0HkwNW2ZATDEDVSzcyhElI=; b=M88DOkSedDrvf9vh7VtORAQIvN2czrRsBEKiVF8YStVLFDVWBSJTf8+XlTaQFGJg5z coQT+ydN7ICtYvuPNCB2cmI7s1+DeMAIp0Q0zPIXg8PUo9Y/OSnJpW6x0/a5+wrpgvkg ouSmDyxOO0Ia6HeF/i2ESavumYGU4amAFng0xrR1Uu9uYMJczYDfWiLcj1rFqIFShIEw 8+KJ/XV2UKYE2NyM3DAoNvRoQ9e+9J3AW0xKDCydB5xTY8Mn2bmPpVHYBOZKE1fNKksF 7QnAI4iTlbvXh2PEeOrvtxnKhg7gvlSmFVzsV88QahNbFe8MaXrNstznnmWLoLuoY+af Fdkw== X-Gm-Message-State: APjAAAW+RlHy0zdsmC2LDAXajqdT1xCK+arJtIRVUoOg735A0tJ13/IV d4qKWYFrnGfLZTcbCYZtcdfeTu0O X-Google-Smtp-Source: APXvYqyz0xVl/9wVKjxyA7k3YPcw6zwyqcIHTFAw+4Quuz1CFeIEK39/+Z84eyG9JSC3B7vo5kED9Q== X-Received: by 2002:a2e:80cd:: with SMTP id r13mr22164205ljg.34.1552466231095; Wed, 13 Mar 2019 01:37:11 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id a23sm1707716ljd.20.2019.03.13.01.37.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 01:37:10 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Lorenzo Pieralisi Cc: Sudeep Holla , Mark Rutland , 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 v2 4/5] drivers: firmware: psci: Simplify error path of psci_dt_init() Date: Wed, 13 Mar 2019 09:36:58 +0100 Message-Id: <20190313083659.7100-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190313083659.7100-1-ulf.hansson@linaro.org> References: <20190313083659.7100-1-ulf.hansson@linaro.org> Instead of having each psci init function taking care of the of_node_put(), let's deal with that from psci_dt_init(), as this enables a bit simpler error path for each psci init function. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson Acked-by: Mark Rutland Reviewed-by: Daniel Lezcano Acked-by: Lorenzo Pieralisi --- drivers/firmware/psci/psci.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 9788bfc1cf8b..e480e0af632c 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -609,9 +609,9 @@ static int __init psci_0_2_init(struct device_node *np) int err; err = get_set_conduit_method(np); - if (err) - goto out_put_node; + return err; + /* * Starting with v0.2, the PSCI specification introduced a call * (PSCI_VERSION) that allows probing the firmware version, so @@ -619,11 +619,7 @@ static int __init psci_0_2_init(struct device_node *np) * can be carried out according to the specific version reported * by firmware */ - err = psci_probe(); - -out_put_node: - of_node_put(np); - return err; + return psci_probe(); } /* @@ -635,9 +631,8 @@ static int __init psci_0_1_init(struct device_node *np) int err; err = get_set_conduit_method(np); - if (err) - goto out_put_node; + return err; pr_info("Using PSCI v0.1 Function IDs from DT\n"); @@ -661,9 +656,7 @@ static int __init psci_0_1_init(struct device_node *np) psci_ops.migrate = psci_migrate; } -out_put_node: - of_node_put(np); - return err; + return 0; } static const struct of_device_id psci_of_match[] __initconst = { @@ -678,6 +671,7 @@ int __init psci_dt_init(void) struct device_node *np; const struct of_device_id *matched_np; psci_initcall_t init_fn; + int ret; np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np); @@ -685,7 +679,10 @@ int __init psci_dt_init(void) return -ENODEV; init_fn = (psci_initcall_t)matched_np->data; - return init_fn(np); + ret = init_fn(np); + + of_node_put(np); + return ret; } #ifdef CONFIG_ACPI From patchwork Wed Mar 13 08:36:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 160211 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp14045781jad; Wed, 13 Mar 2019 01:37:12 -0700 (PDT) X-Received: by 2002:a2e:2c0d:: with SMTP id s13mr23832430ljs.96.1552466232819; Wed, 13 Mar 2019 01:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552466232; cv=none; d=google.com; s=arc-20160816; b=Azg+eWXYwj7sQWtRPK4pP9wsLPbDnumgku6S9Ex5R6vtjt8hJh9RQcYIpJl94V4BrN tTA572b2Yugv2b+ICR209oY6z3UjkD8k43lRTFc4K3UXlfdlwwDr8eZ9UYT5BOusZwXQ gjrXLAmmMeMdrYepYxu2+I04mblCWcF86hHAWuLXjUHdcYQWCdcEqJeYFB/467sUcuvE NBRhlYCCkJfrQOrCqeDgm7GpHB7SX5oX1LJwfJLR9imXWtelZucAhphjGFYFoPLZsLXS 0IYhyP7ocbb/eC1qGFr9ZD/ecYbpYfmdVuCj5U0huuCj6le4emqCm/AIs5aI/KgdlBbJ H0zw== 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=49oAUcefl7Qs60t5vd0C3ulsmkkBE/5vo7x8P2YQaHM=; b=ql02whM55v+DSm4SlglCaL6+TpNVAlMf5zKD/AlwMfJBV+7kzxa002r0njaMLV7Sr7 21oeTxoExmj82svlpf5fP9ZXHwWpG0Mh6+7m9Ud82KWqcxJtVqNxdVHK21VTpWJGdwcP u2Ngju2L9jRLZse7KT7tp6eC6uhRVdOlFJFZgbSeNyvooGf4jx/58AwQX4Z9KjRBEkIV Q3ZUnbGf9cqL9tjOELlHjEsf/QlHdG/xKbJ4PafhbVlGhdEy7ID6HMJGPFOKwcs0ENEp ueWIp15ZTxgErnZJMcIWip8bYHXSDRYcn1GGkC8ZWDjMCLD/9G+1SY2JnOXp41iX6uo8 3IvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AaW900pJ; 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 u67sor6521120lja.6.2019.03.13.01.37.12 for (Google Transport Security); Wed, 13 Mar 2019 01:37:12 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AaW900pJ; 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=49oAUcefl7Qs60t5vd0C3ulsmkkBE/5vo7x8P2YQaHM=; b=AaW900pJqH+ZvraqyUDS8w9k7SNv6l9CJOI6zb+S6ZGSC+ZtfC3ivkC+d1hO8U7zeF vWZvnMcRTcLkzbe0HB8fZu9dSaZQtPfSiFc+vkeFKKEHasb4AkRFa8BwFAiTGsFw7wHw u5wXvEwgKu2yP6sjiYHUjL63Nw4xsq2+SC5c7SIuURaiClnK8+SUcTg54Inu2H+FkAm4 bHO8PPsXCEW3QDaaJ34JrQlPQ9GBrHBj7CtfWCIQ4zM6cXVgj41lCL2Jak84pnuXvkS/ 5lEKE86L+2wi3J2SNJmSryHE+qBIqdZCpyD3Xdx0VLeVRenmgE6jVZeqboxv0xzU7/Uu mj4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=49oAUcefl7Qs60t5vd0C3ulsmkkBE/5vo7x8P2YQaHM=; b=ZwcJRSvjbJJIyLKWz4XHoP2ubLswLz5L3ROp49BGwG0h3joojaGzYpr4pKuDQZB4dQ FUbOmxmpMYcZc50VY6gs18ek4SCxR8fPzIuZ8vyzhN3XdaMkwJw/CpJTUb08FuTMPLKf wOd35GZGx3NnzMh9DPsCSPglFCnxxoGgaoLDB8uUuJg0d/bMyQtlt0JD6I6JQ2YSXFXF 0ERVy1oHMB+iin0+cubyf2+KHOde5qyfIfSuBl6ukmbXzayhcO+x1xvjzy3HATZSQHS8 fjSNUVKtkd2N8jYIbwO2B972bqzd7nsroeoJ30U0xOKwWn6jUIy0tbbCJksQ1a/wpMsL f1Ng== X-Gm-Message-State: APjAAAVKIG71Y/HgwYogdDkRG6ecwVRRP2P+6kkYww0OWrMT/TEcs366 apmpiW6uuVb3XqyijBjqFxg5+BQ+ X-Google-Smtp-Source: APXvYqwM1UOmFchmb8FVNYUvMVbDbX1oYR4zYTRQUF7J3df0h9Vim0zVOeF0kvjf7PGcN1Mbj1ABKg== X-Received: by 2002:a2e:9204:: with SMTP id k4mr17998616ljg.0.1552466232444; Wed, 13 Mar 2019 01:37:12 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id a23sm1707716ljd.20.2019.03.13.01.37.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 01:37:11 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Lorenzo Pieralisi Cc: Sudeep Holla , Mark Rutland , 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 v2 5/5] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Wed, 13 Mar 2019 09:36:59 +0100 Message-Id: <20190313083659.7100-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190313083659.7100-1-ulf.hansson@linaro.org> References: <20190313083659.7100-1-ulf.hansson@linaro.org> PSCI firmware v1.0+, supports two different modes for CPU_SUSPEND. The Platform Coordinated mode, which is the default and mandatory mode, while support for the OS initiated (OSI) mode is optional. In some cases it's interesting for the user/developer to know if the OSI mode is supported by the PSCI FW. Therefore, let's print a message to the log, if that is the case. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson Reviewed-by: Daniel Lezcano Acked-by: Mark Rutland Acked-by: Lorenzo Pieralisi --- drivers/firmware/psci/psci.c | 21 ++++++++++++++++++++- include/uapi/linux/psci.h | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index e480e0af632c..eabd01383cd6 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -95,6 +95,11 @@ static inline bool psci_has_ext_power_state(void) PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK; } +static inline bool psci_has_osi_support(void) +{ + return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED; +} + static inline bool psci_power_state_loses_context(u32 state) { const u32 mask = psci_has_ext_power_state() ? @@ -659,10 +664,24 @@ static int __init psci_0_1_init(struct device_node *np) return 0; } +static int __init psci_1_0_init(struct device_node *np) +{ + int err; + + err = psci_0_2_init(np); + if (err) + return err; + + if (psci_has_osi_support()) + pr_info("OSI mode supported.\n"); + + return 0; +} + static const struct of_device_id psci_of_match[] __initconst = { { .compatible = "arm,psci", .data = psci_0_1_init}, { .compatible = "arm,psci-0.2", .data = psci_0_2_init}, - { .compatible = "arm,psci-1.0", .data = psci_0_2_init}, + { .compatible = "arm,psci-1.0", .data = psci_1_0_init}, {}, }; diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index b3bcabe380da..581f72085c33 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -49,6 +49,7 @@ #define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10) #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) +#define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15) #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) @@ -97,6 +98,10 @@ #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK \ (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT) +#define PSCI_1_0_OS_INITIATED BIT(0) +#define PSCI_1_0_SUSPEND_MODE_PC 0 +#define PSCI_1_0_SUSPEND_MODE_OSI 1 + /* PSCI return values (inclusive of all PSCI versions) */ #define PSCI_RET_SUCCESS 0 #define PSCI_RET_NOT_SUPPORTED -1