On 17-11-2026 18:29, Sk Anirban wrote:
Late binding currently uploads OCODE without checking what is already
running. Before the upload, check whether OCODE is initialized and
compare its version with the payload's. Skip the push when they
match.

Signed-off-by: Sk Anirban <sk.anirban@intel.com>
---
 drivers/gpu/drm/xe/xe_late_bind_fw.c | 31 ++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_late_bind_fw.c b/drivers/gpu/drm/xe/xe_late_bind_fw.c
index 355d7c841871..4b8c48871d8c 100644
--- a/drivers/gpu/drm/xe/xe_late_bind_fw.c
+++ b/drivers/gpu/drm/xe/xe_late_bind_fw.c
@@ -246,6 +246,31 @@ static void wait_for_worker_completion(struct xe_late_bind *late_bind)
 	}
 }
 
+static bool xe_late_bind_ocode_is_current(struct xe_late_bind_fw *lbfw)
+{
+	struct xe_device *xe = late_bind_fw_to_xe(lbfw);
+	u16 running_ver;
+	int ret;
+
+	if (lbfw->type != INTEL_LB_TYPE_OCODE || !xe->info.has_sysctrl)
+		return false;
+
+	if (!xe_sysctrl_is_oobmsm_fw_ready(xe))
+		return false;
+
+	ret = xe_sysctrl_sdk_api_version(xe, &running_ver);
+	if (ret) {
+		drm_dbg(&xe->drm, "Failed to get running OCODE SDK API version: %pe\n",
+			ERR_PTR(ret));
+		return false;
+	}
+
+	drm_dbg(&xe->drm, "OCODE SDK API version running %u, payload %u\n",
+		running_ver, lbfw->sdk_api_version);
+
+	return running_ver == lbfw->sdk_api_version;

sdk_api_version is not the OCode firmware version. Please compare the running version with all four lb_fw->version fields.

Thanks,
Badal

+}
+
 static void xe_late_bind_work(struct work_struct *work)
 {
 	struct xe_late_bind_fw *lbfw = container_of(work, struct xe_late_bind_fw, work);
@@ -258,6 +283,12 @@ static void xe_late_bind_work(struct work_struct *work)
 
 	xe_device_assert_mem_access(xe);
 
+	if (xe_late_bind_ocode_is_current(lbfw)) {
+		drm_dbg(&xe->drm, "%s firmware already loaded, skipping\n",
+			fw_id_to_name[lbfw->id]);
+		goto out;
+	}
+
 	/* we can queue this before the component is bound */
 	for (slept = 0; slept < LB_INIT_TIMEOUT_MS; slept += 100) {
 		if (late_bind->component.ops)