Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 139E4606A31C for ; Fri, 30 Oct 2026 14:46:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=fc61CGpy Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C51EC112873; Fri, 30 Oct 2026 14:46:22 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id EA07F10E387 for ; Fri, 30 Oct 2026 14:46:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1793371572; x=1824907572; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x+uj5ZAjqk6oGvtKW4oF156SWKpW/7AvHhFOEqT8tTQ=; b=fc61CGpy+dXJ3DPItY5Pl+u+UO9tQFFe+bALWYuFQwsf6G6O0WWVhjx/ TbJFiGiVOsJxqwMDhB9H3ONP4ArvqKVXYorfz0M13LNL7hTwWKOJP3JM5 T1o+5/TpjRI/8xGCXtYsSEz4YJO/lqBZLy/jkyb31+ifhiiOr8HfVSl1Z mNwBL5WaoS9X46ikCObmTMb6FlWBJNpXa2T6Ufoy8nbYaWUq+dYN4rVvT T5jSXXG9vbpmxsCrh/JwF5TEZ33HS1hNqb5enGxZb0oc1Ag4ACHx11kF9 Z291FWJ/DDpUZZYnbLchPLkbpJQcw0uy/IWHPtulFFv7mMzCMFDFcLa08 w==; X-CSE-ConnectionGUID: iIHURSbWQDW1Y2efM7NRbw== X-CSE-MsgGUID: gDkZb2afSvajZxru2Arnlg== X-IronPort-AV: E=McAfee;i="6800,10657,11951"; a="2012683" X-IronPort-AV: E=Sophos;i="6.27,186,1787036400"; d="scan'208";a="2012683" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2026 07:46:11 -0700 X-CSE-ConnectionGUID: aCW+N7d1TxqBsmmm/GOfJQ== X-CSE-MsgGUID: UUXULzAjQNuLn8BEsmu0Eg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,186,1787036400"; d="scan'208";a="5588655" Received: from bnilawar-desk2.iind.intel.com ([10.190.239.41]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2026 07:46:08 -0700 From: Badal Nilawar To: intel-xe@lists.freedesktop.org Cc: anshuman.gupta@intel.com, rodrigo.vivi@intel.com, daniele.ceraolospurio@intel.com, michael.j.ruhl@intel.com, alexander.usyskin@intel.com, anoop.c.vijay@intel.com, shamim.begum@intel.com, kelvin.gardiner@intel.com Subject: [PATCH v6 6/6] drm/xe/xe_late_bind_fw: Refactor pm flow Date: Fri, 30 Oct 2026 20:15:54 +0530 Message-ID: <20261030144547.2532309-14-badal.nilawar@intel.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261030144547.2532309-8-badal.nilawar@intel.com> References: <20261030144547.2532309-8-badal.nilawar@intel.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Refactor late binding flow across suspend/resume by adding dedicated pm functions. v2: Flush on suspend even if disabled, work may already be in flight Assisted-by: LLM Reviewed-by: Rodrigo Vivi Signed-off-by: Badal Nilawar --- drivers/gpu/drm/xe/xe_late_bind_fw.c | 43 ++++++++++++++++++++-------- drivers/gpu/drm/xe/xe_late_bind_fw.h | 4 +-- drivers/gpu/drm/xe/xe_pm.c | 6 ++-- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_late_bind_fw.c b/drivers/gpu/drm/xe/xe_late_bind_fw.c index b62a4c15c738..c5a9def25aee 100644 --- a/drivers/gpu/drm/xe/xe_late_bind_fw.c +++ b/drivers/gpu/drm/xe/xe_late_bind_fw.c @@ -228,7 +228,7 @@ static int xe_late_bind_fw_num_fans(struct xe_late_bind *late_bind, u32 *num_fan PCODE_MBOX(FAN_SPEED_CONTROL, FSC_READ_NUM_FANS, 0), num_fans, NULL); } -void xe_late_bind_wait_for_worker_completion(struct xe_late_bind *late_bind) +static void wait_for_worker_completion(struct xe_late_bind *late_bind) { struct xe_device *xe = late_bind_to_xe(late_bind); struct xe_late_bind_fw *lbfw; @@ -304,18 +304,12 @@ static void xe_late_bind_work(struct work_struct *work) xe_pm_runtime_put(xe); } -int xe_late_bind_fw_load(struct xe_late_bind *late_bind) +static void xe_late_bind_fw_load(struct xe_late_bind *late_bind) { struct xe_device *xe = late_bind_to_xe(late_bind); struct xe_late_bind_fw *lbfw; int fw_id; - if (!late_bind->component_added) - return -ENODEV; - - if (late_bind->disable) - return 0; - for (fw_id = 0; fw_id < XE_LB_FW_MAX_ID; fw_id++) { lbfw = &late_bind->late_bind_fw[fw_id]; if (lbfw->payload) { @@ -323,7 +317,6 @@ int xe_late_bind_fw_load(struct xe_late_bind *late_bind) queue_work(late_bind->wq, &lbfw->work); } } - return 0; } static int __xe_late_bind_fw_init(struct xe_late_bind *late_bind, u32 fw_id) @@ -456,7 +449,7 @@ static void xe_late_bind_component_unbind(struct device *xe_kdev, struct xe_device *xe = kdev_to_xe_device(xe_kdev); struct xe_late_bind *late_bind = &xe->late_bind; - xe_late_bind_wait_for_worker_completion(late_bind); + wait_for_worker_completion(late_bind); late_bind->component.ops = NULL; } @@ -471,7 +464,7 @@ static void xe_late_bind_remove(void *arg) struct xe_late_bind *late_bind = arg; struct xe_device *xe = late_bind_to_xe(late_bind); - xe_late_bind_wait_for_worker_completion(late_bind); + wait_for_worker_completion(late_bind); late_bind->component_added = false; @@ -482,6 +475,30 @@ static void xe_late_bind_remove(void *arg) } } +/** + * xe_late_bind_pm_suspend() - Wait for pending late binding fw loads + * @late_bind: pointer to late bind structure. + */ +void xe_late_bind_pm_suspend(struct xe_late_bind *late_bind) +{ + if (!late_bind->component_added) + return; + + wait_for_worker_completion(late_bind); +} + +/** + * xe_late_bind_pm_resume() - Reload late binding fw after resume + * @late_bind: pointer to late bind structure. + */ +void xe_late_bind_pm_resume(struct xe_late_bind *late_bind) +{ + if (!late_bind->component_added || late_bind->disable) + return; + + xe_late_bind_fw_load(late_bind); +} + /** * xe_late_bind_init() - add xe mei late binding component * @late_bind: pointer to late bind structure. @@ -518,5 +535,7 @@ int xe_late_bind_init(struct xe_late_bind *late_bind) if (err) return err; - return xe_late_bind_fw_load(late_bind); + xe_late_bind_fw_load(late_bind); + + return 0; } diff --git a/drivers/gpu/drm/xe/xe_late_bind_fw.h b/drivers/gpu/drm/xe/xe_late_bind_fw.h index 07e437390539..8896fea3068e 100644 --- a/drivers/gpu/drm/xe/xe_late_bind_fw.h +++ b/drivers/gpu/drm/xe/xe_late_bind_fw.h @@ -11,7 +11,7 @@ struct xe_late_bind; int xe_late_bind_init(struct xe_late_bind *late_bind); -int xe_late_bind_fw_load(struct xe_late_bind *late_bind); -void xe_late_bind_wait_for_worker_completion(struct xe_late_bind *late_bind); +void xe_late_bind_pm_suspend(struct xe_late_bind *late_bind); +void xe_late_bind_pm_resume(struct xe_late_bind *late_bind); #endif diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c index 89d64aa6577d..36042252c1db 100644 --- a/drivers/gpu/drm/xe/xe_pm.c +++ b/drivers/gpu/drm/xe/xe_pm.c @@ -186,7 +186,7 @@ int xe_pm_suspend(struct xe_device *xe) if (err) goto err; - xe_late_bind_wait_for_worker_completion(&xe->late_bind); + xe_late_bind_pm_suspend(&xe->late_bind); for_each_gt(gt, xe, id) xe_gt_suspend_prepare(gt); @@ -290,7 +290,7 @@ int xe_pm_resume(struct xe_device *xe) if (IS_VF_CCS_READY(xe)) xe_sriov_vf_ccs_register_context(xe); - xe_late_bind_fw_load(&xe->late_bind); + xe_late_bind_pm_resume(&xe->late_bind); drm_dbg(&xe->drm, "Device resumed\n"); xe_pm_block_end_signalling(); @@ -751,7 +751,7 @@ int xe_pm_runtime_resume(struct xe_device *xe) xe_sriov_vf_ccs_register_context(xe); if (xe->d3cold.allowed) - xe_late_bind_fw_load(&xe->late_bind); + xe_late_bind_pm_resume(&xe->late_bind); out: xe_rpm_lockmap_release(xe); -- 2.56.0