From nobody Mon Feb 9 17:22:37 2026 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 939FC3128B8; Mon, 22 Dec 2025 09:44:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766396683; cv=none; b=qNMZMphWmawA3QXNGj9svZbh5z2mYmcgA/ZEpeqh/4nFFNqmilDSIwp6gaVXednv1wqpo5hxdtOP14mL3t4gBZMoyypi6WnbtQDepxmvaaU0I4FpPsCYb4bjYrPN2FzBaRkTEUbuj0Qho6S3b5qwQF5lAjo2Gg0IMbed8UDALVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766396683; c=relaxed/simple; bh=xC1SOZNAbMOTNg3DPTnK04IkfoeXo/89tWhiQrdjPbU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kcZUU4q534a5StJNpR9wH2AZ3ReMv2U41JwfxK6wlpqY1521z/Jx3M+TuZxl+3FGOMsETY2lDV8mV8903ISB3HZW9qo2Sg7HLcwKbP2xd206fQFzfwqeirDsn5kmMU3JpWYXTrGqZHUNY5nkuQ2E2NMojB8kGf+8bd1EfqPyN6s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=ydqZ8wnY; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="ydqZ8wnY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1766396678; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=LbcgRIezxDawY7xcu3ovX9hkaM5X1wVXgi1CFgzLbWo=; b=ydqZ8wnYzU6Te4rFlWlBcLIrZfCHsuMFGjVUJQhGmFd+1To21SePwq+WgJ8f63fGhQztpQwn9olU9FRdR6wVjo941IcS7vLySO7HTZBViM4wR4hwwXIPYAX4kqJUzYpJz+GRhjhN7MqIy6M8BAs4a1Ysu1MxGBqugrq8m8p4vAc= Received: from localhost(mailfrom:tianruidong@linux.alibaba.com fp:SMTPD_---0WvOT.Y9_1766396676 cluster:ay36) by smtp.aliyun-inc.com; Mon, 22 Dec 2025 17:44:37 +0800 From: Ruidong Tian To: catalin.marinas@arm.com, will@kernel.org, lpieralisi@kernel.org, guohanjun@huawei.com, sudeep.holla@arm.com, xueshuai@linux.alibaba.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rafael@kernel.org, lenb@kernel.org, tony.luck@intel.com, bp@alien8.de, yazen.ghannam@amd.com, misono.tomohiro@fujitsu.com Cc: tianruidong@linux.alibaba.com Subject: [PATCH v4 14/17] ras: ATL: Unified ATL interface for ARM64 and AMD Date: Mon, 22 Dec 2025 17:43:47 +0800 Message-Id: <20251222094351.38792-15-tianruidong@linux.alibaba.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20251222094351.38792-1-tianruidong@linux.alibaba.com> References: <20251222094351.38792-1-tianruidong@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Translate device normalize address in AMD, also named logical address, to system physical address is a common interface in RAS. Provides common interface both for AMD and ARM. Signed-off-by: Ruidong Tian --- drivers/edac/amd64_edac.c | 2 +- drivers/ras/aest/aest-core.c | 3 +++ drivers/ras/amd/atl/core.c | 4 ++-- drivers/ras/amd/atl/internal.h | 2 +- drivers/ras/amd/atl/umc.c | 3 ++- drivers/ras/ras.c | 24 +++++++++++------------- include/linux/ras.h | 9 ++++----- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 2391f3469961..478cfef37892 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2847,7 +2847,7 @@ static void decode_umc_error(int node_id, struct mce = *m) a_err.ipid =3D m->ipid; a_err.cpu =3D m->extcpu; =20 - sys_addr =3D amd_convert_umc_mca_addr_to_sys_addr(&a_err); + sys_addr =3D convert_ras_la_to_spa(&a_err); if (IS_ERR_VALUE(sys_addr)) { err.err_code =3D ERR_NORM_ADDR; goto log_error; diff --git a/drivers/ras/aest/aest-core.c b/drivers/ras/aest/aest-core.c index a290b482bf8b..052211ca3e2a 100644 --- a/drivers/ras/aest/aest-core.c +++ b/drivers/ras/aest/aest-core.c @@ -235,6 +235,9 @@ static void aest_node_pool_process(struct work_struct *= work) (status & (ERR_STATUS_UE | ERR_STATUS_DE))) { if (event->addressing_mode =3D=3D AEST_ADDREESS_SPA) addr =3D event->regs.err_addr & PHYS_MASK; + else + addr =3D convert_ras_la_to_spa(event); + aest_handle_memory_failure(addr); } =20 diff --git a/drivers/ras/amd/atl/core.c b/drivers/ras/amd/atl/core.c index 0f7cd6dab0b0..4f44c0ce97ec 100644 --- a/drivers/ras/amd/atl/core.c +++ b/drivers/ras/amd/atl/core.c @@ -210,7 +210,7 @@ static int __init amd_atl_init(void) =20 /* Increment this module's recount so that it can't be easily unloaded. */ __module_get(THIS_MODULE); - amd_atl_register_decoder(convert_umc_mca_addr_to_sys_addr); + atl_register_decoder(convert_umc_mca_addr_to_sys_addr); =20 pr_info("AMD Address Translation Library initialized\n"); return 0; @@ -222,7 +222,7 @@ static int __init amd_atl_init(void) */ static void __exit amd_atl_exit(void) { - amd_atl_unregister_decoder(); + atl_unregister_decoder(); } =20 module_init(amd_atl_init); diff --git a/drivers/ras/amd/atl/internal.h b/drivers/ras/amd/atl/internal.h index 82a56d9c2be1..423a6193fdc7 100644 --- a/drivers/ras/amd/atl/internal.h +++ b/drivers/ras/amd/atl/internal.h @@ -279,7 +279,7 @@ int denormalize_address(struct addr_ctx *ctx); int dehash_address(struct addr_ctx *ctx); =20 unsigned long norm_to_sys_addr(u8 socket_id, u8 die_id, u8 coh_st_inst_id,= unsigned long addr); -unsigned long convert_umc_mca_addr_to_sys_addr(struct atl_err *err); +unsigned long convert_umc_mca_addr_to_sys_addr(void *data); =20 u64 add_base_and_hole(struct addr_ctx *ctx, u64 addr); u64 remove_base_and_hole(struct addr_ctx *ctx, u64 addr); diff --git a/drivers/ras/amd/atl/umc.c b/drivers/ras/amd/atl/umc.c index befc616d5e8a..57a78c380467 100644 --- a/drivers/ras/amd/atl/umc.c +++ b/drivers/ras/amd/atl/umc.c @@ -399,8 +399,9 @@ static u8 get_coh_st_inst_id(struct atl_err *err) return FIELD_GET(UMC_CHANNEL_NUM, err->ipid); } =20 -unsigned long convert_umc_mca_addr_to_sys_addr(struct atl_err *err) +unsigned long convert_umc_mca_addr_to_sys_addr(void *data) { + struct atl_err *err =3D data; u8 socket_id =3D topology_physical_package_id(err->cpu); u8 coh_st_inst_id =3D get_coh_st_inst_id(err); unsigned long addr =3D get_addr(err->addr); diff --git a/drivers/ras/ras.c b/drivers/ras/ras.c index 2a5b5a9fdcb3..050b49466a18 100644 --- a/drivers/ras/ras.c +++ b/drivers/ras/ras.c @@ -10,36 +10,34 @@ #include #include =20 -#if IS_ENABLED(CONFIG_AMD_ATL) /* * Once set, this function pointer should never be unset. * * The library module will set this pointer if it successfully loads. The = module * should not be unloaded except for testing and debug purposes. */ -static unsigned long (*amd_atl_umc_na_to_spa)(struct atl_err *err); +static unsigned long (*atl_ras_la_to_spa)(void *err); =20 -void amd_atl_register_decoder(unsigned long (*f)(struct atl_err *)) +void atl_register_decoder(unsigned long (*f)(void *)) { - amd_atl_umc_na_to_spa =3D f; + atl_ras_la_to_spa =3D f; } -EXPORT_SYMBOL_GPL(amd_atl_register_decoder); +EXPORT_SYMBOL_GPL(atl_register_decoder); =20 -void amd_atl_unregister_decoder(void) +void atl_unregister_decoder(void) { - amd_atl_umc_na_to_spa =3D NULL; + atl_ras_la_to_spa =3D NULL; } -EXPORT_SYMBOL_GPL(amd_atl_unregister_decoder); +EXPORT_SYMBOL_GPL(atl_unregister_decoder); =20 -unsigned long amd_convert_umc_mca_addr_to_sys_addr(struct atl_err *err) +unsigned long convert_ras_la_to_spa(void *err) { - if (!amd_atl_umc_na_to_spa) + if (!atl_ras_la_to_spa) return -EINVAL; =20 - return amd_atl_umc_na_to_spa(err); + return atl_ras_la_to_spa(err); } -EXPORT_SYMBOL_GPL(amd_convert_umc_mca_addr_to_sys_addr); -#endif /* CONFIG_AMD_ATL */ +EXPORT_SYMBOL_GPL(convert_ras_la_to_spa); =20 #define CREATE_TRACE_POINTS #define TRACE_INCLUDE_PATH ../../include/ras diff --git a/include/linux/ras.h b/include/linux/ras.h index 05096f049dac..2270a8eb1038 100644 --- a/include/linux/ras.h +++ b/include/linux/ras.h @@ -42,14 +42,9 @@ struct atl_err { }; =20 #if IS_ENABLED(CONFIG_AMD_ATL) -void amd_atl_register_decoder(unsigned long (*f)(struct atl_err *)); -void amd_atl_unregister_decoder(void); void amd_retire_dram_row(struct atl_err *err); -unsigned long amd_convert_umc_mca_addr_to_sys_addr(struct atl_err *err); #else static inline void amd_retire_dram_row(struct atl_err *err) { } -static inline unsigned long -amd_convert_umc_mca_addr_to_sys_addr(struct atl_err *err) { return -EINVAL= ; } #endif /* CONFIG_AMD_ATL */ =20 #if defined(CONFIG_ARM) || defined(CONFIG_ARM64) @@ -63,6 +58,10 @@ amd_convert_umc_mca_addr_to_sys_addr(struct atl_err *err= ) { return -EINVAL; } #define GET_LOGICAL_INDEX(mpidr) -EINVAL #endif /* CONFIG_ARM || CONFIG_ARM64 */ =20 +void atl_register_decoder(unsigned long (*f)(void *)); +void atl_unregister_decoder(void); +unsigned long convert_ras_la_to_spa(void *err); + #if IS_ENABLED(CONFIG_AEST) void aest_register_decode_chain(struct notifier_block *nb); void aest_unregister_decode_chain(struct notifier_block *nb); --=20 2.51.2.612.gdc70283dfc