summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Limonciello <mario.limonciello@amd.com>2025-02-17 17:17:41 -0600
committerBorislav Petkov (AMD) <bp@alien8.de>2025-02-18 18:14:29 +0100
commitc893ee3f95f16fcb98da934d61483d0b7d8ed568 (patch)
tree9793eadcf0f48b3c0f76f54dcbddd439cfe154b9
parent6b06755af6679fd7c98ebc017ac31c8a74127538 (diff)
x86/amd_node: Add a smn_read_register() helper
Some of the ACP drivers will poll registers through SMN using read_poll_timeout() which requires returning the result of the register read as the argument. Add a helper to do just that. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20250217231747.1656228-2-superm1@kernel.org
-rw-r--r--arch/x86/include/asm/amd_node.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/include/asm/amd_node.h b/arch/x86/include/asm/amd_node.h
index 002c3afbd30f..23fe617898a8 100644
--- a/arch/x86/include/asm/amd_node.h
+++ b/arch/x86/include/asm/amd_node.h
@@ -46,4 +46,15 @@ static inline int __must_check amd_smn_hsmp_rdwr(u16 node, u32 address, u32 *val
}
#endif /* CONFIG_AMD_NODE */
+/* helper for use with read_poll_timeout */
+static inline int smn_read_register(u32 reg)
+{
+ int data, rc;
+
+ rc = amd_smn_read(0, reg, &data);
+ if (rc)
+ return rc;
+
+ return data;
+}
#endif /*_ASM_X86_AMD_NODE_H_*/