]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/ras: add uniras smu feature flag init func
authorGangliang Xie <ganglxie@amd.com>
Fri, 12 Dec 2025 08:04:30 +0000 (16:04 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 2 Mar 2026 21:43:28 +0000 (16:43 -0500)
add flag to indicate if pmfw eeprom is supported or
not, and initialize it

v2: change copyright from 2025 to 2026

Signed-off-by: Gangliang Xie <ganglxie@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/ras/rascore/Makefile
drivers/gpu/drm/amd/ras/rascore/ras.h
drivers/gpu/drm/amd/ras/rascore/ras_core.c
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c [new file with mode: 0644]
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h [new file with mode: 0644]

index e826a1f86424c5d0935fa7476d1a8c6a8f4e673e..06b265ec1cde8663c78565180d24a1dcb2366d99 100644 (file)
@@ -36,7 +36,8 @@ RAS_CORE_FILES = ras_core.o \
                        ras_log_ring.o \
                        ras_cper.o \
                        ras_psp.o \
-                       ras_psp_v13_0.o
+                       ras_psp_v13_0.o \
+                       ras_eeprom_fw.o
 
 
 RAS_CORE = $(addprefix $(AMD_GPU_RAS_PATH)/rascore/,$(RAS_CORE_FILES))
index 3a1059bb380c279db72f8919b163421131670332..07ef4e0d53f6b9dc9f20294a8a74ae7719e535a6 100644 (file)
@@ -36,6 +36,7 @@
 #include "ras_mp1.h"
 #include "ras_psp.h"
 #include "ras_log_ring.h"
+#include "ras_eeprom_fw.h"
 
 #define RAS_HW_ERR             "[Hardware Error]: "
 
@@ -335,6 +336,8 @@ struct ras_core_context {
        spinlock_t seqno_lock;
 
        bool ras_core_enabled;
+
+       u64 ras_fw_features;
 };
 
 struct ras_core_context *ras_core_create(struct ras_core_config *init_config);
index 9df05b3963edb5a0a740719eabceacea20d71fed..9a5ffcf64b4084d342926d34dc1f4af7e9abe131 100644 (file)
@@ -384,6 +384,8 @@ int ras_core_hw_init(struct ras_core_context *ras_core)
        if (ret)
                goto init_err5;
 
+       ras_fw_init_feature_flags(ras_core);
+
        ret = ras_eeprom_hw_init(ras_core);
        if (ret)
                goto init_err6;
diff --git a/drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c b/drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c
new file mode 100644 (file)
index 0000000..e94c368
--- /dev/null
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "ras.h"
+
+void ras_fw_init_feature_flags(struct ras_core_context *ras_core)
+{
+       struct ras_mp1 *mp1 = &ras_core->ras_mp1;
+       const struct ras_mp1_sys_func *sys_func = mp1->sys_func;
+       uint64_t flags = 0ULL;
+
+       if (!sys_func || !sys_func->mp1_get_ras_enabled_mask)
+               return;
+
+       if (!sys_func->mp1_get_ras_enabled_mask(ras_core, &flags))
+               ras_core->ras_fw_features = flags;
+}
diff --git a/drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h b/drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h
new file mode 100644 (file)
index 0000000..b416654
--- /dev/null
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#ifndef __RAS_EEPROM_FW_H__
+#define __RAS_EEPROM_FW_H__
+
+void ras_fw_init_feature_flags(struct ras_core_context *ras_core);
+
+#endif