[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250624-wip-mca-updates-v4-20-236dd74f645f@amd.com>
Date: Tue, 24 Jun 2025 14:16:15 +0000
From: Yazen Ghannam <yazen.ghannam@....com>
To: <x86@...nel.org>, Tony Luck <tony.luck@...el.com>, "Rafael J. Wysocki"
<rafael@...nel.org>, Len Brown <lenb@...nel.org>
CC: <linux-kernel@...r.kernel.org>, <linux-edac@...r.kernel.org>,
<Smita.KoralahalliChannabasappa@....com>, Qiuxu Zhuo <qiuxu.zhuo@...el.com>,
<linux-acpi@...r.kernel.org>, Yazen Ghannam <yazen.ghannam@....com>
Subject: [PATCH v4 20/22] 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@....com>
---
Notes:
v3->v4:
* New in v4.
arch/x86/kernel/cpu/mce/amd.c | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c
index 3cb9f6a68316..56e7d99cef86 100644
--- a/arch/x86/kernel/cpu/mce/amd.c
+++ b/arch/x86/kernel/cpu/mce/amd.c
@@ -470,6 +470,24 @@ static void threshold_restart_block(void *_tr)
wrmsr(tr->b->address, lo, hi);
}
+static void threshold_restart_bank(unsigned int bank, bool intr_en)
+{
+ struct threshold_bank **thr_banks = this_cpu_read(threshold_banks);
+ struct threshold_block *block, *tmp;
+ struct thresh_restart tr;
+
+ if (!thr_banks || !thr_banks[bank])
+ return;
+
+ memset(&tr, 0, sizeof(tr));
+
+ list_for_each_entry_safe(block, tmp, &thr_banks[bank]->miscj, miscj) {
+ tr.b = block;
+ tr.b->interrupt_enable = intr_en;
+ threshold_restart_block(&tr);
+ }
+}
+
static void mce_threshold_block_init(struct threshold_block *b, int offset)
{
struct thresh_restart tr = {
@@ -832,24 +850,7 @@ static void amd_deferred_error_interrupt(void)
void amd_reset_thr_limit(unsigned int bank)
{
- struct threshold_bank **bp = this_cpu_read(threshold_banks);
- struct threshold_block *block, *tmp;
- struct thresh_restart tr;
-
- /*
- * Validate that the threshold bank has been initialized already. The
- * handler is installed at boot time, but on a hotplug event the
- * interrupt might fire before the data has been initialized.
- */
- if (!bp || !bp[bank])
- return;
-
- memset(&tr, 0, sizeof(tr));
-
- list_for_each_entry_safe(block, tmp, &bp[bank]->miscj, miscj) {
- tr.b = block;
- threshold_restart_block(&tr);
- }
+ threshold_restart_bank(bank, true);
}
/*
--
2.49.0
Powered by blists - more mailing lists