[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251006-wip-atl-prm-v1-2-4a62967fb2b0@amd.com>
Date: Mon, 6 Oct 2025 15:10:26 +0000
From: Yazen Ghannam <yazen.ghannam@....com>
To: "Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>,
Yazen Ghannam <Yazen.Ghannam@....com>, Tony Luck <tony.luck@...el.com>,
Borislav Petkov <bp@...en8.de>
CC: <linux-acpi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-edac@...r.kernel.org>, Avadhut Naik <avadhut.naik@....com>, John Allen
<john.allen@....com>, Mario Limonciello <mario.limonciello@....com>, "Yazen
Ghannam" <yazen.ghannam@....com>
Subject: [PATCH 2/3] RAS/AMD/ATL: Require PRM support for future systems
Currently, the AMD Address Translation Library will fail to load for
new, unrecognized systems (based on Data Fabric revision). The intention
is to prevent the code from executing on new systems and returning
incorrect results.
Recent AMD systems may provide UEFI PRM handlers for address
translation. This is code provided by the platform through BIOS tables.
These are the preferred method for translation, and the Linux native
code can be used as a fallback.
Future AMD systems are expected to provide PRM handlers by default. And
Linux native code will not be used.
Adjust the ATL init code so that new, unrecognized systems will default
to using PRM handlers only.
Signed-off-by: Yazen Ghannam <yazen.ghannam@....com>
---
drivers/ras/amd/atl/internal.h | 10 +++++++++-
drivers/ras/amd/atl/prm.c | 10 ++++++++++
drivers/ras/amd/atl/system.c | 12 ++++++------
drivers/ras/amd/atl/umc.c | 2 +-
4 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/drivers/ras/amd/atl/internal.h b/drivers/ras/amd/atl/internal.h
index 2b6279d32774..8f0864641a1e 100644
--- a/drivers/ras/amd/atl/internal.h
+++ b/drivers/ras/amd/atl/internal.h
@@ -138,7 +138,8 @@ struct df_flags {
__u8 legacy_ficaa : 1,
socket_id_shift_quirk : 1,
heterogeneous : 1,
- __reserved_0 : 5;
+ prm_only : 1,
+ __reserved_0 : 4;
};
struct df_config {
@@ -284,8 +285,15 @@ u64 add_base_and_hole(struct addr_ctx *ctx, u64 addr);
u64 remove_base_and_hole(struct addr_ctx *ctx, u64 addr);
#ifdef CONFIG_AMD_ATL_PRM
+int prm_check(void);
unsigned long prm_umc_norm_to_sys_addr(u8 socket_id, u64 umc_bank_inst_id, unsigned long addr);
#else
+static inline int prm_check(void)
+{
+ pr_debug("CONFIG_AMD_ATL_PRM not enabled\n");
+ return -EINVAL;
+}
+
static inline unsigned long prm_umc_norm_to_sys_addr(u8 socket_id, u64 umc_bank_inst_id,
unsigned long addr)
{
diff --git a/drivers/ras/amd/atl/prm.c b/drivers/ras/amd/atl/prm.c
index 0931a20d213b..2347c8edd4d7 100644
--- a/drivers/ras/amd/atl/prm.c
+++ b/drivers/ras/amd/atl/prm.c
@@ -33,6 +33,16 @@ static const guid_t norm_to_sys_guid = GUID_INIT(0xE7180659, 0xA65D, 0x451D,
0x92, 0xCD, 0x2B, 0x56, 0xF1,
0x2B, 0xEB, 0xA6);
+int prm_check(void)
+{
+ if (!acpi_prm_handler_available(&norm_to_sys_guid)) {
+ pr_debug("PRM not available\n");
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
unsigned long prm_umc_norm_to_sys_addr(u8 socket_id, u64 bank_id, unsigned long addr)
{
struct norm_to_sys_param_buf p_buf;
diff --git a/drivers/ras/amd/atl/system.c b/drivers/ras/amd/atl/system.c
index e18d916d5e8b..09664b0ff8a6 100644
--- a/drivers/ras/amd/atl/system.c
+++ b/drivers/ras/amd/atl/system.c
@@ -212,15 +212,12 @@ static int determine_df_rev(void)
if (!rev)
return determine_df_rev_legacy();
- /*
- * Fail out for major revisions other than '4'.
- *
- * Explicit support should be added for newer systems to avoid issues.
- */
if (rev == 4)
return df4_determine_df_rev(reg);
- return -EINVAL;
+ /* All other systems should have PRM handlers. */
+ df_cfg.flags.prm_only = true;
+ return 0;
}
static int get_dram_hole_base(void)
@@ -294,6 +291,9 @@ int get_df_system_info(void)
return -EINVAL;
}
+ if (df_cfg.flags.prm_only)
+ return prm_check();
+
apply_node_id_shift();
get_num_maps();
diff --git a/drivers/ras/amd/atl/umc.c b/drivers/ras/amd/atl/umc.c
index 6e072b7667e9..18ce419236a5 100644
--- a/drivers/ras/amd/atl/umc.c
+++ b/drivers/ras/amd/atl/umc.c
@@ -422,7 +422,7 @@ unsigned long convert_umc_mca_addr_to_sys_addr(struct atl_err *err)
socket_id, die_id, coh_st_inst_id, addr);
ret_addr = prm_umc_norm_to_sys_addr(socket_id, err->ipid, addr);
- if (!IS_ERR_VALUE(ret_addr))
+ if (!IS_ERR_VALUE(ret_addr) || df_cfg.flags.prm_only)
return ret_addr;
return norm_to_sys_addr(socket_id, die_id, coh_st_inst_id, addr);
--
2.51.0
Powered by blists - more mailing lists