Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795624277; b=5VJSRkkqNusXQbMSeB/BcdK+EFtYtVp4zAu2JolW/du0bYbnFVt//mmIg8Js+V9icI08 buaGGQ6MtZFm5Qp1udlWYnwhvnLiyZdC60C8MgPyrDen4tqkVJzsWtHgfuTN+P2PCyRAO yTNdna/sVORyc1ks82ypcxziGZ0eZ1TeLh5tiJRd3ppHdcpCZkvBz/t49V0JXT5GCCn5p nu5hfxP1zHZXjfnF2ZYuLIbV2nKu60KVhtFa7HdXhXp5jyxe4t2IF4PiLBsBCKVgzbX/K P14kHBD2WCvk4m/jUsTQ0H8ifnVop34YkeSo0iaFVxNF04S1BEj/JCYFFV1B7Hjp9EA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795624277; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=VpQSGosHzWD3LxG20GsB/ChamafDFUkHi9u9FXG4rhg=; b=PmncTAugZ3OYUHnR/ze44CHQRJNUgfGQBBczx8yfzhpXk27vDuHCP63bUqjiOj0poJTZ l0O+PbYNOxh0BzNZjzOcpVyIdklggzhBHsYQ9zmrBK4LHYMKVuh+qoZFyNCJmRudQw7qC LdNElTcA37G0U4l9JVT4C8rX58QYKuqxB+RUhdLZvpyM6Gr77/OufIwZoreChEHK/ftwG Q5MtJ7C5O4noRyIpXWFLyF45jprEQXy+qAwaYTI7yO/viqRDET91atVSXLn1WJAtqVOVw T+Xjf7HyQuMuL04FMdKq49aQcCaQ94XPXreLW7phwEqWue+R6/jZBfA+Q7DoCrdFbKg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=RPApFEWH; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33815606A6AE; Wed, 25 Nov 2026 16:31:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=RPApFEWH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B25A1F000D4; Wed, 25 Nov 2026 16:31:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795624276; bh=VpQSGosHzWD3LxG20GsB/ChamafDFUkHi9u9FXG4rhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RPApFEWHGj5q0FfutB1nhnrbWX/972NLTDbHpoe2iU80bDgY2Hs6UsHUtqKNWGwI3 MZXXt3ZHqJCKVMXd4vBJHgtU+2mHGiKTMmCGH+cKjxmwDh1zht+wQx1njVjAw/XG1a hagTFEjQTwtAGEO5FnbZ13aHQ5R+zr1reyx9BgrE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dmitry Baryshkov , Konrad Dybcio , Mark Brown , Sasha Levin Subject: [PATCH 6.12 142/816] regulator: qcom_spmi: dont take a sleeping lock in the SAW IPI Date: Wed, 25 Nov 2026 15:28:10 +0100 Message-ID: <20261125143852.487528875@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261125143849.205329330@linuxfoundation.org> References: <20261125143849.205329330@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Baryshkov [ Upstream commit 053c50a7052549aab0d310ad505947db3e211592 ] The SAW voltage change runs on CPU 0 from an IPI, but it reaches the SAW registers through the syscon regmap, which is protected by a spinlock_t. That is a sleeping lock on PREEMPT_RT, and lockdep complains as soon as VDD_APCC actually changes voltage: BUG: Invalid wait context ... regmap_lock_spinlock+0x18/0x30 regmap_read+0x3c/0x78 spmi_saw_set_vdd+0x50/0x1ac __flush_smp_call_function_queue+0x1ac/0x334 Map the SAW with a regmap of our own that uses a raw spinlock, and fail the probe when that cannot be done instead of carrying an error pointer around as the SAW regmap. Fixes: 0caecaa87202 ("regulator: qcom_spmi: Add support for SAW") Signed-off-by: Dmitry Baryshkov Reviewed-by: Konrad Dybcio Link: https://patch.msgid.link/20261019-fix-qcom-saw-v1-3-9c7ba3fc2493@oss.qualcomm.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/Kconfig | 1 + drivers/regulator/qcom_spmi-regulator.c | 35 +++++++++++++++++++------ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 39297f7d81771..b2201d1bddc9f 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -1101,6 +1101,7 @@ config REGULATOR_QCOM_SMD_RPM config REGULATOR_QCOM_SPMI tristate "Qualcomm SPMI regulator driver" depends on SPMI || COMPILE_TEST + select REGMAP_MMIO help If you say yes to this option, support will be included for the regulators found in Qualcomm SPMI PMICs. diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c index d66a0f61637e1..05fe8ba0e7663 100644 --- a/drivers/regulator/qcom_spmi-regulator.c +++ b/drivers/regulator/qcom_spmi-regulator.c @@ -12,13 +12,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include /* Pin control enable input pins. */ @@ -1332,6 +1332,14 @@ static irqreturn_t spmi_regulator_vs_ocp_isr(int irq, void *data) static struct regmap *saw_regmap; +static const struct regmap_config saw_regmap_config = { + .name = "saw", + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .use_raw_spinlock = true, +}; + static void spmi_saw_set_vdd(void *data) { u32 vctl, data3, avs_ctl, pmic_sts; @@ -2509,7 +2517,8 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) const char *name; struct device *dev = &pdev->dev; struct device_node *node = pdev->dev.of_node; - struct device_node *syscon, *reg_node; + struct device_node *saw, *reg_node; + void __iomem *saw_base; struct property *reg_prop; int ret, lenp; struct list_head *vreg_list; @@ -2528,12 +2537,22 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) if (!reg) return -ENODEV; - syscon = of_parse_phandle(node, "qcom,saw-reg", 0); - if (syscon) { - saw_regmap = syscon_node_to_regmap(syscon); - of_node_put(syscon); - if (IS_ERR(saw_regmap)) - dev_err(dev, "ERROR reading SAW regmap\n"); + saw = of_parse_phandle(node, "qcom,saw-reg", 0); + if (saw) { + saw_base = devm_of_iomap(dev, saw, 0, NULL); + of_node_put(saw); + if (IS_ERR(saw_base)) + return dev_err_probe(dev, PTR_ERR(saw_base), + "failed to map the SAW\n"); + + saw_regmap = devm_regmap_init_mmio(dev, saw_base, + &saw_regmap_config); + if (IS_ERR(saw_regmap)) { + ret = PTR_ERR(saw_regmap); + saw_regmap = NULL; + return dev_err_probe(dev, ret, + "failed to set the SAW regmap up\n"); + } } for (; reg->name; reg++) { -- 2.53.0