Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge 5.0-rc6 into usb-next

We want the USB fixes in here, and this resolves a merge issue in the
uas driver.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+1516 -1345
+4
.mailmap
··· 169 169 Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com> 170 170 Kamil Konieczny <k.konieczny@samsung.com> <k.konieczny@partner.samsung.com> 171 171 Kay Sievers <kay.sievers@vrfy.org> 172 + Kees Cook <keescook@chromium.org> <kees.cook@canonical.com> 173 + Kees Cook <keescook@chromium.org> <keescook@google.com> 174 + Kees Cook <keescook@chromium.org> <kees@outflux.net> 175 + Kees Cook <keescook@chromium.org> <kees@ubuntu.com> 172 176 Kenneth W Chen <kenneth.w.chen@intel.com> 173 177 Konstantin Khlebnikov <koct9i@gmail.com> <khlebnikov@yandex-team.ru> 174 178 Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com>
+1 -1
Documentation/features/debug/debug-vm-pgtable/arch-support.txt
··· 22 22 | nios2: | TODO | 23 23 | openrisc: | TODO | 24 24 | parisc: | TODO | 25 - | powerpc: | ok | 25 + | powerpc: | TODO | 26 26 | riscv: | ok | 27 27 | s390: | ok | 28 28 | sh: | TODO |
+2 -2
MAINTAINERS
··· 6180 6180 F: drivers/edac/aspeed_edac.c 6181 6181 6182 6182 EDAC-BLUEFIELD 6183 - M: Shravan Kumar Ramani <sramani@nvidia.com> 6183 + M: Shravan Kumar Ramani <shravankr@nvidia.com> 6184 6184 S: Supported 6185 6185 F: drivers/edac/bluefield_edac.c 6186 6186 ··· 9251 9251 9252 9252 ISCSI EXTENSIONS FOR RDMA (ISER) INITIATOR 9253 9253 M: Sagi Grimberg <sagi@grimberg.me> 9254 - M: Max Gurtovoy <maxg@nvidia.com> 9254 + M: Max Gurtovoy <mgurtovoy@nvidia.com> 9255 9255 L: linux-rdma@vger.kernel.org 9256 9256 S: Supported 9257 9257 W: http://www.openfabrics.org
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 9 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc5 5 + EXTRAVERSION = -rc6 6 6 NAME = Kleptomaniac Octopus 7 7 8 8 # *DOCUMENTATION*
+6 -2
arch/arm64/kernel/cpu_errata.c
··· 910 910 .desc = "ARM erratum 1418040", 911 911 .capability = ARM64_WORKAROUND_1418040, 912 912 ERRATA_MIDR_RANGE_LIST(erratum_1418040_list), 913 - .type = (ARM64_CPUCAP_SCOPE_LOCAL_CPU | 914 - ARM64_CPUCAP_PERMITTED_FOR_LATE_CPU), 913 + /* 914 + * We need to allow affected CPUs to come in late, but 915 + * also need the non-affected CPUs to be able to come 916 + * in at any point in time. Wonderful. 917 + */ 918 + .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, 915 919 }, 916 920 #endif 917 921 #ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT
+15 -11
arch/arm64/kernel/paravirt.c
··· 50 50 struct pv_time_stolen_time_region *reg; 51 51 52 52 reg = per_cpu_ptr(&stolen_time_region, cpu); 53 - if (!reg->kaddr) { 54 - pr_warn_once("stolen time enabled but not configured for cpu %d\n", 55 - cpu); 53 + 54 + /* 55 + * paravirt_steal_clock() may be called before the CPU 56 + * online notification callback runs. Until the callback 57 + * has run we just return zero. 58 + */ 59 + if (!reg->kaddr) 56 60 return 0; 57 - } 58 61 59 62 return le64_to_cpu(READ_ONCE(reg->kaddr->stolen_time)); 60 63 } 61 64 62 - static int stolen_time_dying_cpu(unsigned int cpu) 65 + static int stolen_time_cpu_down_prepare(unsigned int cpu) 63 66 { 64 67 struct pv_time_stolen_time_region *reg; 65 68 ··· 76 73 return 0; 77 74 } 78 75 79 - static int init_stolen_time_cpu(unsigned int cpu) 76 + static int stolen_time_cpu_online(unsigned int cpu) 80 77 { 81 78 struct pv_time_stolen_time_region *reg; 82 79 struct arm_smccc_res res; ··· 106 103 return 0; 107 104 } 108 105 109 - static int pv_time_init_stolen_time(void) 106 + static int __init pv_time_init_stolen_time(void) 110 107 { 111 108 int ret; 112 109 113 - ret = cpuhp_setup_state(CPUHP_AP_ARM_KVMPV_STARTING, 114 - "hypervisor/arm/pvtime:starting", 115 - init_stolen_time_cpu, stolen_time_dying_cpu); 110 + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, 111 + "hypervisor/arm/pvtime:online", 112 + stolen_time_cpu_online, 113 + stolen_time_cpu_down_prepare); 116 114 if (ret < 0) 117 115 return ret; 118 116 return 0; 119 117 } 120 118 121 - static bool has_pv_steal_clock(void) 119 + static bool __init has_pv_steal_clock(void) 122 120 { 123 121 struct arm_smccc_res res; 124 122
+31 -12
arch/arm64/net/bpf_jit_comp.c
··· 143 143 } 144 144 } 145 145 146 - static inline int bpf2a64_offset(int bpf_to, int bpf_from, 146 + static inline int bpf2a64_offset(int bpf_insn, int off, 147 147 const struct jit_ctx *ctx) 148 148 { 149 - int to = ctx->offset[bpf_to]; 150 - /* -1 to account for the Branch instruction */ 151 - int from = ctx->offset[bpf_from] - 1; 152 - 153 - return to - from; 149 + /* BPF JMP offset is relative to the next instruction */ 150 + bpf_insn++; 151 + /* 152 + * Whereas arm64 branch instructions encode the offset 153 + * from the branch itself, so we must subtract 1 from the 154 + * instruction offset. 155 + */ 156 + return ctx->offset[bpf_insn + off] - (ctx->offset[bpf_insn] - 1); 154 157 } 155 158 156 159 static void jit_fill_hole(void *area, unsigned int size) ··· 645 642 646 643 /* JUMP off */ 647 644 case BPF_JMP | BPF_JA: 648 - jmp_offset = bpf2a64_offset(i + off, i, ctx); 645 + jmp_offset = bpf2a64_offset(i, off, ctx); 649 646 check_imm26(jmp_offset); 650 647 emit(A64_B(jmp_offset), ctx); 651 648 break; ··· 672 669 case BPF_JMP32 | BPF_JSLE | BPF_X: 673 670 emit(A64_CMP(is64, dst, src), ctx); 674 671 emit_cond_jmp: 675 - jmp_offset = bpf2a64_offset(i + off, i, ctx); 672 + jmp_offset = bpf2a64_offset(i, off, ctx); 676 673 check_imm19(jmp_offset); 677 674 switch (BPF_OP(code)) { 678 675 case BPF_JEQ: ··· 911 908 const struct bpf_prog *prog = ctx->prog; 912 909 int i; 913 910 911 + /* 912 + * - offset[0] offset of the end of prologue, 913 + * start of the 1st instruction. 914 + * - offset[1] - offset of the end of 1st instruction, 915 + * start of the 2nd instruction 916 + * [....] 917 + * - offset[3] - offset of the end of 3rd instruction, 918 + * start of 4th instruction 919 + */ 914 920 for (i = 0; i < prog->len; i++) { 915 921 const struct bpf_insn *insn = &prog->insnsi[i]; 916 922 int ret; 917 923 924 + if (ctx->image == NULL) 925 + ctx->offset[i] = ctx->idx; 918 926 ret = build_insn(insn, ctx, extra_pass); 919 927 if (ret > 0) { 920 928 i++; ··· 933 919 ctx->offset[i] = ctx->idx; 934 920 continue; 935 921 } 936 - if (ctx->image == NULL) 937 - ctx->offset[i] = ctx->idx; 938 922 if (ret) 939 923 return ret; 940 924 } 925 + /* 926 + * offset is allocated with prog->len + 1 so fill in 927 + * the last element with the offset after the last 928 + * instruction (end of program) 929 + */ 930 + if (ctx->image == NULL) 931 + ctx->offset[i] = ctx->idx; 941 932 942 933 return 0; 943 934 } ··· 1021 1002 memset(&ctx, 0, sizeof(ctx)); 1022 1003 ctx.prog = prog; 1023 1004 1024 - ctx.offset = kcalloc(prog->len, sizeof(int), GFP_KERNEL); 1005 + ctx.offset = kcalloc(prog->len + 1, sizeof(int), GFP_KERNEL); 1025 1006 if (ctx.offset == NULL) { 1026 1007 prog = orig_prog; 1027 1008 goto out_off; ··· 1108 1089 prog->jited_len = prog_size; 1109 1090 1110 1091 if (!prog->is_func || extra_pass) { 1111 - bpf_prog_fill_jited_linfo(prog, ctx.offset); 1092 + bpf_prog_fill_jited_linfo(prog, ctx.offset + 1); 1112 1093 out_off: 1113 1094 kfree(ctx.offset); 1114 1095 kfree(jit_data);
-2
arch/ia64/include/asm/acpi.h
··· 74 74 buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; 75 75 } 76 76 77 - #define acpi_unlazy_tlb(x) 78 - 79 77 #ifdef CONFIG_ACPI_NUMA 80 78 extern cpumask_t early_cpu_possible_map; 81 79 #define for_each_possible_early_cpu(cpu) \
+1
arch/mips/Kconfig
··· 877 877 select I8253 878 878 select I8259 879 879 select ISA 880 + select MIPS_L1_CACHE_SHIFT_6 880 881 select SWAP_IO_SPACE if CPU_BIG_ENDIAN 881 882 select SYS_HAS_CPU_R4X00 882 883 select SYS_HAS_CPU_R5000
+7 -2
arch/mips/sni/a20r.c
··· 143 143 }, 144 144 }; 145 145 146 - static u32 a20r_ack_hwint(void) 146 + /* 147 + * Trigger chipset to update CPU's CAUSE IP field 148 + */ 149 + static u32 a20r_update_cause_ip(void) 147 150 { 148 151 u32 status = read_c0_status(); 149 152 ··· 208 205 int irq; 209 206 210 207 clear_c0_status(IE_IRQ0); 211 - status = a20r_ack_hwint(); 208 + status = a20r_update_cause_ip(); 212 209 cause = read_c0_cause(); 213 210 214 211 irq = ffs(((cause & status) >> 8) & 0xf8); 215 212 if (likely(irq > 0)) 216 213 do_IRQ(SNI_A20R_IRQ_BASE + irq - 1); 214 + 215 + a20r_update_cause_ip(); 217 216 set_c0_status(IE_IRQ0); 218 217 } 219 218
-1
arch/powerpc/Kconfig
··· 116 116 # 117 117 select ARCH_32BIT_OFF_T if PPC32 118 118 select ARCH_HAS_DEBUG_VIRTUAL 119 - select ARCH_HAS_DEBUG_VM_PGTABLE 120 119 select ARCH_HAS_DEVMEM_IS_ALLOWED 121 120 select ARCH_HAS_ELF_RANDOMIZE 122 121 select ARCH_HAS_FORTIFY_SOURCE
-1
arch/powerpc/configs/pasemi_defconfig
··· 108 108 CONFIG_FB_NVIDIA_I2C=y 109 109 CONFIG_FB_RADEON=y 110 110 # CONFIG_LCD_CLASS_DEVICE is not set 111 - CONFIG_VGACON_SOFT_SCROLLBACK=y 112 111 CONFIG_LOGO=y 113 112 CONFIG_SOUND=y 114 113 CONFIG_SND=y
-1
arch/powerpc/configs/ppc6xx_defconfig
··· 743 743 CONFIG_FB_SM501=m 744 744 CONFIG_FB_IBM_GXT4500=y 745 745 CONFIG_LCD_PLATFORM=m 746 - CONFIG_VGACON_SOFT_SCROLLBACK=y 747 746 CONFIG_FRAMEBUFFER_CONSOLE=y 748 747 CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y 749 748 CONFIG_LOGO=y
+5 -5
arch/powerpc/include/asm/book3s/64/mmu.h
··· 239 239 240 240 extern void hash__setup_initial_memory_limit(phys_addr_t first_memblock_base, 241 241 phys_addr_t first_memblock_size); 242 - extern void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base, 243 - phys_addr_t first_memblock_size); 244 242 static inline void setup_initial_memory_limit(phys_addr_t first_memblock_base, 245 243 phys_addr_t first_memblock_size) 246 244 { 247 - if (early_radix_enabled()) 248 - return radix__setup_initial_memory_limit(first_memblock_base, 249 - first_memblock_size); 245 + /* 246 + * Hash has more strict restrictions. At this point we don't 247 + * know which translations we will pick. Hence go with hash 248 + * restrictions. 249 + */ 250 250 return hash__setup_initial_memory_limit(first_memblock_base, 251 251 first_memblock_size); 252 252 }
+2 -1
arch/powerpc/kernel/dma-iommu.c
··· 120 120 if (!tbl) 121 121 return 0; 122 122 123 - mask = 1ULL < (fls_long(tbl->it_offset + tbl->it_size) - 1); 123 + mask = 1ULL << (fls_long(tbl->it_offset + tbl->it_size) + 124 + tbl->it_page_shift - 1); 124 125 mask += mask - 1; 125 126 126 127 return mask;
+1 -1
arch/powerpc/kernel/vdso32/Makefile
··· 50 50 51 51 # actual build commands 52 52 quiet_cmd_vdso32ld = VDSO32L $@ 53 - cmd_vdso32ld = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ $(call cc-ldoption, -Wl$(comma)--orphan-handling=warn) -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) 53 + cmd_vdso32ld = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) 54 54 quiet_cmd_vdso32as = VDSO32A $@ 55 55 cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $< 56 56
-1
arch/powerpc/kernel/vdso32/vdso32.lds.S
··· 111 111 *(.note.GNU-stack) 112 112 *(.data .data.* .gnu.linkonce.d.* .sdata*) 113 113 *(.bss .sbss .dynbss .dynsbss) 114 - *(.glink .iplt .plt .rela*) 115 114 } 116 115 } 117 116
+1 -1
arch/powerpc/kernel/vdso64/Makefile
··· 34 34 35 35 # actual build commands 36 36 quiet_cmd_vdso64ld = VDSO64L $@ 37 - cmd_vdso64ld = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) $(call cc-ldoption, -Wl$(comma)--orphan-handling=warn) 37 + cmd_vdso64ld = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) 38 38 39 39 # install commands for the unstripped file 40 40 quiet_cmd_vdso_install = INSTALL $@
+1 -2
arch/powerpc/kernel/vdso64/vdso64.lds.S
··· 30 30 . = ALIGN(16); 31 31 .text : { 32 32 *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) 33 - *(.sfpr) 33 + *(.sfpr .glink) 34 34 } :text 35 35 PROVIDE(__etext = .); 36 36 PROVIDE(_etext = .); ··· 111 111 *(.branch_lt) 112 112 *(.data .data.* .gnu.linkonce.d.* .sdata*) 113 113 *(.bss .sbss .dynbss .dynsbss) 114 - *(.glink .iplt .plt .rela*) 115 114 } 116 115 } 117 116
-15
arch/powerpc/mm/book3s64/radix_pgtable.c
··· 734 734 } 735 735 } 736 736 737 - void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base, 738 - phys_addr_t first_memblock_size) 739 - { 740 - /* 741 - * We don't currently support the first MEMBLOCK not mapping 0 742 - * physical on those processors 743 - */ 744 - BUG_ON(first_memblock_base != 0); 745 - 746 - /* 747 - * Radix mode is not limited by RMA / VRMA addressing. 748 - */ 749 - ppc64_rma_size = ULONG_MAX; 750 - } 751 - 752 737 #ifdef CONFIG_MEMORY_HOTPLUG 753 738 static void free_pte_table(pte_t *pte_start, pmd_t *pmd) 754 739 {
+9 -2
arch/powerpc/mm/init_64.c
··· 433 433 if (!(mfmsr() & MSR_HV)) 434 434 early_check_vec5(); 435 435 436 - if (early_radix_enabled()) 436 + if (early_radix_enabled()) { 437 437 radix__early_init_devtree(); 438 - else 438 + /* 439 + * We have finalized the translation we are going to use by now. 440 + * Radix mode is not limited by RMA / VRMA addressing. 441 + * Hence don't limit memblock allocations. 442 + */ 443 + ppc64_rma_size = ULONG_MAX; 444 + memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE); 445 + } else 439 446 hash__early_init_devtree(); 440 447 } 441 448 #endif /* CONFIG_PPC_BOOK3S_64 */
+1 -1
arch/powerpc/platforms/pseries/papr_scm.c
··· 822 822 kfree(stats); 823 823 return rc ? rc : seq_buf_used(&s); 824 824 } 825 - DEVICE_ATTR_RO(perf_stats); 825 + DEVICE_ATTR_ADMIN_RO(perf_stats); 826 826 827 827 static ssize_t flags_show(struct device *dev, 828 828 struct device_attribute *attr, char *buf)
+1
arch/riscv/Kconfig
··· 32 32 select ARCH_WANT_FRAME_POINTERS 33 33 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT 34 34 select CLONE_BACKWARDS 35 + select CLINT_TIMER if !MMU 35 36 select COMMON_CLK 36 37 select EDAC_SUPPORT 37 38 select GENERIC_ARCH_TOPOLOGY if SMP
+4 -2
arch/riscv/boot/dts/kendryte/k210.dtsi
··· 95 95 #clock-cells = <1>; 96 96 }; 97 97 98 - clint0: interrupt-controller@2000000 { 98 + clint0: clint@2000000 { 99 + #interrupt-cells = <1>; 99 100 compatible = "riscv,clint0"; 100 101 reg = <0x2000000 0xC000>; 101 - interrupts-extended = <&cpu0_intc 3>, <&cpu1_intc 3>; 102 + interrupts-extended = <&cpu0_intc 3 &cpu0_intc 7 103 + &cpu1_intc 3 &cpu1_intc 7>; 102 104 clocks = <&sysctl K210_CLK_ACLK>; 103 105 }; 104 106
+26
arch/riscv/include/asm/clint.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (C) 2020 Google, Inc 4 + */ 5 + 6 + #ifndef _ASM_RISCV_CLINT_H 7 + #define _ASM_RISCV_CLINT_H 8 + 9 + #include <linux/types.h> 10 + #include <asm/mmio.h> 11 + 12 + #ifdef CONFIG_RISCV_M_MODE 13 + /* 14 + * This lives in the CLINT driver, but is accessed directly by timex.h to avoid 15 + * any overhead when accessing the MMIO timer. 16 + * 17 + * The ISA defines mtime as a 64-bit memory-mapped register that increments at 18 + * a constant frequency, but it doesn't define some other constraints we depend 19 + * on (most notably ordering constraints, but also some simpler stuff like the 20 + * memory layout). Thus, this is called "clint_time_val" instead of something 21 + * like "riscv_mtime", to signify that these non-ISA assumptions must hold. 22 + */ 23 + extern u64 __iomem *clint_time_val; 24 + #endif 25 + 26 + #endif
+7
arch/riscv/include/asm/ftrace.h
··· 66 66 * Let auipc+jalr be the basic *mcount unit*, so we make it 8 bytes here. 67 67 */ 68 68 #define MCOUNT_INSN_SIZE 8 69 + 70 + #ifndef __ASSEMBLY__ 71 + struct dyn_ftrace; 72 + int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec); 73 + #define ftrace_init_nop ftrace_init_nop 74 + #endif 75 + 69 76 #endif 70 77 71 78 #endif /* _ASM_RISCV_FTRACE_H */
+27
arch/riscv/include/asm/timex.h
··· 10 10 11 11 typedef unsigned long cycles_t; 12 12 13 + #ifdef CONFIG_RISCV_M_MODE 14 + 15 + #include <asm/clint.h> 16 + 17 + #ifdef CONFIG_64BIT 18 + static inline cycles_t get_cycles(void) 19 + { 20 + return readq_relaxed(clint_time_val); 21 + } 22 + #else /* !CONFIG_64BIT */ 23 + static inline u32 get_cycles(void) 24 + { 25 + return readl_relaxed(((u32 *)clint_time_val)); 26 + } 27 + #define get_cycles get_cycles 28 + 29 + static inline u32 get_cycles_hi(void) 30 + { 31 + return readl_relaxed(((u32 *)clint_time_val) + 1); 32 + } 33 + #define get_cycles_hi get_cycles_hi 34 + #endif /* CONFIG_64BIT */ 35 + 36 + #else /* CONFIG_RISCV_M_MODE */ 37 + 13 38 static inline cycles_t get_cycles(void) 14 39 { 15 40 return csr_read(CSR_TIME); ··· 65 40 return ((u64)hi << 32) | lo; 66 41 } 67 42 #endif /* CONFIG_64BIT */ 43 + 44 + #endif /* !CONFIG_RISCV_M_MODE */ 68 45 69 46 #define ARCH_HAS_READ_CURRENT_TIMER 70 47 static inline int read_current_timer(unsigned long *timer_val)
+19
arch/riscv/kernel/ftrace.c
··· 97 97 return __ftrace_modify_call(rec->ip, addr, false); 98 98 } 99 99 100 + 101 + /* 102 + * This is called early on, and isn't wrapped by 103 + * ftrace_arch_code_modify_{prepare,post_process}() and therefor doesn't hold 104 + * text_mutex, which triggers a lockdep failure. SMP isn't running so we could 105 + * just directly poke the text, but it's simpler to just take the lock 106 + * ourselves. 107 + */ 108 + int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec) 109 + { 110 + int out; 111 + 112 + ftrace_arch_code_modify_prepare(); 113 + out = ftrace_make_nop(mod, rec, MCOUNT_ADDR); 114 + ftrace_arch_code_modify_post_process(); 115 + 116 + return out; 117 + } 118 + 100 119 int ftrace_update_ftrace_func(ftrace_func_t func) 101 120 { 102 121 int ret = __ftrace_modify_call((unsigned long)&ftrace_call,
+3 -4
arch/riscv/mm/init.c
··· 226 226 227 227 ptep = &fixmap_pte[pte_index(addr)]; 228 228 229 - if (pgprot_val(prot)) { 229 + if (pgprot_val(prot)) 230 230 set_pte(ptep, pfn_pte(phys >> PAGE_SHIFT, prot)); 231 - } else { 231 + else 232 232 pte_clear(&init_mm, addr, ptep); 233 - local_flush_tlb_page(addr); 234 - } 233 + local_flush_tlb_page(addr); 235 234 } 236 235 237 236 static pte_t *__init get_pte_virt(phys_addr_t pa)
+1
arch/s390/kernel/entry.h
··· 26 26 void do_dat_exception(struct pt_regs *regs); 27 27 void do_secure_storage_access(struct pt_regs *regs); 28 28 void do_non_secure_storage_access(struct pt_regs *regs); 29 + void do_secure_storage_violation(struct pt_regs *regs); 29 30 30 31 void addressing_exception(struct pt_regs *regs); 31 32 void data_exception(struct pt_regs *regs);
+2 -3
arch/s390/kernel/idle.c
··· 39 39 local_irq_restore(flags); 40 40 41 41 /* Account time spent with enabled wait psw loaded as idle time. */ 42 - /* XXX seqcount has tracepoints that require RCU */ 43 - write_seqcount_begin(&idle->seqcount); 42 + raw_write_seqcount_begin(&idle->seqcount); 44 43 idle_time = idle->clock_idle_exit - idle->clock_idle_enter; 45 44 idle->clock_idle_enter = idle->clock_idle_exit = 0ULL; 46 45 idle->idle_time += idle_time; 47 46 idle->idle_count++; 48 47 account_idle_time(cputime_to_nsecs(idle_time)); 49 - write_seqcount_end(&idle->seqcount); 48 + raw_write_seqcount_end(&idle->seqcount); 50 49 } 51 50 NOKPROBE_SYMBOL(enabled_wait); 52 51
+1 -1
arch/s390/kernel/pgm_check.S
··· 80 80 PGM_CHECK_DEFAULT /* 3c */ 81 81 PGM_CHECK(do_secure_storage_access) /* 3d */ 82 82 PGM_CHECK(do_non_secure_storage_access) /* 3e */ 83 - PGM_CHECK_DEFAULT /* 3f */ 83 + PGM_CHECK(do_secure_storage_violation) /* 3f */ 84 84 PGM_CHECK(monitor_event_exception) /* 40 */ 85 85 PGM_CHECK_DEFAULT /* 41 */ 86 86 PGM_CHECK_DEFAULT /* 42 */
+3 -3
arch/s390/kernel/setup.c
··· 619 619 /* 620 620 * Make sure that the area behind memory_end is protected 621 621 */ 622 - static void reserve_memory_end(void) 622 + static void __init reserve_memory_end(void) 623 623 { 624 624 if (memory_end_set) 625 625 memblock_reserve(memory_end, ULONG_MAX); ··· 628 628 /* 629 629 * Make sure that oldmem, where the dump is stored, is protected 630 630 */ 631 - static void reserve_oldmem(void) 631 + static void __init reserve_oldmem(void) 632 632 { 633 633 #ifdef CONFIG_CRASH_DUMP 634 634 if (OLDMEM_BASE) ··· 640 640 /* 641 641 * Make sure that oldmem, where the dump is stored, is protected 642 642 */ 643 - static void remove_oldmem(void) 643 + static void __init remove_oldmem(void) 644 644 { 645 645 #ifdef CONFIG_CRASH_DUMP 646 646 if (OLDMEM_BASE)
+20
arch/s390/mm/fault.c
··· 859 859 } 860 860 NOKPROBE_SYMBOL(do_non_secure_storage_access); 861 861 862 + void do_secure_storage_violation(struct pt_regs *regs) 863 + { 864 + /* 865 + * Either KVM messed up the secure guest mapping or the same 866 + * page is mapped into multiple secure guests. 867 + * 868 + * This exception is only triggered when a guest 2 is running 869 + * and can therefore never occur in kernel context. 870 + */ 871 + printk_ratelimited(KERN_WARNING 872 + "Secure storage violation in task: %s, pid %d\n", 873 + current->comm, current->pid); 874 + send_sig(SIGSEGV, current, 0); 875 + } 876 + 862 877 #else 863 878 void do_secure_storage_access(struct pt_regs *regs) 864 879 { ··· 881 866 } 882 867 883 868 void do_non_secure_storage_access(struct pt_regs *regs) 869 + { 870 + default_trap_handler(regs); 871 + } 872 + 873 + void do_secure_storage_violation(struct pt_regs *regs) 884 874 { 885 875 default_trap_handler(regs); 886 876 }
+4
arch/s390/pci/pci.c
··· 668 668 int zpci_disable_device(struct zpci_dev *zdev) 669 669 { 670 670 zpci_dma_exit_device(zdev); 671 + /* 672 + * The zPCI function may already be disabled by the platform, this is 673 + * detected in clp_disable_fh() which becomes a no-op. 674 + */ 671 675 return clp_disable_fh(zdev); 672 676 } 673 677 EXPORT_SYMBOL_GPL(zpci_disable_device);
+2
arch/s390/pci/pci_event.c
··· 143 143 zpci_remove_device(zdev); 144 144 } 145 145 146 + zdev->fh = ccdf->fh; 147 + zpci_disable_device(zdev); 146 148 zdev->state = ZPCI_FN_STATE_STANDBY; 147 149 if (!clp_get_state(ccdf->fid, &state) && 148 150 state == ZPCI_FN_STATE_RESERVED) {
-1
arch/sh/include/asm/smp.h
··· 8 8 9 9 #ifdef CONFIG_SMP 10 10 11 - #include <linux/spinlock.h> 12 11 #include <linux/atomic.h> 13 12 #include <asm/current.h> 14 13 #include <asm/percpu.h>
-1
arch/sh/kernel/entry-common.S
··· 370 370 nop 371 371 cmp/eq #-1, r0 372 372 bt syscall_exit 373 - mov.l r0, @(OFF_R0,r15) ! Save return value 374 373 ! Reload R0-R4 from kernel stack, where the 375 374 ! parent may have modified them using 376 375 ! ptrace(POKEUSR). (Note that R0-R2 are
+5 -10
arch/sh/kernel/ptrace_32.c
··· 455 455 456 456 asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) 457 457 { 458 - long ret = 0; 459 - 460 458 if (test_thread_flag(TIF_SYSCALL_TRACE) && 461 - tracehook_report_syscall_entry(regs)) 462 - /* 463 - * Tracing decided this syscall should not happen. 464 - * We'll return a bogus call number to get an ENOSYS 465 - * error, but leave the original number in regs->regs[0]. 466 - */ 467 - ret = -1L; 459 + tracehook_report_syscall_entry(regs)) { 460 + regs->regs[0] = -ENOSYS; 461 + return -1; 462 + } 468 463 469 464 if (secure_computing() == -1) 470 465 return -1; ··· 470 475 audit_syscall_entry(regs->regs[3], regs->regs[4], regs->regs[5], 471 476 regs->regs[6], regs->regs[7]); 472 477 473 - return ret ?: regs->regs[0]; 478 + return 0; 474 479 } 475 480 476 481 asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
+2
arch/x86/boot/compressed/Makefile
··· 43 43 KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) 44 44 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables 45 45 KBUILD_CFLAGS += -D__DISABLE_EXPORTS 46 + # Disable relocation relaxation in case the link is not PIE. 47 + KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no) 46 48 47 49 KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 48 50 GCOV_PROFILE := n
+1 -1
arch/x86/configs/i386_defconfig
··· 19 19 CONFIG_BLK_DEV_INITRD=y 20 20 # CONFIG_COMPAT_BRK is not set 21 21 CONFIG_PROFILING=y 22 + # CONFIG_64BIT is not set 22 23 CONFIG_SMP=y 23 24 CONFIG_X86_GENERIC=y 24 25 CONFIG_HPET_TIMER=y ··· 187 186 CONFIG_FB_MODE_HELPERS=y 188 187 CONFIG_FB_TILEBLITTING=y 189 188 CONFIG_FB_EFI=y 190 - CONFIG_VGACON_SOFT_SCROLLBACK=y 191 189 CONFIG_LOGO=y 192 190 # CONFIG_LOGO_LINUX_MONO is not set 193 191 # CONFIG_LOGO_LINUX_VGA16 is not set
-1
arch/x86/configs/x86_64_defconfig
··· 181 181 CONFIG_FB_MODE_HELPERS=y 182 182 CONFIG_FB_TILEBLITTING=y 183 183 CONFIG_FB_EFI=y 184 - CONFIG_VGACON_SOFT_SCROLLBACK=y 185 184 CONFIG_LOGO=y 186 185 # CONFIG_LOGO_LINUX_MONO is not set 187 186 # CONFIG_LOGO_LINUX_VGA16 is not set
-2
arch/x86/include/asm/acpi.h
··· 159 159 extern int x86_acpi_numa_init(void); 160 160 #endif /* CONFIG_ACPI_NUMA */ 161 161 162 - #define acpi_unlazy_tlb(x) leave_mm(x) 163 - 164 162 #ifdef CONFIG_ACPI_APEI 165 163 static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr) 166 164 {
+19
arch/x86/include/asm/frame.h
··· 60 60 #define FRAME_END "pop %" _ASM_BP "\n" 61 61 62 62 #ifdef CONFIG_X86_64 63 + 63 64 #define ENCODE_FRAME_POINTER \ 64 65 "lea 1(%rsp), %rbp\n\t" 66 + 67 + static inline unsigned long encode_frame_pointer(struct pt_regs *regs) 68 + { 69 + return (unsigned long)regs + 1; 70 + } 71 + 65 72 #else /* !CONFIG_X86_64 */ 73 + 66 74 #define ENCODE_FRAME_POINTER \ 67 75 "movl %esp, %ebp\n\t" \ 68 76 "andl $0x7fffffff, %ebp\n\t" 77 + 78 + static inline unsigned long encode_frame_pointer(struct pt_regs *regs) 79 + { 80 + return (unsigned long)regs & 0x7fffffff; 81 + } 82 + 69 83 #endif /* CONFIG_X86_64 */ 70 84 71 85 #endif /* __ASSEMBLY__ */ ··· 96 82 #else /* !__ASSEMBLY */ 97 83 98 84 #define ENCODE_FRAME_POINTER 85 + 86 + static inline unsigned long encode_frame_pointer(struct pt_regs *regs) 87 + { 88 + return 0; 89 + } 99 90 100 91 #endif 101 92
+2 -1
arch/x86/kernel/process.c
··· 42 42 #include <asm/spec-ctrl.h> 43 43 #include <asm/io_bitmap.h> 44 44 #include <asm/proto.h> 45 + #include <asm/frame.h> 45 46 46 47 #include "process.h" 47 48 ··· 134 133 fork_frame = container_of(childregs, struct fork_frame, regs); 135 134 frame = &fork_frame->frame; 136 135 137 - frame->bp = 0; 136 + frame->bp = encode_frame_pointer(childregs); 138 137 frame->ret_addr = (unsigned long) ret_from_fork; 139 138 p->thread.sp = (unsigned long) fork_frame; 140 139 p->thread.io_bitmap = NULL;
+60 -48
drivers/acpi/processor_idle.c
··· 161 161 } 162 162 163 163 /* Power(C) State timer broadcast control */ 164 - static void lapic_timer_state_broadcast(struct acpi_processor *pr, 165 - struct acpi_processor_cx *cx, 166 - int broadcast) 164 + static bool lapic_timer_needs_broadcast(struct acpi_processor *pr, 165 + struct acpi_processor_cx *cx) 167 166 { 168 - int state = cx - pr->power.states; 169 - 170 - if (state >= pr->power.timer_broadcast_on_state) { 171 - if (broadcast) 172 - tick_broadcast_enter(); 173 - else 174 - tick_broadcast_exit(); 175 - } 167 + return cx - pr->power.states >= pr->power.timer_broadcast_on_state; 176 168 } 177 169 178 170 #else ··· 172 180 static void lapic_timer_check_state(int state, struct acpi_processor *pr, 173 181 struct acpi_processor_cx *cstate) { } 174 182 static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { } 175 - static void lapic_timer_state_broadcast(struct acpi_processor *pr, 176 - struct acpi_processor_cx *cx, 177 - int broadcast) 183 + 184 + static bool lapic_timer_needs_broadcast(struct acpi_processor *pr, 185 + struct acpi_processor_cx *cx) 178 186 { 179 187 } 180 188 ··· 558 566 559 567 /** 560 568 * acpi_idle_enter_bm - enters C3 with proper BM handling 569 + * @drv: cpuidle driver 561 570 * @pr: Target processor 562 571 * @cx: Target state context 563 - * @timer_bc: Whether or not to change timer mode to broadcast 572 + * @index: index of target state 564 573 */ 565 - static void acpi_idle_enter_bm(struct acpi_processor *pr, 566 - struct acpi_processor_cx *cx, bool timer_bc) 574 + static int acpi_idle_enter_bm(struct cpuidle_driver *drv, 575 + struct acpi_processor *pr, 576 + struct acpi_processor_cx *cx, 577 + int index) 567 578 { 568 - acpi_unlazy_tlb(smp_processor_id()); 569 - 570 - /* 571 - * Must be done before busmaster disable as we might need to 572 - * access HPET ! 573 - */ 574 - if (timer_bc) 575 - lapic_timer_state_broadcast(pr, cx, 1); 579 + static struct acpi_processor_cx safe_cx = { 580 + .entry_method = ACPI_CSTATE_HALT, 581 + }; 576 582 577 583 /* 578 584 * disable bus master 579 585 * bm_check implies we need ARB_DIS 580 586 * bm_control implies whether we can do ARB_DIS 581 587 * 582 - * That leaves a case where bm_check is set and bm_control is 583 - * not set. In that case we cannot do much, we enter C3 584 - * without doing anything. 588 + * That leaves a case where bm_check is set and bm_control is not set. 589 + * In that case we cannot do much, we enter C3 without doing anything. 585 590 */ 586 - if (pr->flags.bm_control) { 591 + bool dis_bm = pr->flags.bm_control; 592 + 593 + /* If we can skip BM, demote to a safe state. */ 594 + if (!cx->bm_sts_skip && acpi_idle_bm_check()) { 595 + dis_bm = false; 596 + index = drv->safe_state_index; 597 + if (index >= 0) { 598 + cx = this_cpu_read(acpi_cstate[index]); 599 + } else { 600 + cx = &safe_cx; 601 + index = -EBUSY; 602 + } 603 + } 604 + 605 + if (dis_bm) { 587 606 raw_spin_lock(&c3_lock); 588 607 c3_cpu_count++; 589 608 /* Disable bus master arbitration when all CPUs are in C3 */ ··· 603 600 raw_spin_unlock(&c3_lock); 604 601 } 605 602 603 + rcu_idle_enter(); 604 + 606 605 acpi_idle_do_entry(cx); 607 606 607 + rcu_idle_exit(); 608 + 608 609 /* Re-enable bus master arbitration */ 609 - if (pr->flags.bm_control) { 610 + if (dis_bm) { 610 611 raw_spin_lock(&c3_lock); 611 612 acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0); 612 613 c3_cpu_count--; 613 614 raw_spin_unlock(&c3_lock); 614 615 } 615 616 616 - if (timer_bc) 617 - lapic_timer_state_broadcast(pr, cx, 0); 617 + return index; 618 618 } 619 619 620 620 static int acpi_idle_enter(struct cpuidle_device *dev, ··· 631 625 return -EINVAL; 632 626 633 627 if (cx->type != ACPI_STATE_C1) { 628 + if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check) 629 + return acpi_idle_enter_bm(drv, pr, cx, index); 630 + 631 + /* C2 to C1 demotion. */ 634 632 if (acpi_idle_fallback_to_c1(pr) && num_online_cpus() > 1) { 635 633 index = ACPI_IDLE_STATE_START; 636 634 cx = per_cpu(acpi_cstate[index], dev->cpu); 637 - } else if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check) { 638 - if (cx->bm_sts_skip || !acpi_idle_bm_check()) { 639 - acpi_idle_enter_bm(pr, cx, true); 640 - return index; 641 - } else if (drv->safe_state_index >= 0) { 642 - index = drv->safe_state_index; 643 - cx = per_cpu(acpi_cstate[index], dev->cpu); 644 - } else { 645 - acpi_safe_halt(); 646 - return -EBUSY; 647 - } 648 635 } 649 636 } 650 - 651 - lapic_timer_state_broadcast(pr, cx, 1); 652 637 653 638 if (cx->type == ACPI_STATE_C3) 654 639 ACPI_FLUSH_CPU_CACHE(); 655 640 656 641 acpi_idle_do_entry(cx); 657 - 658 - lapic_timer_state_broadcast(pr, cx, 0); 659 642 660 643 return index; 661 644 } ··· 661 666 return 0; 662 667 663 668 if (pr->flags.bm_check) { 664 - acpi_idle_enter_bm(pr, cx, false); 669 + u8 bm_sts_skip = cx->bm_sts_skip; 670 + 671 + /* Don't check BM_STS, do an unconditional ARB_DIS for S2IDLE */ 672 + cx->bm_sts_skip = 1; 673 + acpi_idle_enter_bm(drv, pr, cx, index); 674 + cx->bm_sts_skip = bm_sts_skip; 675 + 665 676 return 0; 666 677 } else { 667 678 ACPI_FLUSH_CPU_CACHE(); ··· 683 682 { 684 683 int i, count = ACPI_IDLE_STATE_START; 685 684 struct acpi_processor_cx *cx; 685 + struct cpuidle_state *state; 686 686 687 687 if (max_cstate == 0) 688 688 max_cstate = 1; 689 689 690 690 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { 691 + state = &acpi_idle_driver.states[count]; 691 692 cx = &pr->power.states[i]; 692 693 693 694 if (!cx->valid) 694 695 continue; 695 696 696 697 per_cpu(acpi_cstate[count], dev->cpu) = cx; 698 + 699 + if (lapic_timer_needs_broadcast(pr, cx)) 700 + state->flags |= CPUIDLE_FLAG_TIMER_STOP; 701 + 702 + if (cx->type == ACPI_STATE_C3) { 703 + state->flags |= CPUIDLE_FLAG_TLB_FLUSHED; 704 + if (pr->flags.bm_check) 705 + state->flags |= CPUIDLE_FLAG_RCU_IDLE; 706 + } 697 707 698 708 count++; 699 709 if (count == CPUIDLE_STATE_MAX)
+1
drivers/clk/bcm/Kconfig
··· 5 5 depends on ARCH_BCM2835 ||COMPILE_TEST 6 6 depends on COMMON_CLK 7 7 default ARCH_BCM2835 8 + select RESET_CONTROLLER 8 9 select RESET_SIMPLE 9 10 help 10 11 Enable common clock framework support for the Broadcom BCM2711
+1 -1
drivers/clk/davinci/pll.c
··· 491 491 parent_name = postdiv_name; 492 492 } 493 493 494 - pllen = kzalloc(sizeof(*pllout), GFP_KERNEL); 494 + pllen = kzalloc(sizeof(*pllen), GFP_KERNEL); 495 495 if (!pllen) { 496 496 ret = -ENOMEM; 497 497 goto err_unregister_postdiv;
+4 -3
drivers/clk/qcom/lpasscorecc-sc7180.c
··· 420 420 pm_runtime_enable(&pdev->dev); 421 421 ret = pm_clk_create(&pdev->dev); 422 422 if (ret) 423 - return ret; 423 + goto disable_pm_runtime; 424 424 425 425 ret = pm_clk_add(&pdev->dev, "iface"); 426 426 if (ret < 0) { 427 427 dev_err(&pdev->dev, "failed to acquire iface clock\n"); 428 - goto disable_pm_runtime; 428 + goto destroy_pm_clk; 429 429 } 430 430 431 + ret = -EINVAL; 431 432 clk_probe = of_device_get_match_data(&pdev->dev); 432 433 if (!clk_probe) 433 - return -EINVAL; 434 + goto destroy_pm_clk; 434 435 435 436 ret = clk_probe(pdev); 436 437 if (ret)
+1 -1
drivers/clk/rockchip/clk-rk3228.c
··· 137 137 PNAME(mux_hdmiphy_p) = { "hdmiphy_phy", "xin24m" }; 138 138 PNAME(mux_aclk_cpu_src_p) = { "cpll_aclk_cpu", "gpll_aclk_cpu", "hdmiphy_aclk_cpu" }; 139 139 140 - PNAME(mux_pll_src_4plls_p) = { "cpll", "gpll", "hdmiphy" "usb480m" }; 140 + PNAME(mux_pll_src_4plls_p) = { "cpll", "gpll", "hdmiphy", "usb480m" }; 141 141 PNAME(mux_pll_src_3plls_p) = { "cpll", "gpll", "hdmiphy" }; 142 142 PNAME(mux_pll_src_2plls_p) = { "cpll", "gpll" }; 143 143 PNAME(mux_sclk_hdmi_cec_p) = { "cpll", "gpll", "xin24m" };
+3 -1
drivers/clk/versatile/clk-impd1.c
··· 109 109 110 110 for_each_available_child_of_node(np, child) { 111 111 ret = integrator_impd1_clk_spawn(dev, np, child); 112 - if (ret) 112 + if (ret) { 113 + of_node_put(child); 113 114 break; 115 + } 114 116 } 115 117 116 118 return ret;
+17
drivers/clocksource/timer-clint.c
··· 19 19 #include <linux/interrupt.h> 20 20 #include <linux/of_irq.h> 21 21 #include <linux/smp.h> 22 + #include <linux/timex.h> 23 + 24 + #ifndef CONFIG_RISCV_M_MODE 25 + #include <asm/clint.h> 26 + #endif 22 27 23 28 #define CLINT_IPI_OFF 0 24 29 #define CLINT_TIMER_CMP_OFF 0x4000 ··· 35 30 static u64 __iomem *clint_timer_val; 36 31 static unsigned long clint_timer_freq; 37 32 static unsigned int clint_timer_irq; 33 + 34 + #ifdef CONFIG_RISCV_M_MODE 35 + u64 __iomem *clint_time_val; 36 + #endif 38 37 39 38 static void clint_send_ipi(const struct cpumask *target) 40 39 { ··· 192 183 clint_timer_cmp = base + CLINT_TIMER_CMP_OFF; 193 184 clint_timer_val = base + CLINT_TIMER_VAL_OFF; 194 185 clint_timer_freq = riscv_timebase; 186 + 187 + #ifdef CONFIG_RISCV_M_MODE 188 + /* 189 + * Yes, that's an odd naming scheme. time_val is public, but hopefully 190 + * will die in favor of something cleaner. 191 + */ 192 + clint_time_val = clint_timer_val; 193 + #endif 195 194 196 195 pr_info("%pOFP: timer running at %ld Hz\n", np, clint_timer_freq); 197 196
+11 -4
drivers/cpuidle/cpuidle-pseries.c
··· 361 361 for (i = 0; i < nr_xcede_records; i++) { 362 362 struct xcede_latency_record *record = &payload->records[i]; 363 363 u64 latency_tb = be64_to_cpu(record->latency_ticks); 364 - u64 latency_us = tb_to_ns(latency_tb) / NSEC_PER_USEC; 364 + u64 latency_us = DIV_ROUND_UP_ULL(tb_to_ns(latency_tb), NSEC_PER_USEC); 365 + 366 + if (latency_us == 0) 367 + pr_warn("cpuidle: xcede record %d has an unrealistic latency of 0us.\n", i); 365 368 366 369 if (latency_us < min_latency_us) 367 370 min_latency_us = latency_us; ··· 381 378 * Perform the fix-up. 382 379 */ 383 380 if (min_latency_us < dedicated_states[1].exit_latency) { 384 - u64 cede0_latency = min_latency_us - 1; 381 + /* 382 + * We set a minimum of 1us wakeup latency for cede0 to 383 + * distinguish it from snooze 384 + */ 385 + u64 cede0_latency = 1; 385 386 386 - if (cede0_latency <= 0) 387 - cede0_latency = min_latency_us; 387 + if (min_latency_us > cede0_latency) 388 + cede0_latency = min_latency_us - 1; 388 389 389 390 dedicated_states[1].exit_latency = cede0_latency; 390 391 dedicated_states[1].target_residency = 10 * (cede0_latency);
+10 -5
drivers/cpuidle/cpuidle.c
··· 138 138 struct cpuidle_device *dev, int index) 139 139 { 140 140 ktime_t time_start, time_end; 141 + struct cpuidle_state *target_state = &drv->states[index]; 141 142 142 143 time_start = ns_to_ktime(local_clock()); 143 144 ··· 154 153 * suspended is generally unsafe. 155 154 */ 156 155 stop_critical_timings(); 157 - rcu_idle_enter(); 158 - drv->states[index].enter_s2idle(dev, drv, index); 156 + if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE)) 157 + rcu_idle_enter(); 158 + target_state->enter_s2idle(dev, drv, index); 159 159 if (WARN_ON_ONCE(!irqs_disabled())) 160 160 local_irq_disable(); 161 161 /* ··· 164 162 * first CPU executing it calls functions containing RCU read-side 165 163 * critical sections, so tell RCU about that. 166 164 */ 167 - rcu_idle_exit(); 165 + if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE)) 166 + rcu_idle_exit(); 168 167 tick_unfreeze(); 169 168 start_critical_timings(); 170 169 ··· 242 239 time_start = ns_to_ktime(local_clock()); 243 240 244 241 stop_critical_timings(); 245 - rcu_idle_enter(); 242 + if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE)) 243 + rcu_idle_enter(); 246 244 entered_state = target_state->enter(dev, drv, index); 247 - rcu_idle_exit(); 245 + if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE)) 246 + rcu_idle_exit(); 248 247 start_critical_timings(); 249 248 250 249 sched_clock_idle_wakeup_event();
+10 -6
drivers/dax/super.c
··· 85 85 return false; 86 86 } 87 87 88 + if (!dax_dev) { 89 + pr_debug("%s: error: dax unsupported by block device\n", 90 + bdevname(bdev, buf)); 91 + return false; 92 + } 93 + 88 94 err = bdev_dax_pgoff(bdev, start, PAGE_SIZE, &pgoff); 89 95 if (err) { 90 96 pr_info("%s: error: unaligned partition for dax\n", ··· 102 96 err = bdev_dax_pgoff(bdev, last_page, PAGE_SIZE, &pgoff_end); 103 97 if (err) { 104 98 pr_info("%s: error: unaligned partition for dax\n", 105 - bdevname(bdev, buf)); 106 - return false; 107 - } 108 - 109 - if (!dax_dev || !bdev_dax_supported(bdev, blocksize)) { 110 - pr_debug("%s: error: dax unsupported by block device\n", 111 99 bdevname(bdev, buf)); 112 100 return false; 113 101 } ··· 325 325 bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, 326 326 int blocksize, sector_t start, sector_t len) 327 327 { 328 + if (!dax_dev) 329 + return false; 330 + 328 331 if (!dax_alive(dax_dev)) 329 332 return false; 330 333 331 334 return dax_dev->ops->dax_supported(dax_dev, bdev, blocksize, start, len); 332 335 } 336 + EXPORT_SYMBOL_GPL(dax_supported); 333 337 334 338 size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, 335 339 size_t bytes, struct iov_iter *i)
+5
drivers/edac/ghes_edac.c
··· 508 508 if (!force_load && idx < 0) 509 509 return -ENODEV; 510 510 } else { 511 + force_load = true; 511 512 idx = 0; 512 513 } 513 514 ··· 630 629 struct mem_ctl_info *mci; 631 630 unsigned long flags; 632 631 632 + if (!force_load) 633 + return; 634 + 633 635 mutex_lock(&ghes_reg_mutex); 634 636 635 637 system_scanned = false; 638 + memset(&ghes_hw, 0, sizeof(struct ghes_hw_desc)); 636 639 637 640 if (!refcount_dec_and_test(&ghes_refcount)) 638 641 goto unlock;
+1 -1
drivers/firmware/efi/efibc.c
··· 84 84 { 85 85 int ret; 86 86 87 - if (!efi_enabled(EFI_RUNTIME_SERVICES)) 87 + if (!efivars_kobject() || !efivar_supports_writes()) 88 88 return -ENODEV; 89 89 90 90 ret = register_reboot_notifier(&efibc_reboot_notifier);
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
··· 178 178 return ret; 179 179 } 180 180 181 - if (adev->asic_type == CHIP_NAVI10) { 181 + if (adev->asic_type == CHIP_NAVI10 || adev->asic_type == CHIP_SIENNA_CICHLID) { 182 182 ret= psp_sysfs_init(adev); 183 183 if (ret) { 184 184 return ret;
+1 -1
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
··· 58 58 MODULE_FIRMWARE("amdgpu/sienna_cichlid_sos.bin"); 59 59 MODULE_FIRMWARE("amdgpu/sienna_cichlid_ta.bin"); 60 60 MODULE_FIRMWARE("amdgpu/navy_flounder_sos.bin"); 61 - MODULE_FIRMWARE("amdgpu/navy_flounder_asd.bin"); 61 + MODULE_FIRMWARE("amdgpu/navy_flounder_ta.bin"); 62 62 63 63 /* address block */ 64 64 #define smnMP1_FIRMWARE_FLAGS 0x3010024
+3 -1
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
··· 1216 1216 dqm->sched_running = false; 1217 1217 dqm_unlock(dqm); 1218 1218 1219 + pm_release_ib(&dqm->packets); 1220 + 1219 1221 kfd_gtt_sa_free(dqm->dev, dqm->fence_mem); 1220 1222 pm_uninit(&dqm->packets, hanging); 1221 1223 ··· 1328 1326 if (q->properties.is_active) { 1329 1327 increment_queue_count(dqm, q->properties.type); 1330 1328 1331 - retval = execute_queues_cpsch(dqm, 1329 + execute_queues_cpsch(dqm, 1332 1330 KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0); 1333 1331 } 1334 1332
+10 -22
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 5278 5278 { 5279 5279 } 5280 5280 5281 - static bool does_crtc_have_active_cursor(struct drm_crtc_state *new_crtc_state) 5282 - { 5283 - struct drm_device *dev = new_crtc_state->crtc->dev; 5284 - struct drm_plane *plane; 5285 - 5286 - drm_for_each_plane_mask(plane, dev, new_crtc_state->plane_mask) { 5287 - if (plane->type == DRM_PLANE_TYPE_CURSOR) 5288 - return true; 5289 - } 5290 - 5291 - return false; 5292 - } 5293 - 5294 5281 static int count_crtc_active_planes(struct drm_crtc_state *new_crtc_state) 5295 5282 { 5296 5283 struct drm_atomic_state *state = new_crtc_state->state; ··· 5341 5354 return ret; 5342 5355 } 5343 5356 5357 + /* 5358 + * We require the primary plane to be enabled whenever the CRTC is, otherwise 5359 + * drm_mode_cursor_universal may end up trying to enable the cursor plane while all other 5360 + * planes are disabled, which is not supported by the hardware. And there is legacy 5361 + * userspace which stops using the HW cursor altogether in response to the resulting EINVAL. 5362 + */ 5363 + if (state->enable && 5364 + !(state->plane_mask & drm_plane_mask(crtc->primary))) 5365 + return -EINVAL; 5366 + 5344 5367 /* In some use cases, like reset, no stream is attached */ 5345 5368 if (!dm_crtc_state->stream) 5346 5369 return 0; 5347 - 5348 - /* 5349 - * We want at least one hardware plane enabled to use 5350 - * the stream with a cursor enabled. 5351 - */ 5352 - if (state->enable && state->active && 5353 - does_crtc_have_active_cursor(state) && 5354 - dm_crtc_state->active_planes == 0) 5355 - return -EINVAL; 5356 5370 5357 5371 if (dc_validate_stream(dc, dm_crtc_state->stream) == DC_OK) 5358 5372 return 0;
+2 -2
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
··· 409 409 }, 410 410 }, 411 411 .num_states = 5, 412 - .sr_exit_time_us = 8.6, 413 - .sr_enter_plus_exit_time_us = 10.9, 412 + .sr_exit_time_us = 11.6, 413 + .sr_enter_plus_exit_time_us = 13.9, 414 414 .urgent_latency_us = 4.0, 415 415 .urgent_latency_pixel_data_only_us = 4.0, 416 416 .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,
+1 -1
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.h
··· 27 27 #define MOD_HDCP_LOG_H_ 28 28 29 29 #ifdef CONFIG_DRM_AMD_DC_HDCP 30 - #define HDCP_LOG_ERR(hdcp, ...) DRM_WARN(__VA_ARGS__) 30 + #define HDCP_LOG_ERR(hdcp, ...) DRM_DEBUG_KMS(__VA_ARGS__) 31 31 #define HDCP_LOG_VER(hdcp, ...) DRM_DEBUG_KMS(__VA_ARGS__) 32 32 #define HDCP_LOG_FSM(hdcp, ...) DRM_DEBUG_KMS(__VA_ARGS__) 33 33 #define HDCP_LOG_TOP(hdcp, ...) pr_debug("[HDCP_TOP]:"__VA_ARGS__)
+1 -1
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c
··· 88 88 enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS; 89 89 90 90 if (!psp->dtm_context.dtm_initialized) { 91 - DRM_ERROR("Failed to add display topology, DTM TA is not initialized."); 91 + DRM_INFO("Failed to add display topology, DTM TA is not initialized."); 92 92 display->state = MOD_HDCP_DISPLAY_INACTIVE; 93 93 return MOD_HDCP_STATUS_FAILURE; 94 94 }
+9 -3
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
··· 1126 1126 */ 1127 1127 if (smu->uploading_custom_pp_table && 1128 1128 (adev->asic_type >= CHIP_NAVI10) && 1129 - (adev->asic_type <= CHIP_NAVI12)) 1129 + (adev->asic_type <= CHIP_NAVY_FLOUNDER)) 1130 1130 return 0; 1131 1131 1132 1132 /* ··· 1211 1211 int smu_reset(struct smu_context *smu) 1212 1212 { 1213 1213 struct amdgpu_device *adev = smu->adev; 1214 - int ret = 0; 1214 + int ret; 1215 + 1216 + amdgpu_gfx_off_ctrl(smu->adev, false); 1215 1217 1216 1218 ret = smu_hw_fini(adev); 1217 1219 if (ret) ··· 1224 1222 return ret; 1225 1223 1226 1224 ret = smu_late_init(adev); 1225 + if (ret) 1226 + return ret; 1227 1227 1228 - return ret; 1228 + amdgpu_gfx_off_ctrl(smu->adev, true); 1229 + 1230 + return 0; 1229 1231 } 1230 1232 1231 1233 static int smu_suspend(void *handle)
+30 -18
drivers/gpu/drm/i915/gem/i915_gem_context.c
··· 439 439 return __reset_engine(engine); 440 440 } 441 441 442 - static struct intel_engine_cs *__active_engine(struct i915_request *rq) 442 + static bool 443 + __active_engine(struct i915_request *rq, struct intel_engine_cs **active) 443 444 { 444 445 struct intel_engine_cs *engine, *locked; 446 + bool ret = false; 445 447 446 448 /* 447 449 * Serialise with __i915_request_submit() so that it sees 448 450 * is-banned?, or we know the request is already inflight. 451 + * 452 + * Note that rq->engine is unstable, and so we double 453 + * check that we have acquired the lock on the final engine. 449 454 */ 450 455 locked = READ_ONCE(rq->engine); 451 456 spin_lock_irq(&locked->active.lock); 452 457 while (unlikely(locked != (engine = READ_ONCE(rq->engine)))) { 453 458 spin_unlock(&locked->active.lock); 454 - spin_lock(&engine->active.lock); 455 459 locked = engine; 460 + spin_lock(&locked->active.lock); 456 461 } 457 462 458 - engine = NULL; 459 - if (i915_request_is_active(rq) && rq->fence.error != -EIO) 460 - engine = rq->engine; 463 + if (!i915_request_completed(rq)) { 464 + if (i915_request_is_active(rq) && rq->fence.error != -EIO) 465 + *active = locked; 466 + ret = true; 467 + } 461 468 462 469 spin_unlock_irq(&locked->active.lock); 463 470 464 - return engine; 471 + return ret; 465 472 } 466 473 467 474 static struct intel_engine_cs *active_engine(struct intel_context *ce) ··· 479 472 if (!ce->timeline) 480 473 return NULL; 481 474 482 - mutex_lock(&ce->timeline->mutex); 483 - list_for_each_entry_reverse(rq, &ce->timeline->requests, link) { 484 - if (i915_request_completed(rq)) 485 - break; 475 + rcu_read_lock(); 476 + list_for_each_entry_rcu(rq, &ce->timeline->requests, link) { 477 + if (i915_request_is_active(rq) && i915_request_completed(rq)) 478 + continue; 486 479 487 480 /* Check with the backend if the request is inflight */ 488 - engine = __active_engine(rq); 489 - if (engine) 481 + if (__active_engine(rq, &engine)) 490 482 break; 491 483 } 492 - mutex_unlock(&ce->timeline->mutex); 484 + rcu_read_unlock(); 493 485 494 486 return engine; 495 487 } ··· 719 713 ctx->i915 = i915; 720 714 ctx->sched.priority = I915_USER_PRIORITY(I915_PRIORITY_NORMAL); 721 715 mutex_init(&ctx->mutex); 716 + INIT_LIST_HEAD(&ctx->link); 722 717 723 718 spin_lock_init(&ctx->stale.lock); 724 719 INIT_LIST_HEAD(&ctx->stale.engines); ··· 746 739 747 740 for (i = 0; i < ARRAY_SIZE(ctx->hang_timestamp); i++) 748 741 ctx->hang_timestamp[i] = jiffies - CONTEXT_FAST_HANG_JIFFIES; 749 - 750 - spin_lock(&i915->gem.contexts.lock); 751 - list_add_tail(&ctx->link, &i915->gem.contexts.list); 752 - spin_unlock(&i915->gem.contexts.lock); 753 742 754 743 return ctx; 755 744 ··· 934 931 struct drm_i915_file_private *fpriv, 935 932 u32 *id) 936 933 { 934 + struct drm_i915_private *i915 = ctx->i915; 937 935 struct i915_address_space *vm; 938 936 int ret; 939 937 ··· 953 949 /* And finally expose ourselves to userspace via the idr */ 954 950 ret = xa_alloc(&fpriv->context_xa, id, ctx, xa_limit_32b, GFP_KERNEL); 955 951 if (ret) 956 - put_pid(fetch_and_zero(&ctx->pid)); 952 + goto err_pid; 957 953 954 + spin_lock(&i915->gem.contexts.lock); 955 + list_add_tail(&ctx->link, &i915->gem.contexts.list); 956 + spin_unlock(&i915->gem.contexts.lock); 957 + 958 + return 0; 959 + 960 + err_pid: 961 + put_pid(fetch_and_zero(&ctx->pid)); 958 962 return ret; 959 963 } 960 964
+11 -4
drivers/gpu/drm/i915/gt/intel_lrc.c
··· 2060 2060 memset_p((void **)ports, NULL, count); 2061 2061 } 2062 2062 2063 + static inline void 2064 + copy_ports(struct i915_request **dst, struct i915_request **src, int count) 2065 + { 2066 + /* A memcpy_p() would be very useful here! */ 2067 + while (count--) 2068 + WRITE_ONCE(*dst++, *src++); /* avoid write tearing */ 2069 + } 2070 + 2063 2071 static void execlists_dequeue(struct intel_engine_cs *engine) 2064 2072 { 2065 2073 struct intel_engine_execlists * const execlists = &engine->execlists; ··· 2656 2648 2657 2649 /* switch pending to inflight */ 2658 2650 GEM_BUG_ON(!assert_pending_valid(execlists, "promote")); 2659 - memcpy(execlists->inflight, 2660 - execlists->pending, 2661 - execlists_num_ports(execlists) * 2662 - sizeof(*execlists->pending)); 2651 + copy_ports(execlists->inflight, 2652 + execlists->pending, 2653 + execlists_num_ports(execlists)); 2663 2654 smp_wmb(); /* complete the seqlock */ 2664 2655 WRITE_ONCE(execlists->active, execlists->inflight); 2665 2656
+23 -2
drivers/gpu/drm/i915/i915_request.c
··· 388 388 * As we know that there are always preemption points between 389 389 * requests, we know that only the currently executing request 390 390 * may be still active even though we have cleared the flag. 391 - * However, we can't rely on our tracking of ELSP[0] to known 391 + * However, we can't rely on our tracking of ELSP[0] to know 392 392 * which request is currently active and so maybe stuck, as 393 393 * the tracking maybe an event behind. Instead assume that 394 394 * if the context is still inflight, then it is still active 395 395 * even if the active flag has been cleared. 396 + * 397 + * To further complicate matters, if there a pending promotion, the HW 398 + * may either perform a context switch to the second inflight execlists, 399 + * or it may switch to the pending set of execlists. In the case of the 400 + * latter, it may send the ACK and we process the event copying the 401 + * pending[] over top of inflight[], _overwriting_ our *active. Since 402 + * this implies the HW is arbitrating and not struck in *active, we do 403 + * not worry about complete accuracy, but we do require no read/write 404 + * tearing of the pointer [the read of the pointer must be valid, even 405 + * as the array is being overwritten, for which we require the writes 406 + * to avoid tearing.] 407 + * 408 + * Note that the read of *execlists->active may race with the promotion 409 + * of execlists->pending[] to execlists->inflight[], overwritting 410 + * the value at *execlists->active. This is fine. The promotion implies 411 + * that we received an ACK from the HW, and so the context is not 412 + * stuck -- if we do not see ourselves in *active, the inflight status 413 + * is valid. If instead we see ourselves being copied into *active, 414 + * we are inflight and may signal the callback. 396 415 */ 397 416 if (!intel_context_inflight(signal->context)) 398 417 return false; 399 418 400 419 rcu_read_lock(); 401 - for (port = __engine_active(signal->engine); (rq = *port); port++) { 420 + for (port = __engine_active(signal->engine); 421 + (rq = READ_ONCE(*port)); /* may race with promotion of pending[] */ 422 + port++) { 402 423 if (rq->context == signal->context) { 403 424 inflight = i915_seqno_passed(rq->fence.seqno, 404 425 signal->fence.seqno);
+7 -3
drivers/gpu/drm/i915/i915_sw_fence.c
··· 164 164 165 165 do { 166 166 list_for_each_entry_safe(pos, next, &x->head, entry) { 167 - pos->func(pos, 168 - TASK_NORMAL, fence->error, 169 - &extra); 167 + int wake_flags; 168 + 169 + wake_flags = fence->error; 170 + if (pos->func == autoremove_wake_function) 171 + wake_flags = 0; 172 + 173 + pos->func(pos, TASK_NORMAL, wake_flags, &extra); 170 174 } 171 175 172 176 if (list_empty(&extra))
+13 -7
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
··· 831 831 drm_crtc_index(&mtk_crtc->base)); 832 832 mtk_crtc->cmdq_client = NULL; 833 833 } 834 - ret = of_property_read_u32_index(priv->mutex_node, 835 - "mediatek,gce-events", 836 - drm_crtc_index(&mtk_crtc->base), 837 - &mtk_crtc->cmdq_event); 838 - if (ret) 839 - dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events property\n", 840 - drm_crtc_index(&mtk_crtc->base)); 834 + 835 + if (mtk_crtc->cmdq_client) { 836 + ret = of_property_read_u32_index(priv->mutex_node, 837 + "mediatek,gce-events", 838 + drm_crtc_index(&mtk_crtc->base), 839 + &mtk_crtc->cmdq_event); 840 + if (ret) { 841 + dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events property\n", 842 + drm_crtc_index(&mtk_crtc->base)); 843 + cmdq_mbox_destroy(mtk_crtc->cmdq_client); 844 + mtk_crtc->cmdq_client = NULL; 845 + } 846 + } 841 847 #endif 842 848 return 0; 843 849 }
+1
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
··· 496 496 #if IS_REACHABLE(CONFIG_MTK_CMDQ) 497 497 if (of_address_to_resource(node, 0, &res) != 0) { 498 498 dev_err(dev, "Missing reg in %s node\n", node->full_name); 499 + put_device(&larb_pdev->dev); 499 500 return -EINVAL; 500 501 } 501 502 comp->regs_pa = res.start;
+13 -6
drivers/gpu/drm/mediatek/mtk_drm_drv.c
··· 27 27 28 28 #include "mtk_drm_crtc.h" 29 29 #include "mtk_drm_ddp.h" 30 - #include "mtk_drm_ddp.h" 31 30 #include "mtk_drm_ddp_comp.h" 32 31 #include "mtk_drm_drv.h" 33 32 #include "mtk_drm_gem.h" ··· 164 165 165 166 ret = drmm_mode_config_init(drm); 166 167 if (ret) 167 - return ret; 168 + goto put_mutex_dev; 168 169 169 170 drm->mode_config.min_width = 64; 170 171 drm->mode_config.min_height = 64; ··· 181 182 182 183 ret = component_bind_all(drm->dev, drm); 183 184 if (ret) 184 - return ret; 185 + goto put_mutex_dev; 185 186 186 187 /* 187 188 * We currently support two fixed data streams, each optional, ··· 228 229 } 229 230 if (!dma_dev->dma_parms) { 230 231 ret = -ENOMEM; 231 - goto err_component_unbind; 232 + goto put_dma_dev; 232 233 } 233 234 234 235 ret = dma_set_max_seg_size(dma_dev, (unsigned int)DMA_BIT_MASK(32)); ··· 255 256 err_unset_dma_parms: 256 257 if (private->dma_parms_allocated) 257 258 dma_dev->dma_parms = NULL; 259 + put_dma_dev: 260 + put_device(private->dma_dev); 258 261 err_component_unbind: 259 262 component_unbind_all(drm->dev, drm); 260 - 263 + put_mutex_dev: 264 + put_device(private->mutex_dev); 261 265 return ret; 262 266 } 263 267 ··· 546 544 pm_runtime_disable(dev); 547 545 err_node: 548 546 of_node_put(private->mutex_node); 549 - for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) 547 + for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) { 550 548 of_node_put(private->comp_node[i]); 549 + if (private->ddp_comp[i]) { 550 + put_device(private->ddp_comp[i]->larb_dev); 551 + private->ddp_comp[i] = NULL; 552 + } 553 + } 551 554 return ret; 552 555 } 553 556
+4 -5
drivers/gpu/drm/mediatek/mtk_dsi.c
··· 466 466 horizontal_sync_active_byte = (vm->hsync_len * dsi_tmp_buf_bpp - 10); 467 467 468 468 if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) 469 - horizontal_backporch_byte = 470 - (vm->hback_porch * dsi_tmp_buf_bpp - 10); 469 + horizontal_backporch_byte = vm->hback_porch * dsi_tmp_buf_bpp; 471 470 else 472 - horizontal_backporch_byte = ((vm->hback_porch + vm->hsync_len) * 473 - dsi_tmp_buf_bpp - 10); 471 + horizontal_backporch_byte = (vm->hback_porch + vm->hsync_len) * 472 + dsi_tmp_buf_bpp; 474 473 475 474 data_phy_cycles = timing->lpx + timing->da_hs_prepare + 476 - timing->da_hs_zero + timing->da_hs_exit + 3; 475 + timing->da_hs_zero + timing->da_hs_exit; 477 476 478 477 if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) { 479 478 if ((vm->hfront_porch + vm->hback_porch) * dsi_tmp_buf_bpp >
+18 -8
drivers/gpu/drm/mediatek/mtk_hdmi.c
··· 1507 1507 dev_err(dev, 1508 1508 "Failed to get system configuration registers: %d\n", 1509 1509 ret); 1510 - return ret; 1510 + goto put_device; 1511 1511 } 1512 1512 hdmi->sys_regmap = regmap; 1513 1513 1514 1514 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1515 1515 hdmi->regs = devm_ioremap_resource(dev, mem); 1516 - if (IS_ERR(hdmi->regs)) 1517 - return PTR_ERR(hdmi->regs); 1516 + if (IS_ERR(hdmi->regs)) { 1517 + ret = PTR_ERR(hdmi->regs); 1518 + goto put_device; 1519 + } 1518 1520 1519 1521 remote = of_graph_get_remote_node(np, 1, 0); 1520 - if (!remote) 1521 - return -EINVAL; 1522 + if (!remote) { 1523 + ret = -EINVAL; 1524 + goto put_device; 1525 + } 1522 1526 1523 1527 if (!of_device_is_compatible(remote, "hdmi-connector")) { 1524 1528 hdmi->next_bridge = of_drm_find_bridge(remote); 1525 1529 if (!hdmi->next_bridge) { 1526 1530 dev_err(dev, "Waiting for external bridge\n"); 1527 1531 of_node_put(remote); 1528 - return -EPROBE_DEFER; 1532 + ret = -EPROBE_DEFER; 1533 + goto put_device; 1529 1534 } 1530 1535 } 1531 1536 ··· 1539 1534 dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n", 1540 1535 remote); 1541 1536 of_node_put(remote); 1542 - return -EINVAL; 1537 + ret = -EINVAL; 1538 + goto put_device; 1543 1539 } 1544 1540 of_node_put(remote); 1545 1541 ··· 1548 1542 of_node_put(i2c_np); 1549 1543 if (!hdmi->ddc_adpt) { 1550 1544 dev_err(dev, "Failed to get ddc i2c adapter by node\n"); 1551 - return -EINVAL; 1545 + ret = -EINVAL; 1546 + goto put_device; 1552 1547 } 1553 1548 1554 1549 return 0; 1550 + put_device: 1551 + put_device(hdmi->cec_dev); 1552 + return ret; 1555 1553 } 1556 1554 1557 1555 /*
+1 -1
drivers/gpu/drm/radeon/radeon_display.c
··· 933 933 934 934 /* get matching reference and feedback divider */ 935 935 *ref_div = min(max(den/post_div, 1u), ref_div_max); 936 - *fb_div = max(nom * *ref_div * post_div / den, 1u); 936 + *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den); 937 937 938 938 /* limit fb divider to its maximum */ 939 939 if (*fb_div > fb_div_max) {
+5 -2
drivers/hv/channel_mgmt.c
··· 731 731 void *page_addr; 732 732 struct hv_message *msg; 733 733 struct vmbus_channel_message_header *hdr; 734 - u32 message_type; 734 + u32 message_type, i; 735 735 736 736 /* 737 737 * CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was ··· 741 741 * functional and vmbus_unload_response() will complete 742 742 * vmbus_connection.unload_event. If not, the last thing we can do is 743 743 * read message pages for all CPUs directly. 744 + * 745 + * Wait no more than 10 seconds so that the panic path can't get 746 + * hung forever in case the response message isn't seen. 744 747 */ 745 - while (1) { 748 + for (i = 0; i < 1000; i++) { 746 749 if (completion_done(&vmbus_connection.unload_event)) 747 750 break; 748 751
+7 -2
drivers/hv/vmbus_drv.c
··· 2382 2382 if (atomic_read(&vmbus_connection.nr_chan_close_on_suspend) > 0) 2383 2383 wait_for_completion(&vmbus_connection.ready_for_suspend_event); 2384 2384 2385 - WARN_ON(atomic_read(&vmbus_connection.nr_chan_fixup_on_resume) != 0); 2385 + if (atomic_read(&vmbus_connection.nr_chan_fixup_on_resume) != 0) { 2386 + pr_err("Can not suspend due to a previous failed resuming\n"); 2387 + return -EBUSY; 2388 + } 2386 2389 2387 2390 mutex_lock(&vmbus_connection.channel_mutex); 2388 2391 ··· 2459 2456 2460 2457 vmbus_request_offers(); 2461 2458 2462 - wait_for_completion(&vmbus_connection.ready_for_resume_event); 2459 + if (wait_for_completion_timeout( 2460 + &vmbus_connection.ready_for_resume_event, 10 * HZ) == 0) 2461 + pr_err("Some vmbus device is missing after suspending?\n"); 2463 2462 2464 2463 /* Reset the event for the next suspend. */ 2465 2464 reinit_completion(&vmbus_connection.ready_for_suspend_event);
+2
drivers/i2c/busses/i2c-aspeed.c
··· 69 69 * These share bit definitions, so use the same values for the enable & 70 70 * status bits. 71 71 */ 72 + #define ASPEED_I2CD_INTR_RECV_MASK 0xf000ffff 72 73 #define ASPEED_I2CD_INTR_SDA_DL_TIMEOUT BIT(14) 73 74 #define ASPEED_I2CD_INTR_BUS_RECOVER_DONE BIT(13) 74 75 #define ASPEED_I2CD_INTR_SLAVE_MATCH BIT(7) ··· 605 604 writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE, 606 605 bus->base + ASPEED_I2C_INTR_STS_REG); 607 606 readl(bus->base + ASPEED_I2C_INTR_STS_REG); 607 + irq_received &= ASPEED_I2CD_INTR_RECV_MASK; 608 608 irq_remaining = irq_received; 609 609 610 610 #if IS_ENABLED(CONFIG_I2C_SLAVE)
+16 -10
drivers/i2c/busses/i2c-i801.c
··· 1709 1709 static inline void i801_acpi_remove(struct i801_priv *priv) { } 1710 1710 #endif 1711 1711 1712 + static unsigned char i801_setup_hstcfg(struct i801_priv *priv) 1713 + { 1714 + unsigned char hstcfg = priv->original_hstcfg; 1715 + 1716 + hstcfg &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ 1717 + hstcfg |= SMBHSTCFG_HST_EN; 1718 + pci_write_config_byte(priv->pci_dev, SMBHSTCFG, hstcfg); 1719 + return hstcfg; 1720 + } 1721 + 1712 1722 static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) 1713 1723 { 1714 1724 unsigned char temp; ··· 1840 1830 return err; 1841 1831 } 1842 1832 1843 - pci_read_config_byte(priv->pci_dev, SMBHSTCFG, &temp); 1844 - priv->original_hstcfg = temp; 1845 - temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ 1846 - if (!(temp & SMBHSTCFG_HST_EN)) { 1833 + pci_read_config_byte(priv->pci_dev, SMBHSTCFG, &priv->original_hstcfg); 1834 + temp = i801_setup_hstcfg(priv); 1835 + if (!(priv->original_hstcfg & SMBHSTCFG_HST_EN)) 1847 1836 dev_info(&dev->dev, "Enabling SMBus device\n"); 1848 - temp |= SMBHSTCFG_HST_EN; 1849 - } 1850 - pci_write_config_byte(priv->pci_dev, SMBHSTCFG, temp); 1851 1837 1852 1838 if (temp & SMBHSTCFG_SMB_SMI_EN) { 1853 1839 dev_dbg(&dev->dev, "SMBus using interrupt SMI#\n"); ··· 1958 1952 #ifdef CONFIG_PM_SLEEP 1959 1953 static int i801_suspend(struct device *dev) 1960 1954 { 1961 - struct pci_dev *pci_dev = to_pci_dev(dev); 1962 - struct i801_priv *priv = pci_get_drvdata(pci_dev); 1955 + struct i801_priv *priv = dev_get_drvdata(dev); 1963 1956 1964 - pci_write_config_byte(pci_dev, SMBHSTCFG, priv->original_hstcfg); 1957 + pci_write_config_byte(priv->pci_dev, SMBHSTCFG, priv->original_hstcfg); 1965 1958 return 0; 1966 1959 } 1967 1960 ··· 1968 1963 { 1969 1964 struct i801_priv *priv = dev_get_drvdata(dev); 1970 1965 1966 + i801_setup_hstcfg(priv); 1971 1967 i801_enable_host_notify(&priv->adapter); 1972 1968 1973 1969 return 0;
+3 -3
drivers/i2c/busses/i2c-mt65xx.c
··· 681 681 unsigned int cnt_mul; 682 682 int ret = -EINVAL; 683 683 684 - if (target_speed > I2C_MAX_FAST_MODE_PLUS_FREQ) 685 - target_speed = I2C_MAX_FAST_MODE_PLUS_FREQ; 684 + if (target_speed > I2C_MAX_HIGH_SPEED_MODE_FREQ) 685 + target_speed = I2C_MAX_HIGH_SPEED_MODE_FREQ; 686 686 687 687 max_step_cnt = mtk_i2c_max_step_cnt(target_speed); 688 688 base_step_cnt = max_step_cnt; ··· 759 759 for (clk_div = 1; clk_div <= max_clk_div; clk_div++) { 760 760 clk_src = parent_clk / clk_div; 761 761 762 - if (target_speed > I2C_MAX_FAST_MODE_FREQ) { 762 + if (target_speed > I2C_MAX_FAST_MODE_PLUS_FREQ) { 763 763 /* Set master code speed register */ 764 764 ret = mtk_i2c_calculate_speed(i2c, clk_src, 765 765 I2C_MAX_FAST_MODE_FREQ,
+7 -3
drivers/i2c/busses/i2c-mxs.c
··· 25 25 #include <linux/of_device.h> 26 26 #include <linux/dma-mapping.h> 27 27 #include <linux/dmaengine.h> 28 + #include <linux/dma/mxs-dma.h> 28 29 29 30 #define DRIVER_NAME "mxs-i2c" 30 31 ··· 201 200 dma_map_sg(i2c->dev, &i2c->sg_io[0], 1, DMA_TO_DEVICE); 202 201 desc = dmaengine_prep_slave_sg(i2c->dmach, &i2c->sg_io[0], 1, 203 202 DMA_MEM_TO_DEV, 204 - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 203 + DMA_PREP_INTERRUPT | 204 + MXS_DMA_CTRL_WAIT4END); 205 205 if (!desc) { 206 206 dev_err(i2c->dev, 207 207 "Failed to get DMA data write descriptor.\n"); ··· 230 228 dma_map_sg(i2c->dev, &i2c->sg_io[1], 1, DMA_FROM_DEVICE); 231 229 desc = dmaengine_prep_slave_sg(i2c->dmach, &i2c->sg_io[1], 1, 232 230 DMA_DEV_TO_MEM, 233 - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 231 + DMA_PREP_INTERRUPT | 232 + MXS_DMA_CTRL_WAIT4END); 234 233 if (!desc) { 235 234 dev_err(i2c->dev, 236 235 "Failed to get DMA data write descriptor.\n"); ··· 263 260 dma_map_sg(i2c->dev, i2c->sg_io, 2, DMA_TO_DEVICE); 264 261 desc = dmaengine_prep_slave_sg(i2c->dmach, i2c->sg_io, 2, 265 262 DMA_MEM_TO_DEV, 266 - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 263 + DMA_PREP_INTERRUPT | 264 + MXS_DMA_CTRL_WAIT4END); 267 265 if (!desc) { 268 266 dev_err(i2c->dev, 269 267 "Failed to get DMA data write descriptor.\n");
+1 -1
drivers/i2c/i2c-core-base.c
··· 1464 1464 1465 1465 /* create pre-declared device nodes */ 1466 1466 of_i2c_register_devices(adap); 1467 - i2c_acpi_register_devices(adap); 1468 1467 i2c_acpi_install_space_handler(adap); 1468 + i2c_acpi_register_devices(adap); 1469 1469 1470 1470 if (adap->nr < __i2c_first_dynamic_bus_num) 1471 1471 i2c_scan_static_board_info(adap);
+6 -4
drivers/input/mouse/trackpoint.c
··· 17 17 #include "trackpoint.h" 18 18 19 19 static const char * const trackpoint_variants[] = { 20 - [TP_VARIANT_IBM] = "IBM", 21 - [TP_VARIANT_ALPS] = "ALPS", 22 - [TP_VARIANT_ELAN] = "Elan", 23 - [TP_VARIANT_NXP] = "NXP", 20 + [TP_VARIANT_IBM] = "IBM", 21 + [TP_VARIANT_ALPS] = "ALPS", 22 + [TP_VARIANT_ELAN] = "Elan", 23 + [TP_VARIANT_NXP] = "NXP", 24 + [TP_VARIANT_JYT_SYNAPTICS] = "JYT_Synaptics", 25 + [TP_VARIANT_SYNAPTICS] = "Synaptics", 24 26 }; 25 27 26 28 /*
+6 -4
drivers/input/mouse/trackpoint.h
··· 24 24 * 0x01 was the original IBM trackpoint, others implement very limited 25 25 * subset of trackpoint features. 26 26 */ 27 - #define TP_VARIANT_IBM 0x01 28 - #define TP_VARIANT_ALPS 0x02 29 - #define TP_VARIANT_ELAN 0x03 30 - #define TP_VARIANT_NXP 0x04 27 + #define TP_VARIANT_IBM 0x01 28 + #define TP_VARIANT_ALPS 0x02 29 + #define TP_VARIANT_ELAN 0x03 30 + #define TP_VARIANT_NXP 0x04 31 + #define TP_VARIANT_JYT_SYNAPTICS 0x05 32 + #define TP_VARIANT_SYNAPTICS 0x06 31 33 32 34 /* 33 35 * Commands
+16
drivers/input/serio/i8042-x86ia64io.h
··· 548 548 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"), 549 549 }, 550 550 }, 551 + { 552 + /* Entroware Proteus */ 553 + .matches = { 554 + DMI_MATCH(DMI_SYS_VENDOR, "Entroware"), 555 + DMI_MATCH(DMI_PRODUCT_NAME, "Proteus"), 556 + DMI_MATCH(DMI_PRODUCT_VERSION, "EL07R4"), 557 + }, 558 + }, 551 559 { } 552 560 }; 553 561 ··· 682 674 .matches = { 683 675 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 684 676 DMI_MATCH(DMI_PRODUCT_NAME, "33474HU"), 677 + }, 678 + }, 679 + { 680 + /* Entroware Proteus */ 681 + .matches = { 682 + DMI_MATCH(DMI_SYS_VENDOR, "Entroware"), 683 + DMI_MATCH(DMI_PRODUCT_NAME, "Proteus"), 684 + DMI_MATCH(DMI_PRODUCT_VERSION, "EL07R4"), 685 685 }, 686 686 }, 687 687 { }
+7 -1
drivers/iommu/amd/iommu.c
··· 3840 3840 { 3841 3841 struct amd_ir_data *ir_data = (struct amd_ir_data *)data; 3842 3842 struct irte_ga *entry = (struct irte_ga *) ir_data->entry; 3843 + u64 valid; 3843 3844 3844 3845 if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) || 3845 3846 !entry || entry->lo.fields_vapic.guest_mode) 3846 3847 return 0; 3847 3848 3849 + valid = entry->lo.fields_vapic.valid; 3850 + 3848 3851 entry->lo.val = 0; 3849 3852 entry->hi.val = 0; 3850 3853 3854 + entry->lo.fields_vapic.valid = valid; 3851 3855 entry->lo.fields_vapic.guest_mode = 1; 3852 3856 entry->lo.fields_vapic.ga_log_intr = 1; 3853 3857 entry->hi.fields.ga_root_ptr = ir_data->ga_root_ptr; ··· 3868 3864 struct amd_ir_data *ir_data = (struct amd_ir_data *)data; 3869 3865 struct irte_ga *entry = (struct irte_ga *) ir_data->entry; 3870 3866 struct irq_cfg *cfg = ir_data->cfg; 3871 - u64 valid = entry->lo.fields_remap.valid; 3867 + u64 valid; 3872 3868 3873 3869 if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) || 3874 3870 !entry || !entry->lo.fields_vapic.guest_mode) 3875 3871 return 0; 3872 + 3873 + valid = entry->lo.fields_remap.valid; 3876 3874 3877 3875 entry->lo.val = 0; 3878 3876 entry->hi.val = 0;
+7 -3
drivers/md/dm-table.c
··· 860 860 int device_supports_dax(struct dm_target *ti, struct dm_dev *dev, 861 861 sector_t start, sector_t len, void *data) 862 862 { 863 - int blocksize = *(int *) data; 863 + int blocksize = *(int *) data, id; 864 + bool rc; 864 865 865 - return generic_fsdax_supported(dev->dax_dev, dev->bdev, blocksize, 866 - start, len); 866 + id = dax_read_lock(); 867 + rc = dax_supported(dev->dax_dev, dev->bdev, blocksize, start, len); 868 + dax_read_unlock(id); 869 + 870 + return rc; 867 871 } 868 872 869 873 /* Check devices support synchronous DAX */
+3 -2
drivers/md/dm.c
··· 1136 1136 { 1137 1137 struct mapped_device *md = dax_get_private(dax_dev); 1138 1138 struct dm_table *map; 1139 + bool ret = false; 1139 1140 int srcu_idx; 1140 - bool ret; 1141 1141 1142 1142 map = dm_get_live_table(md, &srcu_idx); 1143 1143 if (!map) 1144 - return false; 1144 + goto out; 1145 1145 1146 1146 ret = dm_table_supports_dax(map, device_supports_dax, &blocksize); 1147 1147 1148 + out: 1148 1149 dm_put_live_table(md, srcu_idx); 1149 1150 1150 1151 return ret;
+19 -38
drivers/mtd/spi-nor/core.c
··· 1907 1907 } 1908 1908 1909 1909 /** 1910 - * spi_nor_sr1_bit6_quad_enable() - Set/Unset the Quad Enable BIT(6) in the 1911 - * Status Register 1. 1910 + * spi_nor_sr1_bit6_quad_enable() - Set the Quad Enable BIT(6) in the Status 1911 + * Register 1. 1912 1912 * @nor: pointer to a 'struct spi_nor' 1913 - * @enable: true to enable Quad mode, false to disable Quad mode. 1914 1913 * 1915 1914 * Bit 6 of the Status Register 1 is the QE bit for Macronix like QSPI memories. 1916 1915 * 1917 1916 * Return: 0 on success, -errno otherwise. 1918 1917 */ 1919 - int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor, bool enable) 1918 + int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor) 1920 1919 { 1921 1920 int ret; 1922 1921 ··· 1923 1924 if (ret) 1924 1925 return ret; 1925 1926 1926 - if ((enable && (nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)) || 1927 - (!enable && !(nor->bouncebuf[0] & SR1_QUAD_EN_BIT6))) 1927 + if (nor->bouncebuf[0] & SR1_QUAD_EN_BIT6) 1928 1928 return 0; 1929 1929 1930 - if (enable) 1931 - nor->bouncebuf[0] |= SR1_QUAD_EN_BIT6; 1932 - else 1933 - nor->bouncebuf[0] &= ~SR1_QUAD_EN_BIT6; 1930 + nor->bouncebuf[0] |= SR1_QUAD_EN_BIT6; 1934 1931 1935 1932 return spi_nor_write_sr1_and_check(nor, nor->bouncebuf[0]); 1936 1933 } 1937 1934 1938 1935 /** 1939 - * spi_nor_sr2_bit1_quad_enable() - set/unset the Quad Enable BIT(1) in the 1940 - * Status Register 2. 1936 + * spi_nor_sr2_bit1_quad_enable() - set the Quad Enable BIT(1) in the Status 1937 + * Register 2. 1941 1938 * @nor: pointer to a 'struct spi_nor'. 1942 - * @enable: true to enable Quad mode, false to disable Quad mode. 1943 1939 * 1944 1940 * Bit 1 of the Status Register 2 is the QE bit for Spansion like QSPI memories. 1945 1941 * 1946 1942 * Return: 0 on success, -errno otherwise. 1947 1943 */ 1948 - int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor, bool enable) 1944 + int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor) 1949 1945 { 1950 1946 int ret; 1951 1947 1952 1948 if (nor->flags & SNOR_F_NO_READ_CR) 1953 - return spi_nor_write_16bit_cr_and_check(nor, 1954 - enable ? SR2_QUAD_EN_BIT1 : 0); 1949 + return spi_nor_write_16bit_cr_and_check(nor, SR2_QUAD_EN_BIT1); 1955 1950 1956 1951 ret = spi_nor_read_cr(nor, nor->bouncebuf); 1957 1952 if (ret) 1958 1953 return ret; 1959 1954 1960 - if ((enable && (nor->bouncebuf[0] & SR2_QUAD_EN_BIT1)) || 1961 - (!enable && !(nor->bouncebuf[0] & SR2_QUAD_EN_BIT1))) 1955 + if (nor->bouncebuf[0] & SR2_QUAD_EN_BIT1) 1962 1956 return 0; 1963 1957 1964 - if (enable) 1965 - nor->bouncebuf[0] |= SR2_QUAD_EN_BIT1; 1966 - else 1967 - nor->bouncebuf[0] &= ~SR2_QUAD_EN_BIT1; 1958 + nor->bouncebuf[0] |= SR2_QUAD_EN_BIT1; 1968 1959 1969 1960 return spi_nor_write_16bit_cr_and_check(nor, nor->bouncebuf[0]); 1970 1961 } 1971 1962 1972 1963 /** 1973 - * spi_nor_sr2_bit7_quad_enable() - set/unset QE bit in Status Register 2. 1964 + * spi_nor_sr2_bit7_quad_enable() - set QE bit in Status Register 2. 1974 1965 * @nor: pointer to a 'struct spi_nor' 1975 - * @enable: true to enable Quad mode, false to disable Quad mode. 1976 1966 * 1977 1967 * Set the Quad Enable (QE) bit in the Status Register 2. 1978 1968 * ··· 1971 1983 * 1972 1984 * Return: 0 on success, -errno otherwise. 1973 1985 */ 1974 - int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor, bool enable) 1986 + int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor) 1975 1987 { 1976 1988 u8 *sr2 = nor->bouncebuf; 1977 1989 int ret; ··· 1981 1993 ret = spi_nor_read_sr2(nor, sr2); 1982 1994 if (ret) 1983 1995 return ret; 1984 - if ((enable && (*sr2 & SR2_QUAD_EN_BIT7)) || 1985 - (!enable && !(*sr2 & SR2_QUAD_EN_BIT7))) 1996 + if (*sr2 & SR2_QUAD_EN_BIT7) 1986 1997 return 0; 1987 1998 1988 1999 /* Update the Quad Enable bit. */ 1989 - if (enable) 1990 - *sr2 |= SR2_QUAD_EN_BIT7; 1991 - else 1992 - *sr2 &= ~SR2_QUAD_EN_BIT7; 2000 + *sr2 |= SR2_QUAD_EN_BIT7; 1993 2001 1994 2002 ret = spi_nor_write_sr2(nor, sr2); 1995 2003 if (ret) ··· 2898 2914 } 2899 2915 2900 2916 /** 2901 - * spi_nor_quad_enable() - enable/disable Quad I/O if needed. 2917 + * spi_nor_quad_enable() - enable Quad I/O if needed. 2902 2918 * @nor: pointer to a 'struct spi_nor' 2903 - * @enable: true to enable Quad mode. false to disable Quad mode. 2904 2919 * 2905 2920 * Return: 0 on success, -errno otherwise. 2906 2921 */ 2907 - static int spi_nor_quad_enable(struct spi_nor *nor, bool enable) 2922 + static int spi_nor_quad_enable(struct spi_nor *nor) 2908 2923 { 2909 2924 if (!nor->params->quad_enable) 2910 2925 return 0; ··· 2912 2929 spi_nor_get_protocol_width(nor->write_proto) == 4)) 2913 2930 return 0; 2914 2931 2915 - return nor->params->quad_enable(nor, enable); 2932 + return nor->params->quad_enable(nor); 2916 2933 } 2917 2934 2918 2935 /** ··· 2936 2953 { 2937 2954 int err; 2938 2955 2939 - err = spi_nor_quad_enable(nor, true); 2956 + err = spi_nor_quad_enable(nor); 2940 2957 if (err) { 2941 2958 dev_dbg(nor->dev, "quad mode not supported\n"); 2942 2959 return err; ··· 2983 3000 if (nor->addr_width == 4 && !(nor->flags & SNOR_F_4B_OPCODES) && 2984 3001 nor->flags & SNOR_F_BROKEN_RESET) 2985 3002 nor->params->set_4byte_addr_mode(nor, false); 2986 - 2987 - spi_nor_quad_enable(nor, false); 2988 3003 } 2989 3004 EXPORT_SYMBOL_GPL(spi_nor_restore); 2990 3005
+5 -5
drivers/mtd/spi-nor/core.h
··· 198 198 * higher index in the array, the higher priority. 199 199 * @erase_map: the erase map parsed from the SFDP Sector Map Parameter 200 200 * Table. 201 - * @quad_enable: enables/disables SPI NOR Quad mode. 201 + * @quad_enable: enables SPI NOR quad mode. 202 202 * @set_4byte_addr_mode: puts the SPI NOR in 4 byte addressing mode. 203 203 * @convert_addr: converts an absolute address into something the flash 204 204 * will understand. Particularly useful when pagesize is ··· 219 219 220 220 struct spi_nor_erase_map erase_map; 221 221 222 - int (*quad_enable)(struct spi_nor *nor, bool enable); 222 + int (*quad_enable)(struct spi_nor *nor); 223 223 int (*set_4byte_addr_mode)(struct spi_nor *nor, bool enable); 224 224 u32 (*convert_addr)(struct spi_nor *nor, u32 addr); 225 225 int (*setup)(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps); ··· 406 406 int spi_nor_wait_till_ready(struct spi_nor *nor); 407 407 int spi_nor_lock_and_prep(struct spi_nor *nor); 408 408 void spi_nor_unlock_and_unprep(struct spi_nor *nor); 409 - int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor, bool enable); 410 - int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor, bool enable); 411 - int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor, bool enable); 409 + int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor); 410 + int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor); 411 + int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor); 412 412 413 413 int spi_nor_xread_sr(struct spi_nor *nor, u8 *sr); 414 414 ssize_t spi_nor_read_data(struct spi_nor *nor, loff_t from, size_t len,
+1
drivers/powercap/intel_rapl_common.c
··· 1039 1039 X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE, &rapl_defaults_core), 1040 1040 X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &rapl_defaults_core), 1041 1041 X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server), 1042 + X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD, &rapl_defaults_core), 1042 1043 1043 1044 X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &rapl_defaults_byt), 1044 1045 X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, &rapl_defaults_cht),
+4 -4
drivers/s390/crypto/zcrypt_ccamisc.c
··· 1692 1692 *nr_apqns = 0; 1693 1693 1694 1694 /* fetch status of all crypto cards */ 1695 - device_status = kmalloc_array(MAX_ZDEV_ENTRIES_EXT, 1696 - sizeof(struct zcrypt_device_status_ext), 1697 - GFP_KERNEL); 1695 + device_status = kvmalloc_array(MAX_ZDEV_ENTRIES_EXT, 1696 + sizeof(struct zcrypt_device_status_ext), 1697 + GFP_KERNEL); 1698 1698 if (!device_status) 1699 1699 return -ENOMEM; 1700 1700 zcrypt_device_status_mask_ext(device_status); ··· 1762 1762 verify = 0; 1763 1763 } 1764 1764 1765 - kfree(device_status); 1765 + kvfree(device_status); 1766 1766 return rc; 1767 1767 } 1768 1768 EXPORT_SYMBOL(cca_findcard2);
+2 -1
drivers/scsi/libsas/sas_discover.c
··· 182 182 pr_warn("driver on host %s cannot handle device %016llx, error:%d\n", 183 183 dev_name(sas_ha->dev), 184 184 SAS_ADDR(dev->sas_addr), res); 185 + return res; 185 186 } 186 187 set_bit(SAS_DEV_FOUND, &dev->state); 187 188 kref_get(&dev->kref); 188 - return res; 189 + return 0; 189 190 } 190 191 191 192
+16 -4
drivers/thunderbolt/eeprom.c
··· 7 7 */ 8 8 9 9 #include <linux/crc32.h> 10 + #include <linux/delay.h> 10 11 #include <linux/property.h> 11 12 #include <linux/slab.h> 12 13 #include "tb.h" ··· 390 389 struct tb_drom_entry_header *entry = (void *) (sw->drom + pos); 391 390 if (pos + 1 == drom_size || pos + entry->len > drom_size 392 391 || !entry->len) { 393 - tb_sw_warn(sw, "drom buffer overrun, aborting\n"); 394 - return -EIO; 392 + tb_sw_warn(sw, "DROM buffer overrun\n"); 393 + return -EILSEQ; 395 394 } 396 395 397 396 switch (entry->type) { ··· 527 526 u16 size; 528 527 u32 crc; 529 528 struct tb_drom_header *header; 530 - int res; 529 + int res, retries = 1; 530 + 531 531 if (sw->drom) 532 532 return 0; 533 533 ··· 614 612 tb_sw_warn(sw, "drom device_rom_revision %#x unknown\n", 615 613 header->device_rom_revision); 616 614 617 - return tb_drom_parse_entries(sw); 615 + res = tb_drom_parse_entries(sw); 616 + /* If the DROM parsing fails, wait a moment and retry once */ 617 + if (res == -EILSEQ && retries--) { 618 + tb_sw_warn(sw, "parsing DROM failed, retrying\n"); 619 + msleep(100); 620 + res = tb_drom_read_n(sw, 0, sw->drom, size); 621 + if (!res) 622 + goto parse; 623 + } 624 + 625 + return res; 618 626 err: 619 627 kfree(sw->drom); 620 628 sw->drom = NULL;
+11
drivers/tty/serial/8250/8250_pci.c
··· 5566 5566 PCI_ANY_ID, PCI_ANY_ID, 5567 5567 0, 0, pbn_wch384_4 }, 5568 5568 5569 + /* 5570 + * Realtek RealManage 5571 + */ 5572 + { PCI_VENDOR_ID_REALTEK, 0x816a, 5573 + PCI_ANY_ID, PCI_ANY_ID, 5574 + 0, 0, pbn_b0_1_115200 }, 5575 + 5576 + { PCI_VENDOR_ID_REALTEK, 0x816b, 5577 + PCI_ANY_ID, PCI_ANY_ID, 5578 + 0, 0, pbn_b0_1_115200 }, 5579 + 5569 5580 /* Fintek PCI serial cards */ 5570 5581 { PCI_DEVICE(0x1c29, 0x1104), .driver_data = pbn_fintek_4 }, 5571 5582 { PCI_DEVICE(0x1c29, 0x1108), .driver_data = pbn_fintek_8 },
+20 -24
drivers/tty/serial/serial_core.c
··· 1916 1916 return uart_console(port) && (port->cons->flags & CON_ENABLED); 1917 1917 } 1918 1918 1919 - static void __uart_port_spin_lock_init(struct uart_port *port) 1919 + static void uart_port_spin_lock_init(struct uart_port *port) 1920 1920 { 1921 1921 spin_lock_init(&port->lock); 1922 1922 lockdep_set_class(&port->lock, &port_lock_key); 1923 - } 1924 - 1925 - /* 1926 - * Ensure that the serial console lock is initialised early. 1927 - * If this port is a console, then the spinlock is already initialised. 1928 - */ 1929 - static inline void uart_port_spin_lock_init(struct uart_port *port) 1930 - { 1931 - if (uart_console(port)) 1932 - return; 1933 - 1934 - __uart_port_spin_lock_init(port); 1935 1923 } 1936 1924 1937 1925 #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL) ··· 2074 2086 struct ktermios termios; 2075 2087 static struct ktermios dummy; 2076 2088 2077 - uart_port_spin_lock_init(port); 2089 + /* 2090 + * Ensure that the serial-console lock is initialised early. 2091 + * 2092 + * Note that the console-enabled check is needed because of kgdboc, 2093 + * which can end up calling uart_set_options() for an already enabled 2094 + * console via tty_find_polling_driver() and uart_poll_init(). 2095 + */ 2096 + if (!uart_console_enabled(port) && !port->console_reinit) 2097 + uart_port_spin_lock_init(port); 2078 2098 2079 2099 memset(&termios, 0, sizeof(struct ktermios)); 2080 2100 ··· 2373 2377 2374 2378 /* Power up port for set_mctrl() */ 2375 2379 uart_change_pm(state, UART_PM_STATE_ON); 2376 - 2377 - /* 2378 - * If this driver supports console, and it hasn't been 2379 - * successfully registered yet, initialise spin lock for it. 2380 - */ 2381 - if (port->cons && !(port->cons->flags & CON_ENABLED)) 2382 - __uart_port_spin_lock_init(port); 2383 2380 2384 2381 /* 2385 2382 * Ensure that the modem control lines are de-activated. ··· 2790 2801 if (oldconsole && !newconsole) { 2791 2802 ret = unregister_console(uport->cons); 2792 2803 } else if (!oldconsole && newconsole) { 2793 - if (uart_console(uport)) 2804 + if (uart_console(uport)) { 2805 + uport->console_reinit = 1; 2794 2806 register_console(uport->cons); 2795 - else 2807 + } else { 2796 2808 ret = -ENOENT; 2809 + } 2797 2810 } 2798 2811 } else { 2799 2812 ret = -ENXIO; ··· 2891 2900 goto out; 2892 2901 } 2893 2902 2894 - uart_port_spin_lock_init(uport); 2903 + /* 2904 + * If this port is in use as a console then the spinlock is already 2905 + * initialised. 2906 + */ 2907 + if (!uart_console_enabled(uport)) 2908 + uart_port_spin_lock_init(uport); 2895 2909 2896 2910 if (uport->cons && uport->dev) 2897 2911 of_console_check(uport->dev->of_node, uport->cons->name, uport->line);
+5
drivers/usb/class/usblp.c
··· 827 827 if (rv < 0) 828 828 return rv; 829 829 830 + if (!usblp->present) { 831 + count = -ENODEV; 832 + goto done; 833 + } 834 + 830 835 if ((avail = usblp->rstatus) < 0) { 831 836 printk(KERN_ERR "usblp%d: error %d reading from printer\n", 832 837 usblp->minor, (int)avail);
+4
drivers/usb/core/quirks.c
··· 397 397 /* Generic RTL8153 based ethernet adapters */ 398 398 { USB_DEVICE(0x0bda, 0x8153), .driver_info = USB_QUIRK_NO_LPM }, 399 399 400 + /* SONiX USB DEVICE Touchpad */ 401 + { USB_DEVICE(0x0c45, 0x7056), .driver_info = 402 + USB_QUIRK_IGNORE_REMOTE_WAKEUP }, 403 + 400 404 /* Action Semiconductor flash disk */ 401 405 { USB_DEVICE(0x10d6, 0x2200), .driver_info = 402 406 USB_QUIRK_STRING_FETCH_255 },
+1
drivers/usb/host/ehci-hcd.c
··· 22 22 #include <linux/interrupt.h> 23 23 #include <linux/usb.h> 24 24 #include <linux/usb/hcd.h> 25 + #include <linux/usb/otg.h> 25 26 #include <linux/moduleparam.h> 26 27 #include <linux/dma-mapping.h> 27 28 #include <linux/debugfs.h>
-1
drivers/usb/host/ehci-hub.c
··· 14 14 */ 15 15 16 16 /*-------------------------------------------------------------------------*/ 17 - #include <linux/usb/otg.h> 18 17 19 18 #define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E) 20 19
+9 -3
drivers/usb/typec/mux/intel_pmc_mux.c
··· 176 176 static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len) 177 177 { 178 178 u8 response[4]; 179 + int ret; 179 180 180 181 /* 181 182 * Error bit will always be 0 with the USBC command. 182 - * Status can be checked from the response message. 183 + * Status can be checked from the response message if the 184 + * function intel_scu_ipc_dev_command succeeds. 183 185 */ 184 - intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg, len, 185 - response, sizeof(response)); 186 + ret = intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg, 187 + len, response, sizeof(response)); 188 + 189 + if (ret) 190 + return ret; 191 + 186 192 if (response[2] & PMC_USB_RESP_STATUS_FAILURE) { 187 193 if (response[2] & PMC_USB_RESP_STATUS_FATAL) 188 194 return -EIO;
+16 -6
drivers/usb/typec/ucsi/ucsi.c
··· 216 216 con->partner_altmode[i] == altmode); 217 217 } 218 218 219 - static u8 ucsi_altmode_next_mode(struct typec_altmode **alt, u16 svid) 219 + static int ucsi_altmode_next_mode(struct typec_altmode **alt, u16 svid) 220 220 { 221 221 u8 mode = 1; 222 222 int i; 223 223 224 - for (i = 0; alt[i]; i++) 224 + for (i = 0; alt[i]; i++) { 225 + if (i > MODE_DISCOVERY_MAX) 226 + return -ERANGE; 227 + 225 228 if (alt[i]->svid == svid) 226 229 mode++; 230 + } 227 231 228 232 return mode; 229 233 } ··· 262 258 goto err; 263 259 } 264 260 265 - desc->mode = ucsi_altmode_next_mode(con->port_altmode, 266 - desc->svid); 261 + ret = ucsi_altmode_next_mode(con->port_altmode, desc->svid); 262 + if (ret < 0) 263 + return ret; 264 + 265 + desc->mode = ret; 267 266 268 267 switch (desc->svid) { 269 268 case USB_TYPEC_DP_SID: ··· 299 292 goto err; 300 293 } 301 294 302 - desc->mode = ucsi_altmode_next_mode(con->partner_altmode, 303 - desc->svid); 295 + ret = ucsi_altmode_next_mode(con->partner_altmode, desc->svid); 296 + if (ret < 0) 297 + return ret; 298 + 299 + desc->mode = ret; 304 300 305 301 alt = typec_partner_register_altmode(con->partner, desc); 306 302 if (IS_ERR(alt)) {
+1 -1
drivers/usb/typec/ucsi/ucsi_acpi.c
··· 78 78 if (ret) 79 79 goto out_clear_bit; 80 80 81 - if (!wait_for_completion_timeout(&ua->complete, msecs_to_jiffies(5000))) 81 + if (!wait_for_completion_timeout(&ua->complete, 60 * HZ)) 82 82 ret = -ETIMEDOUT; 83 83 84 84 out_clear_bit:
-46
drivers/video/console/Kconfig
··· 22 22 23 23 Say Y. 24 24 25 - config VGACON_SOFT_SCROLLBACK 26 - bool "Enable Scrollback Buffer in System RAM" 27 - depends on VGA_CONSOLE 28 - default n 29 - help 30 - The scrollback buffer of the standard VGA console is located in 31 - the VGA RAM. The size of this RAM is fixed and is quite small. 32 - If you require a larger scrollback buffer, this can be placed in 33 - System RAM which is dynamically allocated during initialization. 34 - Placing the scrollback buffer in System RAM will slightly slow 35 - down the console. 36 - 37 - If you want this feature, say 'Y' here and enter the amount of 38 - RAM to allocate for this buffer. If unsure, say 'N'. 39 - 40 - config VGACON_SOFT_SCROLLBACK_SIZE 41 - int "Scrollback Buffer Size (in KB)" 42 - depends on VGACON_SOFT_SCROLLBACK 43 - range 1 1024 44 - default "64" 45 - help 46 - Enter the amount of System RAM to allocate for scrollback 47 - buffers of VGA consoles. Each 64KB will give you approximately 48 - 16 80x25 screenfuls of scrollback buffer. 49 - 50 - config VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT 51 - bool "Persistent Scrollback History for each console by default" 52 - depends on VGACON_SOFT_SCROLLBACK 53 - default n 54 - help 55 - Say Y here if the scrollback history should persist by default when 56 - switching between consoles. Otherwise, the scrollback history will be 57 - flushed each time the console is switched. This feature can also be 58 - enabled using the boot command line parameter 59 - 'vgacon.scrollback_persistent=1'. 60 - 61 - This feature might break your tool of choice to flush the scrollback 62 - buffer, e.g. clear(1) will work fine but Debian's clear_console(1) 63 - will be broken, which might cause security issues. 64 - You can use the escape sequence \e[3J instead if this feature is 65 - activated. 66 - 67 - Note that a buffer of VGACON_SOFT_SCROLLBACK_SIZE is taken for each 68 - created tty device. 69 - So if you use a RAM-constrained system, say N here. 70 - 71 25 config MDA_CONSOLE 72 26 depends on !M68K && !PARISC && ISA 73 27 tristate "MDA text console (dual-headed)"
+1 -220
drivers/video/console/vgacon.c
··· 165 165 write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2); 166 166 } 167 167 168 - #ifdef CONFIG_VGACON_SOFT_SCROLLBACK 169 - /* software scrollback */ 170 - struct vgacon_scrollback_info { 171 - void *data; 172 - int tail; 173 - int size; 174 - int rows; 175 - int cnt; 176 - int cur; 177 - int save; 178 - int restore; 179 - }; 180 - 181 - static struct vgacon_scrollback_info *vgacon_scrollback_cur; 182 - static struct vgacon_scrollback_info vgacon_scrollbacks[MAX_NR_CONSOLES]; 183 - static bool scrollback_persistent = \ 184 - IS_ENABLED(CONFIG_VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT); 185 - module_param_named(scrollback_persistent, scrollback_persistent, bool, 0000); 186 - MODULE_PARM_DESC(scrollback_persistent, "Enable persistent scrollback for all vga consoles"); 187 - 188 - static void vgacon_scrollback_reset(int vc_num, size_t reset_size) 189 - { 190 - struct vgacon_scrollback_info *scrollback = &vgacon_scrollbacks[vc_num]; 191 - 192 - if (scrollback->data && reset_size > 0) 193 - memset(scrollback->data, 0, reset_size); 194 - 195 - scrollback->cnt = 0; 196 - scrollback->tail = 0; 197 - scrollback->cur = 0; 198 - } 199 - 200 - static void vgacon_scrollback_init(int vc_num) 201 - { 202 - int pitch = vga_video_num_columns * 2; 203 - size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024; 204 - int rows = size / pitch; 205 - void *data; 206 - 207 - data = kmalloc_array(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, 208 - GFP_NOWAIT); 209 - 210 - vgacon_scrollbacks[vc_num].data = data; 211 - vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num]; 212 - 213 - vgacon_scrollback_cur->rows = rows - 1; 214 - vgacon_scrollback_cur->size = rows * pitch; 215 - 216 - vgacon_scrollback_reset(vc_num, size); 217 - } 218 - 219 - static void vgacon_scrollback_switch(int vc_num) 220 - { 221 - if (!scrollback_persistent) 222 - vc_num = 0; 223 - 224 - if (!vgacon_scrollbacks[vc_num].data) { 225 - vgacon_scrollback_init(vc_num); 226 - } else { 227 - if (scrollback_persistent) { 228 - vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num]; 229 - } else { 230 - size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024; 231 - 232 - vgacon_scrollback_reset(vc_num, size); 233 - } 234 - } 235 - } 236 - 237 - static void vgacon_scrollback_startup(void) 238 - { 239 - vgacon_scrollback_cur = &vgacon_scrollbacks[0]; 240 - vgacon_scrollback_init(0); 241 - } 242 - 243 - static void vgacon_scrollback_update(struct vc_data *c, int t, int count) 244 - { 245 - void *p; 246 - 247 - if (!vgacon_scrollback_cur->data || !vgacon_scrollback_cur->size || 248 - c->vc_num != fg_console) 249 - return; 250 - 251 - p = (void *) (c->vc_origin + t * c->vc_size_row); 252 - 253 - while (count--) { 254 - if ((vgacon_scrollback_cur->tail + c->vc_size_row) > 255 - vgacon_scrollback_cur->size) 256 - vgacon_scrollback_cur->tail = 0; 257 - 258 - scr_memcpyw(vgacon_scrollback_cur->data + 259 - vgacon_scrollback_cur->tail, 260 - p, c->vc_size_row); 261 - 262 - vgacon_scrollback_cur->cnt++; 263 - p += c->vc_size_row; 264 - vgacon_scrollback_cur->tail += c->vc_size_row; 265 - 266 - if (vgacon_scrollback_cur->tail >= vgacon_scrollback_cur->size) 267 - vgacon_scrollback_cur->tail = 0; 268 - 269 - if (vgacon_scrollback_cur->cnt > vgacon_scrollback_cur->rows) 270 - vgacon_scrollback_cur->cnt = vgacon_scrollback_cur->rows; 271 - 272 - vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt; 273 - } 274 - } 275 - 276 - static void vgacon_restore_screen(struct vc_data *c) 277 - { 278 - c->vc_origin = c->vc_visible_origin; 279 - vgacon_scrollback_cur->save = 0; 280 - 281 - if (!vga_is_gfx && !vgacon_scrollback_cur->restore) { 282 - scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, 283 - c->vc_screenbuf_size > vga_vram_size ? 284 - vga_vram_size : c->vc_screenbuf_size); 285 - vgacon_scrollback_cur->restore = 1; 286 - vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt; 287 - } 288 - } 289 - 290 - static void vgacon_scrolldelta(struct vc_data *c, int lines) 291 - { 292 - int start, end, count, soff; 293 - 294 - if (!lines) { 295 - vgacon_restore_screen(c); 296 - return; 297 - } 298 - 299 - if (!vgacon_scrollback_cur->data) 300 - return; 301 - 302 - if (!vgacon_scrollback_cur->save) { 303 - vgacon_cursor(c, CM_ERASE); 304 - vgacon_save_screen(c); 305 - c->vc_origin = (unsigned long)c->vc_screenbuf; 306 - vgacon_scrollback_cur->save = 1; 307 - } 308 - 309 - vgacon_scrollback_cur->restore = 0; 310 - start = vgacon_scrollback_cur->cur + lines; 311 - end = start + abs(lines); 312 - 313 - if (start < 0) 314 - start = 0; 315 - 316 - if (start > vgacon_scrollback_cur->cnt) 317 - start = vgacon_scrollback_cur->cnt; 318 - 319 - if (end < 0) 320 - end = 0; 321 - 322 - if (end > vgacon_scrollback_cur->cnt) 323 - end = vgacon_scrollback_cur->cnt; 324 - 325 - vgacon_scrollback_cur->cur = start; 326 - count = end - start; 327 - soff = vgacon_scrollback_cur->tail - 328 - ((vgacon_scrollback_cur->cnt - end) * c->vc_size_row); 329 - soff -= count * c->vc_size_row; 330 - 331 - if (soff < 0) 332 - soff += vgacon_scrollback_cur->size; 333 - 334 - count = vgacon_scrollback_cur->cnt - start; 335 - 336 - if (count > c->vc_rows) 337 - count = c->vc_rows; 338 - 339 - if (count) { 340 - int copysize; 341 - 342 - int diff = c->vc_rows - count; 343 - void *d = (void *) c->vc_visible_origin; 344 - void *s = (void *) c->vc_screenbuf; 345 - 346 - count *= c->vc_size_row; 347 - /* how much memory to end of buffer left? */ 348 - copysize = min(count, vgacon_scrollback_cur->size - soff); 349 - scr_memcpyw(d, vgacon_scrollback_cur->data + soff, copysize); 350 - d += copysize; 351 - count -= copysize; 352 - 353 - if (count) { 354 - scr_memcpyw(d, vgacon_scrollback_cur->data, count); 355 - d += count; 356 - } 357 - 358 - if (diff) 359 - scr_memcpyw(d, s, diff * c->vc_size_row); 360 - } else 361 - vgacon_cursor(c, CM_MOVE); 362 - } 363 - 364 - static void vgacon_flush_scrollback(struct vc_data *c) 365 - { 366 - size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024; 367 - 368 - vgacon_scrollback_reset(c->vc_num, size); 369 - } 370 - #else 371 - #define vgacon_scrollback_startup(...) do { } while (0) 372 - #define vgacon_scrollback_init(...) do { } while (0) 373 - #define vgacon_scrollback_update(...) do { } while (0) 374 - #define vgacon_scrollback_switch(...) do { } while (0) 375 - 376 168 static void vgacon_restore_screen(struct vc_data *c) 377 169 { 378 170 if (c->vc_origin != c->vc_visible_origin) ··· 177 385 vga_vram_size); 178 386 vga_set_mem_top(c); 179 387 } 180 - 181 - static void vgacon_flush_scrollback(struct vc_data *c) 182 - { 183 - } 184 - #endif /* CONFIG_VGACON_SOFT_SCROLLBACK */ 185 388 186 389 static const char *vgacon_startup(void) 187 390 { ··· 360 573 vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH; 361 574 vgacon_yres = vga_scan_lines; 362 575 363 - if (!vga_init_done) { 364 - vgacon_scrollback_startup(); 365 - vga_init_done = true; 366 - } 576 + vga_init_done = true; 367 577 368 578 return display_desc; 369 579 } ··· 653 869 vgacon_doresize(c, c->vc_cols, c->vc_rows); 654 870 } 655 871 656 - vgacon_scrollback_switch(c->vc_num); 657 872 return 0; /* Redrawing not needed */ 658 873 } 659 874 ··· 1169 1386 oldo = c->vc_origin; 1170 1387 delta = lines * c->vc_size_row; 1171 1388 if (dir == SM_UP) { 1172 - vgacon_scrollback_update(c, t, lines); 1173 1389 if (c->vc_scr_end + delta >= vga_vram_end) { 1174 1390 scr_memcpyw((u16 *) vga_vram_base, 1175 1391 (u16 *) (oldo + delta), ··· 1232 1450 .con_save_screen = vgacon_save_screen, 1233 1451 .con_build_attr = vgacon_build_attr, 1234 1452 .con_invert_region = vgacon_invert_region, 1235 - .con_flush_scrollback = vgacon_flush_scrollback, 1236 1453 }; 1237 1454 EXPORT_SYMBOL(vga_con); 1238 1455
+1 -10
drivers/video/fbdev/core/bitblit.c
··· 234 234 } 235 235 236 236 static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, 237 - int softback_lines, int fg, int bg) 237 + int fg, int bg) 238 238 { 239 239 struct fb_cursor cursor; 240 240 struct fbcon_ops *ops = info->fbcon_par; ··· 246 246 char *src; 247 247 248 248 cursor.set = 0; 249 - 250 - if (softback_lines) { 251 - if (y + softback_lines >= vc->vc_rows) { 252 - mode = CM_ERASE; 253 - ops->cursor_flash = 0; 254 - return; 255 - } else 256 - y += softback_lines; 257 - } 258 249 259 250 c = scr_readw((u16 *) vc->vc_pos); 260 251 attribute = get_attribute(info, c);
+5 -331
drivers/video/fbdev/core/fbcon.c
··· 122 122 /* logo_shown is an index to vc_cons when >= 0; otherwise follows FBCON_LOGO 123 123 enums. */ 124 124 static int logo_shown = FBCON_LOGO_CANSHOW; 125 - /* Software scrollback */ 126 - static int fbcon_softback_size = 32768; 127 - static unsigned long softback_buf, softback_curr; 128 - static unsigned long softback_in; 129 - static unsigned long softback_top, softback_end; 130 - static int softback_lines; 131 125 /* console mappings */ 132 126 static int first_fb_vc; 133 127 static int last_fb_vc = MAX_NR_CONSOLES - 1; ··· 160 166 static int margin_color; 161 167 162 168 static const struct consw fb_con; 163 - 164 - #define CM_SOFTBACK (8) 165 169 166 170 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row) 167 171 ··· 365 373 return color; 366 374 } 367 375 368 - static void fbcon_update_softback(struct vc_data *vc) 369 - { 370 - int l = fbcon_softback_size / vc->vc_size_row; 371 - 372 - if (l > 5) 373 - softback_end = softback_buf + l * vc->vc_size_row; 374 - else 375 - /* Smaller scrollback makes no sense, and 0 would screw 376 - the operation totally */ 377 - softback_top = 0; 378 - } 379 - 380 376 static void fb_flashcursor(struct work_struct *work) 381 377 { 382 378 struct fb_info *info = container_of(work, struct fb_info, queue); ··· 394 414 c = scr_readw((u16 *) vc->vc_pos); 395 415 mode = (!ops->cursor_flash || ops->cursor_state.enable) ? 396 416 CM_ERASE : CM_DRAW; 397 - ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), 417 + ops->cursor(vc, info, mode, get_color(vc, info, c, 1), 398 418 get_color(vc, info, c, 0)); 399 419 console_unlock(); 400 420 } ··· 451 471 } 452 472 453 473 if (!strncmp(options, "scrollback:", 11)) { 454 - options += 11; 455 - if (*options) { 456 - fbcon_softback_size = simple_strtoul(options, &options, 0); 457 - if (*options == 'k' || *options == 'K') { 458 - fbcon_softback_size *= 1024; 459 - } 460 - } 474 + pr_warn("Ignoring scrollback size option\n"); 461 475 continue; 462 476 } 463 477 ··· 996 1022 997 1023 set_blitting_type(vc, info); 998 1024 999 - if (info->fix.type != FB_TYPE_TEXT) { 1000 - if (fbcon_softback_size) { 1001 - if (!softback_buf) { 1002 - softback_buf = 1003 - (unsigned long) 1004 - kvmalloc(fbcon_softback_size, 1005 - GFP_KERNEL); 1006 - if (!softback_buf) { 1007 - fbcon_softback_size = 0; 1008 - softback_top = 0; 1009 - } 1010 - } 1011 - } else { 1012 - if (softback_buf) { 1013 - kvfree((void *) softback_buf); 1014 - softback_buf = 0; 1015 - softback_top = 0; 1016 - } 1017 - } 1018 - if (softback_buf) 1019 - softback_in = softback_top = softback_curr = 1020 - softback_buf; 1021 - softback_lines = 0; 1022 - } 1023 - 1024 1025 /* Setup default font */ 1025 1026 if (!p->fontdata && !vc->vc_font.data) { 1026 1027 if (!fontname[0] || !(font = find_font(fontname))) ··· 1169 1220 if (logo) 1170 1221 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); 1171 1222 1172 - if (vc == svc && softback_buf) 1173 - fbcon_update_softback(vc); 1174 - 1175 1223 if (ops->rotate_font && ops->rotate_font(info, vc)) { 1176 1224 ops->rotate = FB_ROTATE_UR; 1177 1225 set_blitting_type(vc, info); ··· 1331 1385 { 1332 1386 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1333 1387 struct fbcon_ops *ops = info->fbcon_par; 1334 - int y; 1335 1388 int c = scr_readw((u16 *) vc->vc_pos); 1336 1389 1337 1390 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); ··· 1344 1399 fbcon_add_cursor_timer(info); 1345 1400 1346 1401 ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1; 1347 - if (mode & CM_SOFTBACK) { 1348 - mode &= ~CM_SOFTBACK; 1349 - y = softback_lines; 1350 - } else { 1351 - if (softback_lines) 1352 - fbcon_set_origin(vc); 1353 - y = 0; 1354 - } 1355 1402 1356 - ops->cursor(vc, info, mode, y, get_color(vc, info, c, 1), 1403 + ops->cursor(vc, info, mode, get_color(vc, info, c, 1), 1357 1404 get_color(vc, info, c, 0)); 1358 1405 } 1359 1406 ··· 1416 1479 1417 1480 if (con_is_visible(vc)) { 1418 1481 update_screen(vc); 1419 - if (softback_buf) 1420 - fbcon_update_softback(vc); 1421 1482 } 1422 1483 } 1423 1484 ··· 1551 1616 if (scrollback_max < 0) 1552 1617 scrollback_max = 0; 1553 1618 scrollback_current = 0; 1554 - } 1555 - 1556 - static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p, 1557 - long delta) 1558 - { 1559 - int count = vc->vc_rows; 1560 - unsigned short *d, *s; 1561 - unsigned long n; 1562 - int line = 0; 1563 - 1564 - d = (u16 *) softback_curr; 1565 - if (d == (u16 *) softback_in) 1566 - d = (u16 *) vc->vc_origin; 1567 - n = softback_curr + delta * vc->vc_size_row; 1568 - softback_lines -= delta; 1569 - if (delta < 0) { 1570 - if (softback_curr < softback_top && n < softback_buf) { 1571 - n += softback_end - softback_buf; 1572 - if (n < softback_top) { 1573 - softback_lines -= 1574 - (softback_top - n) / vc->vc_size_row; 1575 - n = softback_top; 1576 - } 1577 - } else if (softback_curr >= softback_top 1578 - && n < softback_top) { 1579 - softback_lines -= 1580 - (softback_top - n) / vc->vc_size_row; 1581 - n = softback_top; 1582 - } 1583 - } else { 1584 - if (softback_curr > softback_in && n >= softback_end) { 1585 - n += softback_buf - softback_end; 1586 - if (n > softback_in) { 1587 - n = softback_in; 1588 - softback_lines = 0; 1589 - } 1590 - } else if (softback_curr <= softback_in && n > softback_in) { 1591 - n = softback_in; 1592 - softback_lines = 0; 1593 - } 1594 - } 1595 - if (n == softback_curr) 1596 - return; 1597 - softback_curr = n; 1598 - s = (u16 *) softback_curr; 1599 - if (s == (u16 *) softback_in) 1600 - s = (u16 *) vc->vc_origin; 1601 - while (count--) { 1602 - unsigned short *start; 1603 - unsigned short *le; 1604 - unsigned short c; 1605 - int x = 0; 1606 - unsigned short attr = 1; 1607 - 1608 - start = s; 1609 - le = advance_row(s, 1); 1610 - do { 1611 - c = scr_readw(s); 1612 - if (attr != (c & 0xff00)) { 1613 - attr = c & 0xff00; 1614 - if (s > start) { 1615 - fbcon_putcs(vc, start, s - start, 1616 - line, x); 1617 - x += s - start; 1618 - start = s; 1619 - } 1620 - } 1621 - if (c == scr_readw(d)) { 1622 - if (s > start) { 1623 - fbcon_putcs(vc, start, s - start, 1624 - line, x); 1625 - x += s - start + 1; 1626 - start = s + 1; 1627 - } else { 1628 - x++; 1629 - start++; 1630 - } 1631 - } 1632 - s++; 1633 - d++; 1634 - } while (s < le); 1635 - if (s > start) 1636 - fbcon_putcs(vc, start, s - start, line, x); 1637 - line++; 1638 - if (d == (u16 *) softback_end) 1639 - d = (u16 *) softback_buf; 1640 - if (d == (u16 *) softback_in) 1641 - d = (u16 *) vc->vc_origin; 1642 - if (s == (u16 *) softback_end) 1643 - s = (u16 *) softback_buf; 1644 - if (s == (u16 *) softback_in) 1645 - s = (u16 *) vc->vc_origin; 1646 - } 1647 1619 } 1648 1620 1649 1621 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, ··· 1692 1850 } 1693 1851 } 1694 1852 1695 - static inline void fbcon_softback_note(struct vc_data *vc, int t, 1696 - int count) 1697 - { 1698 - unsigned short *p; 1699 - 1700 - if (vc->vc_num != fg_console) 1701 - return; 1702 - p = (unsigned short *) (vc->vc_origin + t * vc->vc_size_row); 1703 - 1704 - while (count) { 1705 - scr_memcpyw((u16 *) softback_in, p, vc->vc_size_row); 1706 - count--; 1707 - p = advance_row(p, 1); 1708 - softback_in += vc->vc_size_row; 1709 - if (softback_in == softback_end) 1710 - softback_in = softback_buf; 1711 - if (softback_in == softback_top) { 1712 - softback_top += vc->vc_size_row; 1713 - if (softback_top == softback_end) 1714 - softback_top = softback_buf; 1715 - } 1716 - } 1717 - softback_curr = softback_in; 1718 - } 1719 - 1720 1853 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, 1721 1854 enum con_scroll dir, unsigned int count) 1722 1855 { ··· 1714 1897 case SM_UP: 1715 1898 if (count > vc->vc_rows) /* Maximum realistic size */ 1716 1899 count = vc->vc_rows; 1717 - if (softback_top) 1718 - fbcon_softback_note(vc, t, count); 1719 1900 if (logo_shown >= 0) 1720 1901 goto redraw_up; 1721 1902 switch (p->scrollmode) { ··· 2018 2203 struct fb_var_screeninfo var = info->var; 2019 2204 int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh; 2020 2205 2021 - if (ops->p && ops->p->userfont && FNTSIZE(vc->vc_font.data)) { 2206 + if (p->userfont && FNTSIZE(vc->vc_font.data)) { 2022 2207 int size; 2023 2208 int pitch = PITCH(vc->vc_font.width); 2024 2209 ··· 2083 2268 2084 2269 info = registered_fb[con2fb_map[vc->vc_num]]; 2085 2270 ops = info->fbcon_par; 2086 - 2087 - if (softback_top) { 2088 - if (softback_lines) 2089 - fbcon_set_origin(vc); 2090 - softback_top = softback_curr = softback_in = softback_buf; 2091 - softback_lines = 0; 2092 - fbcon_update_softback(vc); 2093 - } 2094 2271 2095 2272 if (logo_shown >= 0) { 2096 2273 struct vc_data *conp2 = vc_cons[logo_shown].d; ··· 2407 2600 int cnt; 2408 2601 char *old_data = NULL; 2409 2602 2410 - if (con_is_visible(vc) && softback_lines) 2411 - fbcon_set_origin(vc); 2412 - 2413 2603 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); 2414 2604 if (p->userfont) 2415 2605 old_data = vc->vc_font.data; ··· 2432 2628 cols /= w; 2433 2629 rows /= h; 2434 2630 vc_resize(vc, cols, rows); 2435 - if (con_is_visible(vc) && softback_buf) 2436 - fbcon_update_softback(vc); 2437 2631 } else if (con_is_visible(vc) 2438 2632 && vc->vc_mode == KD_TEXT) { 2439 2633 fbcon_clear_margins(vc, 0); ··· 2590 2788 2591 2789 static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) 2592 2790 { 2593 - unsigned long p; 2594 - int line; 2595 - 2596 - if (vc->vc_num != fg_console || !softback_lines) 2597 - return (u16 *) (vc->vc_origin + offset); 2598 - line = offset / vc->vc_size_row; 2599 - if (line >= softback_lines) 2600 - return (u16 *) (vc->vc_origin + offset - 2601 - softback_lines * vc->vc_size_row); 2602 - p = softback_curr + offset; 2603 - if (p >= softback_end) 2604 - p += softback_buf - softback_end; 2605 - return (u16 *) p; 2791 + return (u16 *) (vc->vc_origin + offset); 2606 2792 } 2607 2793 2608 2794 static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos, ··· 2604 2814 2605 2815 x = offset % vc->vc_cols; 2606 2816 y = offset / vc->vc_cols; 2607 - if (vc->vc_num == fg_console) 2608 - y += softback_lines; 2609 2817 ret = pos + (vc->vc_cols - x) * 2; 2610 - } else if (vc->vc_num == fg_console && softback_lines) { 2611 - unsigned long offset = pos - softback_curr; 2612 - 2613 - if (pos < softback_curr) 2614 - offset += softback_end - softback_buf; 2615 - offset /= 2; 2616 - x = offset % vc->vc_cols; 2617 - y = offset / vc->vc_cols; 2618 - ret = pos + (vc->vc_cols - x) * 2; 2619 - if (ret == softback_end) 2620 - ret = softback_buf; 2621 - if (ret == softback_in) 2622 - ret = vc->vc_origin; 2623 2818 } else { 2624 2819 /* Should not happen */ 2625 2820 x = y = 0; ··· 2632 2857 a = ((a) & 0x88ff) | (((a) & 0x7000) >> 4) | 2633 2858 (((a) & 0x0700) << 4); 2634 2859 scr_writew(a, p++); 2635 - if (p == (u16 *) softback_end) 2636 - p = (u16 *) softback_buf; 2637 - if (p == (u16 *) softback_in) 2638 - p = (u16 *) vc->vc_origin; 2639 2860 } 2640 - } 2641 - 2642 - static void fbcon_scrolldelta(struct vc_data *vc, int lines) 2643 - { 2644 - struct fb_info *info = registered_fb[con2fb_map[fg_console]]; 2645 - struct fbcon_ops *ops = info->fbcon_par; 2646 - struct fbcon_display *disp = &fb_display[fg_console]; 2647 - int offset, limit, scrollback_old; 2648 - 2649 - if (softback_top) { 2650 - if (vc->vc_num != fg_console) 2651 - return; 2652 - if (vc->vc_mode != KD_TEXT || !lines) 2653 - return; 2654 - if (logo_shown >= 0) { 2655 - struct vc_data *conp2 = vc_cons[logo_shown].d; 2656 - 2657 - if (conp2->vc_top == logo_lines 2658 - && conp2->vc_bottom == conp2->vc_rows) 2659 - conp2->vc_top = 0; 2660 - if (logo_shown == vc->vc_num) { 2661 - unsigned long p, q; 2662 - int i; 2663 - 2664 - p = softback_in; 2665 - q = vc->vc_origin + 2666 - logo_lines * vc->vc_size_row; 2667 - for (i = 0; i < logo_lines; i++) { 2668 - if (p == softback_top) 2669 - break; 2670 - if (p == softback_buf) 2671 - p = softback_end; 2672 - p -= vc->vc_size_row; 2673 - q -= vc->vc_size_row; 2674 - scr_memcpyw((u16 *) q, (u16 *) p, 2675 - vc->vc_size_row); 2676 - } 2677 - softback_in = softback_curr = p; 2678 - update_region(vc, vc->vc_origin, 2679 - logo_lines * vc->vc_cols); 2680 - } 2681 - logo_shown = FBCON_LOGO_CANSHOW; 2682 - } 2683 - fbcon_cursor(vc, CM_ERASE | CM_SOFTBACK); 2684 - fbcon_redraw_softback(vc, disp, lines); 2685 - fbcon_cursor(vc, CM_DRAW | CM_SOFTBACK); 2686 - return; 2687 - } 2688 - 2689 - if (!scrollback_phys_max) 2690 - return; 2691 - 2692 - scrollback_old = scrollback_current; 2693 - scrollback_current -= lines; 2694 - if (scrollback_current < 0) 2695 - scrollback_current = 0; 2696 - else if (scrollback_current > scrollback_max) 2697 - scrollback_current = scrollback_max; 2698 - if (scrollback_current == scrollback_old) 2699 - return; 2700 - 2701 - if (fbcon_is_inactive(vc, info)) 2702 - return; 2703 - 2704 - fbcon_cursor(vc, CM_ERASE); 2705 - 2706 - offset = disp->yscroll - scrollback_current; 2707 - limit = disp->vrows; 2708 - switch (disp->scrollmode) { 2709 - case SCROLL_WRAP_MOVE: 2710 - info->var.vmode |= FB_VMODE_YWRAP; 2711 - break; 2712 - case SCROLL_PAN_MOVE: 2713 - case SCROLL_PAN_REDRAW: 2714 - limit -= vc->vc_rows; 2715 - info->var.vmode &= ~FB_VMODE_YWRAP; 2716 - break; 2717 - } 2718 - if (offset < 0) 2719 - offset += limit; 2720 - else if (offset >= limit) 2721 - offset -= limit; 2722 - 2723 - ops->var.xoffset = 0; 2724 - ops->var.yoffset = offset * vc->vc_font.height; 2725 - ops->update_start(info); 2726 - 2727 - if (!scrollback_current) 2728 - fbcon_cursor(vc, CM_DRAW); 2729 2861 } 2730 2862 2731 2863 static int fbcon_set_origin(struct vc_data *vc) 2732 2864 { 2733 - if (softback_lines) 2734 - fbcon_scrolldelta(vc, softback_lines); 2735 2865 return 0; 2736 2866 } 2737 2867 ··· 2700 3020 2701 3021 fbcon_set_palette(vc, color_table); 2702 3022 update_screen(vc); 2703 - if (softback_buf) 2704 - fbcon_update_softback(vc); 2705 3023 } 2706 3024 } 2707 3025 ··· 3110 3432 .con_font_default = fbcon_set_def_font, 3111 3433 .con_font_copy = fbcon_copy_font, 3112 3434 .con_set_palette = fbcon_set_palette, 3113 - .con_scrolldelta = fbcon_scrolldelta, 3114 3435 .con_set_origin = fbcon_set_origin, 3115 3436 .con_invert_region = fbcon_invert_region, 3116 3437 .con_screen_pos = fbcon_screen_pos, ··· 3343 3666 deferred_takeover = false; 3344 3667 } 3345 3668 #endif 3346 - 3347 - kvfree((void *)softback_buf); 3348 - softback_buf = 0UL; 3349 3669 3350 3670 for_each_registered_fb(i) { 3351 3671 int pending = 0;
+1 -1
drivers/video/fbdev/core/fbcon.h
··· 62 62 void (*clear_margins)(struct vc_data *vc, struct fb_info *info, 63 63 int color, int bottom_only); 64 64 void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode, 65 - int softback_lines, int fg, int bg); 65 + int fg, int bg); 66 66 int (*update_start)(struct fb_info *info); 67 67 int (*rotate_font)(struct fb_info *info, struct vc_data *vc); 68 68 struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */
+1 -10
drivers/video/fbdev/core/fbcon_ccw.c
··· 219 219 } 220 220 221 221 static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode, 222 - int softback_lines, int fg, int bg) 222 + int fg, int bg) 223 223 { 224 224 struct fb_cursor cursor; 225 225 struct fbcon_ops *ops = info->fbcon_par; ··· 235 235 return; 236 236 237 237 cursor.set = 0; 238 - 239 - if (softback_lines) { 240 - if (y + softback_lines >= vc->vc_rows) { 241 - mode = CM_ERASE; 242 - ops->cursor_flash = 0; 243 - return; 244 - } else 245 - y += softback_lines; 246 - } 247 238 248 239 c = scr_readw((u16 *) vc->vc_pos); 249 240 attribute = get_attribute(info, c);
+1 -10
drivers/video/fbdev/core/fbcon_cw.c
··· 202 202 } 203 203 204 204 static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, 205 - int softback_lines, int fg, int bg) 205 + int fg, int bg) 206 206 { 207 207 struct fb_cursor cursor; 208 208 struct fbcon_ops *ops = info->fbcon_par; ··· 218 218 return; 219 219 220 220 cursor.set = 0; 221 - 222 - if (softback_lines) { 223 - if (y + softback_lines >= vc->vc_rows) { 224 - mode = CM_ERASE; 225 - ops->cursor_flash = 0; 226 - return; 227 - } else 228 - y += softback_lines; 229 - } 230 221 231 222 c = scr_readw((u16 *) vc->vc_pos); 232 223 attribute = get_attribute(info, c);
+1 -10
drivers/video/fbdev/core/fbcon_ud.c
··· 249 249 } 250 250 251 251 static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode, 252 - int softback_lines, int fg, int bg) 252 + int fg, int bg) 253 253 { 254 254 struct fb_cursor cursor; 255 255 struct fbcon_ops *ops = info->fbcon_par; ··· 266 266 return; 267 267 268 268 cursor.set = 0; 269 - 270 - if (softback_lines) { 271 - if (y + softback_lines >= vc->vc_rows) { 272 - mode = CM_ERASE; 273 - ops->cursor_flash = 0; 274 - return; 275 - } else 276 - y += softback_lines; 277 - } 278 269 279 270 c = scr_readw((u16 *) vc->vc_pos); 280 271 attribute = get_attribute(info, c);
+1 -1
drivers/video/fbdev/core/tileblit.c
··· 80 80 } 81 81 82 82 static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode, 83 - int softback_lines, int fg, int bg) 83 + int fg, int bg) 84 84 { 85 85 struct fb_tilecursor cursor; 86 86 int use_sw = vc->vc_cursor_type & CUR_SW;
+2 -1
fs/btrfs/ioctl.c
··· 2193 2193 key.offset = sk->min_offset; 2194 2194 2195 2195 while (1) { 2196 - ret = fault_in_pages_writeable(ubuf, *buf_size - sk_offset); 2196 + ret = fault_in_pages_writeable(ubuf + sk_offset, 2197 + *buf_size - sk_offset); 2197 2198 if (ret) 2198 2199 break; 2199 2200
+1 -1
fs/fs-writeback.c
··· 2184 2184 __initcall(start_dirtytime_writeback); 2185 2185 2186 2186 int dirtytime_interval_handler(struct ctl_table *table, int write, 2187 - void __user *buffer, size_t *lenp, loff_t *ppos) 2187 + void *buffer, size_t *lenp, loff_t *ppos) 2188 2188 { 2189 2189 int ret; 2190 2190
-1
include/linux/cpuhotplug.h
··· 142 142 /* Must be the last timer callback */ 143 143 CPUHP_AP_DUMMY_TIMER_STARTING, 144 144 CPUHP_AP_ARM_XEN_STARTING, 145 - CPUHP_AP_ARM_KVMPV_STARTING, 146 145 CPUHP_AP_ARM_CORESIGHT_STARTING, 147 146 CPUHP_AP_ARM_CORESIGHT_CTI_STARTING, 148 147 CPUHP_AP_ARM64_ISNDEP_STARTING,
+1
include/linux/cpuidle.h
··· 82 82 #define CPUIDLE_FLAG_UNUSABLE BIT(3) /* avoid using this state */ 83 83 #define CPUIDLE_FLAG_OFF BIT(4) /* disable this state by default */ 84 84 #define CPUIDLE_FLAG_TLB_FLUSHED BIT(5) /* idle-state flushes TLBs */ 85 + #define CPUIDLE_FLAG_RCU_IDLE BIT(6) /* idle-state takes care of RCU */ 85 86 86 87 struct cpuidle_device_kobj; 87 88 struct cpuidle_state_kobj;
+20 -2
include/linux/dax.h
··· 130 130 return __generic_fsdax_supported(dax_dev, bdev, blocksize, start, 131 131 sectors); 132 132 } 133 + bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, 134 + int blocksize, sector_t start, sector_t len); 133 135 134 136 static inline void fs_put_dax(struct dax_device *dax_dev) 135 137 { ··· 155 153 static inline bool generic_fsdax_supported(struct dax_device *dax_dev, 156 154 struct block_device *bdev, int blocksize, sector_t start, 157 155 sector_t sectors) 156 + { 157 + return false; 158 + } 159 + 160 + static inline bool dax_supported(struct dax_device *dax_dev, 161 + struct block_device *bdev, int blocksize, sector_t start, 162 + sector_t len) 158 163 { 159 164 return false; 160 165 } ··· 198 189 } 199 190 #endif 200 191 192 + #if IS_ENABLED(CONFIG_DAX) 201 193 int dax_read_lock(void); 202 194 void dax_read_unlock(int id); 195 + #else 196 + static inline int dax_read_lock(void) 197 + { 198 + return 0; 199 + } 200 + 201 + static inline void dax_read_unlock(int id) 202 + { 203 + } 204 + #endif /* CONFIG_DAX */ 203 205 bool dax_alive(struct dax_device *dax_dev); 204 206 void *dax_get_private(struct dax_device *dax_dev); 205 207 long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages, 206 208 void **kaddr, pfn_t *pfn); 207 - bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, 208 - int blocksize, sector_t start, sector_t len); 209 209 size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, 210 210 size_t bytes, struct iov_iter *i); 211 211 size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
+1 -2
include/linux/ftrace.h
··· 85 85 extern int ftrace_enabled; 86 86 extern int 87 87 ftrace_enable_sysctl(struct ctl_table *table, int write, 88 - void __user *buffer, size_t *lenp, 89 - loff_t *ppos); 88 + void *buffer, size_t *lenp, loff_t *ppos); 90 89 91 90 struct ftrace_ops; 92 91
+2
include/linux/mm.h
··· 41 41 struct bdi_writeback; 42 42 struct pt_regs; 43 43 44 + extern int sysctl_page_lock_unfairness; 45 + 44 46 void init_mm_internals(void); 45 47 46 48 #ifndef CONFIG_NEED_MULTIPLE_NODES /* Don't use mapnrs, do it properly */
+4 -4
include/linux/percpu-rwsem.h
··· 60 60 * anything we did within this RCU-sched read-size critical section. 61 61 */ 62 62 if (likely(rcu_sync_is_idle(&sem->rss))) 63 - __this_cpu_inc(*sem->read_count); 63 + this_cpu_inc(*sem->read_count); 64 64 else 65 65 __percpu_down_read(sem, false); /* Unconditional memory barrier */ 66 66 /* ··· 79 79 * Same as in percpu_down_read(). 80 80 */ 81 81 if (likely(rcu_sync_is_idle(&sem->rss))) 82 - __this_cpu_inc(*sem->read_count); 82 + this_cpu_inc(*sem->read_count); 83 83 else 84 84 ret = __percpu_down_read(sem, true); /* Unconditional memory barrier */ 85 85 preempt_enable(); ··· 103 103 * Same as in percpu_down_read(). 104 104 */ 105 105 if (likely(rcu_sync_is_idle(&sem->rss))) { 106 - __this_cpu_dec(*sem->read_count); 106 + this_cpu_dec(*sem->read_count); 107 107 } else { 108 108 /* 109 109 * slowpath; reader will only ever wake a single blocked ··· 115 115 * aggregate zero, as that is the only time it matters) they 116 116 * will also see our critical section. 117 117 */ 118 - __this_cpu_dec(*sem->read_count); 118 + this_cpu_dec(*sem->read_count); 119 119 rcuwait_wake_up(&sem->writer); 120 120 } 121 121 preempt_enable();
+1
include/linux/serial_core.h
··· 248 248 249 249 unsigned char hub6; /* this should be in the 8250 driver */ 250 250 unsigned char suspended; 251 + unsigned char console_reinit; 251 252 const char *name; /* port name */ 252 253 struct attribute_group *attr_group; /* port specific attributes */ 253 254 const struct attribute_group **tty_groups; /* all attributes (serial core use only) */
+1 -1
include/linux/stackleak.h
··· 25 25 26 26 #ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE 27 27 int stack_erasing_sysctl(struct ctl_table *table, int write, 28 - void __user *buffer, size_t *lenp, loff_t *ppos); 28 + void *buffer, size_t *lenp, loff_t *ppos); 29 29 #endif 30 30 31 31 #else /* !CONFIG_GCC_PLUGIN_STACKLEAK */
+1
include/linux/wait.h
··· 21 21 #define WQ_FLAG_WOKEN 0x02 22 22 #define WQ_FLAG_BOOKMARK 0x04 23 23 #define WQ_FLAG_CUSTOM 0x08 24 + #define WQ_FLAG_DONE 0x10 24 25 25 26 /* 26 27 * A single wait-queue entry structure:
+4
include/sound/soc.h
··· 1193 1193 ((i) < (rtd)->num_cpus + (rtd)->num_codecs) && \ 1194 1194 ((dai) = (rtd)->dais[i]); \ 1195 1195 (i)++) 1196 + #define for_each_rtd_dais_rollback(rtd, i, dai) \ 1197 + for (; (--(i) >= 0) && ((dai) = (rtd)->dais[i]);) 1196 1198 1197 1199 void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd); 1198 1200 ··· 1362 1360 void snd_soc_unregister_dai(struct snd_soc_dai *dai); 1363 1361 1364 1362 struct snd_soc_dai *snd_soc_find_dai( 1363 + const struct snd_soc_dai_link_component *dlc); 1364 + struct snd_soc_dai *snd_soc_find_dai_with_mutex( 1365 1365 const struct snd_soc_dai_link_component *dlc); 1366 1366 1367 1367 #include <sound/soc-dai.h>
+4 -2
kernel/entry/common.c
··· 60 60 return ret; 61 61 } 62 62 63 + /* Either of the above might have changed the syscall number */ 64 + syscall = syscall_get_nr(current, regs); 65 + 63 66 if (unlikely(ti_work & _TIF_SYSCALL_TRACEPOINT)) 64 67 trace_sys_enter(regs, syscall); 65 68 66 69 syscall_enter_audit(regs, syscall); 67 70 68 - /* The above might have changed the syscall number */ 69 - return ret ? : syscall_get_nr(current, regs); 71 + return ret ? : syscall; 70 72 } 71 73 72 74 static __always_inline long
+8 -1
kernel/kprobes.c
··· 2140 2140 2141 2141 lockdep_assert_held(&kprobe_mutex); 2142 2142 2143 + if (WARN_ON_ONCE(kprobe_gone(p))) 2144 + return; 2145 + 2143 2146 p->flags |= KPROBE_FLAG_GONE; 2144 2147 if (kprobe_aggrprobe(p)) { 2145 2148 /* ··· 2422 2419 mutex_lock(&kprobe_mutex); 2423 2420 for (i = 0; i < KPROBE_TABLE_SIZE; i++) { 2424 2421 head = &kprobe_table[i]; 2425 - hlist_for_each_entry(p, head, hlist) 2422 + hlist_for_each_entry(p, head, hlist) { 2423 + if (kprobe_gone(p)) 2424 + continue; 2425 + 2426 2426 if (within_module_init((unsigned long)p->addr, mod) || 2427 2427 (checkcore && 2428 2428 within_module_core((unsigned long)p->addr, mod))) { ··· 2442 2436 */ 2443 2437 kill_kprobe(p); 2444 2438 } 2439 + } 2445 2440 } 2446 2441 if (val == MODULE_STATE_GOING) 2447 2442 remove_module_kprobe_blacklist(mod);
+29 -6
kernel/locking/lockdep.c
··· 3969 3969 static int mark_lock(struct task_struct *curr, struct held_lock *this, 3970 3970 enum lock_usage_bit new_bit) 3971 3971 { 3972 - unsigned int new_mask = 1 << new_bit, ret = 1; 3972 + unsigned int old_mask, new_mask, ret = 1; 3973 3973 3974 3974 if (new_bit >= LOCK_USAGE_STATES) { 3975 3975 DEBUG_LOCKS_WARN_ON(1); 3976 3976 return 0; 3977 3977 } 3978 + 3979 + if (new_bit == LOCK_USED && this->read) 3980 + new_bit = LOCK_USED_READ; 3981 + 3982 + new_mask = 1 << new_bit; 3978 3983 3979 3984 /* 3980 3985 * If already set then do not dirty the cacheline, ··· 3993 3988 /* 3994 3989 * Make sure we didn't race: 3995 3990 */ 3996 - if (unlikely(hlock_class(this)->usage_mask & new_mask)) { 3997 - graph_unlock(); 3998 - return 1; 3999 - } 3991 + if (unlikely(hlock_class(this)->usage_mask & new_mask)) 3992 + goto unlock; 4000 3993 3994 + old_mask = hlock_class(this)->usage_mask; 4001 3995 hlock_class(this)->usage_mask |= new_mask; 3996 + 3997 + /* 3998 + * Save one usage_traces[] entry and map both LOCK_USED and 3999 + * LOCK_USED_READ onto the same entry. 4000 + */ 4001 + if (new_bit == LOCK_USED || new_bit == LOCK_USED_READ) { 4002 + if (old_mask & (LOCKF_USED | LOCKF_USED_READ)) 4003 + goto unlock; 4004 + new_bit = LOCK_USED; 4005 + } 4002 4006 4003 4007 if (!(hlock_class(this)->usage_traces[new_bit] = save_trace())) 4004 4008 return 0; ··· 4022 4008 return 0; 4023 4009 } 4024 4010 4011 + unlock: 4025 4012 graph_unlock(); 4026 4013 4027 4014 /* ··· 4957 4942 { 4958 4943 #ifdef CONFIG_PROVE_LOCKING 4959 4944 struct lock_class *class = look_up_lock_class(lock, subclass); 4945 + unsigned long mask = LOCKF_USED; 4960 4946 4961 4947 /* if it doesn't have a class (yet), it certainly hasn't been used yet */ 4962 4948 if (!class) 4963 4949 return; 4964 4950 4965 - if (!(class->usage_mask & LOCK_USED)) 4951 + /* 4952 + * READ locks only conflict with USED, such that if we only ever use 4953 + * READ locks, there is no deadlock possible -- RCU. 4954 + */ 4955 + if (!hlock->read) 4956 + mask |= LOCKF_USED_READ; 4957 + 4958 + if (!(class->usage_mask & mask)) 4966 4959 return; 4967 4960 4968 4961 hlock->class_idx = class - lock_classes;
+2
kernel/locking/lockdep_internals.h
··· 19 19 #include "lockdep_states.h" 20 20 #undef LOCKDEP_STATE 21 21 LOCK_USED, 22 + LOCK_USED_READ, 22 23 LOCK_USAGE_STATES 23 24 }; 24 25 ··· 41 40 #include "lockdep_states.h" 42 41 #undef LOCKDEP_STATE 43 42 __LOCKF(USED) 43 + __LOCKF(USED_READ) 44 44 }; 45 45 46 46 #define LOCKDEP_STATE(__STATE) LOCKF_ENABLED_##__STATE |
+2 -2
kernel/locking/percpu-rwsem.c
··· 45 45 46 46 static bool __percpu_down_read_trylock(struct percpu_rw_semaphore *sem) 47 47 { 48 - __this_cpu_inc(*sem->read_count); 48 + this_cpu_inc(*sem->read_count); 49 49 50 50 /* 51 51 * Due to having preemption disabled the decrement happens on ··· 71 71 if (likely(!atomic_read_acquire(&sem->block))) 72 72 return true; 73 73 74 - __this_cpu_dec(*sem->read_count); 74 + this_cpu_dec(*sem->read_count); 75 75 76 76 /* Prod writer to re-evaluate readers_active_check() */ 77 77 rcuwait_wake_up(&sem->writer);
+1 -1
kernel/stackleak.c
··· 20 20 static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass); 21 21 22 22 int stack_erasing_sysctl(struct ctl_table *table, int write, 23 - void __user *buffer, size_t *lenp, loff_t *ppos) 23 + void *buffer, size_t *lenp, loff_t *ppos) 24 24 { 25 25 int ret = 0; 26 26 int state = !static_branch_unlikely(&stack_erasing_bypass);
+8
kernel/sysctl.c
··· 2912 2912 .proc_handler = percpu_pagelist_fraction_sysctl_handler, 2913 2913 .extra1 = SYSCTL_ZERO, 2914 2914 }, 2915 + { 2916 + .procname = "page_lock_unfairness", 2917 + .data = &sysctl_page_lock_unfairness, 2918 + .maxlen = sizeof(sysctl_page_lock_unfairness), 2919 + .mode = 0644, 2920 + .proc_handler = proc_dointvec_minmax, 2921 + .extra1 = SYSCTL_ZERO, 2922 + }, 2915 2923 #ifdef CONFIG_MMU 2916 2924 { 2917 2925 .procname = "max_map_count",
+1 -2
kernel/trace/ftrace.c
··· 7531 7531 7532 7532 int 7533 7533 ftrace_enable_sysctl(struct ctl_table *table, int write, 7534 - void __user *buffer, size_t *lenp, 7535 - loff_t *ppos) 7534 + void *buffer, size_t *lenp, loff_t *ppos) 7536 7535 { 7537 7536 int ret = -ENODEV; 7538 7537
+2 -2
kernel/trace/trace_preemptirq.c
··· 102 102 103 103 __visible void trace_hardirqs_off_caller(unsigned long caller_addr) 104 104 { 105 + lockdep_hardirqs_off(CALLER_ADDR0); 106 + 105 107 if (!this_cpu_read(tracing_irq_cpu)) { 106 108 this_cpu_write(tracing_irq_cpu, 1); 107 109 tracer_hardirqs_off(CALLER_ADDR0, caller_addr); 108 110 if (!in_nmi()) 109 111 trace_irq_disable_rcuidle(CALLER_ADDR0, caller_addr); 110 112 } 111 - 112 - lockdep_hardirqs_off(CALLER_ADDR0); 113 113 } 114 114 EXPORT_SYMBOL(trace_hardirqs_off_caller); 115 115 NOKPROBE_SYMBOL(trace_hardirqs_off_caller);
+1 -3
lib/Kconfig.debug
··· 520 520 endchoice 521 521 522 522 source "lib/Kconfig.kgdb" 523 - 524 523 source "lib/Kconfig.ubsan" 524 + source "lib/Kconfig.kcsan" 525 525 526 526 endmenu 527 527 ··· 1619 1619 See Documentation/core-api/debugging-via-ohci1394.rst for more information. 1620 1620 1621 1621 source "samples/Kconfig" 1622 - 1623 - source "lib/Kconfig.kcsan" 1624 1622 1625 1623 config ARCH_HAS_DEVMEM_IS_ALLOWED 1626 1624 bool
+129 -31
mm/filemap.c
··· 988 988 page_writeback_init(); 989 989 } 990 990 991 + /* 992 + * The page wait code treats the "wait->flags" somewhat unusually, because 993 + * we have multiple different kinds of waits, not just the usual "exclusive" 994 + * one. 995 + * 996 + * We have: 997 + * 998 + * (a) no special bits set: 999 + * 1000 + * We're just waiting for the bit to be released, and when a waker 1001 + * calls the wakeup function, we set WQ_FLAG_WOKEN and wake it up, 1002 + * and remove it from the wait queue. 1003 + * 1004 + * Simple and straightforward. 1005 + * 1006 + * (b) WQ_FLAG_EXCLUSIVE: 1007 + * 1008 + * The waiter is waiting to get the lock, and only one waiter should 1009 + * be woken up to avoid any thundering herd behavior. We'll set the 1010 + * WQ_FLAG_WOKEN bit, wake it up, and remove it from the wait queue. 1011 + * 1012 + * This is the traditional exclusive wait. 1013 + * 1014 + * (c) WQ_FLAG_EXCLUSIVE | WQ_FLAG_CUSTOM: 1015 + * 1016 + * The waiter is waiting to get the bit, and additionally wants the 1017 + * lock to be transferred to it for fair lock behavior. If the lock 1018 + * cannot be taken, we stop walking the wait queue without waking 1019 + * the waiter. 1020 + * 1021 + * This is the "fair lock handoff" case, and in addition to setting 1022 + * WQ_FLAG_WOKEN, we set WQ_FLAG_DONE to let the waiter easily see 1023 + * that it now has the lock. 1024 + */ 991 1025 static int wake_page_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *arg) 992 1026 { 993 - int ret; 1027 + unsigned int flags; 994 1028 struct wait_page_key *key = arg; 995 1029 struct wait_page_queue *wait_page 996 1030 = container_of(wait, struct wait_page_queue, wait); ··· 1033 999 return 0; 1034 1000 1035 1001 /* 1036 - * If it's an exclusive wait, we get the bit for it, and 1037 - * stop walking if we can't. 1038 - * 1039 - * If it's a non-exclusive wait, then the fact that this 1040 - * wake function was called means that the bit already 1041 - * was cleared, and we don't care if somebody then 1042 - * re-took it. 1002 + * If it's a lock handoff wait, we get the bit for it, and 1003 + * stop walking (and do not wake it up) if we can't. 1043 1004 */ 1044 - ret = 0; 1045 - if (wait->flags & WQ_FLAG_EXCLUSIVE) { 1046 - if (test_and_set_bit(key->bit_nr, &key->page->flags)) 1005 + flags = wait->flags; 1006 + if (flags & WQ_FLAG_EXCLUSIVE) { 1007 + if (test_bit(key->bit_nr, &key->page->flags)) 1047 1008 return -1; 1048 - ret = 1; 1009 + if (flags & WQ_FLAG_CUSTOM) { 1010 + if (test_and_set_bit(key->bit_nr, &key->page->flags)) 1011 + return -1; 1012 + flags |= WQ_FLAG_DONE; 1013 + } 1049 1014 } 1050 - wait->flags |= WQ_FLAG_WOKEN; 1051 1015 1016 + /* 1017 + * We are holding the wait-queue lock, but the waiter that 1018 + * is waiting for this will be checking the flags without 1019 + * any locking. 1020 + * 1021 + * So update the flags atomically, and wake up the waiter 1022 + * afterwards to avoid any races. This store-release pairs 1023 + * with the load-acquire in wait_on_page_bit_common(). 1024 + */ 1025 + smp_store_release(&wait->flags, flags | WQ_FLAG_WOKEN); 1052 1026 wake_up_state(wait->private, mode); 1053 1027 1054 1028 /* 1055 1029 * Ok, we have successfully done what we're waiting for, 1056 1030 * and we can unconditionally remove the wait entry. 1057 1031 * 1058 - * Note that this has to be the absolute last thing we do, 1059 - * since after list_del_init(&wait->entry) the wait entry 1032 + * Note that this pairs with the "finish_wait()" in the 1033 + * waiter, and has to be the absolute last thing we do. 1034 + * After this list_del_init(&wait->entry) the wait entry 1060 1035 * might be de-allocated and the process might even have 1061 1036 * exited. 1062 1037 */ 1063 1038 list_del_init_careful(&wait->entry); 1064 - return ret; 1039 + return (flags & WQ_FLAG_EXCLUSIVE) != 0; 1065 1040 } 1066 1041 1067 1042 static void wake_up_page_bit(struct page *page, int bit_nr) ··· 1150 1107 }; 1151 1108 1152 1109 /* 1153 - * Attempt to check (or get) the page bit, and mark the 1154 - * waiter woken if successful. 1110 + * Attempt to check (or get) the page bit, and mark us done 1111 + * if successful. 1155 1112 */ 1156 1113 static inline bool trylock_page_bit_common(struct page *page, int bit_nr, 1157 1114 struct wait_queue_entry *wait) ··· 1162 1119 } else if (test_bit(bit_nr, &page->flags)) 1163 1120 return false; 1164 1121 1165 - wait->flags |= WQ_FLAG_WOKEN; 1122 + wait->flags |= WQ_FLAG_WOKEN | WQ_FLAG_DONE; 1166 1123 return true; 1167 1124 } 1125 + 1126 + /* How many times do we accept lock stealing from under a waiter? */ 1127 + int sysctl_page_lock_unfairness = 5; 1168 1128 1169 1129 static inline int wait_on_page_bit_common(wait_queue_head_t *q, 1170 1130 struct page *page, int bit_nr, int state, enum behavior behavior) 1171 1131 { 1132 + int unfairness = sysctl_page_lock_unfairness; 1172 1133 struct wait_page_queue wait_page; 1173 1134 wait_queue_entry_t *wait = &wait_page.wait; 1174 1135 bool thrashing = false; ··· 1190 1143 } 1191 1144 1192 1145 init_wait(wait); 1193 - wait->flags = behavior == EXCLUSIVE ? WQ_FLAG_EXCLUSIVE : 0; 1194 1146 wait->func = wake_page_function; 1195 1147 wait_page.page = page; 1196 1148 wait_page.bit_nr = bit_nr; 1149 + 1150 + repeat: 1151 + wait->flags = 0; 1152 + if (behavior == EXCLUSIVE) { 1153 + wait->flags = WQ_FLAG_EXCLUSIVE; 1154 + if (--unfairness < 0) 1155 + wait->flags |= WQ_FLAG_CUSTOM; 1156 + } 1197 1157 1198 1158 /* 1199 1159 * Do one last check whether we can get the ··· 1224 1170 1225 1171 /* 1226 1172 * From now on, all the logic will be based on 1227 - * the WQ_FLAG_WOKEN flag, and the and the page 1228 - * bit testing (and setting) will be - or has 1229 - * already been - done by the wake function. 1173 + * the WQ_FLAG_WOKEN and WQ_FLAG_DONE flag, to 1174 + * see whether the page bit testing has already 1175 + * been done by the wake function. 1230 1176 * 1231 1177 * We can drop our reference to the page. 1232 1178 */ 1233 1179 if (behavior == DROP) 1234 1180 put_page(page); 1235 1181 1182 + /* 1183 + * Note that until the "finish_wait()", or until 1184 + * we see the WQ_FLAG_WOKEN flag, we need to 1185 + * be very careful with the 'wait->flags', because 1186 + * we may race with a waker that sets them. 1187 + */ 1236 1188 for (;;) { 1189 + unsigned int flags; 1190 + 1237 1191 set_current_state(state); 1238 1192 1239 - if (signal_pending_state(state, current)) 1193 + /* Loop until we've been woken or interrupted */ 1194 + flags = smp_load_acquire(&wait->flags); 1195 + if (!(flags & WQ_FLAG_WOKEN)) { 1196 + if (signal_pending_state(state, current)) 1197 + break; 1198 + 1199 + io_schedule(); 1200 + continue; 1201 + } 1202 + 1203 + /* If we were non-exclusive, we're done */ 1204 + if (behavior != EXCLUSIVE) 1240 1205 break; 1241 1206 1242 - if (wait->flags & WQ_FLAG_WOKEN) 1207 + /* If the waker got the lock for us, we're done */ 1208 + if (flags & WQ_FLAG_DONE) 1243 1209 break; 1244 1210 1245 - io_schedule(); 1211 + /* 1212 + * Otherwise, if we're getting the lock, we need to 1213 + * try to get it ourselves. 1214 + * 1215 + * And if that fails, we'll have to retry this all. 1216 + */ 1217 + if (unlikely(test_and_set_bit(bit_nr, &page->flags))) 1218 + goto repeat; 1219 + 1220 + wait->flags |= WQ_FLAG_DONE; 1221 + break; 1246 1222 } 1247 1223 1224 + /* 1225 + * If a signal happened, this 'finish_wait()' may remove the last 1226 + * waiter from the wait-queues, but the PageWaiters bit will remain 1227 + * set. That's ok. The next wakeup will take care of it, and trying 1228 + * to do it here would be difficult and prone to races. 1229 + */ 1248 1230 finish_wait(q, wait); 1249 1231 1250 1232 if (thrashing) { ··· 1290 1200 } 1291 1201 1292 1202 /* 1293 - * A signal could leave PageWaiters set. Clearing it here if 1294 - * !waitqueue_active would be possible (by open-coding finish_wait), 1295 - * but still fail to catch it in the case of wait hash collision. We 1296 - * already can fail to clear wait hash collision cases, so don't 1297 - * bother with signals either. 1203 + * NOTE! The wait->flags weren't stable until we've done the 1204 + * 'finish_wait()', and we could have exited the loop above due 1205 + * to a signal, and had a wakeup event happen after the signal 1206 + * test but before the 'finish_wait()'. 1207 + * 1208 + * So only after the finish_wait() can we reliably determine 1209 + * if we got woken up or not, so we can now figure out the final 1210 + * return value based on that state without races. 1211 + * 1212 + * Also note that WQ_FLAG_WOKEN is sufficient for a non-exclusive 1213 + * waiter, but an exclusive one requires WQ_FLAG_DONE. 1298 1214 */ 1215 + if (behavior == EXCLUSIVE) 1216 + return wait->flags & WQ_FLAG_DONE ? 0 : -EINTR; 1299 1217 1300 1218 return wait->flags & WQ_FLAG_WOKEN ? 0 : -EINTR; 1301 1219 }
+23 -19
mm/huge_memory.c
··· 2022 2022 put_page(page); 2023 2023 add_mm_counter(mm, mm_counter_file(page), -HPAGE_PMD_NR); 2024 2024 return; 2025 - } else if (is_huge_zero_pmd(*pmd)) { 2025 + } else if (pmd_trans_huge(*pmd) && is_huge_zero_pmd(*pmd)) { 2026 2026 /* 2027 2027 * FIXME: Do we want to invalidate secondary mmu by calling 2028 2028 * mmu_notifier_invalidate_range() see comments below inside ··· 2116 2116 pte = pte_offset_map(&_pmd, addr); 2117 2117 BUG_ON(!pte_none(*pte)); 2118 2118 set_pte_at(mm, addr, pte, entry); 2119 - atomic_inc(&page[i]._mapcount); 2119 + if (!pmd_migration) 2120 + atomic_inc(&page[i]._mapcount); 2120 2121 pte_unmap(pte); 2121 2122 } 2122 2123 2123 - /* 2124 - * Set PG_double_map before dropping compound_mapcount to avoid 2125 - * false-negative page_mapped(). 2126 - */ 2127 - if (compound_mapcount(page) > 1 && !TestSetPageDoubleMap(page)) { 2128 - for (i = 0; i < HPAGE_PMD_NR; i++) 2129 - atomic_inc(&page[i]._mapcount); 2130 - } 2131 - 2132 - lock_page_memcg(page); 2133 - if (atomic_add_negative(-1, compound_mapcount_ptr(page))) { 2134 - /* Last compound_mapcount is gone. */ 2135 - __dec_lruvec_page_state(page, NR_ANON_THPS); 2136 - if (TestClearPageDoubleMap(page)) { 2137 - /* No need in mapcount reference anymore */ 2124 + if (!pmd_migration) { 2125 + /* 2126 + * Set PG_double_map before dropping compound_mapcount to avoid 2127 + * false-negative page_mapped(). 2128 + */ 2129 + if (compound_mapcount(page) > 1 && 2130 + !TestSetPageDoubleMap(page)) { 2138 2131 for (i = 0; i < HPAGE_PMD_NR; i++) 2139 - atomic_dec(&page[i]._mapcount); 2132 + atomic_inc(&page[i]._mapcount); 2140 2133 } 2134 + 2135 + lock_page_memcg(page); 2136 + if (atomic_add_negative(-1, compound_mapcount_ptr(page))) { 2137 + /* Last compound_mapcount is gone. */ 2138 + __dec_lruvec_page_state(page, NR_ANON_THPS); 2139 + if (TestClearPageDoubleMap(page)) { 2140 + /* No need in mapcount reference anymore */ 2141 + for (i = 0; i < HPAGE_PMD_NR; i++) 2142 + atomic_dec(&page[i]._mapcount); 2143 + } 2144 + } 2145 + unlock_page_memcg(page); 2141 2146 } 2142 - unlock_page_memcg(page); 2143 2147 2144 2148 smp_wmb(); /* make pte visible before pmd */ 2145 2149 pmd_populate(mm, pmd, pgtable);
+4
mm/ksm.c
··· 2586 2586 return page; /* let do_swap_page report the error */ 2587 2587 2588 2588 new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address); 2589 + if (new_page && mem_cgroup_charge(new_page, vma->vm_mm, GFP_KERNEL)) { 2590 + put_page(new_page); 2591 + new_page = NULL; 2592 + } 2589 2593 if (new_page) { 2590 2594 copy_user_highpage(new_page, page, address, vma); 2591 2595
+14
mm/memory_hotplug.c
··· 1575 1575 /* check again */ 1576 1576 ret = walk_system_ram_range(start_pfn, end_pfn - start_pfn, 1577 1577 NULL, check_pages_isolated_cb); 1578 + /* 1579 + * per-cpu pages are drained in start_isolate_page_range, but if 1580 + * there are still pages that are not free, make sure that we 1581 + * drain again, because when we isolated range we might 1582 + * have raced with another thread that was adding pages to pcp 1583 + * list. 1584 + * 1585 + * Forward progress should be still guaranteed because 1586 + * pages on the pcp list can only belong to MOVABLE_ZONE 1587 + * because has_unmovable_pages explicitly checks for 1588 + * PageBuddy on freed pages on other zones. 1589 + */ 1590 + if (ret) 1591 + drain_all_pages(zone); 1578 1592 } while (ret); 1579 1593 1580 1594 /* Ok, all of our target is isolated.
+2 -1
mm/migrate.c
··· 668 668 669 669 copy_page_owner(page, newpage); 670 670 671 - mem_cgroup_migrate(page, newpage); 671 + if (!PageHuge(page)) 672 + mem_cgroup_migrate(page, newpage); 672 673 } 673 674 EXPORT_SYMBOL(migrate_page_states); 674 675
+15 -9
mm/mlock.c
··· 58 58 */ 59 59 void clear_page_mlock(struct page *page) 60 60 { 61 + int nr_pages; 62 + 61 63 if (!TestClearPageMlocked(page)) 62 64 return; 63 65 64 - mod_zone_page_state(page_zone(page), NR_MLOCK, -thp_nr_pages(page)); 65 - count_vm_event(UNEVICTABLE_PGCLEARED); 66 + nr_pages = thp_nr_pages(page); 67 + mod_zone_page_state(page_zone(page), NR_MLOCK, -nr_pages); 68 + count_vm_events(UNEVICTABLE_PGCLEARED, nr_pages); 66 69 /* 67 70 * The previous TestClearPageMlocked() corresponds to the smp_mb() 68 71 * in __pagevec_lru_add_fn(). ··· 79 76 * We lost the race. the page already moved to evictable list. 80 77 */ 81 78 if (PageUnevictable(page)) 82 - count_vm_event(UNEVICTABLE_PGSTRANDED); 79 + count_vm_events(UNEVICTABLE_PGSTRANDED, nr_pages); 83 80 } 84 81 } 85 82 ··· 96 93 VM_BUG_ON_PAGE(PageCompound(page) && PageDoubleMap(page), page); 97 94 98 95 if (!TestSetPageMlocked(page)) { 99 - mod_zone_page_state(page_zone(page), NR_MLOCK, 100 - thp_nr_pages(page)); 101 - count_vm_event(UNEVICTABLE_PGMLOCKED); 96 + int nr_pages = thp_nr_pages(page); 97 + 98 + mod_zone_page_state(page_zone(page), NR_MLOCK, nr_pages); 99 + count_vm_events(UNEVICTABLE_PGMLOCKED, nr_pages); 102 100 if (!isolate_lru_page(page)) 103 101 putback_lru_page(page); 104 102 } ··· 142 138 143 139 /* Did try_to_unlock() succeed or punt? */ 144 140 if (!PageMlocked(page)) 145 - count_vm_event(UNEVICTABLE_PGMUNLOCKED); 141 + count_vm_events(UNEVICTABLE_PGMUNLOCKED, thp_nr_pages(page)); 146 142 147 143 putback_lru_page(page); 148 144 } ··· 158 154 */ 159 155 static void __munlock_isolation_failed(struct page *page) 160 156 { 157 + int nr_pages = thp_nr_pages(page); 158 + 161 159 if (PageUnevictable(page)) 162 - __count_vm_event(UNEVICTABLE_PGSTRANDED); 160 + __count_vm_events(UNEVICTABLE_PGSTRANDED, nr_pages); 163 161 else 164 - __count_vm_event(UNEVICTABLE_PGMUNLOCKED); 162 + __count_vm_events(UNEVICTABLE_PGMUNLOCKED, nr_pages); 165 163 } 166 164 167 165 /**
+8
mm/page_isolation.c
··· 170 170 * pageblocks we may have modified and return -EBUSY to caller. This 171 171 * prevents two threads from simultaneously working on overlapping ranges. 172 172 * 173 + * Please note that there is no strong synchronization with the page allocator 174 + * either. Pages might be freed while their page blocks are marked ISOLATED. 175 + * In some cases pages might still end up on pcp lists and that would allow 176 + * for their allocation even when they are in fact isolated already. Depending 177 + * on how strong of a guarantee the caller needs drain_all_pages might be needed 178 + * (e.g. __offline_pages will need to call it after check for isolated range for 179 + * a next retry). 180 + * 173 181 * Return: the number of isolated pageblocks on success and -EBUSY if any part 174 182 * of range cannot be isolated. 175 183 */
+1 -1
mm/percpu.c
··· 1316 1316 1317 1317 /* allocate chunk */ 1318 1318 alloc_size = sizeof(struct pcpu_chunk) + 1319 - BITS_TO_LONGS(region_size >> PAGE_SHIFT); 1319 + BITS_TO_LONGS(region_size >> PAGE_SHIFT) * sizeof(unsigned long); 1320 1320 chunk = memblock_alloc(alloc_size, SMP_CACHE_BYTES); 1321 1321 if (!chunk) 1322 1322 panic("%s: Failed to allocate %zu bytes\n", __func__,
+6 -4
mm/shmem.c
··· 279 279 280 280 if (!(sb->s_flags & SB_KERNMOUNT)) { 281 281 spin_lock(&sbinfo->stat_lock); 282 - if (!sbinfo->free_inodes) { 283 - spin_unlock(&sbinfo->stat_lock); 284 - return -ENOSPC; 282 + if (sbinfo->max_inodes) { 283 + if (!sbinfo->free_inodes) { 284 + spin_unlock(&sbinfo->stat_lock); 285 + return -ENOSPC; 286 + } 287 + sbinfo->free_inodes--; 285 288 } 286 - sbinfo->free_inodes--; 287 289 if (inop) { 288 290 ino = sbinfo->next_ino++; 289 291 if (unlikely(is_zero_ino(ino)))
+3 -3
mm/swap.c
··· 494 494 495 495 unevictable = (vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) == VM_LOCKED; 496 496 if (unlikely(unevictable) && !TestSetPageMlocked(page)) { 497 + int nr_pages = thp_nr_pages(page); 497 498 /* 498 499 * We use the irq-unsafe __mod_zone_page_stat because this 499 500 * counter is not modified from interrupt context, and the pte 500 501 * lock is held(spinlock), which implies preemption disabled. 501 502 */ 502 - __mod_zone_page_state(page_zone(page), NR_MLOCK, 503 - thp_nr_pages(page)); 504 - count_vm_event(UNEVICTABLE_PGMLOCKED); 503 + __mod_zone_page_state(page_zone(page), NR_MLOCK, nr_pages); 504 + count_vm_events(UNEVICTABLE_PGMLOCKED, nr_pages); 505 505 } 506 506 lru_cache_add(page); 507 507 }
+8 -2
mm/vmscan.c
··· 4268 4268 for (i = 0; i < pvec->nr; i++) { 4269 4269 struct page *page = pvec->pages[i]; 4270 4270 struct pglist_data *pagepgdat = page_pgdat(page); 4271 + int nr_pages; 4271 4272 4272 - pgscanned++; 4273 + if (PageTransTail(page)) 4274 + continue; 4275 + 4276 + nr_pages = thp_nr_pages(page); 4277 + pgscanned += nr_pages; 4278 + 4273 4279 if (pagepgdat != pgdat) { 4274 4280 if (pgdat) 4275 4281 spin_unlock_irq(&pgdat->lru_lock); ··· 4294 4288 ClearPageUnevictable(page); 4295 4289 del_page_from_lru_list(page, lruvec, LRU_UNEVICTABLE); 4296 4290 add_page_to_lru_list(page, lruvec, lru); 4297 - pgrescued++; 4291 + pgrescued += nr_pages; 4298 4292 } 4299 4293 } 4300 4294
+30 -17
scripts/kconfig/lkc.h
··· 66 66 fprintf(stderr, "Error in writing or end of file.\n"); 67 67 } 68 68 69 - /* menu.c */ 70 - void _menu_init(void); 71 - void menu_warn(struct menu *menu, const char *fmt, ...); 72 - struct menu *menu_add_menu(void); 73 - void menu_end_menu(void); 74 - void menu_add_entry(struct symbol *sym); 75 - void menu_add_dep(struct expr *dep); 76 - void menu_add_visibility(struct expr *dep); 77 - struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); 78 - void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); 79 - void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); 80 - void menu_add_option_modules(void); 81 - void menu_add_option_defconfig_list(void); 82 - void menu_add_option_allnoconfig_y(void); 83 - void menu_finalize(struct menu *parent); 84 - void menu_set_type(int type); 85 - 86 69 /* util.c */ 87 70 struct file *file_lookup(const char *name); 88 71 void *xmalloc(size_t size); ··· 91 108 void str_append(struct gstr *gs, const char *s); 92 109 void str_printf(struct gstr *gs, const char *fmt, ...); 93 110 const char *str_get(struct gstr *gs); 111 + 112 + /* menu.c */ 113 + void _menu_init(void); 114 + void menu_warn(struct menu *menu, const char *fmt, ...); 115 + struct menu *menu_add_menu(void); 116 + void menu_end_menu(void); 117 + void menu_add_entry(struct symbol *sym); 118 + void menu_add_dep(struct expr *dep); 119 + void menu_add_visibility(struct expr *dep); 120 + struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); 121 + void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); 122 + void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); 123 + void menu_add_option_modules(void); 124 + void menu_add_option_defconfig_list(void); 125 + void menu_add_option_allnoconfig_y(void); 126 + void menu_finalize(struct menu *parent); 127 + void menu_set_type(int type); 128 + 129 + extern struct menu rootmenu; 130 + 131 + bool menu_is_empty(struct menu *menu); 132 + bool menu_is_visible(struct menu *menu); 133 + bool menu_has_prompt(struct menu *menu); 134 + const char *menu_get_prompt(struct menu *menu); 135 + struct menu *menu_get_root_menu(struct menu *menu); 136 + struct menu *menu_get_parent_menu(struct menu *menu); 137 + bool menu_has_help(struct menu *menu); 138 + const char *menu_get_help(struct menu *menu); 139 + struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); 140 + void menu_get_ext_help(struct menu *menu, struct gstr *help); 94 141 95 142 /* symbol.c */ 96 143 void sym_clear_all_valid(void);
-14
scripts/kconfig/lkc_proto.h
··· 12 12 void conf_set_changed_callback(void (*fn)(void)); 13 13 void conf_set_message_callback(void (*fn)(const char *s)); 14 14 15 - /* menu.c */ 16 - extern struct menu rootmenu; 17 - 18 - bool menu_is_empty(struct menu *menu); 19 - bool menu_is_visible(struct menu *menu); 20 - bool menu_has_prompt(struct menu *menu); 21 - const char * menu_get_prompt(struct menu *menu); 22 - struct menu * menu_get_root_menu(struct menu *menu); 23 - struct menu * menu_get_parent_menu(struct menu *menu); 24 - bool menu_has_help(struct menu *menu); 25 - const char * menu_get_help(struct menu *menu); 26 - struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); 27 - void menu_get_ext_help(struct menu *menu, struct gstr *help); 28 - 29 15 /* symbol.c */ 30 16 extern struct symbol * symbol_hash[SYMBOL_HASHSIZE]; 31 17
+9 -4
scripts/kconfig/qconf.cc
··· 1108 1108 if (showDebug()) 1109 1109 stream << debug_info(sym); 1110 1110 1111 + struct gstr help_gstr = str_new(); 1112 + 1113 + menu_get_ext_help(_menu, &help_gstr); 1114 + stream << print_filter(str_get(&help_gstr)); 1115 + str_free(&help_gstr); 1111 1116 } else if (_menu->prompt) { 1112 1117 stream << "<big><b>"; 1113 1118 stream << print_filter(_menu->prompt->text); ··· 1124 1119 expr_print_help, &stream, E_NONE); 1125 1120 stream << "<br><br>"; 1126 1121 } 1122 + 1123 + stream << "defined at " << _menu->file->name << ":" 1124 + << _menu->lineno << "<br><br>"; 1127 1125 } 1128 1126 } 1129 - if (showDebug()) 1130 - stream << "defined at " << _menu->file->name << ":" 1131 - << _menu->lineno << "<br><br>"; 1132 1127 1133 1128 setText(info); 1134 1129 } ··· 1281 1276 } 1282 1277 1283 1278 free(result); 1284 - delete data; 1279 + delete[] data; 1285 1280 } 1286 1281 1287 1282 void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event)
+2 -1
security/device_cgroup.c
··· 354 354 { 355 355 struct dev_exception_item *ex; 356 356 357 - list_for_each_entry_rcu(ex, exceptions, list) { 357 + list_for_each_entry_rcu(ex, exceptions, list, 358 + lockdep_is_held(&devcgroup_mutex)) { 358 359 if ((type & DEVCG_DEV_BLOCK) && !(ex->type & DEVCG_DEV_BLOCK)) 359 360 continue; 360 361 if ((type & DEVCG_DEV_CHAR) && !(ex->type & DEVCG_DEV_CHAR))
+78
sound/pci/hda/patch_realtek.c
··· 5993 5993 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); 5994 5994 } 5995 5995 5996 + 5997 + static void alc294_gx502_toggle_output(struct hda_codec *codec, 5998 + struct hda_jack_callback *cb) 5999 + { 6000 + /* The Windows driver sets the codec up in a very different way where 6001 + * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it 6002 + */ 6003 + if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) 6004 + alc_write_coef_idx(codec, 0x10, 0x8a20); 6005 + else 6006 + alc_write_coef_idx(codec, 0x10, 0x0a20); 6007 + } 6008 + 6009 + static void alc294_fixup_gx502_hp(struct hda_codec *codec, 6010 + const struct hda_fixup *fix, int action) 6011 + { 6012 + /* Pin 0x21: headphones/headset mic */ 6013 + if (!is_jack_detectable(codec, 0x21)) 6014 + return; 6015 + 6016 + switch (action) { 6017 + case HDA_FIXUP_ACT_PRE_PROBE: 6018 + snd_hda_jack_detect_enable_callback(codec, 0x21, 6019 + alc294_gx502_toggle_output); 6020 + break; 6021 + case HDA_FIXUP_ACT_INIT: 6022 + /* Make sure to start in a correct state, i.e. if 6023 + * headphones have been plugged in before powering up the system 6024 + */ 6025 + alc294_gx502_toggle_output(codec, NULL); 6026 + break; 6027 + } 6028 + } 6029 + 5996 6030 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, 5997 6031 const struct hda_fixup *fix, int action) 5998 6032 { ··· 6207 6173 ALC285_FIXUP_THINKPAD_HEADSET_JACK, 6208 6174 ALC294_FIXUP_ASUS_HPE, 6209 6175 ALC294_FIXUP_ASUS_COEF_1B, 6176 + ALC294_FIXUP_ASUS_GX502_HP, 6177 + ALC294_FIXUP_ASUS_GX502_PINS, 6178 + ALC294_FIXUP_ASUS_GX502_VERBS, 6210 6179 ALC285_FIXUP_HP_GPIO_LED, 6211 6180 ALC285_FIXUP_HP_MUTE_LED, 6212 6181 ALC236_FIXUP_HP_MUTE_LED, ··· 6228 6191 ALC269_FIXUP_LEMOTE_A1802, 6229 6192 ALC269_FIXUP_LEMOTE_A190X, 6230 6193 ALC256_FIXUP_INTEL_NUC8_RUGGED, 6194 + ALC255_FIXUP_XIAOMI_HEADSET_MIC, 6231 6195 }; 6232 6196 6233 6197 static const struct hda_fixup alc269_fixups[] = { ··· 7376 7338 .chained = true, 7377 7339 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC 7378 7340 }, 7341 + [ALC294_FIXUP_ASUS_GX502_PINS] = { 7342 + .type = HDA_FIXUP_PINS, 7343 + .v.pins = (const struct hda_pintbl[]) { 7344 + { 0x19, 0x03a11050 }, /* front HP mic */ 7345 + { 0x1a, 0x01a11830 }, /* rear external mic */ 7346 + { 0x21, 0x03211020 }, /* front HP out */ 7347 + { } 7348 + }, 7349 + .chained = true, 7350 + .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS 7351 + }, 7352 + [ALC294_FIXUP_ASUS_GX502_VERBS] = { 7353 + .type = HDA_FIXUP_VERBS, 7354 + .v.verbs = (const struct hda_verb[]) { 7355 + /* set 0x15 to HP-OUT ctrl */ 7356 + { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, 7357 + /* unmute the 0x15 amp */ 7358 + { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 }, 7359 + { } 7360 + }, 7361 + .chained = true, 7362 + .chain_id = ALC294_FIXUP_ASUS_GX502_HP 7363 + }, 7364 + [ALC294_FIXUP_ASUS_GX502_HP] = { 7365 + .type = HDA_FIXUP_FUNC, 7366 + .v.func = alc294_fixup_gx502_hp, 7367 + }, 7379 7368 [ALC294_FIXUP_ASUS_COEF_1B] = { 7380 7369 .type = HDA_FIXUP_VERBS, 7381 7370 .v.verbs = (const struct hda_verb[]) { ··· 7592 7527 .chained = true, 7593 7528 .chain_id = ALC269_FIXUP_HEADSET_MODE 7594 7529 }, 7530 + [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = { 7531 + .type = HDA_FIXUP_VERBS, 7532 + .v.verbs = (const struct hda_verb[]) { 7533 + { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 }, 7534 + { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 }, 7535 + { } 7536 + }, 7537 + .chained = true, 7538 + .chain_id = ALC289_FIXUP_ASUS_GA401 7539 + }, 7595 7540 }; 7596 7541 7597 7542 static const struct snd_pci_quirk alc269_fixup_tbl[] = { ··· 7786 7711 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), 7787 7712 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), 7788 7713 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), 7714 + SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), 7789 7715 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), 7790 7716 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), 7791 7717 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), ··· 7899 7823 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI), 7900 7824 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101), 7901 7825 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ 7826 + SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), 7902 7827 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), 7903 7828 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), 7904 7829 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), ··· 8077 8000 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"}, 8078 8001 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"}, 8079 8002 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"}, 8003 + {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"}, 8080 8004 {} 8081 8005 }; 8082 8006 #define ALC225_STANDARD_PINS \
+2 -2
sound/soc/codecs/max98373-sdw.c
··· 838 838 839 839 /* Regmap Initialization */ 840 840 regmap = devm_regmap_init_sdw(slave, &max98373_sdw_regmap); 841 - if (!regmap) 842 - return -EINVAL; 841 + if (IS_ERR(regmap)) 842 + return PTR_ERR(regmap); 843 843 844 844 return max98373_init(slave, regmap); 845 845 }
+7
sound/soc/codecs/pcm3168a.c
··· 306 306 struct pcm3168a_priv *pcm3168a = snd_soc_component_get_drvdata(dai->component); 307 307 int ret; 308 308 309 + /* 310 + * Some sound card sets 0 Hz as reset, 311 + * but it is impossible to set. Ignore it here 312 + */ 313 + if (freq == 0) 314 + return 0; 315 + 309 316 if (freq > PCM3168A_MAX_SYSCLK) 310 317 return -EINVAL; 311 318
+2 -2
sound/soc/codecs/rt1308-sdw.c
··· 684 684 685 685 /* Regmap Initialization */ 686 686 regmap = devm_regmap_init_sdw(slave, &rt1308_sdw_regmap); 687 - if (!regmap) 688 - return -EINVAL; 687 + if (IS_ERR(regmap)) 688 + return PTR_ERR(regmap); 689 689 690 690 rt1308_sdw_init(&slave->dev, regmap, slave); 691 691
+2 -2
sound/soc/codecs/rt700-sdw.c
··· 452 452 453 453 /* Regmap Initialization */ 454 454 sdw_regmap = devm_regmap_init_sdw(slave, &rt700_sdw_regmap); 455 - if (!sdw_regmap) 456 - return -EINVAL; 455 + if (IS_ERR(sdw_regmap)) 456 + return PTR_ERR(sdw_regmap); 457 457 458 458 regmap = devm_regmap_init(&slave->dev, NULL, 459 459 &slave->dev, &rt700_regmap);
+2 -2
sound/soc/codecs/rt711-sdw.c
··· 452 452 453 453 /* Regmap Initialization */ 454 454 sdw_regmap = devm_regmap_init_sdw(slave, &rt711_sdw_regmap); 455 - if (!sdw_regmap) 456 - return -EINVAL; 455 + if (IS_ERR(sdw_regmap)) 456 + return PTR_ERR(sdw_regmap); 457 457 458 458 regmap = devm_regmap_init(&slave->dev, NULL, 459 459 &slave->dev, &rt711_regmap);
+2 -2
sound/soc/codecs/rt715-sdw.c
··· 527 527 528 528 /* Regmap Initialization */ 529 529 sdw_regmap = devm_regmap_init_sdw(slave, &rt715_sdw_regmap); 530 - if (!sdw_regmap) 531 - return -EINVAL; 530 + if (IS_ERR(sdw_regmap)) 531 + return PTR_ERR(sdw_regmap); 532 532 533 533 regmap = devm_regmap_init(&slave->dev, NULL, &slave->dev, 534 534 &rt715_regmap);
+15 -13
sound/soc/codecs/tlv320adcx140.c
··· 842 842 if (ret) 843 843 goto out; 844 844 845 + if (adcx140->supply_areg == NULL) 846 + sleep_cfg_val |= ADCX140_AREG_INTERNAL; 847 + 848 + ret = regmap_write(adcx140->regmap, ADCX140_SLEEP_CFG, sleep_cfg_val); 849 + if (ret) { 850 + dev_err(adcx140->dev, "setting sleep config failed %d\n", ret); 851 + goto out; 852 + } 853 + 854 + /* 8.4.3: Wait >= 1ms after entering active mode. */ 855 + usleep_range(1000, 100000); 856 + 845 857 pdm_count = device_property_count_u32(adcx140->dev, 846 858 "ti,pdm-edge-select"); 847 859 if (pdm_count <= ADCX140_NUM_PDM_EDGES && pdm_count > 0) { ··· 900 888 ret = adcx140_configure_gpo(adcx140); 901 889 if (ret) 902 890 goto out; 903 - 904 - if (adcx140->supply_areg == NULL) 905 - sleep_cfg_val |= ADCX140_AREG_INTERNAL; 906 - 907 - ret = regmap_write(adcx140->regmap, ADCX140_SLEEP_CFG, sleep_cfg_val); 908 - if (ret) { 909 - dev_err(adcx140->dev, "setting sleep config failed %d\n", ret); 910 - goto out; 911 - } 912 - 913 - /* 8.4.3: Wait >= 1ms after entering active mode. */ 914 - usleep_range(1000, 100000); 915 891 916 892 ret = regmap_update_bits(adcx140->regmap, ADCX140_BIAS_CFG, 917 893 ADCX140_MIC_BIAS_VAL_MSK | ··· 980 980 if (!adcx140) 981 981 return -ENOMEM; 982 982 983 + adcx140->dev = &i2c->dev; 984 + 983 985 adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev, 984 986 "reset", GPIOD_OUT_LOW); 985 987 if (IS_ERR(adcx140->gpio_reset)) ··· 1009 1007 ret); 1010 1008 return ret; 1011 1009 } 1012 - adcx140->dev = &i2c->dev; 1010 + 1013 1011 i2c_set_clientdata(i2c, adcx140); 1014 1012 1015 1013 return devm_snd_soc_register_component(&i2c->dev,
+10
sound/soc/codecs/wm8994.c
··· 3514 3514 return -EINVAL; 3515 3515 } 3516 3516 3517 + pm_runtime_get_sync(component->dev); 3518 + 3517 3519 switch (micbias) { 3518 3520 case 1: 3519 3521 micdet = &wm8994->micdet[0]; ··· 3562 3560 WM8994_MIC1_DET_DB | WM8994_MIC1_SHRT_DB); 3563 3561 3564 3562 snd_soc_dapm_sync(dapm); 3563 + 3564 + pm_runtime_put(component->dev); 3565 3565 3566 3566 return 0; 3567 3567 } ··· 3936 3932 return -EINVAL; 3937 3933 } 3938 3934 3935 + pm_runtime_get_sync(component->dev); 3936 + 3939 3937 if (jack) { 3940 3938 snd_soc_dapm_force_enable_pin(dapm, "CLK_SYS"); 3941 3939 snd_soc_dapm_sync(dapm); ··· 4005 3999 snd_soc_dapm_disable_pin(dapm, "CLK_SYS"); 4006 4000 snd_soc_dapm_sync(dapm); 4007 4001 } 4002 + 4003 + pm_runtime_put(component->dev); 4008 4004 4009 4005 return 0; 4010 4006 } ··· 4201 4193 wm8994->hubs.dcs_readback_mode = 2; 4202 4194 break; 4203 4195 } 4196 + wm8994->hubs.micd_scthr = true; 4204 4197 break; 4205 4198 4206 4199 case WM8958: 4207 4200 wm8994->hubs.dcs_readback_mode = 1; 4208 4201 wm8994->hubs.hp_startup_mode = 1; 4202 + wm8994->hubs.micd_scthr = true; 4209 4203 4210 4204 switch (control->revision) { 4211 4205 case 0:
+3
sound/soc/codecs/wm_hubs.c
··· 1223 1223 snd_soc_component_update_bits(component, WM8993_ADDITIONAL_CONTROL, 1224 1224 WM8993_LINEOUT2_FB, WM8993_LINEOUT2_FB); 1225 1225 1226 + if (!hubs->micd_scthr) 1227 + return 0; 1228 + 1226 1229 snd_soc_component_update_bits(component, WM8993_MICBIAS, 1227 1230 WM8993_JD_SCTHR_MASK | WM8993_JD_THR_MASK | 1228 1231 WM8993_MICB1_LVL | WM8993_MICB2_LVL,
+1
sound/soc/codecs/wm_hubs.h
··· 27 27 int hp_startup_mode; 28 28 int series_startup; 29 29 int no_series_update; 30 + bool micd_scthr; 30 31 31 32 bool no_cache_dac_hp_direct; 32 33 struct list_head dcs_cache;
+11
sound/soc/intel/atom/sst-mfld-platform-pcm.c
··· 333 333 if (ret_val < 0) 334 334 goto out_power_up; 335 335 336 + /* 337 + * Make sure the period to be multiple of 1ms to align the 338 + * design of firmware. Apply same rule to buffer size to make 339 + * sure alsa could always find a value for period size 340 + * regardless the buffer size given by user space. 341 + */ 342 + snd_pcm_hw_constraint_step(substream->runtime, 0, 343 + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 48); 344 + snd_pcm_hw_constraint_step(substream->runtime, 0, 345 + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 48); 346 + 336 347 /* Make sure, that the period size is always even */ 337 348 snd_pcm_hw_constraint_step(substream->runtime, 0, 338 349 SNDRV_PCM_HW_PARAM_PERIODS, 2);
+10
sound/soc/intel/boards/bytcr_rt5640.c
··· 591 591 BYT_RT5640_SSP0_AIF1 | 592 592 BYT_RT5640_MCLK_EN), 593 593 }, 594 + { /* MPMAN Converter 9, similar hw as the I.T.Works TW891 2-in-1 */ 595 + .matches = { 596 + DMI_MATCH(DMI_SYS_VENDOR, "MPMAN"), 597 + DMI_MATCH(DMI_PRODUCT_NAME, "Converter9"), 598 + }, 599 + .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | 600 + BYT_RT5640_MONO_SPEAKER | 601 + BYT_RT5640_SSP0_AIF1 | 602 + BYT_RT5640_MCLK_EN), 603 + }, 594 604 { 595 605 /* MPMAN MPWIN895CL */ 596 606 .matches = {
+1 -1
sound/soc/intel/boards/skl_hda_dsp_generic.c
··· 181 181 struct snd_soc_dai *dai; 182 182 183 183 for_each_card_rtds(card, rtd) { 184 - if (!strstr(rtd->dai_link->codecs->name, "ehdaudio")) 184 + if (!strstr(rtd->dai_link->codecs->name, "ehdaudio0D0")) 185 185 continue; 186 186 dai = asoc_rtd_to_codec(rtd, 0); 187 187 hda_pvt = snd_soc_component_get_drvdata(dai->component);
+4 -3
sound/soc/intel/boards/sof_maxim_common.c
··· 66 66 int j; 67 67 int ret = 0; 68 68 69 + /* set spk pin by playback only */ 70 + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) 71 + return 0; 72 + 69 73 for_each_rtd_codec_dais(rtd, j, codec_dai) { 70 74 struct snd_soc_component *component = codec_dai->component; 71 75 struct snd_soc_dapm_context *dapm = ··· 90 86 case SNDRV_PCM_TRIGGER_STOP: 91 87 case SNDRV_PCM_TRIGGER_SUSPEND: 92 88 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 93 - /* Make sure no streams are active before disable pin */ 94 - if (snd_soc_dai_active(codec_dai) != 1) 95 - break; 96 89 ret = snd_soc_dapm_disable_pin(dapm, pin_name); 97 90 if (!ret) 98 91 snd_soc_dapm_sync(dapm);
+82 -105
sound/soc/intel/haswell/sst-haswell-dsp.c
··· 243 243 return ret; 244 244 } 245 245 246 - #define CSR_DEFAULT_VALUE 0x8480040E 247 - #define ISC_DEFAULT_VALUE 0x0 248 - #define ISD_DEFAULT_VALUE 0x0 249 - #define IMC_DEFAULT_VALUE 0x7FFF0003 250 - #define IMD_DEFAULT_VALUE 0x7FFF0003 251 - #define IPCC_DEFAULT_VALUE 0x0 252 - #define IPCD_DEFAULT_VALUE 0x0 253 - #define CLKCTL_DEFAULT_VALUE 0x7FF 254 - #define CSR2_DEFAULT_VALUE 0x0 255 - #define LTR_CTRL_DEFAULT_VALUE 0x0 256 - #define HMD_CTRL_DEFAULT_VALUE 0x0 257 - 258 - static void hsw_set_shim_defaults(struct sst_dsp *sst) 259 - { 260 - sst_dsp_shim_write_unlocked(sst, SST_CSR, CSR_DEFAULT_VALUE); 261 - sst_dsp_shim_write_unlocked(sst, SST_ISRX, ISC_DEFAULT_VALUE); 262 - sst_dsp_shim_write_unlocked(sst, SST_ISRD, ISD_DEFAULT_VALUE); 263 - sst_dsp_shim_write_unlocked(sst, SST_IMRX, IMC_DEFAULT_VALUE); 264 - sst_dsp_shim_write_unlocked(sst, SST_IMRD, IMD_DEFAULT_VALUE); 265 - sst_dsp_shim_write_unlocked(sst, SST_IPCX, IPCC_DEFAULT_VALUE); 266 - sst_dsp_shim_write_unlocked(sst, SST_IPCD, IPCD_DEFAULT_VALUE); 267 - sst_dsp_shim_write_unlocked(sst, SST_CLKCTL, CLKCTL_DEFAULT_VALUE); 268 - sst_dsp_shim_write_unlocked(sst, SST_CSR2, CSR2_DEFAULT_VALUE); 269 - sst_dsp_shim_write_unlocked(sst, SST_LTRC, LTR_CTRL_DEFAULT_VALUE); 270 - sst_dsp_shim_write_unlocked(sst, SST_HMDC, HMD_CTRL_DEFAULT_VALUE); 271 - } 272 - 273 - /* all clock-gating minus DCLCGE and DTCGE */ 274 - #define SST_VDRTCL2_CG_OTHER 0xB7D 275 - 276 246 static void hsw_set_dsp_D3(struct sst_dsp *sst) 277 247 { 248 + u32 val; 278 249 u32 reg; 279 250 280 - /* disable clock core gating */ 251 + /* Disable core clock gating (VDRTCTL2.DCLCGE = 0) */ 281 252 reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2); 282 - reg &= ~(SST_VDRTCL2_DCLCGE); 253 + reg &= ~(SST_VDRTCL2_DCLCGE | SST_VDRTCL2_DTCGE); 283 254 writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2); 284 255 285 - /* stall, reset and set 24MHz XOSC */ 286 - sst_dsp_shim_update_bits_unlocked(sst, SST_CSR, 287 - SST_CSR_24MHZ_LPCS | SST_CSR_STALL | SST_CSR_RST, 288 - SST_CSR_24MHZ_LPCS | SST_CSR_STALL | SST_CSR_RST); 256 + /* enable power gating and switch off DRAM & IRAM blocks */ 257 + val = readl(sst->addr.pci_cfg + SST_VDRTCTL0); 258 + val |= SST_VDRTCL0_DSRAMPGE_MASK | 259 + SST_VDRTCL0_ISRAMPGE_MASK; 260 + val &= ~(SST_VDRTCL0_D3PGD | SST_VDRTCL0_D3SRAMPGD); 261 + writel(val, sst->addr.pci_cfg + SST_VDRTCTL0); 289 262 290 - /* DRAM power gating all */ 291 - reg = readl(sst->addr.pci_cfg + SST_VDRTCTL0); 292 - reg |= SST_VDRTCL0_ISRAMPGE_MASK | 293 - SST_VDRTCL0_DSRAMPGE_MASK; 294 - reg &= ~(SST_VDRTCL0_D3SRAMPGD); 295 - reg |= SST_VDRTCL0_D3PGD; 296 - writel(reg, sst->addr.pci_cfg + SST_VDRTCTL0); 297 - udelay(50); 263 + /* switch off audio PLL */ 264 + val = readl(sst->addr.pci_cfg + SST_VDRTCTL2); 265 + val |= SST_VDRTCL2_APLLSE_MASK; 266 + writel(val, sst->addr.pci_cfg + SST_VDRTCTL2); 298 267 299 - /* PLL shutdown enable */ 300 - reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2); 301 - reg |= SST_VDRTCL2_APLLSE_MASK; 302 - writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2); 303 - 304 - /* disable MCLK */ 268 + /* disable MCLK(clkctl.smos = 0) */ 305 269 sst_dsp_shim_update_bits_unlocked(sst, SST_CLKCTL, 306 - SST_CLKCTL_MASK, 0); 270 + SST_CLKCTL_MASK, 0); 307 271 308 - /* switch clock gating */ 309 - reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2); 310 - reg |= SST_VDRTCL2_CG_OTHER; 311 - reg &= ~(SST_VDRTCL2_DTCGE); 312 - writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2); 313 - /* enable DTCGE separatelly */ 314 - reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2); 315 - reg |= SST_VDRTCL2_DTCGE; 316 - writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2); 317 - 318 - /* set shim defaults */ 319 - hsw_set_shim_defaults(sst); 320 - 321 - /* set D3 */ 322 - reg = readl(sst->addr.pci_cfg + SST_PMCS); 323 - reg |= SST_PMCS_PS_MASK; 324 - writel(reg, sst->addr.pci_cfg + SST_PMCS); 272 + /* Set D3 state, delay 50 us */ 273 + val = readl(sst->addr.pci_cfg + SST_PMCS); 274 + val |= SST_PMCS_PS_MASK; 275 + writel(val, sst->addr.pci_cfg + SST_PMCS); 325 276 udelay(50); 326 277 327 - /* enable clock core gating */ 278 + /* Enable core clock gating (VDRTCTL2.DCLCGE = 1), delay 50 us */ 328 279 reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2); 329 - reg |= SST_VDRTCL2_DCLCGE; 280 + reg |= SST_VDRTCL2_DCLCGE | SST_VDRTCL2_DTCGE; 330 281 writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2); 282 + 331 283 udelay(50); 284 + 332 285 } 333 286 334 287 static void hsw_reset(struct sst_dsp *sst) ··· 299 346 SST_CSR_RST | SST_CSR_STALL, SST_CSR_STALL); 300 347 } 301 348 302 - /* recommended CSR state for power-up */ 303 - #define SST_CSR_D0_MASK (0x18A09C0C | SST_CSR_DCS_MASK) 304 - 305 349 static int hsw_set_dsp_D0(struct sst_dsp *sst) 306 350 { 307 - u32 reg; 351 + int tries = 10; 352 + u32 reg, fw_dump_bit; 308 353 309 - /* disable clock core gating */ 354 + /* Disable core clock gating (VDRTCTL2.DCLCGE = 0) */ 310 355 reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2); 311 - reg &= ~(SST_VDRTCL2_DCLCGE); 356 + reg &= ~(SST_VDRTCL2_DCLCGE | SST_VDRTCL2_DTCGE); 312 357 writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2); 313 358 314 - /* switch clock gating */ 315 - reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2); 316 - reg |= SST_VDRTCL2_CG_OTHER; 317 - reg &= ~(SST_VDRTCL2_DTCGE); 318 - writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2); 319 - 320 - /* set D0 */ 321 - reg = readl(sst->addr.pci_cfg + SST_PMCS); 322 - reg &= ~(SST_PMCS_PS_MASK); 323 - writel(reg, sst->addr.pci_cfg + SST_PMCS); 324 - 325 - /* DRAM power gating none */ 359 + /* Disable D3PG (VDRTCTL0.D3PGD = 1) */ 326 360 reg = readl(sst->addr.pci_cfg + SST_VDRTCTL0); 327 - reg &= ~(SST_VDRTCL0_ISRAMPGE_MASK | 328 - SST_VDRTCL0_DSRAMPGE_MASK); 329 - reg |= SST_VDRTCL0_D3SRAMPGD; 330 361 reg |= SST_VDRTCL0_D3PGD; 331 362 writel(reg, sst->addr.pci_cfg + SST_VDRTCTL0); 332 - mdelay(10); 333 363 334 - /* set shim defaults */ 335 - hsw_set_shim_defaults(sst); 364 + /* Set D0 state */ 365 + reg = readl(sst->addr.pci_cfg + SST_PMCS); 366 + reg &= ~SST_PMCS_PS_MASK; 367 + writel(reg, sst->addr.pci_cfg + SST_PMCS); 336 368 337 - /* restore MCLK */ 369 + /* check that ADSP shim is enabled */ 370 + while (tries--) { 371 + reg = readl(sst->addr.pci_cfg + SST_PMCS) & SST_PMCS_PS_MASK; 372 + if (reg == 0) 373 + goto finish; 374 + 375 + msleep(1); 376 + } 377 + 378 + return -ENODEV; 379 + 380 + finish: 381 + /* select SSP1 19.2MHz base clock, SSP clock 0, turn off Low Power Clock */ 382 + sst_dsp_shim_update_bits_unlocked(sst, SST_CSR, 383 + SST_CSR_S1IOCS | SST_CSR_SBCS1 | SST_CSR_LPCS, 0x0); 384 + 385 + /* stall DSP core, set clk to 192/96Mhz */ 386 + sst_dsp_shim_update_bits_unlocked(sst, 387 + SST_CSR, SST_CSR_STALL | SST_CSR_DCS_MASK, 388 + SST_CSR_STALL | SST_CSR_DCS(4)); 389 + 390 + /* Set 24MHz MCLK, prevent local clock gating, enable SSP0 clock */ 338 391 sst_dsp_shim_update_bits_unlocked(sst, SST_CLKCTL, 339 - SST_CLKCTL_MASK, SST_CLKCTL_MASK); 392 + SST_CLKCTL_MASK | SST_CLKCTL_DCPLCG | SST_CLKCTL_SCOE0, 393 + SST_CLKCTL_MASK | SST_CLKCTL_DCPLCG | SST_CLKCTL_SCOE0); 340 394 341 - /* PLL shutdown disable */ 395 + /* Stall and reset core, set CSR */ 396 + hsw_reset(sst); 397 + 398 + /* Enable core clock gating (VDRTCTL2.DCLCGE = 1), delay 50 us */ 342 399 reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2); 343 - reg &= ~(SST_VDRTCL2_APLLSE_MASK); 400 + reg |= SST_VDRTCL2_DCLCGE | SST_VDRTCL2_DTCGE; 344 401 writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2); 345 402 346 - sst_dsp_shim_update_bits_unlocked(sst, SST_CSR, 347 - SST_CSR_D0_MASK, SST_CSR_SBCS0 | SST_CSR_SBCS1 | 348 - SST_CSR_STALL | SST_CSR_DCS(4)); 349 403 udelay(50); 350 404 351 - /* enable clock core gating */ 405 + /* switch on audio PLL */ 352 406 reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2); 353 - reg |= SST_VDRTCL2_DCLCGE; 407 + reg &= ~SST_VDRTCL2_APLLSE_MASK; 354 408 writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2); 355 409 356 - /* clear reset */ 357 - sst_dsp_shim_update_bits_unlocked(sst, SST_CSR, SST_CSR_RST, 0); 410 + /* set default power gating control, enable power gating control for all blocks. that is, 411 + can't be accessed, please enable each block before accessing. */ 412 + reg = readl(sst->addr.pci_cfg + SST_VDRTCTL0); 413 + reg |= SST_VDRTCL0_DSRAMPGE_MASK | SST_VDRTCL0_ISRAMPGE_MASK; 414 + /* for D0, always enable the block(DSRAM[0]) used for FW dump */ 415 + fw_dump_bit = 1 << SST_VDRTCL0_DSRAMPGE_SHIFT; 416 + writel(reg & ~fw_dump_bit, sst->addr.pci_cfg + SST_VDRTCTL0); 417 + 358 418 359 419 /* disable DMA finish function for SSP0 & SSP1 */ 360 420 sst_dsp_shim_update_bits_unlocked(sst, SST_CSR2, SST_CSR2_SDFD_SSP1, ··· 383 417 0x0); 384 418 sst_dsp_shim_update_bits(sst, SST_IMRD, (SST_IMRD_DONE | SST_IMRD_BUSY | 385 419 SST_IMRD_SSP0 | SST_IMRD_DMAC), 0x0); 420 + 421 + /* clear IPC registers */ 422 + sst_dsp_shim_write(sst, SST_IPCX, 0x0); 423 + sst_dsp_shim_write(sst, SST_IPCD, 0x0); 424 + sst_dsp_shim_write(sst, 0x80, 0x6); 425 + sst_dsp_shim_write(sst, 0xe0, 0x300a); 386 426 387 427 return 0; 388 428 } ··· 414 442 static void hsw_sleep(struct sst_dsp *sst) 415 443 { 416 444 dev_dbg(sst->dev, "HSW_PM dsp runtime suspend\n"); 445 + 446 + /* put DSP into reset and stall */ 447 + sst_dsp_shim_update_bits(sst, SST_CSR, 448 + SST_CSR_24MHZ_LPCS | SST_CSR_RST | SST_CSR_STALL, 449 + SST_CSR_RST | SST_CSR_STALL | SST_CSR_24MHZ_LPCS); 417 450 418 451 hsw_set_dsp_D3(sst); 419 452 dev_dbg(sst->dev, "HSW_PM dsp runtime suspend exit\n");
+23 -1
sound/soc/meson/axg-toddr.c
··· 18 18 #define CTRL0_TODDR_SEL_RESAMPLE BIT(30) 19 19 #define CTRL0_TODDR_EXT_SIGNED BIT(29) 20 20 #define CTRL0_TODDR_PP_MODE BIT(28) 21 + #define CTRL0_TODDR_SYNC_CH BIT(27) 21 22 #define CTRL0_TODDR_TYPE_MASK GENMASK(15, 13) 22 23 #define CTRL0_TODDR_TYPE(x) ((x) << 13) 23 24 #define CTRL0_TODDR_MSB_POS_MASK GENMASK(12, 8) ··· 190 189 .dai_drv = &axg_toddr_dai_drv 191 190 }; 192 191 192 + static int g12a_toddr_dai_startup(struct snd_pcm_substream *substream, 193 + struct snd_soc_dai *dai) 194 + { 195 + struct axg_fifo *fifo = snd_soc_dai_get_drvdata(dai); 196 + int ret; 197 + 198 + ret = axg_toddr_dai_startup(substream, dai); 199 + if (ret) 200 + return ret; 201 + 202 + /* 203 + * Make sure the first channel ends up in the at beginning of the output 204 + * As weird as it looks, without this the first channel may be misplaced 205 + * in memory, with a random shift of 2 channels. 206 + */ 207 + regmap_update_bits(fifo->map, FIFO_CTRL0, CTRL0_TODDR_SYNC_CH, 208 + CTRL0_TODDR_SYNC_CH); 209 + 210 + return 0; 211 + } 212 + 193 213 static const struct snd_soc_dai_ops g12a_toddr_ops = { 194 214 .prepare = g12a_toddr_dai_prepare, 195 215 .hw_params = axg_toddr_dai_hw_params, 196 - .startup = axg_toddr_dai_startup, 216 + .startup = g12a_toddr_dai_startup, 197 217 .shutdown = axg_toddr_dai_shutdown, 198 218 }; 199 219
+1
sound/soc/qcom/apq8016_sbc.c
··· 143 143 144 144 card = &data->card; 145 145 card->dev = dev; 146 + card->owner = THIS_MODULE; 146 147 card->dapm_widgets = apq8016_sbc_dapm_widgets; 147 148 card->num_dapm_widgets = ARRAY_SIZE(apq8016_sbc_dapm_widgets); 148 149
+1
sound/soc/qcom/apq8096.c
··· 114 114 return -ENOMEM; 115 115 116 116 card->dev = dev; 117 + card->owner = THIS_MODULE; 117 118 dev_set_drvdata(dev, card); 118 119 ret = qcom_snd_parse_of(card); 119 120 if (ret)
+4 -2
sound/soc/qcom/common.c
··· 52 52 53 53 for_each_child_of_node(dev->of_node, np) { 54 54 dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL); 55 - if (!dlc) 56 - return -ENOMEM; 55 + if (!dlc) { 56 + ret = -ENOMEM; 57 + goto err; 58 + } 57 59 58 60 link->cpus = &dlc[0]; 59 61 link->platforms = &dlc[1];
+1
sound/soc/qcom/sdm845.c
··· 555 555 card->dapm_widgets = sdm845_snd_widgets; 556 556 card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets); 557 557 card->dev = dev; 558 + card->owner = THIS_MODULE; 558 559 dev_set_drvdata(dev, card); 559 560 ret = qcom_snd_parse_of(card); 560 561 if (ret)
+1
sound/soc/qcom/storm.c
··· 96 96 return -ENOMEM; 97 97 98 98 card->dev = &pdev->dev; 99 + card->owner = THIS_MODULE; 99 100 100 101 ret = snd_soc_of_parse_card_name(card, "qcom,model"); 101 102 if (ret) {
+13
sound/soc/soc-core.c
··· 834 834 } 835 835 EXPORT_SYMBOL_GPL(snd_soc_find_dai); 836 836 837 + struct snd_soc_dai *snd_soc_find_dai_with_mutex( 838 + const struct snd_soc_dai_link_component *dlc) 839 + { 840 + struct snd_soc_dai *dai; 841 + 842 + mutex_lock(&client_mutex); 843 + dai = snd_soc_find_dai(dlc); 844 + mutex_unlock(&client_mutex); 845 + 846 + return dai; 847 + } 848 + EXPORT_SYMBOL_GPL(snd_soc_find_dai_with_mutex); 849 + 837 850 static int soc_dai_link_sanity_check(struct snd_soc_card *card, 838 851 struct snd_soc_dai_link *link) 839 852 {
+2 -2
sound/soc/soc-dai.c
··· 412 412 supported_codec = false; 413 413 414 414 for_each_link_cpus(dai_link, i, cpu) { 415 - dai = snd_soc_find_dai(cpu); 415 + dai = snd_soc_find_dai_with_mutex(cpu); 416 416 if (dai && snd_soc_dai_stream_valid(dai, direction)) { 417 417 supported_cpu = true; 418 418 break; 419 419 } 420 420 } 421 421 for_each_link_codecs(dai_link, i, codec) { 422 - dai = snd_soc_find_dai(codec); 422 + dai = snd_soc_find_dai_with_mutex(codec); 423 423 if (dai && snd_soc_dai_stream_valid(dai, direction)) { 424 424 supported_codec = true; 425 425 break;
+1 -1
sound/soc/soc-pcm.c
··· 812 812 return 0; 813 813 814 814 config_err: 815 - for_each_rtd_dais(rtd, i, dai) 815 + for_each_rtd_dais_rollback(rtd, i, dai) 816 816 snd_soc_dai_shutdown(dai, substream); 817 817 818 818 snd_soc_link_shutdown(substream);
+2 -2
sound/soc/ti/ams-delta.c
··· 446 446 /* Will be used if the codec ever has its own digital_mute function */ 447 447 static int ams_delta_startup(struct snd_pcm_substream *substream) 448 448 { 449 - return ams_delta_digital_mute(NULL, 0, substream->stream); 449 + return ams_delta_mute(NULL, 0, substream->stream); 450 450 } 451 451 452 452 static void ams_delta_shutdown(struct snd_pcm_substream *substream) 453 453 { 454 - ams_delta_digital_mute(NULL, 1, substream->stream); 454 + ams_delta_mute(NULL, 1, substream->stream); 455 455 } 456 456 457 457
+1 -1
tools/include/uapi/linux/in.h
··· 135 135 * this socket to prevent accepting spoofed ones. 136 136 */ 137 137 #define IP_PMTUDISC_INTERFACE 4 138 - /* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get 138 + /* weaker version of IP_PMTUDISC_INTERFACE, which allows packets to get 139 139 * fragmented if they exeed the interface mtu 140 140 */ 141 141 #define IP_PMTUDISC_OMIT 5
+4 -2
tools/include/uapi/linux/kvm.h
··· 790 790 #define KVM_VM_PPC_HV 1 791 791 #define KVM_VM_PPC_PR 2 792 792 793 - /* on MIPS, 0 forces trap & emulate, 1 forces VZ ASE */ 794 - #define KVM_VM_MIPS_TE 0 793 + /* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */ 794 + #define KVM_VM_MIPS_AUTO 0 795 795 #define KVM_VM_MIPS_VZ 1 796 + #define KVM_VM_MIPS_TE 2 796 797 797 798 #define KVM_S390_SIE_PAGE_OFFSET 1 798 799 ··· 1036 1035 #define KVM_CAP_LAST_CPU 184 1037 1036 #define KVM_CAP_SMALLER_MAXPHYADDR 185 1038 1037 #define KVM_CAP_S390_DIAG318 186 1038 + #define KVM_CAP_STEAL_TIME 187 1039 1039 1040 1040 #ifdef KVM_CAP_IRQ_ROUTING 1041 1041
+1 -1
tools/objtool/check.c
··· 619 619 if (!is_static_jump(insn)) 620 620 continue; 621 621 622 - if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET) 622 + if (insn->offset == FAKE_JUMP_OFFSET) 623 623 continue; 624 624 625 625 reloc = find_reloc_by_dest_range(file->elf, insn->sec,
+2 -2
tools/perf/bench/sched-messaging.c
··· 66 66 /* Block until we're ready to go */ 67 67 static void ready(int ready_out, int wakefd) 68 68 { 69 - char dummy; 70 69 struct pollfd pollfd = { .fd = wakefd, .events = POLLIN }; 71 70 72 71 /* Tell them we're ready. */ 73 - if (write(ready_out, &dummy, 1) != 1) 72 + if (write(ready_out, "R", 1) != 1) 74 73 err(EXIT_FAILURE, "CLIENT: ready write"); 75 74 76 75 /* Wait for "GO" signal */ ··· 84 85 unsigned int i, j; 85 86 86 87 ready(ctx->ready_out, ctx->wakefd); 88 + memset(data, 'S', sizeof(data)); 87 89 88 90 /* Now pump to every receiver. */ 89 91 for (i = 0; i < nr_loops; i++) {
+1 -1
tools/perf/pmu-events/arch/x86/amdzen1/core.json
··· 61 61 { 62 62 "EventName": "ex_ret_brn_ind_misp", 63 63 "EventCode": "0xca", 64 - "BriefDescription": "Retired Indirect Branch Instructions Mispredicted.", 64 + "BriefDescription": "Retired Indirect Branch Instructions Mispredicted." 65 65 }, 66 66 { 67 67 "EventName": "ex_ret_mmx_fp_instr.sse_instr",
+1 -1
tools/perf/pmu-events/arch/x86/amdzen2/core.json
··· 125 125 { 126 126 "EventName": "ex_ret_fus_brnch_inst", 127 127 "EventCode": "0x1d0", 128 - "BriefDescription": "Retired Fused Instructions. The number of fuse-branch instructions retired per cycle. The number of events logged per cycle can vary from 0-8.", 128 + "BriefDescription": "Retired Fused Instructions. The number of fuse-branch instructions retired per cycle. The number of events logged per cycle can vary from 0-8." 129 129 } 130 130 ]
+1
tools/perf/tests/attr/README
··· 49 49 perf record --call-graph fp kill (test-record-graph-fp) 50 50 perf record --group -e cycles,instructions kill (test-record-group) 51 51 perf record -e '{cycles,instructions}' kill (test-record-group1) 52 + perf record -e '{cycles/period=1/,instructions/period=2/}:S' kill (test-record-group2) 52 53 perf record -D kill (test-record-no-delay) 53 54 perf record -i kill (test-record-no-inherit) 54 55 perf record -n kill (test-record-no-samples)
+29
tools/perf/tests/attr/test-record-group2
··· 1 + [config] 2 + command = record 3 + args = --no-bpf-event -e '{cycles/period=1234000/,instructions/period=6789000/}:S' kill >/dev/null 2>&1 4 + ret = 1 5 + 6 + [event-1:base-record] 7 + fd=1 8 + group_fd=-1 9 + config=0|1 10 + sample_period=1234000 11 + sample_type=87 12 + read_format=12 13 + inherit=0 14 + freq=0 15 + 16 + [event-2:base-record] 17 + fd=2 18 + group_fd=1 19 + config=0|1 20 + sample_period=6789000 21 + sample_type=87 22 + read_format=12 23 + disabled=0 24 + inherit=0 25 + mmap=0 26 + comm=0 27 + freq=0 28 + enable_on_exec=0 29 + task=0
+4 -1
tools/perf/tests/bp_signal.c
··· 45 45 #if defined (__x86_64__) 46 46 extern void __test_function(volatile long *ptr); 47 47 asm ( 48 + ".pushsection .text;" 48 49 ".globl __test_function\n" 50 + ".type __test_function, @function;" 49 51 "__test_function:\n" 50 52 "incq (%rdi)\n" 51 - "ret\n"); 53 + "ret\n" 54 + ".popsection\n"); 52 55 #else 53 56 static void __test_function(volatile long *ptr) 54 57 {
+9 -5
tools/perf/tests/parse-metric.c
··· 153 153 return -ENOMEM; 154 154 155 155 cpus = perf_cpu_map__new("0"); 156 - if (!cpus) 156 + if (!cpus) { 157 + evlist__delete(evlist); 157 158 return -ENOMEM; 159 + } 158 160 159 161 perf_evlist__set_maps(&evlist->core, cpus, NULL); 160 162 ··· 165 163 false, false, 166 164 &metric_events); 167 165 if (err) 168 - return err; 166 + goto out; 169 167 170 - if (perf_evlist__alloc_stats(evlist, false)) 171 - return -1; 168 + err = perf_evlist__alloc_stats(evlist, false); 169 + if (err) 170 + goto out; 172 171 173 172 /* Load the runtime stats with given numbers for events. */ 174 173 runtime_stat__init(&st); ··· 181 178 if (name2 && ratio2) 182 179 *ratio2 = compute_single(&metric_events, evlist, &st, name2); 183 180 181 + out: 184 182 /* ... clenup. */ 185 183 metricgroup__rblist_exit(&metric_events); 186 184 runtime_stat__exit(&st); 187 185 perf_evlist__free_stats(evlist); 188 186 perf_cpu_map__put(cpus); 189 187 evlist__delete(evlist); 190 - return 0; 188 + return err; 191 189 } 192 190 193 191 static int compute_metric(const char *name, struct value *vals, double *ratio)
+5
tools/perf/tests/pmu-events.c
··· 274 274 int res = 0; 275 275 bool use_uncore_table; 276 276 struct pmu_events_map *map = __test_pmu_get_events_map(); 277 + struct perf_pmu_alias *a, *tmp; 277 278 278 279 if (!map) 279 280 return -1; ··· 348 347 pmu_name, alias->name); 349 348 } 350 349 350 + list_for_each_entry_safe(a, tmp, &aliases, list) { 351 + list_del(&a->list); 352 + perf_pmu_free_alias(a); 353 + } 351 354 free(pmu); 352 355 return res; 353 356 }
+1
tools/perf/tests/pmu.c
··· 173 173 ret = 0; 174 174 } while (0); 175 175 176 + perf_pmu__del_formats(&formats); 176 177 test_format_dir_put(format); 177 178 return ret; 178 179 }
+8 -3
tools/perf/util/evlist.c
··· 946 946 947 947 perf_evlist__set_maps(&evlist->core, cpus, threads); 948 948 949 + /* as evlist now has references, put count here */ 950 + perf_cpu_map__put(cpus); 951 + perf_thread_map__put(threads); 952 + 949 953 return 0; 950 954 951 955 out_delete_threads: ··· 1277 1273 goto out_put; 1278 1274 1279 1275 perf_evlist__set_maps(&evlist->core, cpus, threads); 1280 - out: 1281 - return err; 1276 + 1277 + perf_thread_map__put(threads); 1282 1278 out_put: 1283 1279 perf_cpu_map__put(cpus); 1284 - goto out; 1280 + out: 1281 + return err; 1285 1282 } 1286 1283 1287 1284 int evlist__open(struct evlist *evlist)
+7 -3
tools/perf/util/evsel.c
··· 976 976 * We default some events to have a default interval. But keep 977 977 * it a weak assumption overridable by the user. 978 978 */ 979 - if (!attr->sample_period || (opts->user_freq != UINT_MAX || 980 - opts->user_interval != ULLONG_MAX)) { 979 + if (!attr->sample_period) { 981 980 if (opts->freq) { 982 - evsel__set_sample_bit(evsel, PERIOD); 983 981 attr->freq = 1; 984 982 attr->sample_freq = opts->freq; 985 983 } else { 986 984 attr->sample_period = opts->default_interval; 987 985 } 988 986 } 987 + /* 988 + * If attr->freq was set (here or earlier), ask for period 989 + * to be sampled. 990 + */ 991 + if (attr->freq) 992 + evsel__set_sample_bit(evsel, PERIOD); 989 993 990 994 if (opts->no_samples) 991 995 attr->sample_freq = 0;
+25 -10
tools/perf/util/metricgroup.c
··· 85 85 86 86 list_for_each_entry_safe(expr, tmp, &me->head, nd) { 87 87 free(expr->metric_refs); 88 + free(expr->metric_events); 88 89 free(expr); 89 90 } 90 91 ··· 317 316 if (!metric_refs) { 318 317 ret = -ENOMEM; 319 318 free(metric_events); 319 + free(expr); 320 320 break; 321 321 } 322 322 ··· 532 530 continue; 533 531 strlist__add(me->metrics, s); 534 532 } 533 + 534 + if (!raw) 535 + free(s); 535 536 } 536 537 free(omg); 537 538 } ··· 672 667 m->has_constraint = metric_no_group || metricgroup__has_constraint(pe); 673 668 INIT_LIST_HEAD(&m->metric_refs); 674 669 m->metric_refs_cnt = 0; 675 - *mp = m; 676 670 677 671 parent = expr_ids__alloc(ids); 678 672 if (!parent) { ··· 684 680 free(m); 685 681 return -ENOMEM; 686 682 } 683 + *mp = m; 687 684 } else { 688 685 /* 689 686 * We got here for the referenced metric, via the ··· 719 714 * all the metric's IDs and add it to the parent context. 720 715 */ 721 716 if (expr__find_other(pe->metric_expr, NULL, &m->pctx, runtime) < 0) { 722 - expr__ctx_clear(&m->pctx); 723 - free(m); 717 + if (m->metric_refs_cnt == 0) { 718 + expr__ctx_clear(&m->pctx); 719 + free(m); 720 + *mp = NULL; 721 + } 724 722 return -EINVAL; 725 723 } 726 724 ··· 942 934 943 935 ret = add_metric(&list, pe, metric_no_group, &m, NULL, &ids); 944 936 if (ret) 945 - return ret; 937 + goto out; 946 938 947 939 /* 948 940 * Process any possible referenced metrics ··· 951 943 ret = resolve_metric(metric_no_group, 952 944 &list, map, &ids); 953 945 if (ret) 954 - return ret; 946 + goto out; 955 947 } 956 948 957 949 /* End of pmu events. */ 958 - if (!has_match) 959 - return -EINVAL; 950 + if (!has_match) { 951 + ret = -EINVAL; 952 + goto out; 953 + } 960 954 961 955 list_for_each_entry(m, &list, nd) { 962 956 if (events->len > 0) ··· 973 963 } 974 964 } 975 965 966 + out: 967 + /* 968 + * add to metric_list so that they can be released 969 + * even if it's failed 970 + */ 976 971 list_splice(&list, metric_list); 977 972 expr_ids__exit(&ids); 978 - return 0; 973 + return ret; 979 974 } 980 975 981 976 static int metricgroup__add_metric_list(const char *list, bool metric_no_group, ··· 1055 1040 ret = metricgroup__add_metric_list(str, metric_no_group, 1056 1041 &extra_events, &metric_list, map); 1057 1042 if (ret) 1058 - return ret; 1043 + goto out; 1059 1044 pr_debug("adding %s\n", extra_events.buf); 1060 1045 bzero(&parse_error, sizeof(parse_error)); 1061 1046 ret = __parse_events(perf_evlist, extra_events.buf, &parse_error, fake_pmu); ··· 1063 1048 parse_events_print_error(&parse_error, extra_events.buf); 1064 1049 goto out; 1065 1050 } 1066 - strbuf_release(&extra_events); 1067 1051 ret = metricgroup__setup_events(&metric_list, metric_no_merge, 1068 1052 perf_evlist, metric_events); 1069 1053 out: 1070 1054 metricgroup__free_metrics(&metric_list); 1055 + strbuf_release(&extra_events); 1071 1056 return ret; 1072 1057 } 1073 1058
+1 -1
tools/perf/util/parse-events.c
··· 411 411 return -ENOMEM; 412 412 evsel->tool_event = tool_event; 413 413 if (tool_event == PERF_TOOL_DURATION_TIME) 414 - evsel->unit = strdup("ns"); 414 + evsel->unit = "ns"; 415 415 return 0; 416 416 } 417 417
+12 -1
tools/perf/util/pmu.c
··· 274 274 } 275 275 276 276 /* Delete an alias entry. */ 277 - static void perf_pmu_free_alias(struct perf_pmu_alias *newalias) 277 + void perf_pmu_free_alias(struct perf_pmu_alias *newalias) 278 278 { 279 279 zfree(&newalias->name); 280 280 zfree(&newalias->desc); ··· 1352 1352 memset(bits, 0, BITS_TO_BYTES(PERF_PMU_FORMAT_BITS)); 1353 1353 for (b = from; b <= to; b++) 1354 1354 set_bit(b, bits); 1355 + } 1356 + 1357 + void perf_pmu__del_formats(struct list_head *formats) 1358 + { 1359 + struct perf_pmu_format *fmt, *tmp; 1360 + 1361 + list_for_each_entry_safe(fmt, tmp, formats, list) { 1362 + list_del(&fmt->list); 1363 + free(fmt->name); 1364 + free(fmt); 1365 + } 1355 1366 } 1356 1367 1357 1368 static int sub_non_neg(int a, int b)
+2
tools/perf/util/pmu.h
··· 94 94 int config, unsigned long *bits); 95 95 void perf_pmu__set_format(unsigned long *bits, long from, long to); 96 96 int perf_pmu__format_parse(char *dir, struct list_head *head); 97 + void perf_pmu__del_formats(struct list_head *formats); 97 98 98 99 struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); 99 100 ··· 114 113 115 114 struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu); 116 115 bool pmu_uncore_alias_match(const char *pmu_name, const char *name); 116 + void perf_pmu_free_alias(struct perf_pmu_alias *alias); 117 117 118 118 int perf_pmu__convert_scale(const char *scale, char **end, double *sval); 119 119
+26 -8
tools/perf/util/record.c
··· 2 2 #include "debug.h" 3 3 #include "evlist.h" 4 4 #include "evsel.h" 5 + #include "evsel_config.h" 5 6 #include "parse-events.h" 6 7 #include <errno.h> 7 8 #include <limits.h> ··· 34 33 return leader; 35 34 } 36 35 36 + static u64 evsel__config_term_mask(struct evsel *evsel) 37 + { 38 + struct evsel_config_term *term; 39 + struct list_head *config_terms = &evsel->config_terms; 40 + u64 term_types = 0; 41 + 42 + list_for_each_entry(term, config_terms, list) { 43 + term_types |= 1 << term->type; 44 + } 45 + return term_types; 46 + } 47 + 37 48 static void evsel__config_leader_sampling(struct evsel *evsel, struct evlist *evlist) 38 49 { 39 50 struct perf_event_attr *attr = &evsel->core.attr; 40 51 struct evsel *leader = evsel->leader; 41 52 struct evsel *read_sampler; 53 + u64 term_types, freq_mask; 42 54 43 55 if (!leader->sample_read) 44 56 return; ··· 61 47 if (evsel == read_sampler) 62 48 return; 63 49 50 + term_types = evsel__config_term_mask(evsel); 64 51 /* 65 - * Disable sampling for all group members other than the leader in 66 - * case the leader 'leads' the sampling, except when the leader is an 67 - * AUX area event, in which case the 2nd event in the group is the one 68 - * that 'leads' the sampling. 52 + * Disable sampling for all group members except those with explicit 53 + * config terms or the leader. In the case of an AUX area event, the 2nd 54 + * event in the group is the one that 'leads' the sampling. 69 55 */ 70 - attr->freq = 0; 71 - attr->sample_freq = 0; 72 - attr->sample_period = 0; 73 - attr->write_backward = 0; 56 + freq_mask = (1 << EVSEL__CONFIG_TERM_FREQ) | (1 << EVSEL__CONFIG_TERM_PERIOD); 57 + if ((term_types & freq_mask) == 0) { 58 + attr->freq = 0; 59 + attr->sample_freq = 0; 60 + attr->sample_period = 0; 61 + } 62 + if ((term_types & (1 << EVSEL__CONFIG_TERM_OVERWRITE)) == 0) 63 + attr->write_backward = 0; 74 64 75 65 /* 76 66 * We don't get a sample for slave events, we make them when delivering
+15 -13
tools/perf/util/stat-shadow.c
··· 517 517 518 518 color = get_ratio_color(GRC_CACHE_MISSES, ratio); 519 519 520 - out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache hits", ratio); 520 + out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache accesses", ratio); 521 521 } 522 522 523 523 static void print_l1_icache_misses(struct perf_stat_config *config, ··· 538 538 ratio = avg / total * 100.0; 539 539 540 540 color = get_ratio_color(GRC_CACHE_MISSES, ratio); 541 - out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache hits", ratio); 541 + out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache accesses", ratio); 542 542 } 543 543 544 544 static void print_dtlb_cache_misses(struct perf_stat_config *config, ··· 558 558 ratio = avg / total * 100.0; 559 559 560 560 color = get_ratio_color(GRC_CACHE_MISSES, ratio); 561 - out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache hits", ratio); 561 + out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache accesses", ratio); 562 562 } 563 563 564 564 static void print_itlb_cache_misses(struct perf_stat_config *config, ··· 578 578 ratio = avg / total * 100.0; 579 579 580 580 color = get_ratio_color(GRC_CACHE_MISSES, ratio); 581 - out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache hits", ratio); 581 + out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache accesses", ratio); 582 582 } 583 583 584 584 static void print_ll_cache_misses(struct perf_stat_config *config, ··· 598 598 ratio = avg / total * 100.0; 599 599 600 600 color = get_ratio_color(GRC_CACHE_MISSES, ratio); 601 - out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache hits", ratio); 601 + out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache accesses", ratio); 602 602 } 603 603 604 604 /* ··· 853 853 double test_generic_metric(struct metric_expr *mexp, int cpu, struct runtime_stat *st) 854 854 { 855 855 struct expr_parse_ctx pctx; 856 - double ratio; 856 + double ratio = 0.0; 857 857 858 858 if (prepare_metric(mexp->metric_events, mexp->metric_refs, &pctx, cpu, st) < 0) 859 - return 0.; 859 + goto out; 860 860 861 861 if (expr__parse(&ratio, &pctx, mexp->metric_expr, 1)) 862 - return 0.; 862 + ratio = 0.0; 863 863 864 + out: 865 + expr__ctx_clear(&pctx); 864 866 return ratio; 865 867 } 866 868 ··· 920 918 if (runtime_stat_n(st, STAT_L1_DCACHE, ctx, cpu) != 0) 921 919 print_l1_dcache_misses(config, cpu, evsel, avg, out, st); 922 920 else 923 - print_metric(config, ctxp, NULL, NULL, "of all L1-dcache hits", 0); 921 + print_metric(config, ctxp, NULL, NULL, "of all L1-dcache accesses", 0); 924 922 } else if ( 925 923 evsel->core.attr.type == PERF_TYPE_HW_CACHE && 926 924 evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_L1I | ··· 930 928 if (runtime_stat_n(st, STAT_L1_ICACHE, ctx, cpu) != 0) 931 929 print_l1_icache_misses(config, cpu, evsel, avg, out, st); 932 930 else 933 - print_metric(config, ctxp, NULL, NULL, "of all L1-icache hits", 0); 931 + print_metric(config, ctxp, NULL, NULL, "of all L1-icache accesses", 0); 934 932 } else if ( 935 933 evsel->core.attr.type == PERF_TYPE_HW_CACHE && 936 934 evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_DTLB | ··· 940 938 if (runtime_stat_n(st, STAT_DTLB_CACHE, ctx, cpu) != 0) 941 939 print_dtlb_cache_misses(config, cpu, evsel, avg, out, st); 942 940 else 943 - print_metric(config, ctxp, NULL, NULL, "of all dTLB cache hits", 0); 941 + print_metric(config, ctxp, NULL, NULL, "of all dTLB cache accesses", 0); 944 942 } else if ( 945 943 evsel->core.attr.type == PERF_TYPE_HW_CACHE && 946 944 evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_ITLB | ··· 950 948 if (runtime_stat_n(st, STAT_ITLB_CACHE, ctx, cpu) != 0) 951 949 print_itlb_cache_misses(config, cpu, evsel, avg, out, st); 952 950 else 953 - print_metric(config, ctxp, NULL, NULL, "of all iTLB cache hits", 0); 951 + print_metric(config, ctxp, NULL, NULL, "of all iTLB cache accesses", 0); 954 952 } else if ( 955 953 evsel->core.attr.type == PERF_TYPE_HW_CACHE && 956 954 evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_LL | ··· 960 958 if (runtime_stat_n(st, STAT_LL_CACHE, ctx, cpu) != 0) 961 959 print_ll_cache_misses(config, cpu, evsel, avg, out, st); 962 960 else 963 - print_metric(config, ctxp, NULL, NULL, "of all LL-cache hits", 0); 961 + print_metric(config, ctxp, NULL, NULL, "of all LL-cache accesses", 0); 964 962 } else if (evsel__match(evsel, HARDWARE, HW_CACHE_MISSES)) { 965 963 total = runtime_stat_avg(st, STAT_CACHEREFS, ctx, cpu); 966 964
+7 -2
tools/testing/selftests/powerpc/mm/prot_sao.c
··· 7 7 #include <stdlib.h> 8 8 #include <string.h> 9 9 #include <sys/mman.h> 10 + #include <unistd.h> 10 11 11 12 #include <asm/cputable.h> 12 13 ··· 19 18 { 20 19 char *p; 21 20 22 - /* SAO was introduced in 2.06 and removed in 3.1 */ 21 + /* 22 + * SAO was introduced in 2.06 and removed in 3.1. It's disabled in 23 + * guests/LPARs by default, so also skip if we are running in a guest. 24 + */ 23 25 SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06) || 24 - have_hwcap2(PPC_FEATURE2_ARCH_3_1)); 26 + have_hwcap2(PPC_FEATURE2_ARCH_3_1) || 27 + access("/proc/device-tree/rtas/ibm,hypertas-functions", F_OK) == 0); 25 28 26 29 /* 27 30 * Ensure we can ask for PROT_SAO.
+1 -1
tools/testing/selftests/vm/map_hugetlb.c
··· 83 83 } 84 84 85 85 if (shift) 86 - printf("%u kB hugepages\n", 1 << shift); 86 + printf("%u kB hugepages\n", 1 << (shift - 10)); 87 87 else 88 88 printf("Default size hugepages\n"); 89 89 printf("Mapping %lu Mbytes\n", (unsigned long)length >> 20);