From: Yazen Ghannam <yazen.ghannam@amd.com>
To: <linux-edac@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <tony.luck@intel.com>,
<x86@kernel.org>, Yazen Ghannam <yazen.ghannam@amd.com>
Subject: [PATCH 2/3] x86/mce/amd: Convert bank_map to a bitmap
Date: Thu, 3 Sep 2026 09:20:48 -0500 [thread overview]
Message-ID: <20260903142049.4126599-3-yazen.ghannam@amd.com> (raw)
In-Reply-To: <20260903142049.4126599-1-yazen.ghannam@amd.com>
The per-CPU bank_map records which banks had their block 0 prepared
during mce_amd_feature_init(). It is a u64, so BIT_ULL(bank) is
undefined once the bank number reaches 64. That caps the usable bank
count at 64 regardless of MAX_NR_BANKS.
mce_banks_t is the existing type for per-bank bitmaps. It is declared
with MAX_NR_BANKS bits, so it follows the macro instead of fixing a
width of its own. thr_intr_banks and dfr_intr_banks in this file
already use it.
Convert bank_map to mce_banks_t and use the bitmap helpers. This is
preparation for raising MAX_NR_BANKS.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
arch/x86/kernel/cpu/mce/amd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c
index e6542e00dc5a..598b71d54f41 100644
--- a/arch/x86/kernel/cpu/mce/amd.c
+++ b/arch/x86/kernel/cpu/mce/amd.c
@@ -263,7 +263,7 @@ static DEFINE_PER_CPU(struct threshold_bank **, threshold_banks);
* A list of the banks enabled on each logical CPU. Controls which respective
* descriptors to initialize later in mce_threshold_create_device().
*/
-static DEFINE_PER_CPU(u64, bank_map);
+static DEFINE_PER_CPU(mce_banks_t, bank_map);
static void amd_threshold_interrupt(void);
static void amd_deferred_error_interrupt(void);
@@ -572,7 +572,7 @@ static int prepare_threshold_block(unsigned int bank, unsigned int block, u32 ad
int new;
if (!block)
- per_cpu(bank_map, cpu) |= BIT_ULL(bank);
+ __set_bit(bank, per_cpu(bank_map, cpu));
memset(&b, 0, sizeof(b));
b.cpu = cpu;
@@ -1272,7 +1272,7 @@ void mce_threshold_create_device(unsigned int cpu)
return;
for (bank = 0; bank < numbanks; ++bank) {
- if (!(this_cpu_read(bank_map) & BIT_ULL(bank)))
+ if (!test_bit(bank, this_cpu_ptr(bank_map)))
continue;
if (threshold_create_bank(bp, cpu, bank)) {
__threshold_remove_device(bp);
--
2.43.0
next prev parent reply other threads:[~2026-09-03 14:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 14:20 [PATCH 0/3] Increase MCA bank count Yazen Ghannam
2026-09-03 14:20 ` [PATCH 1/3] x86/mce/amd: Fix bank lookup in amd_mce_usable_address() Yazen Ghannam
2026-09-03 14:20 ` Yazen Ghannam [this message]
2026-09-03 14:20 ` [PATCH 3/3] x86/mce: Increase MAX_NR_BANKS to 255 Yazen Ghannam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260903142049.4126599-3-yazen.ghannam@amd.com \
--to=yazen.ghannam@amd.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox