Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.17 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796254420; b=c0eVI2jBX27g0czP6DMTCJBQrWzimO48RvIZDEjbWQLQDpWyplKSSNkTNzQ37JFL/EVZ akUIfPSKLhKA7xgt64imT2TzfQweXQZRtfuwA7KJ9oivutkEmqlDYPQ60Te7tSTTBbuEK 9EjZ0vPLhv4FsuDZUIg8uPLNTMggvllhuxcmxfKtrvUf144Eo+/cIkeAq1fDIAXStUw8r BE5HzjEZrwZOddAL2GzaY4anyKr0Ey4YHcHLk/0QHo/xEs5FJSm+9kSDc4w4/tKJzifiY 1JZqA3pjtEW4/Xr7VOgke9m7itAZvEVHQijNB0eG8q0EPZOIuxTgH29njNFmN7UUw6Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796254420; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Cc:Subject: Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Type:Content-Transfer-Encoding; bh=KMaNBltehjci8wGaAQysQA/QxL+ioZJgxbfJ7Cras+8=; b=EirbLGK5HAvI/AdiNn+r0+FoBD5cTA9yE13iS0g+luICrRtZLd8V8auYhe6l9zDYqDhy HJoxyb1SIKFlpITj2T362N0n3zsgGTEhjgBh63f2KNBaNp4/XWfZpDGzBnF0MdFUASGuG aDkW0ThiKo8VBsCmUjjZXMVGx7lWhgCSeRddb6dRPX44km3urbmALHJuYH0eEm1curGt/ fTEcd3KMmmECNxRbDt8l41bfw0YAEpKW91/hyefwSaRUmfiQcaaO3R0RWV0vcXNH3J2hN RPbbdkZMR96eR2eTPJxk0LNN95k4oit5u/jORONS2EDdlBdojxi+jqnv73OZ9SrDafQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="mmj/C7tU"; arc=none smtp.remote-ip=192.198.163.17 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A88B7606A6A9 for ; Wed, 2 Dec 2026 23:33:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A88B7606A6A9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=mmj/C7tU DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796254420; x=1827790420; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KMaNBltehjci8wGaAQysQA/QxL+ioZJgxbfJ7Cras+8=; b=mmj/C7tUgRrhn6XDRRtkSkrCWKKWa3bC5TgM4FX5oRlhplM6A587cdBi 1hnQECs6GvJf6gMS/hf/rcX4iBti/2ky7+YJIQOkEpahxdY1Vvx9x+PJ1 D5Y9OAj76g3P2RKaN6BFuSRPc3BlOcvinF4MCLe1odH6xwaTVY8/fl3lR bgCWo+zWEOcDeviLhtcxlIFib+ziR527iVq9PKzqhVxW9NeWfdcHFNgBY Baa1ZEGZaKNqtwJ/QBNqZTPjwNdMY1Vz5zHGehLWZwH0L5wHLScL2D2Tw RjoebQmpaKOLZ9vG3I2LdS6oUdNe5oX26fgHbJtqwioyGG2Ew7G7kNeir A==; X-CSE-ConnectionGUID: 735n7KayS6uLgNUxNLxoWQ== X-CSE-MsgGUID: O9HQeTkQTryhRmhZZCk+Iw== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5203280" X-IronPort-AV: E=Sophos;i="6.27,247,1787036400"; d="scan'208";a="5203280" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 15:33:31 -0800 X-CSE-ConnectionGUID: Q8u2cH9BQrqqsRYWPiA62w== X-CSE-MsgGUID: 0ngfRGT2Qvq1LKGe1ywixw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,247,1787036400"; d="scan'208";a="13484102" Received: from gsse-cloud1.jf.intel.com ([10.54.39.91]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 15:33:30 -0800 From: Matthew Brost To: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Matthew Auld , Jani Nikula , stable@vger.kernel.org Subject: [PATCH v5 27/36] drm/xe/display: Flush cleanup work on unregister Date: Wed, 2 Dec 2026 15:33:14 -0800 Message-Id: <20261202233323.3743190-28-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261202233323.3743190-1-matthew.brost@intel.com> References: <20261202233323.3743190-1-matthew.brost@intel.com> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xe_device_remove() calls xe_display_unregister() and then xe_bo_pci_dev_remove_all(), which drops all DMA mappings by evicting every bo. Framebuffers pinned for scanout via ttm_bo_pin() are on the unevictable list and are not on the xe pinned lists, so they rely on drm_atomic_helper_shutdown() in intel_display_driver_unregister() to be unpinned first. However, the shutdown commit unpins the old plane state from the asynchronous cleanup work (intel_atomic_cleanup_work()), which is not flushed until intel_display_driver_remove() runs from a devm action, after xe_device_remove(). A scanout bo can therefore still be pinned when xe_bo_pci_dev_remove_all() runs and keep its DMA mapping past device removal. Unmapping it on final release, after the pci device has left its IOMMU group, dereferences a NULL iommu group. Flush the cleanup work in xe_display_unregister() so all framebuffers are unpinned before the bos are evicted. Fixes: 3cbb651117ff ("drm/xe/bo: Add a bo remove callback") Cc: Thomas Hellström Cc: Matthew Auld Cc: Jani Nikula Cc: stable@vger.kernel.org # v6.16+ Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/display/xe_display.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c index b1a6008bf15c..68d29d78dc8b 100644 --- a/drivers/gpu/drm/xe/display/xe_display.c +++ b/drivers/gpu/drm/xe/display/xe_display.c @@ -155,6 +155,14 @@ void xe_display_unregister(struct xe_device *xe) intel_display_driver_runtime_pm_disable(display); intel_display_driver_unregister(display); + + /* + * The shutdown commit unpins the framebuffers from the asynchronous + * cleanup work. Flush it so they are unpinned, and thus visible to + * the eviction in xe_bo_pci_dev_remove_all(), before the device + * is removed. + */ + intel_display_flush_cleanup_work(display); } void xe_display_shutdown(struct xe_device *xe) -- 2.34.1