public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain
@ 2025-01-24  8:50 Stefan Eichenberger
  2025-01-27 10:13 ` [tip: irq/urgent] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain::host_data tip-bot2 for Stefan Eichenberger
  2025-01-27 10:30 ` [PATCH v2] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain Thomas Gleixner
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Eichenberger @ 2025-01-24  8:50 UTC (permalink / raw)
  To: andrew, gregory.clement, sebastian.hesselbarth, tglx,
	shivamurthy.shastri, anna-maria
  Cc: linux-arm-kernel, linux-kernel, stable

Previously, we incorrectly cast irq_domain->host_data directly to
mvebu_icu_msi_data. However, host_data actually stores a structure of
type msi_domain_info.

This incorrect assumption caused issues such as the thermal sensors of
the CP110 platform malfunctioning. Specifically, the translation of the
SEI interrupt to IRQ_TYPE_EDGE_RISING failed, preventing proper
interrupt handling. The following error was observed:
genirq: Setting trigger mode 4 for irq 85 failed (irq_chip_set_type_parent+0x0/0x34)
armada_thermal f2400000.system-controller:thermal-sensor@70: Cannot request threaded IRQ 85

This commit resolves the issue by first casting host_data to
msi_domain_info and then accessing the mvebu_icu_msi_data through
msi_domain_info->chip_data.

Cc: stable@vger.kernel.org
Fixes: d929e4db22b6 ("irqchip/irq-mvebu-icu: Prepare for real per device MSI")
Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
---
Changes in v2:
* This patch is a v2 because it addresses the same issue as this patch:
  https://lore.kernel.org/all/20241217111623.92625-1-eichest@gmail.com/
* This time it addresses the underlying issue instead of adding a
  workaround (thanks to Thomas)

 drivers/irqchip/irq-mvebu-icu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-mvebu-icu.c b/drivers/irqchip/irq-mvebu-icu.c
index b337f6c05f18..4eebed39880a 100644
--- a/drivers/irqchip/irq-mvebu-icu.c
+++ b/drivers/irqchip/irq-mvebu-icu.c
@@ -68,7 +68,8 @@ static int mvebu_icu_translate(struct irq_domain *d, struct irq_fwspec *fwspec,
 			       unsigned long *hwirq, unsigned int *type)
 {
 	unsigned int param_count = static_branch_unlikely(&legacy_bindings) ? 3 : 2;
-	struct mvebu_icu_msi_data *msi_data = d->host_data;
+	struct msi_domain_info *info = d->host_data;
+	struct mvebu_icu_msi_data *msi_data = info->chip_data;
 	struct mvebu_icu *icu = msi_data->icu;
 
 	/* Check the count of the parameters in dt */
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [tip: irq/urgent] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain::host_data
  2025-01-24  8:50 [PATCH v2] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain Stefan Eichenberger
@ 2025-01-27 10:13 ` tip-bot2 for Stefan Eichenberger
  2025-01-27 10:30 ` [PATCH v2] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Stefan Eichenberger @ 2025-01-27 10:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Stefan Eichenberger, Thomas Gleixner, stable, x86, linux-kernel,
	maz

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     987f379b54091cc1b1db986bde71cee1081350b3
Gitweb:        https://git.kernel.org/tip/987f379b54091cc1b1db986bde71cee1081350b3
Author:        Stefan Eichenberger <eichest@gmail.com>
AuthorDate:    Fri, 24 Jan 2025 09:50:39 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 27 Jan 2025 11:07:03 +01:00

irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain::host_data

mvebu_icu_translate() incorrectly casts irq_domain::host_data directly to
mvebu_icu_msi_data. However, host_data actually points to a structure of
type msi_domain_info.

This incorrect cast causes issues such as the thermal sensors of the
CP110 platform malfunctioning. Specifically, the translation of the SEI
interrupt to IRQ_TYPE_EDGE_RISING fails, preventing proper interrupt
handling. The following error was observed:

  genirq: Setting trigger mode 4 for irq 85 failed (irq_chip_set_type_parent+0x0/0x34)
  armada_thermal f2400000.system-controller:thermal-sensor@70: Cannot request threaded IRQ 85

Resolve the issue by first casting host_data to msi_domain_info and then
accessing mvebu_icu_msi_data through msi_domain_info::chip_data.

Fixes: d929e4db22b6 ("irqchip/irq-mvebu-icu: Prepare for real per device MSI")
Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20250124085140.44792-1-eichest@gmail.com
---
 drivers/irqchip/irq-mvebu-icu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-mvebu-icu.c b/drivers/irqchip/irq-mvebu-icu.c
index b337f6c..4eebed3 100644
--- a/drivers/irqchip/irq-mvebu-icu.c
+++ b/drivers/irqchip/irq-mvebu-icu.c
@@ -68,7 +68,8 @@ static int mvebu_icu_translate(struct irq_domain *d, struct irq_fwspec *fwspec,
 			       unsigned long *hwirq, unsigned int *type)
 {
 	unsigned int param_count = static_branch_unlikely(&legacy_bindings) ? 3 : 2;
-	struct mvebu_icu_msi_data *msi_data = d->host_data;
+	struct msi_domain_info *info = d->host_data;
+	struct mvebu_icu_msi_data *msi_data = info->chip_data;
 	struct mvebu_icu *icu = msi_data->icu;
 
 	/* Check the count of the parameters in dt */

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain
  2025-01-24  8:50 [PATCH v2] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain Stefan Eichenberger
  2025-01-27 10:13 ` [tip: irq/urgent] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain::host_data tip-bot2 for Stefan Eichenberger
@ 2025-01-27 10:30 ` Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2025-01-27 10:30 UTC (permalink / raw)
  To: Stefan Eichenberger, andrew, gregory.clement,
	sebastian.hesselbarth, shivamurthy.shastri, anna-maria
  Cc: linux-arm-kernel, linux-kernel, stable

On Fri, Jan 24 2025 at 09:50, Stefan Eichenberger wrote:
> Previously, we incorrectly cast irq_domain->host_data directly to

Previously 'we' do nothing. The current implementation casts inconrrectly.

> mvebu_icu_msi_data. However, host_data actually stores a structure of
> type msi_domain_info.
>
> This incorrect assumption caused issues such as the thermal sensors of
> the CP110 platform malfunctioning. Specifically, the translation of the
> SEI interrupt to IRQ_TYPE_EDGE_RISING failed, preventing proper
> interrupt handling. The following error was observed:
> genirq: Setting trigger mode 4 for irq 85 failed (irq_chip_set_type_parent+0x0/0x34)
> armada_thermal f2400000.system-controller:thermal-sensor@70: Cannot request threaded IRQ 85
>
> This commit resolves the issue by first casting host_data to

This commit is equally wrong as 'This patch'. See Documentation/process/

> msi_domain_info and then accessing the mvebu_icu_msi_data through
> msi_domain_info->chip_data.

I fixed it up for you.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-27 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-24  8:50 [PATCH v2] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain Stefan Eichenberger
2025-01-27 10:13 ` [tip: irq/urgent] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain::host_data tip-bot2 for Stefan Eichenberger
2025-01-27 10:30 ` [PATCH v2] irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox