linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 15/55] PCI: vmd: Create named irq domain
       [not found] <20170619233700.547167146@linutronix.de>
@ 2017-06-19 23:37 ` Thomas Gleixner
  2017-06-20 20:07   ` Keith Busch
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2017-06-19 23:37 UTC (permalink / raw)
  To: LKML
  Cc: Marc Zyngier, Christoph Hellwig, Ingo Molnar, Peter Zijlstra,
	Michael Ellerman, Jens Axboe, Keith Busch, Bjorn Helgaas,
	linux-pci

Use the fwnode to create a named domain so diagnosis works.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/pci/host/vmd.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/drivers/pci/host/vmd.c
+++ b/drivers/pci/host/vmd.c
@@ -554,6 +554,7 @@ static int vmd_find_free_domain(void)
 static int vmd_enable_domain(struct vmd_dev *vmd)
 {
 	struct pci_sysdata *sd = &vmd->sysdata;
+	struct fwnode_handle *fn;
 	struct resource *res;
 	u32 upper_bits;
 	unsigned long flags;
@@ -617,8 +618,13 @@ static int vmd_enable_domain(struct vmd_
 
 	sd->node = pcibus_to_node(vmd->dev->bus);
 
-	vmd->irq_domain = pci_msi_create_irq_domain(NULL, &vmd_msi_domain_info,
+	fn = irq_domain_alloc_named_id_fwnode("VMD-MSI", vmd->sysdata.domain);
+	if (!fn)
+		return -ENODEV;
+
+	vmd->irq_domain = pci_msi_create_irq_domain(fn, &vmd_msi_domain_info,
 						    x86_vector_domain);
+	kfree(fn);
 	if (!vmd->irq_domain)
 		return -ENODEV;
 

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

* Re: [patch 15/55] PCI: vmd: Create named irq domain
  2017-06-20 20:07   ` Keith Busch
@ 2017-06-20 20:07     ` Thomas Gleixner
  2017-06-20 20:39       ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2017-06-20 20:07 UTC (permalink / raw)
  To: Keith Busch
  Cc: LKML, Marc Zyngier, Christoph Hellwig, Ingo Molnar,
	Peter Zijlstra, Michael Ellerman, Jens Axboe, Bjorn Helgaas,
	linux-pci

On Tue, 20 Jun 2017, Keith Busch wrote:
> On Tue, Jun 20, 2017 at 01:37:15AM +0200, Thomas Gleixner wrote:
> >  static int vmd_enable_domain(struct vmd_dev *vmd)
> >  {
> >  	struct pci_sysdata *sd = &vmd->sysdata;
> > +	struct fwnode_handle *fn;
> >  	struct resource *res;
> >  	u32 upper_bits;
> >  	unsigned long flags;
> > @@ -617,8 +618,13 @@ static int vmd_enable_domain(struct vmd_
> >  
> >  	sd->node = pcibus_to_node(vmd->dev->bus);
> >  
> > -	vmd->irq_domain = pci_msi_create_irq_domain(NULL, &vmd_msi_domain_info,
> > +	fn = irq_domain_alloc_named_id_fwnode("VMD-MSI", vmd->sysdata.domain);
> > +	if (!fn)
> > +		return -ENODEV;
> > +
> > +	vmd->irq_domain = pci_msi_create_irq_domain(fn, &vmd_msi_domain_info,
> >  						    x86_vector_domain);
> > +	kfree(fn);
> 
> If I'm following all this correctly, it looks like we need to use
> irq_domain_free_fwnode with irq_domain_alloc_named_id_fwnode instead of
> freeing 'fn' directly, otherwise we leak 'fwid->name'.

Yes, I'm a moron.

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

* Re: [patch 15/55] PCI: vmd: Create named irq domain
  2017-06-19 23:37 ` [patch 15/55] PCI: vmd: Create named irq domain Thomas Gleixner
@ 2017-06-20 20:07   ` Keith Busch
  2017-06-20 20:07     ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Busch @ 2017-06-20 20:07 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Marc Zyngier, Christoph Hellwig, Ingo Molnar,
	Peter Zijlstra, Michael Ellerman, Jens Axboe, Bjorn Helgaas,
	linux-pci

On Tue, Jun 20, 2017 at 01:37:15AM +0200, Thomas Gleixner wrote:
>  static int vmd_enable_domain(struct vmd_dev *vmd)
>  {
>  	struct pci_sysdata *sd = &vmd->sysdata;
> +	struct fwnode_handle *fn;
>  	struct resource *res;
>  	u32 upper_bits;
>  	unsigned long flags;
> @@ -617,8 +618,13 @@ static int vmd_enable_domain(struct vmd_
>  
>  	sd->node = pcibus_to_node(vmd->dev->bus);
>  
> -	vmd->irq_domain = pci_msi_create_irq_domain(NULL, &vmd_msi_domain_info,
> +	fn = irq_domain_alloc_named_id_fwnode("VMD-MSI", vmd->sysdata.domain);
> +	if (!fn)
> +		return -ENODEV;
> +
> +	vmd->irq_domain = pci_msi_create_irq_domain(fn, &vmd_msi_domain_info,
>  						    x86_vector_domain);
> +	kfree(fn);

If I'm following all this correctly, it looks like we need to use
irq_domain_free_fwnode with irq_domain_alloc_named_id_fwnode instead of
freeing 'fn' directly, otherwise we leak 'fwid->name'.

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

* Re: [patch 15/55] PCI: vmd: Create named irq domain
  2017-06-20 20:07     ` Thomas Gleixner
@ 2017-06-20 20:39       ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2017-06-20 20:39 UTC (permalink / raw)
  To: Keith Busch
  Cc: LKML, Marc Zyngier, Christoph Hellwig, Ingo Molnar,
	Peter Zijlstra, Michael Ellerman, Jens Axboe, Bjorn Helgaas,
	linux-pci

On Tue, 20 Jun 2017, Thomas Gleixner wrote:
> On Tue, 20 Jun 2017, Keith Busch wrote:
> > On Tue, Jun 20, 2017 at 01:37:15AM +0200, Thomas Gleixner wrote:
> > >  static int vmd_enable_domain(struct vmd_dev *vmd)
> > >  {
> > >  	struct pci_sysdata *sd = &vmd->sysdata;
> > > +	struct fwnode_handle *fn;
> > >  	struct resource *res;
> > >  	u32 upper_bits;
> > >  	unsigned long flags;
> > > @@ -617,8 +618,13 @@ static int vmd_enable_domain(struct vmd_
> > >  
> > >  	sd->node = pcibus_to_node(vmd->dev->bus);
> > >  
> > > -	vmd->irq_domain = pci_msi_create_irq_domain(NULL, &vmd_msi_domain_info,
> > > +	fn = irq_domain_alloc_named_id_fwnode("VMD-MSI", vmd->sysdata.domain);
> > > +	if (!fn)
> > > +		return -ENODEV;
> > > +
> > > +	vmd->irq_domain = pci_msi_create_irq_domain(fn, &vmd_msi_domain_info,
> > >  						    x86_vector_domain);
> > > +	kfree(fn);
> > 
> > If I'm following all this correctly, it looks like we need to use
> > irq_domain_free_fwnode with irq_domain_alloc_named_id_fwnode instead of
> > freeing 'fn' directly, otherwise we leak 'fwid->name'.
> 
> Yes, I'm a moron.

Fixed up the mess and updated the git branch.

Thanks for catching it.

       tglx

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

end of thread, other threads:[~2017-06-20 20:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170619233700.547167146@linutronix.de>
2017-06-19 23:37 ` [patch 15/55] PCI: vmd: Create named irq domain Thomas Gleixner
2017-06-20 20:07   ` Keith Busch
2017-06-20 20:07     ` Thomas Gleixner
2017-06-20 20:39       ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).