···910910 .desc = "ARM erratum 1418040",911911 .capability = ARM64_WORKAROUND_1418040,912912 ERRATA_MIDR_RANGE_LIST(erratum_1418040_list),913913- .type = (ARM64_CPUCAP_SCOPE_LOCAL_CPU |914914- ARM64_CPUCAP_PERMITTED_FOR_LATE_CPU),913913+ /*914914+ * We need to allow affected CPUs to come in late, but915915+ * also need the non-affected CPUs to be able to come916916+ * in at any point in time. Wonderful.917917+ */918918+ .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE,915919 },916920#endif917921#ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT
+15-11
arch/arm64/kernel/paravirt.c
···5050 struct pv_time_stolen_time_region *reg;51515252 reg = per_cpu_ptr(&stolen_time_region, cpu);5353- if (!reg->kaddr) {5454- pr_warn_once("stolen time enabled but not configured for cpu %d\n",5555- cpu);5353+5454+ /*5555+ * paravirt_steal_clock() may be called before the CPU5656+ * online notification callback runs. Until the callback5757+ * has run we just return zero.5858+ */5959+ if (!reg->kaddr)5660 return 0;5757- }58615962 return le64_to_cpu(READ_ONCE(reg->kaddr->stolen_time));6063}61646262-static int stolen_time_dying_cpu(unsigned int cpu)6565+static int stolen_time_cpu_down_prepare(unsigned int cpu)6366{6467 struct pv_time_stolen_time_region *reg;6568···7673 return 0;7774}78757979-static int init_stolen_time_cpu(unsigned int cpu)7676+static int stolen_time_cpu_online(unsigned int cpu)8077{8178 struct pv_time_stolen_time_region *reg;8279 struct arm_smccc_res res;···106103 return 0;107104}108105109109-static int pv_time_init_stolen_time(void)106106+static int __init pv_time_init_stolen_time(void)110107{111108 int ret;112109113113- ret = cpuhp_setup_state(CPUHP_AP_ARM_KVMPV_STARTING,114114- "hypervisor/arm/pvtime:starting",115115- init_stolen_time_cpu, stolen_time_dying_cpu);110110+ ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,111111+ "hypervisor/arm/pvtime:online",112112+ stolen_time_cpu_online,113113+ stolen_time_cpu_down_prepare);116114 if (ret < 0)117115 return ret;118116 return 0;119117}120118121121-static bool has_pv_steal_clock(void)119119+static bool __init has_pv_steal_clock(void)122120{123121 struct arm_smccc_res res;124122
+31-12
arch/arm64/net/bpf_jit_comp.c
···143143 }144144}145145146146-static inline int bpf2a64_offset(int bpf_to, int bpf_from,146146+static inline int bpf2a64_offset(int bpf_insn, int off,147147 const struct jit_ctx *ctx)148148{149149- int to = ctx->offset[bpf_to];150150- /* -1 to account for the Branch instruction */151151- int from = ctx->offset[bpf_from] - 1;152152-153153- return to - from;149149+ /* BPF JMP offset is relative to the next instruction */150150+ bpf_insn++;151151+ /*152152+ * Whereas arm64 branch instructions encode the offset153153+ * from the branch itself, so we must subtract 1 from the154154+ * instruction offset.155155+ */156156+ return ctx->offset[bpf_insn + off] - (ctx->offset[bpf_insn] - 1);154157}155158156159static void jit_fill_hole(void *area, unsigned int size)···645642646643 /* JUMP off */647644 case BPF_JMP | BPF_JA:648648- jmp_offset = bpf2a64_offset(i + off, i, ctx);645645+ jmp_offset = bpf2a64_offset(i, off, ctx);649646 check_imm26(jmp_offset);650647 emit(A64_B(jmp_offset), ctx);651648 break;···672669 case BPF_JMP32 | BPF_JSLE | BPF_X:673670 emit(A64_CMP(is64, dst, src), ctx);674671emit_cond_jmp:675675- jmp_offset = bpf2a64_offset(i + off, i, ctx);672672+ jmp_offset = bpf2a64_offset(i, off, ctx);676673 check_imm19(jmp_offset);677674 switch (BPF_OP(code)) {678675 case BPF_JEQ:···911908 const struct bpf_prog *prog = ctx->prog;912909 int i;913910911911+ /*912912+ * - offset[0] offset of the end of prologue,913913+ * start of the 1st instruction.914914+ * - offset[1] - offset of the end of 1st instruction,915915+ * start of the 2nd instruction916916+ * [....]917917+ * - offset[3] - offset of the end of 3rd instruction,918918+ * start of 4th instruction919919+ */914920 for (i = 0; i < prog->len; i++) {915921 const struct bpf_insn *insn = &prog->insnsi[i];916922 int ret;917923924924+ if (ctx->image == NULL)925925+ ctx->offset[i] = ctx->idx;918926 ret = build_insn(insn, ctx, extra_pass);919927 if (ret > 0) {920928 i++;···933919 ctx->offset[i] = ctx->idx;934920 continue;935921 }936936- if (ctx->image == NULL)937937- ctx->offset[i] = ctx->idx;938922 if (ret)939923 return ret;940924 }925925+ /*926926+ * offset is allocated with prog->len + 1 so fill in927927+ * the last element with the offset after the last928928+ * instruction (end of program)929929+ */930930+ if (ctx->image == NULL)931931+ ctx->offset[i] = ctx->idx;941932942933 return 0;943934}···10211002 memset(&ctx, 0, sizeof(ctx));10221003 ctx.prog = prog;1023100410241024- ctx.offset = kcalloc(prog->len, sizeof(int), GFP_KERNEL);10051005+ ctx.offset = kcalloc(prog->len + 1, sizeof(int), GFP_KERNEL);10251006 if (ctx.offset == NULL) {10261007 prog = orig_prog;10271008 goto out_off;···11081089 prog->jited_len = prog_size;1109109011101091 if (!prog->is_func || extra_pass) {11111111- bpf_prog_fill_jited_linfo(prog, ctx.offset);10921092+ bpf_prog_fill_jited_linfo(prog, ctx.offset + 1);11121093out_off:11131094 kfree(ctx.offset);11141095 kfree(jit_data);
···108108CONFIG_FB_NVIDIA_I2C=y109109CONFIG_FB_RADEON=y110110# CONFIG_LCD_CLASS_DEVICE is not set111111-CONFIG_VGACON_SOFT_SCROLLBACK=y112111CONFIG_LOGO=y113112CONFIG_SOUND=y114113CONFIG_SND=y
···239239240240extern void hash__setup_initial_memory_limit(phys_addr_t first_memblock_base,241241 phys_addr_t first_memblock_size);242242-extern void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,243243- phys_addr_t first_memblock_size);244242static inline void setup_initial_memory_limit(phys_addr_t first_memblock_base,245243 phys_addr_t first_memblock_size)246244{247247- if (early_radix_enabled())248248- return radix__setup_initial_memory_limit(first_memblock_base,249249- first_memblock_size);245245+ /*246246+ * Hash has more strict restrictions. At this point we don't247247+ * know which translations we will pick. Hence go with hash248248+ * restrictions.249249+ */250250 return hash__setup_initial_memory_limit(first_memblock_base,251251 first_memblock_size);252252}
···734734 }735735}736736737737-void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,738738- phys_addr_t first_memblock_size)739739-{740740- /*741741- * We don't currently support the first MEMBLOCK not mapping 0742742- * physical on those processors743743- */744744- BUG_ON(first_memblock_base != 0);745745-746746- /*747747- * Radix mode is not limited by RMA / VRMA addressing.748748- */749749- ppc64_rma_size = ULONG_MAX;750750-}751751-752737#ifdef CONFIG_MEMORY_HOTPLUG753738static void free_pte_table(pte_t *pte_start, pmd_t *pmd)754739{
+9-2
arch/powerpc/mm/init_64.c
···433433 if (!(mfmsr() & MSR_HV))434434 early_check_vec5();435435436436- if (early_radix_enabled())436436+ if (early_radix_enabled()) {437437 radix__early_init_devtree();438438- else438438+ /*439439+ * We have finalized the translation we are going to use by now.440440+ * Radix mode is not limited by RMA / VRMA addressing.441441+ * Hence don't limit memblock allocations.442442+ */443443+ ppc64_rma_size = ULONG_MAX;444444+ memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE);445445+ } else439446 hash__early_init_devtree();440447}441448#endif /* CONFIG_PPC_BOOK3S_64 */
···11+/* SPDX-License-Identifier: GPL-2.0-only */22+/*33+ * Copyright (C) 2020 Google, Inc44+ */55+66+#ifndef _ASM_RISCV_CLINT_H77+#define _ASM_RISCV_CLINT_H88+99+#include <linux/types.h>1010+#include <asm/mmio.h>1111+1212+#ifdef CONFIG_RISCV_M_MODE1313+/*1414+ * This lives in the CLINT driver, but is accessed directly by timex.h to avoid1515+ * any overhead when accessing the MMIO timer.1616+ *1717+ * The ISA defines mtime as a 64-bit memory-mapped register that increments at1818+ * a constant frequency, but it doesn't define some other constraints we depend1919+ * on (most notably ordering constraints, but also some simpler stuff like the2020+ * memory layout). Thus, this is called "clint_time_val" instead of something2121+ * like "riscv_mtime", to signify that these non-ISA assumptions must hold.2222+ */2323+extern u64 __iomem *clint_time_val;2424+#endif2525+2626+#endif
+7
arch/riscv/include/asm/ftrace.h
···6666 * Let auipc+jalr be the basic *mcount unit*, so we make it 8 bytes here.6767 */6868#define MCOUNT_INSN_SIZE 86969+7070+#ifndef __ASSEMBLY__7171+struct dyn_ftrace;7272+int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);7373+#define ftrace_init_nop ftrace_init_nop7474+#endif7575+6976#endif70777178#endif /* _ASM_RISCV_FTRACE_H */
···9797 return __ftrace_modify_call(rec->ip, addr, false);9898}9999100100+101101+/*102102+ * This is called early on, and isn't wrapped by103103+ * ftrace_arch_code_modify_{prepare,post_process}() and therefor doesn't hold104104+ * text_mutex, which triggers a lockdep failure. SMP isn't running so we could105105+ * just directly poke the text, but it's simpler to just take the lock106106+ * ourselves.107107+ */108108+int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec)109109+{110110+ int out;111111+112112+ ftrace_arch_code_modify_prepare();113113+ out = ftrace_make_nop(mod, rec, MCOUNT_ADDR);114114+ ftrace_arch_code_modify_post_process();115115+116116+ return out;117117+}118118+100119int ftrace_update_ftrace_func(ftrace_func_t func)101120{102121 int ret = __ftrace_modify_call((unsigned long)&ftrace_call,
···619619/*620620 * Make sure that the area behind memory_end is protected621621 */622622-static void reserve_memory_end(void)622622+static void __init reserve_memory_end(void)623623{624624 if (memory_end_set)625625 memblock_reserve(memory_end, ULONG_MAX);···628628/*629629 * Make sure that oldmem, where the dump is stored, is protected630630 */631631-static void reserve_oldmem(void)631631+static void __init reserve_oldmem(void)632632{633633#ifdef CONFIG_CRASH_DUMP634634 if (OLDMEM_BASE)···640640/*641641 * Make sure that oldmem, where the dump is stored, is protected642642 */643643-static void remove_oldmem(void)643643+static void __init remove_oldmem(void)644644{645645#ifdef CONFIG_CRASH_DUMP646646 if (OLDMEM_BASE)
+20
arch/s390/mm/fault.c
···859859}860860NOKPROBE_SYMBOL(do_non_secure_storage_access);861861862862+void do_secure_storage_violation(struct pt_regs *regs)863863+{864864+ /*865865+ * Either KVM messed up the secure guest mapping or the same866866+ * page is mapped into multiple secure guests.867867+ *868868+ * This exception is only triggered when a guest 2 is running869869+ * and can therefore never occur in kernel context.870870+ */871871+ printk_ratelimited(KERN_WARNING872872+ "Secure storage violation in task: %s, pid %d\n",873873+ current->comm, current->pid);874874+ send_sig(SIGSEGV, current, 0);875875+}876876+862877#else863878void do_secure_storage_access(struct pt_regs *regs)864879{···881866}882867883868void do_non_secure_storage_access(struct pt_regs *regs)869869+{870870+ default_trap_handler(regs);871871+}872872+873873+void do_secure_storage_violation(struct pt_regs *regs)884874{885875 default_trap_handler(regs);886876}
+4
arch/s390/pci/pci.c
···668668int zpci_disable_device(struct zpci_dev *zdev)669669{670670 zpci_dma_exit_device(zdev);671671+ /*672672+ * The zPCI function may already be disabled by the platform, this is673673+ * detected in clp_disable_fh() which becomes a no-op.674674+ */671675 return clp_disable_fh(zdev);672676}673677EXPORT_SYMBOL_GPL(zpci_disable_device);
+2
arch/s390/pci/pci_event.c
···143143 zpci_remove_device(zdev);144144 }145145146146+ zdev->fh = ccdf->fh;147147+ zpci_disable_device(zdev);146148 zdev->state = ZPCI_FN_STATE_STANDBY;147149 if (!clp_get_state(ccdf->fid, &state) &&148150 state == ZPCI_FN_STATE_RESERVED) {
···370370 nop371371 cmp/eq #-1, r0372372 bt syscall_exit373373- mov.l r0, @(OFF_R0,r15) ! Save return value374373 ! Reload R0-R4 from kernel stack, where the375374 ! parent may have modified them using376375 ! ptrace(POKEUSR). (Note that R0-R2 are
+5-10
arch/sh/kernel/ptrace_32.c
···455455456456asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)457457{458458- long ret = 0;459459-460458 if (test_thread_flag(TIF_SYSCALL_TRACE) &&461461- tracehook_report_syscall_entry(regs))462462- /*463463- * Tracing decided this syscall should not happen.464464- * We'll return a bogus call number to get an ENOSYS465465- * error, but leave the original number in regs->regs[0].466466- */467467- ret = -1L;459459+ tracehook_report_syscall_entry(regs)) {460460+ regs->regs[0] = -ENOSYS;461461+ return -1;462462+ }468463469464 if (secure_computing() == -1)470465 return -1;···470475 audit_syscall_entry(regs->regs[3], regs->regs[4], regs->regs[5],471476 regs->regs[6], regs->regs[7]);472477473473- return ret ?: regs->regs[0];478478+ return 0;474479}475480476481asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
+2
arch/x86/boot/compressed/Makefile
···4343KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)4444KBUILD_CFLAGS += -fno-asynchronous-unwind-tables4545KBUILD_CFLAGS += -D__DISABLE_EXPORTS4646+# Disable relocation relaxation in case the link is not PIE.4747+KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no)46484749KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__4850GCOV_PROFILE := n
+1-1
arch/x86/configs/i386_defconfig
···1919CONFIG_BLK_DEV_INITRD=y2020# CONFIG_COMPAT_BRK is not set2121CONFIG_PROFILING=y2222+# CONFIG_64BIT is not set2223CONFIG_SMP=y2324CONFIG_X86_GENERIC=y2425CONFIG_HPET_TIMER=y···187186CONFIG_FB_MODE_HELPERS=y188187CONFIG_FB_TILEBLITTING=y189188CONFIG_FB_EFI=y190190-CONFIG_VGACON_SOFT_SCROLLBACK=y191189CONFIG_LOGO=y192190# CONFIG_LOGO_LINUX_MONO is not set193191# CONFIG_LOGO_LINUX_VGA16 is not set
-1
arch/x86/configs/x86_64_defconfig
···181181CONFIG_FB_MODE_HELPERS=y182182CONFIG_FB_TILEBLITTING=y183183CONFIG_FB_EFI=y184184-CONFIG_VGACON_SOFT_SCROLLBACK=y185184CONFIG_LOGO=y186185# CONFIG_LOGO_LINUX_MONO is not set187186# CONFIG_LOGO_LINUX_VGA16 is not set
···161161}162162163163/* Power(C) State timer broadcast control */164164-static void lapic_timer_state_broadcast(struct acpi_processor *pr,165165- struct acpi_processor_cx *cx,166166- int broadcast)164164+static bool lapic_timer_needs_broadcast(struct acpi_processor *pr,165165+ struct acpi_processor_cx *cx)167166{168168- int state = cx - pr->power.states;169169-170170- if (state >= pr->power.timer_broadcast_on_state) {171171- if (broadcast)172172- tick_broadcast_enter();173173- else174174- tick_broadcast_exit();175175- }167167+ return cx - pr->power.states >= pr->power.timer_broadcast_on_state;176168}177169178170#else···172180static void lapic_timer_check_state(int state, struct acpi_processor *pr,173181 struct acpi_processor_cx *cstate) { }174182static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { }175175-static void lapic_timer_state_broadcast(struct acpi_processor *pr,176176- struct acpi_processor_cx *cx,177177- int broadcast)183183+184184+static bool lapic_timer_needs_broadcast(struct acpi_processor *pr,185185+ struct acpi_processor_cx *cx)178186{179187}180188···558566559567/**560568 * acpi_idle_enter_bm - enters C3 with proper BM handling569569+ * @drv: cpuidle driver561570 * @pr: Target processor562571 * @cx: Target state context563563- * @timer_bc: Whether or not to change timer mode to broadcast572572+ * @index: index of target state564573 */565565-static void acpi_idle_enter_bm(struct acpi_processor *pr,566566- struct acpi_processor_cx *cx, bool timer_bc)574574+static int acpi_idle_enter_bm(struct cpuidle_driver *drv,575575+ struct acpi_processor *pr,576576+ struct acpi_processor_cx *cx,577577+ int index)567578{568568- acpi_unlazy_tlb(smp_processor_id());569569-570570- /*571571- * Must be done before busmaster disable as we might need to572572- * access HPET !573573- */574574- if (timer_bc)575575- lapic_timer_state_broadcast(pr, cx, 1);579579+ static struct acpi_processor_cx safe_cx = {580580+ .entry_method = ACPI_CSTATE_HALT,581581+ };576582577583 /*578584 * disable bus master579585 * bm_check implies we need ARB_DIS580586 * bm_control implies whether we can do ARB_DIS581587 *582582- * That leaves a case where bm_check is set and bm_control is583583- * not set. In that case we cannot do much, we enter C3584584- * without doing anything.588588+ * That leaves a case where bm_check is set and bm_control is not set.589589+ * In that case we cannot do much, we enter C3 without doing anything.585590 */586586- if (pr->flags.bm_control) {591591+ bool dis_bm = pr->flags.bm_control;592592+593593+ /* If we can skip BM, demote to a safe state. */594594+ if (!cx->bm_sts_skip && acpi_idle_bm_check()) {595595+ dis_bm = false;596596+ index = drv->safe_state_index;597597+ if (index >= 0) {598598+ cx = this_cpu_read(acpi_cstate[index]);599599+ } else {600600+ cx = &safe_cx;601601+ index = -EBUSY;602602+ }603603+ }604604+605605+ if (dis_bm) {587606 raw_spin_lock(&c3_lock);588607 c3_cpu_count++;589608 /* Disable bus master arbitration when all CPUs are in C3 */···603600 raw_spin_unlock(&c3_lock);604601 }605602603603+ rcu_idle_enter();604604+606605 acpi_idle_do_entry(cx);607606607607+ rcu_idle_exit();608608+608609 /* Re-enable bus master arbitration */609609- if (pr->flags.bm_control) {610610+ if (dis_bm) {610611 raw_spin_lock(&c3_lock);611612 acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);612613 c3_cpu_count--;613614 raw_spin_unlock(&c3_lock);614615 }615616616616- if (timer_bc)617617- lapic_timer_state_broadcast(pr, cx, 0);617617+ return index;618618}619619620620static int acpi_idle_enter(struct cpuidle_device *dev,···631625 return -EINVAL;632626633627 if (cx->type != ACPI_STATE_C1) {628628+ if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check)629629+ return acpi_idle_enter_bm(drv, pr, cx, index);630630+631631+ /* C2 to C1 demotion. */634632 if (acpi_idle_fallback_to_c1(pr) && num_online_cpus() > 1) {635633 index = ACPI_IDLE_STATE_START;636634 cx = per_cpu(acpi_cstate[index], dev->cpu);637637- } else if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check) {638638- if (cx->bm_sts_skip || !acpi_idle_bm_check()) {639639- acpi_idle_enter_bm(pr, cx, true);640640- return index;641641- } else if (drv->safe_state_index >= 0) {642642- index = drv->safe_state_index;643643- cx = per_cpu(acpi_cstate[index], dev->cpu);644644- } else {645645- acpi_safe_halt();646646- return -EBUSY;647647- }648635 }649636 }650650-651651- lapic_timer_state_broadcast(pr, cx, 1);652637653638 if (cx->type == ACPI_STATE_C3)654639 ACPI_FLUSH_CPU_CACHE();655640656641 acpi_idle_do_entry(cx);657657-658658- lapic_timer_state_broadcast(pr, cx, 0);659642660643 return index;661644}···661666 return 0;662667663668 if (pr->flags.bm_check) {664664- acpi_idle_enter_bm(pr, cx, false);669669+ u8 bm_sts_skip = cx->bm_sts_skip;670670+671671+ /* Don't check BM_STS, do an unconditional ARB_DIS for S2IDLE */672672+ cx->bm_sts_skip = 1;673673+ acpi_idle_enter_bm(drv, pr, cx, index);674674+ cx->bm_sts_skip = bm_sts_skip;675675+665676 return 0;666677 } else {667678 ACPI_FLUSH_CPU_CACHE();···683682{684683 int i, count = ACPI_IDLE_STATE_START;685684 struct acpi_processor_cx *cx;685685+ struct cpuidle_state *state;686686687687 if (max_cstate == 0)688688 max_cstate = 1;689689690690 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {691691+ state = &acpi_idle_driver.states[count];691692 cx = &pr->power.states[i];692693693694 if (!cx->valid)694695 continue;695696696697 per_cpu(acpi_cstate[count], dev->cpu) = cx;698698+699699+ if (lapic_timer_needs_broadcast(pr, cx))700700+ state->flags |= CPUIDLE_FLAG_TIMER_STOP;701701+702702+ if (cx->type == ACPI_STATE_C3) {703703+ state->flags |= CPUIDLE_FLAG_TLB_FLUSHED;704704+ if (pr->flags.bm_check)705705+ state->flags |= CPUIDLE_FLAG_RCU_IDLE;706706+ }697707698708 count++;699709 if (count == CPUIDLE_STATE_MAX)
+1
drivers/clk/bcm/Kconfig
···55 depends on ARCH_BCM2835 ||COMPILE_TEST66 depends on COMMON_CLK77 default ARCH_BCM283588+ select RESET_CONTROLLER89 select RESET_SIMPLE910 help1011 Enable common clock framework support for the Broadcom BCM2711
···109109110110 for_each_available_child_of_node(np, child) {111111 ret = integrator_impd1_clk_spawn(dev, np, child);112112- if (ret)112112+ if (ret) {113113+ of_node_put(child);113114 break;115115+ }114116 }115117116118 return ret;
+17
drivers/clocksource/timer-clint.c
···1919#include <linux/interrupt.h>2020#include <linux/of_irq.h>2121#include <linux/smp.h>2222+#include <linux/timex.h>2323+2424+#ifndef CONFIG_RISCV_M_MODE2525+#include <asm/clint.h>2626+#endif22272328#define CLINT_IPI_OFF 02429#define CLINT_TIMER_CMP_OFF 0x4000···3530static u64 __iomem *clint_timer_val;3631static unsigned long clint_timer_freq;3732static unsigned int clint_timer_irq;3333+3434+#ifdef CONFIG_RISCV_M_MODE3535+u64 __iomem *clint_time_val;3636+#endif38373938static void clint_send_ipi(const struct cpumask *target)4039{···192183 clint_timer_cmp = base + CLINT_TIMER_CMP_OFF;193184 clint_timer_val = base + CLINT_TIMER_VAL_OFF;194185 clint_timer_freq = riscv_timebase;186186+187187+#ifdef CONFIG_RISCV_M_MODE188188+ /*189189+ * Yes, that's an odd naming scheme. time_val is public, but hopefully190190+ * will die in favor of something cleaner.191191+ */192192+ clint_time_val = clint_timer_val;193193+#endif195194196195 pr_info("%pOFP: timer running at %ld Hz\n", np, clint_timer_freq);197196
+11-4
drivers/cpuidle/cpuidle-pseries.c
···361361 for (i = 0; i < nr_xcede_records; i++) {362362 struct xcede_latency_record *record = &payload->records[i];363363 u64 latency_tb = be64_to_cpu(record->latency_ticks);364364- u64 latency_us = tb_to_ns(latency_tb) / NSEC_PER_USEC;364364+ u64 latency_us = DIV_ROUND_UP_ULL(tb_to_ns(latency_tb), NSEC_PER_USEC);365365+366366+ if (latency_us == 0)367367+ pr_warn("cpuidle: xcede record %d has an unrealistic latency of 0us.\n", i);365368366369 if (latency_us < min_latency_us)367370 min_latency_us = latency_us;···381378 * Perform the fix-up.382379 */383380 if (min_latency_us < dedicated_states[1].exit_latency) {384384- u64 cede0_latency = min_latency_us - 1;381381+ /*382382+ * We set a minimum of 1us wakeup latency for cede0 to383383+ * distinguish it from snooze384384+ */385385+ u64 cede0_latency = 1;385386386386- if (cede0_latency <= 0)387387- cede0_latency = min_latency_us;387387+ if (min_latency_us > cede0_latency)388388+ cede0_latency = min_latency_us - 1;388389389390 dedicated_states[1].exit_latency = cede0_latency;390391 dedicated_states[1].target_residency = 10 * (cede0_latency);
+10-5
drivers/cpuidle/cpuidle.c
···138138 struct cpuidle_device *dev, int index)139139{140140 ktime_t time_start, time_end;141141+ struct cpuidle_state *target_state = &drv->states[index];141142142143 time_start = ns_to_ktime(local_clock());143144···154153 * suspended is generally unsafe.155154 */156155 stop_critical_timings();157157- rcu_idle_enter();158158- drv->states[index].enter_s2idle(dev, drv, index);156156+ if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))157157+ rcu_idle_enter();158158+ target_state->enter_s2idle(dev, drv, index);159159 if (WARN_ON_ONCE(!irqs_disabled()))160160 local_irq_disable();161161 /*···164162 * first CPU executing it calls functions containing RCU read-side165163 * critical sections, so tell RCU about that.166164 */167167- rcu_idle_exit();165165+ if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))166166+ rcu_idle_exit();168167 tick_unfreeze();169168 start_critical_timings();170169···242239 time_start = ns_to_ktime(local_clock());243240244241 stop_critical_timings();245245- rcu_idle_enter();242242+ if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))243243+ rcu_idle_enter();246244 entered_state = target_state->enter(dev, drv, index);247247- rcu_idle_exit();245245+ if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))246246+ rcu_idle_exit();248247 start_critical_timings();249248250249 sched_clock_idle_wakeup_event();
+10-6
drivers/dax/super.c
···8585 return false;8686 }87878888+ if (!dax_dev) {8989+ pr_debug("%s: error: dax unsupported by block device\n",9090+ bdevname(bdev, buf));9191+ return false;9292+ }9393+8894 err = bdev_dax_pgoff(bdev, start, PAGE_SIZE, &pgoff);8995 if (err) {9096 pr_info("%s: error: unaligned partition for dax\n",···10296 err = bdev_dax_pgoff(bdev, last_page, PAGE_SIZE, &pgoff_end);10397 if (err) {10498 pr_info("%s: error: unaligned partition for dax\n",105105- bdevname(bdev, buf));106106- return false;107107- }108108-109109- if (!dax_dev || !bdev_dax_supported(bdev, blocksize)) {110110- pr_debug("%s: error: dax unsupported by block device\n",11199 bdevname(bdev, buf));112100 return false;113101 }···325325bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,326326 int blocksize, sector_t start, sector_t len)327327{328328+ if (!dax_dev)329329+ return false;330330+328331 if (!dax_alive(dax_dev))329332 return false;330333331334 return dax_dev->ops->dax_supported(dax_dev, bdev, blocksize, start, len);332335}336336+EXPORT_SYMBOL_GPL(dax_supported);333337334338size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,335339 size_t bytes, struct iov_iter *i)
+5
drivers/edac/ghes_edac.c
···508508 if (!force_load && idx < 0)509509 return -ENODEV;510510 } else {511511+ force_load = true;511512 idx = 0;512513 }513514···630629 struct mem_ctl_info *mci;631630 unsigned long flags;632631632632+ if (!force_load)633633+ return;634634+633635 mutex_lock(&ghes_reg_mutex);634636635637 system_scanned = false;638638+ memset(&ghes_hw, 0, sizeof(struct ghes_hw_desc));636639637640 if (!refcount_dec_and_test(&ghes_refcount))638641 goto unlock;
+1-1
drivers/firmware/efi/efibc.c
···8484{8585 int ret;86868787- if (!efi_enabled(EFI_RUNTIME_SERVICES))8787+ if (!efivars_kobject() || !efivar_supports_writes())8888 return -ENODEV;89899090 ret = register_reboot_notifier(&efibc_reboot_notifier);
+1-1
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
···178178 return ret;179179 }180180181181- if (adev->asic_type == CHIP_NAVI10) {181181+ if (adev->asic_type == CHIP_NAVI10 || adev->asic_type == CHIP_SIENNA_CICHLID) {182182 ret= psp_sysfs_init(adev);183183 if (ret) {184184 return ret;
···52785278{52795279}5280528052815281-static bool does_crtc_have_active_cursor(struct drm_crtc_state *new_crtc_state)52825282-{52835283- struct drm_device *dev = new_crtc_state->crtc->dev;52845284- struct drm_plane *plane;52855285-52865286- drm_for_each_plane_mask(plane, dev, new_crtc_state->plane_mask) {52875287- if (plane->type == DRM_PLANE_TYPE_CURSOR)52885288- return true;52895289- }52905290-52915291- return false;52925292-}52935293-52945281static int count_crtc_active_planes(struct drm_crtc_state *new_crtc_state)52955282{52965283 struct drm_atomic_state *state = new_crtc_state->state;···53415354 return ret;53425355 }5343535653575357+ /*53585358+ * We require the primary plane to be enabled whenever the CRTC is, otherwise53595359+ * drm_mode_cursor_universal may end up trying to enable the cursor plane while all other53605360+ * planes are disabled, which is not supported by the hardware. And there is legacy53615361+ * userspace which stops using the HW cursor altogether in response to the resulting EINVAL.53625362+ */53635363+ if (state->enable &&53645364+ !(state->plane_mask & drm_plane_mask(crtc->primary)))53655365+ return -EINVAL;53665366+53445367 /* In some use cases, like reset, no stream is attached */53455368 if (!dm_crtc_state->stream)53465369 return 0;53475347-53485348- /*53495349- * We want at least one hardware plane enabled to use53505350- * the stream with a cursor enabled.53515351- */53525352- if (state->enable && state->active &&53535353- does_crtc_have_active_cursor(state) &&53545354- dm_crtc_state->active_planes == 0)53555355- return -EINVAL;5356537053575371 if (dc_validate_stream(dc, dm_crtc_state->stream) == DC_OK)53585372 return 0;
···8888 enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;89899090 if (!psp->dtm_context.dtm_initialized) {9191- DRM_ERROR("Failed to add display topology, DTM TA is not initialized.");9191+ DRM_INFO("Failed to add display topology, DTM TA is not initialized.");9292 display->state = MOD_HDCP_DISPLAY_INACTIVE;9393 return MOD_HDCP_STATUS_FAILURE;9494 }
···439439 return __reset_engine(engine);440440}441441442442-static struct intel_engine_cs *__active_engine(struct i915_request *rq)442442+static bool443443+__active_engine(struct i915_request *rq, struct intel_engine_cs **active)443444{444445 struct intel_engine_cs *engine, *locked;446446+ bool ret = false;445447446448 /*447449 * Serialise with __i915_request_submit() so that it sees448450 * is-banned?, or we know the request is already inflight.451451+ *452452+ * Note that rq->engine is unstable, and so we double453453+ * check that we have acquired the lock on the final engine.449454 */450455 locked = READ_ONCE(rq->engine);451456 spin_lock_irq(&locked->active.lock);452457 while (unlikely(locked != (engine = READ_ONCE(rq->engine)))) {453458 spin_unlock(&locked->active.lock);454454- spin_lock(&engine->active.lock);455459 locked = engine;460460+ spin_lock(&locked->active.lock);456461 }457462458458- engine = NULL;459459- if (i915_request_is_active(rq) && rq->fence.error != -EIO)460460- engine = rq->engine;463463+ if (!i915_request_completed(rq)) {464464+ if (i915_request_is_active(rq) && rq->fence.error != -EIO)465465+ *active = locked;466466+ ret = true;467467+ }461468462469 spin_unlock_irq(&locked->active.lock);463470464464- return engine;471471+ return ret;465472}466473467474static struct intel_engine_cs *active_engine(struct intel_context *ce)···479472 if (!ce->timeline)480473 return NULL;481474482482- mutex_lock(&ce->timeline->mutex);483483- list_for_each_entry_reverse(rq, &ce->timeline->requests, link) {484484- if (i915_request_completed(rq))485485- break;475475+ rcu_read_lock();476476+ list_for_each_entry_rcu(rq, &ce->timeline->requests, link) {477477+ if (i915_request_is_active(rq) && i915_request_completed(rq))478478+ continue;486479487480 /* Check with the backend if the request is inflight */488488- engine = __active_engine(rq);489489- if (engine)481481+ if (__active_engine(rq, &engine))490482 break;491483 }492492- mutex_unlock(&ce->timeline->mutex);484484+ rcu_read_unlock();493485494486 return engine;495487}···719713 ctx->i915 = i915;720714 ctx->sched.priority = I915_USER_PRIORITY(I915_PRIORITY_NORMAL);721715 mutex_init(&ctx->mutex);716716+ INIT_LIST_HEAD(&ctx->link);722717723718 spin_lock_init(&ctx->stale.lock);724719 INIT_LIST_HEAD(&ctx->stale.engines);···746739747740 for (i = 0; i < ARRAY_SIZE(ctx->hang_timestamp); i++)748741 ctx->hang_timestamp[i] = jiffies - CONTEXT_FAST_HANG_JIFFIES;749749-750750- spin_lock(&i915->gem.contexts.lock);751751- list_add_tail(&ctx->link, &i915->gem.contexts.list);752752- spin_unlock(&i915->gem.contexts.lock);753742754743 return ctx;755744···934931 struct drm_i915_file_private *fpriv,935932 u32 *id)936933{934934+ struct drm_i915_private *i915 = ctx->i915;937935 struct i915_address_space *vm;938936 int ret;939937···953949 /* And finally expose ourselves to userspace via the idr */954950 ret = xa_alloc(&fpriv->context_xa, id, ctx, xa_limit_32b, GFP_KERNEL);955951 if (ret)956956- put_pid(fetch_and_zero(&ctx->pid));952952+ goto err_pid;957953954954+ spin_lock(&i915->gem.contexts.lock);955955+ list_add_tail(&ctx->link, &i915->gem.contexts.list);956956+ spin_unlock(&i915->gem.contexts.lock);957957+958958+ return 0;959959+960960+err_pid:961961+ put_pid(fetch_and_zero(&ctx->pid));958962 return ret;959963}960964
+11-4
drivers/gpu/drm/i915/gt/intel_lrc.c
···20602060 memset_p((void **)ports, NULL, count);20612061}2062206220632063+static inline void20642064+copy_ports(struct i915_request **dst, struct i915_request **src, int count)20652065+{20662066+ /* A memcpy_p() would be very useful here! */20672067+ while (count--)20682068+ WRITE_ONCE(*dst++, *src++); /* avoid write tearing */20692069+}20702070+20632071static void execlists_dequeue(struct intel_engine_cs *engine)20642072{20652073 struct intel_engine_execlists * const execlists = &engine->execlists;···2656264826572649 /* switch pending to inflight */26582650 GEM_BUG_ON(!assert_pending_valid(execlists, "promote"));26592659- memcpy(execlists->inflight,26602660- execlists->pending,26612661- execlists_num_ports(execlists) *26622662- sizeof(*execlists->pending));26512651+ copy_ports(execlists->inflight,26522652+ execlists->pending,26532653+ execlists_num_ports(execlists));26632654 smp_wmb(); /* complete the seqlock */26642655 WRITE_ONCE(execlists->active, execlists->inflight);26652656
+23-2
drivers/gpu/drm/i915/i915_request.c
···388388 * As we know that there are always preemption points between389389 * requests, we know that only the currently executing request390390 * may be still active even though we have cleared the flag.391391- * However, we can't rely on our tracking of ELSP[0] to known391391+ * However, we can't rely on our tracking of ELSP[0] to know392392 * which request is currently active and so maybe stuck, as393393 * the tracking maybe an event behind. Instead assume that394394 * if the context is still inflight, then it is still active395395 * even if the active flag has been cleared.396396+ *397397+ * To further complicate matters, if there a pending promotion, the HW398398+ * may either perform a context switch to the second inflight execlists,399399+ * or it may switch to the pending set of execlists. In the case of the400400+ * latter, it may send the ACK and we process the event copying the401401+ * pending[] over top of inflight[], _overwriting_ our *active. Since402402+ * this implies the HW is arbitrating and not struck in *active, we do403403+ * not worry about complete accuracy, but we do require no read/write404404+ * tearing of the pointer [the read of the pointer must be valid, even405405+ * as the array is being overwritten, for which we require the writes406406+ * to avoid tearing.]407407+ *408408+ * Note that the read of *execlists->active may race with the promotion409409+ * of execlists->pending[] to execlists->inflight[], overwritting410410+ * the value at *execlists->active. This is fine. The promotion implies411411+ * that we received an ACK from the HW, and so the context is not412412+ * stuck -- if we do not see ourselves in *active, the inflight status413413+ * is valid. If instead we see ourselves being copied into *active,414414+ * we are inflight and may signal the callback.396415 */397416 if (!intel_context_inflight(signal->context))398417 return false;399418400419 rcu_read_lock();401401- for (port = __engine_active(signal->engine); (rq = *port); port++) {420420+ for (port = __engine_active(signal->engine);421421+ (rq = READ_ONCE(*port)); /* may race with promotion of pending[] */422422+ port++) {402423 if (rq->context == signal->context) {403424 inflight = i915_seqno_passed(rq->fence.seqno,404425 signal->fence.seqno);
+7-3
drivers/gpu/drm/i915/i915_sw_fence.c
···164164165165 do {166166 list_for_each_entry_safe(pos, next, &x->head, entry) {167167- pos->func(pos,168168- TASK_NORMAL, fence->error,169169- &extra);167167+ int wake_flags;168168+169169+ wake_flags = fence->error;170170+ if (pos->func == autoremove_wake_function)171171+ wake_flags = 0;172172+173173+ pos->func(pos, TASK_NORMAL, wake_flags, &extra);170174 }171175172176 if (list_empty(&extra))
+13-7
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
···831831 drm_crtc_index(&mtk_crtc->base));832832 mtk_crtc->cmdq_client = NULL;833833 }834834- ret = of_property_read_u32_index(priv->mutex_node,835835- "mediatek,gce-events",836836- drm_crtc_index(&mtk_crtc->base),837837- &mtk_crtc->cmdq_event);838838- if (ret)839839- dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events property\n",840840- drm_crtc_index(&mtk_crtc->base));834834+835835+ if (mtk_crtc->cmdq_client) {836836+ ret = of_property_read_u32_index(priv->mutex_node,837837+ "mediatek,gce-events",838838+ drm_crtc_index(&mtk_crtc->base),839839+ &mtk_crtc->cmdq_event);840840+ if (ret) {841841+ dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events property\n",842842+ drm_crtc_index(&mtk_crtc->base));843843+ cmdq_mbox_destroy(mtk_crtc->cmdq_client);844844+ mtk_crtc->cmdq_client = NULL;845845+ }846846+ }841847#endif842848 return 0;843849}
···27272828#include "mtk_drm_crtc.h"2929#include "mtk_drm_ddp.h"3030-#include "mtk_drm_ddp.h"3130#include "mtk_drm_ddp_comp.h"3231#include "mtk_drm_drv.h"3332#include "mtk_drm_gem.h"···164165165166 ret = drmm_mode_config_init(drm);166167 if (ret)167167- return ret;168168+ goto put_mutex_dev;168169169170 drm->mode_config.min_width = 64;170171 drm->mode_config.min_height = 64;···181182182183 ret = component_bind_all(drm->dev, drm);183184 if (ret)184184- return ret;185185+ goto put_mutex_dev;185186186187 /*187188 * We currently support two fixed data streams, each optional,···228229 }229230 if (!dma_dev->dma_parms) {230231 ret = -ENOMEM;231231- goto err_component_unbind;232232+ goto put_dma_dev;232233 }233234234235 ret = dma_set_max_seg_size(dma_dev, (unsigned int)DMA_BIT_MASK(32));···255256err_unset_dma_parms:256257 if (private->dma_parms_allocated)257258 dma_dev->dma_parms = NULL;259259+put_dma_dev:260260+ put_device(private->dma_dev);258261err_component_unbind:259262 component_unbind_all(drm->dev, drm);260260-263263+put_mutex_dev:264264+ put_device(private->mutex_dev);261265 return ret;262266}263267···546544 pm_runtime_disable(dev);547545err_node:548546 of_node_put(private->mutex_node);549549- for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)547547+ for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) {550548 of_node_put(private->comp_node[i]);549549+ if (private->ddp_comp[i]) {550550+ put_device(private->ddp_comp[i]->larb_dev);551551+ private->ddp_comp[i] = NULL;552552+ }553553+ }551554 return ret;552555}553556
···15071507 dev_err(dev,15081508 "Failed to get system configuration registers: %d\n",15091509 ret);15101510- return ret;15101510+ goto put_device;15111511 }15121512 hdmi->sys_regmap = regmap;1513151315141514 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);15151515 hdmi->regs = devm_ioremap_resource(dev, mem);15161516- if (IS_ERR(hdmi->regs))15171517- return PTR_ERR(hdmi->regs);15161516+ if (IS_ERR(hdmi->regs)) {15171517+ ret = PTR_ERR(hdmi->regs);15181518+ goto put_device;15191519+ }1518152015191521 remote = of_graph_get_remote_node(np, 1, 0);15201520- if (!remote)15211521- return -EINVAL;15221522+ if (!remote) {15231523+ ret = -EINVAL;15241524+ goto put_device;15251525+ }1522152615231527 if (!of_device_is_compatible(remote, "hdmi-connector")) {15241528 hdmi->next_bridge = of_drm_find_bridge(remote);15251529 if (!hdmi->next_bridge) {15261530 dev_err(dev, "Waiting for external bridge\n");15271531 of_node_put(remote);15281528- return -EPROBE_DEFER;15321532+ ret = -EPROBE_DEFER;15331533+ goto put_device;15291534 }15301535 }15311536···15391534 dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n",15401535 remote);15411536 of_node_put(remote);15421542- return -EINVAL;15371537+ ret = -EINVAL;15381538+ goto put_device;15431539 }15441540 of_node_put(remote);15451541···15481542 of_node_put(i2c_np);15491543 if (!hdmi->ddc_adpt) {15501544 dev_err(dev, "Failed to get ddc i2c adapter by node\n");15511551- return -EINVAL;15451545+ ret = -EINVAL;15461546+ goto put_device;15521547 }1553154815541549 return 0;15501550+put_device:15511551+ put_device(hdmi->cec_dev);15521552+ return ret;15551553}1556155415571555/*
+1-1
drivers/gpu/drm/radeon/radeon_display.c
···933933934934 /* get matching reference and feedback divider */935935 *ref_div = min(max(den/post_div, 1u), ref_div_max);936936- *fb_div = max(nom * *ref_div * post_div / den, 1u);936936+ *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den);937937938938 /* limit fb divider to its maximum */939939 if (*fb_div > fb_div_max) {
+5-2
drivers/hv/channel_mgmt.c
···731731 void *page_addr;732732 struct hv_message *msg;733733 struct vmbus_channel_message_header *hdr;734734- u32 message_type;734734+ u32 message_type, i;735735736736 /*737737 * CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was···741741 * functional and vmbus_unload_response() will complete742742 * vmbus_connection.unload_event. If not, the last thing we can do is743743 * read message pages for all CPUs directly.744744+ *745745+ * Wait no more than 10 seconds so that the panic path can't get746746+ * hung forever in case the response message isn't seen.744747 */745745- while (1) {748748+ for (i = 0; i < 1000; i++) {746749 if (completion_done(&vmbus_connection.unload_event))747750 break;748751
+7-2
drivers/hv/vmbus_drv.c
···23822382 if (atomic_read(&vmbus_connection.nr_chan_close_on_suspend) > 0)23832383 wait_for_completion(&vmbus_connection.ready_for_suspend_event);2384238423852385- WARN_ON(atomic_read(&vmbus_connection.nr_chan_fixup_on_resume) != 0);23852385+ if (atomic_read(&vmbus_connection.nr_chan_fixup_on_resume) != 0) {23862386+ pr_err("Can not suspend due to a previous failed resuming\n");23872387+ return -EBUSY;23882388+ }2386238923872390 mutex_lock(&vmbus_connection.channel_mutex);23882391···2459245624602457 vmbus_request_offers();2461245824622462- wait_for_completion(&vmbus_connection.ready_for_resume_event);24592459+ if (wait_for_completion_timeout(24602460+ &vmbus_connection.ready_for_resume_event, 10 * HZ) == 0)24612461+ pr_err("Some vmbus device is missing after suspending?\n");2463246224642463 /* Reset the event for the next suspend. */24652464 reinit_completion(&vmbus_connection.ready_for_suspend_event);
+2
drivers/i2c/busses/i2c-aspeed.c
···6969 * These share bit definitions, so use the same values for the enable &7070 * status bits.7171 */7272+#define ASPEED_I2CD_INTR_RECV_MASK 0xf000ffff7273#define ASPEED_I2CD_INTR_SDA_DL_TIMEOUT BIT(14)7374#define ASPEED_I2CD_INTR_BUS_RECOVER_DONE BIT(13)7475#define ASPEED_I2CD_INTR_SLAVE_MATCH BIT(7)···605604 writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE,606605 bus->base + ASPEED_I2C_INTR_STS_REG);607606 readl(bus->base + ASPEED_I2C_INTR_STS_REG);607607+ irq_received &= ASPEED_I2CD_INTR_RECV_MASK;608608 irq_remaining = irq_received;609609610610#if IS_ENABLED(CONFIG_I2C_SLAVE)
···19071907}1908190819091909/**19101910- * spi_nor_sr1_bit6_quad_enable() - Set/Unset the Quad Enable BIT(6) in the19111911- * Status Register 1.19101910+ * spi_nor_sr1_bit6_quad_enable() - Set the Quad Enable BIT(6) in the Status19111911+ * Register 1.19121912 * @nor: pointer to a 'struct spi_nor'19131913- * @enable: true to enable Quad mode, false to disable Quad mode.19141913 *19151914 * Bit 6 of the Status Register 1 is the QE bit for Macronix like QSPI memories.19161915 *19171916 * Return: 0 on success, -errno otherwise.19181917 */19191919-int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor, bool enable)19181918+int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor)19201919{19211920 int ret;19221921···19231924 if (ret)19241925 return ret;1925192619261926- if ((enable && (nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)) ||19271927- (!enable && !(nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)))19271927+ if (nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)19281928 return 0;1929192919301930- if (enable)19311931- nor->bouncebuf[0] |= SR1_QUAD_EN_BIT6;19321932- else19331933- nor->bouncebuf[0] &= ~SR1_QUAD_EN_BIT6;19301930+ nor->bouncebuf[0] |= SR1_QUAD_EN_BIT6;1934193119351932 return spi_nor_write_sr1_and_check(nor, nor->bouncebuf[0]);19361933}1937193419381935/**19391939- * spi_nor_sr2_bit1_quad_enable() - set/unset the Quad Enable BIT(1) in the19401940- * Status Register 2.19361936+ * spi_nor_sr2_bit1_quad_enable() - set the Quad Enable BIT(1) in the Status19371937+ * Register 2.19411938 * @nor: pointer to a 'struct spi_nor'.19421942- * @enable: true to enable Quad mode, false to disable Quad mode.19431939 *19441940 * Bit 1 of the Status Register 2 is the QE bit for Spansion like QSPI memories.19451941 *19461942 * Return: 0 on success, -errno otherwise.19471943 */19481948-int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor, bool enable)19441944+int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor)19491945{19501946 int ret;1951194719521948 if (nor->flags & SNOR_F_NO_READ_CR)19531953- return spi_nor_write_16bit_cr_and_check(nor,19541954- enable ? SR2_QUAD_EN_BIT1 : 0);19491949+ return spi_nor_write_16bit_cr_and_check(nor, SR2_QUAD_EN_BIT1);1955195019561951 ret = spi_nor_read_cr(nor, nor->bouncebuf);19571952 if (ret)19581953 return ret;1959195419601960- if ((enable && (nor->bouncebuf[0] & SR2_QUAD_EN_BIT1)) ||19611961- (!enable && !(nor->bouncebuf[0] & SR2_QUAD_EN_BIT1)))19551955+ if (nor->bouncebuf[0] & SR2_QUAD_EN_BIT1)19621956 return 0;1963195719641964- if (enable)19651965- nor->bouncebuf[0] |= SR2_QUAD_EN_BIT1;19661966- else19671967- nor->bouncebuf[0] &= ~SR2_QUAD_EN_BIT1;19581958+ nor->bouncebuf[0] |= SR2_QUAD_EN_BIT1;1968195919691960 return spi_nor_write_16bit_cr_and_check(nor, nor->bouncebuf[0]);19701961}1971196219721963/**19731973- * spi_nor_sr2_bit7_quad_enable() - set/unset QE bit in Status Register 2.19641964+ * spi_nor_sr2_bit7_quad_enable() - set QE bit in Status Register 2.19741965 * @nor: pointer to a 'struct spi_nor'19751975- * @enable: true to enable Quad mode, false to disable Quad mode.19761966 *19771967 * Set the Quad Enable (QE) bit in the Status Register 2.19781968 *···19711983 *19721984 * Return: 0 on success, -errno otherwise.19731985 */19741974-int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor, bool enable)19861986+int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor)19751987{19761988 u8 *sr2 = nor->bouncebuf;19771989 int ret;···19811993 ret = spi_nor_read_sr2(nor, sr2);19821994 if (ret)19831995 return ret;19841984- if ((enable && (*sr2 & SR2_QUAD_EN_BIT7)) ||19851985- (!enable && !(*sr2 & SR2_QUAD_EN_BIT7)))19961996+ if (*sr2 & SR2_QUAD_EN_BIT7)19861997 return 0;1987199819881999 /* Update the Quad Enable bit. */19891989- if (enable)19901990- *sr2 |= SR2_QUAD_EN_BIT7;19911991- else19921992- *sr2 &= ~SR2_QUAD_EN_BIT7;20002000+ *sr2 |= SR2_QUAD_EN_BIT7;1993200119942002 ret = spi_nor_write_sr2(nor, sr2);19952003 if (ret)···28982914}2899291529002916/**29012901- * spi_nor_quad_enable() - enable/disable Quad I/O if needed.29172917+ * spi_nor_quad_enable() - enable Quad I/O if needed.29022918 * @nor: pointer to a 'struct spi_nor'29032903- * @enable: true to enable Quad mode. false to disable Quad mode.29042919 *29052920 * Return: 0 on success, -errno otherwise.29062921 */29072907-static int spi_nor_quad_enable(struct spi_nor *nor, bool enable)29222922+static int spi_nor_quad_enable(struct spi_nor *nor)29082923{29092924 if (!nor->params->quad_enable)29102925 return 0;···29122929 spi_nor_get_protocol_width(nor->write_proto) == 4))29132930 return 0;2914293129152915- return nor->params->quad_enable(nor, enable);29322932+ return nor->params->quad_enable(nor);29162933}2917293429182935/**···29362953{29372954 int err;2938295529392939- err = spi_nor_quad_enable(nor, true);29562956+ err = spi_nor_quad_enable(nor);29402957 if (err) {29412958 dev_dbg(nor->dev, "quad mode not supported\n");29422959 return err;···29833000 if (nor->addr_width == 4 && !(nor->flags & SNOR_F_4B_OPCODES) &&29843001 nor->flags & SNOR_F_BROKEN_RESET)29853002 nor->params->set_4byte_addr_mode(nor, false);29862986-29872987- spi_nor_quad_enable(nor, false);29883003}29893004EXPORT_SYMBOL_GPL(spi_nor_restore);29903005
+5-5
drivers/mtd/spi-nor/core.h
···198198 * higher index in the array, the higher priority.199199 * @erase_map: the erase map parsed from the SFDP Sector Map Parameter200200 * Table.201201- * @quad_enable: enables/disables SPI NOR Quad mode.201201+ * @quad_enable: enables SPI NOR quad mode.202202 * @set_4byte_addr_mode: puts the SPI NOR in 4 byte addressing mode.203203 * @convert_addr: converts an absolute address into something the flash204204 * will understand. Particularly useful when pagesize is···219219220220 struct spi_nor_erase_map erase_map;221221222222- int (*quad_enable)(struct spi_nor *nor, bool enable);222222+ int (*quad_enable)(struct spi_nor *nor);223223 int (*set_4byte_addr_mode)(struct spi_nor *nor, bool enable);224224 u32 (*convert_addr)(struct spi_nor *nor, u32 addr);225225 int (*setup)(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps);···406406int spi_nor_wait_till_ready(struct spi_nor *nor);407407int spi_nor_lock_and_prep(struct spi_nor *nor);408408void spi_nor_unlock_and_unprep(struct spi_nor *nor);409409-int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor, bool enable);410410-int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor, bool enable);411411-int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor, bool enable);409409+int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor);410410+int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor);411411+int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor);412412413413int spi_nor_xread_sr(struct spi_nor *nor, u8 *sr);414414ssize_t spi_nor_read_data(struct spi_nor *nor, loff_t from, size_t len,
···19161916 return uart_console(port) && (port->cons->flags & CON_ENABLED);19171917}1918191819191919-static void __uart_port_spin_lock_init(struct uart_port *port)19191919+static void uart_port_spin_lock_init(struct uart_port *port)19201920{19211921 spin_lock_init(&port->lock);19221922 lockdep_set_class(&port->lock, &port_lock_key);19231923-}19241924-19251925-/*19261926- * Ensure that the serial console lock is initialised early.19271927- * If this port is a console, then the spinlock is already initialised.19281928- */19291929-static inline void uart_port_spin_lock_init(struct uart_port *port)19301930-{19311931- if (uart_console(port))19321932- return;19331933-19341934- __uart_port_spin_lock_init(port);19351923}1936192419371925#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL)···20742086 struct ktermios termios;20752087 static struct ktermios dummy;2076208820772077- uart_port_spin_lock_init(port);20892089+ /*20902090+ * Ensure that the serial-console lock is initialised early.20912091+ *20922092+ * Note that the console-enabled check is needed because of kgdboc,20932093+ * which can end up calling uart_set_options() for an already enabled20942094+ * console via tty_find_polling_driver() and uart_poll_init().20952095+ */20962096+ if (!uart_console_enabled(port) && !port->console_reinit)20972097+ uart_port_spin_lock_init(port);2078209820792099 memset(&termios, 0, sizeof(struct ktermios));20802100···2373237723742378 /* Power up port for set_mctrl() */23752379 uart_change_pm(state, UART_PM_STATE_ON);23762376-23772377- /*23782378- * If this driver supports console, and it hasn't been23792379- * successfully registered yet, initialise spin lock for it.23802380- */23812381- if (port->cons && !(port->cons->flags & CON_ENABLED))23822382- __uart_port_spin_lock_init(port);2383238023842381 /*23852382 * Ensure that the modem control lines are de-activated.···27902801 if (oldconsole && !newconsole) {27912802 ret = unregister_console(uport->cons);27922803 } else if (!oldconsole && newconsole) {27932793- if (uart_console(uport))28042804+ if (uart_console(uport)) {28052805+ uport->console_reinit = 1;27942806 register_console(uport->cons);27952795- else28072807+ } else {27962808 ret = -ENOENT;28092809+ }27972810 }27982811 } else {27992812 ret = -ENXIO;···28912900 goto out;28922901 }2893290228942894- uart_port_spin_lock_init(uport);29032903+ /*29042904+ * If this port is in use as a console then the spinlock is already29052905+ * initialised.29062906+ */29072907+ if (!uart_console_enabled(uport))29082908+ uart_port_spin_lock_init(uport);2895290928962910 if (uport->cons && uport->dev)28972911 of_console_check(uport->dev->of_node, uport->cons->name, uport->line);
+5
drivers/usb/class/usblp.c
···827827 if (rv < 0)828828 return rv;829829830830+ if (!usblp->present) {831831+ count = -ENODEV;832832+ goto done;833833+ }834834+830835 if ((avail = usblp->rstatus) < 0) {831836 printk(KERN_ERR "usblp%d: error %d reading from printer\n",832837 usblp->minor, (int)avail);
···176176static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)177177{178178 u8 response[4];179179+ int ret;179180180181 /*181182 * Error bit will always be 0 with the USBC command.182182- * Status can be checked from the response message.183183+ * Status can be checked from the response message if the184184+ * function intel_scu_ipc_dev_command succeeds.183185 */184184- intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg, len,185185- response, sizeof(response));186186+ ret = intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg,187187+ len, response, sizeof(response));188188+189189+ if (ret)190190+ return ret;191191+186192 if (response[2] & PMC_USB_RESP_STATUS_FAILURE) {187193 if (response[2] & PMC_USB_RESP_STATUS_FATAL)188194 return -EIO;
+16-6
drivers/usb/typec/ucsi/ucsi.c
···216216 con->partner_altmode[i] == altmode);217217}218218219219-static u8 ucsi_altmode_next_mode(struct typec_altmode **alt, u16 svid)219219+static int ucsi_altmode_next_mode(struct typec_altmode **alt, u16 svid)220220{221221 u8 mode = 1;222222 int i;223223224224- for (i = 0; alt[i]; i++)224224+ for (i = 0; alt[i]; i++) {225225+ if (i > MODE_DISCOVERY_MAX)226226+ return -ERANGE;227227+225228 if (alt[i]->svid == svid)226229 mode++;230230+ }227231228232 return mode;229233}···262258 goto err;263259 }264260265265- desc->mode = ucsi_altmode_next_mode(con->port_altmode,266266- desc->svid);261261+ ret = ucsi_altmode_next_mode(con->port_altmode, desc->svid);262262+ if (ret < 0)263263+ return ret;264264+265265+ desc->mode = ret;267266268267 switch (desc->svid) {269268 case USB_TYPEC_DP_SID:···299292 goto err;300293 }301294302302- desc->mode = ucsi_altmode_next_mode(con->partner_altmode,303303- desc->svid);295295+ ret = ucsi_altmode_next_mode(con->partner_altmode, desc->svid);296296+ if (ret < 0)297297+ return ret;298298+299299+ desc->mode = ret;304300305301 alt = typec_partner_register_altmode(con->partner, desc);306302 if (IS_ERR(alt)) {
+1-1
drivers/usb/typec/ucsi/ucsi_acpi.c
···7878 if (ret)7979 goto out_clear_bit;80808181- if (!wait_for_completion_timeout(&ua->complete, msecs_to_jiffies(5000)))8181+ if (!wait_for_completion_timeout(&ua->complete, 60 * HZ))8282 ret = -ETIMEDOUT;83838484out_clear_bit:
-46
drivers/video/console/Kconfig
···22222323 Say Y.24242525-config VGACON_SOFT_SCROLLBACK2626- bool "Enable Scrollback Buffer in System RAM"2727- depends on VGA_CONSOLE2828- default n2929- help3030- The scrollback buffer of the standard VGA console is located in3131- the VGA RAM. The size of this RAM is fixed and is quite small.3232- If you require a larger scrollback buffer, this can be placed in3333- System RAM which is dynamically allocated during initialization.3434- Placing the scrollback buffer in System RAM will slightly slow3535- down the console.3636-3737- If you want this feature, say 'Y' here and enter the amount of3838- RAM to allocate for this buffer. If unsure, say 'N'.3939-4040-config VGACON_SOFT_SCROLLBACK_SIZE4141- int "Scrollback Buffer Size (in KB)"4242- depends on VGACON_SOFT_SCROLLBACK4343- range 1 10244444- default "64"4545- help4646- Enter the amount of System RAM to allocate for scrollback4747- buffers of VGA consoles. Each 64KB will give you approximately4848- 16 80x25 screenfuls of scrollback buffer.4949-5050-config VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT5151- bool "Persistent Scrollback History for each console by default"5252- depends on VGACON_SOFT_SCROLLBACK5353- default n5454- help5555- Say Y here if the scrollback history should persist by default when5656- switching between consoles. Otherwise, the scrollback history will be5757- flushed each time the console is switched. This feature can also be5858- enabled using the boot command line parameter5959- 'vgacon.scrollback_persistent=1'.6060-6161- This feature might break your tool of choice to flush the scrollback6262- buffer, e.g. clear(1) will work fine but Debian's clear_console(1)6363- will be broken, which might cause security issues.6464- You can use the escape sequence \e[3J instead if this feature is6565- activated.6666-6767- Note that a buffer of VGACON_SOFT_SCROLLBACK_SIZE is taken for each6868- created tty device.6969- So if you use a RAM-constrained system, say N here.7070-7125config MDA_CONSOLE7226 depends on !M68K && !PARISC && ISA7327 tristate "MDA text console (dual-headed)"
+1-220
drivers/video/console/vgacon.c
···165165 write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2);166166}167167168168-#ifdef CONFIG_VGACON_SOFT_SCROLLBACK169169-/* software scrollback */170170-struct vgacon_scrollback_info {171171- void *data;172172- int tail;173173- int size;174174- int rows;175175- int cnt;176176- int cur;177177- int save;178178- int restore;179179-};180180-181181-static struct vgacon_scrollback_info *vgacon_scrollback_cur;182182-static struct vgacon_scrollback_info vgacon_scrollbacks[MAX_NR_CONSOLES];183183-static bool scrollback_persistent = \184184- IS_ENABLED(CONFIG_VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT);185185-module_param_named(scrollback_persistent, scrollback_persistent, bool, 0000);186186-MODULE_PARM_DESC(scrollback_persistent, "Enable persistent scrollback for all vga consoles");187187-188188-static void vgacon_scrollback_reset(int vc_num, size_t reset_size)189189-{190190- struct vgacon_scrollback_info *scrollback = &vgacon_scrollbacks[vc_num];191191-192192- if (scrollback->data && reset_size > 0)193193- memset(scrollback->data, 0, reset_size);194194-195195- scrollback->cnt = 0;196196- scrollback->tail = 0;197197- scrollback->cur = 0;198198-}199199-200200-static void vgacon_scrollback_init(int vc_num)201201-{202202- int pitch = vga_video_num_columns * 2;203203- size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;204204- int rows = size / pitch;205205- void *data;206206-207207- data = kmalloc_array(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024,208208- GFP_NOWAIT);209209-210210- vgacon_scrollbacks[vc_num].data = data;211211- vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num];212212-213213- vgacon_scrollback_cur->rows = rows - 1;214214- vgacon_scrollback_cur->size = rows * pitch;215215-216216- vgacon_scrollback_reset(vc_num, size);217217-}218218-219219-static void vgacon_scrollback_switch(int vc_num)220220-{221221- if (!scrollback_persistent)222222- vc_num = 0;223223-224224- if (!vgacon_scrollbacks[vc_num].data) {225225- vgacon_scrollback_init(vc_num);226226- } else {227227- if (scrollback_persistent) {228228- vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num];229229- } else {230230- size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;231231-232232- vgacon_scrollback_reset(vc_num, size);233233- }234234- }235235-}236236-237237-static void vgacon_scrollback_startup(void)238238-{239239- vgacon_scrollback_cur = &vgacon_scrollbacks[0];240240- vgacon_scrollback_init(0);241241-}242242-243243-static void vgacon_scrollback_update(struct vc_data *c, int t, int count)244244-{245245- void *p;246246-247247- if (!vgacon_scrollback_cur->data || !vgacon_scrollback_cur->size ||248248- c->vc_num != fg_console)249249- return;250250-251251- p = (void *) (c->vc_origin + t * c->vc_size_row);252252-253253- while (count--) {254254- if ((vgacon_scrollback_cur->tail + c->vc_size_row) >255255- vgacon_scrollback_cur->size)256256- vgacon_scrollback_cur->tail = 0;257257-258258- scr_memcpyw(vgacon_scrollback_cur->data +259259- vgacon_scrollback_cur->tail,260260- p, c->vc_size_row);261261-262262- vgacon_scrollback_cur->cnt++;263263- p += c->vc_size_row;264264- vgacon_scrollback_cur->tail += c->vc_size_row;265265-266266- if (vgacon_scrollback_cur->tail >= vgacon_scrollback_cur->size)267267- vgacon_scrollback_cur->tail = 0;268268-269269- if (vgacon_scrollback_cur->cnt > vgacon_scrollback_cur->rows)270270- vgacon_scrollback_cur->cnt = vgacon_scrollback_cur->rows;271271-272272- vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt;273273- }274274-}275275-276276-static void vgacon_restore_screen(struct vc_data *c)277277-{278278- c->vc_origin = c->vc_visible_origin;279279- vgacon_scrollback_cur->save = 0;280280-281281- if (!vga_is_gfx && !vgacon_scrollback_cur->restore) {282282- scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,283283- c->vc_screenbuf_size > vga_vram_size ?284284- vga_vram_size : c->vc_screenbuf_size);285285- vgacon_scrollback_cur->restore = 1;286286- vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt;287287- }288288-}289289-290290-static void vgacon_scrolldelta(struct vc_data *c, int lines)291291-{292292- int start, end, count, soff;293293-294294- if (!lines) {295295- vgacon_restore_screen(c);296296- return;297297- }298298-299299- if (!vgacon_scrollback_cur->data)300300- return;301301-302302- if (!vgacon_scrollback_cur->save) {303303- vgacon_cursor(c, CM_ERASE);304304- vgacon_save_screen(c);305305- c->vc_origin = (unsigned long)c->vc_screenbuf;306306- vgacon_scrollback_cur->save = 1;307307- }308308-309309- vgacon_scrollback_cur->restore = 0;310310- start = vgacon_scrollback_cur->cur + lines;311311- end = start + abs(lines);312312-313313- if (start < 0)314314- start = 0;315315-316316- if (start > vgacon_scrollback_cur->cnt)317317- start = vgacon_scrollback_cur->cnt;318318-319319- if (end < 0)320320- end = 0;321321-322322- if (end > vgacon_scrollback_cur->cnt)323323- end = vgacon_scrollback_cur->cnt;324324-325325- vgacon_scrollback_cur->cur = start;326326- count = end - start;327327- soff = vgacon_scrollback_cur->tail -328328- ((vgacon_scrollback_cur->cnt - end) * c->vc_size_row);329329- soff -= count * c->vc_size_row;330330-331331- if (soff < 0)332332- soff += vgacon_scrollback_cur->size;333333-334334- count = vgacon_scrollback_cur->cnt - start;335335-336336- if (count > c->vc_rows)337337- count = c->vc_rows;338338-339339- if (count) {340340- int copysize;341341-342342- int diff = c->vc_rows - count;343343- void *d = (void *) c->vc_visible_origin;344344- void *s = (void *) c->vc_screenbuf;345345-346346- count *= c->vc_size_row;347347- /* how much memory to end of buffer left? */348348- copysize = min(count, vgacon_scrollback_cur->size - soff);349349- scr_memcpyw(d, vgacon_scrollback_cur->data + soff, copysize);350350- d += copysize;351351- count -= copysize;352352-353353- if (count) {354354- scr_memcpyw(d, vgacon_scrollback_cur->data, count);355355- d += count;356356- }357357-358358- if (diff)359359- scr_memcpyw(d, s, diff * c->vc_size_row);360360- } else361361- vgacon_cursor(c, CM_MOVE);362362-}363363-364364-static void vgacon_flush_scrollback(struct vc_data *c)365365-{366366- size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;367367-368368- vgacon_scrollback_reset(c->vc_num, size);369369-}370370-#else371371-#define vgacon_scrollback_startup(...) do { } while (0)372372-#define vgacon_scrollback_init(...) do { } while (0)373373-#define vgacon_scrollback_update(...) do { } while (0)374374-#define vgacon_scrollback_switch(...) do { } while (0)375375-376168static void vgacon_restore_screen(struct vc_data *c)377169{378170 if (c->vc_origin != c->vc_visible_origin)···177385 vga_vram_size);178386 vga_set_mem_top(c);179387}180180-181181-static void vgacon_flush_scrollback(struct vc_data *c)182182-{183183-}184184-#endif /* CONFIG_VGACON_SOFT_SCROLLBACK */185388186389static const char *vgacon_startup(void)187390{···360573 vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH;361574 vgacon_yres = vga_scan_lines;362575363363- if (!vga_init_done) {364364- vgacon_scrollback_startup();365365- vga_init_done = true;366366- }576576+ vga_init_done = true;367577368578 return display_desc;369579}···653869 vgacon_doresize(c, c->vc_cols, c->vc_rows);654870 }655871656656- vgacon_scrollback_switch(c->vc_num);657872 return 0; /* Redrawing not needed */658873}659874···11691386 oldo = c->vc_origin;11701387 delta = lines * c->vc_size_row;11711388 if (dir == SM_UP) {11721172- vgacon_scrollback_update(c, t, lines);11731389 if (c->vc_scr_end + delta >= vga_vram_end) {11741390 scr_memcpyw((u16 *) vga_vram_base,11751391 (u16 *) (oldo + delta),···12321450 .con_save_screen = vgacon_save_screen,12331451 .con_build_attr = vgacon_build_attr,12341452 .con_invert_region = vgacon_invert_region,12351235- .con_flush_scrollback = vgacon_flush_scrollback,12361453};12371454EXPORT_SYMBOL(vga_con);12381455
+1-10
drivers/video/fbdev/core/bitblit.c
···234234}235235236236static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,237237- int softback_lines, int fg, int bg)237237+ int fg, int bg)238238{239239 struct fb_cursor cursor;240240 struct fbcon_ops *ops = info->fbcon_par;···246246 char *src;247247248248 cursor.set = 0;249249-250250- if (softback_lines) {251251- if (y + softback_lines >= vc->vc_rows) {252252- mode = CM_ERASE;253253- ops->cursor_flash = 0;254254- return;255255- } else256256- y += softback_lines;257257- }258249259250 c = scr_readw((u16 *) vc->vc_pos);260251 attribute = get_attribute(info, c);
+5-331
drivers/video/fbdev/core/fbcon.c
···122122/* logo_shown is an index to vc_cons when >= 0; otherwise follows FBCON_LOGO123123 enums. */124124static int logo_shown = FBCON_LOGO_CANSHOW;125125-/* Software scrollback */126126-static int fbcon_softback_size = 32768;127127-static unsigned long softback_buf, softback_curr;128128-static unsigned long softback_in;129129-static unsigned long softback_top, softback_end;130130-static int softback_lines;131125/* console mappings */132126static int first_fb_vc;133127static int last_fb_vc = MAX_NR_CONSOLES - 1;···160166static int margin_color;161167162168static const struct consw fb_con;163163-164164-#define CM_SOFTBACK (8)165169166170#define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)167171···365373 return color;366374}367375368368-static void fbcon_update_softback(struct vc_data *vc)369369-{370370- int l = fbcon_softback_size / vc->vc_size_row;371371-372372- if (l > 5)373373- softback_end = softback_buf + l * vc->vc_size_row;374374- else375375- /* Smaller scrollback makes no sense, and 0 would screw376376- the operation totally */377377- softback_top = 0;378378-}379379-380376static void fb_flashcursor(struct work_struct *work)381377{382378 struct fb_info *info = container_of(work, struct fb_info, queue);···394414 c = scr_readw((u16 *) vc->vc_pos);395415 mode = (!ops->cursor_flash || ops->cursor_state.enable) ?396416 CM_ERASE : CM_DRAW;397397- ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),417417+ ops->cursor(vc, info, mode, get_color(vc, info, c, 1),398418 get_color(vc, info, c, 0));399419 console_unlock();400420}···451471 }452472453473 if (!strncmp(options, "scrollback:", 11)) {454454- options += 11;455455- if (*options) {456456- fbcon_softback_size = simple_strtoul(options, &options, 0);457457- if (*options == 'k' || *options == 'K') {458458- fbcon_softback_size *= 1024;459459- }460460- }474474+ pr_warn("Ignoring scrollback size option\n");461475 continue;462476 }463477···99610229971023 set_blitting_type(vc, info);9981024999999- if (info->fix.type != FB_TYPE_TEXT) {10001000- if (fbcon_softback_size) {10011001- if (!softback_buf) {10021002- softback_buf =10031003- (unsigned long)10041004- kvmalloc(fbcon_softback_size,10051005- GFP_KERNEL);10061006- if (!softback_buf) {10071007- fbcon_softback_size = 0;10081008- softback_top = 0;10091009- }10101010- }10111011- } else {10121012- if (softback_buf) {10131013- kvfree((void *) softback_buf);10141014- softback_buf = 0;10151015- softback_top = 0;10161016- }10171017- }10181018- if (softback_buf)10191019- softback_in = softback_top = softback_curr =10201020- softback_buf;10211021- softback_lines = 0;10221022- }10231023-10241025 /* Setup default font */10251026 if (!p->fontdata && !vc->vc_font.data) {10261027 if (!fontname[0] || !(font = find_font(fontname)))···11691220 if (logo)11701221 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows);1171122211721172- if (vc == svc && softback_buf)11731173- fbcon_update_softback(vc);11741174-11751223 if (ops->rotate_font && ops->rotate_font(info, vc)) {11761224 ops->rotate = FB_ROTATE_UR;11771225 set_blitting_type(vc, info);···13311385{13321386 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];13331387 struct fbcon_ops *ops = info->fbcon_par;13341334- int y;13351388 int c = scr_readw((u16 *) vc->vc_pos);1336138913371390 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);···13441399 fbcon_add_cursor_timer(info);1345140013461401 ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1;13471347- if (mode & CM_SOFTBACK) {13481348- mode &= ~CM_SOFTBACK;13491349- y = softback_lines;13501350- } else {13511351- if (softback_lines)13521352- fbcon_set_origin(vc);13531353- y = 0;13541354- }1355140213561356- ops->cursor(vc, info, mode, y, get_color(vc, info, c, 1),14031403+ ops->cursor(vc, info, mode, get_color(vc, info, c, 1),13571404 get_color(vc, info, c, 0));13581405}13591406···1416147914171480 if (con_is_visible(vc)) {14181481 update_screen(vc);14191419- if (softback_buf)14201420- fbcon_update_softback(vc);14211482 }14221483}14231484···15511616 if (scrollback_max < 0)15521617 scrollback_max = 0;15531618 scrollback_current = 0;15541554-}15551555-15561556-static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p,15571557- long delta)15581558-{15591559- int count = vc->vc_rows;15601560- unsigned short *d, *s;15611561- unsigned long n;15621562- int line = 0;15631563-15641564- d = (u16 *) softback_curr;15651565- if (d == (u16 *) softback_in)15661566- d = (u16 *) vc->vc_origin;15671567- n = softback_curr + delta * vc->vc_size_row;15681568- softback_lines -= delta;15691569- if (delta < 0) {15701570- if (softback_curr < softback_top && n < softback_buf) {15711571- n += softback_end - softback_buf;15721572- if (n < softback_top) {15731573- softback_lines -=15741574- (softback_top - n) / vc->vc_size_row;15751575- n = softback_top;15761576- }15771577- } else if (softback_curr >= softback_top15781578- && n < softback_top) {15791579- softback_lines -=15801580- (softback_top - n) / vc->vc_size_row;15811581- n = softback_top;15821582- }15831583- } else {15841584- if (softback_curr > softback_in && n >= softback_end) {15851585- n += softback_buf - softback_end;15861586- if (n > softback_in) {15871587- n = softback_in;15881588- softback_lines = 0;15891589- }15901590- } else if (softback_curr <= softback_in && n > softback_in) {15911591- n = softback_in;15921592- softback_lines = 0;15931593- }15941594- }15951595- if (n == softback_curr)15961596- return;15971597- softback_curr = n;15981598- s = (u16 *) softback_curr;15991599- if (s == (u16 *) softback_in)16001600- s = (u16 *) vc->vc_origin;16011601- while (count--) {16021602- unsigned short *start;16031603- unsigned short *le;16041604- unsigned short c;16051605- int x = 0;16061606- unsigned short attr = 1;16071607-16081608- start = s;16091609- le = advance_row(s, 1);16101610- do {16111611- c = scr_readw(s);16121612- if (attr != (c & 0xff00)) {16131613- attr = c & 0xff00;16141614- if (s > start) {16151615- fbcon_putcs(vc, start, s - start,16161616- line, x);16171617- x += s - start;16181618- start = s;16191619- }16201620- }16211621- if (c == scr_readw(d)) {16221622- if (s > start) {16231623- fbcon_putcs(vc, start, s - start,16241624- line, x);16251625- x += s - start + 1;16261626- start = s + 1;16271627- } else {16281628- x++;16291629- start++;16301630- }16311631- }16321632- s++;16331633- d++;16341634- } while (s < le);16351635- if (s > start)16361636- fbcon_putcs(vc, start, s - start, line, x);16371637- line++;16381638- if (d == (u16 *) softback_end)16391639- d = (u16 *) softback_buf;16401640- if (d == (u16 *) softback_in)16411641- d = (u16 *) vc->vc_origin;16421642- if (s == (u16 *) softback_end)16431643- s = (u16 *) softback_buf;16441644- if (s == (u16 *) softback_in)16451645- s = (u16 *) vc->vc_origin;16461646- }16471619}1648162016491621static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,···16921850 }16931851}1694185216951695-static inline void fbcon_softback_note(struct vc_data *vc, int t,16961696- int count)16971697-{16981698- unsigned short *p;16991699-17001700- if (vc->vc_num != fg_console)17011701- return;17021702- p = (unsigned short *) (vc->vc_origin + t * vc->vc_size_row);17031703-17041704- while (count) {17051705- scr_memcpyw((u16 *) softback_in, p, vc->vc_size_row);17061706- count--;17071707- p = advance_row(p, 1);17081708- softback_in += vc->vc_size_row;17091709- if (softback_in == softback_end)17101710- softback_in = softback_buf;17111711- if (softback_in == softback_top) {17121712- softback_top += vc->vc_size_row;17131713- if (softback_top == softback_end)17141714- softback_top = softback_buf;17151715- }17161716- }17171717- softback_curr = softback_in;17181718-}17191719-17201853static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,17211854 enum con_scroll dir, unsigned int count)17221855{···17141897 case SM_UP:17151898 if (count > vc->vc_rows) /* Maximum realistic size */17161899 count = vc->vc_rows;17171717- if (softback_top)17181718- fbcon_softback_note(vc, t, count);17191900 if (logo_shown >= 0)17201901 goto redraw_up;17211902 switch (p->scrollmode) {···20182203 struct fb_var_screeninfo var = info->var;20192204 int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh;2020220520212021- if (ops->p && ops->p->userfont && FNTSIZE(vc->vc_font.data)) {22062206+ if (p->userfont && FNTSIZE(vc->vc_font.data)) {20222207 int size;20232208 int pitch = PITCH(vc->vc_font.width);20242209···2083226820842269 info = registered_fb[con2fb_map[vc->vc_num]];20852270 ops = info->fbcon_par;20862086-20872087- if (softback_top) {20882088- if (softback_lines)20892089- fbcon_set_origin(vc);20902090- softback_top = softback_curr = softback_in = softback_buf;20912091- softback_lines = 0;20922092- fbcon_update_softback(vc);20932093- }2094227120952272 if (logo_shown >= 0) {20962273 struct vc_data *conp2 = vc_cons[logo_shown].d;···24072600 int cnt;24082601 char *old_data = NULL;2409260224102410- if (con_is_visible(vc) && softback_lines)24112411- fbcon_set_origin(vc);24122412-24132603 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);24142604 if (p->userfont)24152605 old_data = vc->vc_font.data;···24322628 cols /= w;24332629 rows /= h;24342630 vc_resize(vc, cols, rows);24352435- if (con_is_visible(vc) && softback_buf)24362436- fbcon_update_softback(vc);24372631 } else if (con_is_visible(vc)24382632 && vc->vc_mode == KD_TEXT) {24392633 fbcon_clear_margins(vc, 0);···2590278825912789static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)25922790{25932593- unsigned long p;25942594- int line;25952595-25962596- if (vc->vc_num != fg_console || !softback_lines)25972597- return (u16 *) (vc->vc_origin + offset);25982598- line = offset / vc->vc_size_row;25992599- if (line >= softback_lines)26002600- return (u16 *) (vc->vc_origin + offset -26012601- softback_lines * vc->vc_size_row);26022602- p = softback_curr + offset;26032603- if (p >= softback_end)26042604- p += softback_buf - softback_end;26052605- return (u16 *) p;27912791+ return (u16 *) (vc->vc_origin + offset);26062792}2607279326082794static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos,···2604281426052815 x = offset % vc->vc_cols;26062816 y = offset / vc->vc_cols;26072607- if (vc->vc_num == fg_console)26082608- y += softback_lines;26092817 ret = pos + (vc->vc_cols - x) * 2;26102610- } else if (vc->vc_num == fg_console && softback_lines) {26112611- unsigned long offset = pos - softback_curr;26122612-26132613- if (pos < softback_curr)26142614- offset += softback_end - softback_buf;26152615- offset /= 2;26162616- x = offset % vc->vc_cols;26172617- y = offset / vc->vc_cols;26182618- ret = pos + (vc->vc_cols - x) * 2;26192619- if (ret == softback_end)26202620- ret = softback_buf;26212621- if (ret == softback_in)26222622- ret = vc->vc_origin;26232818 } else {26242819 /* Should not happen */26252820 x = y = 0;···26322857 a = ((a) & 0x88ff) | (((a) & 0x7000) >> 4) |26332858 (((a) & 0x0700) << 4);26342859 scr_writew(a, p++);26352635- if (p == (u16 *) softback_end)26362636- p = (u16 *) softback_buf;26372637- if (p == (u16 *) softback_in)26382638- p = (u16 *) vc->vc_origin;26392860 }26402640-}26412641-26422642-static void fbcon_scrolldelta(struct vc_data *vc, int lines)26432643-{26442644- struct fb_info *info = registered_fb[con2fb_map[fg_console]];26452645- struct fbcon_ops *ops = info->fbcon_par;26462646- struct fbcon_display *disp = &fb_display[fg_console];26472647- int offset, limit, scrollback_old;26482648-26492649- if (softback_top) {26502650- if (vc->vc_num != fg_console)26512651- return;26522652- if (vc->vc_mode != KD_TEXT || !lines)26532653- return;26542654- if (logo_shown >= 0) {26552655- struct vc_data *conp2 = vc_cons[logo_shown].d;26562656-26572657- if (conp2->vc_top == logo_lines26582658- && conp2->vc_bottom == conp2->vc_rows)26592659- conp2->vc_top = 0;26602660- if (logo_shown == vc->vc_num) {26612661- unsigned long p, q;26622662- int i;26632663-26642664- p = softback_in;26652665- q = vc->vc_origin +26662666- logo_lines * vc->vc_size_row;26672667- for (i = 0; i < logo_lines; i++) {26682668- if (p == softback_top)26692669- break;26702670- if (p == softback_buf)26712671- p = softback_end;26722672- p -= vc->vc_size_row;26732673- q -= vc->vc_size_row;26742674- scr_memcpyw((u16 *) q, (u16 *) p,26752675- vc->vc_size_row);26762676- }26772677- softback_in = softback_curr = p;26782678- update_region(vc, vc->vc_origin,26792679- logo_lines * vc->vc_cols);26802680- }26812681- logo_shown = FBCON_LOGO_CANSHOW;26822682- }26832683- fbcon_cursor(vc, CM_ERASE | CM_SOFTBACK);26842684- fbcon_redraw_softback(vc, disp, lines);26852685- fbcon_cursor(vc, CM_DRAW | CM_SOFTBACK);26862686- return;26872687- }26882688-26892689- if (!scrollback_phys_max)26902690- return;26912691-26922692- scrollback_old = scrollback_current;26932693- scrollback_current -= lines;26942694- if (scrollback_current < 0)26952695- scrollback_current = 0;26962696- else if (scrollback_current > scrollback_max)26972697- scrollback_current = scrollback_max;26982698- if (scrollback_current == scrollback_old)26992699- return;27002700-27012701- if (fbcon_is_inactive(vc, info))27022702- return;27032703-27042704- fbcon_cursor(vc, CM_ERASE);27052705-27062706- offset = disp->yscroll - scrollback_current;27072707- limit = disp->vrows;27082708- switch (disp->scrollmode) {27092709- case SCROLL_WRAP_MOVE:27102710- info->var.vmode |= FB_VMODE_YWRAP;27112711- break;27122712- case SCROLL_PAN_MOVE:27132713- case SCROLL_PAN_REDRAW:27142714- limit -= vc->vc_rows;27152715- info->var.vmode &= ~FB_VMODE_YWRAP;27162716- break;27172717- }27182718- if (offset < 0)27192719- offset += limit;27202720- else if (offset >= limit)27212721- offset -= limit;27222722-27232723- ops->var.xoffset = 0;27242724- ops->var.yoffset = offset * vc->vc_font.height;27252725- ops->update_start(info);27262726-27272727- if (!scrollback_current)27282728- fbcon_cursor(vc, CM_DRAW);27292861}2730286227312863static int fbcon_set_origin(struct vc_data *vc)27322864{27332733- if (softback_lines)27342734- fbcon_scrolldelta(vc, softback_lines);27352865 return 0;27362866}27372867···2700302027013021 fbcon_set_palette(vc, color_table);27023022 update_screen(vc);27032703- if (softback_buf)27042704- fbcon_update_softback(vc);27053023 }27063024}27073025···31103432 .con_font_default = fbcon_set_def_font,31113433 .con_font_copy = fbcon_copy_font,31123434 .con_set_palette = fbcon_set_palette,31133113- .con_scrolldelta = fbcon_scrolldelta,31143435 .con_set_origin = fbcon_set_origin,31153436 .con_invert_region = fbcon_invert_region,31163437 .con_screen_pos = fbcon_screen_pos,···33433666 deferred_takeover = false;33443667 }33453668#endif33463346-33473347- kvfree((void *)softback_buf);33483348- softback_buf = 0UL;3349366933503670 for_each_registered_fb(i) {33513671 int pending = 0;
+1-1
drivers/video/fbdev/core/fbcon.h
···6262 void (*clear_margins)(struct vc_data *vc, struct fb_info *info,6363 int color, int bottom_only);6464 void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode,6565- int softback_lines, int fg, int bg);6565+ int fg, int bg);6666 int (*update_start)(struct fb_info *info);6767 int (*rotate_font)(struct fb_info *info, struct vc_data *vc);6868 struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */
+1-10
drivers/video/fbdev/core/fbcon_ccw.c
···219219}220220221221static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,222222- int softback_lines, int fg, int bg)222222+ int fg, int bg)223223{224224 struct fb_cursor cursor;225225 struct fbcon_ops *ops = info->fbcon_par;···235235 return;236236237237 cursor.set = 0;238238-239239- if (softback_lines) {240240- if (y + softback_lines >= vc->vc_rows) {241241- mode = CM_ERASE;242242- ops->cursor_flash = 0;243243- return;244244- } else245245- y += softback_lines;246246- }247238248239 c = scr_readw((u16 *) vc->vc_pos);249240 attribute = get_attribute(info, c);
+1-10
drivers/video/fbdev/core/fbcon_cw.c
···202202}203203204204static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,205205- int softback_lines, int fg, int bg)205205+ int fg, int bg)206206{207207 struct fb_cursor cursor;208208 struct fbcon_ops *ops = info->fbcon_par;···218218 return;219219220220 cursor.set = 0;221221-222222- if (softback_lines) {223223- if (y + softback_lines >= vc->vc_rows) {224224- mode = CM_ERASE;225225- ops->cursor_flash = 0;226226- return;227227- } else228228- y += softback_lines;229229- }230221231222 c = scr_readw((u16 *) vc->vc_pos);232223 attribute = get_attribute(info, c);
+1-10
drivers/video/fbdev/core/fbcon_ud.c
···249249}250250251251static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,252252- int softback_lines, int fg, int bg)252252+ int fg, int bg)253253{254254 struct fb_cursor cursor;255255 struct fbcon_ops *ops = info->fbcon_par;···266266 return;267267268268 cursor.set = 0;269269-270270- if (softback_lines) {271271- if (y + softback_lines >= vc->vc_rows) {272272- mode = CM_ERASE;273273- ops->cursor_flash = 0;274274- return;275275- } else276276- y += softback_lines;277277- }278269279270 c = scr_readw((u16 *) vc->vc_pos);280271 attribute = get_attribute(info, c);
+1-1
drivers/video/fbdev/core/tileblit.c
···8080}81818282static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode,8383- int softback_lines, int fg, int bg)8383+ int fg, int bg)8484{8585 struct fb_tilecursor cursor;8686 int use_sw = vc->vc_cursor_type & CUR_SW;
+2-1
fs/btrfs/ioctl.c
···21932193 key.offset = sk->min_offset;2194219421952195 while (1) {21962196- ret = fault_in_pages_writeable(ubuf, *buf_size - sk_offset);21962196+ ret = fault_in_pages_writeable(ubuf + sk_offset,21972197+ *buf_size - sk_offset);21972198 if (ret)21982199 break;21992200
···142142 /* Must be the last timer callback */143143 CPUHP_AP_DUMMY_TIMER_STARTING,144144 CPUHP_AP_ARM_XEN_STARTING,145145- CPUHP_AP_ARM_KVMPV_STARTING,146145 CPUHP_AP_ARM_CORESIGHT_STARTING,147146 CPUHP_AP_ARM_CORESIGHT_CTI_STARTING,148147 CPUHP_AP_ARM64_ISNDEP_STARTING,
+1
include/linux/cpuidle.h
···8282#define CPUIDLE_FLAG_UNUSABLE BIT(3) /* avoid using this state */8383#define CPUIDLE_FLAG_OFF BIT(4) /* disable this state by default */8484#define CPUIDLE_FLAG_TLB_FLUSHED BIT(5) /* idle-state flushes TLBs */8585+#define CPUIDLE_FLAG_RCU_IDLE BIT(6) /* idle-state takes care of RCU */85868687struct cpuidle_device_kobj;8788struct cpuidle_state_kobj;
···4141struct bdi_writeback;4242struct pt_regs;43434444+extern int sysctl_page_lock_unfairness;4545+4446void init_mm_internals(void);45474648#ifndef CONFIG_NEED_MULTIPLE_NODES /* Don't use mapnrs, do it properly */
+4-4
include/linux/percpu-rwsem.h
···6060 * anything we did within this RCU-sched read-size critical section.6161 */6262 if (likely(rcu_sync_is_idle(&sem->rss)))6363- __this_cpu_inc(*sem->read_count);6363+ this_cpu_inc(*sem->read_count);6464 else6565 __percpu_down_read(sem, false); /* Unconditional memory barrier */6666 /*···7979 * Same as in percpu_down_read().8080 */8181 if (likely(rcu_sync_is_idle(&sem->rss)))8282- __this_cpu_inc(*sem->read_count);8282+ this_cpu_inc(*sem->read_count);8383 else8484 ret = __percpu_down_read(sem, true); /* Unconditional memory barrier */8585 preempt_enable();···103103 * Same as in percpu_down_read().104104 */105105 if (likely(rcu_sync_is_idle(&sem->rss))) {106106- __this_cpu_dec(*sem->read_count);106106+ this_cpu_dec(*sem->read_count);107107 } else {108108 /*109109 * slowpath; reader will only ever wake a single blocked···115115 * aggregate zero, as that is the only time it matters) they116116 * will also see our critical section.117117 */118118- __this_cpu_dec(*sem->read_count);118118+ this_cpu_dec(*sem->read_count);119119 rcuwait_wake_up(&sem->writer);120120 }121121 preempt_enable();
+1
include/linux/serial_core.h
···248248249249 unsigned char hub6; /* this should be in the 8250 driver */250250 unsigned char suspended;251251+ unsigned char console_reinit;251252 const char *name; /* port name */252253 struct attribute_group *attr_group; /* port specific attributes */253254 const struct attribute_group **tty_groups; /* all attributes (serial core use only) */
···6060 return ret;6161 }62626363+ /* Either of the above might have changed the syscall number */6464+ syscall = syscall_get_nr(current, regs);6565+6366 if (unlikely(ti_work & _TIF_SYSCALL_TRACEPOINT))6467 trace_sys_enter(regs, syscall);65686669 syscall_enter_audit(regs, syscall);67706868- /* The above might have changed the syscall number */6969- return ret ? : syscall_get_nr(current, regs);7171+ return ret ? : syscall;7072}71737274static __always_inline long
+8-1
kernel/kprobes.c
···2140214021412141 lockdep_assert_held(&kprobe_mutex);2142214221432143+ if (WARN_ON_ONCE(kprobe_gone(p)))21442144+ return;21452145+21432146 p->flags |= KPROBE_FLAG_GONE;21442147 if (kprobe_aggrprobe(p)) {21452148 /*···24222419 mutex_lock(&kprobe_mutex);24232420 for (i = 0; i < KPROBE_TABLE_SIZE; i++) {24242421 head = &kprobe_table[i];24252425- hlist_for_each_entry(p, head, hlist)24222422+ hlist_for_each_entry(p, head, hlist) {24232423+ if (kprobe_gone(p))24242424+ continue;24252425+24262426 if (within_module_init((unsigned long)p->addr, mod) ||24272427 (checkcore &&24282428 within_module_core((unsigned long)p->addr, mod))) {···24422436 */24432437 kill_kprobe(p);24442438 }24392439+ }24452440 }24462441 if (val == MODULE_STATE_GOING)24472442 remove_module_kprobe_blacklist(mod);
+29-6
kernel/locking/lockdep.c
···39693969static int mark_lock(struct task_struct *curr, struct held_lock *this,39703970 enum lock_usage_bit new_bit)39713971{39723972- unsigned int new_mask = 1 << new_bit, ret = 1;39723972+ unsigned int old_mask, new_mask, ret = 1;3973397339743974 if (new_bit >= LOCK_USAGE_STATES) {39753975 DEBUG_LOCKS_WARN_ON(1);39763976 return 0;39773977 }39783978+39793979+ if (new_bit == LOCK_USED && this->read)39803980+ new_bit = LOCK_USED_READ;39813981+39823982+ new_mask = 1 << new_bit;3978398339793984 /*39803985 * If already set then do not dirty the cacheline,···39933988 /*39943989 * Make sure we didn't race:39953990 */39963996- if (unlikely(hlock_class(this)->usage_mask & new_mask)) {39973997- graph_unlock();39983998- return 1;39993999- }39913991+ if (unlikely(hlock_class(this)->usage_mask & new_mask))39923992+ goto unlock;4000399339943994+ old_mask = hlock_class(this)->usage_mask;40013995 hlock_class(this)->usage_mask |= new_mask;39963996+39973997+ /*39983998+ * Save one usage_traces[] entry and map both LOCK_USED and39993999+ * LOCK_USED_READ onto the same entry.40004000+ */40014001+ if (new_bit == LOCK_USED || new_bit == LOCK_USED_READ) {40024002+ if (old_mask & (LOCKF_USED | LOCKF_USED_READ))40034003+ goto unlock;40044004+ new_bit = LOCK_USED;40054005+ }4002400640034007 if (!(hlock_class(this)->usage_traces[new_bit] = save_trace()))40044008 return 0;···40224008 return 0;40234009 }4024401040114011+unlock:40254012 graph_unlock();4026401340274014 /*···49574942{49584943#ifdef CONFIG_PROVE_LOCKING49594944 struct lock_class *class = look_up_lock_class(lock, subclass);49454945+ unsigned long mask = LOCKF_USED;4960494649614947 /* if it doesn't have a class (yet), it certainly hasn't been used yet */49624948 if (!class)49634949 return;4964495049654965- if (!(class->usage_mask & LOCK_USED))49514951+ /*49524952+ * READ locks only conflict with USED, such that if we only ever use49534953+ * READ locks, there is no deadlock possible -- RCU.49544954+ */49554955+ if (!hlock->read)49564956+ mask |= LOCKF_USED_READ;49574957+49584958+ if (!(class->usage_mask & mask))49664959 return;4967496049684961 hlock->class_idx = class - lock_classes;
···988988 page_writeback_init();989989}990990991991+/*992992+ * The page wait code treats the "wait->flags" somewhat unusually, because993993+ * we have multiple different kinds of waits, not just the usual "exclusive"994994+ * one.995995+ *996996+ * We have:997997+ *998998+ * (a) no special bits set:999999+ *10001000+ * We're just waiting for the bit to be released, and when a waker10011001+ * calls the wakeup function, we set WQ_FLAG_WOKEN and wake it up,10021002+ * and remove it from the wait queue.10031003+ *10041004+ * Simple and straightforward.10051005+ *10061006+ * (b) WQ_FLAG_EXCLUSIVE:10071007+ *10081008+ * The waiter is waiting to get the lock, and only one waiter should10091009+ * be woken up to avoid any thundering herd behavior. We'll set the10101010+ * WQ_FLAG_WOKEN bit, wake it up, and remove it from the wait queue.10111011+ *10121012+ * This is the traditional exclusive wait.10131013+ *10141014+ * (c) WQ_FLAG_EXCLUSIVE | WQ_FLAG_CUSTOM:10151015+ *10161016+ * The waiter is waiting to get the bit, and additionally wants the10171017+ * lock to be transferred to it for fair lock behavior. If the lock10181018+ * cannot be taken, we stop walking the wait queue without waking10191019+ * the waiter.10201020+ *10211021+ * This is the "fair lock handoff" case, and in addition to setting10221022+ * WQ_FLAG_WOKEN, we set WQ_FLAG_DONE to let the waiter easily see10231023+ * that it now has the lock.10241024+ */9911025static int wake_page_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *arg)9921026{993993- int ret;10271027+ unsigned int flags;9941028 struct wait_page_key *key = arg;9951029 struct wait_page_queue *wait_page9961030 = container_of(wait, struct wait_page_queue, wait);···1033999 return 0;1034100010351001 /*10361036- * If it's an exclusive wait, we get the bit for it, and10371037- * stop walking if we can't.10381038- *10391039- * If it's a non-exclusive wait, then the fact that this10401040- * wake function was called means that the bit already10411041- * was cleared, and we don't care if somebody then10421042- * re-took it.10021002+ * If it's a lock handoff wait, we get the bit for it, and10031003+ * stop walking (and do not wake it up) if we can't.10431004 */10441044- ret = 0;10451045- if (wait->flags & WQ_FLAG_EXCLUSIVE) {10461046- if (test_and_set_bit(key->bit_nr, &key->page->flags))10051005+ flags = wait->flags;10061006+ if (flags & WQ_FLAG_EXCLUSIVE) {10071007+ if (test_bit(key->bit_nr, &key->page->flags))10471008 return -1;10481048- ret = 1;10091009+ if (flags & WQ_FLAG_CUSTOM) {10101010+ if (test_and_set_bit(key->bit_nr, &key->page->flags))10111011+ return -1;10121012+ flags |= WQ_FLAG_DONE;10131013+ }10491014 }10501050- wait->flags |= WQ_FLAG_WOKEN;1051101510161016+ /*10171017+ * We are holding the wait-queue lock, but the waiter that10181018+ * is waiting for this will be checking the flags without10191019+ * any locking.10201020+ *10211021+ * So update the flags atomically, and wake up the waiter10221022+ * afterwards to avoid any races. This store-release pairs10231023+ * with the load-acquire in wait_on_page_bit_common().10241024+ */10251025+ smp_store_release(&wait->flags, flags | WQ_FLAG_WOKEN);10521026 wake_up_state(wait->private, mode);1053102710541028 /*10551029 * Ok, we have successfully done what we're waiting for,10561030 * and we can unconditionally remove the wait entry.10571031 *10581058- * Note that this has to be the absolute last thing we do,10591059- * since after list_del_init(&wait->entry) the wait entry10321032+ * Note that this pairs with the "finish_wait()" in the10331033+ * waiter, and has to be the absolute last thing we do.10341034+ * After this list_del_init(&wait->entry) the wait entry10601035 * might be de-allocated and the process might even have10611036 * exited.10621037 */10631038 list_del_init_careful(&wait->entry);10641064- return ret;10391039+ return (flags & WQ_FLAG_EXCLUSIVE) != 0;10651040}1066104110671042static void wake_up_page_bit(struct page *page, int bit_nr)···11501107};1151110811521109/*11531153- * Attempt to check (or get) the page bit, and mark the11541154- * waiter woken if successful.11101110+ * Attempt to check (or get) the page bit, and mark us done11111111+ * if successful.11551112 */11561113static inline bool trylock_page_bit_common(struct page *page, int bit_nr,11571114 struct wait_queue_entry *wait)···11621119 } else if (test_bit(bit_nr, &page->flags))11631120 return false;1164112111651165- wait->flags |= WQ_FLAG_WOKEN;11221122+ wait->flags |= WQ_FLAG_WOKEN | WQ_FLAG_DONE;11661123 return true;11671124}11251125+11261126+/* How many times do we accept lock stealing from under a waiter? */11271127+int sysctl_page_lock_unfairness = 5;1168112811691129static inline int wait_on_page_bit_common(wait_queue_head_t *q,11701130 struct page *page, int bit_nr, int state, enum behavior behavior)11711131{11321132+ int unfairness = sysctl_page_lock_unfairness;11721133 struct wait_page_queue wait_page;11731134 wait_queue_entry_t *wait = &wait_page.wait;11741135 bool thrashing = false;···11901143 }1191114411921145 init_wait(wait);11931193- wait->flags = behavior == EXCLUSIVE ? WQ_FLAG_EXCLUSIVE : 0;11941146 wait->func = wake_page_function;11951147 wait_page.page = page;11961148 wait_page.bit_nr = bit_nr;11491149+11501150+repeat:11511151+ wait->flags = 0;11521152+ if (behavior == EXCLUSIVE) {11531153+ wait->flags = WQ_FLAG_EXCLUSIVE;11541154+ if (--unfairness < 0)11551155+ wait->flags |= WQ_FLAG_CUSTOM;11561156+ }1197115711981158 /*11991159 * Do one last check whether we can get the···1224117012251171 /*12261172 * From now on, all the logic will be based on12271227- * the WQ_FLAG_WOKEN flag, and the and the page12281228- * bit testing (and setting) will be - or has12291229- * already been - done by the wake function.11731173+ * the WQ_FLAG_WOKEN and WQ_FLAG_DONE flag, to11741174+ * see whether the page bit testing has already11751175+ * been done by the wake function.12301176 *12311177 * We can drop our reference to the page.12321178 */12331179 if (behavior == DROP)12341180 put_page(page);1235118111821182+ /*11831183+ * Note that until the "finish_wait()", or until11841184+ * we see the WQ_FLAG_WOKEN flag, we need to11851185+ * be very careful with the 'wait->flags', because11861186+ * we may race with a waker that sets them.11871187+ */12361188 for (;;) {11891189+ unsigned int flags;11901190+12371191 set_current_state(state);1238119212391239- if (signal_pending_state(state, current))11931193+ /* Loop until we've been woken or interrupted */11941194+ flags = smp_load_acquire(&wait->flags);11951195+ if (!(flags & WQ_FLAG_WOKEN)) {11961196+ if (signal_pending_state(state, current))11971197+ break;11981198+11991199+ io_schedule();12001200+ continue;12011201+ }12021202+12031203+ /* If we were non-exclusive, we're done */12041204+ if (behavior != EXCLUSIVE)12401205 break;1241120612421242- if (wait->flags & WQ_FLAG_WOKEN)12071207+ /* If the waker got the lock for us, we're done */12081208+ if (flags & WQ_FLAG_DONE)12431209 break;1244121012451245- io_schedule();12111211+ /*12121212+ * Otherwise, if we're getting the lock, we need to12131213+ * try to get it ourselves.12141214+ *12151215+ * And if that fails, we'll have to retry this all.12161216+ */12171217+ if (unlikely(test_and_set_bit(bit_nr, &page->flags)))12181218+ goto repeat;12191219+12201220+ wait->flags |= WQ_FLAG_DONE;12211221+ break;12461222 }1247122312241224+ /*12251225+ * If a signal happened, this 'finish_wait()' may remove the last12261226+ * waiter from the wait-queues, but the PageWaiters bit will remain12271227+ * set. That's ok. The next wakeup will take care of it, and trying12281228+ * to do it here would be difficult and prone to races.12291229+ */12481230 finish_wait(q, wait);1249123112501232 if (thrashing) {···12901200 }1291120112921202 /*12931293- * A signal could leave PageWaiters set. Clearing it here if12941294- * !waitqueue_active would be possible (by open-coding finish_wait),12951295- * but still fail to catch it in the case of wait hash collision. We12961296- * already can fail to clear wait hash collision cases, so don't12971297- * bother with signals either.12031203+ * NOTE! The wait->flags weren't stable until we've done the12041204+ * 'finish_wait()', and we could have exited the loop above due12051205+ * to a signal, and had a wakeup event happen after the signal12061206+ * test but before the 'finish_wait()'.12071207+ *12081208+ * So only after the finish_wait() can we reliably determine12091209+ * if we got woken up or not, so we can now figure out the final12101210+ * return value based on that state without races.12111211+ *12121212+ * Also note that WQ_FLAG_WOKEN is sufficient for a non-exclusive12131213+ * waiter, but an exclusive one requires WQ_FLAG_DONE.12981214 */12151215+ if (behavior == EXCLUSIVE)12161216+ return wait->flags & WQ_FLAG_DONE ? 0 : -EINTR;1299121713001218 return wait->flags & WQ_FLAG_WOKEN ? 0 : -EINTR;13011219}
+23-19
mm/huge_memory.c
···20222022 put_page(page);20232023 add_mm_counter(mm, mm_counter_file(page), -HPAGE_PMD_NR);20242024 return;20252025- } else if (is_huge_zero_pmd(*pmd)) {20252025+ } else if (pmd_trans_huge(*pmd) && is_huge_zero_pmd(*pmd)) {20262026 /*20272027 * FIXME: Do we want to invalidate secondary mmu by calling20282028 * mmu_notifier_invalidate_range() see comments below inside···21162116 pte = pte_offset_map(&_pmd, addr);21172117 BUG_ON(!pte_none(*pte));21182118 set_pte_at(mm, addr, pte, entry);21192119- atomic_inc(&page[i]._mapcount);21192119+ if (!pmd_migration)21202120+ atomic_inc(&page[i]._mapcount);21202121 pte_unmap(pte);21212122 }2122212321232123- /*21242124- * Set PG_double_map before dropping compound_mapcount to avoid21252125- * false-negative page_mapped().21262126- */21272127- if (compound_mapcount(page) > 1 && !TestSetPageDoubleMap(page)) {21282128- for (i = 0; i < HPAGE_PMD_NR; i++)21292129- atomic_inc(&page[i]._mapcount);21302130- }21312131-21322132- lock_page_memcg(page);21332133- if (atomic_add_negative(-1, compound_mapcount_ptr(page))) {21342134- /* Last compound_mapcount is gone. */21352135- __dec_lruvec_page_state(page, NR_ANON_THPS);21362136- if (TestClearPageDoubleMap(page)) {21372137- /* No need in mapcount reference anymore */21242124+ if (!pmd_migration) {21252125+ /*21262126+ * Set PG_double_map before dropping compound_mapcount to avoid21272127+ * false-negative page_mapped().21282128+ */21292129+ if (compound_mapcount(page) > 1 &&21302130+ !TestSetPageDoubleMap(page)) {21382131 for (i = 0; i < HPAGE_PMD_NR; i++)21392139- atomic_dec(&page[i]._mapcount);21322132+ atomic_inc(&page[i]._mapcount);21402133 }21342134+21352135+ lock_page_memcg(page);21362136+ if (atomic_add_negative(-1, compound_mapcount_ptr(page))) {21372137+ /* Last compound_mapcount is gone. */21382138+ __dec_lruvec_page_state(page, NR_ANON_THPS);21392139+ if (TestClearPageDoubleMap(page)) {21402140+ /* No need in mapcount reference anymore */21412141+ for (i = 0; i < HPAGE_PMD_NR; i++)21422142+ atomic_dec(&page[i]._mapcount);21432143+ }21442144+ }21452145+ unlock_page_memcg(page);21412146 }21422142- unlock_page_memcg(page);2143214721442148 smp_wmb(); /* make pte visible before pmd */21452149 pmd_populate(mm, pmd, pgtable);
+4
mm/ksm.c
···25862586 return page; /* let do_swap_page report the error */2587258725882588 new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);25892589+ if (new_page && mem_cgroup_charge(new_page, vma->vm_mm, GFP_KERNEL)) {25902590+ put_page(new_page);25912591+ new_page = NULL;25922592+ }25892593 if (new_page) {25902594 copy_user_highpage(new_page, page, address, vma);25912595
+14
mm/memory_hotplug.c
···15751575 /* check again */15761576 ret = walk_system_ram_range(start_pfn, end_pfn - start_pfn,15771577 NULL, check_pages_isolated_cb);15781578+ /*15791579+ * per-cpu pages are drained in start_isolate_page_range, but if15801580+ * there are still pages that are not free, make sure that we15811581+ * drain again, because when we isolated range we might15821582+ * have raced with another thread that was adding pages to pcp15831583+ * list.15841584+ *15851585+ * Forward progress should be still guaranteed because15861586+ * pages on the pcp list can only belong to MOVABLE_ZONE15871587+ * because has_unmovable_pages explicitly checks for15881588+ * PageBuddy on freed pages on other zones.15891589+ */15901590+ if (ret)15911591+ drain_all_pages(zone);15781592 } while (ret);1579159315801594 /* Ok, all of our target is isolated.
+2-1
mm/migrate.c
···668668669669 copy_page_owner(page, newpage);670670671671- mem_cgroup_migrate(page, newpage);671671+ if (!PageHuge(page))672672+ mem_cgroup_migrate(page, newpage);672673}673674EXPORT_SYMBOL(migrate_page_states);674675
+15-9
mm/mlock.c
···5858 */5959void clear_page_mlock(struct page *page)6060{6161+ int nr_pages;6262+6163 if (!TestClearPageMlocked(page))6264 return;63656464- mod_zone_page_state(page_zone(page), NR_MLOCK, -thp_nr_pages(page));6565- count_vm_event(UNEVICTABLE_PGCLEARED);6666+ nr_pages = thp_nr_pages(page);6767+ mod_zone_page_state(page_zone(page), NR_MLOCK, -nr_pages);6868+ count_vm_events(UNEVICTABLE_PGCLEARED, nr_pages);6669 /*6770 * The previous TestClearPageMlocked() corresponds to the smp_mb()6871 * in __pagevec_lru_add_fn().···7976 * We lost the race. the page already moved to evictable list.8077 */8178 if (PageUnevictable(page))8282- count_vm_event(UNEVICTABLE_PGSTRANDED);7979+ count_vm_events(UNEVICTABLE_PGSTRANDED, nr_pages);8380 }8481}8582···9693 VM_BUG_ON_PAGE(PageCompound(page) && PageDoubleMap(page), page);97949895 if (!TestSetPageMlocked(page)) {9999- mod_zone_page_state(page_zone(page), NR_MLOCK,100100- thp_nr_pages(page));101101- count_vm_event(UNEVICTABLE_PGMLOCKED);9696+ int nr_pages = thp_nr_pages(page);9797+9898+ mod_zone_page_state(page_zone(page), NR_MLOCK, nr_pages);9999+ count_vm_events(UNEVICTABLE_PGMLOCKED, nr_pages);102100 if (!isolate_lru_page(page))103101 putback_lru_page(page);104102 }···142138143139 /* Did try_to_unlock() succeed or punt? */144140 if (!PageMlocked(page))145145- count_vm_event(UNEVICTABLE_PGMUNLOCKED);141141+ count_vm_events(UNEVICTABLE_PGMUNLOCKED, thp_nr_pages(page));146142147143 putback_lru_page(page);148144}···158154 */159155static void __munlock_isolation_failed(struct page *page)160156{157157+ int nr_pages = thp_nr_pages(page);158158+161159 if (PageUnevictable(page))162162- __count_vm_event(UNEVICTABLE_PGSTRANDED);160160+ __count_vm_events(UNEVICTABLE_PGSTRANDED, nr_pages);163161 else164164- __count_vm_event(UNEVICTABLE_PGMUNLOCKED);162162+ __count_vm_events(UNEVICTABLE_PGMUNLOCKED, nr_pages);165163}166164167165/**
+8
mm/page_isolation.c
···170170 * pageblocks we may have modified and return -EBUSY to caller. This171171 * prevents two threads from simultaneously working on overlapping ranges.172172 *173173+ * Please note that there is no strong synchronization with the page allocator174174+ * either. Pages might be freed while their page blocks are marked ISOLATED.175175+ * In some cases pages might still end up on pcp lists and that would allow176176+ * for their allocation even when they are in fact isolated already. Depending177177+ * on how strong of a guarantee the caller needs drain_all_pages might be needed178178+ * (e.g. __offline_pages will need to call it after check for isolated range for179179+ * a next retry).180180+ *173181 * Return: the number of isolated pageblocks on success and -EBUSY if any part174182 * of range cannot be isolated.175183 */
···279279280280 if (!(sb->s_flags & SB_KERNMOUNT)) {281281 spin_lock(&sbinfo->stat_lock);282282- if (!sbinfo->free_inodes) {283283- spin_unlock(&sbinfo->stat_lock);284284- return -ENOSPC;282282+ if (sbinfo->max_inodes) {283283+ if (!sbinfo->free_inodes) {284284+ spin_unlock(&sbinfo->stat_lock);285285+ return -ENOSPC;286286+ }287287+ sbinfo->free_inodes--;285288 }286286- sbinfo->free_inodes--;287289 if (inop) {288290 ino = sbinfo->next_ino++;289291 if (unlikely(is_zero_ino(ino)))
+3-3
mm/swap.c
···494494495495 unevictable = (vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) == VM_LOCKED;496496 if (unlikely(unevictable) && !TestSetPageMlocked(page)) {497497+ int nr_pages = thp_nr_pages(page);497498 /*498499 * We use the irq-unsafe __mod_zone_page_stat because this499500 * counter is not modified from interrupt context, and the pte500501 * lock is held(spinlock), which implies preemption disabled.501502 */502502- __mod_zone_page_state(page_zone(page), NR_MLOCK,503503- thp_nr_pages(page));504504- count_vm_event(UNEVICTABLE_PGMLOCKED);503503+ __mod_zone_page_state(page_zone(page), NR_MLOCK, nr_pages);504504+ count_vm_events(UNEVICTABLE_PGMLOCKED, nr_pages);505505 }506506 lru_cache_add(page);507507}
+8-2
mm/vmscan.c
···42684268 for (i = 0; i < pvec->nr; i++) {42694269 struct page *page = pvec->pages[i];42704270 struct pglist_data *pagepgdat = page_pgdat(page);42714271+ int nr_pages;4271427242724272- pgscanned++;42734273+ if (PageTransTail(page))42744274+ continue;42754275+42764276+ nr_pages = thp_nr_pages(page);42774277+ pgscanned += nr_pages;42784278+42734279 if (pagepgdat != pgdat) {42744280 if (pgdat)42754281 spin_unlock_irq(&pgdat->lru_lock);···42944288 ClearPageUnevictable(page);42954289 del_page_from_lru_list(page, lruvec, LRU_UNEVICTABLE);42964290 add_page_to_lru_list(page, lruvec, lru);42974297- pgrescued++;42914291+ pgrescued += nr_pages;42984292 }42994293 }43004294
+30-17
scripts/kconfig/lkc.h
···6666 fprintf(stderr, "Error in writing or end of file.\n");6767}68686969-/* menu.c */7070-void _menu_init(void);7171-void menu_warn(struct menu *menu, const char *fmt, ...);7272-struct menu *menu_add_menu(void);7373-void menu_end_menu(void);7474-void menu_add_entry(struct symbol *sym);7575-void menu_add_dep(struct expr *dep);7676-void menu_add_visibility(struct expr *dep);7777-struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);7878-void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);7979-void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);8080-void menu_add_option_modules(void);8181-void menu_add_option_defconfig_list(void);8282-void menu_add_option_allnoconfig_y(void);8383-void menu_finalize(struct menu *parent);8484-void menu_set_type(int type);8585-8669/* util.c */8770struct file *file_lookup(const char *name);8871void *xmalloc(size_t size);···91108void str_append(struct gstr *gs, const char *s);92109void str_printf(struct gstr *gs, const char *fmt, ...);93110const char *str_get(struct gstr *gs);111111+112112+/* menu.c */113113+void _menu_init(void);114114+void menu_warn(struct menu *menu, const char *fmt, ...);115115+struct menu *menu_add_menu(void);116116+void menu_end_menu(void);117117+void menu_add_entry(struct symbol *sym);118118+void menu_add_dep(struct expr *dep);119119+void menu_add_visibility(struct expr *dep);120120+struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);121121+void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);122122+void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);123123+void menu_add_option_modules(void);124124+void menu_add_option_defconfig_list(void);125125+void menu_add_option_allnoconfig_y(void);126126+void menu_finalize(struct menu *parent);127127+void menu_set_type(int type);128128+129129+extern struct menu rootmenu;130130+131131+bool menu_is_empty(struct menu *menu);132132+bool menu_is_visible(struct menu *menu);133133+bool menu_has_prompt(struct menu *menu);134134+const char *menu_get_prompt(struct menu *menu);135135+struct menu *menu_get_root_menu(struct menu *menu);136136+struct menu *menu_get_parent_menu(struct menu *menu);137137+bool menu_has_help(struct menu *menu);138138+const char *menu_get_help(struct menu *menu);139139+struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);140140+void menu_get_ext_help(struct menu *menu, struct gstr *help);9414195142/* symbol.c */96143void sym_clear_all_valid(void);
-14
scripts/kconfig/lkc_proto.h
···1212void conf_set_changed_callback(void (*fn)(void));1313void conf_set_message_callback(void (*fn)(const char *s));14141515-/* menu.c */1616-extern struct menu rootmenu;1717-1818-bool menu_is_empty(struct menu *menu);1919-bool menu_is_visible(struct menu *menu);2020-bool menu_has_prompt(struct menu *menu);2121-const char * menu_get_prompt(struct menu *menu);2222-struct menu * menu_get_root_menu(struct menu *menu);2323-struct menu * menu_get_parent_menu(struct menu *menu);2424-bool menu_has_help(struct menu *menu);2525-const char * menu_get_help(struct menu *menu);2626-struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);2727-void menu_get_ext_help(struct menu *menu, struct gstr *help);2828-2915/* symbol.c */3016extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];3117
···59935993 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);59945994}5995599559965996+59975997+static void alc294_gx502_toggle_output(struct hda_codec *codec,59985998+ struct hda_jack_callback *cb)59995999+{60006000+ /* The Windows driver sets the codec up in a very different way where60016001+ * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it60026002+ */60036003+ if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)60046004+ alc_write_coef_idx(codec, 0x10, 0x8a20);60056005+ else60066006+ alc_write_coef_idx(codec, 0x10, 0x0a20);60076007+}60086008+60096009+static void alc294_fixup_gx502_hp(struct hda_codec *codec,60106010+ const struct hda_fixup *fix, int action)60116011+{60126012+ /* Pin 0x21: headphones/headset mic */60136013+ if (!is_jack_detectable(codec, 0x21))60146014+ return;60156015+60166016+ switch (action) {60176017+ case HDA_FIXUP_ACT_PRE_PROBE:60186018+ snd_hda_jack_detect_enable_callback(codec, 0x21,60196019+ alc294_gx502_toggle_output);60206020+ break;60216021+ case HDA_FIXUP_ACT_INIT:60226022+ /* Make sure to start in a correct state, i.e. if60236023+ * headphones have been plugged in before powering up the system60246024+ */60256025+ alc294_gx502_toggle_output(codec, NULL);60266026+ break;60276027+ }60286028+}60296029+59966030static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,59976031 const struct hda_fixup *fix, int action)59986032{···62076173 ALC285_FIXUP_THINKPAD_HEADSET_JACK,62086174 ALC294_FIXUP_ASUS_HPE,62096175 ALC294_FIXUP_ASUS_COEF_1B,61766176+ ALC294_FIXUP_ASUS_GX502_HP,61776177+ ALC294_FIXUP_ASUS_GX502_PINS,61786178+ ALC294_FIXUP_ASUS_GX502_VERBS,62106179 ALC285_FIXUP_HP_GPIO_LED,62116180 ALC285_FIXUP_HP_MUTE_LED,62126181 ALC236_FIXUP_HP_MUTE_LED,···62286191 ALC269_FIXUP_LEMOTE_A1802,62296192 ALC269_FIXUP_LEMOTE_A190X,62306193 ALC256_FIXUP_INTEL_NUC8_RUGGED,61946194+ ALC255_FIXUP_XIAOMI_HEADSET_MIC,62316195};6232619662336197static const struct hda_fixup alc269_fixups[] = {···73767338 .chained = true,73777339 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC73787340 },73417341+ [ALC294_FIXUP_ASUS_GX502_PINS] = {73427342+ .type = HDA_FIXUP_PINS,73437343+ .v.pins = (const struct hda_pintbl[]) {73447344+ { 0x19, 0x03a11050 }, /* front HP mic */73457345+ { 0x1a, 0x01a11830 }, /* rear external mic */73467346+ { 0x21, 0x03211020 }, /* front HP out */73477347+ { }73487348+ },73497349+ .chained = true,73507350+ .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS73517351+ },73527352+ [ALC294_FIXUP_ASUS_GX502_VERBS] = {73537353+ .type = HDA_FIXUP_VERBS,73547354+ .v.verbs = (const struct hda_verb[]) {73557355+ /* set 0x15 to HP-OUT ctrl */73567356+ { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },73577357+ /* unmute the 0x15 amp */73587358+ { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },73597359+ { }73607360+ },73617361+ .chained = true,73627362+ .chain_id = ALC294_FIXUP_ASUS_GX502_HP73637363+ },73647364+ [ALC294_FIXUP_ASUS_GX502_HP] = {73657365+ .type = HDA_FIXUP_FUNC,73667366+ .v.func = alc294_fixup_gx502_hp,73677367+ },73797368 [ALC294_FIXUP_ASUS_COEF_1B] = {73807369 .type = HDA_FIXUP_VERBS,73817370 .v.verbs = (const struct hda_verb[]) {···75927527 .chained = true,75937528 .chain_id = ALC269_FIXUP_HEADSET_MODE75947529 },75307530+ [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {75317531+ .type = HDA_FIXUP_VERBS,75327532+ .v.verbs = (const struct hda_verb[]) {75337533+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },75347534+ { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },75357535+ { }75367536+ },75377537+ .chained = true,75387538+ .chain_id = ALC289_FIXUP_ASUS_GA40175397539+ },75957540};7596754175977542static const struct snd_pci_quirk alc269_fixup_tbl[] = {···77867711 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),77877712 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),77887713 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),77147714+ SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),77897715 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),77907716 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),77917717 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),···78997823 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),79007824 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),79017825 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */78267826+ SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),79027827 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),79037828 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),79047829 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),···80778000 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},80788001 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},80798002 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},80038003+ {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},80808004 {}80818005};80828006#define ALC225_STANDARD_PINS \
+2-2
sound/soc/codecs/max98373-sdw.c
···838838839839 /* Regmap Initialization */840840 regmap = devm_regmap_init_sdw(slave, &max98373_sdw_regmap);841841- if (!regmap)842842- return -EINVAL;841841+ if (IS_ERR(regmap))842842+ return PTR_ERR(regmap);843843844844 return max98373_init(slave, regmap);845845}
+7
sound/soc/codecs/pcm3168a.c
···306306 struct pcm3168a_priv *pcm3168a = snd_soc_component_get_drvdata(dai->component);307307 int ret;308308309309+ /*310310+ * Some sound card sets 0 Hz as reset,311311+ * but it is impossible to set. Ignore it here312312+ */313313+ if (freq == 0)314314+ return 0;315315+309316 if (freq > PCM3168A_MAX_SYSCLK)310317 return -EINVAL;311318
+2-2
sound/soc/codecs/rt1308-sdw.c
···684684685685 /* Regmap Initialization */686686 regmap = devm_regmap_init_sdw(slave, &rt1308_sdw_regmap);687687- if (!regmap)688688- return -EINVAL;687687+ if (IS_ERR(regmap))688688+ return PTR_ERR(regmap);689689690690 rt1308_sdw_init(&slave->dev, regmap, slave);691691
···2727 int hp_startup_mode;2828 int series_startup;2929 int no_series_update;3030+ bool micd_scthr;30313132 bool no_cache_dac_hp_direct;3233 struct list_head dcs_cache;
+11
sound/soc/intel/atom/sst-mfld-platform-pcm.c
···333333 if (ret_val < 0)334334 goto out_power_up;335335336336+ /*337337+ * Make sure the period to be multiple of 1ms to align the338338+ * design of firmware. Apply same rule to buffer size to make339339+ * sure alsa could always find a value for period size340340+ * regardless the buffer size given by user space.341341+ */342342+ snd_pcm_hw_constraint_step(substream->runtime, 0,343343+ SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 48);344344+ snd_pcm_hw_constraint_step(substream->runtime, 0,345345+ SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 48);346346+336347 /* Make sure, that the period size is always even */337348 snd_pcm_hw_constraint_step(substream->runtime, 0,338349 SNDRV_PCM_HW_PARAM_PERIODS, 2);
···181181 struct snd_soc_dai *dai;182182183183 for_each_card_rtds(card, rtd) {184184- if (!strstr(rtd->dai_link->codecs->name, "ehdaudio"))184184+ if (!strstr(rtd->dai_link->codecs->name, "ehdaudio0D0"))185185 continue;186186 dai = asoc_rtd_to_codec(rtd, 0);187187 hda_pvt = snd_soc_component_get_drvdata(dai->component);
+4-3
sound/soc/intel/boards/sof_maxim_common.c
···6666 int j;6767 int ret = 0;68686969+ /* set spk pin by playback only */7070+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)7171+ return 0;7272+6973 for_each_rtd_codec_dais(rtd, j, codec_dai) {7074 struct snd_soc_component *component = codec_dai->component;7175 struct snd_soc_dapm_context *dapm =···9086 case SNDRV_PCM_TRIGGER_STOP:9187 case SNDRV_PCM_TRIGGER_SUSPEND:9288 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:9393- /* Make sure no streams are active before disable pin */9494- if (snd_soc_dai_active(codec_dai) != 1)9595- break;9689 ret = snd_soc_dapm_disable_pin(dapm, pin_name);9790 if (!ret)9891 snd_soc_dapm_sync(dapm);
···1818#define CTRL0_TODDR_SEL_RESAMPLE BIT(30)1919#define CTRL0_TODDR_EXT_SIGNED BIT(29)2020#define CTRL0_TODDR_PP_MODE BIT(28)2121+#define CTRL0_TODDR_SYNC_CH BIT(27)2122#define CTRL0_TODDR_TYPE_MASK GENMASK(15, 13)2223#define CTRL0_TODDR_TYPE(x) ((x) << 13)2324#define CTRL0_TODDR_MSB_POS_MASK GENMASK(12, 8)···190189 .dai_drv = &axg_toddr_dai_drv191190};192191192192+static int g12a_toddr_dai_startup(struct snd_pcm_substream *substream,193193+ struct snd_soc_dai *dai)194194+{195195+ struct axg_fifo *fifo = snd_soc_dai_get_drvdata(dai);196196+ int ret;197197+198198+ ret = axg_toddr_dai_startup(substream, dai);199199+ if (ret)200200+ return ret;201201+202202+ /*203203+ * Make sure the first channel ends up in the at beginning of the output204204+ * As weird as it looks, without this the first channel may be misplaced205205+ * in memory, with a random shift of 2 channels.206206+ */207207+ regmap_update_bits(fifo->map, FIFO_CTRL0, CTRL0_TODDR_SYNC_CH,208208+ CTRL0_TODDR_SYNC_CH);209209+210210+ return 0;211211+}212212+193213static const struct snd_soc_dai_ops g12a_toddr_ops = {194214 .prepare = g12a_toddr_dai_prepare,195215 .hw_params = axg_toddr_dai_hw_params,196196- .startup = axg_toddr_dai_startup,216216+ .startup = g12a_toddr_dai_startup,197217 .shutdown = axg_toddr_dai_shutdown,198218};199219
···412412 supported_codec = false;413413414414 for_each_link_cpus(dai_link, i, cpu) {415415- dai = snd_soc_find_dai(cpu);415415+ dai = snd_soc_find_dai_with_mutex(cpu);416416 if (dai && snd_soc_dai_stream_valid(dai, direction)) {417417 supported_cpu = true;418418 break;419419 }420420 }421421 for_each_link_codecs(dai_link, i, codec) {422422- dai = snd_soc_find_dai(codec);422422+ dai = snd_soc_find_dai_with_mutex(codec);423423 if (dai && snd_soc_dai_stream_valid(dai, direction)) {424424 supported_codec = true;425425 break;
+1-1
sound/soc/soc-pcm.c
···812812 return 0;813813814814config_err:815815- for_each_rtd_dais(rtd, i, dai)815815+ for_each_rtd_dais_rollback(rtd, i, dai)816816 snd_soc_dai_shutdown(dai, substream);817817818818 snd_soc_link_shutdown(substream);
+2-2
sound/soc/ti/ams-delta.c
···446446/* Will be used if the codec ever has its own digital_mute function */447447static int ams_delta_startup(struct snd_pcm_substream *substream)448448{449449- return ams_delta_digital_mute(NULL, 0, substream->stream);449449+ return ams_delta_mute(NULL, 0, substream->stream);450450}451451452452static void ams_delta_shutdown(struct snd_pcm_substream *substream)453453{454454- ams_delta_digital_mute(NULL, 1, substream->stream);454454+ ams_delta_mute(NULL, 1, substream->stream);455455}456456457457
+1-1
tools/include/uapi/linux/in.h
···135135 * this socket to prevent accepting spoofed ones.136136 */137137#define IP_PMTUDISC_INTERFACE 4138138-/* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get138138+/* weaker version of IP_PMTUDISC_INTERFACE, which allows packets to get139139 * fragmented if they exeed the interface mtu140140 */141141#define IP_PMTUDISC_OMIT 5
···619619 if (!is_static_jump(insn))620620 continue;621621622622- if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET)622622+ if (insn->offset == FAKE_JUMP_OFFSET)623623 continue;624624625625 reloc = find_reloc_by_dest_range(file->elf, insn->sec,
+2-2
tools/perf/bench/sched-messaging.c
···6666/* Block until we're ready to go */6767static void ready(int ready_out, int wakefd)6868{6969- char dummy;7069 struct pollfd pollfd = { .fd = wakefd, .events = POLLIN };71707271 /* Tell them we're ready. */7373- if (write(ready_out, &dummy, 1) != 1)7272+ if (write(ready_out, "R", 1) != 1)7473 err(EXIT_FAILURE, "CLIENT: ready write");75747675 /* Wait for "GO" signal */···8485 unsigned int i, j;85868687 ready(ctx->ready_out, ctx->wakefd);8888+ memset(data, 'S', sizeof(data));87898890 /* Now pump to every receiver. */8991 for (i = 0; i < nr_loops; i++) {
···125125 {126126 "EventName": "ex_ret_fus_brnch_inst",127127 "EventCode": "0x1d0",128128- "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.",128128+ "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."129129 }130130]
+1
tools/perf/tests/attr/README
···4949 perf record --call-graph fp kill (test-record-graph-fp)5050 perf record --group -e cycles,instructions kill (test-record-group)5151 perf record -e '{cycles,instructions}' kill (test-record-group1)5252+ perf record -e '{cycles/period=1/,instructions/period=2/}:S' kill (test-record-group2)5253 perf record -D kill (test-record-no-delay)5354 perf record -i kill (test-record-no-inherit)5455 perf record -n kill (test-record-no-samples)
···946946947947 perf_evlist__set_maps(&evlist->core, cpus, threads);948948949949+ /* as evlist now has references, put count here */950950+ perf_cpu_map__put(cpus);951951+ perf_thread_map__put(threads);952952+949953 return 0;950954951955out_delete_threads:···12771273 goto out_put;1278127412791275 perf_evlist__set_maps(&evlist->core, cpus, threads);12801280-out:12811281- return err;12761276+12771277+ perf_thread_map__put(threads);12821278out_put:12831279 perf_cpu_map__put(cpus);12841284- goto out;12801280+out:12811281+ return err;12851282}1286128312871284int evlist__open(struct evlist *evlist)
+7-3
tools/perf/util/evsel.c
···976976 * We default some events to have a default interval. But keep977977 * it a weak assumption overridable by the user.978978 */979979- if (!attr->sample_period || (opts->user_freq != UINT_MAX ||980980- opts->user_interval != ULLONG_MAX)) {979979+ if (!attr->sample_period) {981980 if (opts->freq) {982982- evsel__set_sample_bit(evsel, PERIOD);983981 attr->freq = 1;984982 attr->sample_freq = opts->freq;985983 } else {986984 attr->sample_period = opts->default_interval;987985 }988986 }987987+ /*988988+ * If attr->freq was set (here or earlier), ask for period989989+ * to be sampled.990990+ */991991+ if (attr->freq)992992+ evsel__set_sample_bit(evsel, PERIOD);989993990994 if (opts->no_samples)991995 attr->sample_freq = 0;
+25-10
tools/perf/util/metricgroup.c
···85858686 list_for_each_entry_safe(expr, tmp, &me->head, nd) {8787 free(expr->metric_refs);8888+ free(expr->metric_events);8889 free(expr);8990 }9091···317316 if (!metric_refs) {318317 ret = -ENOMEM;319318 free(metric_events);319319+ free(expr);320320 break;321321 }322322···532530 continue;533531 strlist__add(me->metrics, s);534532 }533533+534534+ if (!raw)535535+ free(s);535536 }536537 free(omg);537538 }···672667 m->has_constraint = metric_no_group || metricgroup__has_constraint(pe);673668 INIT_LIST_HEAD(&m->metric_refs);674669 m->metric_refs_cnt = 0;675675- *mp = m;676670677671 parent = expr_ids__alloc(ids);678672 if (!parent) {···684680 free(m);685681 return -ENOMEM;686682 }683683+ *mp = m;687684 } else {688685 /*689686 * We got here for the referenced metric, via the···719714 * all the metric's IDs and add it to the parent context.720715 */721716 if (expr__find_other(pe->metric_expr, NULL, &m->pctx, runtime) < 0) {722722- expr__ctx_clear(&m->pctx);723723- free(m);717717+ if (m->metric_refs_cnt == 0) {718718+ expr__ctx_clear(&m->pctx);719719+ free(m);720720+ *mp = NULL;721721+ }724722 return -EINVAL;725723 }726724···942934943935 ret = add_metric(&list, pe, metric_no_group, &m, NULL, &ids);944936 if (ret)945945- return ret;937937+ goto out;946938947939 /*948940 * Process any possible referenced metrics···951943 ret = resolve_metric(metric_no_group,952944 &list, map, &ids);953945 if (ret)954954- return ret;946946+ goto out;955947 }956948957949 /* End of pmu events. */958958- if (!has_match)959959- return -EINVAL;950950+ if (!has_match) {951951+ ret = -EINVAL;952952+ goto out;953953+ }960954961955 list_for_each_entry(m, &list, nd) {962956 if (events->len > 0)···973963 }974964 }975965966966+out:967967+ /*968968+ * add to metric_list so that they can be released969969+ * even if it's failed970970+ */976971 list_splice(&list, metric_list);977972 expr_ids__exit(&ids);978978- return 0;973973+ return ret;979974}980975981976static int metricgroup__add_metric_list(const char *list, bool metric_no_group,···10551040 ret = metricgroup__add_metric_list(str, metric_no_group,10561041 &extra_events, &metric_list, map);10571042 if (ret)10581058- return ret;10431043+ goto out;10591044 pr_debug("adding %s\n", extra_events.buf);10601045 bzero(&parse_error, sizeof(parse_error));10611046 ret = __parse_events(perf_evlist, extra_events.buf, &parse_error, fake_pmu);···10631048 parse_events_print_error(&parse_error, extra_events.buf);10641049 goto out;10651050 }10661066- strbuf_release(&extra_events);10671051 ret = metricgroup__setup_events(&metric_list, metric_no_merge,10681052 perf_evlist, metric_events);10691053out:10701054 metricgroup__free_metrics(&metric_list);10551055+ strbuf_release(&extra_events);10711056 return ret;10721057}10731058
···274274}275275276276/* Delete an alias entry. */277277-static void perf_pmu_free_alias(struct perf_pmu_alias *newalias)277277+void perf_pmu_free_alias(struct perf_pmu_alias *newalias)278278{279279 zfree(&newalias->name);280280 zfree(&newalias->desc);···13521352 memset(bits, 0, BITS_TO_BYTES(PERF_PMU_FORMAT_BITS));13531353 for (b = from; b <= to; b++)13541354 set_bit(b, bits);13551355+}13561356+13571357+void perf_pmu__del_formats(struct list_head *formats)13581358+{13591359+ struct perf_pmu_format *fmt, *tmp;13601360+13611361+ list_for_each_entry_safe(fmt, tmp, formats, list) {13621362+ list_del(&fmt->list);13631363+ free(fmt->name);13641364+ free(fmt);13651365+ }13551366}1356136713571368static int sub_non_neg(int a, int b)
+2
tools/perf/util/pmu.h
···9494 int config, unsigned long *bits);9595void perf_pmu__set_format(unsigned long *bits, long from, long to);9696int perf_pmu__format_parse(char *dir, struct list_head *head);9797+void perf_pmu__del_formats(struct list_head *formats);97989899struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);99100···114113115114struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu);116115bool pmu_uncore_alias_match(const char *pmu_name, const char *name);116116+void perf_pmu_free_alias(struct perf_pmu_alias *alias);117117118118int perf_pmu__convert_scale(const char *scale, char **end, double *sval);119119
+26-8
tools/perf/util/record.c
···22#include "debug.h"33#include "evlist.h"44#include "evsel.h"55+#include "evsel_config.h"56#include "parse-events.h"67#include <errno.h>78#include <limits.h>···3433 return leader;3534}36353636+static u64 evsel__config_term_mask(struct evsel *evsel)3737+{3838+ struct evsel_config_term *term;3939+ struct list_head *config_terms = &evsel->config_terms;4040+ u64 term_types = 0;4141+4242+ list_for_each_entry(term, config_terms, list) {4343+ term_types |= 1 << term->type;4444+ }4545+ return term_types;4646+}4747+3748static void evsel__config_leader_sampling(struct evsel *evsel, struct evlist *evlist)3849{3950 struct perf_event_attr *attr = &evsel->core.attr;4051 struct evsel *leader = evsel->leader;4152 struct evsel *read_sampler;5353+ u64 term_types, freq_mask;42544355 if (!leader->sample_read)4456 return;···6147 if (evsel == read_sampler)6248 return;63495050+ term_types = evsel__config_term_mask(evsel);6451 /*6565- * Disable sampling for all group members other than the leader in6666- * case the leader 'leads' the sampling, except when the leader is an6767- * AUX area event, in which case the 2nd event in the group is the one6868- * that 'leads' the sampling.5252+ * Disable sampling for all group members except those with explicit5353+ * config terms or the leader. In the case of an AUX area event, the 2nd5454+ * event in the group is the one that 'leads' the sampling.6955 */7070- attr->freq = 0;7171- attr->sample_freq = 0;7272- attr->sample_period = 0;7373- attr->write_backward = 0;5656+ freq_mask = (1 << EVSEL__CONFIG_TERM_FREQ) | (1 << EVSEL__CONFIG_TERM_PERIOD);5757+ if ((term_types & freq_mask) == 0) {5858+ attr->freq = 0;5959+ attr->sample_freq = 0;6060+ attr->sample_period = 0;6161+ }6262+ if ((term_types & (1 << EVSEL__CONFIG_TERM_OVERWRITE)) == 0)6363+ attr->write_backward = 0;74647565 /*7666 * We don't get a sample for slave events, we make them when delivering
+15-13
tools/perf/util/stat-shadow.c
···517517518518 color = get_ratio_color(GRC_CACHE_MISSES, ratio);519519520520- out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache hits", ratio);520520+ out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache accesses", ratio);521521}522522523523static void print_l1_icache_misses(struct perf_stat_config *config,···538538 ratio = avg / total * 100.0;539539540540 color = get_ratio_color(GRC_CACHE_MISSES, ratio);541541- out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache hits", ratio);541541+ out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache accesses", ratio);542542}543543544544static void print_dtlb_cache_misses(struct perf_stat_config *config,···558558 ratio = avg / total * 100.0;559559560560 color = get_ratio_color(GRC_CACHE_MISSES, ratio);561561- out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache hits", ratio);561561+ out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache accesses", ratio);562562}563563564564static void print_itlb_cache_misses(struct perf_stat_config *config,···578578 ratio = avg / total * 100.0;579579580580 color = get_ratio_color(GRC_CACHE_MISSES, ratio);581581- out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache hits", ratio);581581+ out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache accesses", ratio);582582}583583584584static void print_ll_cache_misses(struct perf_stat_config *config,···598598 ratio = avg / total * 100.0;599599600600 color = get_ratio_color(GRC_CACHE_MISSES, ratio);601601- out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache hits", ratio);601601+ out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache accesses", ratio);602602}603603604604/*···853853double test_generic_metric(struct metric_expr *mexp, int cpu, struct runtime_stat *st)854854{855855 struct expr_parse_ctx pctx;856856- double ratio;856856+ double ratio = 0.0;857857858858 if (prepare_metric(mexp->metric_events, mexp->metric_refs, &pctx, cpu, st) < 0)859859- return 0.;859859+ goto out;860860861861 if (expr__parse(&ratio, &pctx, mexp->metric_expr, 1))862862- return 0.;862862+ ratio = 0.0;863863864864+out:865865+ expr__ctx_clear(&pctx);864866 return ratio;865867}866868···920918 if (runtime_stat_n(st, STAT_L1_DCACHE, ctx, cpu) != 0)921919 print_l1_dcache_misses(config, cpu, evsel, avg, out, st);922920 else923923- print_metric(config, ctxp, NULL, NULL, "of all L1-dcache hits", 0);921921+ print_metric(config, ctxp, NULL, NULL, "of all L1-dcache accesses", 0);924922 } else if (925923 evsel->core.attr.type == PERF_TYPE_HW_CACHE &&926924 evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_L1I |···930928 if (runtime_stat_n(st, STAT_L1_ICACHE, ctx, cpu) != 0)931929 print_l1_icache_misses(config, cpu, evsel, avg, out, st);932930 else933933- print_metric(config, ctxp, NULL, NULL, "of all L1-icache hits", 0);931931+ print_metric(config, ctxp, NULL, NULL, "of all L1-icache accesses", 0);934932 } else if (935933 evsel->core.attr.type == PERF_TYPE_HW_CACHE &&936934 evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_DTLB |···940938 if (runtime_stat_n(st, STAT_DTLB_CACHE, ctx, cpu) != 0)941939 print_dtlb_cache_misses(config, cpu, evsel, avg, out, st);942940 else943943- print_metric(config, ctxp, NULL, NULL, "of all dTLB cache hits", 0);941941+ print_metric(config, ctxp, NULL, NULL, "of all dTLB cache accesses", 0);944942 } else if (945943 evsel->core.attr.type == PERF_TYPE_HW_CACHE &&946944 evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_ITLB |···950948 if (runtime_stat_n(st, STAT_ITLB_CACHE, ctx, cpu) != 0)951949 print_itlb_cache_misses(config, cpu, evsel, avg, out, st);952950 else953953- print_metric(config, ctxp, NULL, NULL, "of all iTLB cache hits", 0);951951+ print_metric(config, ctxp, NULL, NULL, "of all iTLB cache accesses", 0);954952 } else if (955953 evsel->core.attr.type == PERF_TYPE_HW_CACHE &&956954 evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_LL |···960958 if (runtime_stat_n(st, STAT_LL_CACHE, ctx, cpu) != 0)961959 print_ll_cache_misses(config, cpu, evsel, avg, out, st);962960 else963963- print_metric(config, ctxp, NULL, NULL, "of all LL-cache hits", 0);961961+ print_metric(config, ctxp, NULL, NULL, "of all LL-cache accesses", 0);964962 } else if (evsel__match(evsel, HARDWARE, HW_CACHE_MISSES)) {965963 total = runtime_stat_avg(st, STAT_CACHEREFS, ctx, cpu);966964
+7-2
tools/testing/selftests/powerpc/mm/prot_sao.c
···77#include <stdlib.h>88#include <string.h>99#include <sys/mman.h>1010+#include <unistd.h>10111112#include <asm/cputable.h>1213···1918{2019 char *p;21202222- /* SAO was introduced in 2.06 and removed in 3.1 */2121+ /*2222+ * SAO was introduced in 2.06 and removed in 3.1. It's disabled in2323+ * guests/LPARs by default, so also skip if we are running in a guest.2424+ */2325 SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06) ||2424- have_hwcap2(PPC_FEATURE2_ARCH_3_1));2626+ have_hwcap2(PPC_FEATURE2_ARCH_3_1) ||2727+ access("/proc/device-tree/rtas/ibm,hypertas-functions", F_OK) == 0);25282629 /*2730 * Ensure we can ask for PROT_SAO.