From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C18F33C7685 for ; Sun, 14 Jun 2026 15:07:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781449632; cv=none; b=h+bUYae9VUDnrRogAqnOSdeiapRFLeEQpgfDuqwNRcj6O3nvNUH0lYdj9WFE3ZPbKLme3bOl0er1rszokzpmKbUU7ZaFo67qW8g1c3Esw6LU4QxxoAAZGXJqvdGtETCR3pQ4nyuaSRafC2261p3lY7NbgkbFg/n5PnkLWIERbOM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781449632; c=relaxed/simple; bh=ypFhfBuh4oKinLArHJtcuri57IqTPl7YZKA2iJjtZdk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=OC7f9H5tQoC10xG3PVimFeJAnidBqoTH6FOT8UYTyvG1K3MBLLcbGYoszEqiGtf8t/szAnuqqWsu5ZJJT2Zanfj1b9LBrbckkZ3arztA1wYMMCeVW/Bl6QkReQxwh6oVu6LLsDvb3QPPAXu1l3YZC9CK/3lGX5R8eOzSvIEwKnQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--pohaosu.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=WZ/uIC+t; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--pohaosu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WZ/uIC+t" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-842688fa7b8so3187313b3a.0 for ; Sun, 14 Jun 2026 08:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781449629; x=1782054429; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=20bujbZoD7BWLzgU7LEZF+60Jzq/C2M2umGEPKTUImA=; b=WZ/uIC+twnYSWvwSxwvxojw6jfyVbiY1ufUGnQMKc3VfEo3NnfzymI4glDXefC/2bK WezbQWL53ASKeIg8R8wOnZxQ4SF62hzSfl5406vKa8fu9AvHMtk7rE50uO0FgcvbGH9f 5pKVwoqHZ3Oj0N8ZPYyfeumtYHf2hCNuGwyfRLlR4JCiajZW1NmVIQFDYrERsdcm75jR qoKB7RaM5QfXeg5lb8AblKNcejFglMLeqGGMGFrE8Ao0XkMfF+JKFK8jiNOAuXarQzfx veYqzrlixXc/UyCCvQFxEcLsoihsCkMUWDWklMoEEjPYeQKNRe8d/npX/gkCg5w06vhX BENA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781449629; x=1782054429; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=20bujbZoD7BWLzgU7LEZF+60Jzq/C2M2umGEPKTUImA=; b=GRbt611Mvvgt4se+Rfyv+4rUxd8inS4X7RlZ+pcfwc6KRtAdl6mRllZcr25AoG88bl Ca2eensRkgyBBI/mcrW4Ei1sUqSL0gHTxvKUe1t0NKUYVi/7QEKAM5R+EIu9J2zb/+jZ b41JzClItKL3rvSUjt1GssbiP2EZ20h8ZtGo0cnXAUxvo7eQiWTLCzMxjHJ+DiCeohJV GMWrRgbCn/iTNd6ThIh5UpxcDb+6e23iz1i1wvc/0ozNWmSOwORG2R4cR89IqlSYMoPM NSBJz5PFsEK2yZrR/whhBFY9H07dGHB4Iq5e5zq1d5LBwdha933iEDjqw6DsVyNOcX8L O8YA== X-Forwarded-Encrypted: i=1; AFNElJ96fEtbz5OS7uIWUTXOz1KQ7AHKfDIBl3c2lmYLUME7RoTFtSp5eg7LURCA16zcusUv51ngt8SqSVc60EA=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4pNhguDRvHBR00dbPkbUafJYjyZ3iD89Kjwonj6T7CMUc2R+o U0A/UHDBsjX4Ggqrm7jIIlJFtFXhQZoiRnm/G2puqOdozD88G1Cjc6Z6pg7i57690V4HAn2mez3 8qFwEDPTJfA== X-Received: from pfbmc1.prod.google.com ([2002:a05:6a00:7681:b0:842:5e34:69b5]) (user=pohaosu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1391:b0:837:f111:b70 with SMTP id d2e1a72fcca58-8434953f752mr10476313b3a.4.1781449628513; Sun, 14 Jun 2026 08:07:08 -0700 (PDT) Date: Sun, 14 Jun 2026 15:06:18 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.54.0.1136.gdb2ca164c4-goog Message-ID: <20260614150618.696249-1-pohaosu@google.com> Subject: [PATCH v2] EDAC/amd64: Only translate Node ID if GPU nodes are present From: Phineas Su 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 Content-Type: text/plain; charset="UTF-8" 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 --- 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