From patchwork Wed Apr 10 08:20:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 162002 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5919883jan; Wed, 10 Apr 2019 01:20:43 -0700 (PDT) X-Received: by 2002:a2e:8108:: with SMTP id d8mr21761998ljg.57.1554884442907; Wed, 10 Apr 2019 01:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554884442; cv=none; d=google.com; s=arc-20160816; b=hw3I8UsrVUr7QdTsDfQ6FimaAKlS3KhIgIXqNvXBr1X1xxykIICNlwfQGg9jt4SpO3 TEXqXX2voxGpM8PCh8GpeDBSanPwBA1CjLmhOE4c7fuxoaWyONKjo7UJp3YAbh2TBrJM oKNr966Unu/EkRTZFcROjMuusdUgn7KRPTknzfnqc1J+byKkJy33C/5l0a3pyhnXIrCu 4X+HwTPJH6PYDVy5Xaxt1zP9MClThzn4XVoA5Jtj6J22sGGRVIqHQIBHi/P7s317rxdW VD11shsI+2BcYC33mSllOVBxZb8beZ5iEVXKvaFpnYS8dFbt+DQ/1DafG2iA/Gs9+anH oaRA== 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=Pt78YSFYEYO2Y0+d48Y4okdtRiKwc6PvVFOebM7aOTzQw6E0indVTu/FOlFEq1qjfp wI5MbHy0HoTMpj5xGvd19DBsYV8tgAMjB9y0+JF622dX9Z9rP1Tz2nIdt5jLm6spcIil Zuw03/k/Hn7J4MZdVRRgOfSlehO2NPRDqznWAZZz7KDxOSYrpCkQ+Fn/ocSt3e5urLGk ZRMjfxL6mw8evx1n5AQQyBPNYy9ldI8+NZcxM1DaS8lQ4VXs6CwMbJyG0tU6tnHYZGRB 9bIJQOUdA5tkHBgw8LgeaUPlxvoE8ntr/kjfnq4a+rJHCBRHLHqhf9fiVsrLHFQjD2Yu kRfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LzBmjDNq; 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 o7sor21857214ljg.2.2019.04.10.01.20.42 for (Google Transport Security); Wed, 10 Apr 2019 01:20:42 -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=LzBmjDNq; 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=LzBmjDNqM0toMZ6MQV0QMz4tuK3eI+Dk/kmno1wkUgF4UOemy569Cb8QWNual2j2I0 fwrPqSWdSGK1vtqWmhBLRrwMW1fie92JhFv6uL3FEfetCwFUArG+GrukzHqvz0vMYrgl H3whTMrBuUSGqMQyzh8kh4gVFlsSlYTAhsK6OQNw5OIDe7ChFT+2fZmNi0AS28FzPj+o M2cPPhEajT1C/dB3n5Rcu6KCaKtgSq1T+erasLTuKiadSMQXIZOhFSX/lc6foVyc4UFm REXdMGAttPTwCu12ZD4apcyyiX57VwEOmSzrzhJvGybMR1glUbRFZUzB0dEpcu+63Su1 ovtA== 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=mF8b/RMTLGkiuD+gjb2Q4/vfLHr3RV1yq2As3djMNuqh9xPq9goix2PlCsK0XL72Ad RFoMMbtQYt/L7r2Prp1uFtpdlvqkh966ANOKZDKW5yssVO8ilGLeatC2merHi/L7/BZT kFmJtizAa8rwTuyR7Qgfkjok1u1Y2wauoGuRltJrY8nujrLSIn7VWTd48XwKwJkI1TJV v5uDAC5sxwoYtGQVpNdQnBES5y48rNeh0PH4ZHS1jTKUhW+YQrQ6y657ewWVXfbRlMdz KFkrwkGYZW57MdLP0Hwz4OMz+kPQh/EjrvD+mu99mWqITOdWeRGPJp9dNrCug1h/Pz2V 3pIA== X-Gm-Message-State: APjAAAWnaYilQjMDYImGR5mQZFkPSV4aWqKLXPh2/dBPXAUlf0kn2Z7j WirjMjqm93GbcuXuhHxLCHq6QP49 X-Google-Smtp-Source: APXvYqy9Cwtfigxkyshi/JEXtF0oo1BptEUXXkD1CxuMtZg3yt+6xwg/hvhre3gF+ApqxCH7pW/swA== X-Received: by 2002:a2e:8ec5:: with SMTP id e5mr12701296ljl.7.1554884442442; Wed, 10 Apr 2019 01:20:42 -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 q6sm3385189lfj.36.2019.04.10.01.20.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 01:20:41 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Sudeep Holla , Mark Rutland , Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH v2 1/5] drivers: firmware: psci: Move psci to separate directory Date: Wed, 10 Apr 2019 10:20:21 +0200 Message-Id: <20190410082025.5989-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410082025.5989-1-ulf.hansson@linaro.org> References: <20190410082025.5989-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 Apr 10 08:20:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 162003 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5919895jan; Wed, 10 Apr 2019 01:20:44 -0700 (PDT) X-Received: by 2002:a2e:42cf:: with SMTP id h76mr21579924ljf.95.1554884444364; Wed, 10 Apr 2019 01:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554884444; cv=none; d=google.com; s=arc-20160816; b=xRkBAzHwwWIEgdl/tciZ/buyff9eYuwqdB+FG0Z7jW/XdHxDhAr7S+pv2nUh78UEyk 8shUJxFUTpdkoz5F2VBAeHKK9QPCEDmjpK48oW/siotmyLnfdwnJwfp0FwmP62Ti4L+a aT91t4e7iCALyrxsw6ebAhlzhn+X82RVbQ44SKb3arqX4gCn0JKxh2/utqMWxqQTVdwO IH1RUIqblhZqckUpuM4nQD5KaOcNtx4HcCTPFMEWDHgY4ZEzR6oOzusvDFXjEl1teLOi OThtQtyZ7HVV7+Tlmrm4ZirC41lWcGZB7ppzAIIHcOzCiGxQOKr+ve0MfMHEliYV6CEo JJTg== 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=LhVE0xTHCoVnNBo/aF/hU1RWYDIkQ/QDJqJ7Ab3TvoMXJh+73hV1TzQlCxR2hhA/7w 421XuBt3itixc4CPb849ytg7XSok8qCXSFNiDLsxRMNEJ2QFyXNUgAIGscYs2jmk7sMf wt37snEFCHZYeYZTuK7uGBWfzHTxA8AvYl6DipkXYS1ySkN7kR3rxN527hENy0luXOT4 dI045146rox5+dMFyyx9jBa3klMMd988pixTUlupkiPnJTVRyNWj+yChxIu+1j7l3QjL rjNUwNi2LAC70e3K/ESO1lOWG5BuxcCXkGSkjAnR2ERqoe/T+SK7YLgmnLlXbENqDd0x lNqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rHIYi9ba; 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 d9sor1299980lfk.64.2019.04.10.01.20.44 for (Google Transport Security); Wed, 10 Apr 2019 01:20:44 -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=rHIYi9ba; 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=rHIYi9ba92gg8LkA31/7tWSmN9BXPCv4fviYMZe1iSFxfd6GajN5HaoOMcKMj56Nl2 Q+VQP0P0fcCiyIHQcUv3VuufwXB5YDzUOrbe/olGwQoIRC3Qbq/2gzL14A62daskwX0R F+YJAxbPsh6EaLOhueGYvhaHloVSpkyLXcm0H6sbRg5COodlIaq9yB1HLZDeHDZYudu7 FSWO0M4QMkjflN1bIF20Et0VFSYnT/YuRlaLJ8ZTlyH3kFkc0Z73Ff2oiarV0PQlJMGP 7DAvpzBVUIsbIzyhjiDbthAMuTse3GD4kzZKkZ5hDgL3EVQLiQTMOqeZQ3AiWvj5gE5H SWyQ== 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=NsCbRiGlxbEehvaDXQ58+IBGmzhpJk+PEG6SC2E1srBM0Soub2kq+NsT5dUzi5/33t ddVcrPLIwZyxj4jrjfmHsuSQnpxcYo6zpv+ztVNykxnWD8KHjhmI4LtMuHeug7Dy4PLy WeeciE4D3Osgj9ZnYUOJ/uDk1yJEhiBnRDXqvDjnstWtMBtXzv0LH9B2rDYrr4oSz6rG 1MVIRHgIBzpy+4cFSE3kozyrYw4NPe3N3Oyjhyw0ZlHQxMOP15rcswgv1oiEcEO6d1c9 9LuwNNo6Wbgzo4o38s3PaCoTvkU+i4lCkZlBUKyTQYLsHsQVizT6Itz4S5Saqjh/8VhT BRww== X-Gm-Message-State: APjAAAVn2I5HrQu9t6CB7ZRDpPDDTxaSszUL+dzFrPIOHD9CKblBNj6L fXivdk+2eLgKI6v0BgFsNAbhfzWh05ivqA== X-Google-Smtp-Source: APXvYqyryS1q15a6d0UsZY2G/O7PEH4B07acNQrCSSgxP4ck3B8hMWAB5vl6cz5C1FZ2tb6e/Um+Mw== X-Received: by 2002:ac2:4242:: with SMTP id m2mr1249881lfl.142.1554884443988; Wed, 10 Apr 2019 01:20:43 -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 q6sm3385189lfj.36.2019.04.10.01.20.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 01:20:43 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Sudeep Holla , Mark Rutland , Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH v2 2/5] MAINTAINERS: Update files for PSCI Date: Wed, 10 Apr 2019 10:20:22 +0200 Message-Id: <20190410082025.5989-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410082025.5989-1-ulf.hansson@linaro.org> References: <20190410082025.5989-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 Apr 10 08:20:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 162004 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5919912jan; Wed, 10 Apr 2019 01:20:45 -0700 (PDT) X-Received: by 2002:a2e:84ce:: with SMTP id q14mr21933365ljh.80.1554884445812; Wed, 10 Apr 2019 01:20:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554884445; cv=none; d=google.com; s=arc-20160816; b=PbC4g0b+kHbW1TysfJwnlu2HclKjqdw+Y/l8RyNuFv7AB5+V+nkKYMWMu37JgekLPn Sl09qRhMzZ5tWSjTeIz52VyYVsEYgRlPz3QGbnMT2xpaEOfDhZxBYrHcA0E3Fzr1AAF7 smm7hPdMQIMFtpYtR+oPcf4BdDCwt4J7vEzgZgOHTNOn9xGTNs4ybuJqzbVY9Bh79wy7 1uf0ia1z/XCYIGsS7xAF8O6L72GIwpOKUZSo8OMWB9a13fN1yyjA2zu7Pscxrvft4zdN hx7LpNEcE6YE8CKZlNlSGP+7ajYE1Fn9YPyDzjE83QPRnwCGA629zhLwUddYwsFaY82W KcLw== 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=eEFVmtXoAE0SnjV7SY385dOs7hLOZynm6DDAtKCQCv2z52MHuTFRtb0OxL/ZMm8uJY A917OI6FN6HFb9P8kEim6hL36+yORek579Fg9VmRM2Mgmoyq7W5NofV/me/7HTgNxHrq ZAvseP2kzsyN6piufnDu7alRVPwRvt1vyvGkpuuZfL/Ioed/+zAcOQcEgc1YmzgY+U7B 2Znojjy5C/j1Eczh4ILR7hikzbBm+15yJ+xOUbLV4QPhkvYIVaGMDuL/BEV+oZ0EhUbZ amZWAzjfBVspnGK7M7pR6ct0W4DuZPLiExI/WJRzl6aQtK4mtiYSa8U899Up9WAJqHzQ Plmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=meorCV0l; 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 x1sor22560947ljh.3.2019.04.10.01.20.45 for (Google Transport Security); Wed, 10 Apr 2019 01:20:45 -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=meorCV0l; 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=meorCV0lfQredAwU2T0Tv4bAokTPM0RaKKvcv1f4Zkgzrz6wBM9F78OxGC4F4ULvZS TTwysSVVXNlZwlKOotm9O5PzUO1jLSU+pssMiR+xaVT2oGb2AiVXeBPghZsGWtw4MuXv U0wreO5tHp85amwZGZ5njG5mI7n27mJ/wzmO/r4BoimQNrPBusfrLBnH6EOF4YoV77vY vCeUpdya3P60zDgoGV7/xBw/OnHFgCehptWFeHLPHkUzg0xR+QfMNXy9PAxYjwZMjqPK pVvBEqtd/cJJTKbyJNbloU3b4tgWs12BMmgYss6UWYwxchMYSxpim+dHHV1rRUeOrlpK c9+A== 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=Y0a8ItzyGrMwfI6UoIU6uPFCVQ9wYqsTiWRDDiMfTZD/Kfgbjh3FyE6V1XPT91RIkA Ab1pKs5CcH3EKhiMz3egP/lkhtHW0qPacytTdUdM+J4hH8k41vwYWhfEu/dnknbPBAY8 7GPHg+NXlN7ZQg8B8q7+YuSlrdn60IghKuo1vqnhSuhh3K58pbhq7n5x2hjRleLdO4/a tJ5uPPxI64kCTba5BSNlSrrTGKULoXfmf3h+uaTgbiE3TMyr95/1Laqeg7ItG4VzkWUh +QPm1G0M2bu56SJVwz5cLSgjKoA7izawbR3sI3enTrzlRoh7Ecg8gPzJgMsgvpO5X9qm tJdw== X-Gm-Message-State: APjAAAWV9BsPnsA5DVZGrlVmuBHfu+HMqtRcgTHbPbRwVHm6xOhBdN3i v2u1CySpYMmB7VZ7TKjlLXDRTIAj227uGQ== X-Google-Smtp-Source: APXvYqyzghyBIm1gYgowOZ/whO39XDQHXurGBpGYX892IX7polNLrEr5KpF1zI55BOJYcE+O19Fv6A== X-Received: by 2002:a2e:380c:: with SMTP id f12mr23568517lja.116.1554884445456; Wed, 10 Apr 2019 01:20:45 -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 q6sm3385189lfj.36.2019.04.10.01.20.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 01:20:44 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Sudeep Holla , Mark Rutland , Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH v2 3/5] drivers: firmware: psci: Split psci_dt_cpu_init_idle() Date: Wed, 10 Apr 2019 10:20:23 +0200 Message-Id: <20190410082025.5989-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410082025.5989-1-ulf.hansson@linaro.org> References: <20190410082025.5989-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 Apr 10 08:20:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 162005 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5919938jan; Wed, 10 Apr 2019 01:20:47 -0700 (PDT) X-Received: by 2002:ac2:50cb:: with SMTP id h11mr4849570lfm.116.1554884447109; Wed, 10 Apr 2019 01:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554884447; cv=none; d=google.com; s=arc-20160816; b=R1jk4z6RLwSwb8PiL8+tp+RIaIphZkVIxkljX5eUKTxABGqcxJShleZmOsJz3ga2iJ dQBQ2dmkuZ4Y3wcVvsYNMwRLqKbRErmriMt5Rw90DJoON9LnPBFCvgjUihacANnhMTXw TE8PHoWJLpLP1CjryYH6TowBX3OOl3EcLtKLs5uAGolxpKYA2BKoAs3Y2rat43+VBNV0 NdMoGAwCcJf+FviHMKBPOD6SXly67SvtpojgKJrzNLTn0iYL7UzblNQLnIKPqc8RPio9 HTVy11D5MZKSD5IVyjKmuejC6EBH+bMpzh7RRoQxtLjnJCdeqPntQZjGrXHVw+hyjzz8 ATZQ== 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=qq6IHaPYqBd9wX2q5oeOpUTaACkrRt3re3g5q9NXG6GldRaLEtE8v4Q26X+MKTf7N1 i5kkdnRklyTVMkmZdOvW7V77/lcviwPu4cXVrqx6dIuHMjuLtbj3xU6ofU3OhdM9haW/ KGfS+l+S6kRNOxAwW3w5M2A0xrKulWVpGQQ0wRpAIIuGqALlb2YQsnWwP61D/IOl39aJ 6dImV2gsk3kzdsYwOMxzOVI1ChCCaRkmlEkcHMQEN7OOC7N9ZwDJQVhGjTBdVHwCDpld q53EOVOU1hUHoDodj0tw5/i4djKMd0F6kfgmXP3ngbJhmMalNEDGzcGarcdiDf71G9L+ lPPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GP0phiTi; 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 x1sor22560989ljh.3.2019.04.10.01.20.46 for (Google Transport Security); Wed, 10 Apr 2019 01:20:47 -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=GP0phiTi; 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=GP0phiTitWCowgFdyE98UpDaYbbRdaeoGJJFtlBgkRp4GH8FdondGvkhArSSgqgChh coAcL81UNQii/VcyR3SfUb4lM0b3u3BuhrGsuvTFZne8dNwGN6LiXqgB0OD484bWreYy Gu11Lq1vUN0ZujEmNiVdEyBl1qk8maPGU4Mp65929lOH7Flr5GeeUr0/d33cOwaGc/4V c3patnbK1lCK0fpYA1eoj9TQ9bK6rehv5+e735PCgBU4ccnfQmKVvt623oM9i/DZsVsO HRAlJkOYiL1NaTWgbO9B2incA5QF6Gi1mmODDI7eYO6lFoZ32YtKNH8zF5MY77KkKKjq RtIg== 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=RjSYrncf9vK6xl5V4VJKprci0zh7kxQ6h+nR7jZOUA7lpR8cgjoyhfP3pbNsgo9kZK KL3cc+FSoVtJR+nB6fleilXY6iTm4RjUsxDrsujGWDEpcP7PmvztEiynjHkqDOlI9Qtz W+jb2K55okvmKDa3VmUgcMEErcLbsR1lERKuG2e/rKjuW+k2N3HaHgZbqLovbT1MET+5 4ch5ZNOxshGmMCND+sfcNy9eFfeird5ztF0GCH7tt273z9C16drKEnvgPZjk5D5Gn7SD n7Rc/kWtpSrKk5Z281xjd1ORCH2ZKdtE+tWQpP1nirBmlKto+19YL/V2mQLO4c2vZsZy oQzQ== X-Gm-Message-State: APjAAAVbZBP26IN3dp7luA7ktCx98B+Gu4zArtI3uf3HvuHVHgnpoBcn uqOmOYPgeAvLXH9BSuauxbkwU/B9 X-Google-Smtp-Source: APXvYqzXLcsVniYyBVz9bDCydjsovygxv2CXViJzk5qN80M/7XTQHjtC59HgFjstiGB7qIDg0FH3Vw== X-Received: by 2002:a2e:7114:: with SMTP id m20mr22220697ljc.120.1554884446727; Wed, 10 Apr 2019 01:20:46 -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 q6sm3385189lfj.36.2019.04.10.01.20.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 01:20:46 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Sudeep Holla , Mark Rutland , Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH v2 4/5] drivers: firmware: psci: Simplify error path of psci_dt_init() Date: Wed, 10 Apr 2019 10:20:24 +0200 Message-Id: <20190410082025.5989-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410082025.5989-1-ulf.hansson@linaro.org> References: <20190410082025.5989-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 Apr 10 08:20:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 162006 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5919969jan; Wed, 10 Apr 2019 01:20:48 -0700 (PDT) X-Received: by 2002:a2e:5bcc:: with SMTP id m73mr13965423lje.100.1554884448378; Wed, 10 Apr 2019 01:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554884448; cv=none; d=google.com; s=arc-20160816; b=JMh8RrGcn17FXbEz6HTvoi7raSjtfSJ8DeC9j1uGUstTQAIbL5vhhebnT7/5dSh2DE OnH1XICOf1lkATYQARq/ZhAVfq1+HUVw38j4Z/m6KOdZnGZKzuw2gzF5Gzh36sKNrdqI zx2rFNCmGb8ZRa+/5WR0tLVuHwlC+HwEn3mTsnc9yf7DnRtPbwTsqLel9aMLNA+YPxBZ xM+Uur8EapnPm9XHwqgm+5EIzgmTdrVpByzLW8uuhtftx5i6LiFemtycNe1QHDggoNA8 +WUnxPxTlNa7tkpw7PtVf0MZuE2Th+3S3rWQL1lGUS+sv5Zuh8q2jEWSGuCvlghlha9E NlXA== 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=Banb0evWf9d74deC+eVu1j3AR6/07snxz97O2u3NDpvYwCC4kXCvov5uQT04GgdKne say1UZgnQaZkqWS5xCNJZwKz+1daQUuwnCwXb/JiiB8Rv6bbOgR3+/Onc9sRDQxNPP+V zQ6X7SHN7CspgW2Ru7JyGVtG8hVTlIhE31HxFhnE/UGNSFkEtmk6FcClaSmUYVZLYjtZ 3Gqhhh5T5c6z6qvgmk082RTK7FEkJVBwDT5qMLtLHli621wDWVVZyaP5R3/44B53Yb7E jorXAMouA8nWjGRMrRmsu6A83Zt2Ixw8l2fFoLN5q1UTMEpS+Sl0M8nbxN8LVUWp71Z5 P9dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mStHv7QU; 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 y5sor3368434lfh.66.2019.04.10.01.20.48 for (Google Transport Security); Wed, 10 Apr 2019 01:20:48 -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=mStHv7QU; 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=mStHv7QUTH9WDAupaSoNiNHXq56uKPHs6z21Ns4cq2pgt6lYuIwF2y1ydobFZDFkgN k46Q2SZP5ZgY7T277FQDd6kZnntXGYuzX9TiN6F5abjLive7ssOU6xL3aArZ7KC9+Dgo aHOYlHx4xjPDV3fLfRxyNPRR4uDwhdR/a8rh8vP21tjqnO8zoAHY12H2DkMr2VtjyBP9 6MFFADfsLqamKiTq8M1UMjcQbDTzOITDphS+3jEsuZ9QAfSjZdz+Ay288jDWx9ePXqQa pgn8qz6S6UdQDq6t8JNpI4NkYKFB0Ufrc9RruysJpogLhp2ykoAua+bK1LHZf8NcjcuM 7jZA== 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=Th4GUd/XIKLoGK90HVbeKZeK/fGKntPsBtbkUNX2bE09qaYVdsByvI3ntazY5/UB7g +YkuJKDY28KGaztul8sBU4sUlnrMBW+2NB98ZVkgQVYk4r5HDPQtcZEXk7isMVeAZanC HcHySR67DeFNj+X3pQc4GS0bVUOdlgJnZrjhBgcVvCch7TgmAjbW0qeDrs1UouD3vLJA Xa67SEzlorfY37OPw2WqVkuAF2xT+MCbuoDTvir/zGKs4NdJVznGbYunxlkoqqXOifvc sbtvD4WejSu2ZEzgsWx2TB7LIGSv+xt6UU8zFcMa/TtvO/iHM5+ofj0xwWQRI2txRJbl WCOA== X-Gm-Message-State: APjAAAXtc6m5Tz1hmpH+GxJmTUhGhdtAiBpE1BNglXXHfNH69hj3O6yn ojpsV7uchSCNqWMBxJixAh/qtmGG X-Google-Smtp-Source: APXvYqwAQdMdf457/T9VKsq8AbW6qHKBEEhAwtd9AMaQ5kzkjyEFANj/vSnEWMDgy3/QbndrOfTM5w== X-Received: by 2002:ac2:5222:: with SMTP id i2mr13231765lfl.32.1554884447978; Wed, 10 Apr 2019 01:20:47 -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 q6sm3385189lfj.36.2019.04.10.01.20.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 01:20:47 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Sudeep Holla , Mark Rutland , Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH v2 5/5] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Wed, 10 Apr 2019 10:20:25 +0200 Message-Id: <20190410082025.5989-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410082025.5989-1-ulf.hansson@linaro.org> References: <20190410082025.5989-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