linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Cristian Marussi <cristian.marussi@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 5.7 19/58] firmware: arm_scmi: Fix SCMI genpd domain probing
Date: Sat,  8 Aug 2020 19:36:45 -0400	[thread overview]
Message-ID: <20200808233724.3618168-19-sashal@kernel.org> (raw)
In-Reply-To: <20200808233724.3618168-1-sashal@kernel.org>

From: Cristian Marussi <cristian.marussi@arm.com>

[ Upstream commit e0f1a30cf184821499eeb67daedd7a3f21bbcb0b ]

When, at probe time, an SCMI communication failure inhibits the capacity
to query power domains states, such domains should be skipped.

Registering partially initialized SCMI power domains with genpd will
causes kernel panic.

 arm-scmi timed out in resp(caller: scmi_power_state_get+0xa4/0xd0)
 scmi-power-domain scmi_dev.2: failed to get state for domain 9
 Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
 Mem abort info:
   ESR = 0x96000006
   EC = 0x25: DABT (current EL), IL = 32 bits
   SET = 0, FnV = 0
   EA = 0, S1PTW = 0
 Data abort info:
   ISV = 0, ISS = 0x00000006
   CM = 0, WnR = 0
 user pgtable: 4k pages, 48-bit VAs, pgdp=00000009f3691000
 [0000000000000000] pgd=00000009f1ca0003, p4d=00000009f1ca0003, pud=00000009f35ea003, pmd=0000000000000000
 Internal error: Oops: 96000006 [#1] PREEMPT SMP
 CPU: 2 PID: 381 Comm: bash Not tainted 5.8.0-rc1-00011-gebd118c2cca8 #2
 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Jan  3 2020
 Internal error: Oops: 96000006 [#1] PREEMPT SMP
 pstate: 80000005 (Nzcv daif -PAN -UAO BTYPE=--)
 pc : of_genpd_add_provider_onecell+0x98/0x1f8
 lr : of_genpd_add_provider_onecell+0x48/0x1f8
 Call trace:
  of_genpd_add_provider_onecell+0x98/0x1f8
  scmi_pm_domain_probe+0x174/0x1e8
  scmi_dev_probe+0x90/0xe0
  really_probe+0xe4/0x448
  driver_probe_device+0xfc/0x168
  device_driver_attach+0x7c/0x88
  bind_store+0xe8/0x128
  drv_attr_store+0x2c/0x40
  sysfs_kf_write+0x4c/0x60
  kernfs_fop_write+0x114/0x230
  __vfs_write+0x24/0x50
  vfs_write+0xbc/0x1e0
  ksys_write+0x70/0xf8
  __arm64_sys_write+0x24/0x30
  el0_svc_common.constprop.3+0x94/0x160
  do_el0_svc+0x2c/0x98
  el0_sync_handler+0x148/0x1a8
  el0_sync+0x158/0x180

Do not register any power domain that failed to be queried with genpd.

Fixes: 898216c97ed2 ("firmware: arm_scmi: add device power domain support using genpd")
Link: https://lore.kernel.org/r/20200619220330.12217-1-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/firmware/arm_scmi/scmi_pm_domain.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/firmware/arm_scmi/scmi_pm_domain.c b/drivers/firmware/arm_scmi/scmi_pm_domain.c
index bafbfe358f97d..9e44479f02842 100644
--- a/drivers/firmware/arm_scmi/scmi_pm_domain.c
+++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c
@@ -85,7 +85,10 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
 	for (i = 0; i < num_domains; i++, scmi_pd++) {
 		u32 state;
 
-		domains[i] = &scmi_pd->genpd;
+		if (handle->power_ops->state_get(handle, i, &state)) {
+			dev_warn(dev, "failed to get state for domain %d\n", i);
+			continue;
+		}
 
 		scmi_pd->domain = i;
 		scmi_pd->handle = handle;
@@ -94,13 +97,10 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
 		scmi_pd->genpd.power_off = scmi_pd_power_off;
 		scmi_pd->genpd.power_on = scmi_pd_power_on;
 
-		if (handle->power_ops->state_get(handle, i, &state)) {
-			dev_warn(dev, "failed to get state for domain %d\n", i);
-			continue;
-		}
-
 		pm_genpd_init(&scmi_pd->genpd, NULL,
 			      state == SCMI_POWER_STATE_GENERIC_OFF);
+
+		domains[i] = &scmi_pd->genpd;
 	}
 
 	scmi_pd_data->domains = domains;
-- 
2.25.1


  parent reply	other threads:[~2020-08-08 23:47 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-08 23:36 [PATCH AUTOSEL 5.7 01/58] ARM: dts: stm32: fix uart7_pins_a comments in stm32mp15-pinctrl Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 02/58] x86/mce/inject: Fix a wrong assignment of i_mce.status Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 03/58] perf/x86/intel/uncore: Fix oops when counting IMC uncore events on some TGL Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 04/58] x86, sched: Bail out of frequency invariance if turbo frequency is unknown Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 05/58] x86, sched: Bail out of frequency invariance if turbo_freq/base_freq gives 0 Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 06/58] sched/fair: Fix NOHZ next idle balance Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 07/58] sched: correct SD_flags returned by tl->sd_flags() Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 08/58] arm64: dts: rockchip: fix rk3368-lion gmac reset gpio Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 09/58] arm64: dts: rockchip: fix rk3399-puma vcc5v0-host gpio Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 10/58] arm64: dts: rockchip: fix rk3399-puma gmac reset gpio Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 11/58] EDAC: Fix reference count leaks Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 12/58] crc-t10dif: Fix potential crypto notify dead-lock Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 13/58] arm64: dts: qcom: msm8916: Replace invalid bias-pull-none property Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 14/58] memory: tegra: Fix an error handling path in tegra186_emc_probe() Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 15/58] blktrace: fix debugfs use after free Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 16/58] crypto: ccree - fix resource leak on error path Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 17/58] ARM: exynos: MCPM: Restore big.LITTLE cpuidle support Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 18/58] rcu/tree: Repeat the monitor if any free channel is busy Sasha Levin
2020-08-08 23:36 ` Sasha Levin [this message]
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 20/58] arm64: dts: sun50i-pinephone: dldo4 must not be >= 1.8V Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 21/58] arm64: dts: exynos: Fix silent hang after boot on Espresso Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 22/58] sched/uclamp: Fix initialization of struct uclamp_rq Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 23/58] crypto: qat - allow xts requests not multiple of block Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 24/58] clk: scmi: Fix min and max rate when registering clocks with discrete rates Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 25/58] m68k: mac: Don't send IOP message until channel is idle Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 26/58] m68k: mac: Fix IOP status/control register writes Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 27/58] platform/x86: intel-hid: Fix return value check in check_acpi_dev() Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 28/58] platform/x86: intel-vbtn: " Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 29/58] ARM: dts: gose: Fix ports node name for adv7180 Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 30/58] arm64: dts: renesas: Fix SD Card/eMMC interface device node names Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 31/58] ARM: dts: gose: Fix ports node name for adv7612 Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 32/58] ARM: at91: pm: add missing put_device() call in at91_pm_sram_init() Sasha Levin
2020-08-08 23:36 ` [PATCH AUTOSEL 5.7 33/58] ARM: dts: exynos: Disable frequency scaling for FSYS bus on Odroid XU3 family Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 34/58] reset: intel: fix a compile warning about REG_OFFSET redefined Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 35/58] ARM: dts: sunxi: bananapi-m2-plus-v1.2: Add regulator supply to all CPU cores Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 36/58] ARM: dts: sunxi: bananapi-m2-plus-v1.2: Fix CPU supply voltages Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 37/58] spi: lantiq: fix: Rx overflow error in full duplex mode Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 38/58] tpm: Require that all digests are present in TCG_PCR_EVENT2 structures Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 39/58] recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64 Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 40/58] regulator: fix memory leak on error path of regulator_register() Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 41/58] io_uring: fix sq array offset calculation Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 42/58] arm64: dts: meson: fix mmc0 tuning error on Khadas VIM3 Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 43/58] soc: qcom: pdr: Reorder the PD state indication ack Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 44/58] spi: rockchip: Fix error in SPI slave pio read Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 45/58] ARM: socfpga: PM: add missing put_device() call in socfpga_setup_ocram_self_refresh() Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 46/58] iocost: Fix check condition of iocg abs_vdebt Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 47/58] scripts/selinux/mdp: fix initial SID handling Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 48/58] irqchip/ti-sci-inta: Fix return value about devm_ioremap_resource() Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 49/58] seccomp: Fix ioctl number for SECCOMP_IOCTL_NOTIF_ID_VALID Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 50/58] md: raid0/linear: fix dereference before null check on pointer mddev Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 51/58] irqchip/loongson-liointc: Fix potential dead lock Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 52/58] irqchip/irq-bcm7038-l1: Guard uses of cpu_logical_map Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 53/58] irqchip/gic-v4.1: Use GFP_ATOMIC flag in allocate_vpe_l1_table() Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 54/58] nvme-tcp: fix controller reset hang during traffic Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 55/58] nvme-rdma: " Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 56/58] nvme-multipath: fix logic for non-optimized paths Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 57/58] nvme-multipath: do not fall back to __nvme_find_path() " Sasha Levin
2020-08-08 23:37 ` [PATCH AUTOSEL 5.7 58/58] block: don't do revalidate zones on invalid devices Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200808233724.3618168-19-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=cristian.marussi@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).