All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Alex Williamson
	<alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	aik-sLpHqDYs0B2HXe+LvDLADg@public.gmane.org,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org,
	qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org
Subject: Re: [PATCH 3/3] device_isolation: Support isolation on POWER p7ioc (IODA) bridges
Date: Thu, 2 Feb 2012 11:23:03 +1100	[thread overview]
Message-ID: <20120202002303.GD8700@truffala.fritz.box> (raw)
In-Reply-To: <1328123825.6937.227.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>

On Wed, Feb 01, 2012 at 12:17:05PM -0700, Alex Williamson wrote:
> On Wed, 2012-02-01 at 15:46 +1100, David Gibson wrote:
> > This patch adds code to the code for the powernv platform to create
> > and populate isolation groups on hardware using the p7ioc (aka IODA) PCI host
> > bridge used on some IBM POWER systems.
> > 
> > Signed-off-by: Alexey Kardashevskiy <aik-sLpHqDYs0B2HXe+LvDLADg@public.gmane.org>
> > Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
> > ---
> >  arch/powerpc/platforms/powernv/pci-ioda.c |   18 ++++++++++++++++--
> >  arch/powerpc/platforms/powernv/pci.h      |    6 ++++++
> >  2 files changed, 22 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> > index 5e155df..4648475 100644
> > --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> > @@ -20,6 +20,7 @@
> >  #include <linux/irq.h>
> >  #include <linux/io.h>
> >  #include <linux/msi.h>
> > +#include <linux/device_isolation.h>
> >  
> >  #include <asm/sections.h>
> >  #include <asm/io.h>
> > @@ -877,6 +878,9 @@ static void __devinit pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe,
> >  		set_iommu_table_base(&dev->dev, &pe->tce32_table);
> >  		if (dev->subordinate)
> >  			pnv_ioda_setup_bus_dma(pe, dev->subordinate);
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +		device_isolation_dev_add(&pe->di_group, &dev->dev);
> > +#endif
> >  	}
> >  }
> >  
> > @@ -957,11 +961,21 @@ static void __devinit pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
> >  	}
> >  	iommu_init_table(tbl, phb->hose->node);
> >  
> > -	if (pe->pdev)
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +	BUG_ON(device_isolation_group_init(&pe->di_group, "ioda:rid%x-pe%x",
> > +					   pe->rid, pe->pe_number) < 0);
> > +#endif
> > +
> > +	if (pe->pdev) {
> >  		set_iommu_table_base(&pe->pdev->dev, tbl);
> > -	else
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +		device_isolation_dev_add(&pe->di_group, &pe->pdev->dev);
> > +#endif
> > +	} else
> >  		pnv_ioda_setup_bus_dma(pe, pe->pbus);
> 
> Blech, #ifdefs.

Hm, yeah.  The problem is the di_group member not even existing when
!DEVICE_ISOLATION.  Might be able to avoid that with an empty
structure in that case.

> > +
> > +
> >  	return;
> >   fail:
> >  	/* XXX Failure: Try to fallback to 64-bit only ? */
> > diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
> > index 64ede1e..3e282b7 100644
> > --- a/arch/powerpc/platforms/powernv/pci.h
> > +++ b/arch/powerpc/platforms/powernv/pci.h
> > @@ -1,6 +1,8 @@
> >  #ifndef __POWERNV_PCI_H
> >  #define __POWERNV_PCI_H
> >  
> > +#include <linux/device_isolation.h>
> > +
> >  struct pci_dn;
> >  
> >  enum pnv_phb_type {
> > @@ -60,6 +62,10 @@ struct pnv_ioda_pe {
> >  
> >  	/* Link in list of PE#s */
> >  	struct list_head	link;
> > +
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +	struct device_isolation_group di_group;
> > +#endif
> 
> Embedding the struct means we need to know the size, which means we
> can't get rid of the #ifdef.  Probably better to use a pointer if we
> don't mind adding a few bytes in the #ifndef case.  Thanks,

I've been back and forth a few types on this, and I've convinced
myself that allowing the group structure to be embedded is a better
idea.  It's a particular help when you need to construct one from
platform or bridge init code that runs before mem_init_done.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

WARNING: multiple messages have this Message-ID (diff)
From: David Gibson <david@gibson.dropbear.id.au>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: dwmw2@infradead.org, iommu@lists.linux-foundation.org,
	aik@ozlabs.ru, benh@kernel.crashing.org, qemu-devel@nongnu.org,
	joerg.roedel@amd.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] device_isolation: Support isolation on POWER p7ioc (IODA) bridges
Date: Thu, 2 Feb 2012 11:23:03 +1100	[thread overview]
Message-ID: <20120202002303.GD8700@truffala.fritz.box> (raw)
In-Reply-To: <1328123825.6937.227.camel@bling.home>

On Wed, Feb 01, 2012 at 12:17:05PM -0700, Alex Williamson wrote:
> On Wed, 2012-02-01 at 15:46 +1100, David Gibson wrote:
> > This patch adds code to the code for the powernv platform to create
> > and populate isolation groups on hardware using the p7ioc (aka IODA) PCI host
> > bridge used on some IBM POWER systems.
> > 
> > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> >  arch/powerpc/platforms/powernv/pci-ioda.c |   18 ++++++++++++++++--
> >  arch/powerpc/platforms/powernv/pci.h      |    6 ++++++
> >  2 files changed, 22 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> > index 5e155df..4648475 100644
> > --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> > @@ -20,6 +20,7 @@
> >  #include <linux/irq.h>
> >  #include <linux/io.h>
> >  #include <linux/msi.h>
> > +#include <linux/device_isolation.h>
> >  
> >  #include <asm/sections.h>
> >  #include <asm/io.h>
> > @@ -877,6 +878,9 @@ static void __devinit pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe,
> >  		set_iommu_table_base(&dev->dev, &pe->tce32_table);
> >  		if (dev->subordinate)
> >  			pnv_ioda_setup_bus_dma(pe, dev->subordinate);
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +		device_isolation_dev_add(&pe->di_group, &dev->dev);
> > +#endif
> >  	}
> >  }
> >  
> > @@ -957,11 +961,21 @@ static void __devinit pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
> >  	}
> >  	iommu_init_table(tbl, phb->hose->node);
> >  
> > -	if (pe->pdev)
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +	BUG_ON(device_isolation_group_init(&pe->di_group, "ioda:rid%x-pe%x",
> > +					   pe->rid, pe->pe_number) < 0);
> > +#endif
> > +
> > +	if (pe->pdev) {
> >  		set_iommu_table_base(&pe->pdev->dev, tbl);
> > -	else
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +		device_isolation_dev_add(&pe->di_group, &pe->pdev->dev);
> > +#endif
> > +	} else
> >  		pnv_ioda_setup_bus_dma(pe, pe->pbus);
> 
> Blech, #ifdefs.

Hm, yeah.  The problem is the di_group member not even existing when
!DEVICE_ISOLATION.  Might be able to avoid that with an empty
structure in that case.

> > +
> > +
> >  	return;
> >   fail:
> >  	/* XXX Failure: Try to fallback to 64-bit only ? */
> > diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
> > index 64ede1e..3e282b7 100644
> > --- a/arch/powerpc/platforms/powernv/pci.h
> > +++ b/arch/powerpc/platforms/powernv/pci.h
> > @@ -1,6 +1,8 @@
> >  #ifndef __POWERNV_PCI_H
> >  #define __POWERNV_PCI_H
> >  
> > +#include <linux/device_isolation.h>
> > +
> >  struct pci_dn;
> >  
> >  enum pnv_phb_type {
> > @@ -60,6 +62,10 @@ struct pnv_ioda_pe {
> >  
> >  	/* Link in list of PE#s */
> >  	struct list_head	link;
> > +
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +	struct device_isolation_group di_group;
> > +#endif
> 
> Embedding the struct means we need to know the size, which means we
> can't get rid of the #ifdef.  Probably better to use a pointer if we
> don't mind adding a few bytes in the #ifndef case.  Thanks,

I've been back and forth a few types on this, and I've convinced
myself that allowing the group structure to be embedded is a better
idea.  It's a particular help when you need to construct one from
platform or bridge init code that runs before mem_init_done.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

WARNING: multiple messages have this Message-ID (diff)
From: David Gibson <david@gibson.dropbear.id.au>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, aik@ozlabs.ru, qemu-devel@nongnu.org,
	linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	joerg.roedel@amd.com, dwmw2@infradead.org
Subject: Re: [Qemu-devel] [PATCH 3/3] device_isolation: Support isolation on POWER p7ioc (IODA) bridges
Date: Thu, 2 Feb 2012 11:23:03 +1100	[thread overview]
Message-ID: <20120202002303.GD8700@truffala.fritz.box> (raw)
In-Reply-To: <1328123825.6937.227.camel@bling.home>

On Wed, Feb 01, 2012 at 12:17:05PM -0700, Alex Williamson wrote:
> On Wed, 2012-02-01 at 15:46 +1100, David Gibson wrote:
> > This patch adds code to the code for the powernv platform to create
> > and populate isolation groups on hardware using the p7ioc (aka IODA) PCI host
> > bridge used on some IBM POWER systems.
> > 
> > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> >  arch/powerpc/platforms/powernv/pci-ioda.c |   18 ++++++++++++++++--
> >  arch/powerpc/platforms/powernv/pci.h      |    6 ++++++
> >  2 files changed, 22 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> > index 5e155df..4648475 100644
> > --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> > @@ -20,6 +20,7 @@
> >  #include <linux/irq.h>
> >  #include <linux/io.h>
> >  #include <linux/msi.h>
> > +#include <linux/device_isolation.h>
> >  
> >  #include <asm/sections.h>
> >  #include <asm/io.h>
> > @@ -877,6 +878,9 @@ static void __devinit pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe,
> >  		set_iommu_table_base(&dev->dev, &pe->tce32_table);
> >  		if (dev->subordinate)
> >  			pnv_ioda_setup_bus_dma(pe, dev->subordinate);
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +		device_isolation_dev_add(&pe->di_group, &dev->dev);
> > +#endif
> >  	}
> >  }
> >  
> > @@ -957,11 +961,21 @@ static void __devinit pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
> >  	}
> >  	iommu_init_table(tbl, phb->hose->node);
> >  
> > -	if (pe->pdev)
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +	BUG_ON(device_isolation_group_init(&pe->di_group, "ioda:rid%x-pe%x",
> > +					   pe->rid, pe->pe_number) < 0);
> > +#endif
> > +
> > +	if (pe->pdev) {
> >  		set_iommu_table_base(&pe->pdev->dev, tbl);
> > -	else
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +		device_isolation_dev_add(&pe->di_group, &pe->pdev->dev);
> > +#endif
> > +	} else
> >  		pnv_ioda_setup_bus_dma(pe, pe->pbus);
> 
> Blech, #ifdefs.

Hm, yeah.  The problem is the di_group member not even existing when
!DEVICE_ISOLATION.  Might be able to avoid that with an empty
structure in that case.

> > +
> > +
> >  	return;
> >   fail:
> >  	/* XXX Failure: Try to fallback to 64-bit only ? */
> > diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
> > index 64ede1e..3e282b7 100644
> > --- a/arch/powerpc/platforms/powernv/pci.h
> > +++ b/arch/powerpc/platforms/powernv/pci.h
> > @@ -1,6 +1,8 @@
> >  #ifndef __POWERNV_PCI_H
> >  #define __POWERNV_PCI_H
> >  
> > +#include <linux/device_isolation.h>
> > +
> >  struct pci_dn;
> >  
> >  enum pnv_phb_type {
> > @@ -60,6 +62,10 @@ struct pnv_ioda_pe {
> >  
> >  	/* Link in list of PE#s */
> >  	struct list_head	link;
> > +
> > +#ifdef CONFIG_DEVICE_ISOLATION
> > +	struct device_isolation_group di_group;
> > +#endif
> 
> Embedding the struct means we need to know the size, which means we
> can't get rid of the #ifdef.  Probably better to use a pointer if we
> don't mind adding a few bytes in the #ifndef case.  Thanks,

I've been back and forth a few types on this, and I've convinced
myself that allowing the group structure to be embedded is a better
idea.  It's a particular help when you need to construct one from
platform or bridge init code that runs before mem_init_done.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  parent reply	other threads:[~2012-02-02  0:23 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01  4:46 RFC: Device isolation groups David Gibson
2012-02-01  4:46 ` [Qemu-devel] " David Gibson
2012-02-01  4:46 ` David Gibson
     [not found] ` <1328071614-8320-1-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
2012-02-01  4:46   ` [PATCH 1/3] Device isolation group infrastructure (v3) David Gibson
2012-02-01  4:46     ` [Qemu-devel] " David Gibson
2012-02-01  4:46     ` David Gibson
     [not found]     ` <1328071614-8320-2-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
2012-02-08 15:27       ` Joerg Roedel
2012-02-08 15:27         ` [Qemu-devel] " Joerg Roedel
2012-02-08 15:27         ` Joerg Roedel
     [not found]         ` <20120208152748.GD22598-5C7GfCeVMHo@public.gmane.org>
2012-02-08 21:39           ` Benjamin Herrenschmidt
2012-02-08 21:39             ` [Qemu-devel] " Benjamin Herrenschmidt
2012-02-08 21:39             ` Benjamin Herrenschmidt
2012-02-09 11:28             ` Joerg Roedel
2012-02-09 11:28               ` [Qemu-devel] " Joerg Roedel
2012-02-09 11:28               ` Joerg Roedel
     [not found]               ` <20120209112805.GN22598-5C7GfCeVMHo@public.gmane.org>
2012-02-10  0:21                 ` David Gibson
2012-02-10  0:21                   ` [Qemu-devel] " David Gibson
2012-02-10  0:21                   ` David Gibson
2012-02-08 21:43           ` Benjamin Herrenschmidt
2012-02-08 21:43             ` [Qemu-devel] " Benjamin Herrenschmidt
2012-02-08 21:43             ` Benjamin Herrenschmidt
2012-02-09  1:40         ` David Gibson
2012-02-09  1:40           ` [Qemu-devel] " David Gibson
2012-02-09  1:40           ` David Gibson
2012-02-01  4:46   ` [PATCH 2/3] device_isolation: Support isolation on POWER p5ioc2 bridges David Gibson
2012-02-01  4:46     ` [Qemu-devel] " David Gibson
2012-02-01  4:46     ` David Gibson
     [not found]     ` <1328071614-8320-3-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
2012-02-01 18:58       ` Alex Williamson
2012-02-01 18:58         ` [Qemu-devel] " Alex Williamson
2012-02-01 18:58         ` Alex Williamson
     [not found]         ` <1328122724.6937.216.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2012-02-01 19:15           ` Alex Williamson
2012-02-01 19:15             ` [Qemu-devel] " Alex Williamson
2012-02-01 19:15             ` Alex Williamson
2012-02-01  4:46   ` [PATCH 3/3] device_isolation: Support isolation on POWER p7ioc (IODA) bridges David Gibson
2012-02-01  4:46     ` [Qemu-devel] " David Gibson
2012-02-01  4:46     ` David Gibson
     [not found]     ` <1328071614-8320-4-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
2012-02-01 19:17       ` Alex Williamson
2012-02-01 19:17         ` [Qemu-devel] " Alex Williamson
2012-02-01 19:17         ` Alex Williamson
     [not found]         ` <1328123825.6937.227.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2012-02-02  0:23           ` David Gibson [this message]
2012-02-02  0:23             ` [Qemu-devel] " David Gibson
2012-02-02  0:23             ` David Gibson
2012-02-01 20:08   ` RFC: Device isolation groups Alex Williamson
2012-02-01 20:08     ` [Qemu-devel] " Alex Williamson
2012-02-01 20:08     ` Alex Williamson
     [not found]     ` <1328126919.6937.254.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2012-02-02  1:24       ` David Gibson
2012-02-02  1:24         ` [Qemu-devel] " David Gibson
2012-02-02  1:24         ` David Gibson
     [not found]         ` <20120202012414.GE8700-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2012-02-29 19:30           ` Alex Williamson
2012-02-29 19:30             ` [Qemu-devel] " Alex Williamson
2012-02-29 19:30             ` Alex Williamson
     [not found]             ` <1330543855.29701.180.camel-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2012-03-09  3:40               ` David Gibson
2012-03-09  3:40                 ` [Qemu-devel] " David Gibson
2012-03-09  3:40                 ` David Gibson
  -- strict thread matches above, loose matches on Subject: below --
2011-12-15  6:25 [RFC] Device isolation infrastructure v2 David Gibson
2011-12-15  6:25 ` [PATCH 3/3] device_isolation: Support isolation on POWER p7ioc (IODA) bridges David Gibson
2011-12-15  6:09 [PATCH 2/3] device_isolation: Support isolation on POWER p5ioc2 bridges David Gibson
2011-12-15  6:09 ` [PATCH 3/3] device_isolation: Support isolation on POWER p7ioc (IODA) bridges David Gibson

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=20120202002303.GD8700@truffala.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=aik-sLpHqDYs0B2HXe+LvDLADg@public.gmane.org \
    --cc=alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.