Re: [PATCH V5 14/31] powerpc/booke: Move nohash headers (part 2)
Some sort of commit message enlisting what we copied from where and which all header file references have changed will be helpful here. On 11/23/2015 03:52 PM, Aneesh Kumar K.V wrote: > Acked-by: Scott Wood > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/{pgtable-ppc32.h => nohash/32/pgtable.h} | 0 > arch/powerpc/include/asm/{pgtable-ppc64.h => nohash/64/pgtable.h} | 2 +- > arch/powerpc/include/asm/nohash/pgtable.h | 8 > > 3 files changed, 5 insertions(+), 5 deletions(-) > rename arch/powerpc/include/asm/{pgtable-ppc32.h => nohash/32/pgtable.h} > (100%) > rename arch/powerpc/include/asm/{pgtable-ppc64.h => nohash/64/pgtable.h} > (99%) > > diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h > b/arch/powerpc/include/asm/nohash/32/pgtable.h > similarity index 100% > rename from arch/powerpc/include/asm/pgtable-ppc32.h > rename to arch/powerpc/include/asm/nohash/32/pgtable.h > diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h > b/arch/powerpc/include/asm/nohash/64/pgtable.h > similarity index 99% > rename from arch/powerpc/include/asm/pgtable-ppc64.h > rename to arch/powerpc/include/asm/nohash/64/pgtable.h > index 6be203d43fd1..9b4f9fcd64de 100644 > --- a/arch/powerpc/include/asm/pgtable-ppc64.h > +++ b/arch/powerpc/include/asm/nohash/64/pgtable.h > @@ -18,7 +18,7 @@ > * Size of EA range mapped by our pagetables. > */ > #define PGTABLE_EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ > - PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT) > + PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT) > #define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE) > > #ifdef CONFIG_TRANSPARENT_HUGEPAGE > diff --git a/arch/powerpc/include/asm/nohash/pgtable.h > b/arch/powerpc/include/asm/nohash/pgtable.h > index 91325997ba25..c0c41a2409d2 100644 > --- a/arch/powerpc/include/asm/nohash/pgtable.h > +++ b/arch/powerpc/include/asm/nohash/pgtable.h This should be added at the end of the file. #endif /* _ASM_POWERPC_NOHASH_PGTABLE_H */ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V5 11/31] powerpc/mm: Move hash64 PTE bits from book3s/64/pgtable.h to hash.h
On 11/23/2015 03:52 PM, Aneesh Kumar K.V wrote: > +extern struct page *pmd_page(pmd_t pmd); > static inline pte_t pud_pte(pud_t pud) > { > return __pte(pud_val(pud)); > @@ -294,15 +115,14 @@ static inline void pgd_set(pgd_t *pgdp, unsigned long > val) > * Find an entry in a page-table-directory. We combine the address region > * (the high order N bits) and the pgd portion of the address. > */ > -#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - > 1)) > > #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) > > #define pmd_offset(pudp,addr) \ > - (((pmd_t *) pud_page_vaddr(*(pudp))) + (((addr) >> PMD_SHIFT) & > (PTRS_PER_PMD - 1))) > + (((pmd_t *) pud_page_vaddr(*(pudp))) + pmd_index(addr)) > > #define pte_offset_kernel(dir,addr) \ > - (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & > (PTRS_PER_PTE - 1))) > + (((pte_t *) pmd_page_vaddr(*(dir))) + pte_index(addr)) These additions of the code should have been done in a separate patch. This has been observed in some of the previous patches as well. If the commit message says that PTE definitions need to be moved then the patch only needs to move them, not change them anyway while on the move. Any changes to code should be done in separate patch. That will keep the change log clean, logical and makes it easy to track and understand. powerpc/mm: Move hash64 PTE bits from book3s/64/pgtable.h to hash.h This enables us to keep hash64 related bits together, and makes it easy to follow. Acked-by: Scott Wood Signed-off-by: Aneesh Kumar K.V arch/powerpc/include/asm/book3s/64/hash.h| 450 ++ arch/powerpc/include/asm/book3s/64/pgtable.h | 447 -- arch/powerpc/include/asm/pgtable.h | 6 -- 3 files changed, 450 insertions(+), 453 deletions(-) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V5 08/31] powerpc/mm: Drop pte-common.h from BOOK3S 64
On 11/23/2015 03:52 PM, Aneesh Kumar K.V wrote: > We copy only needed PTE bits define from pte-common.h to respective > hash related header. This should greatly simply later patches in which Will it be simplify > we are going to change the pte format for hash config > > Acked-by: Scott Wood > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/book3s/64/hash-4k.h | 1 + > arch/powerpc/include/asm/book3s/64/hash.h| 2 + > arch/powerpc/include/asm/book3s/64/pgtable.h | 106 > ++- > arch/powerpc/include/asm/book3s/pgtable.h| 16 ++-- > 4 files changed, 113 insertions(+), 12 deletions(-) > > diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h > b/arch/powerpc/include/asm/book3s/64/hash-4k.h > index f2c51cd61f69..15518b620f5a 100644 > --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h > +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h > @@ -62,6 +62,7 @@ > /* shift to put page number into pte */ > #define PTE_RPN_SHIFT(17) > > +#define _PAGE_4K_PFN 0 > #ifndef __ASSEMBLY__ > /* > * 4-level page tables related bits > diff --git a/arch/powerpc/include/asm/book3s/64/hash.h > b/arch/powerpc/include/asm/book3s/64/hash.h > index 8e60d4fa434d..7deb5063ff8c 100644 > --- a/arch/powerpc/include/asm/book3s/64/hash.h > +++ b/arch/powerpc/include/asm/book3s/64/hash.h > @@ -20,6 +20,7 @@ > #define _PAGE_EXEC 0x0004 /* No execute on POWER4 and newer (we > invert) */ > #define _PAGE_GUARDED0x0008 > /* We can derive Memory coherence from _PAGE_NO_CACHE */ > +#define _PAGE_COHERENT 0x0 > #define _PAGE_NO_CACHE 0x0020 /* I: cache inhibit */ > #define _PAGE_WRITETHRU 0x0040 /* W: cache write-through */ > #define _PAGE_DIRTY 0x0080 /* C: page changed */ > @@ -30,6 +31,7 @@ > /* No separate kernel read-only */ > #define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY) /* user access > blocked by key */ > #define _PAGE_KERNEL_RO _PAGE_KERNEL_RW > +#define _PAGE_KERNEL_RWX (_PAGE_DIRTY | _PAGE_RW | _PAGE_EXEC) > > /* Strong Access Ordering */ > #define _PAGE_SAO(_PAGE_WRITETHRU | _PAGE_NO_CACHE | > _PAGE_COHERENT) > diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h > b/arch/powerpc/include/asm/book3s/64/pgtable.h > index ddc08bf22709..e41b9d47cc32 100644 > --- a/arch/powerpc/include/asm/book3s/64/pgtable.h > +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h > @@ -94,11 +94,111 @@ > #define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS |\ >_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \ >_PAGE_THP_HUGE) > +#define _PTE_NONE_MASK _PAGE_HPTEFLAGS > /* > - * Default defines for things which we don't use. > - * We should get this removed. > + * The mask convered by the RPN must be a ULL on 32-bit platforms with > + * 64-bit PTEs > + * FIXME!! double check the RPN_MAX May be not used > */ > -#include > +//#define PTE_RPN_MAX(1UL << (32 - PTE_RPN_SHIFT)) Why this commented definition, this was not part of original PTE definitions in pte-common.h > /* > diff --git a/arch/powerpc/include/asm/book3s/pgtable.h > b/arch/powerpc/include/asm/book3s/pgtable.h > index fa270cfcf30a..87333618af3b 100644 > --- a/arch/powerpc/include/asm/book3s/pgtable.h > +++ b/arch/powerpc/include/asm/book3s/pgtable.h > @@ -11,10 +11,7 @@ > #ifndef __ASSEMBLY__ > > /* Generic accessors to PTE bits */ > -static inline int pte_write(pte_t pte) > -{ > - return (pte_val(pte) & (_PAGE_RW | _PAGE_RO)) != _PAGE_RO; > -} > +static inline int pte_write(pte_t pte) { return > !!(pte_val(pte) & _PAGE_RW);} > /* Generic modifiers for PTE bits */ > -static inline pte_t pte_wrprotect(pte_t pte) { > - pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); > - pte_val(pte) |= _PAGE_RO; return pte; } > +static inline pte_t pte_wrprotect(pte_t pte) > +{ > + pte_val(pte) &= ~_PAGE_RW; > + return pte; > +} > static inline pte_t pte_mkclean(pte_t pte) { > - pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; } > + pte_val(pte) &= ~_PAGE_DIRTY; return pte; } Should not these changes in function definitions happen in a separate patch. The commit message here does not speak about these changes happening. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH V2] powerpc/powernv: Add a kmsg_dumper that flushes console output on panic
On BMC machines, console output is controlled by the OPAL firmware and is only flushed when its pollers are called. When the kernel is in a panic state, it no longer calls these pollers and thus console output does not completely flush, causing some output from the panic to be lost. This patch adds a new kmsg_dumper which gets called at panic time to ensure panic output is not lost. It accomplishes this by calling OPAL_CONSOLE_FLUSH in the OPAL API, and if that is not available, the pollers are called enough times to (hopefully) completely flush the buffer. Signed-off-by: Russell Currey --- V2: Fix some code style issues, no functional change A patch to add the preferred OPAL call for flushing the console buffer, OPAL_CONSOLE_FLUSH, was recently sent upstream to Skiboot. You can track its progress here: https://patchwork.ozlabs.org/patch/547379/ --- arch/powerpc/include/asm/opal-api.h| 3 +- arch/powerpc/include/asm/opal.h| 3 ++ arch/powerpc/platforms/powernv/Makefile| 1 + arch/powerpc/platforms/powernv/opal-kmsg.c | 68 ++ arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + arch/powerpc/platforms/powernv/opal.c | 3 ++ 6 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/platforms/powernv/opal-kmsg.c diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index 8374afe..f8faaae 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h @@ -157,7 +157,8 @@ #define OPAL_LEDS_GET_INDICATOR114 #define OPAL_LEDS_SET_INDICATOR115 #define OPAL_CEC_REBOOT2 116 -#define OPAL_LAST 116 +#define OPAL_CONSOLE_FLUSH 117 +#define OPAL_LAST 117 /* Device tree flags */ diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 8001159..a5fd407 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -35,6 +35,7 @@ int64_t opal_console_read(int64_t term_number, __be64 *length, uint8_t *buffer); int64_t opal_console_write_buffer_space(int64_t term_number, __be64 *length); +void opal_console_flush(void); int64_t opal_rtc_read(__be32 *year_month_day, __be64 *hour_minute_second_millisecond); int64_t opal_rtc_write(uint32_t year_month_day, @@ -262,6 +263,8 @@ extern int opal_resync_timebase(void); extern void opal_lpc_init(void); +extern void opal_kmsg_init(void); + extern int opal_event_request(unsigned int opal_event_nr); struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr, diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile index 1c8cdb6..b9de7ef 100644 --- a/arch/powerpc/platforms/powernv/Makefile +++ b/arch/powerpc/platforms/powernv/Makefile @@ -2,6 +2,7 @@ obj-y += setup.o opal-wrappers.o opal.o opal-async.o idle.o obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o obj-y += opal-msglog.o opal-hmi.o opal-power.o opal-irqchip.o +obj-y += opal-kmsg.o obj-$(CONFIG_SMP) += smp.o subcore.o subcore-asm.o obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o diff --git a/arch/powerpc/platforms/powernv/opal-kmsg.c b/arch/powerpc/platforms/powernv/opal-kmsg.c new file mode 100644 index 000..bd3b2ee --- /dev/null +++ b/arch/powerpc/platforms/powernv/opal-kmsg.c @@ -0,0 +1,68 @@ +/* + * kmsg dumper that ensures the OPAL console fully flushes panic messages + * + * Author: Russell Currey + * + * Copyright 2015 IBM Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include + +#include +#include + +/* + * Console output is controlled by OPAL firmware. The kernel regularly calls + * OPAL_POLL_EVENTS, which flushes some console output. In a panic state, + * however, the kernel no longer calls OPAL_POLL_EVENTS and the panic message + * may not be completely printed. This function does not actually dump the + * message, it just ensures that OPAL completely flushes the console buffer. + */ +static void force_opal_console_flush(struct kmsg_dumper *dumper, +enum kmsg_dump_reason reason) +{ + int i; + + /* +* Outside of a panic context the pollers will continue to run, +* so we don't need to do any special flushing. +*/ + if (reason != KMSG_DUMP_PANIC) + return; + + if (opal_check_token(OPAL_CONS
[PATCH 4/4] powerpc/kernel: Combine vec/loc for STD_EXCEPTION_PSERIES
The STD_EXCEPTION_PSERIES macro takes both a vector number, and a location (memory address). However both are always identical, so combine them to save repeating ourselves. This does mean an exception handler must always exist at the location in memory that matches its vector number. But that's OK because this is the "STD" macro (standard), which does exactly that. We have other macros for the other cases, eg. STD_EXCEPTION_PSERIES_OOL (out of line). Signed-off-by: Michael Ellerman --- arch/powerpc/include/asm/exception-64s.h | 4 ++-- arch/powerpc/kernel/exceptions-64s.S | 16 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h index 9b91879b7876..1609448e2583 100644 --- a/arch/powerpc/include/asm/exception-64s.h +++ b/arch/powerpc/include/asm/exception-64s.h @@ -344,8 +344,8 @@ do_kvm_##n: \ /* * Exception vectors. */ -#define STD_EXCEPTION_PSERIES(loc, vec, label) \ - . = loc;\ +#define STD_EXCEPTION_PSERIES(vec, label) \ + . = vec;\ .globl label##_pSeries; \ label##_pSeries: \ SET_SCRATCH0(r13); /* save r13 */ \ diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 9035bda220f5..7ee72d47f926 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -230,7 +230,7 @@ data_access_slb_pSeries: bctr #endif - STD_EXCEPTION_PSERIES(0x400, 0x400, instruction_access) + STD_EXCEPTION_PSERIES(0x400, instruction_access) . = 0x480 .globl instruction_access_slb_pSeries @@ -274,13 +274,13 @@ hardware_interrupt_hv: KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x500) ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) - STD_EXCEPTION_PSERIES(0x600, 0x600, alignment) + STD_EXCEPTION_PSERIES(0x600, alignment) KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x600) - STD_EXCEPTION_PSERIES(0x700, 0x700, program_check) + STD_EXCEPTION_PSERIES(0x700, program_check) KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x700) - STD_EXCEPTION_PSERIES(0x800, 0x800, fp_unavailable) + STD_EXCEPTION_PSERIES(0x800, fp_unavailable) KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x800) . = 0x900 @@ -293,7 +293,7 @@ decrementer_pSeries: MASKABLE_EXCEPTION_PSERIES(0xa00, 0xa00, doorbell_super) KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xa00) - STD_EXCEPTION_PSERIES(0xb00, 0xb00, trap_0b) + STD_EXCEPTION_PSERIES(0xb00, trap_0b) KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xb00) . = 0xc00 @@ -325,7 +325,7 @@ system_call_pSeries: SYSCALL_PSERIES_3 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00) - STD_EXCEPTION_PSERIES(0xd00, 0xd00, single_step) + STD_EXCEPTION_PSERIES(0xd00, single_step) KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xd00) /* At 0xe??? we have a bunch of hypervisor exceptions, we branch @@ -401,7 +401,7 @@ hv_facility_unavailable_trampoline: KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1202) #endif /* CONFIG_CBE_RAS */ - STD_EXCEPTION_PSERIES(0x1300, 0x1300, instruction_breakpoint) + STD_EXCEPTION_PSERIES(0x1300, instruction_breakpoint) KVM_HANDLER_PR_SKIP(PACA_EXGEN, EXC_STD, 0x1300) . = 0x1500 @@ -428,7 +428,7 @@ denorm_exception_hv: KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1602) #endif /* CONFIG_CBE_RAS */ - STD_EXCEPTION_PSERIES(0x1700, 0x1700, altivec_assist) + STD_EXCEPTION_PSERIES(0x1700, altivec_assist) KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x1700) #ifdef CONFIG_CBE_RAS -- 2.5.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/4] powerpc/kernel: Open code SET_DEFAULT_THREAD_PPR
This is only used in one location, open code it. Signed-off-by: Michael Ellerman --- arch/powerpc/include/asm/ppc_asm.h | 13 - arch/powerpc/kernel/entry_64.S | 8 +++- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 67f05d4935a0..499d9f89435a 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h @@ -413,19 +413,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) FTR_SECTION_ELSE_NESTED(848); \ mtocrf (FXM), RS; \ ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_NOEXECUTE, 848) - -/* - * PPR restore macros used in entry_64.S - * Used for P7 or later processors - */ -#define SET_DEFAULT_THREAD_PPR(ra, rb) \ -BEGIN_FTR_SECTION_NESTED(945) \ - lis ra,INIT_PPR@highest;/* default ppr=3 */ \ - ld rb,PACACURRENT(r13);\ - sldira,ra,32; /* 11- 13 bits are used for ppr */ \ - std ra,TASKTHREADPPR(rb); \ -END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,945) - #endif /* diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index c8a60aa07aa5..a4b0f03cf124 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -316,7 +316,13 @@ syscall_exit_work: subir12,r12,TI_FLAGS 4: /* Anything else left to do? */ - SET_DEFAULT_THREAD_PPR(r3, r10) /* Set thread.ppr = 3 */ +BEGIN_FTR_SECTION + lis r3,INIT_PPR@highest /* Set thread.ppr = 3 */ + ld r10,PACACURRENT(r13) + sldir3,r3,32/* bits 11-13 are used for ppr */ + std r3,TASKTHREADPPR(r10) +END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) + andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP) beq ret_from_except_lite -- 2.5.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/4] powerpc/kernel: Open code HMT_MEDIUM_LOW_HAS_PPR
HMT_MEDIUM_LOW_HAS_PPR is only used in once place, open code it. Signed-off-by: Michael Ellerman --- arch/powerpc/include/asm/ppc_asm.h | 5 - arch/powerpc/kernel/entry_64.S | 6 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index dd0fc18d8103..67f05d4935a0 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h @@ -418,11 +418,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) * PPR restore macros used in entry_64.S * Used for P7 or later processors */ -#define HMT_MEDIUM_LOW_HAS_PPR \ -BEGIN_FTR_SECTION_NESTED(944) \ - HMT_MEDIUM_LOW; \ -END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,944) - #define SET_DEFAULT_THREAD_PPR(ra, rb) \ BEGIN_FTR_SECTION_NESTED(945) \ lis ra,INIT_PPR@highest;/* default ppr=3 */ \ diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index a94f155db78e..c8a60aa07aa5 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -223,7 +223,11 @@ END_FTR_SECTION_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) beq-1f ACCOUNT_CPU_USER_EXIT(r11, r12) - HMT_MEDIUM_LOW_HAS_PPR + +BEGIN_FTR_SECTION + HMT_MEDIUM_LOW +END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) + ld r13,GPR13(r1) /* only restore r13 if returning to usermode */ 1: ld r2,GPR2(r1) ld r1,GPR1(r1) -- 2.5.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/4] powerpc/kernel: Drop HMT_MEDIUM_PPR_DISCARD
HMT_MEDIUM_PPR_DISCARD is a macro which is present at the start of most of our first level exception handlers. It conditionally executes a HMT_MEDIUM instruction, which sets the processor priority to medium. On on modern systems, ie. Power7 and later, it is nop'ed out at boot. All it does is make the exception vectors more cramped, and consume 4 bytes of icache. On old systems it has the effect of boosting the processor priority at the start of exception processing. If we were previously in the idle loop for example, we may be at low or very low priority. This is desirable as we want to process the exception as fast as possible. However looking closely at the generated code, we see that in all cases we execute another HMT_MEDIUM just four instructions later. With code patching applied, the final code on an old (Power6) system will look like, eg: c300 : c300: 7c 42 13 78 mr r2,r2 <- c304: 7d b2 43 a6 mtsprg 2,r13 c308: 7d b1 42 a6 mfsprg r13,1 c30c: f9 2d 00 80 std r9,128(r13) c310: 60 00 00 00 nop c314: 7c 42 13 78 mr r2,r2 <- So I suggest that the added code complexity of HMT_MEDIUM_PPR_DISCARD is not justified by the benefit of boosting the processor priority for the duration of four instructions, and therefore we drop it. Signed-off-by: Michael Ellerman --- arch/powerpc/include/asm/exception-64s.h | 15 --- arch/powerpc/kernel/exceptions-64s.S | 9 - 2 files changed, 24 deletions(-) diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h index 77f52b26dad6..9b91879b7876 100644 --- a/arch/powerpc/include/asm/exception-64s.h +++ b/arch/powerpc/include/asm/exception-64s.h @@ -130,15 +130,6 @@ BEGIN_FTR_SECTION_NESTED(941) \ END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,941) /* - * Increase the priority on systems where PPR save/restore is not - * implemented/ supported. - */ -#define HMT_MEDIUM_PPR_DISCARD \ -BEGIN_FTR_SECTION_NESTED(942) \ - HMT_MEDIUM; \ -END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,0,942) /*non P7*/ - -/* * Get an SPR into a register if the CPU has the given feature */ #define OPT_GET_SPR(ra, spr, ftr) \ @@ -357,7 +348,6 @@ do_kvm_##n: \ . = loc;\ .globl label##_pSeries; \ label##_pSeries: \ - HMT_MEDIUM_PPR_DISCARD; \ SET_SCRATCH0(r13); /* save r13 */ \ EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common,\ EXC_STD, KVMTEST_PR, vec) @@ -373,7 +363,6 @@ label##_pSeries: \ . = loc;\ .globl label##_hv; \ label##_hv:\ - HMT_MEDIUM_PPR_DISCARD; \ SET_SCRATCH0(r13); /* save r13 */ \ EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common,\ EXC_HV, KVMTEST, vec) @@ -389,7 +378,6 @@ label##_hv: \ . = loc;\ .globl label##_relon_pSeries; \ label##_relon_pSeries: \ - HMT_MEDIUM_PPR_DISCARD; \ /* No guest interrupts come through here */ \ SET_SCRATCH0(r13); /* save r13 */ \ EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \ @@ -405,7 +393,6 @@ label##_relon_pSeries: \ . = loc;\ .globl label##_relon_hv;\ label##_relon_hv: \ - HMT_MEDIUM_PPR_DISCARD; \ /* No guest interrupts come through here */ \ SET_SCRATCH0(r13); /* save r13 */ \ EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \ @@ -463,7 +450,6 @@ label##_relon_hv: \ . = loc;\ .globl label##_pSeries; \ label##_pSeries: \ - HMT_MEDIUM_PPR_DISCARD; \ _MASKABLE_EXCEPTION_PSERIES(ve
[PATCH v2] powerpc: Append linux_banner to exception information in xmon.
Currently if you are in xmon without an oops etc. to view the kernel version you have to type "d $linux_banner" - not necessarily obvious. As this is useful information, append to the output of "e" command. Example output: $mon> e cpu 0x1: Vector: 0 at [c000f879ba80] pc: c0081718: sysrq_handle_xmon+0x68/0x80 lr: c0081718: sysrq_handle_xmon+0x68/0x80 sp: c000f879bbe0 msr: 80009033 current = 0xc000f604d5c0 paca= 0xcfdc0480 softe: 0irq_happened: 0x01 pid = 2467, comm = bash Linux version 4.4.0-rc2-8-gc51af91c3ab3-dirty (rashmica@circle) (gcc version 5.1.1 20150629 (GCC) ) #45 SMP Wed Nov 25 10:25:12 AEDT 2015 Signed-off-by: Rashmica Gupta --- Added example output and word wrapping. arch/powerpc/xmon/xmon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index df05bd2fca07..6d3d9d031aea 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -1528,6 +1528,8 @@ static void excprint(struct pt_regs *fp) if (trap == 0x700) print_bug_trap(fp); + + printf(linux_banner); } static void prregs(struct pt_regs *fp) -- 2.5.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc: Append linux_banner to exception information in xmon.
Hi Rashmica, Can you make your subject "powerpc/xmon: ...". On Wed, 2015-11-25 at 10:37 +1100, Rashmica Gupta wrote: > Currently if you are in xmon without an oops etc. to view the kernel version > you have to type "d $linux_banner" - not necessarily obvious. As this is > useful information, append to the output of "e" > command. This line should be word wrapped. And can you include an example of the output in the change log? cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] cxl: Fix DSI misses when the context owning task exits
Thanks Vaibhav! This should definitely help people avoid pain in this corner case :) Acked-by: Ian Munsie ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V3 1/3] ASoC: fsl_esai: spba clock is needed by esai device
On Tue, Nov 24, 2015 at 05:21:30PM -0600, Rob Herring wrote: > On Tue, Nov 24, 2015 at 03:03:28PM +0800, Shengjiu Wang wrote: > > ESAI need to enable the spba clock, when sdma is using share peripheral > > script. In this case, there is two spba master port is used, if don't > > enable the clock, the spba bus will have arbitration issue, which may > > cause read/write wrong data from/to ESAI registers. > > > > Signed-off-by: Shengjiu Wang > > --- > > Documentation/devicetree/bindings/sound/fsl,esai.txt | 5 + > > Acked-by: Rob Herring Hi Mark, Rob Just a reminder. There is V4 for this patch set. I think the "Acked-by:" is for the V4. Thanks. best regards wang shengjiu > > > sound/soc/fsl/fsl_esai.c | 13 + > > 2 files changed, 18 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/sound/fsl,esai.txt > > b/Documentation/devicetree/bindings/sound/fsl,esai.txt > > index d3b6b5f..cd3ee5d 100644 > > --- a/Documentation/devicetree/bindings/sound/fsl,esai.txt > > +++ b/Documentation/devicetree/bindings/sound/fsl,esai.txt > > @@ -27,6 +27,11 @@ Required properties: > > derive HCK, SCK and FS. > > "fsys"The system clock derived from ahb clock used to > > derive HCK, SCK and FS. > > + "spba"The spba clock is required when ESAI is placed as a > > + bus slave of the Shared Peripheral Bus and when two > > + or more bus masters (CPU, DMA or DSP) try to access > > + it. This property is optional depending on the SoC > > + design. > > > >- fsl,fifo-depth : The number of elements in the transmit and receive > > FIFOs. This number is the maximum allowed value for > > diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c > > index 504e731..4d7589c 100644 > > --- a/sound/soc/fsl/fsl_esai.c > > +++ b/sound/soc/fsl/fsl_esai.c > > @@ -35,6 +35,7 @@ > > * @coreclk: clock source to access register > > * @extalclk: esai clock source to derive HCK, SCK and FS > > * @fsysclk: system clock source to derive HCK, SCK and FS > > + * @spbaclk: SPBA clock (optional, depending on SoC design) > > * @fifo_depth: depth of tx/rx FIFO > > * @slot_width: width of each DAI slot > > * @slots: number of slots > > @@ -54,6 +55,7 @@ struct fsl_esai { > > struct clk *coreclk; > > struct clk *extalclk; > > struct clk *fsysclk; > > + struct clk *spbaclk; > > u32 fifo_depth; > > u32 slot_width; > > u32 slots; > > @@ -469,6 +471,9 @@ static int fsl_esai_startup(struct snd_pcm_substream > > *substream, > > ret = clk_prepare_enable(esai_priv->coreclk); > > if (ret) > > return ret; > > + ret = clk_prepare_enable(esai_priv->spbaclk); > > + if (ret) > > + goto err_spbaclk; > > if (!IS_ERR(esai_priv->extalclk)) { > > ret = clk_prepare_enable(esai_priv->extalclk); > > if (ret) > > @@ -499,6 +504,8 @@ err_fsysclk: > > if (!IS_ERR(esai_priv->extalclk)) > > clk_disable_unprepare(esai_priv->extalclk); > > err_extalck: > > + clk_disable_unprepare(esai_priv->spbaclk); > > +err_spbaclk: > > clk_disable_unprepare(esai_priv->coreclk); > > > > return ret; > > @@ -564,6 +571,7 @@ static void fsl_esai_shutdown(struct snd_pcm_substream > > *substream, > > clk_disable_unprepare(esai_priv->fsysclk); > > if (!IS_ERR(esai_priv->extalclk)) > > clk_disable_unprepare(esai_priv->extalclk); > > + clk_disable_unprepare(esai_priv->spbaclk); > > clk_disable_unprepare(esai_priv->coreclk); > > } > > > > @@ -819,6 +827,11 @@ static int fsl_esai_probe(struct platform_device *pdev) > > dev_warn(&pdev->dev, "failed to get fsys clock: %ld\n", > > PTR_ERR(esai_priv->fsysclk)); > > > > + esai_priv->spbaclk = devm_clk_get(&pdev->dev, "spba"); > > + if (IS_ERR(esai_priv->spbaclk)) > > + dev_warn(&pdev->dev, "failed to get spba clock: %ld\n", > > + PTR_ERR(esai_priv->spbaclk)); > > + > > irq = platform_get_irq(pdev, 0); > > if (irq < 0) { > > dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); > > -- > > 1.9.1 > > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc: Append linux_banner to exception information in xmon.
Currently if you are in xmon without an oops etc. to view the kernel version you have to type "d $linux_banner" - not necessarily obvious. As this is useful information, append to the output of "e" command. Signed-off-by: Rashmica Gupta --- arch/powerpc/xmon/xmon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index df05bd2fca07..6d3d9d031aea 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -1528,6 +1528,8 @@ static void excprint(struct pt_regs *fp) if (trap == 0x700) print_bug_trap(fp); + + printf(linux_banner); } static void prregs(struct pt_regs *fp) -- 2.5.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V3 3/3] ASoC: fsl_asrc: spba clock is needed by asrc device
On Tue, Nov 24, 2015 at 03:03:30PM +0800, Shengjiu Wang wrote: > ASRC need to enable the spba clock, when sdma is using share peripheral > script. In this case, there is two spba master port is used, if don't > enable the clock, the spba bus will have arbitration issue, which may > cause read/write wrong data from/to ASRC registers > > Signed-off-by: Shengjiu Wang > --- > Documentation/devicetree/bindings/sound/fsl,asrc.txt | 5 + For the binding: Acked-by: Rob Herring > sound/soc/fsl/fsl_asrc.c | 10 ++ > sound/soc/fsl/fsl_asrc.h | 2 ++ > 3 files changed, 17 insertions(+) > > diff --git a/Documentation/devicetree/bindings/sound/fsl,asrc.txt > b/Documentation/devicetree/bindings/sound/fsl,asrc.txt > index b93362a..3e26a94 100644 > --- a/Documentation/devicetree/bindings/sound/fsl,asrc.txt > +++ b/Documentation/devicetree/bindings/sound/fsl,asrc.txt > @@ -25,6 +25,11 @@ Required properties: > "mem" Peripheral access clock to access registers. > "ipg" Peripheral clock to driver module. > "asrck_<0-f>" Clock sources for input and output clock. > + "spba"The spba clock is required when ASRC is placed as a > + bus slave of the Shared Peripheral Bus and when two > + or more bus masters (CPU, DMA or DSP) try to access > + it. This property is optional depending on the SoC > + design. > > - big-endian : If this property is absent, the little endian > mode > will be in use as default. Otherwise, the big endian > diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c > index 9f087d4..800828e 100644 > --- a/sound/soc/fsl/fsl_asrc.c > +++ b/sound/soc/fsl/fsl_asrc.c > @@ -859,6 +859,10 @@ static int fsl_asrc_probe(struct platform_device *pdev) > return PTR_ERR(asrc_priv->ipg_clk); > } > > + asrc_priv->spba_clk = devm_clk_get(&pdev->dev, "spba"); > + if (IS_ERR(asrc_priv->spba_clk)) > + dev_warn(&pdev->dev, "failed to get spba clock\n"); > + > for (i = 0; i < ASRC_CLK_MAX_NUM; i++) { > sprintf(tmp, "asrck_%x", i); > asrc_priv->asrck_clk[i] = devm_clk_get(&pdev->dev, tmp); > @@ -939,6 +943,9 @@ static int fsl_asrc_runtime_resume(struct device *dev) > ret = clk_prepare_enable(asrc_priv->ipg_clk); > if (ret) > goto disable_mem_clk; > + ret = clk_prepare_enable(asrc_priv->spba_clk); > + if (ret) > + goto disable_ipg_clk; > for (i = 0; i < ASRC_CLK_MAX_NUM; i++) { > ret = clk_prepare_enable(asrc_priv->asrck_clk[i]); > if (ret) > @@ -950,6 +957,8 @@ static int fsl_asrc_runtime_resume(struct device *dev) > disable_asrck_clk: > for (i--; i >= 0; i--) > clk_disable_unprepare(asrc_priv->asrck_clk[i]); > + clk_disable_unprepare(asrc_priv->spba_clk); > +disable_ipg_clk: > clk_disable_unprepare(asrc_priv->ipg_clk); > disable_mem_clk: > clk_disable_unprepare(asrc_priv->mem_clk); > @@ -963,6 +972,7 @@ static int fsl_asrc_runtime_suspend(struct device *dev) > > for (i = 0; i < ASRC_CLK_MAX_NUM; i++) > clk_disable_unprepare(asrc_priv->asrck_clk[i]); > + clk_disable_unprepare(asrc_priv->spba_clk); > clk_disable_unprepare(asrc_priv->ipg_clk); > clk_disable_unprepare(asrc_priv->mem_clk); > > diff --git a/sound/soc/fsl/fsl_asrc.h b/sound/soc/fsl/fsl_asrc.h > index 4aed63c..68802cd 100644 > --- a/sound/soc/fsl/fsl_asrc.h > +++ b/sound/soc/fsl/fsl_asrc.h > @@ -426,6 +426,7 @@ struct fsl_asrc_pair { > * @paddr: physical address to the base address of registers > * @mem_clk: clock source to access register > * @ipg_clk: clock source to drive peripheral > + * @spba_clk: SPBA clock (optional, depending on SoC design) > * @asrck_clk: clock sources to driver ASRC internal logic > * @lock: spin lock for resource protection > * @pair: pair pointers > @@ -442,6 +443,7 @@ struct fsl_asrc { > unsigned long paddr; > struct clk *mem_clk; > struct clk *ipg_clk; > + struct clk *spba_clk; > struct clk *asrck_clk[ASRC_CLK_MAX_NUM]; > spinlock_t lock; > > -- > 1.9.1 > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V3 2/3] ASoC: fsl_spdif: spba clk is needed by spdif device
On Tue, Nov 24, 2015 at 03:03:29PM +0800, Shengjiu Wang wrote: > SPDIF need to enable the spba clock, when sdma is using share peripheral > script. In this case, there is two spba master port is used, if don't > enable the clock, the spba bus will have arbitration issue, which may > cause read/write wrong data from/to SPDIF registers. > > Signed-off-by: Shengjiu Wang > --- > Documentation/devicetree/bindings/sound/fsl,spdif.txt | 5 + For the binding: Acked-by: Rob Herring > sound/soc/fsl/fsl_spdif.c | 15 +++ > 2 files changed, 20 insertions(+) > > diff --git a/Documentation/devicetree/bindings/sound/fsl,spdif.txt > b/Documentation/devicetree/bindings/sound/fsl,spdif.txt > index b5ee32e..4ca39dd 100644 > --- a/Documentation/devicetree/bindings/sound/fsl,spdif.txt > +++ b/Documentation/devicetree/bindings/sound/fsl,spdif.txt > @@ -27,6 +27,11 @@ Required properties: > Transceiver Clock Diagram" of SoC reference manual. > It can also be referred to TxClk_Source bit of > register SPDIF_STC. > + "spba"The spba clock is required when SPDIF is placed as a > + bus slave of the Shared Peripheral Bus and when two > + or more bus masters (CPU, DMA or DSP) try to access > + it. This property is optional depending on the SoC > + design. > > - big-endian : If this property is absent, the native endian > mode > will be in use as default, or the big endian mode > diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c > index 28a8823..64e2a1f 100644 > --- a/sound/soc/fsl/fsl_spdif.c > +++ b/sound/soc/fsl/fsl_spdif.c > @@ -88,6 +88,7 @@ struct spdif_mixer_control { > * @rxclk: rx clock sources for capture > * @coreclk: core clock for register access via DMA > * @sysclk: system clock for rx clock rate measurement > + * @spbaclk: SPBA clock (optional, depending on SoC design) > * @dma_params_tx: DMA parameters for transmit channel > * @dma_params_rx: DMA parameters for receive channel > */ > @@ -106,6 +107,7 @@ struct fsl_spdif_priv { > struct clk *rxclk; > struct clk *coreclk; > struct clk *sysclk; > + struct clk *spbaclk; > struct snd_dmaengine_dai_dma_data dma_params_tx; > struct snd_dmaengine_dai_dma_data dma_params_rx; > /* regcache for SRPC */ > @@ -474,6 +476,12 @@ static int fsl_spdif_startup(struct snd_pcm_substream > *substream, > return ret; > } > > + ret = clk_prepare_enable(spdif_priv->spbaclk); > + if (ret) { > + dev_err(&pdev->dev, "failed to enable spba clock\n"); > + goto err_spbaclk; > + } > + > ret = spdif_softreset(spdif_priv); > if (ret) { > dev_err(&pdev->dev, "failed to soft reset\n"); > @@ -515,6 +523,8 @@ disable_txclk: > for (i--; i >= 0; i--) > clk_disable_unprepare(spdif_priv->txclk[i]); > err: > + clk_disable_unprepare(spdif_priv->spbaclk); > +err_spbaclk: > clk_disable_unprepare(spdif_priv->coreclk); > > return ret; > @@ -548,6 +558,7 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream > *substream, > spdif_intr_status_clear(spdif_priv); > regmap_update_bits(regmap, REG_SPDIF_SCR, > SCR_LOW_POWER, SCR_LOW_POWER); > + clk_disable_unprepare(spdif_priv->spbaclk); > clk_disable_unprepare(spdif_priv->coreclk); > } > } > @@ -1261,6 +1272,10 @@ static int fsl_spdif_probe(struct platform_device > *pdev) > return PTR_ERR(spdif_priv->coreclk); > } > > + spdif_priv->spbaclk = devm_clk_get(&pdev->dev, "spba"); > + if (IS_ERR(spdif_priv->spbaclk)) > + dev_warn(&pdev->dev, "no spba clock in devicetree\n"); > + > /* Select clock source for rx/tx clock */ > spdif_priv->rxclk = devm_clk_get(&pdev->dev, "rxtx1"); > if (IS_ERR(spdif_priv->rxclk)) { > -- > 1.9.1 > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V3 1/3] ASoC: fsl_esai: spba clock is needed by esai device
On Tue, Nov 24, 2015 at 03:03:28PM +0800, Shengjiu Wang wrote: > ESAI need to enable the spba clock, when sdma is using share peripheral > script. In this case, there is two spba master port is used, if don't > enable the clock, the spba bus will have arbitration issue, which may > cause read/write wrong data from/to ESAI registers. > > Signed-off-by: Shengjiu Wang > --- > Documentation/devicetree/bindings/sound/fsl,esai.txt | 5 + Acked-by: Rob Herring > sound/soc/fsl/fsl_esai.c | 13 + > 2 files changed, 18 insertions(+) > > diff --git a/Documentation/devicetree/bindings/sound/fsl,esai.txt > b/Documentation/devicetree/bindings/sound/fsl,esai.txt > index d3b6b5f..cd3ee5d 100644 > --- a/Documentation/devicetree/bindings/sound/fsl,esai.txt > +++ b/Documentation/devicetree/bindings/sound/fsl,esai.txt > @@ -27,6 +27,11 @@ Required properties: > derive HCK, SCK and FS. > "fsys"The system clock derived from ahb clock used to > derive HCK, SCK and FS. > + "spba"The spba clock is required when ESAI is placed as a > + bus slave of the Shared Peripheral Bus and when two > + or more bus masters (CPU, DMA or DSP) try to access > + it. This property is optional depending on the SoC > + design. > >- fsl,fifo-depth : The number of elements in the transmit and receive > FIFOs. This number is the maximum allowed value for > diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c > index 504e731..4d7589c 100644 > --- a/sound/soc/fsl/fsl_esai.c > +++ b/sound/soc/fsl/fsl_esai.c > @@ -35,6 +35,7 @@ > * @coreclk: clock source to access register > * @extalclk: esai clock source to derive HCK, SCK and FS > * @fsysclk: system clock source to derive HCK, SCK and FS > + * @spbaclk: SPBA clock (optional, depending on SoC design) > * @fifo_depth: depth of tx/rx FIFO > * @slot_width: width of each DAI slot > * @slots: number of slots > @@ -54,6 +55,7 @@ struct fsl_esai { > struct clk *coreclk; > struct clk *extalclk; > struct clk *fsysclk; > + struct clk *spbaclk; > u32 fifo_depth; > u32 slot_width; > u32 slots; > @@ -469,6 +471,9 @@ static int fsl_esai_startup(struct snd_pcm_substream > *substream, > ret = clk_prepare_enable(esai_priv->coreclk); > if (ret) > return ret; > + ret = clk_prepare_enable(esai_priv->spbaclk); > + if (ret) > + goto err_spbaclk; > if (!IS_ERR(esai_priv->extalclk)) { > ret = clk_prepare_enable(esai_priv->extalclk); > if (ret) > @@ -499,6 +504,8 @@ err_fsysclk: > if (!IS_ERR(esai_priv->extalclk)) > clk_disable_unprepare(esai_priv->extalclk); > err_extalck: > + clk_disable_unprepare(esai_priv->spbaclk); > +err_spbaclk: > clk_disable_unprepare(esai_priv->coreclk); > > return ret; > @@ -564,6 +571,7 @@ static void fsl_esai_shutdown(struct snd_pcm_substream > *substream, > clk_disable_unprepare(esai_priv->fsysclk); > if (!IS_ERR(esai_priv->extalclk)) > clk_disable_unprepare(esai_priv->extalclk); > + clk_disable_unprepare(esai_priv->spbaclk); > clk_disable_unprepare(esai_priv->coreclk); > } > > @@ -819,6 +827,11 @@ static int fsl_esai_probe(struct platform_device *pdev) > dev_warn(&pdev->dev, "failed to get fsys clock: %ld\n", > PTR_ERR(esai_priv->fsysclk)); > > + esai_priv->spbaclk = devm_clk_get(&pdev->dev, "spba"); > + if (IS_ERR(esai_priv->spbaclk)) > + dev_warn(&pdev->dev, "failed to get spba clock: %ld\n", > + PTR_ERR(esai_priv->spbaclk)); > + > irq = platform_get_irq(pdev, 0); > if (irq < 0) { > dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); > -- > 1.9.1 > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4 1/5] dt-bindings: Add QorIQ TMU thermal bindings
On Tue, Nov 24, 2015 at 02:52:44PM +0800, Jia Hongtao wrote: > Add bindings documentation for TMU (Thermal Monitoring Unit) on QorIQ > platform. > > Signed-off-by: Jia Hongtao > Reviewed-by: Scott Wood Acked-by: Rob Herring > --- > .../devicetree/bindings/thermal/qoriq-thermal.txt | 63 > ++ > 1 file changed, 63 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/thermal/qoriq-thermal.txt > > diff --git a/Documentation/devicetree/bindings/thermal/qoriq-thermal.txt > b/Documentation/devicetree/bindings/thermal/qoriq-thermal.txt > new file mode 100644 > index 000..66223d5 > --- /dev/null > +++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.txt > @@ -0,0 +1,63 @@ > +* Thermal Monitoring Unit (TMU) on Freescale QorIQ SoCs > + > +Required properties: > +- compatible : Must include "fsl,qoriq-tmu". The version of the device is > + determined by the TMU IP Block Revision Register (IPBRR0) at > + offset 0x0BF8. > + Table of correspondences between IPBRR0 values and example chips: > + Value Device > + -- - > + 0x01900102 T1040 > +- reg : Address range of TMU registers. > +- interrupts : Contains the interrupt for TMU. > +- fsl,tmu-range : The values to be programmed into TTRnCR, as specified by > + the SoC reference manual. The first cell is TTR0CR, the second is > + TTR1CR, etc. > +- fsl,tmu-calibration : A list of cell pairs containing temperature > + calibration data, as specified by the SoC reference manual. > + The first cell of each pair is the value to be written to TTCFGR, > + and the second is the value to be written to TSCFGR. > + > +Example: > + > +tmu@f { > + compatible = "fsl,qoriq-tmu"; > + reg = <0xf 0x1000>; > + interrupts = <18 2 0 0>; > + fsl,tmu-range = <0x000a 0x00090026 0x0008004a 0x0001006a>; > + fsl,tmu-calibration = <0x 0x0025 > +0x0001 0x0028 > +0x0002 0x002d > +0x0003 0x0031 > +0x0004 0x0036 > +0x0005 0x003a > +0x0006 0x0040 > +0x0007 0x0044 > +0x0008 0x004a > +0x0009 0x004f > +0x000a 0x0054 > + > +0x0001 0x000d > +0x00010001 0x0013 > +0x00010002 0x0019 > +0x00010003 0x001f > +0x00010004 0x0025 > +0x00010005 0x002d > +0x00010006 0x0033 > +0x00010007 0x0043 > +0x00010008 0x004b > +0x00010009 0x0053 > + > +0x0002 0x0010 > +0x00020001 0x0017 > +0x00020002 0x001f > +0x00020003 0x0029 > +0x00020004 0x0031 > +0x00020005 0x003c > +0x00020006 0x0042 > +0x00020007 0x004d > +0x00020008 0x0056 > + > +0x0003 0x0012 > +0x00030001 0x001d>; > +}; > -- > 2.1.0.27.g96db324 > > -- > To unsubscribe from this list: send the line "unsubscribe devicetree" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc: Fix xmon ml command to work with 64 bit values.
The ml command in xmon currently only works for 32-bit values and so fails to find 64-bit values on a ppc64 machine. So change to work for 64-bit values. This is based off a patch by Josh Boyer. Signed-off-by: Rashmica Gupta --- Based off this patch: http://patchwork.ozlabs.org/patch/90309/ arch/powerpc/xmon/xmon.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 786bf01691c9..df05bd2fca07 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -184,6 +184,12 @@ extern void xmon_leave(void); #define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3]) #endif +#if BITS_PER_LONG == 64 +#define GETLONG(v) (((unsigned long) GETWORD(v)) << 32 | GETWORD(v+4)) +#else +#define GETLONG(v) GETWORD(v) +#endif + static char *help_string = "\ Commands:\n\ bshow breakpoints\n\ @@ -2447,14 +2453,15 @@ memdiffs(unsigned char *p1, unsigned char *p2, unsigned nb, unsigned maxpr) printf("Total of %d differences\n", prt); } -static unsigned mend; -static unsigned mask; +static unsigned long mend; +static unsigned long mask; static void memlocate(void) { - unsigned a, n; - unsigned char val[4]; + unsigned long a, n; + int size = sizeof(unsigned long); + unsigned char val[size]; last_cmd = "ml"; scanhex((void *)&mdest); @@ -2470,10 +2477,10 @@ memlocate(void) } } n = 0; - for (a = mdest; a < mend; a += 4) { - if (mread(a, val, 4) == 4 - && ((GETWORD(val) ^ mval) & mask) == 0) { - printf("%.16x: %.16x\n", a, GETWORD(val)); + for (a = mdest; a < mend; a += size) { + if (mread(a, val, size) == size + && ((GETLONG(val) ^ mval) & mask) == 0){ + printf("%.16lx: %.16lx\n", a, GETLONG(val)); if (++n >= 10) break; } -- 2.5.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] Enable MSI/MSI-X caps and disable MSI interrupts at PCI probe time - code move
On 11/24/2015 07:23 PM, Bjorn Helgaas wrote: On Wed, Nov 04, 2015 at 10:00:15AM -0200, Guilherme G. Piccoli wrote: Bjorn, ping? Sorry, Guilherme, this dropped off my radar, and I can't remember why. I'll take a look at it soon. Bjorn Thanks very much Bjorn! Sorry to bother, by the way. Cheers, Guilherme ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] Enable MSI/MSI-X caps and disable MSI interrupts at PCI probe time - code move
On Wed, Nov 04, 2015 at 10:00:15AM -0200, Guilherme G. Piccoli wrote: > Bjorn, ping? Sorry, Guilherme, this dropped off my radar, and I can't remember why. I'll take a look at it soon. Bjorn ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] Enable MSI/MSI-X caps and disable MSI interrupts at PCI probe time - code move
On 10/21/2015 12:17 PM, Guilherme G. Piccoli wrote: Commit 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if kernel doesn't support MSI") changed the location of the code that initializes dev->msi_cap/msix_cap and disables MSI/MSI-X interrupts at PCI probe time in devices that have this flag set. It moved the code from pci_msi_init_pci_dev() to a new function named pci_msi_setup_pci_dev(), called by pci_setup_device(). In Open Firmware code path (PowerPC pSeries/SPARC archs) the function pci_setup_device() is not called, so MSI capabilities are never enabled, leading to error messages as: bnx2x :01:00.0: no msix capability found Commit 4d9aac397a5d ("powerpc/PCI: Disable MSI/MSI-X interrupts at PCI probe time in OF case") solved the issue on PowerPC pSeries arch calling manually pci_msi_setup_pci_dev() on appropriate place. However, this modification does not solve the general case (SPARC arch should be modified too) and duplicates a lot of code, as pointed by Bjorn Helgaas. As suggested by him, worth to reorganize the code to generally solve the MSI caps issue and avoid too much code duplication. This patch does exactly this: we remove both the pci_msi_setup_pci_dev() call from pci_setup_device() and the same call in OF code path of PowerPC pSeries arch. Then, we call pci_msi_setup_pci_dev() directly from pci_init_capabilities(). So, we can initialize MSI caps and disable MSI interruptions during PCI probe in general fashion, avoiding code duplication. Notice that this patch has the same practical effect of reverting commit 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if kernel doesn't support MSI") and commit 4d9aac397a5d ("powerpc/PCI: Disable MSI/MSI-X interrupts at PCI probe time in OF case"). Regarding the former, the author called pci_msi_setup_pci_dev() from pci_setup_device() because there was an early quirk used in pci_msi_off(), which depended on pci_msi_setup_pci_dev(). Since pci_msi_off() was completely removed by commit c6201cd8513d ("PCI/MSI: Remove unused pci_msi_off()"), we can call pci_msi_setup_pci_dev() directly from pci_init_capabilities(). Signed-off-by: Guilherme G. Piccoli --- arch/powerpc/kernel/pci_of_scan.c | 3 --- drivers/pci/probe.c | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c index 2e710c1..526ac67 100644 --- a/arch/powerpc/kernel/pci_of_scan.c +++ b/arch/powerpc/kernel/pci_of_scan.c @@ -187,9 +187,6 @@ struct pci_dev *of_create_pci_dev(struct device_node *node, pci_device_add(dev, bus); - /* Setup MSI caps & disable MSI/MSI-X interrupts */ - pci_msi_setup_pci_dev(dev); - return dev; } EXPORT_SYMBOL(of_create_pci_dev); diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 8361d27..0aac86e 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1209,8 +1209,6 @@ int pci_setup_device(struct pci_dev *dev) /* "Unknown power state" */ dev->current_state = PCI_UNKNOWN; - pci_msi_setup_pci_dev(dev); - /* Early fixups, before probing the BARs */ pci_fixup_device(pci_fixup_early, dev); /* device class may be changed after fixup */ @@ -1600,6 +1598,9 @@ static void pci_init_capabilities(struct pci_dev *dev) /* MSI/MSI-X list */ pci_msi_init_pci_dev(dev); + /* Setup MSI caps & disable MSI/MSI-X interrupts */ + pci_msi_setup_pci_dev(dev); + /* Buffers for saving PCIe and PCI-X capabilities */ pci_allocate_cap_save_buffers(dev); Michael, Bjorn: any news on this one? Thanks, Guilherme ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: kernel BUG at drivers/scsi/scsi_lib.c:1096!
On 11/23/2015 10:21 AM, Ming Lei wrote: On Mon, 23 Nov 2015 10:46:20 +0800 Ming Lei wrote: Hi Mark, On Mon, Nov 23, 2015 at 9:50 AM, Mark Salter wrote: On Mon, 2015-11-23 at 08:36 +0800, Ming Lei wrote: On Mon, Nov 23, 2015 at 7:20 AM, Mark Salter wrote: On Sun, 2015-11-22 at 00:56 +0800, Ming Lei wrote: On Sat, 21 Nov 2015 12:30:14 +0100 Laurent Dufour wrote: On 20/11/2015 13:10, Michael Ellerman wrote: On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote: It's pretty much guaranteed a block layer bug, most likely in the merge bios to request infrastucture where we don't obey the merging limits properly. Does either of you have a known good and first known bad kernel? Not me, I've only hit it one or two times. All I can say is I have hit it in 4.4-rc1. Laurent, can you narrow it down at all? It seems that the panic is triggered by the commit bdced438acd8 ("block: setup bi_phys_segments after splitting") which has been pulled by the merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of git://git.kernel.dk/linux-block"). My system is panicing promptly when running a kernel built at d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours without panicing. This being said, I can't explain what's going wrong. May Ming shed some light here ? Laurent, looks there is one bug in blk_bio_segment_split(), would you mind testing the following patch to see if it fixes your issue? --- From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Sun, 22 Nov 2015 00:47:13 +0800 Subject: [PATCH] block: fix segment split Inside blk_bio_segment_split(), previous bvec pointer('bvprvp') always points to the iterator local variable, which is obviously wrong, so fix it by pointing to the local variable of 'bvprv'. Signed-off-by: Ming Lei --- block/blk-merge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index de5716d8..f2efe8a 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -98,7 +98,7 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, seg_size += bv.bv_len; bvprv = bv; - bvprvp = &bv; + bvprvp = &bvprv; sectors += bv.bv_len >> 9; continue; } @@ -108,7 +108,7 @@ new_segment: nsegs++; bvprv = bv; - bvprvp = &bv; + bvprvp = &bvprv; seg_size = bv.bv_len; sectors += bv.bv_len >> 9; } I'm still hitting the BUG even with this patch applied on top of 4.4-rc1. OK, looks there are still other bugs, care to share us how to reproduce it on arm64? thanks, Ming Unfortunately, the best reproducer I have is to boot the platform. I have seen the BUG a few times post-boot, but I don't have a consistant reproducer. I am using upstream 4.4-rc1 with this config: http://people.redhat.com/msalter/fh_defconfig With 4.4-rc1 on an APM Mustang platform, I see the BUG about once every 6-7 boots. On an AMD Seattle platform, about every 9 boots. Thanks for the input, and I will try to reproduce the issue on mustang with your kernel config. I can reproduce the issue on mustang, and looks I may understand the story now. When 64K page size is used on arm64, and the default segment size of block is 65536, then one segment should only include one page at most. Commit bdced438acd83a(block: setup bi_phys_segments after splitting) does not compute bio->bi_seg_front_size and bio->bi_seg_back_size, then one less segment may be obtained because blk_phys_contig_segment() thought the last bvec in 1st bio and the 1st bvec in the 2nd bio is in one physical segment, so cause the regression. Looks the following patch can fix the issue by figuring bio->bi_seg_front_size and bio->bi_seg_back_size in blk_bio_segment_split(). Mark, thanks again for providing the reproduction steps, and could you run your test to see if it can fix your issue? --- From 86b5f33d48715c1150fdcfd9a76e495e7aa913aa Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Mon, 23 Nov 2015 20:27:23 +0800 Subject: [PATCH 2/2] blk-merge: fix blk_bio_segment_split Commit bdced438acd83a(block: setup bi_phys_segments after splitting) introduces function of computing bio->bi_phys_segments during bio splitting. Unfortunately both bio->bi_seg_front_size and bio->bi_seg_back_size arn't computed, so too many physical segments may be obtained for one request since both the two are used to check if one segment across two bios can be possible. This patch fixes the issue by computing the two variables in blk_bio_segment_split(). Reported-by: Michael Ellerman Reported-by: Mark Salter Fixes: bdced438acd83a(block: setup bi_phys_segments after splitting) Signed-off-by: Ming Lei --- block/blk-merge.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff
Re: [PATCH v2] memory-hotplug: Fix kernel warning during memory hotplug on ppc64
Hi Michael, On 11/09/2015 07:21 PM, Michael Ellerman wrote: > Hi John, > > On Tue, 2015-11-03 at 11:21 -0600, John Allen wrote: >> This patch fixes a bug where a kernel warning is triggered when performing >> a memory hotplug on ppc64. This warning may also occur on any architecture >> that has multiple sections per memory block. > > So it looks like the only arches that enable this code at all are powerpc, sh > and x86 (via CONFIG_ARCH_MEMORY_PROBE). And it sounds like on x86 it's just > there for debugging, ACPI is meant to notify you of memory hotplug by the > sounds. > > Do any of sh or x86 have "multiple sections per memory block" ? > > If not then this bug would only apply to powerpc, which would be useful to > know. Sorry for the delayed response. It looks like your reply got buried in my lkml folder instead of going straight to my inbox. My understanding is that x86 may use multiple sections per block. I think we would have to assume that any architecture that uses this code could potentially hit this issue. > > And what is the actual warning? ie. what does the code look like. My line 210 > of memory.c is a printk() not a WARN. In mainline, the warning is at line 200: if (WARN_ON_ONCE(!pfn_valid(pfn))) return false; > > >> [ 78.300767] [ cut here ] >> [ 78.300768] WARNING: at ../drivers/base/memory.c:210 >> [ 78.300769] Modules linked in: rpadlpar_io(X) rpaphp(X) tcp_diag udp_diag >> inet_diag unix_diag af_packet_diag netlink_diag af_packet xfs libcrc32c >> ibmveth(X) rtc_generic btrfs xor raid6_pq xts >> gf128mul dm_crypt sd_mod sr_mod cdrom crc_t10dif ibmvscsi(X) >> scsi_transport_srp scsi_tgt dm_mod sg scsi_mod autofs4 >> [ 78.300789] Supported: Yes, External >> [ 78.300791] CPU: 1 PID: 3090 Comm: systemd-udevd Tainted: G >> X 3.12.45-1-default #1 >> [ 78.300793] task: c004d7d1d970 ti: c004d7b9 task.ti: >> c004d7b9 >> [ 78.300794] NIP: c04fcff8 LR: c04fda84 CTR: >> >> [ 78.300795] REGS: c004d7b93930 TRAP: 0700 Tainted: G X >> (3.12.45-1-default) >> [ 78.300796] MSR: 80029033 CR: 24088848 >> XER: >> [ 78.300800] CFAR: c04fcf98 SOFTE: 1 >> GPR00: 0537 c004d7b93bb0 c0e7f200 00053000 >> GPR04: 1000 0001 c0e0f200 >> GPR08: 0001 0537 014dc000 >> GPR12: 00054000 ce7f0900 10041040 >> GPR16: 0100206f0010 1003ff78 1006c824 100410b0 >> GPR20: 1003ff90 1006c00c 01002073cd20 0100206f0760 >> GPR24: 0100206f85a0 c076d950 c004ef7c95e0 c004d7b93e00 >> GPR28: c004de601738 0001 c1218f80 003f >> [ 78.300818] NIP [c04fcff8] memory_block_action+0x258/0x2e0 >> [ 78.300820] LR [c04fda84] memory_subsys_online+0x54/0x100 >> [ 78.300821] Call Trace: >> [ 78.300822] [c004d7b93bb0] [c9071ce0] 0xc9071ce0 >> (unreliable) >> [ 78.300824] [c004d7b93c40] [c04fda84] >> memory_subsys_online+0x54/0x100 >> [ 78.300826] [c004d7b93c70] [c04df784] device_online+0xb4/0x120 >> [ 78.300828] [c004d7b93cb0] [c04fd738] >> store_mem_state+0x88/0x220 >> [ 78.300830] [c004d7b93cf0] [c04db448] dev_attr_store+0x68/0xa0 >> [ 78.300833] [c004d7b93d30] [c031f938] >> sysfs_write_file+0xf8/0x1d0 >> [ 78.300835] [c004d7b93d90] [c027d29c] vfs_write+0xec/0x250 >> [ 78.300837] [c004d7b93de0] [c027dfdc] SyS_write+0x6c/0xf0 >> [ 78.300839] [c004d7b93e30] [c000a17c] syscall_exit+0x0/0x7c >> [ 78.300840] Instruction dump: >> [ 78.300841] 780a0560 79482ea4 7ce94214 2fa7 41de0014 7d09402a >> 396b4000 7907ffe3 >> [ 78.300844] 4082ff54 3cc2fff9 8926b83a 69290001 <0b09> 2fa9 >> 40de006c 3860fff0 >> [ 78.300847] ---[ end trace dfec8da06ebbc762 ]--- > > For change logs I think it's nice to trim the oops a bit. Others probably have > different opinions but I'd remove the printk timestamp, the GPRs and some of > the other regs and the instruction dump, so more like: > > WARNING: at ../drivers/base/memory.c:210 > CPU: 1 PID: 3090 Comm: systemd-udevd Tainted: G X > 3.12.45-1-default #1 > NIP [c04fcff8] memory_block_action+0x258/0x2e0 > LR [c04fda84] memory_subsys_online+0x54/0x100 > Call Trace: > [c004d7b93bb0] [c9071ce0] 0xc9071ce0 (unreliable) > [c004d7b93c40] [c04fda84] memory_subsys_online+0x54/0x100 > [c004d7b93c70] [c04df784] device_online+0xb4/0x120 > [c004d7b93cb0] [c04fd738] store_mem_state+0x88/0x220 > [c004d7b93cf0] [c04db448] dev_attr_store+0x68/0xa0 > [c004d7b93d30] [c031f9
[PATCH 2/2] powerpc: tracing: don't trace hcalls on offline CPUs
./drmgr -c cpu -a -r gives the following warning: [ 2327.035563] RCU used illegally from offline CPU! rcu_scheduler_active = 1, debug_locks = 1 [ 2327.035564] no locks held by swapper/12/0. [ 2327.035565] stack backtrace: [ 2327.035567] CPU: 12 PID: 0 Comm: swapper/12 Tainted: G S 4.3.0-rc3-00060-g353169a #5 [ 2327.035568] Call Trace: [ 2327.035573] [c001d62578e0] [c08977fc] .dump_stack+0x98/0xd4 (unreliable) [ 2327.035577] [c001d6257960] [c0109bd8] .lockdep_rcu_suspicious+0x108/0x170 [ 2327.035580] [c001d62579f0] [c006a1d0] .__trace_hcall_exit+0x2b0/0x2c0 [ 2327.035584] [c001d6257ab0] [c006a2e8] plpar_hcall_norets_trace+0x70/0x8c [ 2327.035588] [c001d6257b20] [c0067a14] .icp_hv_set_cpu_priority+0x54/0xc0 [ 2327.035592] [c001d6257ba0] [c0066c5c] .xics_teardown_cpu+0x5c/0xa0 [ 2327.035595] [c001d6257c20] [c00747ac] .pseries_mach_cpu_die+0x6c/0x320 [ 2327.035598] [c001d6257cd0] [c00439cc] .cpu_die+0x3c/0x60 [ 2327.035602] [c001d6257d40] [c00183d8] .arch_cpu_idle_dead+0x28/0x40 [ 2327.035606] [c001d6257db0] [c00ff1dc] .cpu_startup_entry+0x4fc/0x560 [ 2327.035610] [c001d6257ed0] [c0043728] .start_secondary+0x328/0x360 [ 2327.035614] [c001d6257f90] [c0008a6c] start_secondary_prolog+0x10/0x14 [ 2327.035620] cpu 12 (hwid 12) Ready to die... [ 2327.144463] cpu 13 (hwid 13) Ready to die... [ 2327.294180] cpu 14 (hwid 14) Ready to die... [ 2327.403599] cpu 15 (hwid 15) Ready to die... Make the hypervisor tracepoints conditional by using TRACE_EVENT_FN_COND Signed-off-by: Denis Kirjanov --- arch/powerpc/include/asm/trace.h | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/trace.h b/arch/powerpc/include/asm/trace.h index 8e86b48..3dc5803 100644 --- a/arch/powerpc/include/asm/trace.h +++ b/arch/powerpc/include/asm/trace.h @@ -57,12 +57,14 @@ DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_exit, extern void hcall_tracepoint_regfunc(void); extern void hcall_tracepoint_unregfunc(void); -TRACE_EVENT_FN(hcall_entry, +TRACE_EVENT_FN_COND(hcall_entry, TP_PROTO(unsigned long opcode, unsigned long *args), TP_ARGS(opcode, args), + TP_CONDITION(cpu_online(smp_processor_id())), + TP_STRUCT__entry( __field(unsigned long, opcode) ), @@ -76,13 +78,15 @@ TRACE_EVENT_FN(hcall_entry, hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc ); -TRACE_EVENT_FN(hcall_exit, +TRACE_EVENT_FN_COND(hcall_exit, TP_PROTO(unsigned long opcode, unsigned long retval, unsigned long *retbuf), TP_ARGS(opcode, retval, retbuf), + TP_CONDITION(cpu_online(smp_processor_id())), + TP_STRUCT__entry( __field(unsigned long, opcode) __field(unsigned long, retval) -- 2.4.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/2] tracing: introduce TRACE_EVENT_FN_COND macro
TRACE_EVENT_FN can't be used in some circumstances like invoking trace functions from offlined CPU due to RCU usage. This patch adds the TRACE_EVENT_FN_COND macro to make such trace points conditional. Signed-off-by: Denis Kirjanov --- include/linux/tracepoint.h | 4 include/trace/define_trace.h | 6 ++ include/trace/trace_events.h | 6 ++ 3 files changed, 16 insertions(+) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 696a339c..45b3fcf 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -493,6 +493,10 @@ extern void syscall_unregfunc(void); #define TRACE_EVENT_FN(name, proto, args, struct, \ assign, print, reg, unreg) \ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) +#define TRACE_EVENT_FN_COND(name, proto, args, cond, struct, \ + assign, print, reg, unreg) \ + DECLARE_TRACE_CONDITION(name, PARAMS(proto),\ + PARAMS(args), PARAMS(cond)) #define TRACE_EVENT_CONDITION(name, proto, args, cond, \ struct, assign, print)\ DECLARE_TRACE_CONDITION(name, PARAMS(proto),\ diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index 2d8639e..6e3945f 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h @@ -40,6 +40,11 @@ assign, print, reg, unreg) \ DEFINE_TRACE_FN(name, reg, unreg) +#undef TRACE_EVENT_FN_COND +#define TRACE_EVENT_FN_COND(name, proto, args, cond, tstruct, \ + assign, print, reg, unreg) \ + DEFINE_TRACE_FN(name, reg, unreg) + #undef DEFINE_EVENT #define DEFINE_EVENT(template, name, proto, args) \ DEFINE_TRACE(name) @@ -93,6 +98,7 @@ #undef TRACE_EVENT #undef TRACE_EVENT_FN +#undef TRACE_EVENT_FN_COND #undef TRACE_EVENT_CONDITION #undef DECLARE_EVENT_CLASS #undef DEFINE_EVENT diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index de996cf..170c93b 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -123,6 +123,12 @@ TRACE_MAKE_SYSTEM_STR(); TRACE_EVENT(name, PARAMS(proto), PARAMS(args), \ PARAMS(tstruct), PARAMS(assign), PARAMS(print)) \ +#undef TRACE_EVENT_FN_COND +#define TRACE_EVENT_FN_COND(name, proto, args, cond, tstruct, \ + assign, print, reg, unreg) \ + TRACE_EVENT_CONDITION(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \ + PARAMS(tstruct), PARAMS(assign), PARAMS(print)) \ + #undef TRACE_EVENT_FLAGS #define TRACE_EVENT_FLAGS(name, value) \ __TRACE_EVENT_FLAGS(name, value) -- 2.4.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/powernv: Add a kmsg_dumper that flushes console output on panic
On 11/24/15, Russell Currey wrote: > On BMC machines, console output is controlled by the OPAL firmware and is > only flushed when its pollers are called. When the kernel is in a panic > state, it no longer calls these pollers and thus console output does not > completely flush, causing some output from the panic to be lost. > > This patch adds a new kmsg_dumper which gets called at panic time to ensure > panic output is not lost. It accomplishes this by calling > OPAL_CONSOLE_FLUSH > in the OPAL API, and if that is not available, the pollers are called enough > times to (hopefully) completely flush the buffer. > > Signed-off-by: Russell Currey Some minor nits below. > --- > A patch to add the preferred OPAL call for flushing the console buffer, > OPAL_CONSOLE_FLUSH, was recently sent upstream to Skiboot. You can track > its progress here: https://patchwork.ozlabs.org/patch/547379/ > --- > arch/powerpc/include/asm/opal-api.h| 3 +- > arch/powerpc/include/asm/opal.h| 3 ++ > arch/powerpc/platforms/powernv/Makefile| 1 + > arch/powerpc/platforms/powernv/opal-kmsg.c | 70 > ++ > arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + > arch/powerpc/platforms/powernv/opal.c | 3 ++ > 6 files changed, 80 insertions(+), 1 deletion(-) > create mode 100644 arch/powerpc/platforms/powernv/opal-kmsg.c > > diff --git a/arch/powerpc/include/asm/opal-api.h > b/arch/powerpc/include/asm/opal-api.h > index 8374afe..f8faaae 100644 > --- a/arch/powerpc/include/asm/opal-api.h > +++ b/arch/powerpc/include/asm/opal-api.h > @@ -157,7 +157,8 @@ > #define OPAL_LEDS_GET_INDICATOR 114 > #define OPAL_LEDS_SET_INDICATOR 115 > #define OPAL_CEC_REBOOT2 116 > -#define OPAL_LAST116 > +#define OPAL_CONSOLE_FLUSH 117 > +#define OPAL_LAST117 > > /* Device tree flags */ > > diff --git a/arch/powerpc/include/asm/opal.h > b/arch/powerpc/include/asm/opal.h > index 8001159..a5fd407 100644 > --- a/arch/powerpc/include/asm/opal.h > +++ b/arch/powerpc/include/asm/opal.h > @@ -35,6 +35,7 @@ int64_t opal_console_read(int64_t term_number, __be64 > *length, > uint8_t *buffer); > int64_t opal_console_write_buffer_space(int64_t term_number, > __be64 *length); > +void opal_console_flush(void); > int64_t opal_rtc_read(__be32 *year_month_day, > __be64 *hour_minute_second_millisecond); > int64_t opal_rtc_write(uint32_t year_month_day, > @@ -262,6 +263,8 @@ extern int opal_resync_timebase(void); > > extern void opal_lpc_init(void); > > +extern void opal_kmsg_init(void); > + > extern int opal_event_request(unsigned int opal_event_nr); > > struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr, > diff --git a/arch/powerpc/platforms/powernv/Makefile > b/arch/powerpc/platforms/powernv/Makefile > index 1c8cdb6..b9de7ef 100644 > --- a/arch/powerpc/platforms/powernv/Makefile > +++ b/arch/powerpc/platforms/powernv/Makefile > @@ -2,6 +2,7 @@ obj-y += setup.o opal-wrappers.o opal.o > opal-async.o > idle.o > obj-y+= opal-rtc.o opal-nvram.o opal-lpc.o > opal-flash.o > obj-y+= rng.o opal-elog.o opal-dump.o > opal-sysparam.o opal-sensor.o > obj-y+= opal-msglog.o opal-hmi.o opal-power.o > opal-irqchip.o > +obj-y+= opal-kmsg.o > > obj-$(CONFIG_SMP)+= smp.o subcore.o subcore-asm.o > obj-$(CONFIG_PCI)+= pci.o pci-p5ioc2.o pci-ioda.o > diff --git a/arch/powerpc/platforms/powernv/opal-kmsg.c > b/arch/powerpc/platforms/powernv/opal-kmsg.c > new file mode 100644 > index 000..904f123 > --- /dev/null > +++ b/arch/powerpc/platforms/powernv/opal-kmsg.c > @@ -0,0 +1,70 @@ > +/* > + * kmsg dumper that ensures the OPAL console fully flushes panic messages > + * > + * Author: Russell Currey > + * > + * Copyright 2015 IBM Corporation. > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms of the GNU General Public License as published by the > + * Free Software Foundation; either version 2 of the License, or (at your > + * option) any later version. > + */ > + > +#include > + > +#include > +#include > + > +/* > + * Console output is controlled by OPAL firmware. The kernel regularly > calls > + * OPAL_POLL_EVENTS, which flushes some console output. In a panic state, > + * however, the kernel no longer calls OPAL_POLL_EVENTS and the panic > message > + * may not be completely printed. This function does not actually dump the > + * message, it just ensures that OPAL completely flushes the console > buffer. > + */ > +static void force_opal_console_flush(struct kmsg_dumper *dumper, > + enum kmsg_dump_reason reason) > +{ > + int i; > + > + /* > + *
Re: [PATCH] cpufreq: qoriq: Register cooling device based on device tree
On Tue, Nov 24, 2015 at 08:18:17AM -0600, Scott Wood wrote: > On Tue, 2015-11-24 at 14:55 +0800, Jia Hongtao wrote: > > Register the qoriq cpufreq driver as a cooling device, based on the > > thermal device tree framework. When temperature crosses the passive trip > > point cpufreq is used to throttle CPUs. > > > > Signed-off-by: Jia Hongtao > > Reviewed-by: Scott Wood > > When did I add "Reviewed-by" to this? This is typically why I prefer seeing people emailing their reviewed-by and acked-by to the mailing list in reply to the patch itself, instead of getting a patch with all the honors already added. :-/ > > -Scott > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] cpufreq: qoriq: Register cooling device based on device tree
On Tue, 2015-11-24 at 14:55 +0800, Jia Hongtao wrote: > Register the qoriq cpufreq driver as a cooling device, based on the > thermal device tree framework. When temperature crosses the passive trip > point cpufreq is used to throttle CPUs. > > Signed-off-by: Jia Hongtao > Reviewed-by: Scott Wood When did I add "Reviewed-by" to this? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V5 30/31] powerpc/mm: Move THP headers around
On 11/24/15, Aneesh Kumar K.V wrote: > Denis Kirjanov writes: > >> On 11/23/15, Aneesh Kumar K.V wrote: >>> We support THP only with book3s_64 and 64K page size. Move >>> THP details to hash64-64k.h to clarify the same. > ... > >>> -static inline void hpte_do_hugepage_flush(struct mm_struct *mm, >>> - unsigned long addr, pmd_t *pmdp, >>> - unsigned long old_pmd) >>> -{ >>> - >>> - WARN(1, "%s called with THP disabled\n", __func__); >> We can't reach this function with huge pages disabled, right? >> Would it be better to use WARN_ON_ONCE? > > Shouldn't matter, if should never get called and if we get called, them > something is really wrong, and mostly need a kernel fix. This will only > happen during devel mistakes. Ok, we can put the BUG() macro then, but as I know Linus doesn't like it :) So WARN() is fine I think > > -aneesh > > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
FCC driver for Motorola MPC82xx - an error found
I was looking for an error on MPC8270 processor 100 Mbps Ethernet FCC port. The port may become locked if it is set to AUTO, while the peer is forced to 100 Mbs full duplex (non AUTO). I was looking for an error in the area of collision handling of the driver. It looks like I found the problem. The error is at line 555: http://lxr.free-electrons.com/source/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c#L555 The problem is that the last descriptor address is not calculated correctly. Instead of last_tx_bd = fep->tx_bd_base + (fpi->tx_ring * sizeof(cbd_t)); The fix should be: last_tx_bd = fep->tx_bd_base + ((fpi->tx_ring-1)* sizeof(cbd_t)); Is it a bug? Thanks, Martin Roth -- View this message in context: http://linuxppc.10917.n7.nabble.com/FCC-driver-for-Motorola-MPC82xx-an-error-found-tp101297.html Sent from the linuxppc-dev mailing list archive at Nabble.com. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/5] powerpc/rtas: Add rtas_call_unlocked()
On Tue, 2015-11-24 at 22:26 +1100, Michael Ellerman wrote: > Most users of RTAS (Run-Time Abstraction Services) use rtas_call(), > which deals with locking as well as endian handling. > > However we have two users outside of rtas.c that can't use rtas_call() > because they have different locking requirements. > > The hotplug CPU code can't take the RTAS lock because the CPU would go > offline with the lock held and no other CPUs would be able to call RTAS > until the CPU came back online. > > The xmon code doesn't want to take the lock because it would risk dead > locking when we are trying to recover from a crash. > > Both sites required multiple patches when we added little endian > support, proving that programmers can't do endian right. > > Although that ship has sailed, we can still clean the code up by > providing an unlocked version of rtas_call() which avoids the need to > open code the logic elsewhere. > > Signed-off-by: Michael Ellerman > > commit 98bd678fc89575d0f4026a3ced3de19d90d1fe72 > Author: Michael Ellerman > Date: Fri May 15 16:40:48 2015 +1000 > > powerpc/rtas: Add rtas_call_unlocked(), make enter_rtas() private ... wut. Obviously I fubared the commit message a bit here while rebasing. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 5/5] powerpc/rtas: Make enter_rtas() private
There are no longer any users of enter_rtas() outside of rtas.c, so make it "private", by moving the declaration inside rtas.c. Hopefully this will encourage people to use one of the wrappers which takes the sharp edges off the RTAS calling sequence. Signed-off-by: Michael Ellerman --- arch/powerpc/include/asm/rtas.h | 1 - arch/powerpc/kernel/rtas.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h index 6db1d6977a0d..51400baa8d48 100644 --- a/arch/powerpc/include/asm/rtas.h +++ b/arch/powerpc/include/asm/rtas.h @@ -334,7 +334,6 @@ extern void (*rtas_flash_term_hook)(int); extern struct rtas_t rtas; -extern void enter_rtas(unsigned long); extern int rtas_token(const char *service); extern int rtas_service_present(const char *service); extern int rtas_call(int token, int, int, int *, ...); diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index f4fa137292c4..28736ff27fea 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -44,6 +44,9 @@ #include #include +/* This is here deliberately so it's only used in this file */ +void enter_rtas(unsigned long); + struct rtas_t rtas = { .lock = __ARCH_SPIN_LOCK_UNLOCKED }; -- 2.5.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 4/5] powerpc/rtas: Use rtas_call_unlocked() in call_rtas_display_status()
Although call_rtas_display_status() does actually want to use the regular RTAS locking, it doesn't want the extra logic that is in rtas_call(), so currently it open codes the logic. Instead we can use rtas_call_unlocked(), after taking the RTAS lock. Signed-off-by: Michael Ellerman --- arch/powerpc/kernel/rtas.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index fcf2d653a6fe..f4fa137292c4 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -93,21 +93,13 @@ static void unlock_rtas(unsigned long flags) */ static void call_rtas_display_status(unsigned char c) { - struct rtas_args *args = &rtas.args; unsigned long s; if (!rtas.base) return; - s = lock_rtas(); - - args->token = cpu_to_be32(10); - args->nargs = cpu_to_be32(1); - args->nret = cpu_to_be32(1); - args->rets = &(args->args[1]); - args->args[0] = cpu_to_be32(c); - - enter_rtas(__pa(args)); + s = lock_rtas(); + rtas_call_unlocked(&rtas.args, 10, 1, 1, NULL, c); unlock_rtas(s); } -- 2.5.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/5] powerpc/pseries: Use rtas_call_unlocked() in pseries hotplug
Avoid open coding the logic by using rtas_call_unlocked(). Signed-off-by: Michael Ellerman --- arch/powerpc/platforms/pseries/hotplug-cpu.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index 62475440fd45..86d2ecacb237 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c @@ -88,13 +88,7 @@ void set_default_offline_state(int cpu) static void rtas_stop_self(void) { - static struct rtas_args args = { - .nargs = 0, - .nret = cpu_to_be32(1), - .rets = &args.args[0], - }; - - args.token = cpu_to_be32(rtas_stop_self_token); + static struct rtas_args args; local_irq_disable(); @@ -102,7 +96,8 @@ static void rtas_stop_self(void) printk("cpu %u (hwid %u) Ready to die...\n", smp_processor_id(), hard_smp_processor_id()); - enter_rtas(__pa(&args)); + + rtas_call_unlocked(&args, rtas_stop_self_token, 0, 1, NULL); panic("Alas, I survived.\n"); } -- 2.5.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/5] powerpc/xmon: Use rtas_call_unlocked() in xmon
Avoid open coding the logic by using rtas_call_unlocked(). Signed-off-by: Michael Ellerman --- arch/powerpc/xmon/xmon.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 786bf01691c9..ff31e70b81e8 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -320,6 +320,7 @@ static inline void disable_surveillance(void) #ifdef CONFIG_PPC_PSERIES /* Since this can't be a module, args should end up below 4GB. */ static struct rtas_args args; + int token; /* * At this point we have got all the cpus we can into @@ -328,17 +329,12 @@ static inline void disable_surveillance(void) * If we did try to take rtas.lock there would be a * real possibility of deadlock. */ - args.token = rtas_token("set-indicator"); - if (args.token == RTAS_UNKNOWN_SERVICE) + token = rtas_token("set-indicator"); + if (token == RTAS_UNKNOWN_SERVICE) return; - args.token = cpu_to_be32(args.token); - args.nargs = cpu_to_be32(3); - args.nret = cpu_to_be32(1); - args.rets = &args.args[3]; - args.args[0] = cpu_to_be32(SURVEILLANCE_TOKEN); - args.args[1] = 0; - args.args[2] = 0; - enter_rtas(__pa(&args)); + + rtas_call_unlocked(&args, token, 3, 1, NULL, SURVEILLANCE_TOKEN, 0, 0); + #endif /* CONFIG_PPC_PSERIES */ } -- 2.5.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/5] powerpc/rtas: Add rtas_call_unlocked()
Most users of RTAS (Run-Time Abstraction Services) use rtas_call(), which deals with locking as well as endian handling. However we have two users outside of rtas.c that can't use rtas_call() because they have different locking requirements. The hotplug CPU code can't take the RTAS lock because the CPU would go offline with the lock held and no other CPUs would be able to call RTAS until the CPU came back online. The xmon code doesn't want to take the lock because it would risk dead locking when we are trying to recover from a crash. Both sites required multiple patches when we added little endian support, proving that programmers can't do endian right. Although that ship has sailed, we can still clean the code up by providing an unlocked version of rtas_call() which avoids the need to open code the logic elsewhere. Signed-off-by: Michael Ellerman commit 98bd678fc89575d0f4026a3ced3de19d90d1fe72 Author: Michael Ellerman Date: Fri May 15 16:40:48 2015 +1000 powerpc/rtas: Add rtas_call_unlocked(), make enter_rtas() private Most users of RTAS (Run-Time Abstraction Services) use rtas_call(), which deals with locking as well as endian handling. However we have two users outside of rtas.c that can't use rtas_call() because they have different locking requirements. The hotplug CPU code can't take the RTAS lock because the CPU would go offline with the lock held and no other CPUs would be able to call RTAS until the CPU came back online. The xmon code doesn't want to take the lock because it would risk dead locking when we are trying to recover from a crash. Both sites required multiple patches when we added little endian support, proving that programmers can't do endian right. Although that ship has sailed, we can still clean the code up by providing an unlocked version of rtas_call() which avoids the need to open code the logic elsewhere. Signed-off-by: Michael Ellerman diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h index b77ef369c0f0..51400baa8d48 100644 --- a/arch/powerpc/include/asm/rtas.h +++ b/arch/powerpc/include/asm/rtas.h @@ -334,10 +334,11 @@ extern void (*rtas_flash_term_hook)(int); extern struct rtas_t rtas; -extern void enter_rtas(unsigned long); extern int rtas_token(const char *service); extern int rtas_service_present(const char *service); extern int rtas_call(int token, int, int, int *, ...); +void rtas_call_unlocked(struct rtas_args *args, int token, int nargs, + int nret, ...); extern void rtas_restart(char *cmd); extern void rtas_power_off(void); extern void rtas_halt(void); diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 5a753fae8265..dda465b62e9b 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -44,6 +44,9 @@ #include #include +/* This is here deliberately so it's only used in this file */ +void enter_rtas(unsigned long); + struct rtas_t rtas = { .lock = __ARCH_SPIN_LOCK_UNLOCKED }; @@ -418,6 +421,36 @@ static char *__fetch_rtas_last_error(char *altbuf) #define get_errorlog_buffer() NULL #endif + +static void +va_rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int nret, + va_list list) +{ + int i; + + args->token = cpu_to_be32(token); + args->nargs = cpu_to_be32(nargs); + args->nret = cpu_to_be32(nret); + args->rets = &(args->args[nargs]); + + for (i = 0; i < nargs; ++i) + args->args[i] = cpu_to_be32(va_arg(list, __u32)); + + for (i = 0; i < nret; ++i) + args->rets[i] = 0; + + enter_rtas(__pa(args)); +} + +void rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int nret, ...) +{ + va_list list; + + va_start(list, nret); + va_rtas_call_unlocked(args, token, nargs, nret, list); + va_end(list); +} + int rtas_call(int token, int nargs, int nret, int *outputs, ...) { va_list list; @@ -431,22 +464,14 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...) return -1; s = lock_rtas(); + + /* We use the global rtas args buffer */ rtas_args = &rtas.args; - rtas_args->token = cpu_to_be32(token); - rtas_args->nargs = cpu_to_be32(nargs); - rtas_args->nret = cpu_to_be32(nret); - rtas_args->rets = &(rtas_args->args[nargs]); va_start(list, outputs); - for (i = 0; i < nargs; ++i) - rtas_args->args[i] = cpu_to_be32(va_arg(list, __u32)); + va_rtas_call_unlocked(rtas_args, token, nargs, nret, list); va_end(list); - for (i = 0; i < nret; ++i) - rtas_args->rets[i] = 0; - - enter_rtas(__pa(rtas_args)); - /* A -1 return code indicates that the last command couldn't be completed due to a hardware error. */ if (be32_to_cpu(rtas_args->rets[0]) == -1) --- arch/p
Re: [PATCH V5 04/31] powerpc/mm: make a separate copy for book3s (part 2)
On 11/23/2015 03:52 PM, Aneesh Kumar K.V wrote: > Keep it seperate to make rebasing easier This is confusing considering the fact that we are in between some renaming/moving of header files, changing the references they had before and so on. Could you please elaborate a bit about what kind of changes this patch has and their purpose. Also if the movement involves multiple parts (like this one), it will be better to have detailed descriptions about each step in the commit message of the first patch itself to see how its being organized in the subsequent patches. > > Acked-by: Scott Wood > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/book3s/32/pgtable.h | 4 ++-- > arch/powerpc/include/asm/book3s/64/pgtable.h | 6 +++--- > arch/powerpc/include/asm/pgtable-ppc32.h | 2 -- > arch/powerpc/include/asm/pgtable-ppc64.h | 4 > 4 files changed, 5 insertions(+), 11 deletions(-) > > diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h > b/arch/powerpc/include/asm/book3s/32/pgtable.h > index 1a58a05be99c..a7738dfbe7e5 100644 > --- a/arch/powerpc/include/asm/book3s/32/pgtable.h > +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h > @@ -1,5 +1,5 @@ > -#ifndef _ASM_POWERPC_PGTABLE_PPC32_H > -#define _ASM_POWERPC_PGTABLE_PPC32_H > +#ifndef _ASM_POWERPC_BOOK3S_32_PGTABLE_H > +#define _ASM_POWERPC_BOOK3S_32_PGTABLE_H I guess this is missing here. -#endif /* _ASM_POWERPC_PGTABLE_PPC32_H */ +#endif /* _ASM_POWERPC_BOOK3S_32_PGTABLE_H */ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V5 30/31] powerpc/mm: Move THP headers around
Denis Kirjanov writes: > On 11/23/15, Aneesh Kumar K.V wrote: >> We support THP only with book3s_64 and 64K page size. Move >> THP details to hash64-64k.h to clarify the same. ... >> -static inline void hpte_do_hugepage_flush(struct mm_struct *mm, >> - unsigned long addr, pmd_t *pmdp, >> - unsigned long old_pmd) >> -{ >> - >> -WARN(1, "%s called with THP disabled\n", __func__); > We can't reach this function with huge pages disabled, right? > Would it be better to use WARN_ON_ONCE? Shouldn't matter, if should never get called and if we get called, them something is really wrong, and mostly need a kernel fix. This will only happen during devel mistakes. -aneesh ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V5 05/31] powerpc/mm: Move hash specific pte width and other defines to book3s
On 11/23/2015 03:52 PM, Aneesh Kumar K.V wrote: > This further make a copy of pte defines to book3s/64/hash*.h. This > remove the dependency on ppc64-4k.h and ppc64-64k.h > These files are pgtable-ppc64-4k.h and pgtable-ppc64-64k.h instead. > Acked-by: Scott Wood > Signed-off-by: Aneesh Kumar K.V > /* Additional PTE bits (don't change without checking asm in hash_low.S) */ > #define _PAGE_SPECIAL0x0400 /* software: special page */ > @@ -74,8 +105,8 @@ static inline unsigned long __rpte_to_hidx(real_pte_t > rpte, unsigned long index) > #define __rpte_to_pte(r) ((r).pte) > #define __rpte_sub_valid(rpte, index) \ > (pte_val(rpte.pte) & (_PAGE_HPTE_SUB0 >> (index))) > - > -/* Trick: we set __end to va + 64k, which happens works for > +/* > + * Trick: we set __end to va + 64k, which happens works for The above change can be avoided in this patch and should be part of a separate cleanup patch. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] cxl: Fix DSI misses when the context owning task exits
Presently when a user-space process issues CXL_IOCTL_START_WORK ioctl we store the pid of the current task_struct and use it to get pointer to the mm_struct of the process, while processing page or segment faults from the capi card. However this causes issues when the thread that had originally issued the start-work ioctl exits in which case the stored pid is no more valid and the cxl driver is unable to handle faults as the mm_struct corresponding to process is no more accessible. This patch fixes this issue by using the mm_struct of the next alive task in the thread group. This is done by iterating over all the tasks in the thread group starting from thread group leader and calling get_task_mm on each one of them. When a valid mm_struct is obtained the pid of the associated task is stored in the context replacing the exiting one for handling future faults. The patch introduces a new function named get_mem_context that checks if the current task pointed to by ctx->pid is dead? If yes it performs the steps described above. Also a new variable cxl_context.glpid is introduced which stores the pid of the thread group leader associated with the context owning task. Reported-by: Matthew R. Ochs Reported-by: Frank Haverkamp Suggested-by: Ian Munsie Signed-off-by: Vaibhav Jain --- drivers/misc/cxl/api.c | 2 +- drivers/misc/cxl/context.c | 6 ++- drivers/misc/cxl/cxl.h | 3 ++ drivers/misc/cxl/fault.c | 129 + drivers/misc/cxl/file.c| 6 ++- 5 files changed, 109 insertions(+), 37 deletions(-) diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c index 103baf0..befac57 100644 --- a/drivers/misc/cxl/api.c +++ b/drivers/misc/cxl/api.c @@ -176,7 +176,7 @@ int cxl_start_context(struct cxl_context *ctx, u64 wed, if (task) { ctx->pid = get_task_pid(task, PIDTYPE_PID); - get_pid(ctx->pid); + ctx->glpid = get_task_pid(task->group_leader, PIDTYPE_PID); kernel = false; } diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c index 2faa127..7b37ad9 100644 --- a/drivers/misc/cxl/context.c +++ b/drivers/misc/cxl/context.c @@ -42,7 +42,7 @@ int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master, spin_lock_init(&ctx->sste_lock); ctx->afu = afu; ctx->master = master; - ctx->pid = NULL; /* Set in start work ioctl */ + ctx->pid = ctx->glpid = NULL; /* Set in start work ioctl */ mutex_init(&ctx->mapping_lock); ctx->mapping = mapping; @@ -211,7 +211,11 @@ int __detach_context(struct cxl_context *ctx) WARN_ON(cxl_detach_process(ctx) && cxl_adapter_link_ok(ctx->afu->adapter)); flush_work(&ctx->fault_work); /* Only needed for dedicated process */ + + /* release the reference to the group leader and mm handling pid */ put_pid(ctx->pid); + put_pid(ctx->glpid); + cxl_ctx_put(); return 0; } diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h index 0cfb9c1..a312cd4 100644 --- a/drivers/misc/cxl/cxl.h +++ b/drivers/misc/cxl/cxl.h @@ -433,6 +433,9 @@ struct cxl_context { unsigned int sst_size, sst_lru; wait_queue_head_t wq; + /* pid of the group leader associated with the pid */ + struct pid *glpid; + /* use mm context associated with this pid for ds faults */ struct pid *pid; spinlock_t lock; /* Protects pending_irq_mask, pending_fault and fault_addr */ /* Only used in PR mode */ diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c index 25a5418..81c3f75 100644 --- a/drivers/misc/cxl/fault.c +++ b/drivers/misc/cxl/fault.c @@ -166,13 +166,92 @@ static void cxl_handle_page_fault(struct cxl_context *ctx, cxl_ack_irq(ctx, CXL_PSL_TFC_An_R, 0); } +/* + * Returns the mm_struct corresponding to the context ctx via ctx->pid + * In case the task has exited we use the task group leader accessible + * via ctx->glpid to find the next task in the thread group that has a + * valid mm_struct associated with it. If a task with valid mm_struct + * is found the ctx->pid is updated to use the task struct for subsequent + * translations. In case no valid mm_struct is found in the task group to + * service the fault a NULL is returned. + */ +static struct mm_struct *get_mem_context(struct cxl_context *ctx) +{ + struct task_struct *task = NULL; + struct mm_struct *mm = NULL; + struct pid *old_pid = ctx->pid; + + if (old_pid == NULL) { + pr_warn("%s: Invalid context for pe=%d\n", +__func__, ctx->pe); + return NULL; + } + + task = get_pid_task(old_pid, PIDTYPE_PID); + + /* +* pid_alive may look racy but this saves us from costly +* get_task_mm when the task is a zombie. In worst case +* we may think a task is alive, which is about to die +
Re: [PATCH V5 30/31] powerpc/mm: Move THP headers around
On 11/23/15, Aneesh Kumar K.V wrote: > We support THP only with book3s_64 and 64K page size. Move > THP details to hash64-64k.h to clarify the same. > > Acked-by: Scott Wood > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/book3s/64/hash-64k.h | 126 + > arch/powerpc/include/asm/book3s/64/hash.h | 223 > +-- > arch/powerpc/include/asm/nohash/64/pgtable.h | 253 > +- > arch/powerpc/mm/hash_native_64.c | 10 + > arch/powerpc/mm/pgtable_64.c | 2 +- > arch/powerpc/platforms/pseries/lpar.c | 10 + > 6 files changed, 201 insertions(+), 423 deletions(-) > > diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h > b/arch/powerpc/include/asm/book3s/64/hash-64k.h > index 20865ca7a179..34eab4542b85 100644 > --- a/arch/powerpc/include/asm/book3s/64/hash-64k.h > +++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h > @@ -170,6 +170,132 @@ static inline int hugepd_ok(hugepd_t hpd) > > #endif /* CONFIG_HUGETLB_PAGE */ > > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > +extern unsigned long pmd_hugepage_update(struct mm_struct *mm, > + unsigned long addr, > + pmd_t *pmdp, > + unsigned long clr, > + unsigned long set); > +static inline char *get_hpte_slot_array(pmd_t *pmdp) > +{ > + /* > + * The hpte hindex is stored in the pgtable whose address is in the > + * second half of the PMD > + * > + * Order this load with the test for pmd_trans_huge in the caller > + */ > + smp_rmb(); > + return *(char **)(pmdp + PTRS_PER_PMD); > + > + > +} > +/* > + * The linux hugepage PMD now include the pmd entries followed by the > address > + * to the stashed pgtable_t. The stashed pgtable_t contains the hpte bits. > + * [ 1 bit secondary | 3 bit hidx | 1 bit valid | 000]. We use one byte > per > + * each HPTE entry. With 16MB hugepage and 64K HPTE we need 256 entries > and > + * with 4K HPTE we need 4096 entries. Both will fit in a 4K pgtable_t. > + * > + * The last three bits are intentionally left to zero. This memory > location > + * are also used as normal page PTE pointers. So if we have any pointers > + * left around while we collapse a hugepage, we need to make sure > + * _PAGE_PRESENT bit of that is zero when we look at them > + */ > +static inline unsigned int hpte_valid(unsigned char *hpte_slot_array, int > index) > +{ > + return (hpte_slot_array[index] >> 3) & 0x1; > +} > + > +static inline unsigned int hpte_hash_index(unsigned char *hpte_slot_array, > +int index) > +{ > + return hpte_slot_array[index] >> 4; > +} > + > +static inline void mark_hpte_slot_valid(unsigned char *hpte_slot_array, > + unsigned int index, unsigned int hidx) > +{ > + hpte_slot_array[index] = hidx << 4 | 0x1 << 3; > +} > + > +/* > + * > + * For core kernel code by design pmd_trans_huge is never run on any > hugetlbfs > + * page. The hugetlbfs page table walking and mangling paths are totally > + * separated form the core VM paths and they're differentiated by > + * VM_HUGETLB being set on vm_flags well before any pmd_trans_huge could > run. > + * > + * pmd_trans_huge() is defined as false at build time if > + * CONFIG_TRANSPARENT_HUGEPAGE=n to optimize away code blocks at build > + * time in such case. > + * > + * For ppc64 we need to differntiate from explicit hugepages from THP, > because > + * for THP we also track the subpage details at the pmd level. We don't do > + * that for explicit huge pages. > + * > + */ > +static inline int pmd_trans_huge(pmd_t pmd) > +{ > + /* > + * leaf pte for huge page, bottom two bits != 00 > + */ > + return (pmd_val(pmd) & 0x3) && (pmd_val(pmd) & _PAGE_THP_HUGE); > +} > + > +static inline int pmd_trans_splitting(pmd_t pmd) > +{ > + if (pmd_trans_huge(pmd)) > + return pmd_val(pmd) & _PAGE_SPLITTING; > + return 0; > +} > + > +static inline int pmd_large(pmd_t pmd) > +{ > + /* > + * leaf pte for huge page, bottom two bits != 00 > + */ > + return ((pmd_val(pmd) & 0x3) != 0x0); > +} > + > +static inline pmd_t pmd_mknotpresent(pmd_t pmd) > +{ > + return __pmd(pmd_val(pmd) & ~_PAGE_PRESENT); > +} > + > +static inline pmd_t pmd_mksplitting(pmd_t pmd) > +{ > + return __pmd(pmd_val(pmd) | _PAGE_SPLITTING); > +} > + > +#define __HAVE_ARCH_PMD_SAME > +static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b) > +{ > + return (((pmd_val(pmd_a) ^ pmd_val(pmd_b)) & ~_PAGE_HPTEFLAGS) == 0); > +} > + > +static inline int __pmdp_test_and_clear_young(struct mm_struct *mm, > + unsigned long addr, pmd_t *pmdp) > +{ > + unsigned long old; > + > + if ((pmd_val(*pmdp) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0) > + return 0; > + old
Re: [PATCH V5 31/31] powerpc/mm: Add a _PAGE_PTE bit
On 11/23/15, Aneesh Kumar K.V wrote: > For a pte entry we will have _PAGE_PTE set. Our pte page > address have a minimum alignment requirement of HUGEPD_SHIFT_MASK + 1. > We use the lower 7 bits to indicate hugepd. ie. > > For pmd and pgd we can find: > 1) _PAGE_PTE set pte -> indicate PTE > 2) bits [2..6] non zero -> indicate hugepd. >They also encode the size. We skip bit 1 (_PAGE_PRESENT). > 3) othewise pointer to next table. > > Acked-by: Scott Wood > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/book3s/64/hash-4k.h | 9 ++--- > arch/powerpc/include/asm/book3s/64/hash-64k.h | 23 +-- > arch/powerpc/include/asm/book3s/64/hash.h | 13 +++-- > arch/powerpc/include/asm/book3s/64/pgtable.h | 3 +-- > arch/powerpc/include/asm/pte-common.h | 5 + > arch/powerpc/mm/hugetlbpage.c | 4 ++-- > arch/powerpc/mm/pgtable.c | 4 > arch/powerpc/mm/pgtable_64.c | 7 +-- > 8 files changed, 35 insertions(+), 33 deletions(-) > > diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h > b/arch/powerpc/include/asm/book3s/64/hash-4k.h > index b4d25529d179..e59832c94609 100644 > --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h > +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h > @@ -116,10 +116,13 @@ static inline int pgd_huge(pgd_t pgd) > static inline int hugepd_ok(hugepd_t hpd) > { > /* > - * hugepd pointer, bottom two bits == 00 and next 4 bits > - * indicate size of table > + * if it is not a pte and have hugepd shift mask > + * set, then it is a hugepd directory pointer >*/ > - return (((hpd.pd & 0x3) == 0x0) && ((hpd.pd & HUGEPD_SHIFT_MASK) != 0)); > + if (!(hpd.pd & _PAGE_PTE) && > + ((hpd.pd & HUGEPD_SHIFT_MASK) != 0)) > + return true; > + return false; then the function can be converted to the bool type as well as all the logical functions below in the patch. > } > #define is_hugepd(hpd) (hugepd_ok(hpd)) > #endif > diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h > b/arch/powerpc/include/asm/book3s/64/hash-64k.h > index 34eab4542b85..957d66d13a97 100644 > --- a/arch/powerpc/include/asm/book3s/64/hash-64k.h > +++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h > @@ -130,25 +130,25 @@ static inline bool __rpte_sub_valid(real_pte_t rpte, > unsigned long index) > static inline int pmd_huge(pmd_t pmd) > { > /* > - * leaf pte for huge page, bottom two bits != 00 > + * leaf pte for huge page >*/ > - return ((pmd_val(pmd) & 0x3) != 0x0); > + return !!(pmd_val(pmd) & _PAGE_PTE); > } > > static inline int pud_huge(pud_t pud) > { > /* > - * leaf pte for huge page, bottom two bits != 00 > + * leaf pte for huge page >*/ > - return ((pud_val(pud) & 0x3) != 0x0); > + return !!(pud_val(pud) & _PAGE_PTE); > } > > static inline int pgd_huge(pgd_t pgd) > { > /* > - * leaf pte for huge page, bottom two bits != 00 > + * leaf pte for huge page >*/ > - return ((pgd_val(pgd) & 0x3) != 0x0); > + return !!(pgd_val(pgd) & _PAGE_PTE); > } > #define pgd_huge pgd_huge > > @@ -236,10 +236,8 @@ static inline void mark_hpte_slot_valid(unsigned char > *hpte_slot_array, > */ > static inline int pmd_trans_huge(pmd_t pmd) > { > - /* > - * leaf pte for huge page, bottom two bits != 00 > - */ > - return (pmd_val(pmd) & 0x3) && (pmd_val(pmd) & _PAGE_THP_HUGE); > + return !!((pmd_val(pmd) & (_PAGE_PTE | _PAGE_THP_HUGE)) == > + (_PAGE_PTE | _PAGE_THP_HUGE)); > } > > static inline int pmd_trans_splitting(pmd_t pmd) > @@ -251,10 +249,7 @@ static inline int pmd_trans_splitting(pmd_t pmd) > > static inline int pmd_large(pmd_t pmd) > { > - /* > - * leaf pte for huge page, bottom two bits != 00 > - */ > - return ((pmd_val(pmd) & 0x3) != 0x0); > + return !!(pmd_val(pmd) & _PAGE_PTE); > } > > static inline pmd_t pmd_mknotpresent(pmd_t pmd) > diff --git a/arch/powerpc/include/asm/book3s/64/hash.h > b/arch/powerpc/include/asm/book3s/64/hash.h > index 6646fd87c64f..d86c95775e02 100644 > --- a/arch/powerpc/include/asm/book3s/64/hash.h > +++ b/arch/powerpc/include/asm/book3s/64/hash.h > @@ -14,11 +14,12 @@ > * We could create separate kernel read-only if we used the 3 PP bits > * combinations that newer processors provide but we currently don't. > */ > -#define _PAGE_PRESENT0x1 /* software: pte contains a > translation */ > -#define _PAGE_USER 0x2 /* matches one of the PP bits */ > +#define _PAGE_PTE0x1 > +#define _PAGE_PRESENT0x2 /* software: pte contains a > translation */ > #define _PAGE_BIT_SWAP_TYPE 2 > -#define _PAGE_EXEC 0x4 /* No execute on POWER4 and newer (we > invert) > */ > -#define _PAGE_GUARDED0x8 > +#define _PAGE_USER 0x
[PATCH V4 3/3] ASoC: fsl_asrc: spba clock is needed by asrc device
ASRC need to enable the spba clock, when sdma is using share peripheral script. In this case, there is two spba master port is used, if don't enable the clock, the spba bus will have arbitration issue, which may cause read/write wrong data from/to ASRC registers Signed-off-by: Shengjiu Wang --- Documentation/devicetree/bindings/sound/fsl,asrc.txt | 5 + sound/soc/fsl/fsl_asrc.c | 14 ++ sound/soc/fsl/fsl_asrc.h | 2 ++ 3 files changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/fsl,asrc.txt b/Documentation/devicetree/bindings/sound/fsl,asrc.txt index b93362a..3e26a94 100644 --- a/Documentation/devicetree/bindings/sound/fsl,asrc.txt +++ b/Documentation/devicetree/bindings/sound/fsl,asrc.txt @@ -25,6 +25,11 @@ Required properties: "mem" Peripheral access clock to access registers. "ipg" Peripheral clock to driver module. "asrck_<0-f>" Clock sources for input and output clock. + "spba"The spba clock is required when ASRC is placed as a + bus slave of the Shared Peripheral Bus and when two + or more bus masters (CPU, DMA or DSP) try to access + it. This property is optional depending on the SoC + design. - big-endian: If this property is absent, the little endian mode will be in use as default. Otherwise, the big endian diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 9f087d4..cf382475 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -859,6 +859,10 @@ static int fsl_asrc_probe(struct platform_device *pdev) return PTR_ERR(asrc_priv->ipg_clk); } + asrc_priv->spba_clk = devm_clk_get(&pdev->dev, "spba"); + if (IS_ERR(asrc_priv->spba_clk)) + dev_warn(&pdev->dev, "failed to get spba clock\n"); + for (i = 0; i < ASRC_CLK_MAX_NUM; i++) { sprintf(tmp, "asrck_%x", i); asrc_priv->asrck_clk[i] = devm_clk_get(&pdev->dev, tmp); @@ -939,6 +943,11 @@ static int fsl_asrc_runtime_resume(struct device *dev) ret = clk_prepare_enable(asrc_priv->ipg_clk); if (ret) goto disable_mem_clk; + if (!IS_ERR(asrc_priv->spba_clk)) { + ret = clk_prepare_enable(asrc_priv->spba_clk); + if (ret) + goto disable_ipg_clk; + } for (i = 0; i < ASRC_CLK_MAX_NUM; i++) { ret = clk_prepare_enable(asrc_priv->asrck_clk[i]); if (ret) @@ -950,6 +959,9 @@ static int fsl_asrc_runtime_resume(struct device *dev) disable_asrck_clk: for (i--; i >= 0; i--) clk_disable_unprepare(asrc_priv->asrck_clk[i]); + if (!IS_ERR(asrc_priv->spba_clk)) + clk_disable_unprepare(asrc_priv->spba_clk); +disable_ipg_clk: clk_disable_unprepare(asrc_priv->ipg_clk); disable_mem_clk: clk_disable_unprepare(asrc_priv->mem_clk); @@ -963,6 +975,8 @@ static int fsl_asrc_runtime_suspend(struct device *dev) for (i = 0; i < ASRC_CLK_MAX_NUM; i++) clk_disable_unprepare(asrc_priv->asrck_clk[i]); + if (!IS_ERR(asrc_priv->spba_clk)) + clk_disable_unprepare(asrc_priv->spba_clk); clk_disable_unprepare(asrc_priv->ipg_clk); clk_disable_unprepare(asrc_priv->mem_clk); diff --git a/sound/soc/fsl/fsl_asrc.h b/sound/soc/fsl/fsl_asrc.h index 4aed63c..68802cd 100644 --- a/sound/soc/fsl/fsl_asrc.h +++ b/sound/soc/fsl/fsl_asrc.h @@ -426,6 +426,7 @@ struct fsl_asrc_pair { * @paddr: physical address to the base address of registers * @mem_clk: clock source to access register * @ipg_clk: clock source to drive peripheral + * @spba_clk: SPBA clock (optional, depending on SoC design) * @asrck_clk: clock sources to driver ASRC internal logic * @lock: spin lock for resource protection * @pair: pair pointers @@ -442,6 +443,7 @@ struct fsl_asrc { unsigned long paddr; struct clk *mem_clk; struct clk *ipg_clk; + struct clk *spba_clk; struct clk *asrck_clk[ASRC_CLK_MAX_NUM]; spinlock_t lock; -- 1.9.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4 0/3] add spba clock for fsl audio IP
On Tue, Nov 24, 2015 at 05:19:31PM +0800, Shengjiu Wang wrote: > add spba clock for fsl audio IP > > Changes in V3 > - add error check for spba clock > > Shengjiu Wang (3): > ASoC: fsl_esai: spba clock is needed by esai device > ASoC: fsl_spdif: spba clk is needed by spdif device > ASoC: fsl_asrc: spba clock is needed by asrc device For all three, Acked-by: Nicolin Chen > > Documentation/devicetree/bindings/sound/fsl,asrc.txt | 5 + > Documentation/devicetree/bindings/sound/fsl,esai.txt | 5 + > Documentation/devicetree/bindings/sound/fsl,spdif.txt | 5 + > sound/soc/fsl/fsl_asrc.c | 14 ++ > sound/soc/fsl/fsl_asrc.h | 2 ++ > sound/soc/fsl/fsl_esai.c | 17 + > sound/soc/fsl/fsl_spdif.c | 19 > +++ > 7 files changed, 67 insertions(+) > > -- > 1.9.1 > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH V4 2/3] ASoC: fsl_spdif: spba clk is needed by spdif device
SPDIF need to enable the spba clock, when sdma is using share peripheral script. In this case, there is two spba master port is used, if don't enable the clock, the spba bus will have arbitration issue, which may cause read/write wrong data from/to SPDIF registers. Signed-off-by: Shengjiu Wang --- Documentation/devicetree/bindings/sound/fsl,spdif.txt | 5 + sound/soc/fsl/fsl_spdif.c | 19 +++ 2 files changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/fsl,spdif.txt b/Documentation/devicetree/bindings/sound/fsl,spdif.txt index b5ee32e..4ca39dd 100644 --- a/Documentation/devicetree/bindings/sound/fsl,spdif.txt +++ b/Documentation/devicetree/bindings/sound/fsl,spdif.txt @@ -27,6 +27,11 @@ Required properties: Transceiver Clock Diagram" of SoC reference manual. It can also be referred to TxClk_Source bit of register SPDIF_STC. + "spba"The spba clock is required when SPDIF is placed as a + bus slave of the Shared Peripheral Bus and when two + or more bus masters (CPU, DMA or DSP) try to access + it. This property is optional depending on the SoC + design. - big-endian: If this property is absent, the native endian mode will be in use as default, or the big endian mode diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 28a8823..151849f 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -88,6 +88,7 @@ struct spdif_mixer_control { * @rxclk: rx clock sources for capture * @coreclk: core clock for register access via DMA * @sysclk: system clock for rx clock rate measurement + * @spbaclk: SPBA clock (optional, depending on SoC design) * @dma_params_tx: DMA parameters for transmit channel * @dma_params_rx: DMA parameters for receive channel */ @@ -106,6 +107,7 @@ struct fsl_spdif_priv { struct clk *rxclk; struct clk *coreclk; struct clk *sysclk; + struct clk *spbaclk; struct snd_dmaengine_dai_dma_data dma_params_tx; struct snd_dmaengine_dai_dma_data dma_params_rx; /* regcache for SRPC */ @@ -474,6 +476,14 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream, return ret; } + if (!IS_ERR(spdif_priv->spbaclk)) { + ret = clk_prepare_enable(spdif_priv->spbaclk); + if (ret) { + dev_err(&pdev->dev, "failed to enable spba clock\n"); + goto err_spbaclk; + } + } + ret = spdif_softreset(spdif_priv); if (ret) { dev_err(&pdev->dev, "failed to soft reset\n"); @@ -515,6 +525,9 @@ disable_txclk: for (i--; i >= 0; i--) clk_disable_unprepare(spdif_priv->txclk[i]); err: + if (!IS_ERR(spdif_priv->spbaclk)) + clk_disable_unprepare(spdif_priv->spbaclk); +err_spbaclk: clk_disable_unprepare(spdif_priv->coreclk); return ret; @@ -548,6 +561,8 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream *substream, spdif_intr_status_clear(spdif_priv); regmap_update_bits(regmap, REG_SPDIF_SCR, SCR_LOW_POWER, SCR_LOW_POWER); + if (!IS_ERR(spdif_priv->spbaclk)) + clk_disable_unprepare(spdif_priv->spbaclk); clk_disable_unprepare(spdif_priv->coreclk); } } @@ -1261,6 +1276,10 @@ static int fsl_spdif_probe(struct platform_device *pdev) return PTR_ERR(spdif_priv->coreclk); } + spdif_priv->spbaclk = devm_clk_get(&pdev->dev, "spba"); + if (IS_ERR(spdif_priv->spbaclk)) + dev_warn(&pdev->dev, "no spba clock in devicetree\n"); + /* Select clock source for rx/tx clock */ spdif_priv->rxclk = devm_clk_get(&pdev->dev, "rxtx1"); if (IS_ERR(spdif_priv->rxclk)) { -- 1.9.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH V4 1/3] ASoC: fsl_esai: spba clock is needed by esai device
ESAI need to enable the spba clock, when sdma is using share peripheral script. In this case, there is two spba master port is used, if don't enable the clock, the spba bus will have arbitration issue, which may cause read/write wrong data from/to ESAI registers. Signed-off-by: Shengjiu Wang --- Documentation/devicetree/bindings/sound/fsl,esai.txt | 5 + sound/soc/fsl/fsl_esai.c | 17 + 2 files changed, 22 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/fsl,esai.txt b/Documentation/devicetree/bindings/sound/fsl,esai.txt index d3b6b5f..cd3ee5d 100644 --- a/Documentation/devicetree/bindings/sound/fsl,esai.txt +++ b/Documentation/devicetree/bindings/sound/fsl,esai.txt @@ -27,6 +27,11 @@ Required properties: derive HCK, SCK and FS. "fsys"The system clock derived from ahb clock used to derive HCK, SCK and FS. + "spba"The spba clock is required when ESAI is placed as a + bus slave of the Shared Peripheral Bus and when two + or more bus masters (CPU, DMA or DSP) try to access + it. This property is optional depending on the SoC + design. - fsl,fifo-depth : The number of elements in the transmit and receive FIFOs. This number is the maximum allowed value for diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index 504e731..054e64b 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -35,6 +35,7 @@ * @coreclk: clock source to access register * @extalclk: esai clock source to derive HCK, SCK and FS * @fsysclk: system clock source to derive HCK, SCK and FS + * @spbaclk: SPBA clock (optional, depending on SoC design) * @fifo_depth: depth of tx/rx FIFO * @slot_width: width of each DAI slot * @slots: number of slots @@ -54,6 +55,7 @@ struct fsl_esai { struct clk *coreclk; struct clk *extalclk; struct clk *fsysclk; + struct clk *spbaclk; u32 fifo_depth; u32 slot_width; u32 slots; @@ -469,6 +471,11 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream, ret = clk_prepare_enable(esai_priv->coreclk); if (ret) return ret; + if (!IS_ERR(esai_priv->spbaclk)) { + ret = clk_prepare_enable(esai_priv->spbaclk); + if (ret) + goto err_spbaclk; + } if (!IS_ERR(esai_priv->extalclk)) { ret = clk_prepare_enable(esai_priv->extalclk); if (ret) @@ -499,6 +506,9 @@ err_fsysclk: if (!IS_ERR(esai_priv->extalclk)) clk_disable_unprepare(esai_priv->extalclk); err_extalck: + if (!IS_ERR(esai_priv->spbaclk)) + clk_disable_unprepare(esai_priv->spbaclk); +err_spbaclk: clk_disable_unprepare(esai_priv->coreclk); return ret; @@ -564,6 +574,8 @@ static void fsl_esai_shutdown(struct snd_pcm_substream *substream, clk_disable_unprepare(esai_priv->fsysclk); if (!IS_ERR(esai_priv->extalclk)) clk_disable_unprepare(esai_priv->extalclk); + if (!IS_ERR(esai_priv->spbaclk)) + clk_disable_unprepare(esai_priv->spbaclk); clk_disable_unprepare(esai_priv->coreclk); } @@ -819,6 +831,11 @@ static int fsl_esai_probe(struct platform_device *pdev) dev_warn(&pdev->dev, "failed to get fsys clock: %ld\n", PTR_ERR(esai_priv->fsysclk)); + esai_priv->spbaclk = devm_clk_get(&pdev->dev, "spba"); + if (IS_ERR(esai_priv->spbaclk)) + dev_warn(&pdev->dev, "failed to get spba clock: %ld\n", + PTR_ERR(esai_priv->spbaclk)); + irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); -- 1.9.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH V4 0/3] add spba clock for fsl audio IP
add spba clock for fsl audio IP Changes in V3 - add error check for spba clock Shengjiu Wang (3): ASoC: fsl_esai: spba clock is needed by esai device ASoC: fsl_spdif: spba clk is needed by spdif device ASoC: fsl_asrc: spba clock is needed by asrc device Documentation/devicetree/bindings/sound/fsl,asrc.txt | 5 + Documentation/devicetree/bindings/sound/fsl,esai.txt | 5 + Documentation/devicetree/bindings/sound/fsl,spdif.txt | 5 + sound/soc/fsl/fsl_asrc.c | 14 ++ sound/soc/fsl/fsl_asrc.h | 2 ++ sound/soc/fsl/fsl_esai.c | 17 + sound/soc/fsl/fsl_spdif.c | 19 +++ 7 files changed, 67 insertions(+) -- 1.9.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V5 03/31] powerpc/mm: make a separate copy for book3s
On 11/23/2015 03:52 PM, Aneesh Kumar K.V wrote: > +++ b/arch/powerpc/include/asm/book3s/pgtable.h > @@ -0,0 +1,10 @@ > +#ifndef _ASM_POWERPC_BOOK3S_PGTABLE_H > +#define _ASM_POWERPC_BOOK3S_PGTABLE_H > + > +#ifdef CONFIG_PPC64 > +#include > +#else > +#include > +#endif > + > +#endif Just as other headers, you may want to change the last line as the following. #endif /* _ASM_POWERPC_BOOK3S_PGTABLE_H */ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V3 1/3] ASoC: fsl_esai: spba clock is needed by esai device
On Tue, Nov 24, 2015 at 12:33:45AM -0800, Nicolin Chen wrote: > On Tue, Nov 24, 2015 at 03:03:28PM +0800, Shengjiu Wang wrote: > > > @@ -469,6 +471,9 @@ static int fsl_esai_startup(struct snd_pcm_substream > > *substream, > > ret = clk_prepare_enable(esai_priv->coreclk); > > if (ret) > > return ret; > > + ret = clk_prepare_enable(esai_priv->spbaclk); > > + if (ret) > > + goto err_spbaclk; > > if (!IS_ERR(esai_priv->extalclk)) { > > ret = clk_prepare_enable(esai_priv->extalclk); > > if (ret) > > Just like for extalclk there is a IS_ERR check out there, there > should be one for spbaclk as well. Otherwise > > root@imx6qdlsolo:~# aplay /unit_tests/audio8k16S.wav > [ 29.956250] Unable to handle kernel paging request at virtual address > fffe > [ 29.963491] pgd = edd98000 > [ 29.966278] [fffe] *pgd=afffd861, *pte=, *ppte= > [ 29.972615] Internal error: Oops: 37 [#1] SMP ARM > [ 29.977327] Modules linked in: > [ 29.980410] CPU: 0 PID: 755 Comm: aplay Not tainted > 4.4.0-rc1-12414-gcc8db17 #250 > [ 29.987899] Hardware name: Freescale i.MX6 SoloX (Device Tree) > [ 29.993738] task: edece780 ti: ed26a000 task.ti: ed26a000 > [ 29.999156] PC is at clk_prepare+0x18/0x38 > [ 30.003268] LR is at mark_held_locks+0x70/0x98 > [ 30.007720] pc : []lr : []psr: 600f0013 > [ 30.007720] sp : ed26bc60 ip : 0003 fp : ed26bc74 > [ 30.019204] r10: eebe4d9c r9 : eeb2e00c r8 : eeb2e00c > [ 30.024435] r7 : fffe r6 : eeb2c500 r5 : eeb2d0c0 r4 : fffe > [ 30.030966] r3 : edece780 r2 : 0001 r1 : 0001 r0 : 0001 > [ 30.037502] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment > none > [ 30.044643] Control: 10c5387d Table: add9804a DAC: 0051 > [ 30.050395] Process aplay (pid: 755, stack limit = 0xed26a210) > Will fix it in next version, and send it out later. best regards wang shengjiu ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V5 02/31] powerpc/mm: move pte headers to book3s directory (part 2)
On 11/23/2015 03:52 PM, Aneesh Kumar K.V wrote: > diff --git a/arch/powerpc/include/asm/pte-hash64-4k.h > b/arch/powerpc/include/asm/book3s/64/hash-4k.h > similarity index 99% > rename from arch/powerpc/include/asm/pte-hash64-4k.h > rename to arch/powerpc/include/asm/book3s/64/hash-4k.h > index c134e809aac3..79750fd3eeb8 100644 > --- a/arch/powerpc/include/asm/pte-hash64-4k.h > +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h > @@ -14,4 +14,3 @@ > > /* shift to put page number into pte */ > #define PTE_RPN_SHIFT(17) > - Is there any specific reason to remove this one line while renaming & moving the header file ? It will be cleaner not to make any changes to the header while moving it around. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] fs_enet: Adjust BDs after tx error
Hi, I have reviewed the code and in my opinion the line last_tx_bd = fep->tx_bd_base + (fpi->tx_ring * sizeof(cbd_t)); should be replaced with last_tx_bd = fep->tx_bd_base + ((fpi->tx_ring-1) * sizeof(cbd_t)); In the original code the last_tx_bd points to location after the last base descriptor end. In the code fix that I propose, the last_tx_bd points to the last descriptor. Am I missing something ? Thanks, Martin -- View this message in context: http://linuxppc.10917.n7.nabble.com/PATCH-fs-enet-Adjust-BDs-after-tx-error-tp37529p101274.html Sent from the linuxppc-dev mailing list archive at Nabble.com. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V3 1/3] ASoC: fsl_esai: spba clock is needed by esai device
On Tue, Nov 24, 2015 at 03:03:28PM +0800, Shengjiu Wang wrote: > @@ -469,6 +471,9 @@ static int fsl_esai_startup(struct snd_pcm_substream > *substream, > ret = clk_prepare_enable(esai_priv->coreclk); > if (ret) > return ret; > + ret = clk_prepare_enable(esai_priv->spbaclk); > + if (ret) > + goto err_spbaclk; > if (!IS_ERR(esai_priv->extalclk)) { > ret = clk_prepare_enable(esai_priv->extalclk); > if (ret) Just like for extalclk there is a IS_ERR check out there, there should be one for spbaclk as well. Otherwise root@imx6qdlsolo:~# aplay /unit_tests/audio8k16S.wav [ 29.956250] Unable to handle kernel paging request at virtual address fffe [ 29.963491] pgd = edd98000 [ 29.966278] [fffe] *pgd=afffd861, *pte=, *ppte= [ 29.972615] Internal error: Oops: 37 [#1] SMP ARM [ 29.977327] Modules linked in: [ 29.980410] CPU: 0 PID: 755 Comm: aplay Not tainted 4.4.0-rc1-12414-gcc8db17 #250 [ 29.987899] Hardware name: Freescale i.MX6 SoloX (Device Tree) [ 29.993738] task: edece780 ti: ed26a000 task.ti: ed26a000 [ 29.999156] PC is at clk_prepare+0x18/0x38 [ 30.003268] LR is at mark_held_locks+0x70/0x98 [ 30.007720] pc : []lr : []psr: 600f0013 [ 30.007720] sp : ed26bc60 ip : 0003 fp : ed26bc74 [ 30.019204] r10: eebe4d9c r9 : eeb2e00c r8 : eeb2e00c [ 30.024435] r7 : fffe r6 : eeb2c500 r5 : eeb2d0c0 r4 : fffe [ 30.030966] r3 : edece780 r2 : 0001 r1 : 0001 r0 : 0001 [ 30.037502] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 30.044643] Control: 10c5387d Table: add9804a DAC: 0051 [ 30.050395] Process aplay (pid: 755, stack limit = 0xed26a210) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2] selfttest/powerpc: Add memory page migration tests
On 11/24/15, Anshuman Khandual wrote: > This adds two tests for memory page migration. One for normal page > migration which works for both 4K or 64K base page size kernel and > the other one is for 16MB huge page migration which will work both > 4K or 64K base page sized 16MB huge pages as and when we support > huge page migration. > > Signed-off-by: Anshuman Khandual > --- > Changes in V2: > - Changed the script to accommodate review comments from Michael > - Disabled huge page migration test till it is supported on POWER > > tools/testing/selftests/powerpc/mm/Makefile| 14 +- > .../selftests/powerpc/mm/hugepage-migration.c | 30 > tools/testing/selftests/powerpc/mm/migration.h | 196 > + > .../testing/selftests/powerpc/mm/page-migration.c | 33 > tools/testing/selftests/powerpc/mm/run_mmtests | 104 +++ > 5 files changed, 372 insertions(+), 5 deletions(-) > create mode 100644 tools/testing/selftests/powerpc/mm/hugepage-migration.c > create mode 100644 tools/testing/selftests/powerpc/mm/migration.h > create mode 100644 tools/testing/selftests/powerpc/mm/page-migration.c > create mode 100755 tools/testing/selftests/powerpc/mm/run_mmtests > > diff --git a/tools/testing/selftests/powerpc/mm/Makefile > b/tools/testing/selftests/powerpc/mm/Makefile > index ee179e2..c482614 100644 > --- a/tools/testing/selftests/powerpc/mm/Makefile > +++ b/tools/testing/selftests/powerpc/mm/Makefile > @@ -1,12 +1,16 @@ > noarg: > $(MAKE) -C ../ > > -TEST_PROGS := hugetlb_vs_thp_test subpage_prot > -TEST_FILES := tempfile > +TEST_PROGS := run_mmtests > +TEST_FILES := hugetlb_vs_thp_test > +TEST_FILES += subpage_prot > +TEST_FILES += tempfile > +TEST_FILES += hugepage-migration > +TEST_FILES += page-migration > > -all: $(TEST_PROGS) $(TEST_FILES) > +all: $(TEST_FILES) > > -$(TEST_PROGS): ../harness.c > +$(TEST_FILES): ../harness.c > > include ../../lib.mk > > @@ -14,4 +18,4 @@ tempfile: > dd if=/dev/zero of=tempfile bs=64k count=1 > > clean: > - rm -f $(TEST_PROGS) tempfile > + rm -f $(TEST_FILES) > diff --git a/tools/testing/selftests/powerpc/mm/hugepage-migration.c > b/tools/testing/selftests/powerpc/mm/hugepage-migration.c > new file mode 100644 > index 000..b60bc10 > --- /dev/null > +++ b/tools/testing/selftests/powerpc/mm/hugepage-migration.c > @@ -0,0 +1,30 @@ > +/* > + * Copyright (C) 2015, Anshuman Khandual, IBM Corporation. > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms of the GNU General Public License version 2 as published > + * by the Free Software Foundation. > + */ > +#include "migration.h" > + > +static int hugepage_migration(void) > +{ > + int ret = 0; > + > + if ((unsigned long)getpagesize() == 0x1000) > + printf("Running on base page size 4K\n"); > + > + if ((unsigned long)getpagesize() == 0x1) > + printf("Running on base page size 64K\n"); > + > + ret = test_huge_migration(16 * MEM_MB); > + ret = test_huge_migration(256 * MEM_MB); > + ret = test_huge_migration(512 * MEM_MB); > + > + return ret; > +} > + > +int main(void) > +{ > + return test_harness(hugepage_migration, "hugepage_migration"); > +} > diff --git a/tools/testing/selftests/powerpc/mm/migration.h > b/tools/testing/selftests/powerpc/mm/migration.h > new file mode 100644 > index 000..2f9e3f9 > --- /dev/null > +++ b/tools/testing/selftests/powerpc/mm/migration.h > @@ -0,0 +1,196 @@ > +/* > + * Copyright (C) 2015, Anshuman Khandual, IBM Corporation. > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms of the GNU General Public License version 2 as published > + * by the Free Software Foundation. > + */ > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "utils.h" > + > +#define HPAGE_OFF0 > +#define HPAGE_ON 1 > + > +#define PAGE_SHIFT_4K12 > +#define PAGE_SHIFT_64K 16 > +#define PAGE_SIZE_4K 0x1000 > +#define PAGE_SIZE_64K0x1 > +#define PAGE_SIZE_HUGE 16UL * 1024 * 1024 > + > +#define MEM_GB 1024UL * 1024 * 1024 > +#define MEM_MB 1024UL * 1024 > +#define MME_KB 1024UL > + > +#define PMAP_FILE"/proc/self/pagemap" > +#define PMAP_PFN 0x007FUL > +#define PMAP_SIZE8 > + > +#define SOFT_OFFLINE "/sys/devices/system/memory/soft_offline_page" > +#define HARD_OFFLINE "/sys/devices/system/memory/hard_offline_page" > + > +#define MMAP_LENGTH (256 * MEM_MB) > +#define MMAP_ADDR(void *)(0x0UL) > +#define MMAP_PROT(PROT_READ | PROT_WRITE) > +#define MMAP_FLAGS (MAP_PRIVATE | MAP_ANONYMOUS) > +#define MMAP_FLAGS_HUGE (MAP_SHARED) > + > +#define FILE_NAME"huge/hugepagefile" > + > +static void write_buffer(char *addr, unsigned long length) > +{ > + unsigned long i; > + > + for (i = 0; i < length; i++) > + *(addr +