public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: vmd: override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info()
@ 2025-10-14  1:46 Inochi Amaoto
  2025-10-14 21:18 ` Bjorn Helgaas
  0 siblings, 1 reply; 5+ messages in thread
From: Inochi Amaoto @ 2025-10-14  1:46 UTC (permalink / raw)
  To: Nirmal Patel, Jonathan Derrick, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, Chen Wang, Inochi Amaoto, Thomas Gleixner
  Cc: Kenneth Crudup, Genes Lists, linux-pci, linux-kernel, Yixun Lan,
	Longbin Li

Since commit 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per
device domains") set callback irq_startup() and irq_shutdown() of
the struct pci_msi[x]_template, __irq_startup() will always invokes
irq_startup() callback instead of irq_enable() callback overridden
in vmd_init_dev_msi_info(). This will not start the irq correctly.

Also override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info(),
so the irq_startup() can invoke the real logic.

Fixes: 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per device domains")
Reported-by: Kenneth Crudup <kenny@panix.com>
Closes: https://lore.kernel.org/all/8a923590-5b3a-406f-a324-7bd1cf894d8f@panix.com/
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Tested-by: Kenneth R. Crudup <kenny@panix.com>
---
 drivers/pci/controller/vmd.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index 1bd5bf4a6097..b4b62b9ccc45 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -192,6 +192,12 @@ static void vmd_pci_msi_enable(struct irq_data *data)
 	data->chip->irq_unmask(data);
 }

+static unsigned int vmd_pci_msi_startup(struct irq_data *data)
+{
+	vmd_pci_msi_enable(data);
+	return 0;
+}
+
 static void vmd_irq_disable(struct irq_data *data)
 {
 	struct vmd_irq *vmdirq = data->chip_data;
@@ -210,6 +216,11 @@ static void vmd_pci_msi_disable(struct irq_data *data)
 	vmd_irq_disable(data->parent_data);
 }

+static void vmd_pci_msi_shutdown(struct irq_data *data)
+{
+	vmd_pci_msi_disable(data);
+}
+
 static struct irq_chip vmd_msi_controller = {
 	.name			= "VMD-MSI",
 	.irq_compose_msi_msg	= vmd_compose_msi_msg,
@@ -309,6 +320,8 @@ static bool vmd_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 	if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
 		return false;

+	info->chip->irq_startup		= vmd_pci_msi_startup;
+	info->chip->irq_shutdown	= vmd_pci_msi_shutdown;
 	info->chip->irq_enable		= vmd_pci_msi_enable;
 	info->chip->irq_disable		= vmd_pci_msi_disable;
 	return true;
--
2.51.0


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

* Re: [PATCH] PCI: vmd: override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info()
  2025-10-14  1:46 [PATCH] PCI: vmd: override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info() Inochi Amaoto
@ 2025-10-14 21:18 ` Bjorn Helgaas
  2025-10-16 16:55   ` Bjorn Helgaas
  0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2025-10-14 21:18 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Nirmal Patel, Jonathan Derrick, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, Chen Wang, Thomas Gleixner, Kenneth Crudup,
	Genes Lists, linux-pci, linux-kernel, Yixun Lan, Longbin Li

On Tue, Oct 14, 2025 at 09:46:07AM +0800, Inochi Amaoto wrote:
> Since commit 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per
> device domains") set callback irq_startup() and irq_shutdown() of
> the struct pci_msi[x]_template, __irq_startup() will always invokes
> irq_startup() callback instead of irq_enable() callback overridden
> in vmd_init_dev_msi_info(). This will not start the irq correctly.
> 
> Also override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info(),
> so the irq_startup() can invoke the real logic.
> 
> Fixes: 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per device domains")
> Reported-by: Kenneth Crudup <kenny@panix.com>
> Closes: https://lore.kernel.org/all/8a923590-5b3a-406f-a324-7bd1cf894d8f@panix.com/
> Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
> Tested-by: Kenneth R. Crudup <kenny@panix.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

Thomas, I'm happy to take this via PCI you prefer.  I acked it
because you merged 54f45a30c0d0.

If you take it, I wouldn't mind if you capitalized "Override" in the
subject to match the history.

Obviously this is v6.18 material since 54f45a30c0d0 is a v6.18-rc1
regression.

> ---
>  drivers/pci/controller/vmd.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index 1bd5bf4a6097..b4b62b9ccc45 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
> @@ -192,6 +192,12 @@ static void vmd_pci_msi_enable(struct irq_data *data)
>  	data->chip->irq_unmask(data);
>  }
> 
> +static unsigned int vmd_pci_msi_startup(struct irq_data *data)
> +{
> +	vmd_pci_msi_enable(data);
> +	return 0;
> +}
> +
>  static void vmd_irq_disable(struct irq_data *data)
>  {
>  	struct vmd_irq *vmdirq = data->chip_data;
> @@ -210,6 +216,11 @@ static void vmd_pci_msi_disable(struct irq_data *data)
>  	vmd_irq_disable(data->parent_data);
>  }
> 
> +static void vmd_pci_msi_shutdown(struct irq_data *data)
> +{
> +	vmd_pci_msi_disable(data);
> +}
> +
>  static struct irq_chip vmd_msi_controller = {
>  	.name			= "VMD-MSI",
>  	.irq_compose_msi_msg	= vmd_compose_msi_msg,
> @@ -309,6 +320,8 @@ static bool vmd_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
>  	if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
>  		return false;
> 
> +	info->chip->irq_startup		= vmd_pci_msi_startup;
> +	info->chip->irq_shutdown	= vmd_pci_msi_shutdown;
>  	info->chip->irq_enable		= vmd_pci_msi_enable;
>  	info->chip->irq_disable		= vmd_pci_msi_disable;
>  	return true;
> --
> 2.51.0
> 

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

* Re: [PATCH] PCI: vmd: override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info()
  2025-10-14 21:18 ` Bjorn Helgaas
@ 2025-10-16 16:55   ` Bjorn Helgaas
  2025-10-17  7:29     ` Hervé D.
  0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2025-10-16 16:55 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Nirmal Patel, Jonathan Derrick, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, Chen Wang, Thomas Gleixner, Kenneth Crudup,
	Genes Lists, linux-pci, linux-kernel, Yixun Lan, Longbin Li,
	Todd Brandt, Oliver Hartkopp

[+cc Gene, Todd, Oliver]

On Tue, Oct 14, 2025 at 04:18:24PM -0500, Bjorn Helgaas wrote:
> On Tue, Oct 14, 2025 at 09:46:07AM +0800, Inochi Amaoto wrote:
> > Since commit 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per
> > device domains") set callback irq_startup() and irq_shutdown() of
> > the struct pci_msi[x]_template, __irq_startup() will always invokes
> > irq_startup() callback instead of irq_enable() callback overridden
> > in vmd_init_dev_msi_info(). This will not start the irq correctly.
> > 
> > Also override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info(),
> > so the irq_startup() can invoke the real logic.
> > 
> > Fixes: 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per device domains")
> > Reported-by: Kenneth Crudup <kenny@panix.com>
> > Closes: https://lore.kernel.org/all/8a923590-5b3a-406f-a324-7bd1cf894d8f@panix.com/
> > Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
> > Tested-by: Kenneth R. Crudup <kenny@panix.com>
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> Thomas, I'm happy to take this via PCI you prefer.  I acked it
> because you merged 54f45a30c0d0.
> 
> If you take it, I wouldn't mind if you capitalized "Override" in the
> subject to match the history.
> 
> Obviously this is v6.18 material since 54f45a30c0d0 is a v6.18-rc1
> regression.

Not having heard anything, I put this on pci/for-linus and plan to
request a merge before -rc2.  Let me know if you plan to merge this
elsewhere and I can drop it from the PCI tree.

I added more reports to the commit log:

  PCI: vmd: Override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info()

  Since commit 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per
  device domains") set callback irq_startup() and irq_shutdown() of
  the struct pci_msi[x]_template, __irq_startup() will always invokes
  irq_startup() callback instead of irq_enable() callback overridden
  in vmd_init_dev_msi_info(). This will not start the IRQ correctly.

  Also override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info(),
  so the irq_startup() can invoke the real logic.

  Fixes: 54f45a30c0d0 ("PCI/MSI: Add startup/shutdown for per device domains")
  Reported-by: Kenneth Crudup <kenny@panix.com>
  Closes: https://lore.kernel.org/r/8a923590-5b3a-406f-a324-7bd1cf894d8f@panix.com/
  Reported-by: Genes Lists <lists@sapience.com>
  Closes: https://lore.kernel.org/r/4b392af8847cc19720ffcd53865f60ab3edc56b3.camel@sapience.com
  Reported-by: Todd Brandt <todd.e.brandt@intel.com>
  Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220658
  Reported-by: Oliver Hartkopp <socketcan@hartkopp.net>
  Closes: https://lore.kernel.org/r/8d6887a5-60bc-423c-8f7a-87b4ab739f6a@hartkopp.net
  Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
  Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  Tested-by: Kenneth R. Crudup <kenny@panix.com>
  Tested-by: Genes Lists <lists@sapience.com>
  Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
  Link: https://patch.msgid.link/20251014014607.612586-1-inochiama@gmail.com

> > ---
> >  drivers/pci/controller/vmd.c | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> > index 1bd5bf4a6097..b4b62b9ccc45 100644
> > --- a/drivers/pci/controller/vmd.c
> > +++ b/drivers/pci/controller/vmd.c
> > @@ -192,6 +192,12 @@ static void vmd_pci_msi_enable(struct irq_data *data)
> >  	data->chip->irq_unmask(data);
> >  }
> > 
> > +static unsigned int vmd_pci_msi_startup(struct irq_data *data)
> > +{
> > +	vmd_pci_msi_enable(data);
> > +	return 0;
> > +}
> > +
> >  static void vmd_irq_disable(struct irq_data *data)
> >  {
> >  	struct vmd_irq *vmdirq = data->chip_data;
> > @@ -210,6 +216,11 @@ static void vmd_pci_msi_disable(struct irq_data *data)
> >  	vmd_irq_disable(data->parent_data);
> >  }
> > 
> > +static void vmd_pci_msi_shutdown(struct irq_data *data)
> > +{
> > +	vmd_pci_msi_disable(data);
> > +}
> > +
> >  static struct irq_chip vmd_msi_controller = {
> >  	.name			= "VMD-MSI",
> >  	.irq_compose_msi_msg	= vmd_compose_msi_msg,
> > @@ -309,6 +320,8 @@ static bool vmd_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
> >  	if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
> >  		return false;
> > 
> > +	info->chip->irq_startup		= vmd_pci_msi_startup;
> > +	info->chip->irq_shutdown	= vmd_pci_msi_shutdown;
> >  	info->chip->irq_enable		= vmd_pci_msi_enable;
> >  	info->chip->irq_disable		= vmd_pci_msi_disable;
> >  	return true;
> > --
> > 2.51.0
> > 

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

* Re: [PATCH] PCI: vmd: override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info()
  2025-10-16 16:55   ` Bjorn Helgaas
@ 2025-10-17  7:29     ` Hervé D.
  2025-10-17 13:32       ` Bjorn Helgaas
  0 siblings, 1 reply; 5+ messages in thread
From: Hervé D. @ 2025-10-17  7:29 UTC (permalink / raw)
  To: helgaas
  Cc: bhelgaas, dlan, inochiama, jonathan.derrick, kenny, kwilczynski,
	linux-kernel, linux-pci, lists, looong.bin, lpieralisi, mani,
	nirmal.patel, robh, socketcan, tglx, todd.e.brandt, unicorn_wang,
	Hervé

Hello,

I've tested the patch on a clean 6.17.3 tree, seems booting and running properly on my debian13 system.

you can include theses on the patch
Reported-by: Hervé <herve@dxcv.net>
Tested-by: Hervé <herve@dxcv.net>

Regards,
Hervé

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

* Re: [PATCH] PCI: vmd: override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info()
  2025-10-17  7:29     ` Hervé D.
@ 2025-10-17 13:32       ` Bjorn Helgaas
  0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2025-10-17 13:32 UTC (permalink / raw)
  To: Hervé D.
  Cc: bhelgaas, dlan, inochiama, jonathan.derrick, kenny, kwilczynski,
	linux-kernel, linux-pci, lists, looong.bin, lpieralisi, mani,
	nirmal.patel, robh, socketcan, tglx, todd.e.brandt, unicorn_wang

On Fri, Oct 17, 2025 at 09:29:52AM +0200, Hervé D. wrote:
> Hello,
> 
> I've tested the patch on a clean 6.17.3 tree, seems booting and running properly on my debian13 system.
> 
> you can include theses on the patch
> Reported-by: Hervé <herve@dxcv.net>
> Tested-by: Hervé <herve@dxcv.net>

Thank you!  Added to the commit, should appear in v6.18-rc2.

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

end of thread, other threads:[~2025-10-17 13:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-14  1:46 [PATCH] PCI: vmd: override irq_startup()/irq_shutdown() in vmd_init_dev_msi_info() Inochi Amaoto
2025-10-14 21:18 ` Bjorn Helgaas
2025-10-16 16:55   ` Bjorn Helgaas
2025-10-17  7:29     ` Hervé D.
2025-10-17 13:32       ` Bjorn Helgaas

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