[PATCH] powerpc: Add an in memory udbg console

2013-04-28 Thread Alistair Popple
This patch adds a new udbg early debug console which utilises statically defined input and output buffers stored within the kernel BSS. It is primarily designed to assist with bring up of new hardware which may not have a working console but which has a method of reading/writing kernel memory. Sig

[PATCH] powerpc/rtas_flash: Fix bad memory access

2013-04-28 Thread Vasant Hegde
We use kmem_cache_alloc() to allocate memory to hold the new firmware which will be flashed. kmem_cache_alloc() calls rtas_block_ctor() to set memory to NULL. But these constructor is called only for newly allocated slabs. If we run below command multiple time without rebooting, allocator may allo

linux-next: build failure after merge of the cgroup tree

2013-04-28 Thread Stephen Rothwell
Hi Tejun, After merging the cgroup tree, today's linux-next build (powerpc ppc64_defconfig) failed like this: arch/powerpc/mm/numa.c: In function 'arch_update_cpu_topology': arch/powerpc/mm/numa.c:1465:2: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration] a

[PATCH 2/2] powerpc: Update default configurations

2013-04-28 Thread Alistair Popple
Update default configurations for systems with CONFIG_BOOTX_TEXT selected so that they continue to print early debug messages as is currently the case. Signed-off-by: Alistair Popple --- arch/powerpc/configs/c2k_defconfig|2 ++ arch/powerpc/configs/g5_defconfig |2 ++ arch/powerp

[PATCH 1/2] powerpc: Add a configuration option for early BootX/OpenFirmware debug

2013-04-28 Thread Alistair Popple
Signed-off-by: Alistair Popple --- arch/powerpc/Kconfig.debug |7 +++ arch/powerpc/kernel/udbg.c |2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug index 5416e28..e826853 100644 --- a/arch/powerpc/Kconfig.debug

[PATCH 0/2] powerpc: Early debug console configuration clean up

2013-04-28 Thread Alistair Popple
This patch series (based on v3.9) adds a configuration option to enable the use of BootX or OpenFirmware console for early debug console support. Previously the use of BootX/OpenFirmware as an early debug console was selected by CONFIG_BOOTX. However this left the ability to select a different ear

Re: linux-next: manual merge of the vfs tree with the powerpc tree

2013-04-28 Thread Benjamin Herrenschmidt
On Mon, 2013-04-29 at 11:35 +1000, Stephen Rothwell wrote: > Today's linux-next merge of the vfs tree got a conflict in > arch/powerpc/kernel/rtas_flash.c between commit ad18a364f186 > ("powerpc/rtas_flash: Free kmem upon module exit"), from the powerpc > tree and commit 5c0333c00ff6 ("ppc: Clean

[PATCH] powerpc: Align p_toc

2013-04-28 Thread Anton Blanchard
p_toc is an 8 byte relative offset to the TOC that we place in the text section. This means it is only 4 byte aligned where it should be 8 byte aligned. Add an explicit alignment. Signed-off-by: Anton Blanchard --- Index: b/arch/powerpc/kernel/head_64.S =

linux-next: manual merge of the vfs tree with the powerpc tree

2013-04-28 Thread Stephen Rothwell
Hi Al, Today's linux-next merge of the vfs tree got a conflict in arch/powerpc/kernel/rtas_flash.c between commit ad18a364f186 ("powerpc/rtas_flash: Free kmem upon module exit"), from the powerpc tree and commit 5c0333c00ff6 ("ppc: Clean up rtas_flash driver somewhat") from the vfs tree. I fixed

[PATCH -V7 10/10] powerpc: disable assert_pte_locked

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" With THP we set pmd to none, before we do pte_clear. Hence we can't walk page table to get the pte lock ptr and verify whether it is locked. THP do take pte lock before calling pte_clear. So we don't change the locking rules here. It is that we can't use page table walkin

[PATCH -V7 04/10] powerpc: Update find_linux_pte_or_hugepte to handle transparent hugepages

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 8601f2d..081c001 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/ar

[PATCH -V7 07/10] powerpc/THP: Add code to handle HPTE faults for large pages

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" The deposted PTE page in the second half of the PMD table is used to track the state on hash PTEs. After updating the HPTE, we mark the coresponding slot in the deposted PTE page valid. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/mmu-hash64.h | 13 +++

[PATCH -V7 09/10] powerpc: Optimize hugepage invalidate

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" Hugepage invalidate involves invalidating multiple hpte entries. Optimize the operation using H_BULK_REMOVE on lpar platforms. On native, reduce the number of tlb flush. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/machdep.h| 3 + arch/powerpc/mm/

[PATCH -V7 08/10] powerpc/THP: Enable THP on PPC64

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" We enable only if the we support 16MB page size. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/pgtable-ppc64.h | 3 +-- arch/powerpc/mm/pgtable_64.c | 28 2 files changed, 29 insertions(+), 2 deletions(-) diff -

[PATCH -V7 06/10] powerpc: Update gup_pmd_range to handle transparent hugepages

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/gup.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c index 4b921af..3d36fd7 100644 --- a/arch/powerpc/mm/gup.c +++ b/arch/powerpc/mm/g

[PATCH -V7 05/10] powerpc: Replace find_linux_pte with find_linux_pte_or_hugepte

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" Replace find_linux_pte with find_linux_pte_or_hugepte and explicitly document why we don't need to handle transparent hugepages at callsites. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/pgtable-ppc64.h | 24 arch/powerpc/kernel

[PATCH -V7 03/10] powerpc: move find_linux_pte_or_hugepte and gup_hugepte to common code

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" We will use this in the later patch for handling THP pages Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/hugetlb.h | 8 +- arch/powerpc/include/asm/pgtable-ppc64.h | 11 -- arch/powerpc/mm/Makefile | 2 +- arch/powerpc/mm/huget

[PATCH -V7 02/10] powerpc/THP: Implement transparent hugepages for ppc64

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" We now have pmd entries covering 16MB range and the PMD table double its original size. We use the second half of the PMD table to deposit the pgtable (PTE page). The depoisted PTE page is further used to track the HPTE information. The information include [ secondary g

[PATCH -V7 01/10] powerpc/THP: Double the PMD table size for THP

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" THP code does PTE page allocation along with large page request and deposit them for later use. This is to ensure that we won't have any failures when we split hugepages to regular pages. On powerpc we want to use the deposited PTE page for storing hash pte slot and seco

[PATCH -V7 00/10] THP support for PPC64 (Patchset 2)

2013-04-28 Thread Aneesh Kumar K.V
Hi, This is the second patchset needed to support THP on ppc64. Some of the changes included in this series are tricky in that it changes the powerpc linux page table walk subtly. We also overload few of the pte flags for ptes at PMD leve (huge page PTEs). This patchset require closer review befo

[PATCH -V7 14/18] powerpc: Decode the pte-lp-encoding bits correctly.

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" We look at both the segment base page size and actual page size and store the pte-lp-encodings in an array per base page size. We also update all relevant functions to take actual page size argument so that we can use the correct PTE LP encoding in HPTE. This should also

[PATCH -V7 11/18] powerpc: Move the pte free routines from common header

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" This patch moves the common code to 32/64 bit headers and also duplicate 4K_PAGES and 64K_PAGES section. We will later change the 64 bit 64K_PAGES version to support smaller PTE fragments. The patch doesn't introduce any functional changes. Acked-by: Paul Mackerras Sign

[PATCH -V7 09/18] powerpc: Switch 16GB and 16MB explicit hugepages to a different page table format

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" We will be switching PMD_SHIFT to 24 bits to facilitate THP impmenetation. With PMD_SHIFT set to 24, we now have 16MB huge pages allocated at PGD level. That means with 32 bit process we cannot allocate normal pages at all, because we cover the entire address space with o

[PATCH -V7 02/18] mm/THP: Add pmd args to pgtable deposit and withdraw APIs

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" This will be later used by powerpc THP support. In powerpc we want to use pgtable for storing the hash index values. So instead of adding them to mm_context list, we would like to store them in the second half of pmd Reviewed-by: Andrea Arcangeli Reviewed-by: David Gibs

[PATCH -V7 06/18] powerpc: Don't hard code the size of pte page

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" USE PTRS_PER_PTE to indicate the size of pte page. To support THP, later patches will be changing PTRS_PER_PTE value. Acked-by: Paul Mackerras Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/pgtable.h | 6 ++ arch/powerpc/mm/hash_low_64.S | 4 ++-

[PATCH -V7 16/18] powerpc: print both base and actual page size on hash failure

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" Reviewed-by: David Gibson Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/mmu-hash64.h | 3 ++- arch/powerpc/mm/hash_utils_64.c | 12 +++- arch/powerpc/mm/hugetlbpage-hash64.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff

[PATCH -V7 04/18] powerpc: Use signed formatting when printing error

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" PAPR defines these errors as negative values. So print them accordingly for easy debugging. Acked-by: Paul Mackerras Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/platforms/pseries/lpar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powe

[PATCH -V7 08/18] powerpc: New hugepage directory format

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" Change the hugepage directory format so that we can have leaf ptes directly at page directory avoiding the allocation of hugepage directory. With the new table format we have 3 cases for pgds and pmds: (1) invalid (all zeroes) (2) pointer to next table, as normal; bottom

[PATCH -V7 15/18] powerpc: Fix hpte_decode to use the correct decoding for page sizes

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" As per ISA doc, we encode base and actual page size in the LP bits of PTE. The number of bit used to encode the page sizes depend on actual page size. ISA doc lists this as PTE LP actual page size rrrz >=8KB rrzz >=16KB rzzz >=32K

[PATCH -V7 07/18] powerpc: Don't truncate pgd_index wrongly

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" With PGD_INDEX_SIZE set to 12 the existing macro doesn't work. Fix it to use PTRS_PER_PGD The idea originally was to have one more bit in the result of pgd_index() than PGD_INDEX_SIZE, so that if one had an address corresponding to the last PGD entry, and then incremente

[PATCH -V7 17/18] powerpc: Print page size info during boot

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" This gives hint about different base and actual page size combination supported by the platform. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/hash_utils_64.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/mm/hash_util

[PATCH -V7 01/18] mm/THP: HPAGE_SHIFT is not a #define on some arch

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" On archs like powerpc that support different hugepage sizes, HPAGE_SHIFT and other derived values like HPAGE_PMD_ORDER are not constants. So move that to hugepage_init Reviewed-by: Andrea Arcangeli Reviewed-by: David Gibson Signed-off-by: Aneesh Kumar K.V --- include

[PATCH -V7 03/18] mm/THP: withdraw the pgtable after pmdp related operations

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" For architectures like ppc64 we look at deposited pgtable when calling pmdp_get_and_clear. So do the pgtable_trans_huge_withdraw after finishing pmdp related operations. Reviewed-by: Andrea Arcangeli Signed-off-by: Aneesh Kumar K.V --- mm/huge_memory.c | 8 +++- 1

[PATCH -V7 18/18] powerpc: Update tlbie/tlbiel as per ISA doc

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" Encode the actual page correctly in tlbie/tlbiel. This make sure we handle multiple page size segment correctly. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/hash_native_64.c | 32 ++-- 1 file changed, 30 insertions(+), 2 deletions(-)

[PATCH -V7 12/18] powerpc: Reduce PTE table memory wastage

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" We allocate one page for the last level of linux page table. With THP and large page size of 16MB, that would mean we are wasting large part of that page. To map 16MB area, we only need a PTE space of 2K with 64K page size. This patch reduce the space wastage by sharing t

[PATCH -V7 00/18] THP support for PPC64 (Patchset 1)

2013-04-28 Thread Aneesh Kumar K.V
Hi, This patchset include changes needed for mm/ and powerpc/mm/ to support THP. I have split the patch series into two patchset, so that we can look at getting prerequisite patches upstream in 3.10. Some numbers: The latency measurements code from Anton found at http://ozlabs.org/~anton/junkco

[PATCH -V7 10/18] powerpc: Reduce the PTE_INDEX_SIZE

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" This make one PMD cover 16MB range. That helps in easier implementation of THP on power. THP core code make use of one pmd entry to track the hugepage and the range mapped by a single pmd entry should be equal to the hugepage size supported by the hardware. This also swi

[PATCH -V7 13/18] powerpc: Use encode avpn where we need only avpn values

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" In all these cases we are doing something similar to HPTE_V_COMPARE(hpte_v, want_v) which ignores the HPTE_V_LARGE bit With MPSS support we would need actual page size to set HPTE_V_LARGE bit and that won't be available in most of these cases. Since we are ignoring HPTE

[PATCH -V7 05/18] powerpc: Save DAR and DSISR in pt_regs on MCE

2013-04-28 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" We were not saving DAR and DSISR on MCE. Save then and also print the values along with exception details in xmon. Acked-by: Paul Mackerras Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kernel/exceptions-64s.S | 9 + arch/powerpc/xmon/xmon.c | 2

Re: [PATCH v2 02/15] powerpc/85xx: add sleep and deep sleep support

2013-04-28 Thread Zhao Chenhui
On Tue, Apr 23, 2013 at 06:53:20PM -0500, Scott Wood wrote: > On 04/19/2013 05:47:35 AM, Zhao Chenhui wrote: > > static int pmc_suspend_enter(suspend_state_t state) > > { > >-int ret; > >+int ret = 0; > >+ > >+switch (state) { > >+#ifdef CONFIG_PPC_85xx > >+case PM_SUSPEND_MEM: > >+

Re: [PATCH v2 12/15] powerpc/85xx: add time base sync support for e6500

2013-04-28 Thread Zhao Chenhui
On Thu, Apr 25, 2013 at 07:07:24PM -0500, Scott Wood wrote: > On 04/24/2013 07:28:18 PM, Zhao Chenhui wrote: > >On Wed, Apr 24, 2013 at 05:38:16PM -0500, Scott Wood wrote: > >> On 04/24/2013 06:29:29 AM, Zhao Chenhui wrote: > >> >On Tue, Apr 23, 2013 at 07:04:06PM -0500, Scott Wood wrote: > >> >> O