type
stringclasses
5 values
content
stringlengths
9
163k
includes
#include <linux/prctl.h>
includes
#include <linux/slab.h>
includes
#include <linux/sched.h>
includes
#include <linux/sched/idle.h>
includes
#include <linux/sched/debug.h>
includes
#include <linux/sched/task.h>
includes
#include <linux/sched/task_stack.h>
includes
#include <linux/init.h>
includes
#include <linux/export.h>
includes
#include <linux/pm.h>
includes
#include <linux/tick.h>
includes
#include <linux/random.h>
includes
#include <linux/user-return-notifier.h>
includes
#include <linux/dmi.h>
includes
#include <linux/utsname.h>
includes
#include <linux/stackprotector.h>
includes
#include <linux/cpuidle.h>
includes
#include <linux/acpi.h>
includes
#include <linux/elf-randomize.h>
includes
#include <trace/events/power.h>
includes
#include <linux/hw_breakpoint.h>
includes
#include <asm/cpu.h>
includes
#include <asm/apic.h>
includes
#include <asm/syscalls.h>
includes
#include <linux/uaccess.h>
includes
#include <asm/mwait.h>
includes
#include <asm/fpu/internal.h>
includes
#include <asm/debugreg.h>
includes
#include <asm/nmi.h>
includes
#include <asm/tlbflush.h>
includes
#include <asm/mce.h>
includes
#include <asm/vm86.h>
includes
#include <asm/switch_to.h>
includes
#include <asm/desc.h>
includes
#include <asm/prctl.h>
includes
#include <asm/spec-ctrl.h>
includes
#include <asm/proto.h>
defines
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
defines
#define LSTATE_SSB 0
structs
struct ssb_state { struct ssb_state *shared_state; raw_spinlock_t lock; unsigned int disable_state; unsigned long local_state; };
functions
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) { memcpy(dst, src, arch_task_struct_size); #ifdef CONFIG_VM86 dst->thread.vm86 = NULL; #endif return fpu__copy(dst, src); }
functions
void exit_thread(struct task_struct *tsk) { struct thread_struct *t = &tsk->thread; unsigned long *bp = t->io_bitmap_ptr; struct fpu *fpu = &t->fpu; if (bp) { struct tss_struct *tss = &per_cpu(cpu_tss_rw, get_cpu()); t->io_bitmap_ptr = NULL; clear_thread_flag(TIF_IO_BITMAP); /* * Careful, clear this in...
functions
void flush_thread(void) { struct task_struct *tsk = current; flush_ptrace_hw_breakpoint(tsk); memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); fpu__clear(&tsk->thread.fpu); }
functions
void disable_TSC(void) { preempt_disable(); if (!test_and_set_thread_flag(TIF_NOTSC)) /* * Must flip the CPU state synchronously with * TIF_NOTSC in the current running context. */ cr4_set_bits(X86_CR4_TSD); preempt_enable(); }
functions
void enable_TSC(void) { preempt_disable(); if (test_and_clear_thread_flag(TIF_NOTSC)) /* * Must flip the CPU state synchronously with * TIF_NOTSC in the current running context. */ cr4_clear_bits(X86_CR4_TSD); preempt_enable(); }
functions
int get_tsc_mode(unsigned long adr) { unsigned int val; if (test_thread_flag(TIF_NOTSC)) val = PR_TSC_SIGSEGV; else val = PR_TSC_ENABLE; return put_user(val, (unsigned int __user *)adr); }
functions
int set_tsc_mode(unsigned int val) { if (val == PR_TSC_SIGSEGV) disable_TSC(); else if (val == PR_TSC_ENABLE) enable_TSC(); else return -EINVAL; return 0; }
functions
void set_cpuid_faulting(bool on) { u64 msrval; msrval = this_cpu_read(msr_misc_features_shadow); msrval &= ~MSR_MISC_FEATURES_ENABLES_CPUID_FAULT; msrval |= (on << MSR_MISC_FEATURES_ENABLES_CPUID_FAULT_BIT); this_cpu_write(msr_misc_features_shadow, msrval); wrmsrl(MSR_MISC_FEATURES_ENABLES, msrval); }
functions
void disable_cpuid(void) { preempt_disable(); if (!test_and_set_thread_flag(TIF_NOCPUID)) { /* * Must flip the CPU state synchronously with * TIF_NOCPUID in the current running context. */ set_cpuid_faulting(true); }
functions
void enable_cpuid(void) { preempt_disable(); if (test_and_clear_thread_flag(TIF_NOCPUID)) { /* * Must flip the CPU state synchronously with * TIF_NOCPUID in the current running context. */ set_cpuid_faulting(false); }
functions
int get_cpuid_mode(void) { return !test_thread_flag(TIF_NOCPUID); }
functions
int set_cpuid_mode(struct task_struct *task, unsigned long cpuid_enabled) { if (!boot_cpu_has(X86_FEATURE_CPUID_FAULT)) return -ENODEV; if (cpuid_enabled) enable_cpuid(); else disable_cpuid(); return 0; }
functions
void arch_setup_new_exec(void) { /* If cpuid was previously disabled for this task, re-enable it. */ if (test_thread_flag(TIF_NOCPUID)) enable_cpuid(); /* * Don't inherit TIF_SSBD across exec boundary when * PR_SPEC_DISABLE_NOEXEC is used. */ if (test_thread_flag(TIF_SSBD) && task_spec_ssb_noexec(curr...
functions
void switch_to_bitmap(struct thread_struct *prev, struct thread_struct *next, unsigned long tifp, unsigned long tifn) { struct tss_struct *tss = this_cpu_ptr(&cpu_tss_rw); if (tifn & _TIF_IO_BITMAP) { /* * Copy the relevant range of the IO bitmap. * Normally this is 128 bytes or less: */ ...
functions
else if (tifp & _TIF_IO_BITMAP) { /* * Clear any possible leftover bits: */ memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); }
functions
void speculative_store_bypass_ht_init(void) { struct ssb_state *st = this_cpu_ptr(&ssb_state); unsigned int this_cpu = smp_processor_id(); unsigned int cpu; st->local_state = 0; /* * Shared state setup happens once on the first bringup * of the CPU. It's not destroyed on CPU hotunplug. */ if (st->shared_s...
functions
void amd_set_core_ssb_state(unsigned long tifn) { struct ssb_state *st = this_cpu_ptr(&ssb_state); u64 msr = x86_amd_ls_cfg_base; if (!static_cpu_has(X86_FEATURE_ZEN)) { msr |= ssbd_tif_to_amd_ls_cfg(tifn); wrmsrl(MSR_AMD64_LS_CFG, msr); return; }
functions
void amd_set_core_ssb_state(unsigned long tifn) { u64 msr = x86_amd_ls_cfg_base | ssbd_tif_to_amd_ls_cfg(tifn); wrmsrl(MSR_AMD64_LS_CFG, msr); }
functions
void amd_set_ssb_virt_state(unsigned long tifn) { /* * SSBD has the same definition in SPEC_CTRL and VIRT_SPEC_CTRL, * so ssbd_tif_to_spec_ctrl() just works. */ wrmsrl(MSR_AMD64_VIRT_SPEC_CTRL, ssbd_tif_to_spec_ctrl(tifn)); }
functions
void __speculation_ctrl_update(unsigned long tifp, unsigned long tifn) { unsigned long tif_diff = tifp ^ tifn; u64 msr = x86_spec_ctrl_base; bool updmsr = false; lockdep_assert_irqs_disabled(); /* * If TIF_SSBD is different, select the proper mitigation * method. Note that if SSBD mitigation is d...
functions
long speculation_ctrl_update_tif(struct task_struct *tsk) { if (test_and_clear_tsk_thread_flag(tsk, TIF_SPEC_FORCE_UPDATE)) { if (task_spec_ssb_disable(tsk)) set_tsk_thread_flag(tsk, TIF_SSBD); else clear_tsk_thread_flag(tsk, TIF_SSBD); if (task_spec_ib_disable(tsk)) set_tsk_thread_flag(tsk, TIF_SPEC_I...
functions
void speculation_ctrl_update(unsigned long tif) { unsigned long flags; /* Forced update. Make sure all relevant TIF flags are different */ local_irq_save(flags); __speculation_ctrl_update(~tif, tif); local_irq_restore(flags); }
functions
void speculation_ctrl_update_current(void) { preempt_disable(); speculation_ctrl_update(speculation_ctrl_update_tif(current)); preempt_enable(); }
functions
void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p) { struct thread_struct *prev, *next; unsigned long tifp, tifn; prev = &prev_p->thread; next = &next_p->thread; tifn = READ_ONCE(task_thread_info(next_p)->flags); tifp = READ_ONCE(task_thread_info(prev_p)->flags); switch_to_bitmap(pre...
functions
void play_dead(void) { BUG(); }
functions
void arch_cpu_idle_enter(void) { tsc_verify_tsc_adjust(false); local_touch_nmi(); }
functions
void arch_cpu_idle_dead(void) { play_dead(); }
functions
void arch_cpu_idle(void) { x86_idle(); }
functions
__cpuidle default_idle(void) { trace_cpu_idle_rcuidle(1, smp_processor_id()); safe_halt(); trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); }
functions
bool xen_set_default_idle(void) { bool ret = !!x86_idle; x86_idle = default_idle; return ret; }
functions
void stop_this_cpu(void *dummy) { local_irq_disable(); /* * Remove this CPU: */ set_cpu_online(smp_processor_id(), false); disable_local_APIC(); mcheck_cpu_clear(this_cpu_ptr(&cpu_info)); /* * Use wbinvd on processors that support SME. This provides support * for performing a successful kexec when going ...
functions
void amd_e400_idle(void) { /* * We cannot use static_cpu_has_bug() here because X86_BUG_AMD_APIC_C1E * gets set after static_cpu_has() places have been converted via * alternatives. */ if (!boot_cpu_has_bug(X86_BUG_AMD_APIC_C1E)) { default_idle(); return; }
functions
int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c) { if (c->x86_vendor != X86_VENDOR_INTEL) return 0; if (!cpu_has(c, X86_FEATURE_MWAIT) || boot_cpu_has_bug(X86_BUG_MONITOR)) return 0; return 1; }
functions
void mwait_idle(void) { if (!current_set_polling_and_test()) { trace_cpu_idle_rcuidle(1, smp_processor_id()); if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) { mb(); /* quirk */ clflush((void *)&current_thread_info()->flags); mb(); /* quirk */ }
functions
void select_idle_routine(const struct cpuinfo_x86 *c) { #ifdef CONFIG_SMP if (boot_option_idle_override == IDLE_POLL && smp_num_siblings > 1) pr_warn_once("WARNING: polling idle and HT enabled, performance may degrade\n"); #endif if (x86_idle || boot_option_idle_override == IDLE_POLL) return; if (boot_cpu_has_b...
functions
void amd_e400_c1e_apic_setup(void) { if (boot_cpu_has_bug(X86_BUG_AMD_APIC_C1E)) { pr_info("Switch to broadcast mode on CPU%d\n", smp_processor_id()); local_irq_disable(); tick_broadcast_force(); local_irq_enable(); }
functions
__init arch_post_acpi_subsys_init(void) { u32 lo, hi; if (!boot_cpu_has_bug(X86_BUG_AMD_E400)) return; /* * AMD E400 detection needs to happen after ACPI has been enabled. If * the machine is affected K8_INTP_C1E_ACTIVE_MASK bits are set in * MSR_K8_INT_PENDING_MSG. */ rdmsr(MSR_K8_INT_PENDING_MSG, lo, ...
functions
__init idle_setup(char *str) { if (!str) return -EINVAL; if (!strcmp(str, "poll")) { pr_info("using polling idle threads\n"); boot_option_idle_override = IDLE_POLL; cpu_idle_poll_ctrl(true); }
functions
long arch_align_stack(unsigned long sp) { if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) sp -= get_random_int() % 8192; return sp & ~0xf; }
functions
long arch_randomize_brk(struct mm_struct *mm) { return randomize_page(mm->brk, 0x02000000); }
functions
long get_wchan(struct task_struct *p) { unsigned long start, bottom, top, sp, fp, ip, ret = 0; int count = 0; if (p == current || p->state == TASK_RUNNING) return 0; if (!try_get_task_stack(p)) return 0; start = (unsigned long)task_stack_page(p); if (!start) goto out; /* * Layout of the stack page: ...
functions
long do_arch_prctl_common(struct task_struct *task, int option, unsigned long cpuid_enabled) { switch (option) { case ARCH_GET_CPUID: return get_cpuid_mode(); case ARCH_SET_CPUID: return set_cpuid_mode(task, cpuid_enabled); }
defines
#define MODULE_NAME "spca561"
defines
#define EXPOSURE_MIN 1
defines
#define EXPOSURE_DEF 700 /* == 10 fps */
defines
#define EXPOSURE_MAX (2047 + 325) /* see setexposure */
defines
#define CONTRAST_MIN 0x00
defines
#define CONTRAST_DEF 0x20
defines
#define CONTRAST_MAX 0x3f
defines
#define BRIGHTNESS_MIN 0
defines
#define BRIGHTNESS_DEF 0x20
defines
#define BRIGHTNESS_MAX 0x3f
defines
#define HUE_MIN 1
defines
#define HUE_DEF 0x40
defines
#define HUE_MAX 0x7f
defines
#define AUTOGAIN_MIN 0
defines
#define AUTOGAIN_DEF 1
defines
#define AUTOGAIN_MAX 1
defines
#define GAIN_MIN 0
defines
#define GAIN_DEF 63