[PATCH v3 3/3] powerpc/mm/book3s64/radix: Off-load TLB invalidations to host when !GTSE
From: Nicholas Piggin When platform doesn't support GTSE, let TLB invalidation requests for radix guests be off-loaded to the host using H_RPT_INVALIDATE hcall. Signed-off-by: Nicholas Piggin Signed-off-by: Bharata B Rao [hcall wrapper, error path handling and renames] --- .../include/asm/book3s/64/tlbflush-radix.h| 15 arch/powerpc/include/asm/hvcall.h | 34 +++- arch/powerpc/include/asm/plpar_wrappers.h | 52 arch/powerpc/mm/book3s64/radix_tlb.c | 82 +-- 4 files changed, 175 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h index ca8db193ae38..94439e0cefc9 100644 --- a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h +++ b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h @@ -2,10 +2,25 @@ #ifndef _ASM_POWERPC_TLBFLUSH_RADIX_H #define _ASM_POWERPC_TLBFLUSH_RADIX_H +#include + struct vm_area_struct; struct mm_struct; struct mmu_gather; +static inline u64 psize_to_rpti_pgsize(unsigned long psize) +{ + if (psize == MMU_PAGE_4K) + return H_RPTI_PAGE_4K; + if (psize == MMU_PAGE_64K) + return H_RPTI_PAGE_64K; + if (psize == MMU_PAGE_2M) + return H_RPTI_PAGE_2M; + if (psize == MMU_PAGE_1G) + return H_RPTI_PAGE_1G; + return H_RPTI_PAGE_ALL; +} + static inline int mmu_get_ap(int psize) { return mmu_psize_defs[psize].ap; diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h index e90c073e437e..43486e773bd6 100644 --- a/arch/powerpc/include/asm/hvcall.h +++ b/arch/powerpc/include/asm/hvcall.h @@ -305,7 +305,8 @@ #define H_SCM_UNBIND_ALL0x3FC #define H_SCM_HEALTH0x400 #define H_SCM_PERFORMANCE_STATS 0x418 -#define MAX_HCALL_OPCODE H_SCM_PERFORMANCE_STATS +#define H_RPT_INVALIDATE 0x448 +#define MAX_HCALL_OPCODE H_RPT_INVALIDATE /* Scope args for H_SCM_UNBIND_ALL */ #define H_UNBIND_SCOPE_ALL (0x1) @@ -389,6 +390,37 @@ #define PROC_TABLE_RADIX 0x04 #define PROC_TABLE_GTSE0x01 +/* + * Defines for + * H_RPT_INVALIDATE - Invalidate RPT translation lookaside information. + */ + +/* Type of translation to invalidate (type) */ +#define H_RPTI_TYPE_NESTED 0x0001 /* Invalidate nested guest partition-scope */ +#define H_RPTI_TYPE_TLB0x0002 /* Invalidate TLB */ +#define H_RPTI_TYPE_PWC0x0004 /* Invalidate Page Walk Cache */ +/* Invalidate Process Table Entries if H_RPTI_TYPE_NESTED is clear */ +#define H_RPTI_TYPE_PRT0x0008 +/* Invalidate Partition Table Entries if H_RPTI_TYPE_NESTED is set */ +#define H_RPTI_TYPE_PAT0x0008 +#define H_RPTI_TYPE_ALL(H_RPTI_TYPE_TLB | H_RPTI_TYPE_PWC | \ +H_RPTI_TYPE_PRT) +#define H_RPTI_TYPE_NESTED_ALL (H_RPTI_TYPE_TLB | H_RPTI_TYPE_PWC | \ +H_RPTI_TYPE_PAT) + +/* Invalidation targets (target) */ +#define H_RPTI_TARGET_CMMU 0x01 /* All virtual processors in the partition */ +#define H_RPTI_TARGET_CMMU_LOCAL 0x02 /* Current virtual processor */ +/* All nest/accelerator agents in use by the partition */ +#define H_RPTI_TARGET_NMMU 0x04 + +/* Page size mask (page sizes) */ +#define H_RPTI_PAGE_4K 0x01 +#define H_RPTI_PAGE_64K0x02 +#define H_RPTI_PAGE_2M 0x04 +#define H_RPTI_PAGE_1G 0x08 +#define H_RPTI_PAGE_ALL (-1UL) + #ifndef __ASSEMBLY__ #include diff --git a/arch/powerpc/include/asm/plpar_wrappers.h b/arch/powerpc/include/asm/plpar_wrappers.h index 4497c8afb573..4293c5d2ddf4 100644 --- a/arch/powerpc/include/asm/plpar_wrappers.h +++ b/arch/powerpc/include/asm/plpar_wrappers.h @@ -334,6 +334,51 @@ static inline long plpar_get_cpu_characteristics(struct h_cpu_char_result *p) return rc; } +/* + * Wrapper to H_RPT_INVALIDATE hcall that handles return values appropriately + * + * - Returns H_SUCCESS on success + * - For H_BUSY return value, we retry the hcall. + * - For any other hcall failures, attempt a full flush once before + * resorting to BUG(). + * + * Note: This hcall is expected to fail only very rarely. The correct + * error recovery of killing the process/guest will be eventually + * needed. + */ +static inline long pseries_rpt_invalidate(u32 pid, u64 target, u64 type, + u64 page_sizes, u64 start, u64 end) +{ + long rc; + unsigned long all; + + while (true) { + rc = plpar_hcall_norets(H_RPT_INVALIDATE, pid, target, type, + page_sizes, start, end); + if (rc == H_BUSY) { + cpu_relax(); + continue; + } else if (rc == H_SUCCESS) + return rc; + + /* Flush request failed, try with a
[PATCH v3 2/3] powerpc/pseries: H_REGISTER_PROC_TBL should ask for GTSE only if enabled
H_REGISTER_PROC_TBL asks for GTSE by default. GTSE flag bit should be set only when GTSE is supported. Signed-off-by: Bharata B Rao Reviewed-by: Aneesh Kumar K.V --- arch/powerpc/platforms/pseries/lpar.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index fd26f3d21d7b..f82569a505f1 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -1680,9 +1680,11 @@ static int pseries_lpar_register_process_table(unsigned long base, if (table_size) flags |= PROC_TABLE_NEW; - if (radix_enabled()) - flags |= PROC_TABLE_RADIX | PROC_TABLE_GTSE; - else + if (radix_enabled()) { + flags |= PROC_TABLE_RADIX; + if (mmu_has_feature(MMU_FTR_GTSE)) + flags |= PROC_TABLE_GTSE; + } else flags |= PROC_TABLE_HPT_SLB; for (;;) { rc = plpar_hcall_norets(H_REGISTER_PROC_TBL, flags, base, -- 2.21.3
[PATCH v3 1/3] powerpc/mm: Enable radix GTSE only if supported.
Make GTSE an MMU feature and enable it by default for radix. However for guest, conditionally enable it if hypervisor supports it via OV5 vector. Let prom_init ask for radix GTSE only if the support exists. Having GTSE as an MMU feature will make it easy to enable radix without GTSE. Currently radix assumes GTSE is enabled by default. Signed-off-by: Bharata B Rao Reviewed-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/mmu.h| 4 arch/powerpc/kernel/dt_cpu_ftrs.c | 1 + arch/powerpc/kernel/prom_init.c | 13 - arch/powerpc/mm/init_64.c | 5 - 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index f4ac25d4df05..884d51995934 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h @@ -28,6 +28,9 @@ * Individual features below. */ +/* Guest Translation Shootdown Enable */ +#define MMU_FTR_GTSE ASM_CONST(0x1000) + /* * Support for 68 bit VA space. We added that from ISA 2.05 */ @@ -173,6 +176,7 @@ enum { #endif #ifdef CONFIG_PPC_RADIX_MMU MMU_FTR_TYPE_RADIX | + MMU_FTR_GTSE | #ifdef CONFIG_PPC_KUAP MMU_FTR_RADIX_KUAP | #endif /* CONFIG_PPC_KUAP */ diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c index a0edeb391e3e..ac650c233cd9 100644 --- a/arch/powerpc/kernel/dt_cpu_ftrs.c +++ b/arch/powerpc/kernel/dt_cpu_ftrs.c @@ -336,6 +336,7 @@ static int __init feat_enable_mmu_radix(struct dt_cpu_feature *f) #ifdef CONFIG_PPC_RADIX_MMU cur_cpu_spec->mmu_features |= MMU_FTR_TYPE_RADIX; cur_cpu_spec->mmu_features |= MMU_FTRS_HASH_BASE; + cur_cpu_spec->mmu_features |= MMU_FTR_GTSE; cur_cpu_spec->cpu_user_features |= PPC_FEATURE_HAS_MMU; return 1; diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 90c604d00b7d..cbc605cfdec0 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -1336,12 +1336,15 @@ static void __init prom_check_platform_support(void) } } - if (supported.radix_mmu && supported.radix_gtse && - IS_ENABLED(CONFIG_PPC_RADIX_MMU)) { - /* Radix preferred - but we require GTSE for now */ - prom_debug("Asking for radix with GTSE\n"); + if (supported.radix_mmu && IS_ENABLED(CONFIG_PPC_RADIX_MMU)) { + /* Radix preferred - Check if GTSE is also supported */ + prom_debug("Asking for radix\n"); ibm_architecture_vec.vec5.mmu = OV5_FEAT(OV5_MMU_RADIX); - ibm_architecture_vec.vec5.radix_ext = OV5_FEAT(OV5_RADIX_GTSE); + if (supported.radix_gtse) + ibm_architecture_vec.vec5.radix_ext = + OV5_FEAT(OV5_RADIX_GTSE); + else + prom_debug("Radix GTSE isn't supported\n"); } else if (supported.hash_mmu) { /* Default to hash mmu (if we can) */ prom_debug("Asking for hash\n"); diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index bc73abf0bc25..152aa0200cef 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c @@ -407,12 +407,15 @@ static void __init early_check_vec5(void) if (!(vec5[OV5_INDX(OV5_RADIX_GTSE)] & OV5_FEAT(OV5_RADIX_GTSE))) { pr_warn("WARNING: Hypervisor doesn't support RADIX with GTSE\n"); - } + cur_cpu_spec->mmu_features &= ~MMU_FTR_GTSE; + } else + cur_cpu_spec->mmu_features |= MMU_FTR_GTSE; /* Do radix anyway - the hypervisor said we had to */ cur_cpu_spec->mmu_features |= MMU_FTR_TYPE_RADIX; } else if (mmu_supported == OV5_FEAT(OV5_MMU_HASH)) { /* Hypervisor only supports hash - disable radix */ cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; + cur_cpu_spec->mmu_features &= ~MMU_FTR_GTSE; } } -- 2.21.3
[PATCH v3 0/3] Off-load TLB invalidations to host for !GTSE
Hypervisor may choose not to enable Guest Translation Shootdown Enable (GTSE) option for the guest. When GTSE isn't ON, the guest OS isn't permitted to use instructions like tblie and tlbsync directly, but is expected to make hypervisor calls to get the TLB flushed. This series enables the TLB flush routines in the radix code to off-load TLB flushing to hypervisor via the newly proposed hcall H_RPT_INVALIDATE. To easily check the availability of GTSE, it is made an MMU feature. The OV5 handling and H_REGISTER_PROC_TBL hcall are changed to handle GTSE as an optionally available feature and to not assume GTSE when radix support is available. The actual hcall implementation for KVM isn't included in this patchset and will be posted separately. Changes in v3 = - Fixed a bug in the hcall wrapper code where we were missing setting H_RPTI_TYPE_NESTED while retrying the failed flush request with a full flush for the nested case. - s/psize_to_h_rpti/psize_to_rpti_pgsize v2: https://lore.kernel.org/linuxppc-dev/20200626131000.5207-1-bhar...@linux.ibm.com/T/#t Bharata B Rao (2): powerpc/mm: Enable radix GTSE only if supported. powerpc/pseries: H_REGISTER_PROC_TBL should ask for GTSE only if enabled Nicholas Piggin (1): powerpc/mm/book3s64/radix: Off-load TLB invalidations to host when !GTSE .../include/asm/book3s/64/tlbflush-radix.h| 15 arch/powerpc/include/asm/hvcall.h | 34 +++- arch/powerpc/include/asm/mmu.h| 4 + arch/powerpc/include/asm/plpar_wrappers.h | 52 arch/powerpc/kernel/dt_cpu_ftrs.c | 1 + arch/powerpc/kernel/prom_init.c | 13 +-- arch/powerpc/mm/book3s64/radix_tlb.c | 82 +-- arch/powerpc/mm/init_64.c | 5 +- arch/powerpc/platforms/pseries/lpar.c | 8 +- 9 files changed, 197 insertions(+), 17 deletions(-) -- 2.21.3
Re: objtool clac/stac handling change..
Le 03/07/2020 à 05:17, Michael Ellerman a écrit : Christophe Leroy writes: Le 02/07/2020 à 15:34, Michael Ellerman a écrit : Linus Torvalds writes: On Wed, Jul 1, 2020 at 12:59 PM Al Viro wrote: On Wed, Jul 01, 2020 at 12:04:36PM -0700, Linus Torvalds wrote: That's actually for the access granting. Shutting the access down ends up always doing the same thing anyway.. #define user_read_access_endprevent_current_read_from_user #define user_write_access_end prevent_current_write_to_user static inline void prevent_current_read_from_user(void) { prevent_user_access(NULL, NULL, ~0UL, KUAP_CURRENT_READ); } static inline void prevent_current_write_to_user(void) { prevent_user_access(NULL, NULL, ~0UL, KUAP_CURRENT_WRITE); } and prevent_user_access() has instances that do care about the direction... Go and look closer. There are three cases: (a) the 32-bit book3s case. It looks like it cares, but when you look closer, it ends up not caring about the read side, and saving the "which address to I allow user writes to" in current->thread.kuap (b) the nohash 32-bit case - doesn't care (c) the 64-bit books case - doesn't care So yes, in the (a) case it does make a difference between reads and writes, but at least as far as I can tell, it ignores the read case, and has code to avoid the unnecessary "disable user writes" case when there was only a read enable done. Yeah that's my understanding too. Christophe is the expert on that code so I'll defer to him if I'm wrong. Now, it's possible that I'm wrong, but the upshot of that is that even on powerpc, I think that if we just made the rule be that "taking a user exception should automatically do the 'user_access_end()' for us" is trivial. I think we can do something to make it work. We don't have an equivalent of x86's ex_handler_uaccess(), so it's not quite as easy as whacking a user_access_end() in there. Isn't it something easy to do in bad_page_fault() ? We'd need to do it there at least. But I'm not convinced that's the only place we'd need to do it. We could theoretically take a machine check on a user access, and those are handled differently on each sub-(sub-sub)-platform, and I think all or most of them don't call bad_page_fault(). Indeed, it needs to be done everywhere we do regs->nip = extable_fixup(entry) There are half a dozen of places that do that, in additional of bad_page_fault() that's mainly machine checks, also kprobe. I think we can create a fixup_exception() function which takes regs and entry as parameters and does the nip fixup and kuap closuse. Not exactly a call to user_access_end() but altering regs->kuap so that user access is not restored on exception exit. Yes. Probably the simplest option for us is to just handle it in our unsafe_op_wrap(). I'll try and come up with something tomorrow. unsafe_op_wrap() is not used anymore for unsafe_put_user() as we are now using asm goto. Sure, but we could change it back to use unsafe_op_wrap(). But the whole purpose of using goto in unsafe_???_user() is to allow the use of asm goto. See explanations in commit https://github.com/linuxppc/linux/commit/1bd4403d86a1c06cb6cc9ac87664a0c9d3413d51#diff-eba084de047bb8a9087dac10c06f44bc I did a quick hack to do that and see no difference in the generated code, but your commit adding put_user_goto() did show better code generation, so possibly it depends on compiler version, or my example wasn't complicated enough (filldir()). Yes as explained above it should remove the error checking in the caller so your exemple was most likely too trivial. Christophe
[Bug 208181] BUG: KASAN: stack-out-of-bounds in strcmp+0x58/0xd8
https://bugzilla.kernel.org/show_bug.cgi?id=208181 --- Comment #15 from Christophe Leroy (christophe.le...@csgroup.eu) --- Ah yes, having init_text above the 24 bits limit might be a problem for function calls. I'm surprised that the linker doesn't complain. Anyway, it is not a problem in itself, and it's unrelated to this bug. -- You are receiving this mail because: You are watching the assignee of the bug.
[PATCH v2 3/3] powerpc/64s/hash: disable subpage_prot syscall by default
The subpage_prot syscall was added for specialised system software (Lx86) that has been discontinued for about 7 years, and is not thought to be used elsewhere, so disable it by default. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 7 +-- arch/powerpc/configs/powernv_defconfig | 1 - arch/powerpc/configs/pseries_defconfig | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 9fa23eb320ff..04c6ca17661a 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -833,13 +833,16 @@ config FORCE_MAX_ZONEORDER this in mind when choosing a value for this option. config PPC_SUBPAGE_PROT - bool "Support setting protections for 4k subpages" + bool "Support setting protections for 4k subpages (subpage_prot syscall)" + default n depends on PPC_BOOK3S_64 && PPC_64K_PAGES help - This option adds support for a system call to allow user programs + This option adds support for system call to allow user programs to set access permissions (read/write, readonly, or no access) on the 4k subpages of each 64k page. + If unsure, say N here. + config PPC_COPRO_BASE bool diff --git a/arch/powerpc/configs/powernv_defconfig b/arch/powerpc/configs/powernv_defconfig index 2de9aadf0f50..afc0dd73a1e6 100644 --- a/arch/powerpc/configs/powernv_defconfig +++ b/arch/powerpc/configs/powernv_defconfig @@ -64,7 +64,6 @@ CONFIG_HWPOISON_INJECT=m CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_DEFERRED_STRUCT_PAGE_INIT=y CONFIG_PPC_64K_PAGES=y -CONFIG_PPC_SUBPAGE_PROT=y CONFIG_SCHED_SMT=y CONFIG_PM=y CONFIG_HOTPLUG_PCI=y diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index dfa4a726333b..894e8d85fb48 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig @@ -57,7 +57,6 @@ CONFIG_MEMORY_HOTREMOVE=y CONFIG_KSM=y CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_PPC_64K_PAGES=y -CONFIG_PPC_SUBPAGE_PROT=y CONFIG_SCHED_SMT=y CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_RPA=m -- 2.23.0
[PATCH v2 2/3] powerpc/64s: remove PROT_SAO support
ISA v3.1 does not support the SAO storage control attribute required to implement PROT_SAO. PROT_SAO was used by specialised system software (Lx86) that has been discontinued for about 7 years, and is not thought to be used elsewhere, so removal should not cause problems. We rather remove it than keep support for older processors, because live migrating guest partitions to newer processors may not be possible if SAO is in use (or worse allowed with silent races). - PROT_SAO stays in the uapi header so code using it would still build. - arch_validate_prot() is removed, the generic version rejects PROT_SAO so applications would get a failure at mmap() time. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/pgtable.h | 8 ++-- arch/powerpc/include/asm/cputable.h | 10 ++--- arch/powerpc/include/asm/kvm_book3s_64.h | 5 ++- arch/powerpc/include/asm/mman.h | 26 ++-- arch/powerpc/include/asm/nohash/64/pgtable.h | 2 - arch/powerpc/include/uapi/asm/mman.h | 2 +- arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +- arch/powerpc/mm/book3s64/hash_utils.c | 2 - include/linux/mm.h| 2 - include/trace/events/mmflags.h| 2 - mm/ksm.c | 4 -- tools/testing/selftests/powerpc/mm/.gitignore | 1 - tools/testing/selftests/powerpc/mm/Makefile | 4 +- tools/testing/selftests/powerpc/mm/prot_sao.c | 42 --- 14 files changed, 20 insertions(+), 92 deletions(-) delete mode 100644 tools/testing/selftests/powerpc/mm/prot_sao.c diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index 25c3cb8272c0..8e9aca96143b 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -20,9 +20,13 @@ #define _PAGE_RW (_PAGE_READ | _PAGE_WRITE) #define _PAGE_RWX (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC) #define _PAGE_PRIVILEGED 0x8 /* kernel access only */ -#define _PAGE_SAO 0x00010 /* Strong access order */ + +#define _PAGE_CACHE_CTL0x00030 /* Bits for the folowing cache modes */ + /* No bits set is normal cacheable memory */ + /* 0x00010 unused, is SAO bit on radix POWER9 */ #define _PAGE_NON_IDEMPOTENT 0x00020 /* non idempotent memory */ #define _PAGE_TOLERANT 0x00030 /* tolerant memory, cache inhibited */ + #define _PAGE_DIRTY0x00080 /* C: page changed */ #define _PAGE_ACCESSED 0x00100 /* R: page referenced */ /* @@ -825,8 +829,6 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, return hash__set_pte_at(mm, addr, ptep, pte, percpu); } -#define _PAGE_CACHE_CTL(_PAGE_SAO | _PAGE_NON_IDEMPOTENT | _PAGE_TOLERANT) - #define pgprot_noncached pgprot_noncached static inline pgprot_t pgprot_noncached(pgprot_t prot) { diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index bac2252c839e..87284750535d 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h @@ -191,7 +191,7 @@ static inline void cpu_feature_keys_init(void) { } #define CPU_FTR_SPURR LONG_ASM_CONST(0x0100) #define CPU_FTR_DSCR LONG_ASM_CONST(0x0200) #define CPU_FTR_VSXLONG_ASM_CONST(0x0400) -#define CPU_FTR_SAOLONG_ASM_CONST(0x0800) +// Free LONG_ASM_CONST(0x0800) #define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x1000) #define CPU_FTR_UNALIGNED_LD_STD LONG_ASM_CONST(0x2000) #define CPU_FTR_ASYM_SMT LONG_ASM_CONST(0x4000) @@ -435,7 +435,7 @@ static inline void cpu_feature_keys_init(void) { } CPU_FTR_MMCRA | CPU_FTR_SMT | \ CPU_FTR_COHERENT_ICACHE | \ CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ - CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT | \ + CPU_FTR_DSCR | CPU_FTR_ASYM_SMT | \ CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_CFAR | CPU_FTR_HVMODE | \ CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR | CPU_FTR_DABRX | CPU_FTR_PKEY) @@ -444,7 +444,7 @@ static inline void cpu_feature_keys_init(void) { } CPU_FTR_MMCRA | CPU_FTR_SMT | \ CPU_FTR_COHERENT_ICACHE | \ CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ - CPU_FTR_DSCR | CPU_FTR_SAO | \ + CPU_FTR_DSCR | \ CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \ @@ -455,7 +455,7 @@ static inline void
[PATCH v2 1/3] powerpc: remove stale calc_vm_prot_bits comment
This comment is wrong, we wouldn't use calc_vm_prot_bits here because we are being called by calc_vm_prot_bits to modify its behaviour. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/mman.h | 4 1 file changed, 4 deletions(-) diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h index d610c2e07b28..4ba303ea27f5 100644 --- a/arch/powerpc/include/asm/mman.h +++ b/arch/powerpc/include/asm/mman.h @@ -13,10 +13,6 @@ #include #include -/* - * This file is included by linux/mman.h, so we can't use cacl_vm_prot_bits() - * here. How important is the optimization? - */ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, unsigned long pkey) { -- 2.23.0
[PATCH v2 0/3] remove PROT_SAO support and disable
It was suggested that I post this to a wider audience on account of the change to supported userspace features in patch 2 particularly. Thanks, Nick Nicholas Piggin (3): powerpc: remove stale calc_vm_prot_bits comment powerpc/64s: remove PROT_SAO support powerpc/64s/hash: disable subpage_prot syscall by default arch/powerpc/Kconfig | 7 +++- arch/powerpc/configs/powernv_defconfig| 1 - arch/powerpc/configs/pseries_defconfig| 1 - arch/powerpc/include/asm/book3s/64/pgtable.h | 8 ++-- arch/powerpc/include/asm/cputable.h | 10 ++--- arch/powerpc/include/asm/kvm_book3s_64.h | 5 ++- arch/powerpc/include/asm/mman.h | 30 ++--- arch/powerpc/include/asm/nohash/64/pgtable.h | 2 - arch/powerpc/include/uapi/asm/mman.h | 2 +- arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +- arch/powerpc/mm/book3s64/hash_utils.c | 2 - include/linux/mm.h| 2 - include/trace/events/mmflags.h| 2 - mm/ksm.c | 4 -- tools/testing/selftests/powerpc/mm/.gitignore | 1 - tools/testing/selftests/powerpc/mm/Makefile | 4 +- tools/testing/selftests/powerpc/mm/prot_sao.c | 42 --- 17 files changed, 25 insertions(+), 100 deletions(-) delete mode 100644 tools/testing/selftests/powerpc/mm/prot_sao.c -- 2.23.0
[Bug 208181] BUG: KASAN: stack-out-of-bounds in strcmp+0x58/0xd8
https://bugzilla.kernel.org/show_bug.cgi?id=208181 --- Comment #14 from Erhard F. (erhar...@mailbox.org) --- Ah, I've overlooked that... To set CONFIG_DATA_SHIFT=25 I needed to set ADVANCED_OPTIONS=y, DATA_SHIFT_BOOL=y first. But with CONFIG_DATA_SHIFT=25 this kernel won't boot at all. OpenFirmware shows for a brief moment that the kernel gets loaded and then I get dropped back to OF console. OpenFirmware tells me: Invalid memory access at %SRR0: a000 %SRR1: -- You are receiving this mail because: You are watching the assignee of the bug.
Re: [PATCH 6/8] powerpc/pseries: implement paravirt qspinlocks for SPLPAR
On 7/2/20 12:15 PM, kernel test robot wrote: Hi Nicholas, I love your patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on tip/locking/core v5.8-rc3 next-20200702] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/powerpc-queued-spinlocks-and-rwlocks/20200702-155158 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-allyesconfig (attached as .config) compiler: powerpc64-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): kernel/locking/lock_events.c:61:16: warning: no previous prototype for 'lockevent_read' [-Wmissing-prototypes] 61 | ssize_t __weak lockevent_read(struct file *file, char __user *user_buf, |^~ kernel/locking/lock_events.c: In function 'skip_lockevent': kernel/locking/lock_events.c:126:12: error: implicit declaration of function 'pv_is_native_spin_unlock' [-Werror=implicit-function-declaration] 126 | pv_on = !pv_is_native_spin_unlock(); |^~~~ cc1: some warnings being treated as errors vim +/pv_is_native_spin_unlock +126 kernel/locking/lock_events.c I think you will need to add the following into arch/powerpc/include/asm/qspinlock_paravirt.h: static inline pv_is_native_spin_unlock(void) { return !is_shared_processor(); } Cheers, Longman
Re: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
Excerpts from Zefan Li's message of July 1, 2020 5:10 pm: >> static void *__vmalloc_node(unsigned long size, unsigned long align, >> -gfp_t gfp_mask, pgprot_t prot, >> -int node, const void *caller); >> +gfp_t gfp_mask, pgprot_t prot, unsigned long vm_flags, >> +int node, const void *caller); >> static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, >> - pgprot_t prot, int node) >> + pgprot_t prot, unsigned int page_shift, >> + int node) >> { >> struct page **pages; >> +unsigned long addr = (unsigned long)area->addr; >> +unsigned long size = get_vm_area_size(area); >> +unsigned int page_order = page_shift - PAGE_SHIFT; >> unsigned int nr_pages, array_size, i; >> const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO; >> const gfp_t alloc_mask = gfp_mask | __GFP_NOWARN; >> const gfp_t highmem_mask = (gfp_mask & (GFP_DMA | GFP_DMA32)) ? >> -0 : >> -__GFP_HIGHMEM; >> +0 : __GFP_HIGHMEM; >> >> -nr_pages = get_vm_area_size(area) >> PAGE_SHIFT; >> +nr_pages = size >> page_shift; > > while try out this patchset, we encountered a BUG_ON in account_kernel_stack() > in kernel/fork.c. > > BUG_ON(vm->nr_pages != THREAD_SIZE / PAGE_SIZE); > > which obviously should be updated accordingly. Thanks for finding that. We may have to change this around a bit so nr_pages still appears to be in PAGE_SIZE units for anybody looking. Thanks, Nick
[PATCH] powerpc/powernv: machine check handler for POWER10
Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/mce.h| 1 + arch/powerpc/kernel/dt_cpu_ftrs.c | 10 arch/powerpc/kernel/mce.c | 1 + arch/powerpc/kernel/mce_power.c | 84 +++ 4 files changed, 96 insertions(+) diff --git a/arch/powerpc/include/asm/mce.h b/arch/powerpc/include/asm/mce.h index 376a395daf32..30b5b03fb11d 100644 --- a/arch/powerpc/include/asm/mce.h +++ b/arch/powerpc/include/asm/mce.h @@ -86,6 +86,7 @@ enum MCE_TlbErrorType { enum MCE_UserErrorType { MCE_USER_ERROR_INDETERMINATE = 0, MCE_USER_ERROR_TLBIE = 1, + MCE_USER_ERROR_SCV = 2, }; enum MCE_RaErrorType { diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c index 3a409517c031..12cec6919a1a 100644 --- a/arch/powerpc/kernel/dt_cpu_ftrs.c +++ b/arch/powerpc/kernel/dt_cpu_ftrs.c @@ -67,6 +67,7 @@ struct dt_cpu_feature { extern long __machine_check_early_realmode_p8(struct pt_regs *regs); extern long __machine_check_early_realmode_p9(struct pt_regs *regs); +extern long __machine_check_early_realmode_p10(struct pt_regs *regs); static int hv_mode; @@ -450,6 +451,14 @@ static int __init feat_enable_pmu_power9(struct dt_cpu_feature *f) return 1; } +static int __init feat_enable_mce_power10(struct dt_cpu_feature *f) +{ + cur_cpu_spec->platform = "power10"; + cur_cpu_spec->machine_check_early = __machine_check_early_realmode_p10; + + return 1; +} + static int __init feat_enable_tm(struct dt_cpu_feature *f) { #ifdef CONFIG_PPC_TRANSACTIONAL_MEM @@ -638,6 +647,7 @@ static struct dt_cpu_feature_match __initdata {"group-start-register", feat_enable, 0}, {"pc-relative-addressing", feat_enable, 0}, {"machine-check-power9", feat_enable_mce_power9, 0}, + {"machine-check-power10", feat_enable_mce_power10, 0}, {"performance-monitor-power9", feat_enable_pmu_power9, 0}, {"event-based-branch-v3", feat_enable, 0}, {"random-number-generator", feat_enable, 0}, diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c index fd90c0eda229..4f96f3c24797 100644 --- a/arch/powerpc/kernel/mce.c +++ b/arch/powerpc/kernel/mce.c @@ -370,6 +370,7 @@ void machine_check_print_event_info(struct machine_check_event *evt, static const char *mc_user_types[] = { "Indeterminate", "tlbie(l) invalid", + "scv invalid", }; static const char *mc_ra_types[] = { "Indeterminate", diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c index c3b522bff9b4..b7e173754a2e 100644 --- a/arch/powerpc/kernel/mce_power.c +++ b/arch/powerpc/kernel/mce_power.c @@ -243,6 +243,45 @@ static const struct mce_ierror_table mce_p9_ierror_table[] = { MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true }, { 0, 0, 0, 0, 0, 0, 0 } }; +static const struct mce_ierror_table mce_p10_ierror_table[] = { +{ 0x081c, 0x0004, true, + MCE_ERROR_TYPE_UE, MCE_UE_ERROR_IFETCH, MCE_ECLASS_HARDWARE, + MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true }, +{ 0x081c, 0x0008, true, + MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_PARITY, MCE_ECLASS_HARD_INDETERMINATE, + MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true }, +{ 0x081c, 0x000c, true, + MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE, + MCE_INITIATOR_CPU, MCE_SEV_WARNING, true }, +{ 0x081c, 0x0010, true, + MCE_ERROR_TYPE_ERAT, MCE_ERAT_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE, + MCE_INITIATOR_CPU, MCE_SEV_WARNING, true }, +{ 0x081c, 0x0014, true, + MCE_ERROR_TYPE_TLB, MCE_TLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE, + MCE_INITIATOR_CPU, MCE_SEV_WARNING, true }, +{ 0x081c, 0x0018, true, + MCE_ERROR_TYPE_UE, MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH, MCE_ECLASS_HARDWARE, + MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true }, +{ 0x081c, 0x001c, true, + MCE_ERROR_TYPE_RA, MCE_RA_ERROR_IFETCH_FOREIGN, MCE_ECLASS_SOFTWARE, + MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true }, +{ 0x081c, 0x0808, true, + MCE_ERROR_TYPE_USER,MCE_USER_ERROR_SCV, MCE_ECLASS_SOFTWARE, + MCE_INITIATOR_CPU, MCE_SEV_WARNING, true }, +{ 0x081c, 0x080c, true, + MCE_ERROR_TYPE_RA, MCE_RA_ERROR_IFETCH, MCE_ECLASS_SOFTWARE, + MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true }, +{ 0x081c, 0x0810, true, + MCE_ERROR_TYPE_RA, MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH, MCE_ECLASS_SOFTWARE, + MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true }, +{ 0x081c, 0x0814, false, + MCE_ERROR_TYPE_RA, MCE_RA_ERROR_STORE, MCE_ECLASS_HARDWARE, + MCE_INITIATOR_CPU, MCE_SEV_FATAL, false }, /* ASYNC is fatal */ +{ 0x081c, 0x081c, true, MCE_ECLASS_HARDWARE, + MCE_ERROR_TYPE_RA, MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN, +
Re: [PATCH 1/2] dt-bindings: sound: fsl-asoc-card: add new compatible for I2S slave
Hi Mark, Le 02/07/2020 à 16:31, Mark Brown a écrit : > On Thu, Jul 02, 2020 at 04:11:14PM +0200, Arnaud Ferraris wrote: >> fsl-asoc-card currently doesn't support generic codecs with the SoC >> acting as I2S slave. >> >> This commit adds a new `fsl,imx-audio-i2s-slave` for this use-case, as >> well as the following mandatory properties: > > Why require that the CODEC be clock master here - why not make this > configurable, reusing the properties from the generic and audio graph > cards? This is partly because I'm not sure how to do it (yet), but mostly because I don't have the hardware to test this (the 2 CODECs present on my only i.MX6 board are both clock master) Regards, Arnaud
Re: [PATCH 17/20] block: rename generic_make_request to submit_bio_noacct
On 2020/7/1 16:59, Christoph Hellwig wrote: > generic_make_request has always been very confusingly misnamed, so rename > it to submit_bio_noacct to make it clear that it is submit_bio minus > accounting and a few checks. > > Signed-off-by: Christoph Hellwig I will miss generic_make_request(). Anyway, if it is decided, for bcache part, Acked-by: Coly Li > --- > Documentation/block/biodoc.rst| 2 +- > .../fault-injection/fault-injection.rst | 2 +- > Documentation/trace/ftrace.rst| 4 +-- > block/bio.c | 14 > block/blk-core.c | 32 +-- > block/blk-crypto-fallback.c | 2 +- > block/blk-crypto.c| 2 +- > block/blk-merge.c | 2 +- > block/blk-throttle.c | 4 +-- > block/bounce.c| 2 +- > drivers/block/drbd/drbd_int.h | 6 ++-- > drivers/block/drbd/drbd_main.c| 2 +- > drivers/block/drbd/drbd_receiver.c| 2 +- > drivers/block/drbd/drbd_req.c | 2 +- > drivers/block/drbd/drbd_worker.c | 2 +- > drivers/block/pktcdvd.c | 2 +- > drivers/lightnvm/pblk-read.c | 2 +- > drivers/md/bcache/bcache.h| 2 +- > drivers/md/bcache/btree.c | 2 +- > drivers/md/bcache/request.c | 7 ++-- > drivers/md/dm-cache-target.c | 6 ++-- > drivers/md/dm-clone-target.c | 10 +++--- > drivers/md/dm-crypt.c | 6 ++-- > drivers/md/dm-delay.c | 2 +- > drivers/md/dm-era-target.c| 2 +- > drivers/md/dm-integrity.c | 4 +-- > drivers/md/dm-mpath.c | 2 +- > drivers/md/dm-raid1.c | 2 +- > drivers/md/dm-snap-persistent.c | 2 +- > drivers/md/dm-snap.c | 6 ++-- > drivers/md/dm-thin.c | 4 +-- > drivers/md/dm-verity-target.c | 2 +- > drivers/md/dm-writecache.c| 2 +- > drivers/md/dm-zoned-target.c | 2 +- > drivers/md/dm.c | 10 +++--- > drivers/md/md-faulty.c| 4 +-- > drivers/md/md-linear.c| 4 +-- > drivers/md/md-multipath.c | 4 +-- > drivers/md/raid0.c| 8 ++--- > drivers/md/raid1.c| 14 > drivers/md/raid10.c | 28 > drivers/md/raid5.c| 10 +++--- > drivers/nvme/host/multipath.c | 2 +- > include/linux/blkdev.h| 2 +- > 44 files changed, 115 insertions(+), 118 deletions(-) > [snipped] > diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c > index 140927ebf41e9a..c28537a489bc10 100644 > --- a/drivers/lightnvm/pblk-read.c > +++ b/drivers/lightnvm/pblk-read.c > @@ -320,7 +320,7 @@ void pblk_submit_read(struct pblk *pblk, struct bio *bio) > split_bio = bio_split(bio, nr_secs * NR_PHY_IN_LOG, GFP_KERNEL, > _bio_set); > bio_chain(split_bio, bio); > - generic_make_request(bio); > + submit_bio_noacct(bio); > > /* New bio contains first N sectors of the previous one, so >* we can continue to use existing rqd, but we need to shrink > diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h > index 221e0191b6870f..3c708e8b5e2d34 100644 > --- a/drivers/md/bcache/bcache.h > +++ b/drivers/md/bcache/bcache.h > @@ -929,7 +929,7 @@ static inline void closure_bio_submit(struct cache_set *c, > bio_endio(bio); > return; > } > - generic_make_request(bio); > + submit_bio_noacct(bio); > } > > /* > diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c > index 6548a601edf0e4..d5c51e33204679 100644 > --- a/drivers/md/bcache/btree.c > +++ b/drivers/md/bcache/btree.c > @@ -959,7 +959,7 @@ static struct btree *mca_alloc(struct cache_set *c, > struct btree_op *op, > * bch_btree_node_get - find a btree node in the cache and lock it, reading > it > * in from disk if necessary. > * > - * If IO is necessary and running under generic_make_request, returns > -EAGAIN. > + * If IO is necessary and running under submit_bio_noacct, returns -EAGAIN. > * > * The btree node will have either a read or a write lock held, depending on > * level and op->lock. > diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c > index fc5702b10074d6..dd012ebface012 100644 > --- a/drivers/md/bcache/request.c > +++
Re: [PATCH 16/20] block: move ->make_request_fn to struct block_device_operations
On 2020/7/1 16:59, Christoph Hellwig wrote: > The make_request_fn is a little weird in that it sits directly in > struct request_queue instead of an operation vector. Replace it with > a block_device_operations method called submit_bio (which describes much > better what it does). Also remove the request_queue argument to it, as > the queue can be derived pretty trivially from the bio. > > Signed-off-by: Christoph Hellwig For the bcache part, Acked-by: Coly Li > --- > Documentation/block/biodoc.rst| 2 +- > .../block/writeback_cache_control.rst | 2 +- > arch/m68k/emu/nfblock.c | 5 +- > arch/xtensa/platforms/iss/simdisk.c | 5 +- > block/blk-cgroup.c| 2 +- > block/blk-core.c | 53 +++ > block/blk-mq.c| 10 ++-- > block/blk.h | 2 - > drivers/block/brd.c | 5 +- > drivers/block/drbd/drbd_int.h | 2 +- > drivers/block/drbd/drbd_main.c| 9 ++-- > drivers/block/drbd/drbd_req.c | 2 +- > drivers/block/null_blk_main.c | 17 -- > drivers/block/pktcdvd.c | 11 ++-- > drivers/block/ps3vram.c | 15 +++--- > drivers/block/rsxx/dev.c | 7 ++- > drivers/block/umem.c | 5 +- > drivers/block/zram/zram_drv.c | 11 ++-- > drivers/lightnvm/core.c | 8 +-- > drivers/lightnvm/pblk-init.c | 12 +++-- > drivers/md/bcache/request.c | 4 +- > drivers/md/bcache/request.h | 4 +- > drivers/md/bcache/super.c | 23 +--- > drivers/md/dm.c | 23 > drivers/md/md.c | 5 +- > drivers/nvdimm/blk.c | 5 +- > drivers/nvdimm/btt.c | 5 +- > drivers/nvdimm/pmem.c | 5 +- > drivers/nvme/host/core.c | 1 + > drivers/nvme/host/multipath.c | 5 +- > drivers/nvme/host/nvme.h | 1 + > drivers/s390/block/dcssblk.c | 9 ++-- > drivers/s390/block/xpram.c| 6 +-- > include/linux/blk-mq.h| 2 +- > include/linux/blkdev.h| 7 +-- > include/linux/lightnvm.h | 3 +- > 36 files changed, 153 insertions(+), 140 deletions(-) > [snipped] > diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c > index 7acf024e99f351..fc5702b10074d6 100644 > --- a/drivers/md/bcache/request.c > +++ b/drivers/md/bcache/request.c > @@ -1158,7 +1158,7 @@ static void quit_max_writeback_rate(struct cache_set *c, > > /* Cached devices - read & write stuff */ > > -blk_qc_t cached_dev_make_request(struct request_queue *q, struct bio *bio) > +blk_qc_t cached_dev_submit_bio(struct bio *bio) > { > struct search *s; > struct bcache_device *d = bio->bi_disk->private_data; > @@ -1291,7 +1291,7 @@ static void flash_dev_nodata(struct closure *cl) > continue_at(cl, search_free, NULL); > } > > -blk_qc_t flash_dev_make_request(struct request_queue *q, struct bio *bio) > +blk_qc_t flash_dev_submit_bio(struct bio *bio) > { > struct search *s; > struct closure *cl; > diff --git a/drivers/md/bcache/request.h b/drivers/md/bcache/request.h > index bb005c93dd7218..82b38366a95deb 100644 > --- a/drivers/md/bcache/request.h > +++ b/drivers/md/bcache/request.h > @@ -37,10 +37,10 @@ unsigned int bch_get_congested(const struct cache_set *c); > void bch_data_insert(struct closure *cl); > > void bch_cached_dev_request_init(struct cached_dev *dc); > -blk_qc_t cached_dev_make_request(struct request_queue *q, struct bio *bio); > +blk_qc_t cached_dev_submit_bio(struct bio *bio); > > void bch_flash_dev_request_init(struct bcache_device *d); > -blk_qc_t flash_dev_make_request(struct request_queue *q, struct bio *bio); > +blk_qc_t flash_dev_submit_bio(struct bio *bio); > > extern struct kmem_cache *bch_search_cache; > > diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c > index 21aa168113d30b..de13f6e916966d 100644 > --- a/drivers/md/bcache/super.c > +++ b/drivers/md/bcache/super.c > @@ -680,7 +680,16 @@ static int ioctl_dev(struct block_device *b, fmode_t > mode, > return d->ioctl(d, mode, cmd, arg); > } > > -static const struct block_device_operations bcache_ops = { > +static const struct block_device_operations bcache_cached_ops = { > + .submit_bio = cached_dev_submit_bio, > + .open = open_dev, > + .release= release_dev, > + .ioctl = ioctl_dev, > + .owner = THIS_MODULE, > +}; > + > +static const struct block_device_operations bcache_flash_ops
Re: [PATCH 09/20] bcache: stop setting ->queuedata
On 2020/7/1 16:59, Christoph Hellwig wrote: > Nothing in bcache actually uses the ->queuedata field. > > Signed-off-by: Christoph Hellwig Acked-by: Coly Li > --- > drivers/md/bcache/super.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c > index 2014016f9a60d3..21aa168113d30b 100644 > --- a/drivers/md/bcache/super.c > +++ b/drivers/md/bcache/super.c > @@ -876,7 +876,6 @@ static int bcache_device_init(struct bcache_device *d, > unsigned int block_size, > return -ENOMEM; > > d->disk->queue = q; > - q->queuedata= d; > q->backing_dev_info->congested_data = d; > q->limits.max_hw_sectors= UINT_MAX; > q->limits.max_sectors = UINT_MAX; >
[PATCH 4/4] ASoC: fsl_asrc: swap input and output clocks in capture mode
The input clock is the reference clock we need to convert the stream to, which therefore has to be the clock of the origin stream/device. When the stream is bi-directional and we want ASRC to act on both directions, we need to swap the input and output clocks between the playback and capture streams. As some of the clocks have different ID's depending on whether they are used as input or output, this requires adding a new function to find the output clock ID corresponding to a given input clock. Signed-off-by: Arnaud Ferraris --- sound/soc/fsl/fsl_asrc.c | 50 ++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 65e7307a3df0..5aeab1fbcdd9 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -506,6 +506,50 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) return fsl_asrc_set_ideal_ratio(pair, inrate, outrate); } +/** + * Select the output clock corresponding to a given input clock (and vice-versa) + * + * If we want to setup a capture channel, the input and output clocks have to + * be swapped. + * However, even if most of the clocks have the same index when used as input + * or output, some of them (ESAI, SSI* and SPDIF) are different: + * - the TX output clock has the index of the corresponding RX input clock + * - the RX output clock has the index of the corresponding TX input clock + * + * This function makes sure that we use the proper clock index when swapping + * the input and output clocks. + */ +static enum asrc_outclk fsl_asrc_get_capture_clock(enum asrc_inclk inclk) +{ + enum asrc_outclk outclk; + + switch (inclk) { + case INCLK_ESAI_RX: + case INCLK_SSI1_RX: + case INCLK_SSI2_RX: + case INCLK_SPDIF_RX: + outclk = inclk + 0x8; + break; + case INCLK_SSI3_RX: + outclk = OUTCLK_SSI3_RX; + break; + case INCLK_ESAI_TX: + case INCLK_SSI1_TX: + case INCLK_SSI2_TX: + case INCLK_SPDIF_TX: + outclk = inclk - 0x8; + break; + case INCLK_SSI3_TX: + outclk = OUTCLK_SSI3_TX; + break; + default: + outclk = inclk; + break; + } + + return outclk; +} + /** * Start the assigned ASRC pair * @@ -604,15 +648,17 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream, config.pair = pair->index; config.channel_num = channels; - config.inclk = asrc->inclk; - config.outclk = asrc->outclk; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + config.inclk = asrc->inclk; + config.outclk = asrc->outclk; config.input_format = params_format(params); config.output_format = asrc->asrc_format; config.input_sample_rate = rate; config.output_sample_rate = asrc->asrc_rate; } else { + config.inclk = fsl_asrc_get_capture_clock(asrc->outclk); + config.outclk = fsl_asrc_get_capture_clock(asrc->inclk); config.input_format = asrc->asrc_format; config.output_format = params_format(params); config.input_sample_rate = asrc->asrc_rate; -- 2.27.0
[PATCH 3/4] ASoC: fsl_asrc: always use ratio for conversion
Even when not in "Ideal Ratio" mode, ASRC can use an internally measured ratio, which greatly improves the conversion quality. This patch ensures we always use at least the internal ratio. Signed-off-by: Arnaud Ferraris --- sound/soc/fsl/fsl_asrc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 75df220e4b51..65e7307a3df0 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -451,7 +451,7 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) regmap_update_bits(asrc->regmap, REG_ASRCTR, ASRCTR_ATSi_MASK(index), ASRCTR_ATS(index)); regmap_update_bits(asrc->regmap, REG_ASRCTR, - ASRCTR_USRi_MASK(index), 0); + ASRCTR_USRi_MASK(index), ASRCTR_USR(index)); /* Set the input and output clock sources */ regmap_update_bits(asrc->regmap, REG_ASRCSR, @@ -493,8 +493,7 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) /* Enable Ideal Ratio mode */ regmap_update_bits(asrc->regmap, REG_ASRCTR, - ASRCTR_IDRi_MASK(index) | ASRCTR_USRi_MASK(index), - ASRCTR_IDR(index) | ASRCTR_USR(index)); + ASRCTR_IDRi_MASK(index), ASRCTR_IDR(index)); fsl_asrc_sel_proc(inrate, outrate, _proc, _proc); -- 2.27.0
[PATCH 2/4] ASoC: fsl_asrc: allow using arbitrary input and output clocks
fsl_asrc currently uses hardcoded input and output clocks, preventing its use for anything other than S/PDIF output. This patch adds the ability to select any clock as input or output (by using new DT properties), making it possible to use this peripheral in a more advanced way. Signed-off-by: Arnaud Ferraris --- sound/soc/fsl/fsl_asrc.c| 18 -- sound/soc/fsl/fsl_asrc_common.h | 3 +++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 95f6a9617b0b..75df220e4b51 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -605,8 +605,8 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream, config.pair = pair->index; config.channel_num = channels; - config.inclk = INCLK_NONE; - config.outclk = OUTCLK_ASRCK1_CLK; + config.inclk = asrc->inclk; + config.outclk = asrc->outclk; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { config.input_format = params_format(params); @@ -1067,6 +1067,20 @@ static int fsl_asrc_probe(struct platform_device *pdev) asrc->channel_avail = 10; + ret = of_property_read_u32(np, "fsl,asrc-input-clock", + >inclk); + if (ret) { + dev_info(>dev, "no input clock specified, using none\n"); + asrc->inclk = INCLK_NONE; + } + + ret = of_property_read_u32(np, "fsl,asrc-output-clock", + >outclk); + if (ret) { + dev_info(>dev, "no output clock specified, using default\n"); + asrc->outclk = OUTCLK_ASRCK1_CLK; + } + ret = of_property_read_u32(np, "fsl,asrc-rate", >asrc_rate); if (ret) { diff --git a/sound/soc/fsl/fsl_asrc_common.h b/sound/soc/fsl/fsl_asrc_common.h index 7e1c13ca37f1..1468878fbaca 100644 --- a/sound/soc/fsl/fsl_asrc_common.h +++ b/sound/soc/fsl/fsl_asrc_common.h @@ -89,6 +89,9 @@ struct fsl_asrc { struct fsl_asrc_pair *pair[PAIR_CTX_NUM]; unsigned int channel_avail; + enum asrc_inclk inclk; + enum asrc_outclk outclk; + int asrc_rate; snd_pcm_format_t asrc_format; bool use_edma; -- 2.27.0
[PATCH 1/4] dt-bindings: sound: fsl, asrc: add properties to select in/out clocks
The ASRC peripheral accepts a wide range of input and output clocks, but no mechanism exists at the moment to define those as they are currently hardcoded in the driver. This commit adds new properties allowing selection of arbitrary input and output clocks. Signed-off-by: Arnaud Ferraris --- Documentation/devicetree/bindings/sound/fsl,asrc.txt | 8 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/fsl,asrc.txt b/Documentation/devicetree/bindings/sound/fsl,asrc.txt index 998b4c8a7f78..e26ce9bad617 100644 --- a/Documentation/devicetree/bindings/sound/fsl,asrc.txt +++ b/Documentation/devicetree/bindings/sound/fsl,asrc.txt @@ -55,6 +55,12 @@ Optional properties: Ends, which can replace the fsl,asrc-width. The value is 2 (S16_LE), or 6 (S24_LE). + - fsl,asrc-input-clock : Input clock ID, defaults to INCLK_NONE + (see enum asrc_inclk in fsl_asrc.h) + + - fsl,asrc-output-clock : Output clock ID, defaults to OUTCLK_ASRCK1_CLK + (see enum asrc_outclk in fsl_asrc.h) + Example: asrc: asrc@2034000 { @@ -77,4 +83,6 @@ asrc: asrc@2034000 { "txa", "txb", "txc"; fsl,asrc-rate = <48000>; fsl,asrc-width = <16>; + fsl,asrc-input-clock = <0x3>; + fsl,asrc-output-clock = <0xf>; }; -- 2.27.0
[PATCH 0/4] ASoC: fsl_asrc: allow selecting arbitrary clocks
The current ASRC driver hardcodes the input and output clocks used for sample rate conversions. In order to allow greater flexibility and to cover more use cases, it would be preferable to select the clocks using device-tree properties. This series also fix register configuration and clock assignment so conversion can be conducted effectively in both directions with a good quality. Arnaud Ferraris (4): dt-bindings: sound: fsl,asrc: add properties to select in/out clocks ASoC: fsl_asrc: allow using arbitrary input and output clocks ASoC: fsl_asrc: always use ratio for conversion ASoC: fsl_asrc: swap input and output clocks in capture mode Documentation/devicetree/bindings/sound/fsl,asrc.txt | 8 sound/soc/fsl/fsl_asrc.c | 69 - sound/soc/fsl/fsl_asrc_common.h | 3 +++ 3 files changed, 75 insertions(+), 5 deletions(-)
[PATCH 2/2] ASoC: fsl-asoc-card: add support for generic I2S slave use-case
This commit implements support for generic codecs with the SoC acting as I2S slave, by implementing the new `fsl,imx-audio-i2s-slave` compatible and related properties. This is particularly useful when using a Bluetooth controller acting as I2S master, but other simple or dummy codecs might benefit from it too. Signed-off-by: Arnaud Ferraris --- sound/soc/fsl/fsl-asoc-card.c | 46 ++- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 57ea1b072326..6076b963c873 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -166,12 +166,15 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream, return 0; /* Specific configurations of DAIs starts from here */ - ret = snd_soc_dai_set_sysclk(asoc_rtd_to_cpu(rtd, 0), cpu_priv->sysclk_id[tx], -cpu_priv->sysclk_freq[tx], -cpu_priv->sysclk_dir[tx]); - if (ret && ret != -ENOTSUPP) { - dev_err(dev, "failed to set sysclk for cpu dai\n"); - return ret; + if (cpu_priv->sysclk_freq[tx] > 0) { + ret = snd_soc_dai_set_sysclk(asoc_rtd_to_cpu(rtd, 0), +cpu_priv->sysclk_id[tx], +cpu_priv->sysclk_freq[tx], +cpu_priv->sysclk_dir[tx]); + if (ret && ret != -ENOTSUPP) { + dev_err(dev, "failed to set sysclk for cpu dai\n"); + return ret; + } } if (cpu_priv->slot_width) { @@ -475,11 +478,14 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card) return 0; } - ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id, -codec_priv->mclk_freq, SND_SOC_CLOCK_IN); - if (ret && ret != -ENOTSUPP) { - dev_err(dev, "failed to set sysclk in %s\n", __func__); - return ret; + if (codec_priv->mclk_freq > 0) { + ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id, +codec_priv->mclk_freq, +SND_SOC_CLOCK_IN); + if (ret && ret != -ENOTSUPP) { + dev_err(dev, "failed to set sysclk in %s\n", __func__); + return ret; + } } return 0; @@ -620,6 +626,23 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->cpu_priv.slot_width = 32; priv->card.dapm_routes = audio_map_tx; priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx); + } else if (of_device_is_compatible(np, "fsl,imx-audio-i2s-slave")) { + ret = of_property_read_string(np, "audio-codec-dai-name", + _dai_name); + if (ret) { + dev_err(>dev, "failed to get codec DAI name\n"); + ret = -EINVAL; + goto asrc_fail; + } + ret = of_property_read_u32(np, "audio-slot-width", + >cpu_priv.slot_width); + if (ret) { + dev_err(>dev, "failed to get slot width\n"); + ret = -EINVAL; + goto asrc_fail; + } + priv->card.set_bias_level = NULL; + priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; } else { dev_err(>dev, "unknown Device Tree compatible\n"); ret = -EINVAL; @@ -763,6 +786,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) static const struct of_device_id fsl_asoc_card_dt_ids[] = { { .compatible = "fsl,imx-audio-ac97", }, + { .compatible = "fsl,imx-audio-i2s-slave", }, { .compatible = "fsl,imx-audio-cs42888", }, { .compatible = "fsl,imx-audio-cs427x", }, { .compatible = "fsl,imx-audio-sgtl5000", }, -- 2.27.0
[PATCH 1/2] dt-bindings: sound: fsl-asoc-card: add new compatible for I2S slave
fsl-asoc-card currently doesn't support generic codecs with the SoC acting as I2S slave. This commit adds a new `fsl,imx-audio-i2s-slave` for this use-case, as well as the following mandatory properties: - `audio-codec-dai-name` for specifying the codec DAI to be used - `audio-slot-width` Signed-off-by: Arnaud Ferraris --- .../bindings/sound/fsl-asoc-card.txt | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt index 133d7e14a4d0..694a138df462 100644 --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt @@ -22,6 +22,8 @@ Note: The card is initially designed for those sound cards who use AC'97, I2S The compatible list for this generic sound card currently: "fsl,imx-audio-ac97" + "fsl,imx-audio-i2s-slave" + "fsl,imx-audio-cs42888" "fsl,imx-audio-cs427x" @@ -75,7 +77,13 @@ Optional unless SSI is selected as a CPU DAI: - mux-ext-port : The external port of the i.MX audio muxer -Example: +Optional unless compatible is "fsl,imx-audio-i2s-slave": + + - audio-codec-dai-name: The name of the DAI provided by the codec + + - audio-slot-width : The audio sample format + +Examples: sound-cs42888 { compatible = "fsl,imx-audio-cs42888"; model = "cs42888-audio"; @@ -96,3 +104,16 @@ sound-cs42888 { "AIN2L", "Line In Jack", "AIN2R", "Line In Jack"; }; + +sound-bluetooth { + compatible = "fsl,imx-audio-i2s-slave"; + audio-cpu = <>; + audio-codec = <_bluetooth>; + audio-codec-dai-name = "bt-sco-pcm-wb"; + audio-slot-width = <16>; + audio-routing = + "RX", "Mic Jack", + "Headphone Jack", "TX"; + mux-int-port = <1>; + mux-ext-port = <4>; +}; -- 2.27.0
[PATCH 0/2] ASoC: fsl-asoc-card: add support for generic codecs
fsl-asoc-card currently only works with AC97 or a selection of codecs, although the hardware is capable of more. Supporting generic codecs when acting as I2S slave (codec is master) would be useful, especially when using Bluetooth audio, as these are generally simple I2S devices not controlled by the sound subsystem. This will allow using simple/dummy codecs along with ASRC. Arnaud Ferraris (2): dt-bindings: sound: fsl-asoc-card: add new compatible for I2S slave ASoC: fsl-asoc-card: add support for generic I2S slave use-case Documentation/devicetree/bindings/sound/fsl-asoc-card.txt | 23 ++- sound/soc/fsl/fsl-asoc-card.c | 46 +++--- 2 files changed, 57 insertions(+), 12 deletions(-)
Re: [PATCH 0/8] mm: cleanup usage of
Gentle ping. On Sat, Jun 27, 2020 at 05:34:45PM +0300, Mike Rapoport wrote: > From: Mike Rapoport > > Hi, > > Most architectures have very similar versions of pXd_alloc_one() and > pXd_free_one() for intermediate levels of page table. > These patches add generic versions of these functions in > and enable use of the generic functions where > appropriate. > > In addition, functions declared and defined in headers > are used mostly by core mm and early mm initialization in arch and there is > no actual reason to have the included all over the place. > The first patch in this series removes unneeded includes of > > In the end it didn't work out as neatly as I hoped and moving > pXd_alloc_track() definitions to would require > unnecessary changes to arches that have custom page table allocations, so > I've decided to move lib/ioremap.c to mm/ and make pgalloc-track.h local to > mm/. > > Joerg Roedel (1): > mm: move p?d_alloc_track to separate header file > > Mike Rapoport (7): > mm: remove unneeded includes of > opeinrisc: switch to generic version of pte allocation > xtensa: switch to generic version of pte allocation > asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one() > asm-generic: pgalloc: provide generic pud_alloc_one() and pud_free_one() > asm-generic: pgalloc: provide generic pgd_free() > mm: move lib/ioremap.c to mm/ > > arch/alpha/include/asm/pgalloc.h | 21 + > arch/alpha/include/asm/tlbflush.h| 1 - > arch/alpha/kernel/core_irongate.c| 1 - > arch/alpha/kernel/core_marvel.c | 1 - > arch/alpha/kernel/core_titan.c | 1 - > arch/alpha/kernel/machvec_impl.h | 2 - > arch/alpha/kernel/smp.c | 1 - > arch/alpha/mm/numa.c | 1 - > arch/arc/mm/fault.c | 1 - > arch/arc/mm/init.c | 1 - > arch/arm/include/asm/pgalloc.h | 12 +-- > arch/arm/include/asm/tlb.h | 1 - > arch/arm/kernel/machine_kexec.c | 1 - > arch/arm/kernel/smp.c| 1 - > arch/arm/kernel/suspend.c| 1 - > arch/arm/mach-omap2/omap-mpuss-lowpower.c| 1 - > arch/arm/mm/hugetlbpage.c| 1 - > arch/arm/mm/mmu.c| 1 + > arch/arm64/include/asm/pgalloc.h | 39 +- > arch/arm64/kernel/smp.c | 1 - > arch/arm64/mm/hugetlbpage.c | 1 - > arch/arm64/mm/ioremap.c | 1 - > arch/arm64/mm/mmu.c | 1 + > arch/csky/include/asm/pgalloc.h | 7 +- > arch/csky/kernel/smp.c | 1 - > arch/hexagon/include/asm/pgalloc.h | 7 +- > arch/ia64/include/asm/pgalloc.h | 24 -- > arch/ia64/include/asm/tlb.h | 1 - > arch/ia64/kernel/process.c | 1 - > arch/ia64/kernel/smp.c | 1 - > arch/ia64/kernel/smpboot.c | 1 - > arch/ia64/mm/contig.c| 1 - > arch/ia64/mm/discontig.c | 1 - > arch/ia64/mm/hugetlbpage.c | 1 - > arch/ia64/mm/tlb.c | 1 - > arch/m68k/include/asm/mmu_context.h | 2 +- > arch/m68k/include/asm/sun3_pgalloc.h | 7 +- > arch/m68k/kernel/dma.c | 2 +- > arch/m68k/kernel/traps.c | 3 +- > arch/m68k/mm/cache.c | 2 +- > arch/m68k/mm/fault.c | 1 - > arch/m68k/mm/kmap.c | 2 +- > arch/m68k/mm/mcfmmu.c| 1 + > arch/m68k/mm/memory.c| 1 - > arch/m68k/sun3x/dvma.c | 2 +- > arch/microblaze/include/asm/pgalloc.h| 6 -- > arch/microblaze/include/asm/tlbflush.h | 1 - > arch/microblaze/kernel/process.c | 1 - > arch/microblaze/kernel/signal.c | 1 - > arch/mips/include/asm/pgalloc.h | 19 + > arch/mips/sgi-ip32/ip32-memory.c | 1 - > arch/nds32/mm/mm-nds32.c | 2 + > arch/nios2/include/asm/pgalloc.h | 7 +- > arch/openrisc/include/asm/pgalloc.h | 33 +--- > arch/openrisc/include/asm/tlbflush.h | 1 - > arch/openrisc/kernel/or32_ksyms.c| 1 - > arch/parisc/include/asm/mmu_context.h| 1 - > arch/parisc/include/asm/pgalloc.h| 12 +-- > arch/parisc/kernel/cache.c | 1 - > arch/parisc/kernel/pci-dma.c | 1 - > arch/parisc/kernel/process.c | 1 - > arch/parisc/kernel/signal.c | 1 - > arch/parisc/kernel/smp.c | 1 - > arch/parisc/mm/hugetlbpage.c | 1 - > arch/parisc/mm/ioremap.c
Re: [PATCH] MAINTAINERS: Add Shengjiu to reviewer list of sound/soc/fsl
On Thu, Jul 2, 2020 at 4:31 PM Nicolin Chen wrote: > > Add Shengjiu who's actively working on the latest fsl/nxp audio drivers. > > Signed-off-by: Nicolin Chen > Cc: Shengjiu Wang Reviewed-by: Fabio Estevam
Re: [PATCH 6/8] powerpc/pseries: implement paravirt qspinlocks for SPLPAR
On 7/2/20 3:48 AM, Nicholas Piggin wrote: Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/paravirt.h | 23 arch/powerpc/include/asm/qspinlock.h | 55 +++ arch/powerpc/include/asm/qspinlock_paravirt.h | 5 ++ arch/powerpc/platforms/pseries/Kconfig| 5 ++ arch/powerpc/platforms/pseries/setup.c| 6 +- include/asm-generic/qspinlock.h | 2 + 6 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/include/asm/qspinlock_paravirt.h diff --git a/arch/powerpc/include/asm/paravirt.h b/arch/powerpc/include/asm/paravirt.h index 7a8546660a63..5fae9dfa6fe9 100644 --- a/arch/powerpc/include/asm/paravirt.h +++ b/arch/powerpc/include/asm/paravirt.h @@ -29,6 +29,16 @@ static inline void yield_to_preempted(int cpu, u32 yield_count) { plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(cpu), yield_count); } + +static inline void prod_cpu(int cpu) +{ + plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu)); +} + +static inline void yield_to_any(void) +{ + plpar_hcall_norets(H_CONFER, -1, 0); +} #else static inline bool is_shared_processor(void) { @@ -45,6 +55,19 @@ static inline void yield_to_preempted(int cpu, u32 yield_count) { ___bad_yield_to_preempted(); /* This would be a bug */ } + +extern void ___bad_yield_to_any(void); +static inline void yield_to_any(void) +{ + ___bad_yield_to_any(); /* This would be a bug */ +} + +extern void ___bad_prod_cpu(void); +static inline void prod_cpu(int cpu) +{ + ___bad_prod_cpu(); /* This would be a bug */ +} + #endif #define vcpu_is_preempted vcpu_is_preempted diff --git a/arch/powerpc/include/asm/qspinlock.h b/arch/powerpc/include/asm/qspinlock.h index f84da77b6bb7..997a9a32df77 100644 --- a/arch/powerpc/include/asm/qspinlock.h +++ b/arch/powerpc/include/asm/qspinlock.h @@ -3,9 +3,36 @@ #define _ASM_POWERPC_QSPINLOCK_H #include +#include #define _Q_PENDING_LOOPS (1 << 9) /* not tuned */ +#ifdef CONFIG_PARAVIRT_SPINLOCKS +extern void native_queued_spin_lock_slowpath(struct qspinlock *lock, u32 val); +extern void __pv_queued_spin_lock_slowpath(struct qspinlock *lock, u32 val); + +static __always_inline void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val) +{ + if (!is_shared_processor()) + native_queued_spin_lock_slowpath(lock, val); + else + __pv_queued_spin_lock_slowpath(lock, val); +} You may need to match the use of __pv_queued_spin_lock_slowpath() with the corresponding __pv_queued_spin_unlock(), e.g. #define queued_spin_unlock queued_spin_unlock static inline queued_spin_unlock(struct qspinlock *lock) { if (!is_shared_processor()) smp_store_release(>locked, 0); else __pv_queued_spin_unlock(lock); } Otherwise, pv_kick() will never be called. Cheers, Longman
[PATCH v2 12/12] ppc64/kexec_file: fix kexec load failure with lack of memory hole
The kexec purgatory has to run in real mode. Only the first memory block maybe accessible in real mode. And, unlike the case with panic kernel, no memory is set aside for regular kexec load. Another thing to note is, the memory for crashkernel is reserved at an offset of 128MB. So, when crashkernel memory is reserved, the memory ranges to load kexec segments shrink further as the generic code only looks for memblock free memory ranges and in all likelihood only a tiny bit of memory from 0 to 128MB would be available to load kexec segments. With kdump being used by default in general, kexec file load is likely to fail almost always. This can be fixed by changing the memory hole lookup logic for regular kexec to use the same method as kdump. This would mean that most kexec segments will overlap with crashkernel memory region. That should still be ok as the pages, whose destination address isn't available while loading, are placed in an intermediate location till a flush to the actual destination address happens during kexec boot sequence. Signed-off-by: Hari Bathini --- Changes in v2: * New patch to fix locating memory hole for kexec_file_load (kexec -s -l) when memory is reserved for crashkernel. arch/powerpc/kexec/file_load_64.c | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index d3b29e0..746c16f 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -1326,13 +1326,6 @@ int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) u64 buf_min, buf_max; int ret; - /* -* Use the generic kexec_locate_mem_hole for regular -* kexec_file_load syscall -*/ - if (kbuf->image->type != KEXEC_TYPE_CRASH) - return kexec_locate_mem_hole(kbuf); - /* Look up the exclude ranges list while locating the memory hole */ emem = &(kbuf->image->arch.exclude_ranges); if (!(*emem) || ((*emem)->nr_ranges == 0)) { @@ -1340,11 +1333,15 @@ int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) return 0; } + buf_min = kbuf->buf_min; + buf_max = kbuf->buf_max; /* Segments for kdump kernel should be within crashkernel region */ - buf_min = (kbuf->buf_min < crashk_res.start ? - crashk_res.start : kbuf->buf_min); - buf_max = (kbuf->buf_max > crashk_res.end ? - crashk_res.end : kbuf->buf_max); + if (kbuf->image->type == KEXEC_TYPE_CRASH) { + buf_min = (buf_min < crashk_res.start ? + crashk_res.start : buf_min); + buf_max = (buf_max > crashk_res.end ? + crashk_res.end : buf_max); + } if (buf_min > buf_max) { pr_err("Invalid buffer min and/or max values\n"); @@ -1477,15 +1474,13 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, unsigned long buf_len) { - if (image->type == KEXEC_TYPE_CRASH) { - int ret; + int ret; - /* Get exclude memory ranges needed for setting up kdump segments */ - ret = get_exclude_memory_ranges(&(image->arch.exclude_ranges)); - if (ret) { - pr_err("Failed to setup exclude memory ranges for buffer lookup\n"); - return ret; - } + /* Get exclude memory ranges needed for setting up kexec segments */ + ret = get_exclude_memory_ranges(&(image->arch.exclude_ranges)); + if (ret) { + pr_err("Failed to setup exclude memory ranges for buffer lookup\n"); + return ret; } return kexec_image_probe_default(image, buf, buf_len);
[PATCH v2 11/12] ppc64/kexec_file: add appropriate regions for memory reserve map
While initrd, elfcorehdr and backup regions are already added to the reserve map, there are a few missing regions that need to be added to the memory reserve map. Add them here. And now that all the changes to load panic kernel are in place, claim likewise. Signed-off-by: Hari Bathini --- Changes in v2: * Updated add_rtas_mem_range() & add_opal_mem_range() callsites based on the new prototype for these functions. arch/powerpc/kexec/file_load_64.c | 58 ++--- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index 6f895fa..d3b29e0 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -193,6 +193,34 @@ static int get_crash_memory_ranges(struct crash_mem **mem_ranges) } /** + * get_reserved_memory_ranges - Get reserve memory ranges. This list includes + * memory regions that should be added to the + * memory reserve map to ensure the region is + * protected from any mischeif. + * @mem_ranges: Range list to add the memory ranges to. + * + * Returns 0 on success, negative errno on error. + */ +static int get_reserved_memory_ranges(struct crash_mem **mem_ranges) +{ + int ret; + + ret = add_rtas_mem_range(mem_ranges); + if (ret) + goto out; + + ret = add_tce_mem_ranges(mem_ranges); + if (ret) + goto out; + + ret = add_reserved_ranges(mem_ranges); +out: + if (ret) + pr_err("Failed to setup reserved memory ranges\n"); + return ret; +} + +/** * __locate_mem_hole_top_down - Looks top down for a large enough memory hole * in the memory regions between buf_min & buf_max * for the buffer. If found, sets kbuf->mem. @@ -1200,8 +1228,8 @@ int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, unsigned long initrd_load_addr, unsigned long initrd_len, const char *cmdline) { - struct crash_mem *umem = NULL; - int chosen_node, ret; + struct crash_mem *umem = NULL, *rmem = NULL; + int i, nr_ranges, chosen_node, ret; /* Remove memory reservation for the current device tree. */ ret = delete_fdt_mem_rsv(fdt, __pa(initial_boot_params), @@ -1247,6 +1275,25 @@ int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, } } + /* Update memory reserve map */ + ret = get_reserved_memory_ranges(); + if (ret) + goto out; + + nr_ranges = rmem ? rmem->nr_ranges : 0; + for (i = 0; i < nr_ranges; i++) { + u64 base, size; + + base = rmem->ranges[i].start; + size = rmem->ranges[i].end - base + 1; + ret = fdt_add_mem_rsv(fdt, base, size); + if (ret) { + pr_err("Error updating memory reserve map: %s\n", + fdt_strerror(ret)); + goto out; + } + } + ret = setup_new_fdt(image, fdt, initrd_load_addr, initrd_len, cmdline, _node); if (ret) @@ -1257,6 +1304,7 @@ int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, pr_err("Failed to update device-tree with linux,booted-from-kexec\n"); out: kfree(umem); + kfree(rmem); return ret; } @@ -1434,10 +1482,10 @@ int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, /* Get exclude memory ranges needed for setting up kdump segments */ ret = get_exclude_memory_ranges(&(image->arch.exclude_ranges)); - if (ret) + if (ret) { pr_err("Failed to setup exclude memory ranges for buffer lookup\n"); - /* Return this until all changes for panic kernel are in */ - return -EOPNOTSUPP; + return ret; + } } return kexec_image_probe_default(image, buf, buf_len);
[PATCH v2 10/12] ppc64/kexec_file: prepare elfcore header for crashing kernel
Prepare elf headers for the crashing kernel's core file using crash_prepare_elf64_headers() and pass on this info to kdump kernel by updating its command line with elfcorehdr parameter. Also, add elfcorehdr location to reserve map to avoid it from being stomped on while booting. Signed-off-by: Hari Bathini --- Changes in v2: * Tried merging adjacent memory ranges on hitting maximum ranges limit to reduce reallocations for memory ranges and also, minimize PT_LOAD segments for elfcore. * Updated add_rtas_mem_range() & add_opal_mem_range() callsites based on the new prototype for these functions. arch/powerpc/include/asm/kexec.h |6 + arch/powerpc/kexec/elf_64.c | 12 ++ arch/powerpc/kexec/file_load.c| 49 ++ arch/powerpc/kexec/file_load_64.c | 181 + 4 files changed, 248 insertions(+) diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index 037cf2b..8b0a6d6 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -112,12 +112,18 @@ struct kimage_arch { unsigned long backup_start; void *backup_buf; + unsigned long elfcorehdr_addr; + unsigned long elf_headers_sz; + void *elf_headers; + #ifdef CONFIG_IMA_KEXEC phys_addr_t ima_buffer_addr; size_t ima_buffer_size; #endif }; +char *setup_kdump_cmdline(struct kimage *image, char *cmdline, + unsigned long cmdline_len); int setup_purgatory(struct kimage *image, const void *slave_code, const void *fdt, unsigned long kernel_load_addr, unsigned long fdt_load_addr); diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c index 4838b42..40a028c 100644 --- a/arch/powerpc/kexec/elf_64.c +++ b/arch/powerpc/kexec/elf_64.c @@ -36,6 +36,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, void *fdt; const void *slave_code; struct elfhdr ehdr; + char *modified_cmdline = NULL; struct kexec_elf_info elf_info; struct kexec_buf kbuf = { .image = image, .buf_min = 0, .buf_max = ppc64_rma_size }; @@ -74,6 +75,16 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, pr_err("Failed to load kdump kernel segments\n"); goto out; } + + /* Setup cmdline for kdump kernel case */ + modified_cmdline = setup_kdump_cmdline(image, cmdline, + cmdline_len); + if (!modified_cmdline) { + pr_err("Setting up cmdline for kdump kernel failed\n"); + ret = -EINVAL; + goto out; + } + cmdline = modified_cmdline; } if (initrd != NULL) { @@ -130,6 +141,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, pr_err("Error setting up the purgatory.\n"); out: + kfree(modified_cmdline); kexec_free_elf_info(_info); /* Make kimage_file_post_load_cleanup free the fdt buffer for us. */ diff --git a/arch/powerpc/kexec/file_load.c b/arch/powerpc/kexec/file_load.c index 99a2c4d..2e74992 100644 --- a/arch/powerpc/kexec/file_load.c +++ b/arch/powerpc/kexec/file_load.c @@ -17,11 +17,46 @@ #include #include #include +#include #include #define SLAVE_CODE_SIZE256 /* First 0x100 bytes */ /** + * setup_kdump_cmdline - Prepend "elfcorehdr= " to command line + * of kdump kernel for exporting the core. + * @image: Kexec image + * @cmdline: Command line parameters to update. + * @cmdline_len: Length of the cmdline parameters. + * + * kdump segment must be setup before calling this function. + * + * Returns new cmdline buffer for kdump kernel on success, NULL otherwise. + */ +char *setup_kdump_cmdline(struct kimage *image, char *cmdline, + unsigned long cmdline_len) +{ + int elfcorehdr_strlen; + char *cmdline_ptr; + + cmdline_ptr = kzalloc(COMMAND_LINE_SIZE, GFP_KERNEL); + if (!cmdline_ptr) + return NULL; + + elfcorehdr_strlen = sprintf(cmdline_ptr, "elfcorehdr=0x%lx ", + image->arch.elfcorehdr_addr); + + if (elfcorehdr_strlen + cmdline_len > COMMAND_LINE_SIZE) { + pr_err("Appending elfcorehdr= exceeds cmdline size\n"); + kfree(cmdline_ptr); + return NULL; + } + + memcpy(cmdline_ptr + elfcorehdr_strlen, cmdline, cmdline_len); + return cmdline_ptr; +} + +/** * setup_purgatory - initialize the purgatory's global variables * @image: kexec image. * @slave_code:Slave code for the purgatory. @@ -215,6 +250,20 @@ int setup_new_fdt(const struct kimage
[PATCH v2 09/12] ppc64/kexec_file: setup backup region for kdump kernel
Though kdump kernel boots from loaded address, the first 64K bytes of it is copied down to real 0. So, setup a backup region to copy the first 64K bytes of crashed kernel, in purgatory, before booting into kdump kernel. Also, update reserve map with backup region and crashed kernel's memory to avoid kdump kernel from accidentially using that memory. Reported-by: kernel test robot [lkp: In v1, purgatory() declaration was missing] Signed-off-by: Hari Bathini --- Changes in v2: * Check if backup region is available before branching out. This is to keep `kexec -l -s` flow as before as much as possible. This would eventually change with more testing and addition of sha256 digest verification support. * Fixed missing prototype for purgatory() as reported by lkp. lkp report for reference: - https://lore.kernel.org/patchwork/patch/1264423/ arch/powerpc/include/asm/crashdump-ppc64.h |5 + arch/powerpc/include/asm/kexec.h |7 ++ arch/powerpc/include/asm/purgatory.h | 11 +++ arch/powerpc/kexec/elf_64.c|9 +++ arch/powerpc/kexec/file_load_64.c | 95 arch/powerpc/purgatory/Makefile| 28 arch/powerpc/purgatory/purgatory_64.c | 36 +++ arch/powerpc/purgatory/trampoline_64.S | 28 +++- 8 files changed, 211 insertions(+), 8 deletions(-) create mode 100644 arch/powerpc/include/asm/purgatory.h create mode 100644 arch/powerpc/purgatory/purgatory_64.c diff --git a/arch/powerpc/include/asm/crashdump-ppc64.h b/arch/powerpc/include/asm/crashdump-ppc64.h index 90deb46..fcc5fce 100644 --- a/arch/powerpc/include/asm/crashdump-ppc64.h +++ b/arch/powerpc/include/asm/crashdump-ppc64.h @@ -2,6 +2,11 @@ #ifndef _ASM_POWERPC_CRASHDUMP_PPC64_H #define _ASM_POWERPC_CRASHDUMP_PPC64_H +/* Backup region - first 64K bytes of System RAM. */ +#define BACKUP_SRC_START 0 +#define BACKUP_SRC_END 0x +#define BACKUP_SRC_SIZE(BACKUP_SRC_END - BACKUP_SRC_START + 1) + /* min & max addresses for kdump load segments */ #define KDUMP_BUF_MIN (crashk_res.start) #define KDUMP_BUF_MAX ((crashk_res.end < ppc64_rma_size) ? \ diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index e78cd0a..037cf2b 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -109,6 +109,9 @@ extern const struct kexec_file_ops kexec_elf64_ops; struct kimage_arch { struct crash_mem *exclude_ranges; + unsigned long backup_start; + void *backup_buf; + #ifdef CONFIG_IMA_KEXEC phys_addr_t ima_buffer_addr; size_t ima_buffer_size; @@ -124,6 +127,10 @@ int setup_new_fdt(const struct kimage *image, void *fdt, int delete_fdt_mem_rsv(void *fdt, unsigned long start, unsigned long size); #ifdef CONFIG_PPC64 +struct kexec_buf; + +int load_crashdump_segments_ppc64(struct kimage *image, + struct kexec_buf *kbuf); int setup_purgatory_ppc64(struct kimage *image, const void *slave_code, const void *fdt, unsigned long kernel_load_addr, unsigned long fdt_load_addr); diff --git a/arch/powerpc/include/asm/purgatory.h b/arch/powerpc/include/asm/purgatory.h new file mode 100644 index 000..076d150 --- /dev/null +++ b/arch/powerpc/include/asm/purgatory.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _ASM_POWERPC_PURGATORY_H +#define _ASM_POWERPC_PURGATORY_H + +#ifndef __ASSEMBLY__ +#include + +void purgatory(void); +#endif /* __ASSEMBLY__ */ + +#endif /* _ASM_POWERPC_PURGATORY_H */ diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c index c695f94..4838b42 100644 --- a/arch/powerpc/kexec/elf_64.c +++ b/arch/powerpc/kexec/elf_64.c @@ -67,6 +67,15 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, pr_debug("Loaded purgatory at 0x%lx\n", pbuf.mem); + /* Setup additional segments needed for panic kernel */ + if (image->type == KEXEC_TYPE_CRASH) { + ret = load_crashdump_segments_ppc64(image, ); + if (ret) { + pr_err("Failed to load kdump kernel segments\n"); + goto out; + } + } + if (initrd != NULL) { kbuf.buffer = initrd; kbuf.bufsz = kbuf.memsz = initrd_len; diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index f06dcf1..f91530e 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -858,6 +859,69 @@ static int kexec_do_relocs_ppc64(unsigned long my_r2, const Elf_Sym *sym, } /** + * load_backup_segment - Initialize backup segment of crashing kernel. + * @image: Kexec image. + * @kbuf:Buffer contents
[PATCH v2 08/12] ppc64/kexec_file: setup the stack for purgatory
To avoid any weird errors, the purgatory should run with its own stack. Set one up by adding the stack buffer to .data section of the purgatory. Also, setup opal base & entry values in r8 & r9 registers to help early OPAL debugging. Signed-off-by: Hari Bathini --- Changes in v2: * Setting up opal base & entry values in r8 & r9 for early OPAL debug. arch/powerpc/include/asm/kexec.h |4 arch/powerpc/kexec/file_load_64.c | 29 + arch/powerpc/purgatory/trampoline_64.S | 32 3 files changed, 65 insertions(+) diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index bf47a01..e78cd0a 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -45,6 +45,10 @@ #define KEXEC_ARCH KEXEC_ARCH_PPC #endif +#ifdef CONFIG_KEXEC_FILE +#define KEXEC_PURGATORY_STACK_SIZE 16384 /* 16KB stack size */ +#endif + #define KEXEC_STATE_NONE 0 #define KEXEC_STATE_IRQS_OFF 1 #define KEXEC_STATE_REAL_MODE 2 diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index adca9c0..f06dcf1 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -873,6 +873,8 @@ int setup_purgatory_ppc64(struct kimage *image, const void *slave_code, const void *fdt, unsigned long kernel_load_addr, unsigned long fdt_load_addr) { + struct device_node *dn; + void *stack_buf; uint64_t val; int ret; @@ -896,10 +898,37 @@ int setup_purgatory_ppc64(struct kimage *image, const void *slave_code, goto out; } + /* Setup the stack top */ + stack_buf = kexec_purgatory_get_symbol_addr(image, "stack_buf"); + if (!stack_buf) + goto out; + + val = (u64)stack_buf + KEXEC_PURGATORY_STACK_SIZE; + ret = kexec_purgatory_get_set_symbol(image, "stack", , sizeof(val), +false); + if (ret) + goto out; + /* Setup the TOC pointer */ val = get_toc_ptr(image->purgatory_info.ehdr); ret = kexec_purgatory_get_set_symbol(image, "my_toc", , sizeof(val), false); + if (ret) + goto out; + + /* Setup OPAL base & entry values */ + dn = of_find_node_by_path("/ibm,opal"); + if (dn) { + of_property_read_u64(dn, "opal-base-address", ); + ret = kexec_purgatory_get_set_symbol(image, "opal_base", , +sizeof(val), false); + if (ret) + goto out; + + of_property_read_u64(dn, "opal-entry-address", ); + ret = kexec_purgatory_get_set_symbol(image, "opal_entry", , +sizeof(val), false); + } out: if (ret) pr_err("Failed to setup purgatory symbols"); diff --git a/arch/powerpc/purgatory/trampoline_64.S b/arch/powerpc/purgatory/trampoline_64.S index 7b4a5f7..83e93b7 100644 --- a/arch/powerpc/purgatory/trampoline_64.S +++ b/arch/powerpc/purgatory/trampoline_64.S @@ -9,6 +9,7 @@ * Copyright (C) 2013, Anton Blanchard, IBM Corporation */ +#include #include .machine ppc64 @@ -53,6 +54,8 @@ master: ld %r2,(my_toc - 0b)(%r18) /* setup toc */ + ld %r1,(stack - 0b)(%r18) /* setup stack */ + /* load device-tree address */ ld %r3, (dt_offset - 0b)(%r18) mr %r16,%r3/* save dt address in reg16 */ @@ -63,6 +66,11 @@ master: li %r4,28 STWX_BE %r17,%r3,%r4/* Store my cpu as __be32 at byte 28 */ 1: + + /* Load opal base and entry values in r8 & r9 respectively */ + ld %r8,(opal_base - 0b)(%r18) + ld %r9,(opal_entry - 0b)(%r18) + /* load the kernel address */ ld %r4,(kernel - 0b)(%r18) @@ -111,6 +119,24 @@ my_toc: .8byte 0x0 .size my_toc, . - my_toc + .balign 8 + .globl stack +stack: + .8byte 0x0 + .size stack, . - stack + + .balign 8 + .globl opal_base +opal_base: + .8byte 0x0 + .size opal_base, . - opal_base + + .balign 8 + .globl opal_entry +opal_entry: + .8byte 0x0 + .size opal_entry, . - opal_entry + .data .balign 8 .globl purgatory_sha256_digest @@ -123,3 +149,9 @@ purgatory_sha256_digest: purgatory_sha_regions: .skip 8 * 2 * 16 .size purgatory_sha_regions, . - purgatory_sha_regions + + .balign 8 +.globl stack_buf +stack_buf: + .skip KEXEC_PURGATORY_STACK_SIZE + .size stack_buf, . - stack_buf
[PATCH v2 07/12] ppc64/kexec_file: add support to relocate purgatory
Right now purgatory implementation is only minimal. But if purgatory code is to be enhanced to copy memory to the backup region and verify sha256 digest, relocations may have to be applied to the purgatory. So, add support to relocate purgatory in kexec_file_load system call by setting up TOC pointer and applying RELA relocations as needed. Reported-by: kernel test robot [lkp: In v1, 'struct mem_sym' was declared in parameter list] Signed-off-by: Hari Bathini --- Changes in v2: * Fixed wrong use of 'struct mem_sym' in local_entry_offset() as reported by lkp. lkp report for reference: - https://lore.kernel.org/patchwork/patch/1264421/ arch/powerpc/kexec/file_load_64.c | 338 arch/powerpc/purgatory/trampoline_64.S |8 + 2 files changed, 346 insertions(+) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index 08c71be..adca9c0 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -621,6 +622,242 @@ static int update_usable_mem_fdt(void *fdt, struct crash_mem *usable_mem) } /** + * get_toc_section - Look for ".toc" symbol and return the corresponding section + * @ehdr:ELF header. + * + * Returns TOC section on success, NULL otherwise. + */ +static const Elf_Shdr *get_toc_section(const Elf_Ehdr *ehdr) +{ + const Elf_Shdr *sechdrs; + const char *secstrings; + int i; + + if (!ehdr) { + pr_err("Purgatory elf load info missing?\n"); + return NULL; + } + + sechdrs = (void *)ehdr + ehdr->e_shoff; + secstrings = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset; + + for (i = 0; i < ehdr->e_shnum; i++) { + if ((sechdrs[i].sh_size != 0) && + (strcmp(secstrings + sechdrs[i].sh_name, ".toc") == 0)) { + /* Return the ".toc" section */ + pr_debug("TOC section number is %d\n", i); + return [i]; + } + } + + return NULL; +} + +/** + * get_toc_ptr - r2 is the TOC pointer: it points 0x8000 into the TOC + * @ehdr:ELF header. + * + * Returns r2 on success, 0 otherwise. + */ +static unsigned long get_toc_ptr(const Elf_Ehdr *ehdr) +{ + const Elf_Shdr *sechdr; + + sechdr = get_toc_section(ehdr); + if (!sechdr) { + pr_err("Could not get the TOC section!\n"); + return 0; + } + + return sechdr->sh_addr + 0x8000; +} + +/* Helper functions to apply relocations */ +static int do_relative_toc(unsigned long val, uint16_t *loc, + unsigned long mask, int complain_signed) +{ + if (complain_signed && (val + 0x8000 > 0x)) { + pr_err("TOC16 relocation overflows (%lu)\n", val); + return -ENOEXEC; + } + + if ((~mask & 0x) & val) { + pr_err("Bad TOC16 relocation (%lu)\n", val); + return -ENOEXEC; + } + + *loc = (*loc & ~mask) | (val & mask); + return 0; +} +#ifdef PPC64_ELF_ABI_v2 +/* PowerPC64 specific values for the Elf64_Sym st_other field. */ +#define STO_PPC64_LOCAL_BIT5 +#define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT) +#define PPC64_LOCAL_ENTRY_OFFSET(other) \ + (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) \ +>> 2) << 2) + +static unsigned int local_entry_offset(const Elf64_Sym *sym) +{ + /* If this symbol has a local entry point, use it. */ + return PPC64_LOCAL_ENTRY_OFFSET(sym->st_other); +} +#else +static unsigned int local_entry_offset(const Elf64_Sym *sym) +{ + return 0; +} +#endif + +/** + * kexec_do_relocs_ppc64 - Apply relocations based on relocation type. + * @my_r2: TOC pointer. + * @sym: Symbol to relocate. + * @r_type:Relocation type. + * @loc: Location to modify. + * @val: Relocated symbol value. + * @addr: Final location after relocation. + * + * Returns 0 on success, negative errno on error. + */ +static int kexec_do_relocs_ppc64(unsigned long my_r2, const Elf_Sym *sym, +int r_type, void *loc, unsigned long val, +unsigned long addr) +{ + int ret = 0; + + switch (r_type) { + case R_PPC64_ADDR32: + /* Simply set it */ + *(uint32_t *)loc = val; + break; + + case R_PPC64_ADDR64: + /* Simply set it */ + *(uint64_t *)loc = val; + break; + + case R_PPC64_REL64: + *(uint64_t *)loc = val - (uint64_t)loc; + break; + + case R_PPC64_REL32: + /* Convert value to relative */ +
[PATCH v2 05/12] powerpc/drmem: make lmb walk a bit more flexible
Currently, numa & prom are the users of drmem lmb walk code. Loading kdump with kexec_file also needs to walk the drmem LMBs to setup the usable memory ranges for kdump kernel. But there are couple of issues in using the code as is. One, walk_drmem_lmb() code is built into the .init section currently, while kexec_file needs it later. Two, there is no scope to pass data to the callback function for processing and/ or erroring out on certain conditions. Fix that by, moving drmem LMB walk code out of .init section, adding scope to pass data to the callback function and bailing out when an error is encountered in the callback function. Signed-off-by: Hari Bathini --- Changes in v2: * No changes. arch/powerpc/include/asm/drmem.h |9 ++-- arch/powerpc/kernel/prom.c | 13 +++--- arch/powerpc/mm/drmem.c | 87 +- arch/powerpc/mm/numa.c | 13 +++--- 4 files changed, 78 insertions(+), 44 deletions(-) diff --git a/arch/powerpc/include/asm/drmem.h b/arch/powerpc/include/asm/drmem.h index 414d209..17ccc64 100644 --- a/arch/powerpc/include/asm/drmem.h +++ b/arch/powerpc/include/asm/drmem.h @@ -90,13 +90,14 @@ static inline bool drmem_lmb_reserved(struct drmem_lmb *lmb) } u64 drmem_lmb_memory_max(void); -void __init walk_drmem_lmbs(struct device_node *dn, - void (*func)(struct drmem_lmb *, const __be32 **)); +int walk_drmem_lmbs(struct device_node *dn, void *data, + int (*func)(struct drmem_lmb *, const __be32 **, void *)); int drmem_update_dt(void); #ifdef CONFIG_PPC_PSERIES -void __init walk_drmem_lmbs_early(unsigned long node, - void (*func)(struct drmem_lmb *, const __be32 **)); +int __init +walk_drmem_lmbs_early(unsigned long node, void *data, + int (*func)(struct drmem_lmb *, const __be32 **, void *)); #endif static inline void invalidate_lmb_associativity_index(struct drmem_lmb *lmb) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 9cc49f2..7df78de 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -468,8 +468,9 @@ static bool validate_mem_limit(u64 base, u64 *size) * This contains a list of memory blocks along with NUMA affinity * information. */ -static void __init early_init_drmem_lmb(struct drmem_lmb *lmb, - const __be32 **usm) +static int __init early_init_drmem_lmb(struct drmem_lmb *lmb, + const __be32 **usm, + void *data) { u64 base, size; int is_kexec_kdump = 0, rngs; @@ -484,7 +485,7 @@ static void __init early_init_drmem_lmb(struct drmem_lmb *lmb, */ if ((lmb->flags & DRCONF_MEM_RESERVED) || !(lmb->flags & DRCONF_MEM_ASSIGNED)) - return; + return 0; if (*usm) is_kexec_kdump = 1; @@ -499,7 +500,7 @@ static void __init early_init_drmem_lmb(struct drmem_lmb *lmb, */ rngs = dt_mem_next_cell(dt_root_size_cells, usm); if (!rngs) /* there are no (base, size) duple */ - return; + return 0; } do { @@ -524,6 +525,8 @@ static void __init early_init_drmem_lmb(struct drmem_lmb *lmb, if (lmb->flags & DRCONF_MEM_HOTREMOVABLE) memblock_mark_hotplug(base, size); } while (--rngs); + + return 0; } #endif /* CONFIG_PPC_PSERIES */ @@ -534,7 +537,7 @@ static int __init early_init_dt_scan_memory_ppc(unsigned long node, #ifdef CONFIG_PPC_PSERIES if (depth == 1 && strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0) { - walk_drmem_lmbs_early(node, early_init_drmem_lmb); + walk_drmem_lmbs_early(node, NULL, early_init_drmem_lmb); return 0; } #endif diff --git a/arch/powerpc/mm/drmem.c b/arch/powerpc/mm/drmem.c index 59327ce..b2eeea3 100644 --- a/arch/powerpc/mm/drmem.c +++ b/arch/powerpc/mm/drmem.c @@ -14,6 +14,8 @@ #include #include +static int n_root_addr_cells, n_root_size_cells; + static struct drmem_lmb_info __drmem_info; struct drmem_lmb_info *drmem_info = &__drmem_info; @@ -189,12 +191,13 @@ int drmem_update_dt(void) return rc; } -static void __init read_drconf_v1_cell(struct drmem_lmb *lmb, +static void read_drconf_v1_cell(struct drmem_lmb *lmb, const __be32 **prop) { const __be32 *p = *prop; - lmb->base_addr = dt_mem_next_cell(dt_root_addr_cells, ); + lmb->base_addr = of_read_number(p, n_root_addr_cells); + p += n_root_addr_cells; lmb->drc_index = of_read_number(p++, 1); p++; /* skip reserved field */ @@ -205,29 +208,33 @@ static void __init read_drconf_v1_cell(struct drmem_lmb *lmb, *prop = p; } -static void __init
[PATCH v2 06/12] ppc64/kexec_file: restrict memory usage of kdump kernel
Kdump kernel, used for capturing the kernel core image, is supposed to use only specific memory regions to avoid corrupting the image to be captured. The regions are crashkernel range - the memory reserved explicitly for kdump kernel, memory used for the tce-table, the OPAL region and RTAS region as applicable. Restrict kdump kernel memory to use only these regions by setting up usable-memory DT property. Also, tell the kdump kernel to run at the loaded address by setting the magic word at 0x5c. Signed-off-by: Hari Bathini --- Changes in v2: * Fixed off-by-one error while setting up usable-memory properties. * Updated add_rtas_mem_range() & add_opal_mem_range() callsites based on the new prototype for these functions. arch/powerpc/kexec/file_load_64.c | 401 + 1 file changed, 399 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index 932e0e5..08c71be 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -17,10 +17,22 @@ #include #include #include +#include #include +#include +#include #include #include +struct umem_info { + uint64_t *buf; /* data buffer for usable-memory property */ + uint32_t idx; /* current index */ + uint32_t size; /* size allocated for the data buffer */ + + /* usable memory ranges to look up */ + const struct crash_mem *umrngs; +}; + const struct kexec_file_ops * const kexec_file_loaders[] = { _elf64_ops, NULL @@ -76,6 +88,38 @@ static int get_exclude_memory_ranges(struct crash_mem **mem_ranges) } /** + * get_usable_memory_ranges - Get usable memory ranges. This list includes + *regions like crashkernel, opal/rtas & tce-table, + *that kdump kernel could use. + * @mem_ranges: Range list to add the memory ranges to. + * + * Returns 0 on success, negative errno on error. + */ +static int get_usable_memory_ranges(struct crash_mem **mem_ranges) +{ + int ret; + + /* First memory block & crashkernel region */ + ret = add_mem_range(mem_ranges, 0, crashk_res.end + 1); + if (ret) + goto out; + + ret = add_rtas_mem_range(mem_ranges); + if (ret) + goto out; + + ret = add_opal_mem_range(mem_ranges); + if (ret) + goto out; + + ret = add_tce_mem_ranges(mem_ranges); +out: + if (ret) + pr_err("Failed to setup usable memory ranges\n"); + return ret; +} + +/** * __locate_mem_hole_top_down - Looks top down for a large enough memory hole * in the memory regions between buf_min & buf_max * for the buffer. If found, sets kbuf->mem. @@ -261,6 +305,322 @@ static int locate_mem_hole_bottom_up_ppc64(struct kexec_buf *kbuf, } /** + * check_realloc_usable_mem - Reallocate buffer if it can't accommodate entries + * @um_info: Usable memory buffer and ranges info. + * @cnt: No. of entries to accommodate. + * + * Returns 0 on success, negative errno on error. + */ +static uint64_t *check_realloc_usable_mem(struct umem_info *um_info, int cnt) +{ + void *tbuf; + + if (um_info->size >= + ((um_info->idx + cnt) * sizeof(*(um_info->buf + return um_info->buf; + + um_info->size += MEM_RANGE_CHUNK_SZ; + tbuf = krealloc(um_info->buf, um_info->size, GFP_KERNEL); + if (!tbuf) { + um_info->size -= MEM_RANGE_CHUNK_SZ; + return NULL; + } + + memset(tbuf + um_info->idx, 0, MEM_RANGE_CHUNK_SZ); + return tbuf; +} + +/** + * add_usable_mem - Add the usable memory ranges within the given memory range + * to the buffer + * @um_info:Usable memory buffer and ranges info. + * @base: Base address of memory range to look for. + * @end:End address of memory range to look for. + * @cnt:No. of usable memory ranges added to buffer. + * + * Returns 0 on success, negative errno on error. + */ +static int add_usable_mem(struct umem_info *um_info, uint64_t base, + uint64_t end, int *cnt) +{ + uint64_t loc_base, loc_end, *buf; + const struct crash_mem *umrngs; + int i, add; + + *cnt = 0; + umrngs = um_info->umrngs; + for (i = 0; i < umrngs->nr_ranges; i++) { + add = 0; + loc_base = umrngs->ranges[i].start; + loc_end = umrngs->ranges[i].end; + if (loc_base >= base && loc_end <= end) + add = 1; + else if (base < loc_end && end > loc_base) { + if (loc_base < base) + loc_base = base; + if (loc_end > end) + loc_end = end; +
[PATCH v2 04/12] ppc64/kexec_file: avoid stomping memory used by special regions
crashkernel region could have an overlap with special memory regions like opal, rtas, tce-table & such. These regions are referred to as exclude memory ranges. Setup this ranges during image probe in order to avoid them while finding the buffer for different kdump segments. Override arch_kexec_locate_mem_hole() to locate a memory hole taking these ranges into account. Signed-off-by: Hari Bathini --- Changes in v2: * Did arch_kexec_locate_mem_hole() override to handle special regions. * Ensured holes in the memory are accounted for while locating mem hole. * Updated add_rtas_mem_range() & add_opal_mem_range() callsites based on the new prototype for these functions. arch/powerpc/include/asm/crashdump-ppc64.h | 10 + arch/powerpc/include/asm/kexec.h |7 - arch/powerpc/kexec/elf_64.c|7 + arch/powerpc/kexec/file_load_64.c | 324 4 files changed, 344 insertions(+), 4 deletions(-) create mode 100644 arch/powerpc/include/asm/crashdump-ppc64.h diff --git a/arch/powerpc/include/asm/crashdump-ppc64.h b/arch/powerpc/include/asm/crashdump-ppc64.h new file mode 100644 index 000..90deb46 --- /dev/null +++ b/arch/powerpc/include/asm/crashdump-ppc64.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _ASM_POWERPC_CRASHDUMP_PPC64_H +#define _ASM_POWERPC_CRASHDUMP_PPC64_H + +/* min & max addresses for kdump load segments */ +#define KDUMP_BUF_MIN (crashk_res.start) +#define KDUMP_BUF_MAX ((crashk_res.end < ppc64_rma_size) ? \ +crashk_res.end : (ppc64_rma_size - 1)) + +#endif /* __ASM_POWERPC_CRASHDUMP_PPC64_H */ diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index 7008ea1..bf47a01 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -100,14 +100,16 @@ void relocate_new_kernel(unsigned long indirection_page, unsigned long reboot_co #ifdef CONFIG_KEXEC_FILE extern const struct kexec_file_ops kexec_elf64_ops; -#ifdef CONFIG_IMA_KEXEC #define ARCH_HAS_KIMAGE_ARCH struct kimage_arch { + struct crash_mem *exclude_ranges; + +#ifdef CONFIG_IMA_KEXEC phys_addr_t ima_buffer_addr; size_t ima_buffer_size; -}; #endif +}; int setup_purgatory(struct kimage *image, const void *slave_code, const void *fdt, unsigned long kernel_load_addr, @@ -125,6 +127,7 @@ int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, unsigned long initrd_load_addr, unsigned long initrd_len, const char *cmdline); #endif /* CONFIG_PPC64 */ + #endif /* CONFIG_KEXEC_FILE */ #else /* !CONFIG_KEXEC_CORE */ diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c index 23ad04c..c695f94 100644 --- a/arch/powerpc/kexec/elf_64.c +++ b/arch/powerpc/kexec/elf_64.c @@ -22,6 +22,7 @@ #include #include #include +#include static void *elf64_load(struct kimage *image, char *kernel_buf, unsigned long kernel_len, char *initrd, @@ -46,6 +47,12 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, if (ret) goto out; + if (image->type == KEXEC_TYPE_CRASH) { + /* min & max buffer values for kdump case */ + kbuf.buf_min = pbuf.buf_min = KDUMP_BUF_MIN; + kbuf.buf_max = pbuf.buf_max = KDUMP_BUF_MAX; + } + ret = kexec_elf_load(image, , _info, , _load_addr); if (ret) goto out; diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index e6bff960..932e0e5 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -17,6 +17,9 @@ #include #include #include +#include +#include +#include const struct kexec_file_ops * const kexec_file_loaders[] = { _elf64_ops, @@ -24,6 +27,240 @@ const struct kexec_file_ops * const kexec_file_loaders[] = { }; /** + * get_exclude_memory_ranges - Get exclude memory ranges. This list includes + * regions like opal/rtas, tce-table, initrd, + * kernel, htab which should be avoided while + * setting up kexec load segments. + * @mem_ranges:Range list to add the memory ranges to. + * + * Returns 0 on success, negative errno on error. + */ +static int get_exclude_memory_ranges(struct crash_mem **mem_ranges) +{ + int ret; + + ret = add_tce_mem_ranges(mem_ranges); + if (ret) + goto out; + + ret = add_initrd_mem_range(mem_ranges); + if (ret) + goto out; + + ret = add_htab_mem_range(mem_ranges); + if (ret) + goto out; + + ret = add_kernel_mem_range(mem_ranges); + if (ret) + goto out; + + ret = add_rtas_mem_range(mem_ranges); + if (ret) + goto out;
[PATCH v2 03/12] powerpc/kexec_file: add helper functions for getting memory ranges
In kexec case, the kernel to be loaded uses the same memory layout as the running kernel. So, passing on the DT of the running kernel would be good enough. But in case of kdump, different memory ranges are needed to manage loading the kdump kernel, booting into it and exporting the elfcore of the crashing kernel. The ranges are exlude memory ranges, usable memory ranges, reserved memory ranges and crash memory ranges. Exclude memory ranges specify the list of memory ranges to avoid while loading kdump segments. Usable memory ranges list the memory ranges that could be used for booting kdump kernel. Reserved memory ranges list the memory regions for the loading kernel's reserve map. Crash memory ranges list the memory ranges to be exported as the crashing kernel's elfcore. Add helper functions for setting up the above mentioned memory ranges. This helpers facilitate in understanding the subsequent changes better and make it easy to setup the different memory ranges listed above, as and when appropriate. Signed-off-by: Hari Bathini --- Changes in v2: * Added an option to merge ranges while sorting to minimize reallocations for memory ranges list. * Dropped within_crashkernel option for add_opal_mem_range() & add_rtas_mem_range() as it is not really needed. arch/powerpc/include/asm/kexec_ranges.h | 18 + arch/powerpc/kexec/Makefile |2 arch/powerpc/kexec/ranges.c | 397 +++ 3 files changed, 416 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/include/asm/kexec_ranges.h create mode 100644 arch/powerpc/kexec/ranges.c diff --git a/arch/powerpc/include/asm/kexec_ranges.h b/arch/powerpc/include/asm/kexec_ranges.h new file mode 100644 index 000..799dc40 --- /dev/null +++ b/arch/powerpc/include/asm/kexec_ranges.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _ASM_POWERPC_KEXEC_RANGES_H +#define _ASM_POWERPC_KEXEC_RANGES_H + +#define MEM_RANGE_CHUNK_SZ 2048/* Memory ranges size chunk */ + +struct crash_mem *realloc_mem_ranges(struct crash_mem **mem_ranges); +int add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size); +int add_tce_mem_ranges(struct crash_mem **mem_ranges); +int add_initrd_mem_range(struct crash_mem **mem_ranges); +int add_htab_mem_range(struct crash_mem **mem_ranges); +int add_kernel_mem_range(struct crash_mem **mem_ranges); +int add_rtas_mem_range(struct crash_mem **mem_ranges); +int add_opal_mem_range(struct crash_mem **mem_ranges); +int add_reserved_ranges(struct crash_mem **mem_ranges); +void sort_memory_ranges(struct crash_mem *mrngs, bool merge); + +#endif /* _ASM_POWERPC_KEXEC_RANGES_H */ diff --git a/arch/powerpc/kexec/Makefile b/arch/powerpc/kexec/Makefile index 67c3553..4aff684 100644 --- a/arch/powerpc/kexec/Makefile +++ b/arch/powerpc/kexec/Makefile @@ -7,7 +7,7 @@ obj-y += core.o crash.o core_$(BITS).o obj-$(CONFIG_PPC32)+= relocate_32.o -obj-$(CONFIG_KEXEC_FILE) += file_load.o file_load_$(BITS).o elf_$(BITS).o +obj-$(CONFIG_KEXEC_FILE) += file_load.o ranges.o file_load_$(BITS).o elf_$(BITS).o ifdef CONFIG_HAVE_IMA_KEXEC ifdef CONFIG_IMA diff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c new file mode 100644 index 000..a704819 --- /dev/null +++ b/arch/powerpc/kexec/ranges.c @@ -0,0 +1,397 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * powerpc code to implement the kexec_file_load syscall + * + * Copyright (C) 2004 Adam Litke (a...@us.ibm.com) + * Copyright (C) 2004 IBM Corp. + * Copyright (C) 2004,2005 Milton D Miller II, IBM Corporation + * Copyright (C) 2005 R Sharada (shar...@in.ibm.com) + * Copyright (C) 2006 Mohan Kumar M (mo...@in.ibm.com) + * Copyright (C) 2020 IBM Corporation + * + * Based on kexec-tools' kexec-ppc64.c, fs2dt.c. + * Heavily modified for the kernel by + * Hari Bathini . + */ + +#include +#include +#include +#include +#include + +/** + * get_max_nr_ranges - Get the max no. of ranges crash_mem structure + * could hold, given the size allocated for it. + * @size: Allocation size of crash_mem structure. + * + * Returns the maximum no. of ranges. + */ +static inline unsigned int get_max_nr_ranges(size_t size) +{ + return ((size - sizeof(struct crash_mem)) / + sizeof(struct crash_mem_range)); +} + +/** + * get_mem_rngs_size - Get the allocated size of mrngs based on + * max_nr_ranges and chunk size. + * @mrngs: Memory ranges. + * + * Returns the maximum no. of ranges. + */ +static inline size_t get_mem_rngs_size(struct crash_mem *mrngs) +{ + size_t size; + + if (!mrngs) + return 0; + + size = (sizeof(struct crash_mem) + + (mrngs->max_nr_ranges * sizeof(struct crash_mem_range))); + + /* +* Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ. +* So, align to get the actual
[PATCH v2 02/12] powerpc/kexec_file: mark PPC64 specific code
Some of the kexec_file_load code isn't PPC64 specific. Move PPC64 specific code from kexec/file_load.c to kexec/file_load_64.c. Also, rename purgatory/trampoline.S to purgatory/trampoline_64.S in the same spirit. Signed-off-by: Hari Bathini --- Changes in v2: * No changes. arch/powerpc/include/asm/kexec.h | 11 +++ arch/powerpc/kexec/Makefile|2 - arch/powerpc/kexec/elf_64.c|7 +- arch/powerpc/kexec/file_load.c | 37 ++ arch/powerpc/kexec/file_load_64.c | 108 ++ arch/powerpc/purgatory/Makefile|4 + arch/powerpc/purgatory/trampoline.S| 117 arch/powerpc/purgatory/trampoline_64.S | 117 8 files changed, 248 insertions(+), 155 deletions(-) create mode 100644 arch/powerpc/kexec/file_load_64.c delete mode 100644 arch/powerpc/purgatory/trampoline.S create mode 100644 arch/powerpc/purgatory/trampoline_64.S diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index c684768..7008ea1 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -114,8 +114,17 @@ int setup_purgatory(struct kimage *image, const void *slave_code, unsigned long fdt_load_addr); int setup_new_fdt(const struct kimage *image, void *fdt, unsigned long initrd_load_addr, unsigned long initrd_len, - const char *cmdline); + const char *cmdline, int *node); int delete_fdt_mem_rsv(void *fdt, unsigned long start, unsigned long size); + +#ifdef CONFIG_PPC64 +int setup_purgatory_ppc64(struct kimage *image, const void *slave_code, + const void *fdt, unsigned long kernel_load_addr, + unsigned long fdt_load_addr); +int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, + unsigned long initrd_load_addr, + unsigned long initrd_len, const char *cmdline); +#endif /* CONFIG_PPC64 */ #endif /* CONFIG_KEXEC_FILE */ #else /* !CONFIG_KEXEC_CORE */ diff --git a/arch/powerpc/kexec/Makefile b/arch/powerpc/kexec/Makefile index 86380c6..67c3553 100644 --- a/arch/powerpc/kexec/Makefile +++ b/arch/powerpc/kexec/Makefile @@ -7,7 +7,7 @@ obj-y += core.o crash.o core_$(BITS).o obj-$(CONFIG_PPC32)+= relocate_32.o -obj-$(CONFIG_KEXEC_FILE) += file_load.o elf_$(BITS).o +obj-$(CONFIG_KEXEC_FILE) += file_load.o file_load_$(BITS).o elf_$(BITS).o ifdef CONFIG_HAVE_IMA_KEXEC ifdef CONFIG_IMA diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c index 3072fd6..23ad04c 100644 --- a/arch/powerpc/kexec/elf_64.c +++ b/arch/powerpc/kexec/elf_64.c @@ -88,7 +88,8 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, goto out; } - ret = setup_new_fdt(image, fdt, initrd_load_addr, initrd_len, cmdline); + ret = setup_new_fdt_ppc64(image, fdt, initrd_load_addr, + initrd_len, cmdline); if (ret) goto out; @@ -107,8 +108,8 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, pr_debug("Loaded device tree at 0x%lx\n", fdt_load_addr); slave_code = elf_info.buffer + elf_info.proghdrs[0].p_offset; - ret = setup_purgatory(image, slave_code, fdt, kernel_load_addr, - fdt_load_addr); + ret = setup_purgatory_ppc64(image, slave_code, fdt, kernel_load_addr, + fdt_load_addr); if (ret) pr_err("Error setting up the purgatory.\n"); diff --git a/arch/powerpc/kexec/file_load.c b/arch/powerpc/kexec/file_load.c index 143c917..99a2c4d 100644 --- a/arch/powerpc/kexec/file_load.c +++ b/arch/powerpc/kexec/file_load.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * ppc64 code to implement the kexec_file_load syscall + * powerpc code to implement the kexec_file_load syscall * * Copyright (C) 2004 Adam Litke (a...@us.ibm.com) * Copyright (C) 2004 IBM Corp. @@ -16,26 +16,10 @@ #include #include -#include #include #include -#define SLAVE_CODE_SIZE256 - -const struct kexec_file_ops * const kexec_file_loaders[] = { - _elf64_ops, - NULL -}; - -int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, - unsigned long buf_len) -{ - /* We don't support crash kernels yet. */ - if (image->type == KEXEC_TYPE_CRASH) - return -EOPNOTSUPP; - - return kexec_image_probe_default(image, buf, buf_len); -} +#define SLAVE_CODE_SIZE256 /* First 0x100 bytes */ /** * setup_purgatory - initialize the purgatory's global variables @@ -127,24 +111,17 @@ int delete_fdt_mem_rsv(void *fdt, unsigned long start, unsigned long size) * @initrd_len:
[PATCH v2 01/12] kexec_file: allow archs to handle special regions while locating memory hole
Some architectures may have special memory regions, within the given memory range, which can't be used for the buffer in a kexec segment. Implement weak arch_kexec_locate_mem_hole() definition which arch code may override, to take care of special regions, while trying to locate a memory hole. Also, add the missing declarations for arch overridable functions and and drop the __weak descriptors in the declarations to avoid non-weak definitions from becoming weak. Reported-by: kernel test robot [lkp: In v1, arch_kimage_file_post_load_cleanup() declaration was missing] Signed-off-by: Hari Bathini --- Changes in v2: * Introduced arch_kexec_locate_mem_hole() for override and dropped weak arch_kexec_add_buffer(). * Dropped __weak identifier for arch overridable functions. * Fixed the missing declaration for arch_kimage_file_post_load_cleanup() reported by lkp. lkp report for reference: - https://lore.kernel.org/patchwork/patch/1264418/ include/linux/kexec.h | 29 ++--- kernel/kexec_file.c | 16 ++-- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index ea67910..9e93bef 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -183,17 +183,24 @@ int kexec_purgatory_get_set_symbol(struct kimage *image, const char *name, bool get_value); void *kexec_purgatory_get_symbol_addr(struct kimage *image, const char *name); -int __weak arch_kexec_kernel_image_probe(struct kimage *image, void *buf, -unsigned long buf_len); -void * __weak arch_kexec_kernel_image_load(struct kimage *image); -int __weak arch_kexec_apply_relocations_add(struct purgatory_info *pi, - Elf_Shdr *section, - const Elf_Shdr *relsec, - const Elf_Shdr *symtab); -int __weak arch_kexec_apply_relocations(struct purgatory_info *pi, - Elf_Shdr *section, - const Elf_Shdr *relsec, - const Elf_Shdr *symtab); +/* Architectures may override the below functions */ +int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, + unsigned long buf_len); +void *arch_kexec_kernel_image_load(struct kimage *image); +int arch_kexec_apply_relocations_add(struct purgatory_info *pi, +Elf_Shdr *section, +const Elf_Shdr *relsec, +const Elf_Shdr *symtab); +int arch_kexec_apply_relocations(struct purgatory_info *pi, +Elf_Shdr *section, +const Elf_Shdr *relsec, +const Elf_Shdr *symtab); +int arch_kimage_file_post_load_cleanup(struct kimage *image); +#ifdef CONFIG_KEXEC_SIG +int arch_kexec_kernel_verify_sig(struct kimage *image, void *buf, +unsigned long buf_len); +#endif +int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf); extern int kexec_add_buffer(struct kexec_buf *kbuf); int kexec_locate_mem_hole(struct kexec_buf *kbuf); diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 09cc78d..e89912d 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -636,6 +636,19 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf) } /** + * arch_kexec_locate_mem_hole - Find free memory to place the segments. + * @kbuf: Parameters for the memory search. + * + * On success, kbuf->mem will have the start address of the memory region found. + * + * Return: 0 on success, negative errno on error. + */ +int __weak arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) +{ + return kexec_locate_mem_hole(kbuf); +} + +/** * kexec_add_buffer - place a buffer in a kexec segment * @kbuf: Buffer contents and memory parameters. * @@ -647,7 +660,6 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf) */ int kexec_add_buffer(struct kexec_buf *kbuf) { - struct kexec_segment *ksegment; int ret; @@ -675,7 +687,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf) kbuf->buf_align = max(kbuf->buf_align, PAGE_SIZE); /* Walk the RAM ranges and allocate a suitable range for the buffer */ - ret = kexec_locate_mem_hole(kbuf); + ret = arch_kexec_locate_mem_hole(kbuf); if (ret) return ret;
[PATCH v2 00/12] ppc64: enable kdump support for kexec_file_load syscall
This patch series enables kdump support for kexec_file_load system call (kexec -s -p) on PPC64. The changes are inspired from kexec-tools code but heavily modified for kernel consumption. There is scope to expand purgatory to verify sha256 digest along with other improvements in purgatory code. Will deal with those changes in a separate patch series later. The first patch adds a weak arch_kexec_locate_mem_hole() function to override locate memory hole logic suiting arch needs. There are some special regions in ppc64 which should be avoided while loading buffer & there are multiple callers to kexec_add_buffer making it complicated to maintain range sanity and using generic lookup at the same time. The second patch marks ppc64 specific code within arch/powerpc/kexec and arch/powerpc/purgatory to make the subsequent code changes easy to understand. The next patch adds helper function to setup different memory ranges needed for loading kdump kernel, booting into it and exporting the crashing kernel's elfcore. The fourth patch overrides arch_kexec_locate_mem_hole() function to locate memory hole for kdump segments by accounting for the special memory regions, referred to as excluded memory ranges, and sets kbuf->mem when a suitable memory region is found. The fifth patch moves walk_drmem_lmbs() out of .init section with a few changes to reuse it for setting up kdump kernel's usable memory ranges. The next patch uses walk_drmem_lmbs() to look up the LMBs and set linux,drconf-usable-memory & linux,usable-memory properties in order to restrict kdump kernel's memory usage. The seventh patch adds relocation support for the purgatory. Patch 8 helps setup the stack for the purgatory. The next patch setups up backup region as a segment while loading kdump kernel and teaches purgatory to copy it from source to destination. Patch 10 builds the elfcore header for the running kernel & passes the info to kdump kernel via "elfcorehdr=" parameter to export as /proc/vmcore file. The next patch sets up the memory reserve map for the kexec kernel and also claims kdump support for kdump as all the necessary changes are added. The last patch fixes a lookup issue for `kexec -l -s` case when memory is reserved for crashkernel. Tested the changes successfully on P8, P9 lpars, couple of OpenPOWER boxes and a simulator. Changes in v2: * Introduced arch_kexec_locate_mem_hole() for override and dropped weak arch_kexec_add_buffer(). * Addressed warnings reported by lkp. * Added patch to address kexec load issue when memory is reserved for crashkernel. * Used the appropriate license header for the new files added. * Added an option to merge ranges to minimize reallocations while adding memory ranges. * Dropped within_crashkernel parameter for add_opal_mem_range() & add_rtas_mem_range() functions as it is not really needed. --- Hari Bathini (12): kexec_file: allow archs to handle special regions while locating memory hole powerpc/kexec_file: mark PPC64 specific code powerpc/kexec_file: add helper functions for getting memory ranges ppc64/kexec_file: avoid stomping memory used by special regions powerpc/drmem: make lmb walk a bit more flexible ppc64/kexec_file: restrict memory usage of kdump kernel ppc64/kexec_file: add support to relocate purgatory ppc64/kexec_file: setup the stack for purgatory ppc64/kexec_file: setup backup region for kdump kernel ppc64/kexec_file: prepare elfcore header for crashing kernel ppc64/kexec_file: add appropriate regions for memory reserve map ppc64/kexec_file: fix kexec load failure with lack of memory hole arch/powerpc/include/asm/crashdump-ppc64.h | 15 arch/powerpc/include/asm/drmem.h |9 arch/powerpc/include/asm/kexec.h | 35 + arch/powerpc/include/asm/kexec_ranges.h| 18 arch/powerpc/include/asm/purgatory.h | 11 arch/powerpc/kernel/prom.c | 13 arch/powerpc/kexec/Makefile|2 arch/powerpc/kexec/elf_64.c| 35 + arch/powerpc/kexec/file_load.c | 78 + arch/powerpc/kexec/file_load_64.c | 1509 arch/powerpc/kexec/ranges.c| 397 +++ arch/powerpc/mm/drmem.c| 87 +- arch/powerpc/mm/numa.c | 13 arch/powerpc/purgatory/Makefile| 28 - arch/powerpc/purgatory/purgatory_64.c | 36 + arch/powerpc/purgatory/trampoline.S| 117 -- arch/powerpc/purgatory/trampoline_64.S | 175 +++ include/linux/kexec.h | 29 - kernel/kexec_file.c| 16 19 files changed, 2413 insertions(+), 210 deletions(-) create mode 100644 arch/powerpc/include/asm/crashdump-ppc64.h create mode 100644 arch/powerpc/include/asm/kexec_ranges.h create mode 100644 arch/powerpc/include/asm/purgatory.h create mode 100644 arch/powerpc/kexec/file_load_64.c create
[PATCH] MAINTAINERS: Add Shengjiu to reviewer list of sound/soc/fsl
Add Shengjiu who's actively working on the latest fsl/nxp audio drivers. Signed-off-by: Nicolin Chen Cc: Shengjiu Wang --- To Shengjiu, please ack if you feel okay with this (your email address too). MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 496fd4eafb68..54aab083bb88 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6956,6 +6956,7 @@ M:Timur Tabi M: Nicolin Chen M: Xiubo Li R: Fabio Estevam +R: Shengjiu Wang L: alsa-de...@alsa-project.org (moderated for non-subscribers) L: linuxppc-dev@lists.ozlabs.org S: Maintained -- 2.17.1
[PATCH v2 6/6] ASoC: fsl: fsl_esai: fix kernel-doc
Fix W=1 warnings. Fix kernel-doc syntax and add missing parameters. Acked-by: Nicolin Chen Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl_esai.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index cbcb70d6f8c8..b8fbd7ba94af 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -22,8 +22,7 @@ SNDRV_PCM_FMTBIT_S24_LE) /** - * fsl_esai_soc_data: soc specific data - * + * struct fsl_esai_soc_data - soc specific data * @imx: for imx platform * @reset_at_xrun: flags for enable reset operaton */ @@ -33,8 +32,7 @@ struct fsl_esai_soc_data { }; /** - * fsl_esai: ESAI private data - * + * struct fsl_esai - ESAI private data * @dma_params_rx: DMA parameters for receive channel * @dma_params_tx: DMA parameters for transmit channel * @pdev: platform device pointer @@ -49,6 +47,8 @@ struct fsl_esai_soc_data { * @fifo_depth: depth of tx/rx FIFO * @slot_width: width of each DAI slot * @slots: number of slots + * @tx_mask: slot mask for TX + * @rx_mask: slot mask for RX * @channels: channel num for tx or rx * @hck_rate: clock rate of desired HCKx clock * @sck_rate: clock rate of desired SCKx clock @@ -157,13 +157,15 @@ static irqreturn_t esai_isr(int irq, void *devid) } /** - * This function is used to calculate the divisors of psr, pm, fp and it is - * supposed to be called in set_dai_sysclk() and set_bclk(). + * fsl_esai_divisor_cal - This function is used to calculate the + * divisors of psr, pm, fp and it is supposed to be called in + * set_dai_sysclk() and set_bclk(). * + * @dai: pointer to DAI + * @tx: current setting is for playback or capture * @ratio: desired overall ratio for the paticipating dividers * @usefp: for HCK setting, there is no need to set fp divider * @fp: bypass other dividers by setting fp directly if fp != 0 - * @tx: current setting is for playback or capture */ static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio, bool usefp, u32 fp) @@ -250,13 +252,12 @@ static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio, } /** - * This function mainly configures the clock frequency of MCLK (HCKT/HCKR) - * - * @Parameters: - * clk_id: The clock source of HCKT/HCKR + * fsl_esai_set_dai_sysclk - configure the clock frequency of MCLK (HCKT/HCKR) + * @dai: pointer to DAI + * @clk_id: The clock source of HCKT/HCKR * (Input from outside; output from inside, FSYS or EXTAL) - * freq: The required clock rate of HCKT/HCKR - * dir: The clock direction of HCKT/HCKR + * @freq: The required clock rate of HCKT/HCKR + * @dir: The clock direction of HCKT/HCKR * * Note: If the direction is input, we do not care about clk_id. */ @@ -358,7 +359,10 @@ static int fsl_esai_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, } /** - * This function configures the related dividers according to the bclk rate + * fsl_esai_set_bclk - configure the related dividers according to the bclk rate + * @dai: pointer to DAI + * @tx: direction boolean + * @freq: bclk freq */ static int fsl_esai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq) { -- 2.25.1
[PATCH v2 5/6] ASoC: fsl: fsl_asrc: fix kernel-doc
Fix W=1 warnings. fix kernel doc and describe arguments. Acked-by: Nicolin Chen Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl_asrc.c | 57 +++- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 462ce9f9ab48..02c81d2e34ad 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -37,7 +37,7 @@ static struct snd_pcm_hw_constraint_list fsl_asrc_rate_constraints = { .list = supported_asrc_rate, }; -/** +/* * The following tables map the relationship between asrc_inclk/asrc_outclk in * fsl_asrc.h and the registers of ASRCSR */ @@ -68,7 +68,7 @@ static unsigned char output_clk_map_imx53[ASRC_CLK_MAP_LEN] = { 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, }; -/** +/* * i.MX8QM/i.MX8QXP uses the same map for input and output. * clk_map_imx8qm[0] is for i.MX8QM asrc0 * clk_map_imx8qm[1] is for i.MX8QM asrc1 @@ -102,16 +102,17 @@ static unsigned char clk_map_imx8qxp[2][ASRC_CLK_MAP_LEN] = { }; /** - * Select the pre-processing and post-processing options + * fsl_asrc_sel_proc - Select the pre-processing and post-processing options + * @inrate: input sample rate + * @outrate: output sample rate + * @pre_proc: return value for pre-processing option + * @post_proc: return value for post-processing option + * * Make sure to exclude following unsupported cases before * calling this function: * 1) inrate > 8.125 * outrate * 2) inrate > 16.125 * outrate * - * inrate: input sample rate - * outrate: output sample rate - * pre_proc: return value for pre-processing option - * post_proc: return value for post-processing option */ static void fsl_asrc_sel_proc(int inrate, int outrate, int *pre_proc, int *post_proc) @@ -148,7 +149,9 @@ static void fsl_asrc_sel_proc(int inrate, int outrate, } /** - * Request ASRC pair + * fsl_asrc_request_pair - Request ASRC pair + * @channels: number of channels + * @pair: pointer to pair * * It assigns pair by the order of A->C->B because allocation of pair B, * within range [ANCA, ANCA+ANCB-1], depends on the channels of pair A @@ -193,7 +196,8 @@ static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair) } /** - * Release ASRC pair + * fsl_asrc_release_pair - Release ASRC pair + * @pair: pair to release * * It clears the resource from asrc and releases the occupied channels. */ @@ -217,7 +221,10 @@ static void fsl_asrc_release_pair(struct fsl_asrc_pair *pair) } /** - * Configure input and output thresholds + * fsl_asrc_set_watermarks- configure input and output thresholds + * @pair: pointer to pair + * @in: input threshold + * @out: output threshold */ static void fsl_asrc_set_watermarks(struct fsl_asrc_pair *pair, u32 in, u32 out) { @@ -234,7 +241,9 @@ static void fsl_asrc_set_watermarks(struct fsl_asrc_pair *pair, u32 in, u32 out) } /** - * Calculate the total divisor between asrck clock rate and sample rate + * fsl_asrc_cal_asrck_divisor - Calculate the total divisor between asrck clock rate and sample rate + * @pair: pointer to pair + * @div: divider * * It follows the formula clk_rate = samplerate * (2 ^ prescaler) * divider */ @@ -250,7 +259,10 @@ static u32 fsl_asrc_cal_asrck_divisor(struct fsl_asrc_pair *pair, u32 div) } /** - * Calculate and set the ratio for Ideal Ratio mode only + * fsl_asrc_set_ideal_ratio - Calculate and set the ratio for Ideal Ratio mode only + * @pair: pointer to pair + * @inrate: input rate + * @outrate: output rate * * The ratio is a 32-bit fixed point value with 26 fractional bits. */ @@ -293,7 +305,9 @@ static int fsl_asrc_set_ideal_ratio(struct fsl_asrc_pair *pair, } /** - * Configure the assigned ASRC pair + * fsl_asrc_config_pair - Configure the assigned ASRC pair + * @pair: pointer to pair + * @use_ideal_rate: boolean configuration * * It configures those ASRC registers according to a configuration instance * of struct asrc_config which includes in/output sample rate, width, channel @@ -508,7 +522,8 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) } /** - * Start the assigned ASRC pair + * fsl_asrc_start_pair - Start the assigned ASRC pair + * @pair: pointer to pair * * It enables the assigned pair and makes it stopped at the stall level. */ @@ -539,7 +554,8 @@ static void fsl_asrc_start_pair(struct fsl_asrc_pair *pair) } /** - * Stop the assigned ASRC pair + * fsl_asrc_stop_pair - Stop the assigned ASRC pair + * @pair: pointer to pair */ static void fsl_asrc_stop_pair(struct fsl_asrc_pair *pair) { @@ -552,7 +568,9 @@ static void fsl_asrc_stop_pair(struct fsl_asrc_pair *pair) } /** - * Get DMA channel according to the pair and direction. + * fsl_asrc_get_dma_channel- Get DMA channel according to the pair and direction. + * @pair: pointer to pair + * @dir: DMA
[PATCH v2 4/6] ASoC: fsl: fsl_spdif: fix kernel-doc
Fix W=1 warnings. kernel-doc syntax was not followed and missing parameter Acked-by: Nicolin Chen Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl_spdif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 5b2689ae63d4..9fb95c6ee7ba 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -81,8 +81,8 @@ struct spdif_mixer_control { }; /** - * fsl_spdif_priv: Freescale SPDIF private data - * + * struct fsl_spdif_priv - Freescale SPDIF private data + * @soc: SPDIF soc data * @fsl_spdif_control: SPDIF control data * @cpu_dai_drv: cpu dai driver * @pdev: platform device pointer @@ -100,6 +100,7 @@ struct spdif_mixer_control { * @spbaclk: SPBA clock (optional, depending on SoC design) * @dma_params_tx: DMA parameters for transmit channel * @dma_params_rx: DMA parameters for receive channel + * @regcache_srpc: regcache for SRPC */ struct fsl_spdif_priv { const struct fsl_spdif_soc_data *soc; -- 2.25.1
[PATCH v2 2/6] ASoC: fsl: fsl_ssi: fix kernel-doc
Fix W=1 warnings. The kernel-doc support is partial, add more descriptions and follow proper syntax Acked-by: Nicolin Chen Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl_ssi.c | 70 ++--- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 1a2fa7f18142..7ec80b240563 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -203,12 +203,10 @@ struct fsl_ssi_soc_data { }; /** - * fsl_ssi: per-SSI private data - * + * struct fsl_ssi - per-SSI private data * @regs: Pointer to the regmap registers * @irq: IRQ of this SSI * @cpu_dai_drv: CPU DAI driver for this device - * * @dai_fmt: DAI configuration this device is currently used with * @streams: Mask of current active streams: BIT(TX) and BIT(RX) * @i2s_net: I2S and Network mode configurations of SCR register @@ -221,38 +219,29 @@ struct fsl_ssi_soc_data { * @slot_width: Width of each DAI slot * @slots: Number of slots * @regvals: Specific RX/TX register settings - * * @clk: Clock source to access register * @baudclk: Clock source to generate bit and frame-sync clocks * @baudclk_streams: Active streams that are using baudclk - * * @regcache_sfcsr: Cache sfcsr register value during suspend and resume * @regcache_sacnt: Cache sacnt register value during suspend and resume - * * @dma_params_tx: DMA transmit parameters * @dma_params_rx: DMA receive parameters * @ssi_phys: physical address of the SSI registers - * * @fiq_params: FIQ stream filtering parameters - * * @card_pdev: Platform_device pointer to register a sound card for PowerPC or * to register a CODEC platform device for AC97 * @card_name: Platform_device name to register a sound card for PowerPC or * to register a CODEC platform device for AC97 * @card_idx: The index of SSI to register a sound card for PowerPC or *to register a CODEC platform device for AC97 - * * @dbg_stats: Debugging statistics - * * @soc: SoC specific data * @dev: Pointer to >dev - * * @fifo_watermark: The FIFO watermark setting. Notifies DMA when there are * @fifo_watermark or fewer words in TX fifo or * @fifo_watermark or more empty words in RX fifo. * @dma_maxburst: Max number of words to transfer in one go. So far, *this is always the same as fifo_watermark. - * * @ac97_reg_lock: Mutex lock to serialize AC97 register access operations */ struct fsl_ssi { @@ -374,7 +363,9 @@ static bool fsl_ssi_is_i2s_cbm_cfs(struct fsl_ssi *ssi) } /** - * Interrupt handler to gather states + * fsl_ssi_irq - Interrupt handler to gather states + * @irq: irq number + * @dev_id: context */ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id) { @@ -395,7 +386,10 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id) } /** - * Set SCR, SIER, STCR and SRCR registers with cached values in regvals + * fsl_ssi_config_enable - Set SCR, SIER, STCR and SRCR registers with + * cached values in regvals + * @ssi: SSI context + * @tx: direction * * Notes: * 1) For offline_config SoCs, enable all necessary bits of both streams @@ -474,7 +468,7 @@ static void fsl_ssi_config_enable(struct fsl_ssi *ssi, bool tx) ssi->streams |= BIT(dir); } -/** +/* * Exclude bits that are used by the opposite stream * * When both streams are active, disabling some bits for the current stream @@ -495,7 +489,10 @@ static void fsl_ssi_config_enable(struct fsl_ssi *ssi, bool tx) ((vals) & _ssi_xor_shared_bits(vals, avals, aactive)) /** - * Unset SCR, SIER, STCR and SRCR registers with cached values in regvals + * fsl_ssi_config_disable - Unset SCR, SIER, STCR and SRCR registers + * with cached values in regvals + * @ssi: SSI context + * @tx: direction * * Notes: * 1) For offline_config SoCs, to avoid online reconfigurations, disable all @@ -577,7 +574,9 @@ static void fsl_ssi_tx_ac97_saccst_setup(struct fsl_ssi *ssi) } /** - * Cache critical bits of SIER, SRCR, STCR and SCR to later set them safely + * fsl_ssi_setup_regvals - Cache critical bits of SIER, SRCR, STCR and + * SCR to later set them safely + * @ssi: SSI context */ static void fsl_ssi_setup_regvals(struct fsl_ssi *ssi) { @@ -661,9 +660,12 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream, } /** - * Configure Digital Audio Interface bit clock + * fsl_ssi_set_bclk - Configure Digital Audio Interface bit clock + * @substream: ASoC substream + * @dai: pointer to DAI + * @hw_params: pointers to hw_params * - * Note: This function can be only called when using SSI as DAI master + * Notes: This function can be only called when using SSI as DAI master * * Quick instruction for parameters: * freq: Output BCLK frequency = samplerate * slots * slot_width @@ -782,7 +784,10 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, } /** - *
[PATCH v2 3/6] ASoC: fsl: fsl-asoc-card: fix kernel-doc
Fix W=1 warnings. Kernel-doc syntax was not properly used. Acked-by: Nicolin Chen Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl-asoc-card.c | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 57ea1b072326..faac6ce9a82c 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -33,8 +33,7 @@ #define DAI_FMT_BASE (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF) /** - * CODEC private data - * + * struct codec_priv - CODEC private data * @mclk_freq: Clock rate of MCLK * @mclk_id: MCLK (or main clock) id for set_sysclk() * @fll_id: FLL (or secordary clock) id for set_sysclk() @@ -48,11 +47,10 @@ struct codec_priv { }; /** - * CPU private data - * - * @sysclk_freq[2]: SYSCLK rates for set_sysclk() - * @sysclk_dir[2]: SYSCLK directions for set_sysclk() - * @sysclk_id[2]: SYSCLK ids for set_sysclk() + * struct cpu_priv - CPU private data + * @sysclk_freq: SYSCLK rates for set_sysclk() + * @sysclk_dir: SYSCLK directions for set_sysclk() + * @sysclk_id: SYSCLK ids for set_sysclk() * @slot_width: Slot width of each frame * * Note: [1] for tx and [0] for rx @@ -65,9 +63,8 @@ struct cpu_priv { }; /** - * Freescale Generic ASOC card private data - * - * @dai_link[3]: DAI link structure including normal one and DPCM link + * struct fsl_asoc_card_priv - Freescale Generic ASOC card private data + * @dai_link: DAI link structure including normal one and DPCM link * @pdev: platform device pointer * @codec_priv: CODEC private data * @cpu_priv: CPU private data @@ -94,8 +91,8 @@ struct fsl_asoc_card_priv { char name[32]; }; -/** - * This dapm route map exsits for DPCM link only. +/* + * This dapm route map exits for DPCM link only. * The other routes shall go through Device Tree. * * Note: keep all ASRC routes in the second half -- 2.25.1
[PATCH v2 1/6] ASoC: fsl: fsl_ssi_dbg: remove spurious kernel-doc comment start
Fix W=1 warnings. There is no kernel-doc here. Acked-by: Nicolin Chen Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl_ssi_dbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi_dbg.c b/sound/soc/fsl/fsl_ssi_dbg.c index 2a20ee23dc52..2c46c55f0a88 100644 --- a/sound/soc/fsl/fsl_ssi_dbg.c +++ b/sound/soc/fsl/fsl_ssi_dbg.c @@ -78,7 +78,7 @@ void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *dbg, u32 sisr) dbg->stats.tfe0++; } -/** +/* * Show the statistics of a flag only if its interrupt is enabled * * Compilers will optimize it to a no-op if the interrupt is disabled @@ -90,7 +90,7 @@ void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *dbg, u32 sisr) } while (0) -/** +/* * Display the statistics for the current SSI device * * To avoid confusion, only show those counts that are enabled -- 2.25.1
Re: [PATCH 6/6] ASoC: fsl: fsl_esai: fix kernel-doc
On 7/2/20 1:55 PM, Nicolin Chen wrote: On Thu, Jul 02, 2020 at 12:22:27PM -0500, Pierre-Louis Bossart wrote: Fix W=1 warnings. Fix kernel-doc syntax and add missing parameters. Signed-off-by: Pierre-Louis Bossart + * fsl_esai_set_dai_sysclk - This function mainly configures the clock frequency of MCLK (HCKT/HCKR) Can drop "This function mainly" /** - * This function configures the related dividers according to the bclk rate + * fsl_esai_set_bclk - This function configures the related dividers according to the bclk rate Here too -- dropping "This function" will fix both, thanks for reviewing the edits. Otherwise, Acked-by: Nicolin Chen Thanks!
Re: [PATCH 3/6] ASoC: fsl: fsl-asoc-card: fix kernel-doc
On 7/2/20 1:47 PM, Nicolin Chen wrote: On Thu, Jul 02, 2020 at 12:22:24PM -0500, Pierre-Louis Bossart wrote: Fix W=1 warnings. Kernel-doc syntax was not properly used. Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl-asoc-card.c | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c /** - * Freescale Generic ASOC card private data + * struct fsl_asoc_card_priv - struct Freescale Generic ASOC card private data Just a nit, can you drop the "struct" before "Freescale"? Other parts of your changes don't really add this word. will do, thanks for spotting this. Otherwise, Acked-by: Nicolin Chen
Re: [PATCH 6/6] ASoC: fsl: fsl_esai: fix kernel-doc
On Thu, Jul 02, 2020 at 12:22:27PM -0500, Pierre-Louis Bossart wrote: > Fix W=1 warnings. Fix kernel-doc syntax and add missing parameters. > > Signed-off-by: Pierre-Louis Bossart > + * fsl_esai_set_dai_sysclk - This function mainly configures the clock > frequency of MCLK (HCKT/HCKR) Can drop "This function mainly" > /** > - * This function configures the related dividers according to the bclk rate > + * fsl_esai_set_bclk - This function configures the related dividers > according to the bclk rate Here too -- dropping "This function" Otherwise, Acked-by: Nicolin Chen Thanks!
Re: [PATCH 5/6] ASoC: fsl: fsl_asrc: fix kernel-doc
On Thu, Jul 02, 2020 at 12:22:26PM -0500, Pierre-Louis Bossart wrote: > Fix W=1 warnings. fix kernel doc and describe arguments. > > Signed-off-by: Pierre-Louis Bossart Acked-by: Nicolin Chen
Re: [PATCH 4/6] ASoC: fsl: fsl_spdif: fix kernel-doc
On Thu, Jul 02, 2020 at 12:22:25PM -0500, Pierre-Louis Bossart wrote: > Fix W=1 warnings. kernel-doc syntax was not followed and missing parameter > > Signed-off-by: Pierre-Louis Bossart Acked-by: Nicolin Chen
Re: [PATCH 3/6] ASoC: fsl: fsl-asoc-card: fix kernel-doc
On Thu, Jul 02, 2020 at 12:22:24PM -0500, Pierre-Louis Bossart wrote: > Fix W=1 warnings. Kernel-doc syntax was not properly used. > > Signed-off-by: Pierre-Louis Bossart > --- > sound/soc/fsl/fsl-asoc-card.c | 21 + > 1 file changed, 9 insertions(+), 12 deletions(-) > > diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c > /** > - * Freescale Generic ASOC card private data > + * struct fsl_asoc_card_priv - struct Freescale Generic ASOC card private > data Just a nit, can you drop the "struct" before "Freescale"? Other parts of your changes don't really add this word. Otherwise, Acked-by: Nicolin Chen
Re: [PATCH 2/6] ASoC: fsl: fsl_ssi: fix kernel-doc
On Thu, Jul 02, 2020 at 12:22:23PM -0500, Pierre-Louis Bossart wrote: > Fix W=1 warnings. The kernel-doc support is partial, add more > descriptions and follow proper syntax > > Signed-off-by: Pierre-Louis Bossart Acked-by: Nicolin Chen
Re: [PATCH v6 0/2] Append new variables to vmcoreinfo (TCR_EL1.T1SZ for arm64 and MAX_PHYSMEM_BITS for all archs)
On Thu, Jul 2, 2020 at 10:45 PM Catalin Marinas wrote: > > On Thu, 14 May 2020 00:22:35 +0530, Bhupesh Sharma wrote: > > Apologies for the delayed update. Its been quite some time since I > > posted the last version (v5), but I have been really caught up in some > > other critical issues. > > > > Changes since v5: > > > > - v5 can be viewed here: > > http://lists.infradead.org/pipermail/kexec/2019-November/024055.html > > - Addressed review comments from James Morse and Boris. > > - Added Tested-by received from John on v5 patchset. > > - Rebased against arm64 (for-next/ptr-auth) branch which has Amit's > > patchset for ARMv8.3-A Pointer Authentication feature vmcoreinfo > > applied. > > > > [...] > > Applied to arm64 (for-next/vmcoreinfo), thanks! > > [1/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo > https://git.kernel.org/arm64/c/1d50e5d0c505 > [2/2] arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo > https://git.kernel.org/arm64/c/bbdbc11804ff Thanks Catalin for pulling in the changes. Dave and James, many thanks for reviewing the same as well. Regards, Bhupesh
Re: [PATCH 1/6] ASoC: fsl: fsl_ssi_dbg: remove spurious kernel-doc comment start
On Thu, Jul 02, 2020 at 12:22:22PM -0500, Pierre-Louis Bossart wrote: > Fix W=1 warnings. There is no kernel-doc here. > > Signed-off-by: Pierre-Louis Bossart Acked-by: Nicolin Chen
Re: [PATCH 0/4] ASoC: fsl_asrc: allow selecting arbitrary clocks
Hi Arnaud, On Thu, Jul 02, 2020 at 04:22:31PM +0200, Arnaud Ferraris wrote: > The current ASRC driver hardcodes the input and output clocks used for > sample rate conversions. In order to allow greater flexibility and to > cover more use cases, it would be preferable to select the clocks using > device-tree properties. We recent just merged a new change that auto-selecting internal clocks based on sample rates as the first option -- ideal ratio mode is the fallback mode now. Please refer to: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20200702=d0250cf4f2abfbea64ed247230f08f5ae23979f0 Having a quick review at your changes, I think the DT part may not be necessary as it's more likely a software configuration. I personally like the new auto-selecting solution more. > This series also fix register configuration and clock assignment so > conversion can be conducted effectively in both directions with a good > quality. If there's any further change that you feel you can improve on the top of mentioned change after rebasing, I'd like to review. Thanks Nic
Re: [PATCH 17/20] block: rename generic_make_request to submit_bio_noacct
On Wed, Jul 1, 2020 at 2:01 AM Christoph Hellwig wrote: > > generic_make_request has always been very confusingly misnamed, so rename > it to submit_bio_noacct to make it clear that it is submit_bio minus > accounting and a few checks. > > Signed-off-by: Christoph Hellwig > --- [...] > drivers/md/md-faulty.c| 4 +-- > drivers/md/md-linear.c| 4 +-- > drivers/md/md-multipath.c | 4 +-- > drivers/md/raid0.c| 8 ++--- > drivers/md/raid1.c| 14 > drivers/md/raid10.c | 28 > drivers/md/raid5.c| 10 +++--- For md part: Acked-by: Song Liu
[Bug 208181] BUG: KASAN: stack-out-of-bounds in strcmp+0x58/0xd8
https://bugzilla.kernel.org/show_bug.cgi?id=208181 --- Comment #13 from Christophe Leroy (christophe.le...@csgroup.eu) --- Thanks for testing. Regarding the two BATs, I suggest you increase CONFIG_DATA_SHIFT as explained in a previous comment. -- You are receiving this mail because: You are watching the assignee of the bug.
[PATCH 6/6] ASoC: fsl: fsl_esai: fix kernel-doc
Fix W=1 warnings. Fix kernel-doc syntax and add missing parameters. Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl_esai.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index cbcb70d6f8c8..a1db69061b4b 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -22,8 +22,7 @@ SNDRV_PCM_FMTBIT_S24_LE) /** - * fsl_esai_soc_data: soc specific data - * + * struct fsl_esai_soc_data - soc specific data * @imx: for imx platform * @reset_at_xrun: flags for enable reset operaton */ @@ -33,8 +32,7 @@ struct fsl_esai_soc_data { }; /** - * fsl_esai: ESAI private data - * + * struct fsl_esai - ESAI private data * @dma_params_rx: DMA parameters for receive channel * @dma_params_tx: DMA parameters for transmit channel * @pdev: platform device pointer @@ -49,6 +47,8 @@ struct fsl_esai_soc_data { * @fifo_depth: depth of tx/rx FIFO * @slot_width: width of each DAI slot * @slots: number of slots + * @tx_mask: slot mask for TX + * @rx_mask: slot mask for RX * @channels: channel num for tx or rx * @hck_rate: clock rate of desired HCKx clock * @sck_rate: clock rate of desired SCKx clock @@ -157,13 +157,15 @@ static irqreturn_t esai_isr(int irq, void *devid) } /** - * This function is used to calculate the divisors of psr, pm, fp and it is - * supposed to be called in set_dai_sysclk() and set_bclk(). + * fsl_esai_divisor_cal - This function is used to calculate the + * divisors of psr, pm, fp and it is supposed to be called in + * set_dai_sysclk() and set_bclk(). * + * @dai: pointer to DAI + * @tx: current setting is for playback or capture * @ratio: desired overall ratio for the paticipating dividers * @usefp: for HCK setting, there is no need to set fp divider * @fp: bypass other dividers by setting fp directly if fp != 0 - * @tx: current setting is for playback or capture */ static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio, bool usefp, u32 fp) @@ -250,13 +252,12 @@ static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio, } /** - * This function mainly configures the clock frequency of MCLK (HCKT/HCKR) - * - * @Parameters: - * clk_id: The clock source of HCKT/HCKR + * fsl_esai_set_dai_sysclk - This function mainly configures the clock frequency of MCLK (HCKT/HCKR) + * @dai: pointer to DAI + * @clk_id: The clock source of HCKT/HCKR * (Input from outside; output from inside, FSYS or EXTAL) - * freq: The required clock rate of HCKT/HCKR - * dir: The clock direction of HCKT/HCKR + * @freq: The required clock rate of HCKT/HCKR + * @dir: The clock direction of HCKT/HCKR * * Note: If the direction is input, we do not care about clk_id. */ @@ -358,7 +359,10 @@ static int fsl_esai_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, } /** - * This function configures the related dividers according to the bclk rate + * fsl_esai_set_bclk - This function configures the related dividers according to the bclk rate + * @dai: pointer to DAI + * @tx: direction boolean + * @freq: bclk freq */ static int fsl_esai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq) { -- 2.25.1
[PATCH 4/6] ASoC: fsl: fsl_spdif: fix kernel-doc
Fix W=1 warnings. kernel-doc syntax was not followed and missing parameter Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl_spdif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 5b2689ae63d4..9fb95c6ee7ba 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -81,8 +81,8 @@ struct spdif_mixer_control { }; /** - * fsl_spdif_priv: Freescale SPDIF private data - * + * struct fsl_spdif_priv - Freescale SPDIF private data + * @soc: SPDIF soc data * @fsl_spdif_control: SPDIF control data * @cpu_dai_drv: cpu dai driver * @pdev: platform device pointer @@ -100,6 +100,7 @@ struct spdif_mixer_control { * @spbaclk: SPBA clock (optional, depending on SoC design) * @dma_params_tx: DMA parameters for transmit channel * @dma_params_rx: DMA parameters for receive channel + * @regcache_srpc: regcache for SRPC */ struct fsl_spdif_priv { const struct fsl_spdif_soc_data *soc; -- 2.25.1
[PATCH 5/6] ASoC: fsl: fsl_asrc: fix kernel-doc
Fix W=1 warnings. fix kernel doc and describe arguments. Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl_asrc.c | 57 +++- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 462ce9f9ab48..02c81d2e34ad 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -37,7 +37,7 @@ static struct snd_pcm_hw_constraint_list fsl_asrc_rate_constraints = { .list = supported_asrc_rate, }; -/** +/* * The following tables map the relationship between asrc_inclk/asrc_outclk in * fsl_asrc.h and the registers of ASRCSR */ @@ -68,7 +68,7 @@ static unsigned char output_clk_map_imx53[ASRC_CLK_MAP_LEN] = { 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, }; -/** +/* * i.MX8QM/i.MX8QXP uses the same map for input and output. * clk_map_imx8qm[0] is for i.MX8QM asrc0 * clk_map_imx8qm[1] is for i.MX8QM asrc1 @@ -102,16 +102,17 @@ static unsigned char clk_map_imx8qxp[2][ASRC_CLK_MAP_LEN] = { }; /** - * Select the pre-processing and post-processing options + * fsl_asrc_sel_proc - Select the pre-processing and post-processing options + * @inrate: input sample rate + * @outrate: output sample rate + * @pre_proc: return value for pre-processing option + * @post_proc: return value for post-processing option + * * Make sure to exclude following unsupported cases before * calling this function: * 1) inrate > 8.125 * outrate * 2) inrate > 16.125 * outrate * - * inrate: input sample rate - * outrate: output sample rate - * pre_proc: return value for pre-processing option - * post_proc: return value for post-processing option */ static void fsl_asrc_sel_proc(int inrate, int outrate, int *pre_proc, int *post_proc) @@ -148,7 +149,9 @@ static void fsl_asrc_sel_proc(int inrate, int outrate, } /** - * Request ASRC pair + * fsl_asrc_request_pair - Request ASRC pair + * @channels: number of channels + * @pair: pointer to pair * * It assigns pair by the order of A->C->B because allocation of pair B, * within range [ANCA, ANCA+ANCB-1], depends on the channels of pair A @@ -193,7 +196,8 @@ static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair) } /** - * Release ASRC pair + * fsl_asrc_release_pair - Release ASRC pair + * @pair: pair to release * * It clears the resource from asrc and releases the occupied channels. */ @@ -217,7 +221,10 @@ static void fsl_asrc_release_pair(struct fsl_asrc_pair *pair) } /** - * Configure input and output thresholds + * fsl_asrc_set_watermarks- configure input and output thresholds + * @pair: pointer to pair + * @in: input threshold + * @out: output threshold */ static void fsl_asrc_set_watermarks(struct fsl_asrc_pair *pair, u32 in, u32 out) { @@ -234,7 +241,9 @@ static void fsl_asrc_set_watermarks(struct fsl_asrc_pair *pair, u32 in, u32 out) } /** - * Calculate the total divisor between asrck clock rate and sample rate + * fsl_asrc_cal_asrck_divisor - Calculate the total divisor between asrck clock rate and sample rate + * @pair: pointer to pair + * @div: divider * * It follows the formula clk_rate = samplerate * (2 ^ prescaler) * divider */ @@ -250,7 +259,10 @@ static u32 fsl_asrc_cal_asrck_divisor(struct fsl_asrc_pair *pair, u32 div) } /** - * Calculate and set the ratio for Ideal Ratio mode only + * fsl_asrc_set_ideal_ratio - Calculate and set the ratio for Ideal Ratio mode only + * @pair: pointer to pair + * @inrate: input rate + * @outrate: output rate * * The ratio is a 32-bit fixed point value with 26 fractional bits. */ @@ -293,7 +305,9 @@ static int fsl_asrc_set_ideal_ratio(struct fsl_asrc_pair *pair, } /** - * Configure the assigned ASRC pair + * fsl_asrc_config_pair - Configure the assigned ASRC pair + * @pair: pointer to pair + * @use_ideal_rate: boolean configuration * * It configures those ASRC registers according to a configuration instance * of struct asrc_config which includes in/output sample rate, width, channel @@ -508,7 +522,8 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) } /** - * Start the assigned ASRC pair + * fsl_asrc_start_pair - Start the assigned ASRC pair + * @pair: pointer to pair * * It enables the assigned pair and makes it stopped at the stall level. */ @@ -539,7 +554,8 @@ static void fsl_asrc_start_pair(struct fsl_asrc_pair *pair) } /** - * Stop the assigned ASRC pair + * fsl_asrc_stop_pair - Stop the assigned ASRC pair + * @pair: pointer to pair */ static void fsl_asrc_stop_pair(struct fsl_asrc_pair *pair) { @@ -552,7 +568,9 @@ static void fsl_asrc_stop_pair(struct fsl_asrc_pair *pair) } /** - * Get DMA channel according to the pair and direction. + * fsl_asrc_get_dma_channel- Get DMA channel according to the pair and direction. + * @pair: pointer to pair + * @dir: DMA direction */ static struct
[PATCH 3/6] ASoC: fsl: fsl-asoc-card: fix kernel-doc
Fix W=1 warnings. Kernel-doc syntax was not properly used. Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl-asoc-card.c | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 57ea1b072326..91220b96e043 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -33,8 +33,7 @@ #define DAI_FMT_BASE (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF) /** - * CODEC private data - * + * struct codec_priv - CODEC private data * @mclk_freq: Clock rate of MCLK * @mclk_id: MCLK (or main clock) id for set_sysclk() * @fll_id: FLL (or secordary clock) id for set_sysclk() @@ -48,11 +47,10 @@ struct codec_priv { }; /** - * CPU private data - * - * @sysclk_freq[2]: SYSCLK rates for set_sysclk() - * @sysclk_dir[2]: SYSCLK directions for set_sysclk() - * @sysclk_id[2]: SYSCLK ids for set_sysclk() + * struct cpu_priv - CPU private data + * @sysclk_freq: SYSCLK rates for set_sysclk() + * @sysclk_dir: SYSCLK directions for set_sysclk() + * @sysclk_id: SYSCLK ids for set_sysclk() * @slot_width: Slot width of each frame * * Note: [1] for tx and [0] for rx @@ -65,9 +63,8 @@ struct cpu_priv { }; /** - * Freescale Generic ASOC card private data - * - * @dai_link[3]: DAI link structure including normal one and DPCM link + * struct fsl_asoc_card_priv - struct Freescale Generic ASOC card private data + * @dai_link: DAI link structure including normal one and DPCM link * @pdev: platform device pointer * @codec_priv: CODEC private data * @cpu_priv: CPU private data @@ -94,8 +91,8 @@ struct fsl_asoc_card_priv { char name[32]; }; -/** - * This dapm route map exsits for DPCM link only. +/* + * This dapm route map exits for DPCM link only. * The other routes shall go through Device Tree. * * Note: keep all ASRC routes in the second half -- 2.25.1
[PATCH 1/6] ASoC: fsl: fsl_ssi_dbg: remove spurious kernel-doc comment start
Fix W=1 warnings. There is no kernel-doc here. Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl_ssi_dbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi_dbg.c b/sound/soc/fsl/fsl_ssi_dbg.c index 2a20ee23dc52..2c46c55f0a88 100644 --- a/sound/soc/fsl/fsl_ssi_dbg.c +++ b/sound/soc/fsl/fsl_ssi_dbg.c @@ -78,7 +78,7 @@ void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *dbg, u32 sisr) dbg->stats.tfe0++; } -/** +/* * Show the statistics of a flag only if its interrupt is enabled * * Compilers will optimize it to a no-op if the interrupt is disabled @@ -90,7 +90,7 @@ void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *dbg, u32 sisr) } while (0) -/** +/* * Display the statistics for the current SSI device * * To avoid confusion, only show those counts that are enabled -- 2.25.1
[PATCH 2/6] ASoC: fsl: fsl_ssi: fix kernel-doc
Fix W=1 warnings. The kernel-doc support is partial, add more descriptions and follow proper syntax Signed-off-by: Pierre-Louis Bossart --- sound/soc/fsl/fsl_ssi.c | 70 ++--- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 1a2fa7f18142..7ec80b240563 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -203,12 +203,10 @@ struct fsl_ssi_soc_data { }; /** - * fsl_ssi: per-SSI private data - * + * struct fsl_ssi - per-SSI private data * @regs: Pointer to the regmap registers * @irq: IRQ of this SSI * @cpu_dai_drv: CPU DAI driver for this device - * * @dai_fmt: DAI configuration this device is currently used with * @streams: Mask of current active streams: BIT(TX) and BIT(RX) * @i2s_net: I2S and Network mode configurations of SCR register @@ -221,38 +219,29 @@ struct fsl_ssi_soc_data { * @slot_width: Width of each DAI slot * @slots: Number of slots * @regvals: Specific RX/TX register settings - * * @clk: Clock source to access register * @baudclk: Clock source to generate bit and frame-sync clocks * @baudclk_streams: Active streams that are using baudclk - * * @regcache_sfcsr: Cache sfcsr register value during suspend and resume * @regcache_sacnt: Cache sacnt register value during suspend and resume - * * @dma_params_tx: DMA transmit parameters * @dma_params_rx: DMA receive parameters * @ssi_phys: physical address of the SSI registers - * * @fiq_params: FIQ stream filtering parameters - * * @card_pdev: Platform_device pointer to register a sound card for PowerPC or * to register a CODEC platform device for AC97 * @card_name: Platform_device name to register a sound card for PowerPC or * to register a CODEC platform device for AC97 * @card_idx: The index of SSI to register a sound card for PowerPC or *to register a CODEC platform device for AC97 - * * @dbg_stats: Debugging statistics - * * @soc: SoC specific data * @dev: Pointer to >dev - * * @fifo_watermark: The FIFO watermark setting. Notifies DMA when there are * @fifo_watermark or fewer words in TX fifo or * @fifo_watermark or more empty words in RX fifo. * @dma_maxburst: Max number of words to transfer in one go. So far, *this is always the same as fifo_watermark. - * * @ac97_reg_lock: Mutex lock to serialize AC97 register access operations */ struct fsl_ssi { @@ -374,7 +363,9 @@ static bool fsl_ssi_is_i2s_cbm_cfs(struct fsl_ssi *ssi) } /** - * Interrupt handler to gather states + * fsl_ssi_irq - Interrupt handler to gather states + * @irq: irq number + * @dev_id: context */ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id) { @@ -395,7 +386,10 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id) } /** - * Set SCR, SIER, STCR and SRCR registers with cached values in regvals + * fsl_ssi_config_enable - Set SCR, SIER, STCR and SRCR registers with + * cached values in regvals + * @ssi: SSI context + * @tx: direction * * Notes: * 1) For offline_config SoCs, enable all necessary bits of both streams @@ -474,7 +468,7 @@ static void fsl_ssi_config_enable(struct fsl_ssi *ssi, bool tx) ssi->streams |= BIT(dir); } -/** +/* * Exclude bits that are used by the opposite stream * * When both streams are active, disabling some bits for the current stream @@ -495,7 +489,10 @@ static void fsl_ssi_config_enable(struct fsl_ssi *ssi, bool tx) ((vals) & _ssi_xor_shared_bits(vals, avals, aactive)) /** - * Unset SCR, SIER, STCR and SRCR registers with cached values in regvals + * fsl_ssi_config_disable - Unset SCR, SIER, STCR and SRCR registers + * with cached values in regvals + * @ssi: SSI context + * @tx: direction * * Notes: * 1) For offline_config SoCs, to avoid online reconfigurations, disable all @@ -577,7 +574,9 @@ static void fsl_ssi_tx_ac97_saccst_setup(struct fsl_ssi *ssi) } /** - * Cache critical bits of SIER, SRCR, STCR and SCR to later set them safely + * fsl_ssi_setup_regvals - Cache critical bits of SIER, SRCR, STCR and + * SCR to later set them safely + * @ssi: SSI context */ static void fsl_ssi_setup_regvals(struct fsl_ssi *ssi) { @@ -661,9 +660,12 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream, } /** - * Configure Digital Audio Interface bit clock + * fsl_ssi_set_bclk - Configure Digital Audio Interface bit clock + * @substream: ASoC substream + * @dai: pointer to DAI + * @hw_params: pointers to hw_params * - * Note: This function can be only called when using SSI as DAI master + * Notes: This function can be only called when using SSI as DAI master * * Quick instruction for parameters: * freq: Output BCLK frequency = samplerate * slots * slot_width @@ -782,7 +784,10 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, } /** - * Configure SSI based on PCM
[Bug 208181] BUG: KASAN: stack-out-of-bounds in strcmp+0x58/0xd8
https://bugzilla.kernel.org/show_bug.cgi?id=208181 --- Comment #12 from Erhard F. (erhar...@mailbox.org) --- Successfully applied your 2 patches. The kernel still complains about these 2 BATs, but the KASAN hit at early boot is gone with the patches. Thanks! -- You are receiving this mail because: You are watching the assignee of the bug.
Re: [PATCH v6 0/2] Append new variables to vmcoreinfo (TCR_EL1.T1SZ for arm64 and MAX_PHYSMEM_BITS for all archs)
On Thu, 14 May 2020 00:22:35 +0530, Bhupesh Sharma wrote: > Apologies for the delayed update. Its been quite some time since I > posted the last version (v5), but I have been really caught up in some > other critical issues. > > Changes since v5: > > - v5 can be viewed here: > http://lists.infradead.org/pipermail/kexec/2019-November/024055.html > - Addressed review comments from James Morse and Boris. > - Added Tested-by received from John on v5 patchset. > - Rebased against arm64 (for-next/ptr-auth) branch which has Amit's > patchset for ARMv8.3-A Pointer Authentication feature vmcoreinfo > applied. > > [...] Applied to arm64 (for-next/vmcoreinfo), thanks! [1/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo https://git.kernel.org/arm64/c/1d50e5d0c505 [2/2] arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo https://git.kernel.org/arm64/c/bbdbc11804ff -- Catalin
[PATCH] powerpc/rtas: Restrict RTAS requests from userspace
A number of userspace utilities depend on making calls to RTAS to retrieve information and update various things. The existing API through which we expose RTAS to userspace exposes more RTAS functionality than we actually need, through the sys_rtas syscall, which allows root (or anyone with CAP_SYS_ADMIN) to make any RTAS call they want with arbitrary arguments. Many RTAS calls take the address of a buffer as an argument, and it's up to the caller to specify the physical address of the buffer as an argument. We allocate a buffer (the "RMO buffer") in the Real Memory Area that RTAS can access, and then expose the physical address and size of this buffer in /proc/powerpc/rtas/rmo_buffer. Userspace is expected to read this address, poke at the buffer using /dev/mem, and pass an address in the RMO buffer to the RTAS call. However, there's nothing stopping the caller from specifying whatever address they want in the RTAS call, and it's easy to construct a series of RTAS calls that can overwrite arbitrary bytes (even without /dev/mem access). Additionally, there are some RTAS calls that do potentially dangerous things and for which there are no legitimate userspace use cases. In the past, this would not have been a particularly big deal as it was assumed that root could modify all system state freely, but with Secure Boot and lockdown we need to care about this. We can't fundamentally change the ABI at this point, however we can address this by implementing a filter that checks RTAS calls against a list of permitted calls and forces the caller to use addresses within the RMO buffer. The list is based off the list of calls that are used by the librtas userspace library, and has been tested with a number of existing userspace RTAS utilities. For compatibility with any applications we are not aware of that require other calls, the filter can be turned off at build time. Reported-by: Daniel Axtens Cc: sta...@vger.kernel.org Signed-off-by: Andrew Donnellan --- arch/powerpc/Kconfig | 13 +++ arch/powerpc/kernel/rtas.c | 198 + 2 files changed, 211 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 9fa23eb320ff..0e2dfe497357 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -973,6 +973,19 @@ config PPC_SECVAR_SYSFS read/write operations on these variables. Say Y if you have secure boot enabled and want to expose variables to userspace. +config PPC_RTAS_FILTER + bool "Enable filtering of RTAS syscalls" + default y + depends on PPC_RTAS + help + The RTAS syscall API has security issues that could be used to + compromise system integrity. This option enforces restrictions on the + RTAS calls and arguments passed by userspace programs to mitigate + these issues. + + Say Y unless you know what you are doing and the filter is causing + problems for you. + endmenu config ISA_DMA_API diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index a09eba03f180..ec1cae52d8bd 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -324,6 +324,23 @@ int rtas_token(const char *service) } EXPORT_SYMBOL(rtas_token); +#ifdef CONFIG_PPC_RTAS_FILTER + +static char *rtas_token_name(int token) +{ + struct property *prop; + + for_each_property_of_node(rtas.dev, prop) { + const __be32 *tokp = prop->value; + + if (tokp && be32_to_cpu(*tokp) == token) + return prop->name; + } + return NULL; +} + +#endif /* CONFIG_PPC_RTAS_FILTER */ + int rtas_service_present(const char *service) { return rtas_token(service) != RTAS_UNKNOWN_SERVICE; @@ -1110,6 +1127,184 @@ struct pseries_errorlog *get_pseries_errorlog(struct rtas_error_log *log, return NULL; } +#ifdef CONFIG_PPC_RTAS_FILTER + +/* + * The sys_rtas syscall, as originally designed, allows root to pass + * arbitrary physical addresses to RTAS calls. A number of RTAS calls + * can be abused to write to arbitrary memory and do other things that + * are potentially harmful to system integrity, and thus should only + * be used inside the kernel and not exposed to userspace. + * + * All known legitimate users of the sys_rtas syscall will only ever + * pass addresses that fall within the RMO buffer, and use a known + * subset of RTAS calls. + * + * Accordingly, we filter RTAS requests to check that the call is + * permitted, and that provided pointers fall within the RMO buffer. + * The rtas_filters list contains an entry for each permitted call, + * with the indexes of the parameters which are expected to contain + * addresses and sizes of buffers allocated inside the RMO buffer. + */ +struct rtas_filter { + const char name[32]; + + /* Indexes into the args buffer, -1 if not used */ + int rmo_buf_idx1; + int rmo_size_idx1; + int rmo_buf_idx2; + int
Re: [PATCH v5] ocxl: control via sysfs whether the FPGA is reloaded on a link reset
On 20/6/20 12:04 am, Frederic Barrat wrote: From: Philippe Bergheaud Some opencapi FPGA images allow to control if the FPGA should be reloaded on the next adapter reset. If it is supported, the image specifies it through a Vendor Specific DVSEC in the config space of function 0. Signed-off-by: Philippe Bergheaud Signed-off-by: Frederic Barrat Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH v6 1/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo
On Thu, Jul 02, 2020 at 08:08:55PM +0800, Dave Young wrote: > Hi Catalin, > On 07/02/20 at 12:00pm, Catalin Marinas wrote: > > On Thu, May 14, 2020 at 12:22:36AM +0530, Bhupesh Sharma wrote: > > > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > > > index 9f1557b98468..18175687133a 100644 > > > --- a/kernel/crash_core.c > > > +++ b/kernel/crash_core.c > > > @@ -413,6 +413,7 @@ static int __init crash_save_vmcoreinfo_init(void) > > > VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS); > > > VMCOREINFO_STRUCT_SIZE(mem_section); > > > VMCOREINFO_OFFSET(mem_section, section_mem_map); > > > + VMCOREINFO_NUMBER(MAX_PHYSMEM_BITS); > > > #endif > > > VMCOREINFO_STRUCT_SIZE(page); > > > VMCOREINFO_STRUCT_SIZE(pglist_data); > > > > I can queue this patch via the arm64 tree (together with the second one) > > but I'd like an ack from the kernel/crash_core.c maintainers. They don't > > seem to have been cc'ed either (only the kexec list). > > For the VMCOREINFO part, I'm fine with the changes, but since I do not > understand the arm64 pieces so I would like to leave to arm64 people to > review. If arm64 bits are good enough, feel free to add: > > Acked-by: Dave Young Thanks. -- Catalin
Re: [PATCH 6/8] powerpc/pseries: implement paravirt qspinlocks for SPLPAR
Hi Nicholas, I love your patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on tip/locking/core v5.8-rc3 next-20200702] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/powerpc-queued-spinlocks-and-rwlocks/20200702-155158 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-allyesconfig (attached as .config) compiler: powerpc64-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): kernel/locking/lock_events.c:61:16: warning: no previous prototype for 'lockevent_read' [-Wmissing-prototypes] 61 | ssize_t __weak lockevent_read(struct file *file, char __user *user_buf, |^~ kernel/locking/lock_events.c: In function 'skip_lockevent': >> kernel/locking/lock_events.c:126:12: error: implicit declaration of function >> 'pv_is_native_spin_unlock' [-Werror=implicit-function-declaration] 126 | pv_on = !pv_is_native_spin_unlock(); |^~~~ cc1: some warnings being treated as errors vim +/pv_is_native_spin_unlock +126 kernel/locking/lock_events.c fb346fd9fc081c Waiman Long 2019-04-04 57 fb346fd9fc081c Waiman Long 2019-04-04 58 /* fb346fd9fc081c Waiman Long 2019-04-04 59 * The lockevent_read() function can be overridden. fb346fd9fc081c Waiman Long 2019-04-04 60 */ fb346fd9fc081c Waiman Long 2019-04-04 @61 ssize_t __weak lockevent_read(struct file *file, char __user *user_buf, fb346fd9fc081c Waiman Long 2019-04-04 62size_t count, loff_t *ppos) fb346fd9fc081c Waiman Long 2019-04-04 63 { fb346fd9fc081c Waiman Long 2019-04-04 64 char buf[64]; fb346fd9fc081c Waiman Long 2019-04-04 65 int cpu, id, len; fb346fd9fc081c Waiman Long 2019-04-04 66 u64 sum = 0; fb346fd9fc081c Waiman Long 2019-04-04 67 fb346fd9fc081c Waiman Long 2019-04-04 68 /* fb346fd9fc081c Waiman Long 2019-04-04 69 * Get the counter ID stored in file->f_inode->i_private fb346fd9fc081c Waiman Long 2019-04-04 70 */ fb346fd9fc081c Waiman Long 2019-04-04 71 id = (long)file_inode(file)->i_private; fb346fd9fc081c Waiman Long 2019-04-04 72 fb346fd9fc081c Waiman Long 2019-04-04 73 if (id >= lockevent_num) fb346fd9fc081c Waiman Long 2019-04-04 74 return -EBADF; fb346fd9fc081c Waiman Long 2019-04-04 75 fb346fd9fc081c Waiman Long 2019-04-04 76 for_each_possible_cpu(cpu) fb346fd9fc081c Waiman Long 2019-04-04 77 sum += per_cpu(lockevents[id], cpu); fb346fd9fc081c Waiman Long 2019-04-04 78 len = snprintf(buf, sizeof(buf) - 1, "%llu\n", sum); fb346fd9fc081c Waiman Long 2019-04-04 79 fb346fd9fc081c Waiman Long 2019-04-04 80 return simple_read_from_buffer(user_buf, count, ppos, buf, len); fb346fd9fc081c Waiman Long 2019-04-04 81 } fb346fd9fc081c Waiman Long 2019-04-04 82 fb346fd9fc081c Waiman Long 2019-04-04 83 /* fb346fd9fc081c Waiman Long 2019-04-04 84 * Function to handle write request fb346fd9fc081c Waiman Long 2019-04-04 85 * fb346fd9fc081c Waiman Long 2019-04-04 86 * When idx = reset_cnts, reset all the counts. fb346fd9fc081c Waiman Long 2019-04-04 87 */ fb346fd9fc081c Waiman Long 2019-04-04 88 static ssize_t lockevent_write(struct file *file, const char __user *user_buf, fb346fd9fc081c Waiman Long 2019-04-04 89 size_t count, loff_t *ppos) fb346fd9fc081c Waiman Long 2019-04-04 90 { fb346fd9fc081c Waiman Long 2019-04-04 91 int cpu; fb346fd9fc081c Waiman Long 2019-04-04 92 fb346fd9fc081c Waiman Long 2019-04-04 93 /* fb346fd9fc081c Waiman Long 2019-04-04 94 * Get the counter ID stored in file->f_inode->i_private fb346fd9fc081c Waiman Long 2019-04-04 95 */ fb346fd9fc081c Waiman Long 2019-04-04 96 if ((long)file_inode(file)->i_private != LOCKEVENT_reset_cnts) fb346fd9fc081c Waiman Long 2019-04-04 97 return count; fb346fd9fc081c Waiman Long 2019-04-04 98 fb346fd9fc081c Waiman Long 2019-04-04 99 for_each_possible_cpu(cpu) { fb346fd9fc081c Waiman Long 2019-04-04 100 int i; fb346fd9fc081c Waiman Long 2019-04-04 101 unsigned long *ptr = per_cpu_ptr(lockevents, cpu); fb346fd9fc081c Waiman Long 2019-04-04
Re: [PATCH 18/20] block: refator submit_bio_noacct
On Thu, 2 Jul 2020 at 20:45, Christoph Hellwig wrote: > > On Thu, Jul 02, 2020 at 10:10:10AM -0400, Qian Cai wrote: > > On Mon, Jun 29, 2020 at 09:39:45PM +0200, Christoph Hellwig wrote: > > > Split out a __submit_bio_noacct helper for the actual de-recursion > > > algorithm, and simplify the loop by using a continue when we can't > > > enter the queue for a bio. > > > > > > Signed-off-by: Christoph Hellwig > > > > Reverting this commit and its dependencies, > > > > 5a6c35f9af41 block: remove direct_make_request > > ff93ea0ce763 block: shortcut __submit_bio_noacct for blk-mq drivers > > > > fixed the stack-out-of-bounds during boot, > > > > https://lore.kernel.org/linux-block/bcdeaa05a9728...@google.com/ > > Yikes. bio_alloc_bioset pokes into bio_list[1] in a totally > undocumented way. But even with that the problem should only show > up with "block: shortcut __submit_bio_noacct for blk-mq drivers". > > Can you try this patch? Applied your patch on top of linux-next 20200702 and tested on arm64 and x86_64 devices and the reported BUG fixed. Reported-by: Naresh Kamboju Tested-by: Naresh Kamboju > > diff --git a/block/blk-core.c b/block/blk-core.c > index bf882b8d84450c..9f1bf8658b611a 100644 > --- a/block/blk-core.c > +++ b/block/blk-core.c > @@ -1155,11 +1155,10 @@ static blk_qc_t __submit_bio_noacct(struct bio *bio) > static blk_qc_t __submit_bio_noacct_mq(struct bio *bio) > { > struct gendisk *disk = bio->bi_disk; > - struct bio_list bio_list; > + struct bio_list bio_list[2] = { }; > blk_qc_t ret = BLK_QC_T_NONE; > > - bio_list_init(_list); > - current->bio_list = _list; > + current->bio_list = bio_list; > > do { > WARN_ON_ONCE(bio->bi_disk != disk); > @@ -1174,7 +1173,7 @@ static blk_qc_t __submit_bio_noacct_mq(struct bio *bio) > } > > ret = blk_mq_submit_bio(bio); > - } while ((bio = bio_list_pop(_list))); > + } while ((bio = bio_list_pop(_list[0]))); > > current->bio_list = NULL; > return ret; ref: https://lkft.validation.linaro.org/scheduler/job/1538359#L288 https://lkft.validation.linaro.org/scheduler/job/1538360#L572 - Naresh
Re: [PATCH 1/2] dt-bindings: sound: fsl-asoc-card: add new compatible for I2S slave
On Thu, Jul 02, 2020 at 05:28:03PM +0200, Arnaud Ferraris wrote: > Le 02/07/2020 à 16:31, Mark Brown a écrit : > > Why require that the CODEC be clock master here - why not make this > > configurable, reusing the properties from the generic and audio graph > > cards? > This is partly because I'm not sure how to do it (yet), but mostly > because I don't have the hardware to test this (the 2 CODECs present on > my only i.MX6 board are both clock master) Take a look at what the generic cards are doing, it's a library function asoc_simple_parse_daifmt(). It's not the end of the world if you can't test it properly - if it turns out it's buggy somehow someone can always fix the code later but an ABI is an ABI so we can't change it. signature.asc Description: PGP signature
Re: [PATCH 18/20] block: refator submit_bio_noacct
On Thu, 2 Jul 2020 at 19:40, Qian Cai wrote: > > On Mon, Jun 29, 2020 at 09:39:45PM +0200, Christoph Hellwig wrote: > > Split out a __submit_bio_noacct helper for the actual de-recursion > > algorithm, and simplify the loop by using a continue when we can't > > enter the queue for a bio. > > > > Signed-off-by: Christoph Hellwig Kernel BUG: on arm64 and x86_64 devices running linux next-rc3-next-20200702 with KASAN config enabled. While running mkfs -t ext4. metadata: git branch: master git repo: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git commit: d37d57041350dff35dd17cbdf9aef4011acada38 git describe: next-20200702 make_kernelversion: 5.8.0-rc3 kernel-config: https://builds.tuxbuild.com/DnjQHvYrx586eUoFxtYZxQ/kernel.config steps to reproduce: # mkfs -t ext4 /dev/disk/by-id/ata-SanDisk_SDSSDA120G_165193445014 BUG: KASAN: stack-out-of-bounds in bio_alloc_bioset+0x28c/0x2c8 [ 59.398307] Read of size 8 at addr 0009084277e0 by task mkfs.ext4/417 [ 59.405121] [ 59.406644] CPU: 5 PID: 417 Comm: mkfs.ext4 Not tainted 5.8.0-rc3-next-20200702 #1 [ 59.414248] Hardware name: ARM Juno development board (r2) (DT) [ 59.420195] Call trace: [ 59.422683] dump_backtrace+0x0/0x2b8 [ 59.426386] show_stack+0x18/0x28 [ 59.429741] dump_stack+0xec/0x144 [ 59.433183] print_address_description.isra.0+0x6c/0x448 [ 59.438531] kasan_report+0x134/0x200 [ 59.442226] __asan_load8+0x9c/0xd8 [ 59.445751] bio_alloc_bioset+0x28c/0x2c8 [ 59.449796] bio_clone_fast+0x28/0x98 [ 59.453492] bio_split+0x64/0x138 [ 59.456842] __blk_queue_split+0x534/0x698 [ 59.460979] blk_mq_submit_bio+0x10c/0x680 [ 59.465118] submit_bio_noacct+0x57c/0x640 [ 59.469253] submit_bio+0xc0/0x358 [ 59.472688] submit_bio_wait+0xc0/0x110 [ 59.476561] blkdev_issue_discard+0xd0/0x138 [ 59.480877] blk_ioctl_discard+0x1b8/0x238 [ 59.485008] blkdev_common_ioctl+0x594/0xd38 [ 59.489312] blkdev_ioctl+0x130/0x578 [ 59.493010] block_ioctl+0x78/0x98 [ 59.496453] ksys_ioctl+0xb8/0xf8 [ 59.499808] __arm64_sys_ioctl+0x44/0x60 [ 59.503781] el0_svc_common.constprop.0+0xa4/0x1e0 [ 59.508615] do_el0_svc+0x38/0xa0 [ 59.511967] el0_sync_handler+0x98/0x1a8 [ 59.515922] el0_sync+0x158/0x180 [ 59.519255] [ 59.520761] The buggy address belongs to the page: [ 59.525590] page:fe00240109c0 refcount:0 mapcount:0 mapping: index:0x0 [ 59.533895] flags: 0x2000() [ 59.537779] raw: 2000 fe00240109c8 [ 59.545575] raw: [ 59.553352] page dumped because: kasan: bad access detected [ 59.558947] [ 59.560463] addr 0009084277e0 is located in stack of task mkfs.ext4/417 at offset 48 in frame: [ 59.569475] submit_bio_noacct+0x0/0x640 [ 59.573423] [ 59.574930] this frame has 2 objects: [ 59.578624] [32, 48) 'bio_list' [ 59.578644] [64, 96) 'bio_list_on_stack' [ 59.581889] [ 59.587412] Memory state around the buggy address: [ 59.592243] 000908427680: 00 00 00 f2 00 00 00 f2 f2 f2 00 00 00 00 00 f3 [ 59.599510] 000908427700: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 [ 59.606777] >000908427780: 00 00 00 00 00 00 f1 f1 f1 f1 00 00 f2 f2 00 00 [ 59.614031]^ [ 59.620427] 000908427800: 00 00 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 [ 59.627694] 000908427880: 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 f3 f3 [ 59.634946] == [ 59.642198] Disabling lock debugging due to kernel taint Kernel BUG on x86_64: [ 17.809563] == [ 17.816786] BUG: KASAN: stack-out-of-bounds in bio_alloc_bioset+0x31f/0x340 [ 17.823750] Read of size 8 at addr 888225f9f450 by task systemd-udevd/361 [ 17.830881] [ 17.832384] CPU: 0 PID: 361 Comm: systemd-udevd Not tainted 5.8.0-rc3-next-20200702 #1 [ 17.840294] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS 2.2 05/23/2018 [ 17.847686] Call Trace: [ 17.850143] dump_stack+0x84/0xba [ 17.853462] print_address_description.constprop.0+0x1f/0x210 [ 17.859212] ? _raw_spin_lock_irqsave+0x7c/0xd0 [ 17.859214] ? _raw_write_lock_irqsave+0xd0/0xd0 [ 17.859217] ? bio_alloc_bioset+0x31f/0x340 [ 17.859220] kasan_report.cold+0x37/0x7c [ 17.859222] ? bio_alloc_bioset+0x31f/0x340 [ 17.859224] __asan_load8+0x86/0xb0 [ 17.859226] bio_alloc_bioset+0x31f/0x340 [ 17.859228] ? bvec_alloc+0x160/0x160 [ 17.859230] ? bio_alloc_bioset+0x253/0x340 [ 17.859232] ? mpage_alloc.isra.0+0x37/0x120 [ 17.859234] ? do_mpage_readpage+0x740/0xd40 [ 17.859236] ? mpage_readahead+0x196/0x280 [ 17.859238] ? blkdev_readahead+0x10/0x20 [ 17.859241] ? read_pages+0x149/0x470 [ 17.859243]
Re: [PATCH 18/20] block: refator submit_bio_noacct
On Thu, Jul 02, 2020 at 10:10:10AM -0400, Qian Cai wrote: > On Mon, Jun 29, 2020 at 09:39:45PM +0200, Christoph Hellwig wrote: > > Split out a __submit_bio_noacct helper for the actual de-recursion > > algorithm, and simplify the loop by using a continue when we can't > > enter the queue for a bio. > > > > Signed-off-by: Christoph Hellwig > > Reverting this commit and its dependencies, > > 5a6c35f9af41 block: remove direct_make_request > ff93ea0ce763 block: shortcut __submit_bio_noacct for blk-mq drivers > > fixed the stack-out-of-bounds during boot, > > https://lore.kernel.org/linux-block/bcdeaa05a9728...@google.com/ Yikes. bio_alloc_bioset pokes into bio_list[1] in a totally undocumented way. But even with that the problem should only show up with "block: shortcut __submit_bio_noacct for blk-mq drivers". Can you try this patch? diff --git a/block/blk-core.c b/block/blk-core.c index bf882b8d84450c..9f1bf8658b611a 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1155,11 +1155,10 @@ static blk_qc_t __submit_bio_noacct(struct bio *bio) static blk_qc_t __submit_bio_noacct_mq(struct bio *bio) { struct gendisk *disk = bio->bi_disk; - struct bio_list bio_list; + struct bio_list bio_list[2] = { }; blk_qc_t ret = BLK_QC_T_NONE; - bio_list_init(_list); - current->bio_list = _list; + current->bio_list = bio_list; do { WARN_ON_ONCE(bio->bi_disk != disk); @@ -1174,7 +1173,7 @@ static blk_qc_t __submit_bio_noacct_mq(struct bio *bio) } ret = blk_mq_submit_bio(bio); - } while ((bio = bio_list_pop(_list))); + } while ((bio = bio_list_pop(_list[0]))); current->bio_list = NULL; return ret;
Re: [PATCH v5 3/3] mm/page_alloc: Keep memoryless cpuless node 0 offline
* Michal Hocko [2020-07-02 10:41:23]: > On Thu 02-07-20 12:14:08, Srikar Dronamraju wrote: > > * Michal Hocko [2020-07-01 14:21:10]: > > > > > > > The autonuma problem sounds interesting but again this patch > > > > > doesn't > > > > > really solve the underlying problem because I strongly suspect > > > > > that the > > > > > problem is still there when a numa node gets all its memory > > > > > offline as > > > > > mentioned above. > > > > > > I would really appreciate a feedback to these two as well. > > > > 1. Its not just numactl that's to be fixed but all tools/utilities that > > depend on /sys/devices/system/node/online. Are we saying to not rely/believe > > in the output given by the kernel but do further verification? > > No, what we are saying is that even an online node might have zero > number of online pages/cpus. So the online status is not really > something that matters. If people are confused by that output then user > space tools can make their confusion go away. I really do not understand > why the kernel should do any logic there. The user facing teams are saying they are getting queries from the users who are unable to understand from the tools/sysfs files why a node is online and but has no attached resources. Its the amount of time that is being spent on these issues that triggered the patch. Initially even I was skeptical that this was a non-issue. > > > Also how would the user space differentiate between the case where the > > Kernel missed marking a node as offline to the case where the memory was > > offlined on a cpuless node but node wasn't offline?. > > What I am arguing is that those two shouldn't be any different. Really! > > > 2. Regarding the autonuma, the case of offline memory is user/admin driven, > > so if there is a performance hit, its something that's driven by his > > user/admin actions. Also how often do we see users offline complete memory > > of cpuless node on a 2 node system? > > How often do we see crippled HW configurations like that? Really if > autonuma should be made more clever for one case it should recognize the > other as well. > Lets take a 16 socket PowerVM system and assume that 32 lpars are created on that socket, i.e 2 lpars for each socket. (PowerVM has the final say on how the lpars are created.) In such a case, we can expect 30 out of the 32 lpars to face this problem, with the only 2 lpars that actually run on socket 0 having the correct configuration. > > > > > > This begs a question whether ppc can do the same thing? > > > > Certainly ppc can be made to adapt to this situation but that would be a > > workaround. Do we have a reason why we think node 0 is unique and special? > > It is not. As replied in other email in this thread. I would hope for > having less hacks in the numa initialization. Cleaning up the mess is > would be a lot of work and testing on all NUMA capable architectures. > This is a heritage from the past I am afraid. All that I am arguing here > is that your touch to the generic code with a very simple looking patch > might have side effects which are pretty much impossible to review. > Moreover it seems that nothing but ppc really needs this treatment. > So fixing it in ppc specific code sounds much more safe. > > Normally I would really push for a generic solution but after getting > burned several times in this area I do not dare anymore. The problem is > not in the code complexity but in how spread it is in places where you > do not expect side effects. > I do understand and respect your viewpoint. > -- > Michal Hocko > SUSE Labs -- Thanks and Regards Srikar Dronamraju
Re: [PATCH v3 2/2] powerpc/hv-24x7: Add sysfs files inside hv-24x7 device to show cpumask
On Fri, Jun 26, 2020 at 03:58:24PM +0530, Kajol Jain wrote: > Patch here adds a cpumask attr to hv_24x7 pmu along with ABI documentation. > > Primary use to expose the cpumask is for the perf tool which has the > capability to parse the driver sysfs folder and understand the > cpumask file. Having cpumask file will reduce the number of perf command > line parameters (will avoid "-C" option in the perf tool > command line). It can also notify the user which is > the current cpu used to retrieve the counter data. > > command:# cat /sys/devices/hv_24x7/cpumask > 0 > > Signed-off-by: Kajol Jain This patch looks good to me. Reviewed-by: Gautham R. Shenoy > --- > .../sysfs-bus-event_source-devices-hv_24x7| 7 > arch/powerpc/perf/hv-24x7.c | 36 +-- > 2 files changed, 41 insertions(+), 2 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7 > b/Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7 > index e8698afcd952..f9dd3755b049 100644 > --- a/Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7 > +++ b/Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7 > @@ -43,6 +43,13 @@ Description: read only > This sysfs interface exposes the number of cores per chip > present in the system. > > +What:/sys/devices/hv_24x7/cpumask > +Date:June 2020 > +Contact: Linux on PowerPC Developer List > +Description: read only > + This sysfs file exposes the cpumask which is designated to make > + HCALLs to retrieve hv-24x7 pmu event counter data. > + > What: > /sys/bus/event_source/devices/hv_24x7/event_descs/ > Date:February 2014 > Contact: Linux on PowerPC Developer List > diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c > index ce4739e2b407..3c699612d29f 100644 > --- a/arch/powerpc/perf/hv-24x7.c > +++ b/arch/powerpc/perf/hv-24x7.c > @@ -448,6 +448,12 @@ static ssize_t device_show_string(struct device *dev, > return sprintf(buf, "%s\n", (char *)d->var); > } > > +static ssize_t cpumask_get_attr(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + return cpumap_print_to_pagebuf(true, buf, _24x7_cpumask); > +} > + > static ssize_t sockets_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > @@ -1116,6 +1122,17 @@ static DEVICE_ATTR_RO(sockets); > static DEVICE_ATTR_RO(chipspersocket); > static DEVICE_ATTR_RO(coresperchip); > > +static DEVICE_ATTR(cpumask, S_IRUGO, cpumask_get_attr, NULL); > + > +static struct attribute *cpumask_attrs[] = { > + _attr_cpumask.attr, > + NULL, > +}; > + > +static struct attribute_group cpumask_attr_group = { > + .attrs = cpumask_attrs, > +}; > + > static struct bin_attribute *if_bin_attrs[] = { > _attr_catalog, > NULL, > @@ -1143,6 +1160,11 @@ static const struct attribute_group *attr_groups[] = { > _desc_group, > _long_desc_group, > _group, > + /* > + * This NULL is a placeholder for the cpumask attr which will update > + * onlyif cpuhotplug registration is successful > + */ > + NULL, > NULL, > }; > > @@ -1683,7 +1705,7 @@ static int hv_24x7_cpu_hotplug_init(void) > > static int hv_24x7_init(void) > { > - int r; > + int r, i = -1; > unsigned long hret; > struct hv_perf_caps caps; > > @@ -1727,8 +1749,18 @@ static int hv_24x7_init(void) > > /* init cpuhotplug */ > r = hv_24x7_cpu_hotplug_init(); > - if (r) > + if (r) { > pr_err("hv_24x7: CPU hotplug init failed\n"); > + } else { > + /* > + * Cpu hotplug init is successful, add the > + * cpumask file as part of pmu attr group and > + * assign it to very first NULL location. > + */ > + while (attr_groups[++i]) > + /* nothing */; > + attr_groups[i] = _attr_group; > + } > > r = perf_pmu_register(_24x7_pmu, h_24x7_pmu.name, -1); > if (r) > -- > 2.18.2 >
Re: [PATCH 1/2] dt-bindings: sound: fsl-asoc-card: add new compatible for I2S slave
On Thu, Jul 02, 2020 at 04:11:14PM +0200, Arnaud Ferraris wrote: > fsl-asoc-card currently doesn't support generic codecs with the SoC > acting as I2S slave. > > This commit adds a new `fsl,imx-audio-i2s-slave` for this use-case, as > well as the following mandatory properties: Why require that the CODEC be clock master here - why not make this configurable, reusing the properties from the generic and audio graph cards? signature.asc Description: PGP signature
Re: [PATCH 18/20] block: refator submit_bio_noacct
On Mon, Jun 29, 2020 at 09:39:45PM +0200, Christoph Hellwig wrote: > Split out a __submit_bio_noacct helper for the actual de-recursion > algorithm, and simplify the loop by using a continue when we can't > enter the queue for a bio. > > Signed-off-by: Christoph Hellwig Reverting this commit and its dependencies, 5a6c35f9af41 block: remove direct_make_request ff93ea0ce763 block: shortcut __submit_bio_noacct for blk-mq drivers fixed the stack-out-of-bounds during boot, https://lore.kernel.org/linux-block/bcdeaa05a9728...@google.com/ [ 55.573431][ T1373] BUG: KASAN: stack-out-of-bounds in bio_alloc_bioset+0x493/0x4a0 bio_alloc_bioset+0x493/0x4a0: bio_list_empty at include/linux/bio.h:561 (inlined by) bio_alloc_bioset at block/bio.c:482 [ 55.581140][ T1373] Read of size 8 at addr c9000a7df1e0 by task mount/1373 [ 55.588409][ T1373] [ 55.590615][ T1373] CPU: 2 PID: 1373 Comm: mount Not tainted 5.8.0-rc3-next-20200702 #2 [ 55.598672][ T1373] Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019 [ 55.607972][ T1373] Call Trace: [ 55.607980][ T1373] dump_stack+0x9d/0xe0 [ 55.607984][ T1373] ? bio_alloc_bioset+0x493/0x4a0 [ 55.607992][ T1373] ? bio_alloc_bioset+0x493/0x4a0 [ 55.625007][ T1373] print_address_description.constprop.8.cold.10+0x56/0x44e [ 55.632191][ T1373] ? bio_alloc_bioset+0x493/0x4a0 [ 55.637100][ T1373] ? bio_alloc_bioset+0x493/0x4a0 [ 55.642011][ T1373] kasan_report.cold.11+0x37/0x7c [ 55.646923][ T1373] ? bio_alloc_bioset+0x493/0x4a0 [ 55.651968][ T1373] bio_alloc_bioset+0x493/0x4a0 [ 55.651971][ T1373] ? bvec_alloc+0x290/0x290 [ 55.651975][ T1373] ? mark_lock+0x147/0x1800 [ 55.651978][ T1373] ? mark_lock+0x147/0x1800 [ 55.651981][ T1373] bio_clone_fast+0xe/0x30 [ 55.651983][ T1373] bio_split+0x8a/0x4c0 [ 55.651986][ T1373] ? print_irqtrace_events+0x270/0x270 [ 55.651990][ T1373] __blk_queue_split+0xc42/0x13e0 [ 55.651998][ T1373] ? __lock_acquire+0xc57/0x4da0 Startin[ 55.693322][ T1373] ? __blk_rq_map_sg+0x14c0/0x14c0 [ 55.699711][ T1373] ? lockdep_hardirqs_on_prepare+0x550/0x550 [ 55.705602][ T1373] ? mark_held_locks+0xb0/0x110 [ 55.705605][ T1373] ? lockdep_hardirqs_on_prepare+0x550/0x550 [ 55.705608][ T1373] ? lockdep_hardirqs_on_prepare+0x550/0x550 [ 55.705611][ T1373] ? find_held_lock+0x33/0x1c0 [ 55.705614][ T1373] ? find_held_lock+0x33/0x1c0 [ 55.705618][ T1373] blk_mq_submit_bio+0x19e/0x1e20 [ 55.705621][ T1373] ? lock_downgrade+0x720/0x720 [ 55.705624][ T1373] ? blk_mq_try_issue_directly+0x140/0x140 [ 55.705628][ T1373] ? rcu_read_lock_sched_held+0xaa/0xd0 [ 55.705631][ T1373] ? rcu_read_lock_bh_held+0xc0/0xc0 [ 55.705635][ T1373] ? blk_queue_enter+0x83c/0x9a0 [ 55.705647][ T1373] ? submit_bio_checks+0x1cc0/0x1cc0 [ 55.767384][ T1373] submit_bio_noacct+0x9c0/0xeb0 [ 55.772212][ T1373] ? blk_queue_enter+0x9a0/0x9a0 [ 55.777038][ T1373] ? lockdep_hardirqs_on_prepare+0x550/0x550 [ 55.782913][ T1373] ? trace_hardirqs_on+0x20/0x1b5 [ 55.787825][ T1373] ? submit_bio+0xe7/0x480 [ 55.792125][ T1373] submit_bio+0xe7/0x480 [ 55.796252][ T1373] ? bio_associate_blkg_from_css+0x4a3/0xd30 [ 55.802124][ T1373] ? submit_bio_noacct+0xeb0/0xeb0 [ 55.807124][ T1373] ? lock_downgrade+0x720/0x720 [ 55.811862][ T1373] ? rcu_read_unlock+0x50/0x50 [ 55.816512][ T1373] ? lockdep_init_map_waits+0x267/0x7b0 [ 55.821948][ T1373] ? lockdep_init_map_waits+0x267/0x7b0 g LVM event acti[ 55.827386][ T1373] ? __raw_spin_lock_init+0x34/0x100 [ 55.833957][ T1373] submit_bio_wait+0xf9/0x200 vation on device[ 55.838521][ T1373] ? submit_bio_wait_endio+0x30/0x30 [ 55.845091][ T1373] xfs_rw_bdev+0x3ca/0x4d0 [ 55.849396][ T1373] xlog_do_io+0x149/0x320 [ 55.853611][ T1373] xlog_bread+0x1e/0xb0 [ 55.857651][ T1373] xlog_find_verify_log_record+0xba/0x4c0 [ 55.863264][ T1373] ? xlog_header_check_mount+0xb0/0xb0 [ 55.868615][ T1373] xlog_find_zeroed+0x2bc/0x4c0 8:3... [ 55.873356][ T1373] ? print_irqtrace_events+0x270/0x270 [ 55.880093][ T1373] ? xlog_find_verify_log_record+0x4c0/0x4c0 [ 55.885966][ T1373] ? __lock_acquire+0x1920/0x4da0 [ 55.890881][ T1373] xlog_find_head+0xd4/0x790 [ 55.895355][ T1373] ? xlog_find_zeroed+0x4c0/0x4c0 [ 55.900269][ T1373] ? rcu_read_lock_sched_held+0xaa/0xd0 [ 55.905708][ T1373] ? rcu_read_lock_bh_held+0xc0/0xc0 [ 55.910885][ T1373] ? sugov_update_single+0x18d/0x4f0 [ 55.916058][ T1373] xlog_find_tail+0xc2/0x810 [ 55.920534][ T1373] ? mark_lock+0x147/0x1800 [ 55.924921][ T1373] ? xlog_verify_head+0x4c0/0x4c0 [ 55.929834][ T1373] ? debug_show_held_locks+0x30/0x50 [ 55.935007][ T1373] ? print_irqtrace_events+0x270/0x270 [ 55.940358][ T1373] ? try_to_wake_up+0x6d1/0xf40 [ 55.945094][ T1373] ? mark_held_locks+0xb0/0x110 [ 55.949835][ T1373] ? lockdep_hardirqs_on_prepare+0x38c/0x550 [ 55
[PATCH] docs: powerpc: Clarify book3s/32 MMU families
Documentation wrongly tells that book3s/32 CPU have hash MMU. 603 and e300 core only have software loaded TLB. 755, 7450 family and e600 core have both hash MMU and software loaded TLB. This can be selected by setting a bit in HID2 (755) or HID0 (others). At the time being this is not supported by the kernel. Make this explicit in the documentation. Signed-off-by: Christophe Leroy --- Documentation/powerpc/cpu_families.rst | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Documentation/powerpc/cpu_families.rst b/Documentation/powerpc/cpu_families.rst index 1e063c5440c3..9b84e045e713 100644 --- a/Documentation/powerpc/cpu_families.rst +++ b/Documentation/powerpc/cpu_families.rst @@ -9,7 +9,9 @@ and are supported by arch/powerpc. Book3S (aka sPAPR) -- -- Hash MMU +- Hash MMU (except 603 and e300) +- Software loaded TLB (603 and e300) +- Selectable Software loaded TLB in addition to hash MMU (755, 7450, e600) - Mix of 32 & 64 bit:: +--+ ++ @@ -24,9 +26,9 @@ Book3S (aka sPAPR) | | | | v v - +--+ ++ +---+ - | 604 | |750 (G3)| ---> | 750CX | - +--+ ++ +---+ + +--++-+ ++ +---+ + | 604 || 755 | <--- |750 (G3)| ---> | 750CX | + +--++-+ ++ +---+ | | | | | | v v v -- 2.25.0
Re: [PATCH V3 (RESEND) 2/3] mm/sparsemem: Enable vmem_altmap support in vmemmap_alloc_block_buf()
On Thu, Jun 18, 2020 at 06:45:29AM +0530, Anshuman Khandual wrote: > There are many instances where vmemap allocation is often switched between > regular memory and device memory just based on whether altmap is available > or not. vmemmap_alloc_block_buf() is used in various platforms to allocate > vmemmap mappings. Lets also enable it to handle altmap based device memory > allocation along with existing regular memory allocations. This will help > in avoiding the altmap based allocation switch in many places. > > While here also implement a regular memory allocation fallback mechanism > when the first preferred device memory allocation fails. This will ensure > preserving the existing semantics on powerpc platform. To summarize there > are three different methods to call vmemmap_alloc_block_buf(). > > (., NULL, false) /* Allocate from system RAM */ > (., altmap, false) /* Allocate from altmap without any fallback */ > (., altmap, true) /* Allocate from altmap with fallback (system RAM) */ [...] > diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c > index bc73abf0bc25..01e25b56eccb 100644 > --- a/arch/powerpc/mm/init_64.c > +++ b/arch/powerpc/mm/init_64.c > @@ -225,12 +225,12 @@ int __meminit vmemmap_populate(unsigned long start, > unsigned long end, int node, >* fall back to system memory if the altmap allocation fail. >*/ > if (altmap && !altmap_cross_boundary(altmap, start, page_size)) > { > - p = altmap_alloc_block_buf(page_size, altmap); > - if (!p) > - pr_debug("altmap block allocation failed, > falling back to system memory"); > + p = vmemmap_alloc_block_buf(page_size, node, > + altmap, true); > + } else { > + p = vmemmap_alloc_block_buf(page_size, node, > + NULL, false); > } > - if (!p) > - p = vmemmap_alloc_block_buf(page_size, node); > if (!p) > return -ENOMEM; Is the fallback argument actually necessary. It may be cleaner to just leave the code as is with the choice between altmap and NULL. If an arch needs a fallback (only powerpc), they have the fallback in place already. I don't see the powerpc code any better after this change. I'm fine with the altmap argument though. -- Catalin
Re: [powerpc][next-20200701] Hung task timeouts during regression test runs
> On 02-Jul-2020, at 5:22 PM, Ming Lei wrote: > > On Thu, Jul 02, 2020 at 04:53:04PM +0530, Sachin Sant wrote: >> Starting with linux-next 20200701 release I am observing automated >> regressions >> tests taking longer time to complete. A test which took 10 minutes with >> next-20200630 >> took more than 60 minutes against next-20200701. >> >> Following hung task timeout messages were seen during these runs >> >> [ 1718.848351] Not tainted 5.8.0-rc3-next-20200701-autotest #1 >> [ 1718.848356] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables >> this message. >> [ 1718.848362] NetworkManager D0 2626 1 0x00040080 >> [ 1718.848367] Call Trace: >> [ 1718.848374] [c008b0f6b8f0] [c0c6d558] schedule+0x78/0x130 >> (unreliable) >> [ 1718.848382] [c008b0f6bad0] [c001b070] __switch_to+0x2e0/0x480 >> [ 1718.848388] [c008b0f6bb30] [c0c6ce9c] __schedule+0x2cc/0x910 >> [ 1718.848394] [c008b0f6bc10] [c0c6d558] schedule+0x78/0x130 >> [ 1718.848401] [c008b0f6bc40] [c05d5a64] >> jbd2_log_wait_commit+0xd4/0x1a0 >> [ 1718.848408] [c008b0f6bcc0] [c055fb6c] >> ext4_sync_file+0x1cc/0x480 >> [ 1718.848415] [c008b0f6bd20] [c0493530] >> vfs_fsync_range+0x70/0xf0 >> [ 1718.848421] [c008b0f6bd60] [c0493638] do_fsync+0x58/0xd0 >> [ 1718.848427] [c008b0f6bda0] [c04936d8] sys_fsync+0x28/0x40 >> [ 1718.848433] [c008b0f6bdc0] [c0035e28] >> system_call_exception+0xf8/0x1c0 >> [ 1718.848440] [c008b0f6be20] [c000ca70] >> system_call_common+0xf0/0x278 >> >> Comparing next-20200630 with next-20200701 one possible candidate seems to >> be following commit: >> >> commit 37f4a24c2469a10a4c16c641671bd766e276cf9f >>blk-mq: centralise related handling into blk_mq_get_driver_tag >> >> Reverting this commit allows the test to complete in 10 minutes. > > Hello, > > Thanks for the report. > > Please try the following fix: > > https://lore.kernel.org/linux-block/20200702062041.GC2452799@T590/raw The fix works for me. Tested-by : Sachin Sant Thanks -Sachin > > > Thanks, > Ming
Re: [PATCH v6 1/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo
Hi Catalin, On 07/02/20 at 12:00pm, Catalin Marinas wrote: > On Thu, May 14, 2020 at 12:22:36AM +0530, Bhupesh Sharma wrote: > > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > > index 9f1557b98468..18175687133a 100644 > > --- a/kernel/crash_core.c > > +++ b/kernel/crash_core.c > > @@ -413,6 +413,7 @@ static int __init crash_save_vmcoreinfo_init(void) > > VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS); > > VMCOREINFO_STRUCT_SIZE(mem_section); > > VMCOREINFO_OFFSET(mem_section, section_mem_map); > > + VMCOREINFO_NUMBER(MAX_PHYSMEM_BITS); > > #endif > > VMCOREINFO_STRUCT_SIZE(page); > > VMCOREINFO_STRUCT_SIZE(pglist_data); > > I can queue this patch via the arm64 tree (together with the second one) > but I'd like an ack from the kernel/crash_core.c maintainers. They don't > seem to have been cc'ed either (only the kexec list). For the VMCOREINFO part, I'm fine with the changes, but since I do not understand the arm64 pieces so I would like to leave to arm64 people to review. If arm64 bits are good enough, feel free to add: Acked-by: Dave Young Thanks Dave
[Bug 208181] BUG: KASAN: stack-out-of-bounds in strcmp+0x58/0xd8
https://bugzilla.kernel.org/show_bug.cgi?id=208181 --- Comment #11 from Christophe Leroy (christophe.le...@csgroup.eu) --- The issue is that that commit moved more code than described into kasan_init(): Kasan Pages allocation have to be moved into kasan_init() but page tables allocation must remain before the switch to the final hash table. Problem only occurs on book3s/32 having hash MMU. See proposed fix at https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=187165 (2 patches). -- You are receiving this mail because: You are watching the assignee of the bug.
Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions
> > I'm confused about the "overlap with crashkernel memory", does that mean > > those normal kernel used memory could be put in crashkernel reserved > > memory range? If so why can't just skip those areas while crashkernel > > doing the reservation? > I raised the same question in another mail. As Hari's answer, "kexec -p" > skips these ranges in user space. And the same logic should be done in > "kexec -s -p" See it, thanks! The confusion also applied to the userspace implementation though. Seems they have to be special cases because of the powerpc crashkernel reservation implemtation in kernel limitation Thanks Dave
Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions
On 07/01/20 at 11:48pm, Hari Bathini wrote: > > > On 01/07/20 1:10 pm, Dave Young wrote: > > Hi Hari, > > On 06/27/20 at 12:35am, Hari Bathini wrote: > >> crashkernel region could have an overlap with special memory regions > >> like opal, rtas, tce-table & such. These regions are referred to as > >> exclude memory ranges. Setup this ranges during image probe in order > >> to avoid them while finding the buffer for different kdump segments. > >> Implement kexec_locate_mem_hole_ppc64() that locates a memory hole > >> accounting for these ranges. Also, override arch_kexec_add_buffer() > >> to locate a memory hole & later call __kexec_add_buffer() function > >> with kbuf->mem set to skip the generic locate memory hole lookup. > >> > >> Signed-off-by: Hari Bathini > >> --- > >> arch/powerpc/include/asm/crashdump-ppc64.h | 10 + > >> arch/powerpc/include/asm/kexec.h |7 - > >> arch/powerpc/kexec/elf_64.c|7 + > >> arch/powerpc/kexec/file_load_64.c | 292 > >> > >> 4 files changed, 312 insertions(+), 4 deletions(-) > >> create mode 100644 arch/powerpc/include/asm/crashdump-ppc64.h > >> > > [snip] > >> /** > >> + * get_exclude_memory_ranges - Get exclude memory ranges. This list > >> includes > >> + * regions like opal/rtas, tce-table, initrd, > >> + * kernel, htab which should be avoided while > >> + * setting up kexec load segments. > >> + * @mem_ranges:Range list to add the memory ranges to. > >> + * > >> + * Returns 0 on success, negative errno on error. > >> + */ > >> +static int get_exclude_memory_ranges(struct crash_mem **mem_ranges) > >> +{ > >> + int ret; > >> + > >> + ret = add_tce_mem_ranges(mem_ranges); > >> + if (ret) > >> + goto out; > >> + > >> + ret = add_initrd_mem_range(mem_ranges); > >> + if (ret) > >> + goto out; > >> + > >> + ret = add_htab_mem_range(mem_ranges); > >> + if (ret) > >> + goto out; > >> + > >> + ret = add_kernel_mem_range(mem_ranges); > >> + if (ret) > >> + goto out; > >> + > >> + ret = add_rtas_mem_range(mem_ranges, false); > >> + if (ret) > >> + goto out; > >> + > >> + ret = add_opal_mem_range(mem_ranges, false); > >> + if (ret) > >> + goto out; > >> + > >> + ret = add_reserved_ranges(mem_ranges); > >> + if (ret) > >> + goto out; > >> + > >> + /* exclude memory ranges should be sorted for easy lookup */ > >> + sort_memory_ranges(*mem_ranges); > >> +out: > >> + if (ret) > >> + pr_err("Failed to setup exclude memory ranges\n"); > >> + return ret; > >> +} > > > > I'm confused about the "overlap with crashkernel memory", does that mean > > those normal kernel used memory could be put in crashkernel reserved > > There are regions that could overlap with crashkernel region but they are > not normal kernel used memory though. These are regions that kernel and/or > f/w chose to place at a particular address for real mode accessibility > and/or memory layout between kernel & f/w kind of thing. > > > memory range? If so why can't just skip those areas while crashkernel > > doing the reservation? > > crashkernel region has a dependency to be in the first memory block for it > to be accessible in real mode. Accommodating this requirement while addressing > other requirements would mean something like what we have now. A list of > possible special memory regions in crashkernel region to take care of. > > I have plans to split crashkernel region into low & high to have exclusive > regions for crashkernel, even if that means to have two of them. But that > is for another day with its own set of complexities to deal with... Ok, I was not aware the powerpc crashkernel reservation is not dynamically reserved. But seems powerpc need those tricks at least for the time being like you said. Thanks Dave
Re: [powerpc][next-20200701] Hung task timeouts during regression test runs
On Thu, Jul 02, 2020 at 04:53:04PM +0530, Sachin Sant wrote: > Starting with linux-next 20200701 release I am observing automated regressions > tests taking longer time to complete. A test which took 10 minutes with > next-20200630 > took more than 60 minutes against next-20200701. > > Following hung task timeout messages were seen during these runs > > [ 1718.848351] Not tainted 5.8.0-rc3-next-20200701-autotest #1 > [ 1718.848356] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables > this message. > [ 1718.848362] NetworkManager D0 2626 1 0x00040080 > [ 1718.848367] Call Trace: > [ 1718.848374] [c008b0f6b8f0] [c0c6d558] schedule+0x78/0x130 > (unreliable) > [ 1718.848382] [c008b0f6bad0] [c001b070] __switch_to+0x2e0/0x480 > [ 1718.848388] [c008b0f6bb30] [c0c6ce9c] __schedule+0x2cc/0x910 > [ 1718.848394] [c008b0f6bc10] [c0c6d558] schedule+0x78/0x130 > [ 1718.848401] [c008b0f6bc40] [c05d5a64] > jbd2_log_wait_commit+0xd4/0x1a0 > [ 1718.848408] [c008b0f6bcc0] [c055fb6c] > ext4_sync_file+0x1cc/0x480 > [ 1718.848415] [c008b0f6bd20] [c0493530] vfs_fsync_range+0x70/0xf0 > [ 1718.848421] [c008b0f6bd60] [c0493638] do_fsync+0x58/0xd0 > [ 1718.848427] [c008b0f6bda0] [c04936d8] sys_fsync+0x28/0x40 > [ 1718.848433] [c008b0f6bdc0] [c0035e28] > system_call_exception+0xf8/0x1c0 > [ 1718.848440] [c008b0f6be20] [c000ca70] > system_call_common+0xf0/0x278 > > Comparing next-20200630 with next-20200701 one possible candidate seems to > be following commit: > > commit 37f4a24c2469a10a4c16c641671bd766e276cf9f > blk-mq: centralise related handling into blk_mq_get_driver_tag > > Reverting this commit allows the test to complete in 10 minutes. Hello, Thanks for the report. Please try the following fix: https://lore.kernel.org/linux-block/20200702062041.GC2452799@T590/raw Thanks, Ming
[PATCH 1/2] Revert "powerpc/kasan: Fix shadow pages allocation failure"
This reverts commit d2a91cef9bbdeb87b7449fdab1a6be6000930210. This commit moved too much work in kasan_init(). The allocation of shadow pages has to be moved for the reason explained in that patch, but the allocation of page tables still need to be done before switching to the final hash table. First revert the incorrect commit, following patch redoes it properly. Reported-by: Erhard F. Link: https://bugzilla.kernel.org/show_bug.cgi?id=208181 Fixes: d2a91cef9bbd ("powerpc/kasan: Fix shadow pages allocation failure") Cc: sta...@vger.kernel.org Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/kasan.h | 2 ++ arch/powerpc/mm/init_32.c | 2 ++ arch/powerpc/mm/kasan/kasan_init_32.c | 4 +--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/include/asm/kasan.h b/arch/powerpc/include/asm/kasan.h index be85c7005fb1..d635b96c7ea6 100644 --- a/arch/powerpc/include/asm/kasan.h +++ b/arch/powerpc/include/asm/kasan.h @@ -27,10 +27,12 @@ #ifdef CONFIG_KASAN void kasan_early_init(void); +void kasan_mmu_init(void); void kasan_init(void); void kasan_late_init(void); #else static inline void kasan_init(void) { } +static inline void kasan_mmu_init(void) { } static inline void kasan_late_init(void) { } #endif diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index 5a5469eb3174..bf1717f8d5f4 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c @@ -171,6 +171,8 @@ void __init MMU_init(void) btext_unmap(); #endif + kasan_mmu_init(); + setup_kup(); /* Shortly after that, the entire linear mapping will be available */ diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c index 0760e1e754e4..4813c6d50889 100644 --- a/arch/powerpc/mm/kasan/kasan_init_32.c +++ b/arch/powerpc/mm/kasan/kasan_init_32.c @@ -117,7 +117,7 @@ static void __init kasan_unmap_early_shadow_vmalloc(void) kasan_update_early_region(k_start, k_end, __pte(0)); } -static void __init kasan_mmu_init(void) +void __init kasan_mmu_init(void) { int ret; struct memblock_region *reg; @@ -146,8 +146,6 @@ static void __init kasan_mmu_init(void) void __init kasan_init(void) { - kasan_mmu_init(); - kasan_remap_early_shadow_ro(); clear_page(kasan_early_shadow_page); -- 2.25.0
[PATCH 2/2] powerpc/kasan: Fix shadow pages allocation failure
Doing kasan pages allocation in MMU_init is too early, kernel doesn't have access yet to the entire memory space and memblock_alloc() fails when the kernel is a bit big. Do it from kasan_init() instead. Reported-by: Erhard F. Link: https://bugzilla.kernel.org/show_bug.cgi?id=208181 Fixes: 2edb16efc899 ("powerpc/32: Add KASAN support") Fixes: d2a91cef9bbd ("powerpc/kasan: Fix shadow pages allocation failure") Cc: sta...@vger.kernel.org Signed-off-by: Christophe Leroy --- arch/powerpc/mm/kasan/kasan_init_32.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c index 4813c6d50889..019b0c0bbbf3 100644 --- a/arch/powerpc/mm/kasan/kasan_init_32.c +++ b/arch/powerpc/mm/kasan/kasan_init_32.c @@ -120,11 +120,24 @@ static void __init kasan_unmap_early_shadow_vmalloc(void) void __init kasan_mmu_init(void) { int ret; + + if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE) || + IS_ENABLED(CONFIG_KASAN_VMALLOC)) { + ret = kasan_init_shadow_page_tables(KASAN_SHADOW_START, KASAN_SHADOW_END); + + if (ret) + panic("kasan: kasan_init_shadow_page_tables() failed"); + } +} + +void __init kasan_init(void) +{ struct memblock_region *reg; for_each_memblock(memory, reg) { phys_addr_t base = reg->base; phys_addr_t top = min(base + reg->size, total_lowmem); + int ret; if (base >= top) continue; @@ -134,18 +147,6 @@ void __init kasan_mmu_init(void) panic("kasan: kasan_init_region() failed"); } - if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE) || - IS_ENABLED(CONFIG_KASAN_VMALLOC)) { - ret = kasan_init_shadow_page_tables(KASAN_SHADOW_START, KASAN_SHADOW_END); - - if (ret) - panic("kasan: kasan_init_shadow_page_tables() failed"); - } - -} - -void __init kasan_init(void) -{ kasan_remap_early_shadow_ro(); clear_page(kasan_early_shadow_page); -- 2.25.0
Re: [PATCH 01/11] kexec_file: allow archs to handle special regions while locating memory hole
On 07/02/20 at 12:01am, Hari Bathini wrote: > > > On 01/07/20 1:16 pm, Dave Young wrote: > > On 06/29/20 at 05:26pm, Hari Bathini wrote: > >> Hi Petr, > >> > >> On 29/06/20 5:09 pm, Petr Tesarik wrote: > >>> Hi Hari, > >>> > >>> is there any good reason to add two more functions with a very similar > >>> name to an existing function? AFAICS all you need is a way to call a > >>> PPC64-specific function from within kexec_add_buffer (PATCH 4/11), so > >>> you could add something like this: > >>> > >>> int __weak arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) > >>> { > >>> return 0; > >>> } > >>> > >>> Call this function from kexec_add_buffer where appropriate and then > >>> override it for PPC64 (it roughly corresponds to your > >>> kexec_locate_mem_hole_ppc64() from PATCH 4/11). > >>> > >>> FWIW it would make it easier for me to follow the resulting code. > >> > >> Right, Petr. > >> > >> I was trying out a few things before I ended up with what I sent here. > >> Bu yeah.. I did realize arch_kexec_locate_mem_hole() would have been better > >> after sending out v1. Will take care of that in v2. > > > > Another way is use arch private function to locate mem hole, then set > > kbuf->mem, and then call kexec_add_buf, it will skip the common locate > > hole function. > > Dave, I did think about it. But there are a couple of places this can get > tricky. One is ima_add_kexec_buffer() and the other is kexec_elf_load(). > These call sites could be updated to set kbuf->mem before kexec_add_buffer(). > But the current approach seemed like the better option for it creates a > single point of control in setting up segment buffers and also, makes adding > any new segments simpler, arch-specific segments or otherwise. > Ok, thanks for the explanation.
[powerpc][next-20200701] Hung task timeouts during regression test runs
Starting with linux-next 20200701 release I am observing automated regressions tests taking longer time to complete. A test which took 10 minutes with next-20200630 took more than 60 minutes against next-20200701. Following hung task timeout messages were seen during these runs [ 1718.848351] Not tainted 5.8.0-rc3-next-20200701-autotest #1 [ 1718.848356] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 1718.848362] NetworkManager D0 2626 1 0x00040080 [ 1718.848367] Call Trace: [ 1718.848374] [c008b0f6b8f0] [c0c6d558] schedule+0x78/0x130 (unreliable) [ 1718.848382] [c008b0f6bad0] [c001b070] __switch_to+0x2e0/0x480 [ 1718.848388] [c008b0f6bb30] [c0c6ce9c] __schedule+0x2cc/0x910 [ 1718.848394] [c008b0f6bc10] [c0c6d558] schedule+0x78/0x130 [ 1718.848401] [c008b0f6bc40] [c05d5a64] jbd2_log_wait_commit+0xd4/0x1a0 [ 1718.848408] [c008b0f6bcc0] [c055fb6c] ext4_sync_file+0x1cc/0x480 [ 1718.848415] [c008b0f6bd20] [c0493530] vfs_fsync_range+0x70/0xf0 [ 1718.848421] [c008b0f6bd60] [c0493638] do_fsync+0x58/0xd0 [ 1718.848427] [c008b0f6bda0] [c04936d8] sys_fsync+0x28/0x40 [ 1718.848433] [c008b0f6bdc0] [c0035e28] system_call_exception+0xf8/0x1c0 [ 1718.848440] [c008b0f6be20] [c000ca70] system_call_common+0xf0/0x278 Comparing next-20200630 with next-20200701 one possible candidate seems to be following commit: commit 37f4a24c2469a10a4c16c641671bd766e276cf9f blk-mq: centralise related handling into blk_mq_get_driver_tag Reverting this commit allows the test to complete in 10 minutes. Thanks -Sachin
Re: [PATCH v6 1/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo
On Thu, May 14, 2020 at 12:22:36AM +0530, Bhupesh Sharma wrote: > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > index 9f1557b98468..18175687133a 100644 > --- a/kernel/crash_core.c > +++ b/kernel/crash_core.c > @@ -413,6 +413,7 @@ static int __init crash_save_vmcoreinfo_init(void) > VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS); > VMCOREINFO_STRUCT_SIZE(mem_section); > VMCOREINFO_OFFSET(mem_section, section_mem_map); > + VMCOREINFO_NUMBER(MAX_PHYSMEM_BITS); > #endif > VMCOREINFO_STRUCT_SIZE(page); > VMCOREINFO_STRUCT_SIZE(pglist_data); I can queue this patch via the arm64 tree (together with the second one) but I'd like an ack from the kernel/crash_core.c maintainers. They don't seem to have been cc'ed either (only the kexec list). Thanks. -- Catalin
Re: [PATCH 5/8] powerpc/64s: implement queued spinlocks and rwlocks
On Thu, Jul 02, 2020 at 08:47:05PM +1000, Nicholas Piggin wrote: > Excerpts from Will Deacon's message of July 2, 2020 8:35 pm: > > On Thu, Jul 02, 2020 at 08:25:43PM +1000, Nicholas Piggin wrote: > >> Excerpts from Will Deacon's message of July 2, 2020 6:02 pm: > >> > On Thu, Jul 02, 2020 at 05:48:36PM +1000, Nicholas Piggin wrote: > >> >> diff --git a/arch/powerpc/include/asm/qspinlock.h > >> >> b/arch/powerpc/include/asm/qspinlock.h > >> >> new file mode 100644 > >> >> index ..f84da77b6bb7 > >> >> --- /dev/null > >> >> +++ b/arch/powerpc/include/asm/qspinlock.h > >> >> @@ -0,0 +1,20 @@ > >> >> +/* SPDX-License-Identifier: GPL-2.0 */ > >> >> +#ifndef _ASM_POWERPC_QSPINLOCK_H > >> >> +#define _ASM_POWERPC_QSPINLOCK_H > >> >> + > >> >> +#include > >> >> + > >> >> +#define _Q_PENDING_LOOPS (1 << 9) /* not tuned */ > >> >> + > >> >> +#define smp_mb__after_spinlock() smp_mb() > >> >> + > >> >> +static __always_inline int queued_spin_is_locked(struct qspinlock > >> >> *lock) > >> >> +{ > >> >> + smp_mb(); > >> >> + return atomic_read(>val); > >> >> +} > >> > > >> > Why do you need the smp_mb() here? > >> > >> A long and sad tale that ends here 51d7d5205d338 > >> > >> Should probably at least refer to that commit from here, since this one > >> is not going to git blame back there. I'll add something. > > > > Is this still an issue, though? > > > > See 38b850a73034 (where we added a similar barrier on arm64) and then > > c6f5d02b6a0f (where we removed it). > > > > Oh nice, I didn't know that went away. Thanks for the heads up. > > I'm going to say I'm too scared to remove it while changing the > spinlock algorithm, but I'll open an issue and we should look at > removing it. Makes sense to me -- it certainly needs a deeper look! In the meantime, please put some of this in a comment next to the barrier. Cheers, Will
Re: [PATCH 5/8] powerpc/64s: implement queued spinlocks and rwlocks
Excerpts from Will Deacon's message of July 2, 2020 8:35 pm: > On Thu, Jul 02, 2020 at 08:25:43PM +1000, Nicholas Piggin wrote: >> Excerpts from Will Deacon's message of July 2, 2020 6:02 pm: >> > On Thu, Jul 02, 2020 at 05:48:36PM +1000, Nicholas Piggin wrote: >> >> diff --git a/arch/powerpc/include/asm/qspinlock.h >> >> b/arch/powerpc/include/asm/qspinlock.h >> >> new file mode 100644 >> >> index ..f84da77b6bb7 >> >> --- /dev/null >> >> +++ b/arch/powerpc/include/asm/qspinlock.h >> >> @@ -0,0 +1,20 @@ >> >> +/* SPDX-License-Identifier: GPL-2.0 */ >> >> +#ifndef _ASM_POWERPC_QSPINLOCK_H >> >> +#define _ASM_POWERPC_QSPINLOCK_H >> >> + >> >> +#include >> >> + >> >> +#define _Q_PENDING_LOOPS (1 << 9) /* not tuned */ >> >> + >> >> +#define smp_mb__after_spinlock() smp_mb() >> >> + >> >> +static __always_inline int queued_spin_is_locked(struct qspinlock *lock) >> >> +{ >> >> + smp_mb(); >> >> + return atomic_read(>val); >> >> +} >> > >> > Why do you need the smp_mb() here? >> >> A long and sad tale that ends here 51d7d5205d338 >> >> Should probably at least refer to that commit from here, since this one >> is not going to git blame back there. I'll add something. > > Is this still an issue, though? > > See 38b850a73034 (where we added a similar barrier on arm64) and then > c6f5d02b6a0f (where we removed it). > Oh nice, I didn't know that went away. Thanks for the heads up. I'm going to say I'm too scared to remove it while changing the spinlock algorithm, but I'll open an issue and we should look at removing it. Thanks, Nick
Re: [PATCH 2/8] powerpc/pseries: use smp_rmb() in H_CONFER spin yield
Excerpts from Peter Zijlstra's message of July 2, 2020 6:28 pm: > On Thu, Jul 02, 2020 at 05:48:33PM +1000, Nicholas Piggin wrote: >> There is no need for rmb(), this allows faster lwsync here. > > Since you determined this; I'm thinking you actually understand the > ordering here. How about recording this understanding in a comment? > > Also, should the lock->slock load not use READ_ONCE() ? Yeah, good point. Maybe I'll drop it from this series, doesn't really belong I just saw the cleanup and didn't want to forget it. We we just ordering the two loads in this function, and !SMP isn't a concern (i.e., no issues of !SMP guest on SMP HV), but yeah fixing the lack of comment is warranted, thanks. Thanks, Nick
Re: [PATCH 5/8] powerpc/64s: implement queued spinlocks and rwlocks
On Thu, Jul 02, 2020 at 08:25:43PM +1000, Nicholas Piggin wrote: > Excerpts from Will Deacon's message of July 2, 2020 6:02 pm: > > On Thu, Jul 02, 2020 at 05:48:36PM +1000, Nicholas Piggin wrote: > >> diff --git a/arch/powerpc/include/asm/qspinlock.h > >> b/arch/powerpc/include/asm/qspinlock.h > >> new file mode 100644 > >> index ..f84da77b6bb7 > >> --- /dev/null > >> +++ b/arch/powerpc/include/asm/qspinlock.h > >> @@ -0,0 +1,20 @@ > >> +/* SPDX-License-Identifier: GPL-2.0 */ > >> +#ifndef _ASM_POWERPC_QSPINLOCK_H > >> +#define _ASM_POWERPC_QSPINLOCK_H > >> + > >> +#include > >> + > >> +#define _Q_PENDING_LOOPS (1 << 9) /* not tuned */ > >> + > >> +#define smp_mb__after_spinlock() smp_mb() > >> + > >> +static __always_inline int queued_spin_is_locked(struct qspinlock *lock) > >> +{ > >> + smp_mb(); > >> + return atomic_read(>val); > >> +} > > > > Why do you need the smp_mb() here? > > A long and sad tale that ends here 51d7d5205d338 > > Should probably at least refer to that commit from here, since this one > is not going to git blame back there. I'll add something. Is this still an issue, though? See 38b850a73034 (where we added a similar barrier on arm64) and then c6f5d02b6a0f (where we removed it). Will
Re: [PATCH 5/8] powerpc/64s: implement queued spinlocks and rwlocks
Excerpts from Will Deacon's message of July 2, 2020 6:02 pm: > On Thu, Jul 02, 2020 at 05:48:36PM +1000, Nicholas Piggin wrote: >> diff --git a/arch/powerpc/include/asm/qspinlock.h >> b/arch/powerpc/include/asm/qspinlock.h >> new file mode 100644 >> index ..f84da77b6bb7 >> --- /dev/null >> +++ b/arch/powerpc/include/asm/qspinlock.h >> @@ -0,0 +1,20 @@ >> +/* SPDX-License-Identifier: GPL-2.0 */ >> +#ifndef _ASM_POWERPC_QSPINLOCK_H >> +#define _ASM_POWERPC_QSPINLOCK_H >> + >> +#include >> + >> +#define _Q_PENDING_LOOPS(1 << 9) /* not tuned */ >> + >> +#define smp_mb__after_spinlock() smp_mb() >> + >> +static __always_inline int queued_spin_is_locked(struct qspinlock *lock) >> +{ >> +smp_mb(); >> +return atomic_read(>val); >> +} > > Why do you need the smp_mb() here? A long and sad tale that ends here 51d7d5205d338 Should probably at least refer to that commit from here, since this one is not going to git blame back there. I'll add something. Thanks, Nick
Re: [PATCH v2 10/10] powerpc/perf: Add extended regs support for power10 platform
Hi Athira, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on tip/perf/core v5.8-rc3 next-20200702] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Athira-Rajeev/powerpc-perf-Add-support-for-power10-PMU-Hardware/20200701-181147 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-pmac32_defconfig (attached as .config) compiler: powerpc-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): {standard input}: Assembler messages: >> {standard input}:84: Error: unsupported relocation against SPRN_SIER2 >> {standard input}:91: Error: unsupported relocation against SPRN_SIER3 >> {standard input}:119: Error: unsupported relocation against SPRN_MMCR3 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip