[git pull] Please pull powerpc.git merge branch

2014-07-22 Thread Benjamin Herrenschmidt
Hi Linus ! Here is a handful of powerpc fixes for 3.16. They are all pretty simple and self contained and should still make this release. Cheers, Ben. The following changes since commit f56029410a13cae3652d1f34788045c40a13ffc7: powerpc/perf: Never program book3s PMCs with values >= 0x8000

Re: [PATCH v2 06/18] powerpc/powernv: Use it_page_shift in TCE build

2014-07-22 Thread Alexey Kardashevskiy
On 07/23/2014 02:00 PM, Gavin Shan wrote: > On Wed, Jul 23, 2014 at 01:05:52PM +1000, Alexey Kardashevskiy wrote: >> This makes use of iommu_table::it_page_shift instead of TCE_SHIFT and >> TCE_RPN_SHIFT hardcoded values. >> >> Signed-off-by: Alexey Kardashevskiy > > Reviewed-by: Gavin Shan > >

Re: [PATCH v2 06/18] powerpc/powernv: Use it_page_shift in TCE build

2014-07-22 Thread Gavin Shan
On Wed, Jul 23, 2014 at 01:05:52PM +1000, Alexey Kardashevskiy wrote: >This makes use of iommu_table::it_page_shift instead of TCE_SHIFT and >TCE_RPN_SHIFT hardcoded values. > >Signed-off-by: Alexey Kardashevskiy Reviewed-by: Gavin Shan >--- > arch/powerpc/platforms/powernv/pci.c | 5 +++-- > 1

Re: [PATCH v2 03/18] KVM: PPC: Account TCE pages in locked_vm

2014-07-22 Thread Gavin Shan
On Wed, Jul 23, 2014 at 01:05:49PM +1000, Alexey Kardashevskiy wrote: >Signed-off-by: Alexey Kardashevskiy >--- > arch/powerpc/kvm/book3s_64_vio.c | 35 ++- > 1 file changed, 34 insertions(+), 1 deletion(-) > >diff --git a/arch/powerpc/kvm/book3s_64_vio.c >b/arch/po

[PATCH v2 11/18] powerpc/iommu: Fix IOMMU ownership control functions

2014-07-22 Thread Alexey Kardashevskiy
This adds missing locks in iommu_take_ownership()/ iommu_release_ownership(). This marks all pages busy in iommu_table::it_map in order to catch errors if there is an attempt to use this table while ownership over it is taken. This only clears TCE content if there is no page marked busy in it_map

[PATCH v2 01/18] powerpc/iommu: Fix comments with it_page_shift

2014-07-22 Thread Alexey Kardashevskiy
There is a couple of commented debug prints which still use IOMMU_PAGE_SHIFT() which is not defined for POWERPC anymore, replace them with it_page_shift. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ar

[PATCH v2 05/18] powerpc/powernv: Use it_page_shift for TCE invalidation

2014-07-22 Thread Alexey Kardashevskiy
This fixes IODA1/2 to use it_page_shift as it may be bigger than 4K. This changes the involved constant values to use "ull" modifier. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --

[PATCH v2 15/18] powerpc/iommu: Implement put_page() if TCE had non-zero value

2014-07-22 Thread Alexey Kardashevskiy
Guests might put new TCEs without clearing them first and the PAPR spec allows that. This adds put_page() for TCEs which we just replaced. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powe

[PATCH v2 17/18] vfio: Use it_page_size

2014-07-22 Thread Alexey Kardashevskiy
This makes use of the it_page_size from the iommu_table struct as page size can differ. This replaces missing IOMMU_PAGE_SHIFT macro in commented debug code as recently introduced IOMMU_PAGE_XXX macros do not include IOMMU_PAGE_SHIFT. Signed-off-by: Alexey Kardashevskiy --- drivers/vfio/vfio_io

[PATCH v2 18/18] vfio: powerpc: Enable Dynamic DMA windows

2014-07-22 Thread Alexey Kardashevskiy
This defines and implements VFIO IOMMU API required to support Dynamic DMA windows defined in the SPAPR specification. The ioctl handlers implement host-size part of corresponding RTAS calls: - VFIO_IOMMU_SPAPR_TCE_QUERY - ibm,query-pe-dma-window; - VFIO_IOMMU_SPAPR_TCE_CREATE - ibm,create-pe-dma-w

[PATCH v2 16/18] powerpc/powernv: Implement Dynamic DMA windows (DDW) for IODA

2014-07-22 Thread Alexey Kardashevskiy
SPAPR defines an interface to create additional DMA windows dynamically. "Dynamically" means that the window is not allocated at the guest start and the guest can request it later. In practice, existing linux guests check for the capability and if it is there, they create+map one big DMA window as

[PATCH v2 14/18] powerpc/powernv: Return non-zero TCE from pnv_tce_build

2014-07-22 Thread Alexey Kardashevskiy
This returns old TCE values to the caller if requested. The caller is expectded to call put_page() for them. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/powernv

[PATCH v2 13/18] powerpc/iommu: Extend ppc_md.tce_build(_rm) to return old TCE values

2014-07-22 Thread Alexey Kardashevskiy
The tce_build/tce_build_rm callbacks are used to implement H_PUT_TCE/etc hypercalls. The PAPR spec does not allow to fail if the TCE is not empty. However we cannot just overwrite the existing TCE value with the new one as we still have to do page counting. This adds an optional @old_tces return p

[PATCH v2 12/18] powerpc/iommu: Fix missing permission bits in iommu_put_tce_user_mode()

2014-07-22 Thread Alexey Kardashevskiy
This adds missing permission bits to the translated TCE. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index da04561..01ac319 100644 --- a/arch/powerpc/kernel/iommu

[PATCH v2 10/18] powerpc/powernv: Convert/move set_bypass() callback to take_ownership()

2014-07-22 Thread Alexey Kardashevskiy
At the moment the iommu_table struct has a set_bypass() which enables/ disables DMA bypass on IODA2 PHB. This is exposed to POWERPC IOMMU code which calls this callback when external IOMMU users such as VFIO are about to get over a PHB. Since the set_bypass() is not really an iommu_table function

[PATCH v2 07/18] powerpc/powernv: Add a page size parameter to pnv_pci_setup_iommu_table()

2014-07-22 Thread Alexey Kardashevskiy
Since a TCE page size can be other than 4K, make it configurable for P5IOC2 and IODA PHBs. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 5 +++-- arch/powerpc/platforms/powernv/pci-p5ioc2.c | 3 ++- arch/powerpc/platforms/powernv/pci.c| 6 +++--- a

[PATCH v2 08/18] powerpc/powernv: Make invalidate() callback an iommu_table callback

2014-07-22 Thread Alexey Kardashevskiy
This implements pnv_pci_ioda(1|2)_tce_invalidate as a callback of iommu_table to simplify code structure. The callbacks receive iommu_table only and cast it to PE, the specific callback knows how. This registers invalidate() callbacks for IODA1 and IODA2: - pnv_pci_ioda1_tce_invalidate; - pnv_pci_

[PATCH v2 06/18] powerpc/powernv: Use it_page_shift in TCE build

2014-07-22 Thread Alexey Kardashevskiy
This makes use of iommu_table::it_page_shift instead of TCE_SHIFT and TCE_RPN_SHIFT hardcoded values. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch

[PATCH v2 09/18] powerpc/spapr: vfio: Implement spapr_tce_iommu_ops

2014-07-22 Thread Alexey Kardashevskiy
Modern IBM POWERPC systems support multiple IOMMU tables per PHB so we need a more reliable way (compared to container_of()) to get a PE pointer from the iommu_table struct pointer used in IOMMU functions. At the moment IOMMU group data points to an iommu_table struct. This introduces a spapr_tce_

[PATCH v2 04/18] vfio: powerpc: Move locked_vm accounting to a helper

2014-07-22 Thread Alexey Kardashevskiy
Additional DMA windows support is coming and accounting will include them so let's move this code to a helper for reuse. Signed-off-by: Alexey Kardashevskiy --- drivers/vfio/vfio_iommu_spapr_tce.c | 54 - 1 file changed, 36 insertions(+), 18 deletions(-) diff

[PATCH v2 02/18] KVM: PPC: Use RCU when adding to arch.spapr_tce_tables

2014-07-22 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/book3s_64_vio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 54cf9bc..516f2ee 100644 --- a/arch/powerpc/kvm/book3s_64_vio.c +++ b/arch/powerpc/

[PATCH v2 03/18] KVM: PPC: Account TCE pages in locked_vm

2014-07-22 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/book3s_64_vio.c | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 516f2ee..48b7ed4 100644 --- a/arch/powerpc/kvm

[PATCH v2 00/18] powernv: vfio: Add Dynamic DMA windows (DDW)

2014-07-22 Thread Alexey Kardashevskiy
This prepares existing upstream kernel for DDW (Dynamic DMA windows) and adds actual DDW support for VFIO. This patchset does not contain any in-kernel acceleration stuff. This patchset does not enable DDW for emulated devices. Changes: v2: * moved "Account TCE pages in locked_vm" here (was in

Re: [RFC PATCH 2/3] topology: support node_numa_mem() for determining the fallback node

2014-07-22 Thread David Rientjes
On Tue, 22 Jul 2014, Nishanth Aravamudan wrote: > > I think there's two use cases of interest: > > > > - allocating from a memoryless node where numa_node_id() is memoryless, > >and > > > > - using node_to_mem_node() for a possibly-memoryless node for kmalloc(). > > > > I believe the fir

Re: [RFC PATCH 2/3] topology: support node_numa_mem() for determining the fallback node

2014-07-22 Thread Nishanth Aravamudan
On 22.07.2014 [14:43:11 -0700], Nishanth Aravamudan wrote: > Hi David, > on powerpc now, things look really good. On a KVM instance with the > following topology: > > available: 2 nodes (0-1) > node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 > 25 26 27 28 29 30 31

Re: [PATCH] powerpc: thp: Add write barrier after updating the valid bit

2014-07-22 Thread Benjamin Herrenschmidt
On Wed, 2014-07-23 at 00:23 +0530, Aneesh Kumar K.V wrote: > > A better place for this would be right before the last write to the PMD > > (that's also clearing BUSY) in __hash_page_thp(). Basically, it's the > > normal lock ordering that's missing here, nothing specific to > > mark_hpte_slot_valid

Re: [RFC PATCH 2/3] topology: support node_numa_mem() for determining the fallback node

2014-07-22 Thread Tejun Heo
Hello, On Tue, Jul 22, 2014 at 02:43:11PM -0700, Nishanth Aravamudan wrote: ... > "There is an issue currently where NUMA information is used on powerpc > (and possibly ia64) before it has been read from the device-tree, which > leads to large slab consumption with CONFIG_SLUB and memo

Re: [RFC PATCH 2/3] topology: support node_numa_mem() for determining the fallback node

2014-07-22 Thread Nishanth Aravamudan
Hi David, On 21.07.2014 [18:16:58 -0700], David Rientjes wrote: > On Mon, 21 Jul 2014, Nishanth Aravamudan wrote: > > > Sorry for bringing up this old thread again, but I had a question for > > you, David. node_to_mem_node(), which does seem like a useful API, > > doesn't seem like it can just no

Re: [PATCH v5 4/5] KVM: PPC: Alow kvmppc_get_last_inst() to fail

2014-07-22 Thread Alexander Graf
On 21.07.14 11:59, mihai.cara...@freescale.com wrote: -Original Message- From: Linuxppc-dev [mailto:linuxppc-dev- bounces+mihai.caraman=freescale@lists.ozlabs.org] On Behalf Of mihai.cara...@freescale.com Sent: Friday, July 18, 2014 12:06 PM To: Alexander Graf; kvm-...@vger.kernel.or

Re: [PATCH 2/2] powerpc: thp: invalidate old 64K based hash page mapping before insert

2014-07-22 Thread Aneesh Kumar K.V
Benjamin Herrenschmidt writes: > On Tue, 2014-07-15 at 20:22 +0530, Aneesh Kumar K.V wrote: >> If we changed base page size of the segment, either via sub_page_protect >> or via remap_4k_pfn, we do a demote_segment which doesn't flush the hash >> table entries. We do that when inserting a new has

Re: [PATCH] powerpc: thp: Add write barrier after updating the valid bit

2014-07-22 Thread Aneesh Kumar K.V
Benjamin Herrenschmidt writes: > On Tue, 2014-07-15 at 20:22 +0530, Aneesh Kumar K.V wrote: >> With hugepages, we store the hpte valid information in the pte page >> whose address is stored in the second half of the PMD. Use a >> write barrier to make sure that clearing pmd busy bit and updating

[PATCH] powerpc/perf/hv-24x7: Use kmem_cache_free

2014-07-22 Thread Himangi Saraogi
Free memory allocated using kmem_cache_zalloc using kmem_cache_free rather than kfree. The Coccinelle semantic patch that makes this change is as follows: // @@ expression x,E,c; @@ x = \(kmem_cache_alloc\|kmem_cache_zalloc\|kmem_cache_alloc_node\)(c,...) ... when != x = E when != &x ?-k

Re: [PATCH v4 6/6] clk: Add floor and ceiling constraints to clock rates

2014-07-22 Thread Stephen Warren
On 07/17/2014 08:13 AM, Tomeu Vizoso wrote: > Adds a way for clock consumers to set maximum and minimum rates. This can be > used for thermal drivers to set ceiling rates, or by misc. drivers to set > floor rates to assure a minimum performance level. > diff --git a/drivers/clk/clk.c b/drivers/clk

Re: [PATCH] powerpc: Revert removing of _INIT_GLOBAL(), _STATIC() and _INIT_STATIC()

2014-07-22 Thread Michael Ellerman
On Tue, 2014-07-22 at 16:13 +1000, Benjamin Herrenschmidt wrote: > On Mon, 2014-07-21 at 14:56 -0400, Steven Rostedt wrote: > > > Weird ... what are your gcc and binutils versions ? Smells like a > > > toolchain issue to me but I need to dig a bit more. Doesn't hit any > > > of my test configs here