[PATCH] ibmveth: Fix off-by-one error in ibmveth_change_mtu()

2015-04-12 Thread David Gibson
an <= in ibmveth_change_mtu(), which only permits an MTU which is strictly smaller than the buffer size, rather than allowing the buffer to be completely filled. This patch fixes the buglet. Signed-off-by: David Gibson --- drivers/net/ethernet/ibm/ibmveth.c | 2 +- 1 file changed, 1 insertion(+),

Re: [PATCH kernel v8 05/31] vfio: powerpc/spapr: Move locked_vm accounting to helpers

2015-04-14 Thread David Gibson
group attached but with the counter incremented. > > While we are here, update the comment explaining why RLIMIT_MEMLOCK > might be required to be bigger than the guest RAM. This also prints > pid of the current process in pr_warn/pr_debug. > > Signed-off-by: Alexey Kardash

Re: [PATCH kernel v8 02/31] vfio: powerpc/spapr: Do cleanup when releasing the group

2015-04-14 Thread David Gibson
y Reviewed-by: David Gibson -- 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 pgpiXVuLdjhE8.pgp Descri

Re: [PATCH kernel v8 01/31] vfio: powerpc/spapr: Move page pinning from arch code to VFIO IOMMU driver

2015-04-14 Thread David Gibson
last part, the rest of the patch is mechanical. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_

Re: [PATCH kernel v8 03/31] vfio: powerpc/spapr: Check that IOMMU page is fully contained by system page

2015-04-14 Thread David Gibson
mory between > the end of the actual page and the end of the aligned up TCE page. > > Since compound_order() and compound_head() work correctly on non-huge > pages, there is no need for additional check whether the page is huge. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by:

Re: [PATCH kernel v8 06/31] vfio: powerpc/spapr: Disable DMA mappings on disabled container

2015-04-15 Thread David Gibson
P that the container is enabled, otherwise > -EPERM is returned. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimal

Re: [PATCH kernel v8 09/31] powerpc/powernv: Do not set "read" flag if direction==DMA_NONE

2015-04-15 Thread David Gibson
: Alexey Kardashevskiy I have no objection to the patch though, so Reviewed-by: David Gibson -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _

Re: [PATCH kernel v8 08/31] vfio: powerpc/spapr: Rework groups attaching

2015-04-15 Thread David Gibson
py/paste I'd call mechanical. Reworking logic in this way, not so much. Say "This should cause no behavioural change" if that's what you mean. > Signed-off-by: Alexey Kardashevskiy Though it's not instantly obvious, it does look as though it makes no behavioural

Re: [PATCH kernel v8 07/31] vfio: powerpc/spapr: Moving pinning/unpinning to helpers

2015-04-15 Thread David Gibson
reak; > } > > - hva = (unsigned long) page_address(page) + > - (tce & IOMMU_PAGE_MASK(tbl) & ~PAGE_MASK); > + /* Preserve offset within IOMMU page */ > + hva |= tce & IOMMU_PAGE_MASK(tbl) &

Re: [PATCH kernel v8 10/31] powerpc/iommu: Move tce_xxx callbacks from ppc_md to iommu_table

2015-04-15 Thread David Gibson
; will not be called on TCE tables, for example - VFIO. That seems a little bit clunky to me, but it's not a big enough objection to delay the patch over, so Reviewed-by: David Gibson > > This does s/tce_build/set/, s/tce_free/clear/ and removes "tce_" > redundand prefixes

Re: [PATCH kernel v8 11/31] powerpc/iommu: Introduce iommu_table_alloc() helper

2015-04-15 Thread David Gibson
(phb, dn, tbl); > tbl->it_ops = &iommu_table_pseries_ops; > PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node); > @@ -1120,8 +1117,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev > *dev) > > pci = PCI_DN(pdn); > if (!pci-&

Re: [PATCH kernel v8 12/31] powerpc/spapr: vfio: Switch from iommu_table to new iommu_table_group

2015-04-15 Thread David Gibson
cmd, arg); > } > > @@ -466,16 +508,15 @@ static int tce_iommu_attach_group(void *iommu_data, > { > int ret; > struct tce_container *container = iommu_data; > - struct iommu_table *tbl = iommu_group_get_iommudata(iommu_group); > + struct iommu

Re: [PATCH kernel v8 13/31] vfio: powerpc/spapr: powerpc/iommu: Rework IOMMU ownership control

2015-04-15 Thread David Gibson
mu_spapr_tce.c > +++ b/drivers/vfio/vfio_iommu_spapr_tce.c > @@ -535,7 +535,7 @@ static int tce_iommu_attach_group(void *iommu_data, > goto unlock_exit; > } > > - ret = iommu_take_ownership(&table_group->tables[0]); > + r

Re: [PATCH kernel v8 15/31] powerpc/iommu: Fix IOMMU ownership control functions

2015-04-15 Thread David Gibson
id iommu_table_release_ownership(struct > iommu_table *tbl) > if (tbl->it_offset == 0) > set_bit(0, tbl->it_map); > > + for (i = 0; i < tbl->nr_pools; i++) > + spin_unlock(&tbl->pools[i].lock); > + spin_unlock_irqrest

Re: [PATCH kernel v8 14/31] vfio: powerpc/spapr: powerpc/powernv/ioda2: Rework IOMMU ownership control

2015-04-15 Thread David Gibson
->grp = iommu_group; > > unlock_exit: > mutex_unlock(&container->lock); > @@ -572,7 +585,11 @@ static void tce_iommu_detach_group(void *iommu_data, > table_group = iommu_group_get_iommudata(iommu_group); > BUG_ON(!table_group); > > - iommu_release_

Re: [PATCH kernel v8 16/31] powerpc/powernv/ioda/ioda2: Rework tce_build()/tce_free()

2015-04-15 Thread David Gibson
ize, > u64 dma_offset, unsigned page_shift) > @@ -685,7 +663,7 @@ static struct iommu_table *pnv_pci_setup_bml_iommu(struct > pci_controller *hose) > return NULL; > pnv_pci_setup_iommu_table(tbl, __va(be64_to_cpup(bas

Re: [PATCH kernel v8 18/31] powerpc/powernv/ioda2: Rework iommu_table creation

2015-04-15 Thread David Gibson
> - iommu_init_table(tbl, phb->hose->node); > -#ifdef CONFIG_IOMMU_API > - pe->table_group.ops = &pnv_pci_ioda2_ops; > -#endif > iommu_register_group(&pe->table_group, phb->hose->global_number, > pe->pe_number); > > if

Re: [PATCH kernel v8 17/31] powerpc/iommu/powernv: Release replaced TCE

2015-04-15 Thread David Gibson
; > @@ -418,24 +425,33 @@ static long tce_iommu_ioctl(void *iommu_data, > if (!tbl) > return -ENXIO; > > - if ((param.size & ~IOMMU_PAGE_MASK(tbl)) || > - (param.vaddr & ~IOMMU_PAGE_MASK(tbl))) > +

Re: [PATCH kernel v8 19/31] powerpc/powernv/ioda2: Introduce pnv_pci_ioda2_create_table/pnc_pci_free_table

2015-04-15 Thread David Gibson
y mechanical patch. ??? > Signed-off-by: Alexey Kardashevskiy But apart from that dubious comment in the commit message, Reviewed-by: David Gibson -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, tha

Re: [PATCH kernel v8 21/31] powerpc/iommu: Split iommu_free_table into 2 helpers

2015-04-15 Thread David Gibson
table contains no entries */ > - if (!bitmap_empty(tbl->it_map, tbl->it_size)) > - pr_warn("%s: Unexpected TCEs for %s\n", __func__, node_name); > - > - /* calculate bitmap size in bytes */ > - bitmap_sz = BITS_TO_LONGS(

Re: [PATCH kernel v8 20/31] powerpc/powernv/ioda2: Introduce pnv_pci_ioda2_set_window

2015-04-15 Thread David Gibson
On Fri, Apr 10, 2015 at 04:31:02PM +1000, Alexey Kardashevskiy wrote: > This is a part of moving DMA window programming to an iommu_ops > callback. > > This is a mechanical patch. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson -- David Gibson

Re: [PATCH kernel v8 21/31] powerpc/iommu: Split iommu_free_table into 2 helpers

2015-04-19 Thread David Gibson
On Fri, Apr 17, 2015 at 02:29:23AM +1000, Alexey Kardashevskiy wrote: > On 04/16/2015 04:46 PM, David Gibson wrote: > >On Fri, Apr 10, 2015 at 04:31:03PM +1000, Alexey Kardashevskiy wrote: > >>The iommu_free_table helper release memory it is using (the TCE table and > >&

Re: [PATCH kernel v8 12/31] powerpc/spapr: vfio: Switch from iommu_table to new iommu_table_group

2015-04-19 Thread David Gibson
On Fri, Apr 17, 2015 at 01:48:13AM +1000, Alexey Kardashevskiy wrote: > On 04/16/2015 03:55 PM, David Gibson wrote: > >On Fri, Apr 10, 2015 at 04:30:54PM +1000, Alexey Kardashevskiy wrote: > >>Modern IBM POWERPC systems support multiple (currently two) TCE tables > >>

Re: [PATCH kernel v8 12/31] powerpc/spapr: vfio: Switch from iommu_table to new iommu_table_group

2015-04-19 Thread David Gibson
On Fri, Apr 17, 2015 at 07:46:23PM +1000, Alexey Kardashevskiy wrote: > On 04/16/2015 03:55 PM, David Gibson wrote: > >On Fri, Apr 10, 2015 at 04:30:54PM +1000, Alexey Kardashevskiy wrote: > >>Modern IBM POWERPC systems support multiple (currently two) TCE tables > >>

Re: [PATCH kernel v8 15/31] powerpc/iommu: Fix IOMMU ownership control functions

2015-04-19 Thread David Gibson
On Fri, Apr 17, 2015 at 08:16:13PM +1000, Alexey Kardashevskiy wrote: > On 04/16/2015 04:10 PM, David Gibson wrote: > >On Fri, Apr 10, 2015 at 04:30:57PM +1000, Alexey Kardashevskiy wrote: > >>This adds missing locks in iommu_take_ownership()/ > >>iommu_release_ownership

Re: [PATCH kernel v8 14/31] vfio: powerpc/spapr: powerpc/powernv/ioda2: Rework IOMMU ownership control

2015-04-19 Thread David Gibson
On Fri, Apr 17, 2015 at 08:09:29PM +1000, Alexey Kardashevskiy wrote: > On 04/16/2015 04:07 PM, David Gibson wrote: > >On Fri, Apr 10, 2015 at 04:30:56PM +1000, Alexey Kardashevskiy wrote: > >>At the moment the iommu_table struct has a set_bypass() which enables/ > >>d

Re: [PATCH kernel v8 17/31] powerpc/iommu/powernv: Release replaced TCE

2015-04-19 Thread David Gibson
On Fri, Apr 17, 2015 at 08:37:54PM +1000, Alexey Kardashevskiy wrote: > On 04/16/2015 04:26 PM, David Gibson wrote: > >On Fri, Apr 10, 2015 at 04:30:59PM +1000, Alexey Kardashevskiy wrote: > >>At the moment writing new TCE value to the IOMMU table fails with EBUSY > >&g

[PATCHv2] ibmveth: Fix off-by-one error in ibmveth_change_mtu()

2015-04-20 Thread David Gibson
an <= in ibmveth_change_mtu(), which only permits an MTU which is strictly smaller than the buffer size, rather than allowing the buffer to be completely filled. This patch fixes the buglet. Signed-off-by: David Gibson 1 --- drivers/net/ethernet/ibm/ibmveth.c | 4 ++-- 1 file changed, 2 inser

Re: [PATCH kernel v8 15/31] powerpc/iommu: Fix IOMMU ownership control functions

2015-04-21 Thread David Gibson
On Mon, Apr 20, 2015 at 04:34:24PM +1000, Alexey Kardashevskiy wrote: > On 04/20/2015 12:46 PM, David Gibson wrote: > >On Fri, Apr 17, 2015 at 08:16:13PM +1000, Alexey Kardashevskiy wrote: > >>On 04/16/2015 04:10 PM, David Gibson wrote: > >>>On Fri, Apr 10, 20

Re: [PATCH kernel v8 14/31] vfio: powerpc/spapr: powerpc/powernv/ioda2: Rework IOMMU ownership control

2015-04-21 Thread David Gibson
On Mon, Apr 20, 2015 at 04:55:32PM +1000, Alexey Kardashevskiy wrote: > On 04/20/2015 12:44 PM, David Gibson wrote: > >On Fri, Apr 17, 2015 at 08:09:29PM +1000, Alexey Kardashevskiy wrote: > >>On 04/16/2015 04:07 PM, David Gibson wrote: > >>>On Fri, Apr 10, 20

Re: [PATCH kernel v8 14/31] vfio: powerpc/spapr: powerpc/powernv/ioda2: Rework IOMMU ownership control

2015-04-21 Thread David Gibson
On Tue, Apr 21, 2015 at 09:47:54PM +1000, Alexey Kardashevskiy wrote: > On 04/21/2015 07:43 PM, David Gibson wrote: > >On Mon, Apr 20, 2015 at 04:55:32PM +1000, Alexey Kardashevskiy wrote: > >>On 04/20/2015 12:44 PM, David Gibson wrote: > >>>On Fri, Apr 17, 20

[PATCHv2] ibmveth: Fix off-by-one error in ibmveth_change_mtu()

2015-04-22 Thread David Gibson
an <= in ibmveth_change_mtu(), which only permits an MTU which is strictly smaller than the buffer size, rather than allowing the buffer to be completely filled. This patch fixes the buglet. Signed-off-by: David Gibson Acked-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmveth.c | 4 ++-- 1 file

Re: [PATCH kernel v9 01/32] powerpc/iommu: Split iommu_free_table into 2 helpers

2015-04-28 Thread David Gibson
t; > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson -- 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

Re: [PATCH kernel v9 08/32] vfio: powerpc/spapr: Moving pinning/unpinning to helpers

2015-04-28 Thread David Gibson
chg() callback for an IOMMU table which will accept/return > physical addresses (unlike current tce_build()) which will eliminate > redundant conversions. > > Signed-off-by: Alexey Kardashevskiy > [aw: for the vfio related changes] > Acked-by: Alex Williamson Reviewed-by: Da

Re: [PATCH kernel v9 14/32] powerpc/iommu: Fix IOMMU ownership control functions

2015-04-28 Thread David Gibson
ng the it_map to the state it was in when we called > iommu_take_ownership(). Ah! I finally understand what all this bit#0 stuff is about. Thanks for the explanation. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson With one small comment.. > --- > Change

Re: [PATCH kernel v9 16/32] powerpc/powernv/ioda: Move TCE kill register address to PE

2015-04-28 Thread David Gibson
* bus number, print that out instead. > - */ > - pe->tce_inval_reg_phys = be64_to_cpup(swinvp); > - tbl->it_index = (unsigned long)ioremap(pe->tce_inval_reg_phys, > - 8); > + if (pe->tce_in

Re: [PATCH kernel v9 12/32] powerpc/spapr: vfio: Switch from iommu_table to new iommu_table_group

2015-04-28 Thread David Gibson
27;m not particularly fond of the "table_group" name, but I can't really think of a better name for now. So, Reviewed-by: David Gibson -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank

Re: [PATCH kernel v9 15/32] powerpc/powernv/ioda/ioda2: Rework TCE invalidation in tce_build()/tce_free()

2015-04-28 Thread David Gibson
gt;it_page_shift)); > > - /* Some implementations won't cache invalid TCEs and thus may not > - * need that flush. We'll probably turn it_type into a bit mask > - * of flags if that becomes the case > - */ > - if (tbl->it_type & TCE_PCI_SWINV_C

Re: [PATCH kernel v9 02/32] Revert "powerpc/powernv: Allocate struct pnv_ioda_pe iommu_table dynamically"

2015-04-28 Thread David Gibson
ned-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson -- 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/~dgib

Re: [PATCH kernel v9 09/32] vfio: powerpc/spapr: Rework groups attaching

2015-04-28 Thread David Gibson
p from an enabled container would fail with EBUSY, now it forces a disable. > > Signed-off-by: Alexey Kardashevskiy > [aw: for the vfio related changes] > Acked-by: Alex Williamson > Reviewed-by: David Gibson > --- > drivers/vfio/vfio_iommu_spapr_tce.c | 40 > ++

Re: [PATCH kernel v9 13/32] vfio: powerpc/spapr/iommu/powernv/ioda2: Rework IOMMU ownership control

2015-04-28 Thread David Gibson
via the bypass window instead of just > + * the pages that has been explicitly mapped into the iommu > + */ > + table_group->ops->take_ownership(table_group); > + ret = 0; > + } > + > + if (ret) > + g

Re: [PATCH kernel v9 23/32] powerpc/powernv/ioda: Define and implement DMA table/window management callbacks

2015-04-28 Thread David Gibson
__init pnv_pci_init_p5ioc2_phb(struct > device_node *np, u64 hub_id, > u64 phb_id; > int64_t rc; > static int primary = 1; > + struct iommu_table_group *table_group; > + struct iommu_table *tbl; > > pr_info(" Initializing p5ioc2 PHB %s\n&

Re: [PATCH kernel v9 17/32] powerpc/powernv: Implement accessor to TCE entry

2015-04-28 Thread David Gibson
ior is expected. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson > --- > Changes: > v9: > * new patch in the series to separate this mechanical change from > functional changes; this is not right before > "powerpc/powernv: Implement multilevel TCE

Re: [PATCH kernel v9 19/32] powerpc/powernv/ioda2: Rework iommu_table creation

2015-04-28 Thread David Gibson
; > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson -- 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

Re: [PATCH kernel v9 22/32] powerpc/powernv: Implement multilevel TCE tables

2015-04-28 Thread David Gibson
f (!tbl->it_size) > return; > > - free_pages(tbl->it_base, get_order(tbl->it_size << 3)); > + pnv_free_tce_table_pages(tbl->it_base, size, tbl->it_indirect_levels); > iommu_reset_table(tbl, "pnv"); > } > > diff --git a/arch/pow

Re: [PATCH kernel v9 21/32] powerpc/powernv/ioda2: Introduce pnv_pci_ioda2_set_window

2015-04-28 Thread David Gibson
> is never recreated after reboot but it will in the following patches. > > This should cause no behavioural change. > > Signed-off-by: Alexey Kardashevskiy > Reviewed-by: David Gibson Really? I don't remember this one. > --- > Changes: > v9: > * ini

Re: [PATCH kernel v9 25/32] vfio: powerpc/spapr: powerpc/powernv/ioda2: Rework ownership

2015-04-28 Thread David Gibson
ops->release_ownership) > tce_iommu_release_ownership(container, table_group); > - else > + else if (!table_group->ops->unset_window) > + WARN_ON_ONCE(1); > + else { > + for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) { > +

Re: [PATCH kernel v9 20/32] powerpc/powernv/ioda2: Introduce pnv_pci_create_table/pnv_pci_free_table

2015-04-28 Thread David Gibson
; helpers as it does not do anything IODA2-specific. > > This adds pnv_pci_free_table() helper to release the actual TCE table. > > This enforces window size to be a power of two. > > This should cause no behavioural change. > > Signed-off-by: Alexey Kardashevskiy >

Re: [PATCH kernel v9 18/32] powerpc/iommu/powernv: Release replaced TCE

2015-04-28 Thread David Gibson
PAGE_MASK(tbl)) > + return -EINVAL; > + > + if (param.vaddr & (TCE_PCI_READ | TCE_PCI_WRITE)) > return -EINVAL; This doesn't look right - the existing check against PAGE_MASK is still correct and included the check for the permission bits as

Re: [PATCH kernel v9 27/32] powerpc/iommu/ioda2: Add get_table_size() to calculate the size of future table

2015-04-29 Thread David Gibson
arch/powerpc/platforms/powernv/pci.h > b/arch/powerpc/platforms/powernv/pci.h > index 3d1ff584..ce4bc3c 100644 > --- a/arch/powerpc/platforms/powernv/pci.h > +++ b/arch/powerpc/platforms/powernv/pci.h > @@ -224,6 +224,8 @@ extern long pnv_pci_create_table(struct iommu_table_gro

Re: [PATCH kernel v9 28/32] powerpc/mmu: Add userspace-to-physical addresses translation cache

2015-04-29 Thread David Gibson
break; > + } > + } > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(mm_iommu_lookup); > + > +long mm_iommu_ua_to_hpa(struct mm_iommu_table_group_mem_t *mem, > + unsigned long ua, unsigned long *hpa) Return type should be int, it's just an

Re: [PATCH kernel v9 26/32] powerpc/iommu: Add userspace view of TCE table

2015-04-29 Thread David Gibson
> __u64 bus_offset = num ? pe->tce_bypass_base : 0; > long ret; > + unsigned long *uas, uas_cb = sizeof(*uas) * (window_size >> page_shift); > + > + uas = vzalloc(uas_cb); > + if (!uas) > + return -ENOMEM; I don't see why this is allocated

Re: [PATCH kernel v9 17/32] powerpc/powernv: Implement accessor to TCE entry

2015-04-29 Thread David Gibson
On Wed, Apr 29, 2015 at 07:02:17PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 02:04 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:41PM +1000, Alexey Kardashevskiy wrote: > >>This replaces direct accesses to TCE table with a helper which > >>returns

Re: [PATCH kernel v9 23/32] powerpc/powernv/ioda: Define and implement DMA table/window management callbacks

2015-04-29 Thread David Gibson
On Wed, Apr 29, 2015 at 07:44:20PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 03:30 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:47PM +1000, Alexey Kardashevskiy wrote: > >>This extends iommu_table_group_ops by a set of callbacks to support > >>dyn

Re: [PATCH kernel v9 09/32] vfio: powerpc/spapr: Rework groups attaching

2015-04-29 Thread David Gibson
On Thu, Apr 30, 2015 at 12:29:30PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 12:16 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:33PM +1000, Alexey Kardashevskiy wrote: > >>This is to make extended ownership and multiple groups support patches >

Re: [PATCH kernel v9 16/32] powerpc/powernv/ioda: Move TCE kill register address to PE

2015-04-29 Thread David Gibson
On Wed, Apr 29, 2015 at 07:00:30PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 01:25 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:40PM +1000, Alexey Kardashevskiy wrote: > >>At the moment the DMA setup code looks for the "ibm,opal-tce-kill" propert

Re: [PATCH kernel v9 15/32] powerpc/powernv/ioda/ioda2: Rework TCE invalidation in tce_build()/tce_free()

2015-04-29 Thread David Gibson
On Thu, Apr 30, 2015 at 12:58:12PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 01:18 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:39PM +1000, Alexey Kardashevskiy wrote: > >>The pnv_pci_ioda_tce_invalidate() helper invalidates TCE cache. It is > >>sup

Re: [PATCH kernel v9 20/32] powerpc/powernv/ioda2: Introduce pnv_pci_create_table/pnv_pci_free_table

2015-04-29 Thread David Gibson
On Wed, Apr 29, 2015 at 07:12:37PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 02:39 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:44PM +1000, Alexey Kardashevskiy wrote: > >>This is a part of moving TCE table allocation into an iommu_ops > >>callbac

Re: [PATCH kernel v9 13/32] vfio: powerpc/spapr/iommu/powernv/ioda2: Rework IOMMU ownership control

2015-04-29 Thread David Gibson
On Wed, Apr 29, 2015 at 07:19:51PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 01:02 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:37PM +1000, Alexey Kardashevskiy wrote: > >>This adds tce_iommu_take_ownership() and tce_iommu_release_ownership > &

Re: [PATCH kernel v9 18/32] powerpc/iommu/powernv: Release replaced TCE

2015-04-29 Thread David Gibson
On Wed, Apr 29, 2015 at 07:51:21PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 02:18 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:42PM +1000, Alexey Kardashevskiy wrote: > >>At the moment writing new TCE value to the IOMMU table fails with EBUSY > >&g

Re: [PATCH kernel v9 21/32] powerpc/powernv/ioda2: Introduce pnv_pci_ioda2_set_window

2015-04-29 Thread David Gibson
On Wed, Apr 29, 2015 at 07:26:28PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 02:45 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:45PM +1000, Alexey Kardashevskiy wrote: > >>This is a part of moving DMA window programming to an iommu_ops > >>callbac

Re: [PATCH kernel v9 28/32] powerpc/mmu: Add userspace-to-physical addresses translation cache

2015-04-30 Thread David Gibson
ock or unlock, but I don't see what the point of actualy storing the translations in hpas is. I had assumed it was so that you could later on get to the translations in real mode when you do in-kernel acceleration. But that doesn't make sense, because the array is vmalloc()ed, so can&#

Re: [PATCH kernel v9 29/32] vfio: powerpc/spapr: Register memory and define IOMMU v2

2015-04-30 Thread David Gibson
> index b57b750..8fdcfb9 100644 > --- a/include/uapi/linux/vfio.h > +++ b/include/uapi/linux/vfio.h > @@ -36,6 +36,8 @@ > /* Two-stage IOMMU */ > #define VFIO_TYPE1_NESTING_IOMMU 6 /* Implies v2 */ > > +#define VFIO_SPAPR_TCE_v2_IOMMU 7 > + > /* > * The IOCTL interface is designed for

Re: [PATCH kernel v9 30/32] vfio: powerpc/spapr: Use 32bit DMA window properties from table_group

2015-04-30 Thread David Gibson
r to review if you took this and the parts of the earlier patch which add the tce32_* fields to table_group and roll them up on their own. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank

Re: [PATCH kernel v9 31/32] vfio: powerpc/spapr: Support multiple groups in one container if possible

2015-04-30 Thread David Gibson
iommu_group_id(iommu_group), > - iommu_group_id(container->grp)); > + > + list_for_each_entry(tcegrp, &container->group_list, next) { > + if (tcegrp->grp == iommu_group) { > + found = true; > + break; > +

Re: [PATCH kernel v9 23/32] powerpc/powernv/ioda: Define and implement DMA table/window management callbacks

2015-04-30 Thread David Gibson
On Thu, Apr 30, 2015 at 07:56:17PM +1000, Alexey Kardashevskiy wrote: > On 04/30/2015 02:37 PM, David Gibson wrote: > >On Wed, Apr 29, 2015 at 07:44:20PM +1000, Alexey Kardashevskiy wrote: > >>On 04/29/2015 03:30 PM, David Gibson wrote: > >>>On Sat, Apr 25, 20

Re: [PATCH kernel v9 28/32] powerpc/mmu: Add userspace-to-physical addresses translation cache

2015-04-30 Thread David Gibson
On Thu, Apr 30, 2015 at 06:25:25PM +1000, Paul Mackerras wrote: > On Thu, Apr 30, 2015 at 04:34:55PM +1000, David Gibson wrote: > > On Sat, Apr 25, 2015 at 10:14:52PM +1000, Alexey Kardashevskiy wrote: > > > We are adding support for DMA memory pre-registration to be used in >

Re: [PATCH kernel v9 31/32] vfio: powerpc/spapr: Support multiple groups in one container if possible

2015-04-30 Thread David Gibson
On Fri, May 01, 2015 at 10:46:08AM +1000, Benjamin Herrenschmidt wrote: > On Thu, 2015-04-30 at 19:33 +1000, Alexey Kardashevskiy wrote: > > On 04/30/2015 05:22 PM, David Gibson wrote: > > > On Sat, Apr 25, 2015 at 10:14:55PM +1000, Alexey Kardashevskiy wrote: > > >>

Re: [PATCH kernel v9 26/32] powerpc/iommu: Add userspace view of TCE table

2015-04-30 Thread David Gibson
On Fri, May 01, 2015 at 02:01:17PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 04:31 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:50PM +1000, Alexey Kardashevskiy wrote: > >>In order to support memory pre-registration, we need a way to track > >>

Re: [PATCH kernel v9 31/32] vfio: powerpc/spapr: Support multiple groups in one container if possible

2015-04-30 Thread David Gibson
On Thu, Apr 30, 2015 at 07:33:09PM +1000, Alexey Kardashevskiy wrote: > On 04/30/2015 05:22 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:55PM +1000, Alexey Kardashevskiy wrote: > >>At the moment only one group per container is supported. > >>POWER8 CPUs ha

Re: [PATCH kernel v9 27/32] powerpc/iommu/ioda2: Add get_table_size() to calculate the size of future table

2015-04-30 Thread David Gibson
On Fri, May 01, 2015 at 02:10:58PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 04:40 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:51PM +1000, Alexey Kardashevskiy wrote: > >>This adds a way for the IOMMU user to know how much a new table will > >>us

Re: [PATCH kernel v9 29/32] vfio: powerpc/spapr: Register memory and define IOMMU v2

2015-04-30 Thread David Gibson
On Fri, May 01, 2015 at 02:35:23PM +1000, Alexey Kardashevskiy wrote: > On 04/30/2015 04:55 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:53PM +1000, Alexey Kardashevskiy wrote: > >>The existing implementation accounts the whole DMA window in > >>the locked_v

Re: [PATCH kernel v9 31/32] vfio: powerpc/spapr: Support multiple groups in one container if possible

2015-05-05 Thread David Gibson
On Fri, May 01, 2015 at 04:05:24PM +1000, Alexey Kardashevskiy wrote: > On 05/01/2015 02:33 PM, David Gibson wrote: > >On Thu, Apr 30, 2015 at 07:33:09PM +1000, Alexey Kardashevskiy wrote: > >>On 04/30/2015 05:22 PM, David Gibson wrote: > >>>On Sat, Apr 25, 20

Re: [PATCH kernel v9 27/32] powerpc/iommu/ioda2: Add get_table_size() to calculate the size of future table

2015-05-05 Thread David Gibson
On Fri, May 01, 2015 at 04:53:08PM +1000, Alexey Kardashevskiy wrote: > On 05/01/2015 03:12 PM, David Gibson wrote: > >On Fri, May 01, 2015 at 02:10:58PM +1000, Alexey Kardashevskiy wrote: > >>On 04/29/2015 04:40 PM, David Gibson wrote: > >>>On Sat, Apr 25, 20

Re: [PATCH kernel v9 29/32] vfio: powerpc/spapr: Register memory and define IOMMU v2

2015-05-05 Thread David Gibson
On Fri, May 01, 2015 at 04:27:47PM +1000, Alexey Kardashevskiy wrote: > On 05/01/2015 03:23 PM, David Gibson wrote: > >On Fri, May 01, 2015 at 02:35:23PM +1000, Alexey Kardashevskiy wrote: > >>On 04/30/2015 04:55 PM, David Gibson wrote: > >>>On Sat, Apr 25, 20

Re: [PATCH kernel v9 26/32] powerpc/iommu: Add userspace view of TCE table

2015-05-05 Thread David Gibson
On Fri, May 01, 2015 at 05:12:45PM +1000, Alexey Kardashevskiy wrote: > On 05/01/2015 02:23 PM, David Gibson wrote: > >On Fri, May 01, 2015 at 02:01:17PM +1000, Alexey Kardashevskiy wrote: > >>On 04/29/2015 04:31 PM, David Gibson wrote: > >>>On Sat, Apr 25, 20

Re: [PATCH kernel v9 22/32] powerpc/powernv: Implement multilevel TCE tables

2015-05-05 Thread David Gibson
On Fri, May 01, 2015 at 07:48:49PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 03:04 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:46PM +1000, Alexey Kardashevskiy wrote: > >>TCE tables might get too big in case of 4K IOMMU pages and DDW enabled > >>on

Re: [PATCH kernel v9 28/32] powerpc/mmu: Add userspace-to-physical addresses translation cache

2015-05-05 Thread David Gibson
On Fri, May 01, 2015 at 09:26:48PM +1000, Alexey Kardashevskiy wrote: > On 04/29/2015 05:01 PM, David Gibson wrote: > >On Sat, Apr 25, 2015 at 10:14:52PM +1000, Alexey Kardashevskiy wrote: > >>We are adding support for DMA memory pre-registration to be used in > >>conj

Re: [RFC PATCH] powerpc/mm: Return NULL for not present hugetlb page

2015-05-07 Thread David Gibson
age = NULL; > + goto no_page; > } > mask = (1UL << shift) - 1; > - page = pte_page(*ptep); > + page = pte_page(pte); > if (page) > page += (address & mask) / PAGE_SIZE; > > +no_page: > local_i

Re: [PATCH kernel v11 01/34] powerpc/eeh/ioda2: Use device::iommu_group to check IOMMU group

2015-05-31 Thread David Gibson
ot rely on the table presence here, remove the workaround > from pnv_pci_ioda2_set_bypass(); also remove the @add_to_iommu_group > parameter from pnv_ioda_setup_bus_dma(). > > Signed-off-by: Alexey Kardashevskiy > Acked-by: Gavin Shan Reviewed-by: David Gibson -- David Gibson

Re: [PATCH kernel v11 02/34] powerpc/iommu/powernv: Get rid of set_iommu_table_base_and_group

2015-05-31 Thread David Gibson
l PE, the sysfs entries are not ready to create all symlinks > so actual adding is happening in tce_iommu_bus_notifier. > > Signed-off-by: Alexey Kardashevskiy > Reviewed-by: Gavin Shan Reviewed-by: David Gibson -- David Gibson| I'll have my music baroque

Re: [PATCH kernel v11 04/34] powerpc/iommu: Put IOMMU group explicitly

2015-05-31 Thread David Gibson
> Signed-off-by: Alexey Kardashevskiy > Reviewed-by: Gavin Shan Reviewed-by: David Gibson -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_

Re: [PATCH kernel v11 03/34] powerpc/powernv/ioda: Clean up IOMMU group registration

2015-05-31 Thread David Gibson
e sense when we add TCE table sharing. > > Signed-off-by: Alexey Kardashevskiy > Reviewed-by: Gavin Shan Reviewed-by: David Gibson -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist,

Re: [PATCH kernel v11 05/34] powerpc/iommu: Always release iommu_table in iommu_free_table()

2015-05-31 Thread David Gibson
mic DMA windows, we will need to be able to release > iommu_table even if it was used for VFIO in which case it_map is NULL > so does the patch. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson -- David Gibson| I'll have my mus

Re: [PATCH kernel v11 09/34] vfio: powerpc/spapr: Move locked_vm accounting to helpers

2015-05-31 Thread David Gibson
skiy > [aw: for the vfio related changes] > Acked-by: Alex Williamson > Reviewed-by: David Gibson > Reviewed-by: Gavin Shan > --- > Changes: > v4: > * new helpers do nothing if @npages == 0 > * tce_iommu_disable() now can decrement the counter if the group w

Re: [PATCH kernel v11 16/34] powerpc/spapr: vfio: Replace iommu_table with iommu_table_group

2015-05-31 Thread David Gibson
pci_ioda_setup_dma_pe and > pnv_pci_ioda2_setup_dma_pe as this is where DMA is actually initialized. > This change is here because those lines had to be changed anyway. > > This should cause no behavioural change. > > Signed-off-by: Alexey Kardashevskiy > [aw: for the vfio related c

Re: [PATCH kernel v11 18/34] vfio: powerpc/spapr/iommu/powernv/ioda2: Rework IOMMU ownership control

2015-05-31 Thread David Gibson
es not do much > more compared to pnv_pci_ioda2_set_bypass. This moves tce_bypass_base > initialization to pnv_pci_ioda2_setup_dma_pe. > > Signed-off-by: Alexey Kardashevskiy > [aw: for the vfio related changes] > Acked-by: Alex Williamson > Reviewed-by: Gavin Shan Reviewe

Re: [PATCH kernel v11 17/34] powerpc/spapr: vfio: Switch from iommu_table to new iommu_table_group

2015-05-31 Thread David Gibson
ehavioural change. > > Signed-off-by: Alexey Kardashevskiy > [aw: for the vfio related changes] > Acked-by: Alex Williamson > Reviewed-by: David Gibson > Reviewed-by: Gavin Shan It looks like this commit message doesn't match the code - it seems like an older or newer ve

Re: [PATCH kernel v11 20/34] powerpc/powernv/ioda2: Move TCE kill register address to PE

2015-05-31 Thread David Gibson
a single TCE table and 64bit DMA was handled via > bypass window (which has no table so no cache was used) but this is going > to change with Dynamic DMA windows (DDW). > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson -- David Gibson| I'll have

Re: [PATCH kernel v11 21/34] powerpc/powernv/ioda2: Add TCE invalidation for all attached groups

2015-05-31 Thread David Gibson
ach PE needs to be invalidated so does the patch. > > This does not change pnv_pci_ioda1_tce_invalidate() as there is no plan > to enable TCE table sharing on PHBs older than IODA2. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson -- David Gibson

Re: [PATCH kernel v11 23/34] powerpc/iommu/powernv: Release replaced TCE

2015-06-01 Thread David Gibson
o the IOMMU code to make it work for both > VFIO ioctl interface in in-kernel TCE acceleration (when it becomes > available later). > > Signed-off-by: Alexey Kardashevskiy > [aw: for the vfio related changes] > Acked-by: Alex Williamson Reviewed-by: David Gibson -- David

Re: [PATCH kernel v11 25/34] powerpc/powernv/ioda2: Introduce helpers to allocate TCE pages

2015-06-01 Thread David Gibson
wed-by: Gavin Shan Reviewed-by: David Gibson -- 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

Re: [PATCH kernel v11 26/34] powerpc/powernv/ioda2: Introduce pnv_pci_ioda2_set_window

2015-06-01 Thread David Gibson
ot but it will in the following patches. > > This should cause no behavioural change. > > Signed-off-by: Alexey Kardashevskiy > Reviewed-by: David Gibson > Reviewed-by: Gavin Shan > --- > Changes: > v11: > * replaced some 1< > v9: > * initialize pe-&g

Re: [PATCH kernel v11 27/34] powerpc/powernv: Implement multilevel TCE tables

2015-06-01 Thread David Gibson
, IOMMU_PAGE_SHIFT_4K, phb->ioda.m32_pci_base, > + POWERNV_IOMMU_DEFAULT_LEVELS, tbl); > if (rc) { > pe_err(pe, "Failed to create 32-bit TCE table, err %ld", rc); > goto fail; > diff --git a/arch/powerpc/platforms/powe

Re: [PATCH kernel v11 28/34] vfio: powerpc/spapr: powerpc/powernv/ioda: Define and implement DMA windows API

2015-06-01 Thread David Gibson
This makes use of new values in > vfio_iommu_spapr_tce. IODA1/P5IOC2 do not support DDW so they do not > advertise pagemasks to the userspace. > > Signed-off-by: Alexey Kardashevskiy > Acked-by: Alex Williamson Reviewed-by: David Gibson -- David Gibson| I&#x

Re: [PATCH kernel v11 29/34] powerpc/powernv/ioda2: Use new helpers to do proper cleanup on PE release

2015-06-01 Thread David Gibson
lease and > TVT update. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_

Re: [PATCH kernel v11 30/34] powerpc/iommu/ioda2: Add get_table_size() to calculate the size of future table

2015-06-01 Thread David Gibson
_get_table_size() > so the locked_vm counter can be updated correctly when a table is > being disposed. > > This defines an iommu_table_group_ops callback to let VFIO know > how much memory will be locked if a table is created. > > Signed-off-by: Alexey Kardashevskiy Reviewed

Re: [PATCH kernel v11 31/34] vfio: powerpc/spapr: powerpc/powernv/ioda2: Use DMA windows API in ownership control

2015-06-01 Thread David Gibson
and when the ownership is > passed from VFIO to the platform code. > > Signed-off-by: Alexey Kardashevskiy > [aw: for the vfio related changes] > Acked-by: Alex Williamson Reviewed-by: David Gibson -- David Gibson| I'll have

Re: [PATCH kernel v11 32/34] powerpc/mmu: Add userspace-to-physical addresses translation cache

2015-06-01 Thread David Gibson
sed remains 1. > > Host physical addresses are stored in vmalloc'ed array. In order to > access these in the real mode (mmu off), there is a real_vmalloc_addr() > helper. In-kernel acceleration patchset will move it from KVM to MMU code. > > Signed-off-by: Alexey Kar

Re: [PATCH kernel v11 33/34] vfio: powerpc/spapr: Register memory and define IOMMU v2

2015-06-01 Thread David Gibson
tatic int tce_iommu_attach_group(void *iommu_data, > else > ret = tce_iommu_take_ownership_ddw(container, table_group); > > - if (!ret) > - container->grp = iommu_group; > + if (!ret) { > + tcegrp->grp = iommu_group; > + list_add

  1   2   3   4   5   6   7   8   9   10   >