[PATCH 1/2 V2] powerpc: Move opcode definitions from kvm/emulate.c to asm/ppc-opcode.h

2013-04-28 Thread Jia Hongtao
Opcode and xopcode are useful definitions not just for KVM. Move these definitions to asm/ppc-opcode.h for public use. Signed-off-by: Jia Hongtao hongtao@freescale.com Signed-off-by: Li Yang le...@freescale.com --- V2: * Add LHAUX definition. arch/powerpc/include/asm/ppc-opcode.h | 46

[PATCH 2/2 V8] powerpc/85xx: Add machine check handler to fix PCIe erratum on mpc85xx

2013-04-28 Thread Jia Hongtao
A PCIe erratum of mpc85xx may causes a core hang when a link of PCIe goes down. when the link goes down, Non-posted transactions issued via the ATMU requiring completion result in an instruction stall. At the same time a machine-check exception is generated to the core to allow further processing

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: On 04/19/2013

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: +#ifdef CONFIG_SPE

[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 aneesh.ku...@linux.vnet.ibm.com 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 pau...@samba.org Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com ---

[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 aneesh.ku...@linux.vnet.ibm.com 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

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

2013-04-28 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 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

[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

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

2013-04-28 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 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

[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 aneesh.ku...@linux.vnet.ibm.com 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 aneesh.ku...@linux.vnet.ibm.com --- arch/powerpc/mm/hash_native_64.c | 32

[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 aneesh.ku...@linux.vnet.ibm.com 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 aarca...@redhat.com Signed-off-by: Aneesh

[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 aneesh.ku...@linux.vnet.ibm.com 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 aarca...@redhat.com Reviewed-by: David

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

2013-04-28 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com This gives hint about different base and actual page size combination supported by the platform. Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- arch/powerpc/mm/hash_utils_64.c | 10 +- 1 file changed, 5

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

2013-04-28 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 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

[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 aneesh.ku...@linux.vnet.ibm.com 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

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

2013-04-28 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 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

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

2013-04-28 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com PAPR defines these errors as negative values. So print them accordingly for easy debugging. Acked-by: Paul Mackerras pau...@samba.org Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- arch/powerpc/platforms/pseries/lpar.c

[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 aneesh.ku...@linux.vnet.ibm.com Reviewed-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- arch/powerpc/include/asm/mmu-hash64.h | 3 ++- arch/powerpc/mm/hash_utils_64.c | 12 +++-

[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 aneesh.ku...@linux.vnet.ibm.com 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 pau...@samba.org Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com ---

[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 aneesh.ku...@linux.vnet.ibm.com 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

[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 aneesh.ku...@linux.vnet.ibm.com 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

[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 aneesh.ku...@linux.vnet.ibm.com 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.

[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 aneesh.ku...@linux.vnet.ibm.com 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

[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

[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 aneesh.ku...@linux.vnet.ibm.com 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

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

2013-04-28 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 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

[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 aneesh.ku...@linux.vnet.ibm.com We will use this in the later patch for handling THP pages Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- arch/powerpc/include/asm/hugetlb.h | 8 +- arch/powerpc/include/asm/pgtable-ppc64.h | 11 --

[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 aneesh.ku...@linux.vnet.ibm.com 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 aneesh.ku...@linux.vnet.ibm.com ---

[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 aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- 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

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

2013-04-28 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com We enable only if the we support 16MB page size. Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- arch/powerpc/include/asm/pgtable-ppc64.h | 3 +-- arch/powerpc/mm/pgtable_64.c | 28

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

2013-04-28 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 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 aneesh.ku...@linux.vnet.ibm.com ---

[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 aneesh.ku...@linux.vnet.ibm.com 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

[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 aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- 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

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

2013-04-28 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 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

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 it

[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 an...@samba.org --- Index: b/arch/powerpc/kernel/head_64.S

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 up

[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

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

2013-04-28 Thread Alistair Popple
Signed-off-by: Alistair Popple alist...@popple.id.au --- 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 ---

[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 alist...@popple.id.au --- arch/powerpc/configs/c2k_defconfig|2 ++ arch/powerpc/configs/g5_defconfig

[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