mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
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
54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* AMD Address Translation Library
|
|
*
|
|
* prm.c : Plumbing code for ACPI Platform Runtime Mechanism (PRM)
|
|
*
|
|
* Information on AMD PRM modules and handlers including the GUIDs and buffer
|
|
* structures used here are defined in the AMD ACPI Porting Guide in the
|
|
* chapter "Platform Runtime Mechanism Table (PRMT)"
|
|
*
|
|
* Copyright (c) 2024, Advanced Micro Devices, Inc.
|
|
* All Rights Reserved.
|
|
*
|
|
* Author: John Allen <john.allen@amd.com>
|
|
*/
|
|
|
|
#include "internal.h"
|
|
|
|
#include <linux/prmt.h>
|
|
|
|
/*
|
|
* PRM parameter buffer - normalized to system physical address, as described
|
|
* in the "PRM Parameter Buffer" section of the AMD ACPI Porting Guide.
|
|
*/
|
|
struct norm_to_sys_param_buf {
|
|
u64 norm_addr;
|
|
u8 socket;
|
|
u64 bank_id;
|
|
void *out_buf;
|
|
} __packed;
|
|
|
|
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;
|
|
unsigned long ret_addr;
|
|
int ret;
|
|
|
|
p_buf.norm_addr = addr;
|
|
p_buf.socket = socket_id;
|
|
p_buf.bank_id = bank_id;
|
|
p_buf.out_buf = &ret_addr;
|
|
|
|
ret = acpi_call_prm_handler(norm_to_sys_guid, &p_buf);
|
|
if (!ret)
|
|
return ret_addr;
|
|
|
|
if (ret == -ENODEV)
|
|
pr_debug("PRM module/handler not available\n");
|
|
else
|
|
pr_notice_once("PRM address translation failed\n");
|
|
|
|
return ret;
|
|
}
|