From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sibi Sankar <quic_sibis@quicinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Sasha Levin <sashal@kernel.org>,
krzysztof.kozlowski@linaro.org, konrad.dybcio@linaro.org,
linux-arm-msm@vger.kernel.org
Subject: [PATCH AUTOSEL 6.10 5/9] soc: qcom: icc-bwmon: Allow for interrupts to be shared across instances
Date: Sat, 27 Jul 2024 20:49:25 -0400 [thread overview]
Message-ID: <20240728004934.1706375-5-sashal@kernel.org> (raw)
In-Reply-To: <20240728004934.1706375-1-sashal@kernel.org>
From: Sibi Sankar <quic_sibis@quicinc.com>
[ Upstream commit dc18836435e7f8dda019db2c618c69194933157f ]
The multiple BWMONv4 instances available on the X1E80100 SoC use the
same interrupt number. Mark them are shared to allow for re-use across
instances.
Using IRQF_SHARED coupled with devm_request_threaded_irq implies that
the irq can still trigger during/after bwmon_remove due to other active
bwmon instances. Handle this race by relying on bwmon_disable to disable
the interrupt and coupled with explicit request/free irqs.
Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20240624092214.146935-4-quic_sibis@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/soc/qcom/icc-bwmon.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c
index fb323b3364db4..e1ffd453ecdf0 100644
--- a/drivers/soc/qcom/icc-bwmon.c
+++ b/drivers/soc/qcom/icc-bwmon.c
@@ -781,9 +781,14 @@ static int bwmon_probe(struct platform_device *pdev)
bwmon->dev = dev;
bwmon_disable(bwmon);
- ret = devm_request_threaded_irq(dev, bwmon->irq, bwmon_intr,
- bwmon_intr_thread,
- IRQF_ONESHOT, dev_name(dev), bwmon);
+
+ /*
+ * SoCs with multiple cpu-bwmon instances can end up using a shared interrupt
+ * line. Using the devm_ variant might result in the IRQ handler being executed
+ * after bwmon_disable in bwmon_remove()
+ */
+ ret = request_threaded_irq(bwmon->irq, bwmon_intr, bwmon_intr_thread,
+ IRQF_ONESHOT | IRQF_SHARED, dev_name(dev), bwmon);
if (ret)
return dev_err_probe(dev, ret, "failed to request IRQ\n");
@@ -798,6 +803,7 @@ static void bwmon_remove(struct platform_device *pdev)
struct icc_bwmon *bwmon = platform_get_drvdata(pdev);
bwmon_disable(bwmon);
+ free_irq(bwmon->irq, bwmon);
}
static const struct icc_bwmon_data msm8998_bwmon_data = {
--
2.43.0
next prev parent reply other threads:[~2024-07-28 0:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-28 0:49 [PATCH AUTOSEL 6.10 1/9] ACPI: battery: create alarm sysfs attribute atomically Sasha Levin
2024-07-28 0:49 ` [PATCH AUTOSEL 6.10 2/9] ACPI: SBS: manage alarm sysfs attribute through psy core Sasha Levin
2024-07-28 0:49 ` [PATCH AUTOSEL 6.10 3/9] cpufreq: amd-pstate: Allow users to write 'default' EPP string Sasha Levin
2024-07-28 0:49 ` [PATCH AUTOSEL 6.10 4/9] cpufreq: amd-pstate: auto-load pstate driver by default Sasha Levin
2024-07-28 0:49 ` Sasha Levin [this message]
2024-07-28 0:49 ` [PATCH AUTOSEL 6.10 6/9] xen: privcmd: Switch from mutex to spinlock for irqfds Sasha Levin
2024-07-28 0:49 ` [PATCH AUTOSEL 6.10 7/9] ACPI: resource: Skip IRQ override on Asus Vivobook Pro N6506MU Sasha Levin
2024-07-28 0:49 ` [PATCH AUTOSEL 6.10 8/9] ACPI: resource: Skip IRQ override on Asus Vivobook Pro N6506MJ Sasha Levin
2024-07-28 0:49 ` [PATCH AUTOSEL 6.10 9/9] thermal: intel: hfi: Give HFI instances package scope 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=20240728004934.1706375-5-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=andersson@kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_sibis@quicinc.com \
--cc=stable@vger.kernel.org \
/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