From: Ricardo Ribalda <ribalda@chromium.org>
To: Mark Brown <broonie@kernel.org>,
Support Opensource <support.opensource@diasemi.com>,
Liam Girdwood <lgirdwood@gmail.com>
Cc: Ricardo Ribalda <ribalda@chromium.org>, linux-kernel@vger.kernel.org
Subject: [PATCH v1 1/1] regulator: da9211: Use irq handler when ready
Date: Thu, 24 Nov 2022 17:45:31 +0100 [thread overview]
Message-ID: <20221124-da9211-v1-1-a54549aa6d3b@chromium.org> (raw)
In-Reply-To: <20221124-da9211-v1-0-a54549aa6d3b@chromium.org>
If the system does not come from reset (like when it is kexec()), the
regulator might have an IRQ waiting for us.
If we enable the IRQ handler before its structures are ready, we crash.
This patch fixes:
[ 1.141839] Unable to handle kernel read from unreadable memory at virtual address 0000000000000078
[ 1.144475] tpm_i2c_infineon 3-0020: 1.2 TPM (device-id 0x1A)
[ 1.150883] Mem abort info:
[ 1.150884] ESR = 0x96000005
[ 1.150887] EC = 0x25: DABT (current EL), IL = 32 bits
[ 1.167749] SET = 0, FnV = 0
[ 1.170794] EA = 0, S1PTW = 0
[ 1.173926] Data abort info:
[ 1.176798] ISV = 0, ISS = 0x00000005
[ 1.180626] CM = 0, WnR = 0
[ 1.183584] [0000000000000078] user address but active_mm is swapper
[ 1.189929] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[ 1.195490] Modules linked in:
[ 1.198537] CPU: 2 PID: 145 Comm: irq/77-da9211 Not tainted 5.10.153-20404-gdd5053d763d6
[ 1.210431] Hardware name: Google Hana (DT)
[ 1.214603] pstate: 60400005 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[ 1.220601] pc : blocking_notifier_call_chain+0x20/0xa8
[ 1.225818] lr : regulator_notifier_call_chain+0x1c/0x2c
[ 1.231116] sp : ffffffc010463d40
[ 1.234419] x29: ffffffc010463d40 x28: ffffff9140ad2ca4
[ 1.239720] x27: ffffff914205efc0 x26: ffffff9140ad2cd8
[ 1.245021] x25: 0000000000000001 x24: ffffffe9bd532b28
[ 1.250321] x23: ffffff9140ad2ce0 x22: ffffff9140ad2cac
[ 1.255622] x21: ffffff9140cc5a00 x20: ffffff9140ad2c00
[ 1.255625] x19: ffffff9142059580 x18: fffffffffffffff5
[ 1.267353] x17: 0000000000000304 x16: 00000000000003b6
[ 1.267356] x15: 0000000000000002
[ 1.279078] x14: 000000000018bae8
[ 1.279080] x13: 0000000000100000 x12: 0000000000000239
[ 1.287768] x11: 0000000000000000 x10: 0000000000000001
[ 1.294202] mtk-thermal 1100b000.thermal: can't find thermal sensor 5
[ 1.297582] x9 : ffffffe9bc344050 x8 : 0000000000000013
[ 1.297586] x7 : 0000000000000000
[ 1.309308] x6 : 0000000000000013
[ 1.309310] x5 : ffffff914205ec02 x4 : 0000000000000001
[ 1.309313] x3 : ffffffc010463c58 x2 : 0000000000000000
[ 1.316093] x1 : 0000000000000002 x0 : 0000000000000050
[ 1.316096] Call trace:
[ 1.316101] blocking_notifier_call_chain+0x20/0xa8
[ 1.322757] cpu cpu0: dummy supplies not allowed for exclusive requests
[ 1.327823] regulator_notifier_call_chain+0x1c/0x2c
[ 1.327825] da9211_irq_handler+0x68/0xf8
[ 1.327829] irq_thread+0x11c/0x234
[ 1.327833] kthread+0x13c/0x154
[ 1.332067] cpu cpu0: EM: created perf domain
[ 1.339641] ret_from_fork+0x10/0x30
[ 1.339647] Code: a9015ff8 a90257f6 a9034ff4 910003fd (f9401408)
[ 1.343215] cpu cpu2: EM: created perf domain
[ 1.348335] ---[ end trace 46760cc6c7f556d8 ]---
[ 1.420026] Kernel panic - not syncing: Oops: Fatal exception
[ 1.425761] SMP: stopping secondary CPUs
[ 1.429678] Kernel Offset: 0x29ac000000 from 0xffffffc010000000
[ 1.435583] PHYS_OFFSET: 0xffffffefc0000000
[ 1.439754] CPU features: 0x48240022,65806005
[ 1.444099] Memory Limit: none
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
index e01b32d1fa17..36a0009e23de 100644
--- a/drivers/regulator/da9211-regulator.c
+++ b/drivers/regulator/da9211-regulator.c
@@ -496,6 +496,12 @@ static int da9211_i2c_probe(struct i2c_client *i2c)
return PTR_ERR(chip->pdata);
}
+ ret = da9211_regulator_init(chip);
+ if (ret < 0) {
+ dev_err(chip->dev, "Failed to initialize regulator: %d\n", ret);
+ return ret;
+ }
+
chip->chip_irq = i2c->irq;
if (chip->chip_irq != 0) {
@@ -512,11 +518,6 @@ static int da9211_i2c_probe(struct i2c_client *i2c)
dev_warn(chip->dev, "No IRQ configured\n");
}
- ret = da9211_regulator_init(chip);
-
- if (ret < 0)
- dev_err(chip->dev, "Failed to initialize regulator: %d\n", ret);
-
return ret;
}
--
b4 0.11.0-dev-d93f8
next prev parent reply other threads:[~2022-11-24 16:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 16:45 [PATCH v1 0/1] regulator: da9211: Fix crash when irqs are pre-enabled Ricardo Ribalda
2022-11-24 16:45 ` Ricardo Ribalda [this message]
2022-11-24 16:53 ` [PATCH v1 1/1] regulator: da9211: Use irq handler when ready Mark Brown
2022-11-24 17:35 ` Ricardo Ribalda
2022-11-24 17:41 ` Mark Brown
2022-11-27 20:55 ` DLG Adam Ward
2022-11-24 16:52 ` [PATCH v1 0/1] regulator: da9211: Fix crash when irqs are pre-enabled Mark Brown
2022-11-24 17:33 ` Ricardo Ribalda
2022-11-29 16:46 ` Mark Brown
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=20221124-da9211-v1-1-a54549aa6d3b@chromium.org \
--to=ribalda@chromium.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=support.opensource@diasemi.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
all inboxes | Powered by JetHome®