Commit 6311350d authored by Yazen Ghannam's avatar Yazen Ghannam Committed by PrithivishS
Browse files

RAS: Introduce AMD Address Translation Library

mainline inclusion
from mainline-v6.9-rc1
commit 3f3174996be6b4312c38f54d5969f5d5b75fec9e
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IAYOV8
CVE: NA

Reference: https://github.com/torvalds/linux/commit/3f3174996be6b4312c38f54d5969f5d5b75fec9e



--------------------------------

commit 3f3174996be6b4312c38f54d5969f5d5b75fec9e upstream.

AMD Zen-based systems report memory errors through Machine Check banks
representing Unified Memory Controllers (UMCs). The address value
reported for DRAM ECC errors is a "normalized address" that is relative
to the UMC. This normalized address must be converted to a system
physical address to be usable by the OS.

Support for this address translation was introduced to the MCA subsystem
with Zen1 systems. The code was later moved to the AMD64 EDAC module,
since this was the only user of the code at the time.

However, there are uses for this translation outside of EDAC. The system
physical address can be used in MCA for preemptive page offlining as done
in some MCA notifier functions. Also, this translation is needed as the
basis of similar functionality needed for some CXL configurations on AMD
systems.

Introduce a common address translation library that can be used for
multiple subsystems including MCA, EDAC, and CXL.

Include support for UMC normalized to system physical address
translation for current CPU systems.

The Data Fabric Indirect register access offsets and one of the register
fields were changed. Default to the current offsets and register field
definition. And fallback to the older values if running on a "legacy"
system.

Provide built-in code to facilitate the loading and unloading of the
library module without affecting other modules or built-in code.

Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20240123041401.79812-2-yazen.ghannam@amd.com


Signed-off-by: default avatarJeevan deep J <j.jeevandeep@amd.com>
Signed-off-by: default avatarPrithivishS <sprithiv@amd.com>
parent 980f4346
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -891,6 +891,12 @@ Q: https://patchwork.kernel.org/project/linux-rdma/list/
F:	drivers/infiniband/hw/efa/
F:	include/uapi/rdma/efa-abi.h
AMD ADDRESS TRANSLATION LIBRARY (ATL)
M:	Yazen Ghannam <Yazen.Ghannam@amd.com>
L:	linux-edac@vger.kernel.org
S:	Supported
F:	drivers/ras/amd/atl/*
AMD CDX BUS DRIVER
M:	Nipun Gupta <nipun.gupta@amd.com>
M:	Nikhil Agarwal <nikhil.agarwal@amd.com>
+1 −0
Original line number Diff line number Diff line
@@ -44,5 +44,6 @@ if RAS

source "arch/x86/ras/Kconfig"
source "drivers/ras/hisilicon/Kconfig"
source "drivers/ras/amd/atl/Kconfig"

endif
+2 −0
Original line number Diff line number Diff line
@@ -4,3 +4,5 @@ obj-$(CONFIG_DEBUG_FS) += debugfs.o
obj-$(CONFIG_RAS_CEC)	+= cec.o

obj-$(CONFIG_ARCH_HISI)	+= hisilicon/

obj-y			+= amd/atl/
+20 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-or-later
#
# AMD Address Translation Library Kconfig
#
# Copyright (c) 2023, Advanced Micro Devices, Inc.
# All Rights Reserved.
#
# Author: Yazen Ghannam <Yazen.Ghannam@amd.com>

config AMD_ATL
	tristate "AMD Address Translation Library"
	depends on AMD_NB && X86_64 && RAS
	default N
	help
	  This library includes support for implementation-specific
	  address translation procedures needed for various error
	  handling cases.

	  Enable this option if using DRAM ECC on Zen-based systems
	  and OS-based error handling.
+18 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-or-later
#
# AMD Address Translation Library Makefile
#
# Copyright (c) 2023, Advanced Micro Devices, Inc.
# All Rights Reserved.
#
# Author: Yazen Ghannam <Yazen.Ghannam@amd.com>

amd_atl-y		:= access.o
amd_atl-y		+= core.o
amd_atl-y		+= dehash.o
amd_atl-y		+= denormalize.o
amd_atl-y		+= map.o
amd_atl-y		+= system.o
amd_atl-y		+= umc.o

obj-$(CONFIG_AMD_ATL)	+= amd_atl.o
Loading