Lines Matching refs:b
78 struct threshold_block *b; member
91 static const char *bank4_names(const struct threshold_block *b) in bank4_names() argument
93 switch (b->address) { in bank4_names()
105 WARN(1, "Funny MSR: 0x%08x\n", b->address); in bank4_names()
126 static int lvt_off_valid(struct threshold_block *b, int apic, u32 lo, u32 hi) in lvt_off_valid() argument
132 "for bank %d, block %d (MSR%08X=0x%x%08x)\n", b->cpu, in lvt_off_valid()
133 b->bank, b->block, b->address, hi, lo); in lvt_off_valid()
140 b->cpu, apic, b->bank, b->block, b->address, hi, lo); in lvt_off_valid()
156 rdmsr(tr->b->address, lo, hi); in threshold_restart_bank()
158 if (tr->b->threshold_limit < (hi & THRESHOLD_MAX)) in threshold_restart_bank()
164 (THRESHOLD_MAX - tr->b->threshold_limit); in threshold_restart_bank()
167 (tr->old_limit - tr->b->threshold_limit); in threshold_restart_bank()
176 if (!tr->b->interrupt_capable) in threshold_restart_bank()
180 if (lvt_off_valid(tr->b, tr->lvt_off, lo, hi)) { in threshold_restart_bank()
187 if (tr->b->interrupt_enable) in threshold_restart_bank()
193 wrmsr(tr->b->address, lo, hi); in threshold_restart_bank()
196 static void mce_threshold_block_init(struct threshold_block *b, int offset) in mce_threshold_block_init() argument
199 .b = b, in mce_threshold_block_init()
204 b->threshold_limit = THRESHOLD_MAX; in mce_threshold_block_init()
253 struct threshold_block b; in mce_amd_feature_init() local
285 memset(&b, 0, sizeof(b)); in mce_amd_feature_init()
286 b.cpu = cpu; in mce_amd_feature_init()
287 b.bank = bank; in mce_amd_feature_init()
288 b.block = block; in mce_amd_feature_init()
289 b.address = address; in mce_amd_feature_init()
290 b.interrupt_capable = lvt_interrupt_supported(bank, high); in mce_amd_feature_init()
292 if (!b.interrupt_capable) in mce_amd_feature_init()
295 b.interrupt_enable = 1; in mce_amd_feature_init()
304 mce_threshold_block_init(&b, offset); in mce_amd_feature_init()
447 static ssize_t show_ ## name(struct threshold_block *b, char *buf) \
449 return sprintf(buf, "%lu\n", (unsigned long) b->name); \
455 store_interrupt_enable(struct threshold_block *b, const char *buf, size_t size) in SHOW_FIELDS()
460 if (!b->interrupt_capable) in SHOW_FIELDS()
466 b->interrupt_enable = !!new; in SHOW_FIELDS()
469 tr.b = b; in SHOW_FIELDS()
471 smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); in SHOW_FIELDS()
477 store_threshold_limit(struct threshold_block *b, const char *buf, size_t size) in store_threshold_limit() argument
491 tr.old_limit = b->threshold_limit; in store_threshold_limit()
492 b->threshold_limit = new; in store_threshold_limit()
493 tr.b = b; in store_threshold_limit()
495 smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); in store_threshold_limit()
500 static ssize_t show_error_count(struct threshold_block *b, char *buf) in show_error_count() argument
504 rdmsr_on_cpu(b->cpu, b->address, &lo, &hi); in show_error_count()
507 (THRESHOLD_MAX - b->threshold_limit))); in show_error_count()
537 struct threshold_block *b = to_block(kobj); in show() local
541 ret = a->show ? a->show(b, buf) : -EIO; in show()
549 struct threshold_block *b = to_block(kobj); in store() local
553 ret = a->store ? a->store(b, buf, count) : -EIO; in store()
571 struct threshold_block *b = NULL; in allocate_threshold_blocks() local
592 b = kzalloc(sizeof(struct threshold_block), GFP_KERNEL); in allocate_threshold_blocks()
593 if (!b) in allocate_threshold_blocks()
596 b->block = block; in allocate_threshold_blocks()
597 b->bank = bank; in allocate_threshold_blocks()
598 b->cpu = cpu; in allocate_threshold_blocks()
599 b->address = address; in allocate_threshold_blocks()
600 b->interrupt_enable = 0; in allocate_threshold_blocks()
601 b->interrupt_capable = lvt_interrupt_supported(bank, high); in allocate_threshold_blocks()
602 b->threshold_limit = THRESHOLD_MAX; in allocate_threshold_blocks()
604 if (b->interrupt_capable) { in allocate_threshold_blocks()
606 b->interrupt_enable = 1; in allocate_threshold_blocks()
611 INIT_LIST_HEAD(&b->miscj); in allocate_threshold_blocks()
614 list_add(&b->miscj, in allocate_threshold_blocks()
617 per_cpu(threshold_banks, cpu)[bank]->blocks = b; in allocate_threshold_blocks()
620 err = kobject_init_and_add(&b->kobj, &threshold_ktype, in allocate_threshold_blocks()
622 (bank == 4 ? bank4_names(b) : th_names[bank])); in allocate_threshold_blocks()
639 if (b) in allocate_threshold_blocks()
640 kobject_uevent(&b->kobj, KOBJ_ADD); in allocate_threshold_blocks()
645 if (b) { in allocate_threshold_blocks()
646 kobject_put(&b->kobj); in allocate_threshold_blocks()
647 list_del(&b->miscj); in allocate_threshold_blocks()
648 kfree(b); in allocate_threshold_blocks()
653 static int __threshold_add_blocks(struct threshold_bank *b) in __threshold_add_blocks() argument
655 struct list_head *head = &b->blocks->miscj; in __threshold_add_blocks()
660 err = kobject_add(&b->blocks->kobj, b->kobj, b->blocks->kobj.name); in __threshold_add_blocks()
666 err = kobject_add(&pos->kobj, b->kobj, pos->kobj.name); in __threshold_add_blocks()
681 struct threshold_bank *b = NULL; in threshold_create_bank() local
691 b = nb->bank4; in threshold_create_bank()
692 err = kobject_add(b->kobj, &dev->kobj, name); in threshold_create_bank()
696 per_cpu(threshold_banks, cpu)[bank] = b; in threshold_create_bank()
697 atomic_inc(&b->cpus); in threshold_create_bank()
699 err = __threshold_add_blocks(b); in threshold_create_bank()
705 b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL); in threshold_create_bank()
706 if (!b) { in threshold_create_bank()
711 b->kobj = kobject_create_and_add(name, &dev->kobj); in threshold_create_bank()
712 if (!b->kobj) { in threshold_create_bank()
717 per_cpu(threshold_banks, cpu)[bank] = b; in threshold_create_bank()
720 atomic_set(&b->cpus, 1); in threshold_create_bank()
725 nb->bank4 = b; in threshold_create_bank()
734 kfree(b); in threshold_create_bank()
785 static void __threshold_remove_blocks(struct threshold_bank *b) in __threshold_remove_blocks() argument
790 kobject_del(b->kobj); in __threshold_remove_blocks()
792 list_for_each_entry_safe(pos, tmp, &b->blocks->miscj, miscj) in __threshold_remove_blocks()
799 struct threshold_bank *b; in threshold_remove_bank() local
801 b = per_cpu(threshold_banks, cpu)[bank]; in threshold_remove_bank()
802 if (!b) in threshold_remove_bank()
805 if (!b->blocks) in threshold_remove_bank()
809 if (!atomic_dec_and_test(&b->cpus)) { in threshold_remove_bank()
810 __threshold_remove_blocks(b); in threshold_remove_bank()
826 kobject_del(b->kobj); in threshold_remove_bank()
827 kobject_put(b->kobj); in threshold_remove_bank()
828 kfree(b); in threshold_remove_bank()