Skip to content

Commit 56f17be

Browse files
yghannambp3tk0v
authored andcommitted
x86/mce/amd: Define threshold restart function for banks
Prepare for CMCI storm support by moving the common bank/block iterator code to a helper function. Include a parameter to switch the interrupt enable. This will be used by the CMCI storm handling function. Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> Link: https://lore.kernel.org/20251104-wip-mca-updates-v8-0-66c8eacf67b9@amd.com
1 parent 3206b41 commit 56f17be

1 file changed

Lines changed: 19 additions & 18 deletions

File tree

  • arch/x86/kernel/cpu/mce

arch/x86/kernel/cpu/mce/amd.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,24 @@ static void threshold_restart_block(void *_tr)
471471
wrmsr(tr->b->address, lo, hi);
472472
}
473473

474+
static void threshold_restart_bank(unsigned int bank, bool intr_en)
475+
{
476+
struct threshold_bank **thr_banks = this_cpu_read(threshold_banks);
477+
struct threshold_block *block, *tmp;
478+
struct thresh_restart tr;
479+
480+
if (!thr_banks || !thr_banks[bank])
481+
return;
482+
483+
memset(&tr, 0, sizeof(tr));
484+
485+
list_for_each_entry_safe(block, tmp, &thr_banks[bank]->miscj, miscj) {
486+
tr.b = block;
487+
tr.b->interrupt_enable = intr_en;
488+
threshold_restart_block(&tr);
489+
}
490+
}
491+
474492
static void mce_threshold_block_init(struct threshold_block *b, int offset)
475493
{
476494
struct thresh_restart tr = {
@@ -814,24 +832,7 @@ static void amd_deferred_error_interrupt(void)
814832

815833
static void amd_reset_thr_limit(unsigned int bank)
816834
{
817-
struct threshold_bank **bp = this_cpu_read(threshold_banks);
818-
struct threshold_block *block, *tmp;
819-
struct thresh_restart tr;
820-
821-
/*
822-
* Validate that the threshold bank has been initialized already. The
823-
* handler is installed at boot time, but on a hotplug event the
824-
* interrupt might fire before the data has been initialized.
825-
*/
826-
if (!bp || !bp[bank])
827-
return;
828-
829-
memset(&tr, 0, sizeof(tr));
830-
831-
list_for_each_entry_safe(block, tmp, &bp[bank]->miscj, miscj) {
832-
tr.b = block;
833-
threshold_restart_block(&tr);
834-
}
835+
threshold_restart_bank(bank, true);
835836
}
836837

837838
/*

0 commit comments

Comments
 (0)