From mboxrd@z Thu Jan 1 00:00:00 1970 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 BA97ED6CFAB for ; Thu, 22 Jan 2026 22:51:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E930010EB4F; Thu, 22 Jan 2026 22:51:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="grDLp8Wv"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id D80AC10EB3F for ; Thu, 22 Jan 2026 22:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769122285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=UCysTo7OMV2/jfbYw2YK22A1cPCErwIaomCVQtYlQaE=; b=grDLp8WvTHawsMClf+mgmJ3pK+EHYrgpMDimJzbAXmq8KI7rVFokoc4U6H5N6vNU7xLKLQ HBGohUmAUzyZjv0eDbNVyGmsLODyzQ0ezRVcgp5EfVq5suQUzHQ5cwIp6PrQIstO32kjo2 s5hpJOVattwLkHT97g4kqXIlTCeLeS8= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-591-66iMN1VCOG61fk1WMto-bA-1; Thu, 22 Jan 2026 17:51:21 -0500 X-MC-Unique: 66iMN1VCOG61fk1WMto-bA-1 X-Mimecast-MFC-AGG-ID: 66iMN1VCOG61fk1WMto-bA_1769122279 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6E8C918005B9; Thu, 22 Jan 2026 22:51:19 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.89.232]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7B69A30002D8; Thu, 22 Jan 2026 22:51:16 +0000 (UTC) From: Lyude Paul To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org, Danilo Krummrich Cc: nouveau@lists.freedesktop.org, "Miguel Ojeda" , "Simona Vetter" , "Alice Ryhl" , "Shankari Anand" , "David Airlie" , "Benno Lossin" , "Asahi Lina" , "Daniel Almeida" , "Lyude Paul" Subject: [PATCH v3 0/3] Introduce DeviceContext Date: Thu, 22 Jan 2026 17:46:35 -0500 Message-ID: <20260122225057.3589500-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Previous version of this patch series: https://patchwork.freedesktop.org/series/160217/#rev1 One of the unsolved issues we still have with the rust DRM bindings is the ability to limit certain Device operations to contexts where we can guarantee that a Device has been fully initialized and registered with userspace, or vice-versa (e.g. must be unregistered). While the previous solution for this that I had was simply not exposing drm::Device at all until the device has been registered with userspace, unfortunately this isn't enough since: * As we found out with Tyr, drivers occasionally need to be able to create GEM objects before device registration * We would still need to be able to handle KMS callbacks which could be invoked after KMS init but before userspace registration (not handled in this series specifically, but DeviceContext will be required for handling this). This patch series provides a pretty nice solution to this, by implementing a very similar solution to kernel::device::DeviceContext: introducing our own DeviceContext type state. This patch series depends on the two pre-requisite patch series: * https://patchwork.freedesktop.org/series/160523/ * https://patchwork.freedesktop.org/series/160525/ Series-wide changes V2: * s/DeviceCtx/DeviceContext/ for consistency * Move private driver-data availability to the Registration DeviceContext * s/AnyCtx/Init/ More changes described in each patch description. Lyude Paul (3): rust/drm: Introduce DeviceContext rust/drm: Don't setup private driver data until registration rust/drm/gem: Use DeviceContext with GEM objects drivers/gpu/drm/nova/driver.rs | 10 +- drivers/gpu/drm/nova/gem.rs | 11 +- drivers/gpu/drm/tyr/driver.rs | 12 +- drivers/gpu/drm/tyr/gem.rs | 3 +- rust/kernel/drm/device.rs | 246 +++++++++++++++++++++++++-------- rust/kernel/drm/driver.rs | 55 ++++++-- rust/kernel/drm/gem/mod.rs | 64 ++++++--- rust/kernel/drm/mod.rs | 4 + 8 files changed, 303 insertions(+), 102 deletions(-) base-commit: 6ea52b6d8f33ae627f4dcf43b12b6e713a8b9331 prerequisite-patch-id: d596b2a5a81fb067cb267fe30b6e2d8fd47fddad prerequisite-patch-id: 32f09c643498c714d92a6a87b3de220b5d37b41e prerequisite-patch-id: 28f11c925aab9ed9d4fa70dbbf2c4a7accb5c05d -- 2.52.0