Lines Matching refs:b
69 struct threshold_block *b; member
82 static const char *bank4_names(const struct threshold_block *b) in bank4_names() argument
84 switch (b->address) { in bank4_names()
96 WARN(1, "Funny MSR: 0x%08x\n", b->address); in bank4_names()
117 static int lvt_off_valid(struct threshold_block *b, int apic, u32 lo, u32 hi) in lvt_off_valid() argument
123 "for bank %d, block %d (MSR%08X=0x%x%08x)\n", b->cpu, in lvt_off_valid()
124 b->bank, b->block, b->address, hi, lo); in lvt_off_valid()
131 b->cpu, apic, b->bank, b->block, b->address, hi, lo); in lvt_off_valid()
147 rdmsr(tr->b->address, lo, hi); in threshold_restart_bank()
149 if (tr->b->threshold_limit < (hi & THRESHOLD_MAX)) in threshold_restart_bank()
155 (THRESHOLD_MAX - tr->b->threshold_limit); in threshold_restart_bank()
158 (tr->old_limit - tr->b->threshold_limit); in threshold_restart_bank()
167 if (!tr->b->interrupt_capable) in threshold_restart_bank()
171 if (lvt_off_valid(tr->b, tr->lvt_off, lo, hi)) { in threshold_restart_bank()
178 if (tr->b->interrupt_enable) in threshold_restart_bank()
184 wrmsr(tr->b->address, lo, hi); in threshold_restart_bank()
187 static void mce_threshold_block_init(struct threshold_block *b, int offset) in mce_threshold_block_init() argument
190 .b = b, in mce_threshold_block_init()
195 b->threshold_limit = THRESHOLD_MAX; in mce_threshold_block_init()
211 struct threshold_block b; in mce_amd_feature_init() local
243 memset(&b, 0, sizeof(b)); in mce_amd_feature_init()
244 b.cpu = cpu; in mce_amd_feature_init()
245 b.bank = bank; in mce_amd_feature_init()
246 b.block = block; in mce_amd_feature_init()
247 b.address = address; in mce_amd_feature_init()
248 b.interrupt_capable = lvt_interrupt_supported(bank, high); in mce_amd_feature_init()
250 if (!b.interrupt_capable) in mce_amd_feature_init()
253 b.interrupt_enable = 1; in mce_amd_feature_init()
262 mce_threshold_block_init(&b, offset); in mce_amd_feature_init()
346 static ssize_t show_ ## name(struct threshold_block *b, char *buf) \
348 return sprintf(buf, "%lu\n", (unsigned long) b->name); \
354 store_interrupt_enable(struct threshold_block *b, const char *buf, size_t size) in SHOW_FIELDS()
359 if (!b->interrupt_capable) in SHOW_FIELDS()
365 b->interrupt_enable = !!new; in SHOW_FIELDS()
368 tr.b = b; in SHOW_FIELDS()
370 smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); in SHOW_FIELDS()
376 store_threshold_limit(struct threshold_block *b, const char *buf, size_t size) in store_threshold_limit() argument
390 tr.old_limit = b->threshold_limit; in store_threshold_limit()
391 b->threshold_limit = new; in store_threshold_limit()
392 tr.b = b; in store_threshold_limit()
394 smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); in store_threshold_limit()
399 static ssize_t show_error_count(struct threshold_block *b, char *buf) in show_error_count() argument
403 rdmsr_on_cpu(b->cpu, b->address, &lo, &hi); in show_error_count()
406 (THRESHOLD_MAX - b->threshold_limit))); in show_error_count()
436 struct threshold_block *b = to_block(kobj); in show() local
440 ret = a->show ? a->show(b, buf) : -EIO; in show()
448 struct threshold_block *b = to_block(kobj); in store() local
452 ret = a->store ? a->store(b, buf, count) : -EIO; in store()
470 struct threshold_block *b = NULL; in allocate_threshold_blocks() local
491 b = kzalloc(sizeof(struct threshold_block), GFP_KERNEL); in allocate_threshold_blocks()
492 if (!b) in allocate_threshold_blocks()
495 b->block = block; in allocate_threshold_blocks()
496 b->bank = bank; in allocate_threshold_blocks()
497 b->cpu = cpu; in allocate_threshold_blocks()
498 b->address = address; in allocate_threshold_blocks()
499 b->interrupt_enable = 0; in allocate_threshold_blocks()
500 b->interrupt_capable = lvt_interrupt_supported(bank, high); in allocate_threshold_blocks()
501 b->threshold_limit = THRESHOLD_MAX; in allocate_threshold_blocks()
503 if (b->interrupt_capable) { in allocate_threshold_blocks()
505 b->interrupt_enable = 1; in allocate_threshold_blocks()
510 INIT_LIST_HEAD(&b->miscj); in allocate_threshold_blocks()
513 list_add(&b->miscj, in allocate_threshold_blocks()
516 per_cpu(threshold_banks, cpu)[bank]->blocks = b; in allocate_threshold_blocks()
519 err = kobject_init_and_add(&b->kobj, &threshold_ktype, in allocate_threshold_blocks()
521 (bank == 4 ? bank4_names(b) : th_names[bank])); in allocate_threshold_blocks()
538 if (b) in allocate_threshold_blocks()
539 kobject_uevent(&b->kobj, KOBJ_ADD); in allocate_threshold_blocks()
544 if (b) { in allocate_threshold_blocks()
545 kobject_put(&b->kobj); in allocate_threshold_blocks()
546 list_del(&b->miscj); in allocate_threshold_blocks()
547 kfree(b); in allocate_threshold_blocks()
552 static int __threshold_add_blocks(struct threshold_bank *b) in __threshold_add_blocks() argument
554 struct list_head *head = &b->blocks->miscj; in __threshold_add_blocks()
559 err = kobject_add(&b->blocks->kobj, b->kobj, b->blocks->kobj.name); in __threshold_add_blocks()
565 err = kobject_add(&pos->kobj, b->kobj, pos->kobj.name); in __threshold_add_blocks()
580 struct threshold_bank *b = NULL; in threshold_create_bank() local
590 b = nb->bank4; in threshold_create_bank()
591 err = kobject_add(b->kobj, &dev->kobj, name); in threshold_create_bank()
595 per_cpu(threshold_banks, cpu)[bank] = b; in threshold_create_bank()
596 atomic_inc(&b->cpus); in threshold_create_bank()
598 err = __threshold_add_blocks(b); in threshold_create_bank()
604 b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL); in threshold_create_bank()
605 if (!b) { in threshold_create_bank()
610 b->kobj = kobject_create_and_add(name, &dev->kobj); in threshold_create_bank()
611 if (!b->kobj) { in threshold_create_bank()
616 per_cpu(threshold_banks, cpu)[bank] = b; in threshold_create_bank()
619 atomic_set(&b->cpus, 1); in threshold_create_bank()
624 nb->bank4 = b; in threshold_create_bank()
633 kfree(b); in threshold_create_bank()
684 static void __threshold_remove_blocks(struct threshold_bank *b) in __threshold_remove_blocks() argument
689 kobject_del(b->kobj); in __threshold_remove_blocks()
691 list_for_each_entry_safe(pos, tmp, &b->blocks->miscj, miscj) in __threshold_remove_blocks()
698 struct threshold_bank *b; in threshold_remove_bank() local
700 b = per_cpu(threshold_banks, cpu)[bank]; in threshold_remove_bank()
701 if (!b) in threshold_remove_bank()
704 if (!b->blocks) in threshold_remove_bank()
708 if (!atomic_dec_and_test(&b->cpus)) { in threshold_remove_bank()
709 __threshold_remove_blocks(b); in threshold_remove_bank()
725 kobject_del(b->kobj); in threshold_remove_bank()
726 kobject_put(b->kobj); in threshold_remove_bank()
727 kfree(b); in threshold_remove_bank()