Skip to content

Commit 187d1b2

Browse files
yghannambp3tk0v
authored andcommitted
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, however, 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@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: "Mario Limonciello (AMD)" <superm1@kernel.org> Link: https://patch.msgid.link/all/20251017-wip-atl-prm-v2-2-7ab1df4a5fbc@amd.com
1 parent 83be4be commit 187d1b2

4 files changed

Lines changed: 23 additions & 12 deletions

File tree

drivers/ras/amd/atl/internal.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ struct df_flags {
138138
__u8 legacy_ficaa : 1,
139139
socket_id_shift_quirk : 1,
140140
heterogeneous : 1,
141-
__reserved_0 : 5;
141+
prm_only : 1,
142+
__reserved_0 : 4;
142143
};
143144

144145
struct df_config {
@@ -283,6 +284,9 @@ unsigned long convert_umc_mca_addr_to_sys_addr(struct atl_err *err);
283284
u64 add_base_and_hole(struct addr_ctx *ctx, u64 addr);
284285
u64 remove_base_and_hole(struct addr_ctx *ctx, u64 addr);
285286

287+
/* GUIDs for PRM handlers */
288+
extern const guid_t norm_to_sys_guid;
289+
286290
#ifdef CONFIG_AMD_ATL_PRM
287291
unsigned long prm_umc_norm_to_sys_addr(u8 socket_id, u64 umc_bank_inst_id, unsigned long addr);
288292
#else

drivers/ras/amd/atl/prm.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ struct norm_to_sys_param_buf {
2929
void *out_buf;
3030
} __packed;
3131

32-
static const guid_t norm_to_sys_guid = GUID_INIT(0xE7180659, 0xA65D, 0x451D,
33-
0x92, 0xCD, 0x2B, 0x56, 0xF1,
34-
0x2B, 0xEB, 0xA6);
35-
3632
unsigned long prm_umc_norm_to_sys_addr(u8 socket_id, u64 bank_id, unsigned long addr)
3733
{
3834
struct norm_to_sys_param_buf p_buf;

drivers/ras/amd/atl/system.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212

1313
#include "internal.h"
1414

15+
#include <linux/prmt.h>
16+
17+
const guid_t norm_to_sys_guid = GUID_INIT(0xE7180659, 0xA65D, 0x451D,
18+
0x92, 0xCD, 0x2B, 0x56, 0xF1,
19+
0x2B, 0xEB, 0xA6);
20+
1521
int determine_node_id(struct addr_ctx *ctx, u8 socket_id, u8 die_id)
1622
{
1723
u16 socket_id_bits, die_id_bits;
@@ -212,15 +218,17 @@ static int determine_df_rev(void)
212218
if (!rev)
213219
return determine_df_rev_legacy();
214220

215-
/*
216-
* Fail out for major revisions other than '4'.
217-
*
218-
* Explicit support should be added for newer systems to avoid issues.
219-
*/
220221
if (rev == 4)
221222
return df4_determine_df_rev(reg);
222223

223-
return -EINVAL;
224+
/* All other systems should have PRM handlers. */
225+
if (!acpi_prm_handler_available(&norm_to_sys_guid)) {
226+
pr_debug("PRM not available\n");
227+
return -ENODEV;
228+
}
229+
230+
df_cfg.flags.prm_only = true;
231+
return 0;
224232
}
225233

226234
static int get_dram_hole_base(void)
@@ -297,6 +305,9 @@ int get_df_system_info(void)
297305
return ret;
298306
}
299307

308+
if (df_cfg.flags.prm_only)
309+
return 0;
310+
300311
apply_node_id_shift();
301312

302313
get_num_maps();

drivers/ras/amd/atl/umc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ unsigned long convert_umc_mca_addr_to_sys_addr(struct atl_err *err)
422422
socket_id, die_id, coh_st_inst_id, addr);
423423

424424
ret_addr = prm_umc_norm_to_sys_addr(socket_id, err->ipid, addr);
425-
if (!IS_ERR_VALUE(ret_addr))
425+
if (!IS_ERR_VALUE(ret_addr) || df_cfg.flags.prm_only)
426426
return ret_addr;
427427

428428
return norm_to_sys_addr(socket_id, die_id, coh_st_inst_id, addr);

0 commit comments

Comments
 (0)