Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AB00CC6B1A for ; Wed, 14 Oct 2026 05:52:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F91410F398; Wed, 14 Oct 2026 05:52:52 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id CF23D10F398 for ; Wed, 14 Oct 2026 05:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1791957166; x=1823493166; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0KFTeoy2O8OnKu5Z0TtzXDB4xiNwB7994TvyFAUs4sw=; b=NdjdNpUL5C3GzdgDqur9dSwOSBzjg5McLQA8U7LyrY5IyEN7tbRirTqy Wzqy+1gK0yuUoSCuws4NffJnKXniP7VyoY++4EalOPyF+sM2hIiwpCgAp Q1mV0XSdQrjNUH1tLgtsrBvmEnnFclA3gw1AXvVa/6lymsoHYKUU1uHng 3jKaiNL7/XUUWB67m7NhEg8cS6yVybvJK1qr9z8IcbVW4iPK6C2+yC2nr nW4JQpwfy5j9ZPoKlkxCbvqPaDq7va5mEi6OcNMN0AAeu2jslzVjIOk3a 7Xzw/IOZ43T3Se6Y1cnfnv4u7l5KganmsP6c9lJv/4aXag9BvYAREsSc0 g==; X-CSE-ConnectionGUID: eYsslGjFTLC+hEFgnly8OA== X-CSE-MsgGUID: vEHodV8XQR+Exs+Ar57kxA== X-IronPort-AV: E=McAfee;i="6800,10657,11934"; a="679837" X-IronPort-AV: E=Sophos;i="6.27,157,1787036400"; d="scan'208";a="679837" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2026 22:52:45 -0700 X-CSE-ConnectionGUID: 2/bTA31tRfqrn4wvp7OKbQ== X-CSE-MsgGUID: votd0am+QbGScmsLCV2y5Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,157,1787036400"; d="scan'208";a="1675761" Received: from jraag-z790m-itx-wifi.iind.intel.com ([10.190.239.23]) by fmviesa008.fm.intel.com with ESMTP; 13 Oct 2026 22:52:44 -0700 From: Raag Jadav To: intel-xe@lists.freedesktop.org Cc: riana.tauro@intel.com, michal.wajdeczko@intel.com, lukasz.laguna@intel.com, matthew.d.roper@intel.com, matthew.brost@intel.com, mallesh.koujalagi@intel.com, rodrigo.vivi@intel.com, Raag Jadav Subject: [PATCH v6 3/7] drm/xe: Move xe_device_wedged_fini() registration to xe_device_probe_early() Date: Wed, 14 Oct 2026 11:21:20 +0530 Message-ID: <20261014055215.330408-4-raag.jadav@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261014055215.330408-1-raag.jadav@intel.com> References: <20261014055215.330408-1-raag.jadav@intel.com> 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" The device can be declared wedged while processing boot-time hardware errors, which can result in PM reference leak if driver probe fails before xe_device_wedged_fini() is registered. Early register the required cleanup action and fix this. Fixes: a7df563b45b0 ("drm/xe/xe_hw_error: Handle CSC Firmware reported Hardware errors") Signed-off-by: Raag Jadav Reviewed-by: Rodrigo Vivi --- v2: Split fixes into separate patches (Rodrigo, Michal) --- drivers/gpu/drm/xe/xe_device.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index cd2decc24f78..d05d2791b9a0 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -697,6 +697,8 @@ static int xe_device_vram_alloc(struct xe_device *xe) return 0; } +static void xe_device_wedged_fini(struct drm_device *drm, void *arg); + /** * xe_device_probe_early: Device early probe * @xe: xe device instance @@ -765,6 +767,10 @@ int xe_device_probe_early(struct xe_device *xe) if (err) return err; + err = drmm_add_action_or_reset(&xe->drm, xe_device_wedged_fini, xe); + if (err) + return err; + return 0; } ALLOW_ERROR_INJECTION(xe_device_probe_early, ERRNO); /* See xe_pci_probe() */ @@ -1095,10 +1101,6 @@ int xe_device_probe(struct xe_device *xe) detect_preproduction_hw(xe); - err = drmm_add_action_or_reset(&xe->drm, xe_device_wedged_fini, xe); - if (err) - goto err_unregister_display; - /* * Process and log any errors detected by hardware. Possible results can * include declaring the device as wedged, which must be done only after -- 2.43.0