mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Phineas Su <pohaosu@google.com>
To: yazen.ghannam@amd.com
Cc: bp@alien8.de, tony.luck@intel.com, muralidhara.mk@amd.com,
	 linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Phineas Su <pohaosu@google.com>
Subject: [PATCH v2] EDAC/amd64: Only translate Node ID if GPU nodes are present
Date: Sun, 14 Jun 2026 15:06:18 +0000	[thread overview]
Message-ID: <20260614150618.696249-1-pohaosu@google.com> (raw)
In-Reply-To: <CAHGR-A+kTAcFpBE0wH5WYraUUq3=st+hXMjnF6Zcj8OGqOBJwQ@mail.gmail.com>

The fixup_node_id() function adjusts the AMD Node ID for GPU memory
controllers (which report as SMCA_UMC_V2) on heterogeneous systems.
CPU memory controllers typically report as SMCA_UMC (v1) and do not
require translation.

If a CPU memory controller on a CPU-only system were to report as
SMCA_UMC_V2 (e.g. due to future hardware iterations, firmware reporting,
or kernel enumeration differences), the code would attempt to apply the
GPU translation. Since gpu_node_map is uninitialized on CPU-only systems,
this would lead to an unintended translation being applied.

Harden the translation logic by checking that GPU nodes are actually
present in the system (gpu_node_map.node_count > 0) before applying the
translation. This ensures CPU-only systems are always safely bypassed.

Signed-off-by: Phineas Su <pohaosu@google.com>
---
v2:
  - Reframed commit message to focus on robustness rather than a confirmed
    bug, as Zen4 CPUs do not generally report UMC_V2. (Yazen)

 drivers/edac/amd64_edac.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index c6aa69dbd9fb..1e688123a50c 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1047,6 +1047,10 @@ static int fixup_node_id(int node_id, struct mce *m)
 	if (smca_get_bank_type(m->extcpu, m->bank) != SMCA_UMC_V2)
 		return node_id;
 
+	/* If no GPU nodes are present, no fixup is needed. */
+	if (!gpu_node_map.node_count)
+		return node_id;
+
 	/* Nodes below the GPU base node are CPU nodes and don't need a fixup. */
 	if (nid < gpu_node_map.base_node_id)
 		return node_id;
-- 
2.54.0.1136.gdb2ca164c4-goog


  reply	other threads:[~2026-06-14 15:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08  7:26 [PATCH] EDAC/amd64: Fix incorrect Node ID mapping on CPU-only Zen4+ systems Phineas Su
2026-06-09 16:07 ` Yazen Ghannam
2026-06-14 14:15   ` Phineas Su
2026-06-14 15:06     ` Phineas Su [this message]
2026-06-22 17:07       ` [PATCH v2] EDAC/amd64: Only translate Node ID if GPU nodes are present Yazen Ghannam
2026-06-23  0:49         ` Borislav Petkov
2026-06-23 15:49           ` 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=20260614150618.696249-1-pohaosu@google.com \
    --to=pohaosu@google.com \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muralidhara.mk@amd.com \
    --cc=tony.luck@intel.com \
    --cc=yazen.ghannam@amd.com \
    /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

all inboxes | Powered by JetHome®