Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1670100 > unrolled thread

[patch 15/55] PCI: vmd: Create named irq domain

Started byThomas Gleixner <tglx@linutronix.de>
First post2017-06-20 02:10 +0200
Last post2017-06-22 19:00 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [patch 15/55] PCI: vmd: Create named irq domain Thomas Gleixner <tglx@linutronix.de> - 2017-06-20 02:10 +0200
    Re: [patch 15/55] PCI: vmd: Create named irq domain Keith Busch <keith.busch@intel.com> - 2017-06-20 22:00 +0200
      Re: [patch 15/55] PCI: vmd: Create named irq domain Thomas Gleixner <tglx@linutronix.de> - 2017-06-20 22:10 +0200
        Re: [patch 15/55] PCI: vmd: Create named irq domain Thomas Gleixner <tglx@linutronix.de> - 2017-06-20 22:40 +0200
    [tip:irq/core] PCI/vmd: Create named irq domain tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-06-22 19:00 +0200

#1670100 — [patch 15/55] PCI: vmd: Create named irq domain

FromThomas Gleixner <tglx@linutronix.de>
Date2017-06-20 02:10 +0200
Subject[patch 15/55] PCI: vmd: Create named irq domain
Message-ID<tUeU4-1fU-89@gated-at.bofh.it>
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;
 

[toc] | [next] | [standalone]


#1671058

FromKeith Busch <keith.busch@intel.com>
Date2017-06-20 22:00 +0200
Message-ID<tUxtE-4rk-25@gated-at.bofh.it>
In reply to#1670100
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'.

[toc] | [prev] | [next] | [standalone]


#1671063

FromThomas Gleixner <tglx@linutronix.de>
Date2017-06-20 22:10 +0200
Message-ID<tUxDj-4LL-7@gated-at.bofh.it>
In reply to#1671058
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.

[toc] | [prev] | [next] | [standalone]


#1671089

FromThomas Gleixner <tglx@linutronix.de>
Date2017-06-20 22:40 +0200
Message-ID<tUy6l-4Vv-9@gated-at.bofh.it>
In reply to#1671063
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

[toc] | [prev] | [next] | [standalone]


#1672837 — [tip:irq/core] PCI/vmd: Create named irq domain

Fromtip-bot for Thomas Gleixner <tipbot@zytor.com>
Date2017-06-22 19:00 +0200
Subject[tip:irq/core] PCI/vmd: Create named irq domain
Message-ID<tVdCz-7lD-45@gated-at.bofh.it>
In reply to#1670100
Commit-ID:  ae904cafd59d7120ef2afb97b252eadeba45e95f
Gitweb:     http://git.kernel.org/tip/ae904cafd59d7120ef2afb97b252eadeba45e95f
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 20 Jun 2017 01:37:15 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 22 Jun 2017 18:21:12 +0200

PCI/vmd: Create named irq domain

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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-pci@vger.kernel.org
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Christoph Hellwig <hch@lst.de>
Link: http://lkml.kernel.org/r/20170619235444.379861978@linutronix.de

---
 drivers/pci/host/vmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/host/vmd.c b/drivers/pci/host/vmd.c
index e27ad2a..31203d6 100644
--- 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_dev *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);
+	irq_domain_free_fwnode(fn);
 	if (!vmd->irq_domain)
 		return -ENODEV;
 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web