Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
static void default_deferred_error_interrupt(void) { pr_err("Unexpected deferred interrupt at vector %x\n", DEFERRED_ERROR_VECTOR); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
static void disable_err_thresholding(struct cpuinfo_x86 *c, unsigned int bank) { int i, num_msrs; u64 hwcr; bool need_toggle; u32 msrs[NR_BLOCKS]; if (c->x86 == 0x15 && bank == 4) { msrs[0] = 0x00000413; msrs[1] = 0xc0000408; /* MC4_MISC1 */ num_msrs = 2; } else if (c->x86 == 0x17 && (c->x86_mo...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
void mce_amd_feature_init(struct cpuinfo_x86 *c) { unsigned int bank, block, cpu = smp_processor_id(); u32 low = 0, high = 0, address = 0; int offset = -1; for (bank = 0; bank < this_cpu_read(mce_num_banks); ++bank) { if (mce_flags.smca) smca_configure(bank, cpu); disable_err_thresholding(c, ban...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
bool amd_mce_is_memory_error(struct mce *m) { u8 xec = (m->status >> 16) & 0x1f; if (mce_flags.smca) return smca_get_bank_type(m->extcpu, m->bank) == SMCA_UMC && xec == 0x0; return m->bank == 4 && xec == 0x8; }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
static void __log_error(unsigned int bank, u64 status, u64 addr, u64 misc) { struct mce m; mce_setup(&m); m.status = status; m.misc = misc; m.bank = bank; m.tsc = rdtsc(); if (m.status & MCI_STATUS_ADDRV) { m.addr = addr; if (mce_flags.smca) { u8 lsb = (m.addr >> 56) & 0x3f; m.add...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
static inline bool _log_error_bank(unsigned int bank, u32 msr_stat, u32 msr_addr, u64 misc) { u64 status, addr = 0; rdmsrl(msr_stat, status); if (!(status & MCI_STATUS_VAL)) return false; if (status & MCI_STATUS_ADDRV) rdmsrl(msr_addr, addr); __log_error(bank, sta...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
static void amd_deferred_error_interrupt(void) { unsigned int bank; for (bank = 0; bank < this_cpu_read(mce_num_banks); ++bank) log_error_deferred(bank); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
static void log_and_reset_block(struct threshold_block *block) { struct thresh_restart tr; u32 low = 0, high = 0; if (!block) return; if (rdmsr_safe(block->address, &low, &high)) return; if (!(high & MASK_OVERFLOW_HI)) return; log_error_thresholding(block->bank, ((u64)high << 32) | low); ...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
static const char *get_name(unsigned int cpu, unsigned int bank, struct threshold_block *b) { enum smca_bank_types bank_type; if (!mce_flags.smca) { if (b && bank == 4) return bank4_names(b); return th_names[bank]; } bank_type = smca_get_bank_type(cpu, bank); if (...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
static int __threshold_add_blocks(struct threshold_bank *b) { struct list_head *head = &b->blocks->miscj; struct threshold_block *pos = NULL; struct threshold_block *tmp = NULL; int err = 0; err = kobject_add(&b->blocks->kobj, b->kobj, b->blocks->kobj.name); if (err) return err; list_for_each_entry...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/amd.c
static int threshold_create_bank(struct threshold_bank **bp, unsigned int cpu, unsigned int bank) { struct device *dev = this_cpu_read(mce_device); struct amd_northbridge *nb = NULL; struct threshold_bank *b = NULL; const char *name = get_name(cpu, bank, NULL); int err = 0; ...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
void mce_setup(struct mce *m) { memset(m, 0, sizeof(struct mce)); m->cpu = m->extcpu = smp_processor_id(); m->time = __ktime_get_real_seconds(); m->cpuvendor = boot_cpu_data.x86_vendor; m->cpuid = cpuid_eax(1); m->socketid = cpu_data(m->extcpu).phys_proc_id; m->apicid = cpu_data(m->extcpu).initial_apicid...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
void mce_register_decode_chain(struct notifier_block *nb) { if (WARN_ON(nb->priority < MCE_PRIO_LOWEST || nb->priority > MCE_PRIO_HIGHEST)) return; blocking_notifier_chain_register(&x86_mce_decoder_chain, nb); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
void mce_unregister_decode_chain(struct notifier_block *nb) { blocking_notifier_chain_unregister(&x86_mce_decoder_chain, nb); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void __print_mce(struct mce *m) { pr_emerg(HW_ERR "CPU %d: Machine Check%s: %Lx Bank %d: %016Lx\n", m->extcpu, (m->mcgstatus & MCG_STATUS_MCIP ? " Exception" : ""), m->mcgstatus, m->bank, m->status); if (m->ip) { pr_emerg(HW_ERR "RIP%s %02x:<%016Lx> ", !(m->mcgstatus &...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void wait_for_panic(void) { long timeout = PANIC_TIMEOUT * USEC_PER_SEC; preempt_disable(); local_irq_enable(); while (timeout-- > 0) udelay(1); if (panic_timeout == 0) panic_timeout = mca_cfg.panic_timeout; panic("Panicing machine check CPU died"); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
void ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr) { if (wrmsr) { pr_emerg("MSR access error: WRMSR to 0x%x (tried to write 0x%08x%08x) at " "rIP: 0x%lx (%pS)\n", (unsigned int)regs->cx, (unsigned int)regs->dx, (unsigned int)regs->ax, regs->ip, (void *)regs->ip); }...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void mce_irq_work_cb(struct irq_work *entry) { mce_schedule_work(); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
int mce_usable_address(struct mce *m) { if (!(m->status & MCI_STATUS_ADDRV)) return 0; if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL && boot_cpu_data.x86_vendor != X86_VENDOR_ZHAOXIN) return 1; if (!(m->status & MCI_STATUS_MISCV)) return 0; if (MCI_MISC_ADDR_LSB(m->misc) > PAGE_SHIFT) ...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static bool whole_page(struct mce *m) { if (!mca_cfg.ser || !(m->status & MCI_STATUS_MISCV)) return true; return MCI_MISC_ADDR_LSB(m->misc) >= PAGE_SHIFT; }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
bool mce_is_correctable(struct mce *m) { if (m->cpuvendor == X86_VENDOR_AMD && m->status & MCI_STATUS_DEFERRED) return false; if (m->cpuvendor == X86_VENDOR_HYGON && m->status & MCI_STATUS_DEFERRED) return false; if (m->status & MCI_STATUS_UC) return false; return true; }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static int mce_default_notifier(struct notifier_block *nb, unsigned long val, void *data) { struct mce *m = (struct mce *)data; if (!m) return NOTIFY_DONE; if (mca_cfg.print_all || !m->kflags) __print_mce(m); return NOTIFY_DONE; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static noinstr void mce_read_aux(struct mce *m, int i) { if (m->status & MCI_STATUS_MISCV) m->misc = mce_rdmsrl(mca_msr_reg(i, MCA_MISC)); if (m->status & MCI_STATUS_ADDRV) { m->addr = mce_rdmsrl(mca_msr_reg(i, MCA_ADDR)); if (mca_cfg.ser && (m->status & MCI_STATUS_MISCV)) { u8 shift = MCI_MISC_...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static noinstr int mce_start(int *no_way_out) { u64 timeout = (u64)mca_cfg.monarch_timeout * NSEC_PER_USEC; int order, ret = -1; if (!timeout) return ret; arch_atomic_add(*no_way_out, &global_nwo); order = arch_atomic_inc_return(&mce_callin); arch_cpumask_clear_cpu(smp_processor_id(), &mce_missing_cp...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void kill_me_maybe(struct callback_head *cb) { struct task_struct *p = container_of(cb, struct task_struct, mce_kill_me); int flags = MF_ACTION_REQUIRED; int ret; p->mce_count = 0; pr_err("Uncorrected hardware memory error in user-access at %llx", p->mce_addr); if (!p->mce_ripv) flags ...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static noinstr void unexpected_machine_check(struct pt_regs *regs) { instrumentation_begin(); pr_err("CPU#%d: Unexpected int18 (Machine Check)\n", smp_processor_id()); instrumentation_end(); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void mce_timer_fn(struct timer_list *t) { struct timer_list *cpu_t = this_cpu_ptr(&mce_timer); unsigned long iv; WARN_ON(cpu_t != t); iv = __this_cpu_read(mce_next_interval); if (mce_available(this_cpu_ptr(&cpu_info))) { machine_check_poll(0, this_cpu_ptr(&mce_poll_banks)); if (mce_intel_cm...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
void mce_timer_kick(unsigned long interval) { struct timer_list *t = this_cpu_ptr(&mce_timer); unsigned long iv = __this_cpu_read(mce_next_interval); __start_timer(t, interval); if (interval < iv) __this_cpu_write(mce_next_interval, interval); }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void __mcheck_cpu_init_generic(void) { enum mcp_flags m_fl = 0; mce_banks_t all_banks; u64 cap; if (!mca_cfg.bootlog) m_fl = MCP_DONTLOG; bitmap_fill(all_banks, MAX_NR_BANKS); machine_check_poll(MCP_UC | MCP_QUEUE_LOG | m_fl, &all_banks); cr4_set_bits(X86_CR4_MCE); rdmsrl(MSR_IA32_MCG_CAP...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static int __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c) { if (c->x86 != 5) return 0; switch (c->x86_vendor) { case X86_VENDOR_INTEL: intel_p5_mcheck_init(c); mce_flags.p5 = 1; return 1; case X86_VENDOR_CENTAUR: winchip_mcheck_init(c); mce_flags.winchip = 1; return 1; default:...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c) { switch (c->x86_vendor) { case X86_VENDOR_INTEL: mce_intel_feature_init(c); mce_adjust_timer = cmci_intel_adjust_timer; break; case X86_VENDOR_AMD: { mce_amd_feature_init(c); break; } case X86_VENDOR_HYGON: mce_hygon_featu...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void __mcheck_cpu_clear_vendor(struct cpuinfo_x86 *c) { switch (c->x86_vendor) { case X86_VENDOR_INTEL: mce_intel_feature_clear(c); break; case X86_VENDOR_ZHAOXIN: mce_zhaoxin_feature_clear(c); break; default: break; } }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
void mcheck_cpu_init(struct cpuinfo_x86 *c) { if (mca_cfg.disabled) return; if (__mcheck_cpu_ancient_init(c)) return; if (!mce_available(c)) return; __mcheck_cpu_cap_init(); if (__mcheck_cpu_apply_quirks(c) < 0) { mca_cfg.disabled = 1; return; } if (mce_gen_pool_init()) { mca_...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
void mcheck_cpu_clear(struct cpuinfo_x86 *c) { if (mca_cfg.disabled) return; if (!mce_available(c)) return; __mcheck_cpu_clear_vendor(c); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void mce_disable_error_reporting(void) { struct mce_bank *mce_banks = this_cpu_ptr(mce_banks_array); int i; for (i = 0; i < this_cpu_read(mce_num_banks); i++) { struct mce_bank *b = &mce_banks[i]; if (b->init) wrmsrl(mca_msr_reg(i, MCA_CTL), 0); } return; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static ssize_t set_cmci_disabled(struct device *s, struct device_attribute *attr, const char *buf, size_t size) { u64 new; if (kstrtou64(buf, 0, &new) < 0) return -EINVAL; mutex_lock(&mce_sysfs_mutex); if (mca_cfg.cmci_disabled ^ !!new) { ...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static ssize_t store_int_with_restart(struct device *s, struct device_attribute *attr, const char *buf, size_t size) { unsigned long old_check_interval = check_interval; ssize_t ret = device_store_ulong(s, attr, buf, size); if (check_in...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static int mce_device_create(unsigned int cpu) { struct device *dev; int err; int i, j; if (!mce_available(&boot_cpu_data)) return -EIO; dev = per_cpu(mce_device, cpu); if (dev) return 0; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; dev->id = cpu; dev->bus = &mce...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void mce_disable_cpu(void) { if (!mce_available(raw_cpu_ptr(&cpu_info))) return; if (!cpuhp_tasks_frozen) cmci_clear(); vendor_disable_error_reporting(); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static int mce_cpu_online(unsigned int cpu) { struct timer_list *t = this_cpu_ptr(&mce_timer); int ret; mce_device_create(cpu); ret = mce_threshold_create_device(cpu); if (ret) { mce_device_remove(cpu); return ret; } mce_reenable_cpu(); mce_start_timer(t); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static __init void mce_init_banks(void) { int i; for (i = 0; i < MAX_NR_BANKS; i++) { struct mce_bank_dev *b = &mce_bank_devs[i]; struct device_attribute *a = &b->attr; b->bank = i; sysfs_attr_init(&a->attr); a->attr.name = b->attrname; snprintf(b->attrname, ATTR_LEN, "bank%d", i); ...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static int __init mcheck_disable(char *str) { mca_cfg.disabled = 1; return 1; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static void mce_reset(void) { atomic_set(&mce_fake_panicked, 0); atomic_set(&mce_executing, 0); atomic_set(&mce_callin, 0); atomic_set(&global_nwo, 0); cpumask_setall(&mce_missing_cpus); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/core.c
static int __init mcheck_late_init(void) { if (mca_cfg.recovery) enable_copy_mc_fragile(); mcheck_debugfs_init(); mce_schedule_work(); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/dev-mcelog.c
static int dev_mce_log(struct notifier_block *nb, unsigned long val, void *data) { struct mce *mce = (struct mce *)data; unsigned int entry; if (mce->kflags & MCE_HANDLED_CEC) return NOTIFY_DONE; mutex_lock(&mce_chrdev_read_mutex); entry = mcelog->next; if (entry >= mcelog->le...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/dev-mcelog.c
void mce_work_trigger(void) { if (mce_helper[0]) schedule_work(&mce_trigger_work); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/dev-mcelog.c
static ssize_t show_trigger(struct device *s, struct device_attribute *attr, char *buf) { strcpy(buf, mce_helper); strcat(buf, "\n"); return strlen(mce_helper) + 1; }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/dev-mcelog.c
static ssize_t set_trigger(struct device *s, struct device_attribute *attr, const char *buf, size_t siz) { char *p; strncpy(mce_helper, buf, sizeof(mce_helper)); mce_helper[sizeof(mce_helper) - 1] = 0; p = strchr(mce_helper, '\n'); if (p) *p = 0; return strlen(mce_helper) ...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/dev-mcelog.c
static ssize_t mce_chrdev_read(struct file *filp, char __user *ubuf, size_t usize, loff_t *off) { char __user *buf = ubuf; unsigned next; int i, err; mutex_lock(&mce_chrdev_read_mutex); if (!mce_apei_read_done) { err = __mce_read_apei(&buf, usize); if (err || buf != ub...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/dev-mcelog.c
static long mce_chrdev_ioctl(struct file *f, unsigned int cmd, unsigned long arg) { int __user *p = (int __user *)arg; if (!capable(CAP_SYS_ADMIN)) return -EPERM; switch (cmd) { case MCE_GET_RECORD_LEN: return put_user(sizeof(struct mce), p); case MCE_GET_LOG_LEN: r...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/dev-mcelog.c
void mce_register_injector_chain(struct notifier_block *nb) { blocking_notifier_chain_register(&mce_injector_chain, nb); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/dev-mcelog.c
static __init int dev_mcelog_init_device(void) { int mce_log_len; int err; mce_log_len = max(MCE_LOG_MIN_LEN, num_online_cpus()); mcelog = kzalloc(struct_size(mcelog, entry, mce_log_len), GFP_KERNEL); if (!mcelog) return -ENOMEM; memcpy(mcelog->signature, MCE_LOG_SIGNATURE, sizeof(mcelog->signature));...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/genpool.c
static bool is_duplicate_mce_record(struct mce_evt_llist *t, struct mce_evt_llist *l) { struct mce_evt_llist *node; struct mce *m1, *m2; m1 = &t->mce; llist_for_each_entry(node, &l->llnode, llnode) { m2 = &node->mce; if (!mce_cmp(m1, m2)) return true; } r...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/genpool.c
struct llist_node *mce_gen_pool_prepare_records(void) { struct llist_node *head; LLIST_HEAD(new_head); struct mce_evt_llist *node, *t; head = llist_del_all(&mce_event_llist); if (!head) return NULL; llist_for_each_entry_safe(node, t, head, llnode) { if (!is_duplicate_mce_record(node, t)) lli...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/genpool.c
bool mce_gen_pool_empty(void) { return llist_empty(&mce_event_llist); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/inject.c
static int raise_local(void) { struct mce *m = this_cpu_ptr(&injectm); int context = MCJ_CTX(m->inject_flags); int ret = 0; int cpu = m->extcpu; if (m->inject_flags & MCJ_EXCEPTION) { pr_info("Triggering MCE exception on CPU %d\n", cpu); switch (context) { case MCJ_CTX_IRQ: fallthrough; ...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/inject.c
static ssize_t flags_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { char buf[MAX_FLAG_OPT_SIZE]; int n; n = sprintf(buf, "%s\n", flags_options[inj_type]); return simple_read_from_buffer(ubuf, cnt, ppos, buf, n); }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/inject.c
static int inj_extcpu_set(void *data, u64 val) { struct mce *m = (struct mce *)data; if (val >= nr_cpu_ids || !cpu_online(val)) { pr_err("%s: Invalid CPU: %llu\n", __func__, val); return -EINVAL; } m->extcpu = val; return 0; }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/inject.c
static void trigger_dfr_int(void *info) { asm volatile("int %0" ::"i"(DEFERRED_ERROR_VECTOR)); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/inject.c
static void trigger_thr_int(void *info) { asm volatile("int %0" ::"i"(THRESHOLD_APIC_VECTOR)); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/inject.c
static void toggle_nb_mca_mst_cpu(u16 nid) { struct amd_northbridge *nb; struct pci_dev *F3; u32 val; int err; nb = node_to_amd_nb(nid); if (!nb) return; F3 = nb->misc; if (!F3) return; err = pci_read_config_dword(F3, NBCFG, &val); if (err) { pr_err("%s: Error reading F%dx%03x.\n", _...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/inject.c
static int inj_bank_set(void *data, u64 val) { struct mce *m = (struct mce *)data; u8 n_banks; u64 cap; rdmsrl_on_cpu(m->extcpu, MSR_IA32_MCG_CAP, &cap); n_banks = cap & MCG_BANKCNT_MASK; if (val >= n_banks) { pr_err("MCA bank %llu non-existent on CPU%d\n", val, m->extcpu); return -EINVAL; } ...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/inject.c
static void check_hw_inj_possible(void) { int cpu; u8 bank; if (!cpu_feature_enabled(X86_FEATURE_SMCA)) return; cpu = get_cpu(); for (bank = 0; bank < MAX_NR_BANKS; ++bank) { u64 status = MCI_STATUS_VAL, ipid; /* Check whether bank is populated */ rdmsrl(MSR_AMD64_SMCA_MCx_IPID(bank), ipid...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/inject.c
static void __exit inject_exit(void) { mce_unregister_injector_chain(&inject_nb); unregister_nmi_handler(NMI_LOCAL, "mce_notify"); debugfs_remove_recursive(dfs_inj); dfs_inj = NULL; memset(&dfs_fls, 0, sizeof(dfs_fls)); free_cpumask_var(mce_inject_cpumask); }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/intel.c
static int cmci_supported(int *banks) { u64 cap; if (mca_cfg.cmci_disabled || mca_cfg.ignore_ce) return 0; if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL && boot_cpu_data.x86_vendor != X86_VENDOR_ZHAOXIN) return 0; if (!boot_cpu_has(X86_FEATURE_APIC) || lapic_get_maxlvt() < 6) return 0; ...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/intel.c
static bool lmce_supported(void) { u64 tmp; if (mca_cfg.lmce_disabled) return false; rdmsrl(MSR_IA32_MCG_CAP, tmp); if ((tmp & (MCG_SER_P | MCG_LMCE_P)) != (MCG_SER_P | MCG_LMCE_P)) return false; /* * BIOS should indicate support for LMCE by setting bit 20 in * IA32_FEAT_CTL without which to...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/intel.c
void mce_intel_hcpu_update(unsigned long cpu) { if (per_cpu(cmci_storm_state, cpu) == CMCI_STORM_ACTIVE) atomic_dec(&cmci_storm_on_cpus); per_cpu(cmci_storm_state, cpu) = CMCI_STORM_NONE; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/intel.c
static void cmci_toggle_interrupt_mode(bool on) { unsigned long flags, *owned; int bank; u64 val; raw_spin_lock_irqsave(&cmci_discover_lock, flags); owned = this_cpu_ptr(mce_banks_owned); for_each_set_bit(bank, owned, MAX_NR_BANKS) { rdmsrl(MSR_IA32_MCx_CTL2(bank), val); if (on) val |= MCI_...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/intel.c
static void __cmci_disable_bank(int bank) { u64 val; if (!test_bit(bank, this_cpu_ptr(mce_banks_owned))) return; rdmsrl(MSR_IA32_MCx_CTL2(bank), val); val &= ~MCI_CTL2_CMCI_EN; wrmsrl(MSR_IA32_MCx_CTL2(bank), val); __clear_bit(bank, this_cpu_ptr(mce_banks_owned)); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/intel.c
void cmci_rediscover(void) { int banks; if (!cmci_supported(&banks)) return; on_each_cpu(cmci_rediscover_work_func, NULL, 1); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/intel.c
void cmci_reenable(void) { int banks; if (cmci_supported(&banks)) cmci_discover(banks); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/intel.c
void cmci_disable_bank(int bank) { int banks; unsigned long flags; if (!cmci_supported(&banks)) return; raw_spin_lock_irqsave(&cmci_discover_lock, flags); __cmci_disable_bank(bank); raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/intel.c
void intel_init_lmce(void) { u64 val; if (!lmce_supported()) return; rdmsrl(MSR_IA32_MCG_EXT_CTL, val); if (!(val & MCG_EXT_CTL_LMCE_EN)) wrmsrl(MSR_IA32_MCG_EXT_CTL, val | MCG_EXT_CTL_LMCE_EN); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/internal.h
static inline bool intel_filter_mce(struct mce *m) { return false; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/internal.h
static inline ssize_t apei_read_mce(struct mce *m, u64 *record_id) { return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/internal.h
static inline int apei_clear_mce(u64 record_id) { return -EINVAL; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/internal.h
static inline bool mce_cmp(struct mce *m1, struct mce *m2) { return m1->bank != m2->bank || m1->status != m2->status || m1->addr != m2->addr || m1->misc != m2->misc; }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/severity.c
static void *s_next(struct seq_file *f, void *data, loff_t *pos) { if (++(*pos) >= ARRAY_SIZE(severities)) return NULL; return &severities[*pos]; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/severity.c
static ssize_t severities_coverage_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { int i; for (i = 0; i < ARRAY_SIZE(severities); i++) severities[i].covered = 0; return count; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/threshold.c
static void default_threshold_interrupt(void) { pr_err("Unexpected threshold interrupt at vector %x\n", THRESHOLD_APIC_VECTOR); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/mce/winchip.c
noinstr void winchip_machine_check(struct pt_regs *regs) { instrumentation_begin(); pr_emerg("CPU0: Machine Check Exception.\n"); add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE); instrumentation_end(); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
static unsigned int __verify_patch_size(u8 family, u32 sh_psize, size_t buf_size) { u32 max_size; if (family >= 0x15) return min_t(u32, sh_psize, buf_size); #define F1XH_MPB_MAX_SIZE 2048 #define F14H_MPB_MAX_SIZE 1824 switch (family) { case 0x10 ... 0x12: max_...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
static int __apply_microcode_amd(struct microcode_amd *mc) { u32 rev, dummy; native_wrmsrl(MSR_AMD64_PATCH_LOADER, (u64)(long)&mc->hdr.data_code); native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy); if (rev != mc->hdr.patch_id) return -1; return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
static void __load_ucode_amd(unsigned int cpuid_1_eax, struct cpio_data *ret) { struct ucode_cpu_info *uci; struct cpio_data cp; const char *path; bool use_pa; if (IS_ENABLED(CONFIG_X86_32)) { uci = (struct ucode_cpu_info *)__pa_nodebug(ucode_cpu_info); path = (const char *)__pa_nodebug(ucode_path); ...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
void __init load_ucode_amd_bsp(unsigned int cpuid_1_eax) { struct cpio_data cp = {}; __load_ucode_amd(cpuid_1_eax, &cp); if (!(cp.data && cp.size)) return; apply_microcode_early_amd(cpuid_1_eax, cp.data, cp.size, true); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
void reload_ucode_amd(void) { struct microcode_amd *mc; u32 rev, dummy __always_unused; mc = (struct microcode_amd *)amd_ucode_patch; rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy); if (rev < mc->hdr.patch_id) { if (!__apply_microcode_amd(mc)) { ucode_new_rev = mc->hdr.patch_id; pr_info("reload ...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
static struct ucode_patch *find_patch(unsigned int cpu) { u16 equiv_id; equiv_id = __find_equiv_id(cpu); if (!equiv_id) return NULL; return cache_find_patch(equiv_id); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
static size_t install_equiv_cpu_table(const u8 *buf, size_t buf_size) { u32 equiv_tbl_len; const u32 *hdr; if (!verify_equivalence_table(buf, buf_size, false)) return 0; hdr = (const u32 *)buf; equiv_tbl_len = hdr[2]; equiv_table.entry = vmalloc(equiv_tbl_len); if (!equiv_table.entry) { pr_err(...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
static void free_equiv_cpu_table(void) { vfree(equiv_table.entry); memset(&equiv_table, 0, sizeof(equiv_table)); }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover, unsigned int *patch_size) { struct microcode_header_amd *mc_hdr; struct ucode_patch *patch; u16 proc_id; int ret; ret = verify_patch(family, fw, leftover, patch_size, false); if (ret) return ret; ...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
static enum ucode_state __load_microcode_amd(u8 family, const u8 *data, size_t size) { u8 *fw = (u8 *)data; size_t offset; offset = install_equiv_cpu_table(data, size); if (!offset) return UCODE_ERROR; fw += offset; size -= offset; if (*(u32 *)fw != UCO...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/amd.c
static void microcode_fini_cpu_amd(int cpu) { struct ucode_cpu_info *uci = ucode_cpu_info + cpu; uci->mc = NULL; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/core.c
static bool __init check_loader_disabled_bsp(void) { static const char *__dis_opt_str = "dis_ucode_ldr"; #ifdef CONFIG_X86_32 const char *cmdline = (const char *)__pa_nodebug(boot_command_line); const char *option = (const char *)__pa_nodebug(__dis_opt_str); bool *res = (bool *)__pa_nodebug(&dis_ucode_ldr); #...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/core.c
void load_ucode_ap(void) { unsigned int cpuid_1_eax; if (check_loader_disabled_ap()) return; cpuid_1_eax = native_cpuid_eax(1); switch (x86_cpuid_vendor()) { case X86_VENDOR_INTEL: if (x86_family(cpuid_1_eax) >= 6) load_ucode_intel_ap(); break; case X86_VENDOR_AMD: if (x86_family(c...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/core.c
struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa) { #ifdef CONFIG_BLK_DEV_INITRD unsigned long start = 0; size_t size; #ifdef CONFIG_X86_32 struct boot_params *params; if (use_pa) params = (struct boot_params *)__pa_nodebug(&boot_params); else params = &boot_params; size = ...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/core.c
void reload_early_microcode(void) { int vendor, family; vendor = x86_cpuid_vendor(); family = x86_cpuid_family(); switch (vendor) { case X86_VENDOR_INTEL: if (family >= 6) reload_ucode_intel(); break; case X86_VENDOR_AMD: if (family >= 0x10) reload_ucode_amd(); break; defaul...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/core.c
static int microcode_reload_late(void) { int old = boot_cpu_data.microcode, ret; pr_err("Attempting late microcode loading - it is dangerous and taints the " "kernel.\n"); pr_err("You should switch to early loading, if possible.\n"); atomic_set(&late_cpus_in, 0); atomic_set(&late_cpus_out, 0); r...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/core.c
static int mc_cpu_online(unsigned int cpu) { struct device *dev = get_cpu_device(cpu); if (sysfs_create_group(&dev->kobj, &mc_attr_group)) pr_err("Failed to create group for CPU%d\n", cpu); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/core.c
static int mc_cpu_down_prep(unsigned int cpu) { struct device *dev; dev = get_cpu_device(cpu); microcode_fini_cpu(cpu); sysfs_remove_group(&dev->kobj, &mc_attr_group); pr_debug("%s: CPU%d\n", __func__, cpu); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/cpu/microcode/intel.c
static struct ucode_patch *memdup_patch(void *data, unsigned int size) { struct ucode_patch *p; p = kzalloc(sizeof(struct ucode_patch), GFP_KERNEL); if (!p) return NULL; p->data = kmemdup(data, size, GFP_KERNEL); if (!p->data) { kfree(p); return NULL; } return p; }
[ 0, 0 ]