From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A03592D320E for ; Thu, 12 Feb 2026 08:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770884260; cv=none; b=tYuwWqta1njJHg3ZpPLXqDcBqs8E1ofTduQHAkYdm2VoTeyV2byrC9A/b3jPPZsW4htStv3q9bqi6GuWAaPW8SL2jFz6fkJsfeQevvoln5wtlownqFCUFu5F0cU6OTahf12cBm6xllUpEigLV7pXAqZfz7Y2mmh7tQyN6prnBAA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770884260; c=relaxed/simple; bh=93IOVW/PcOxdSVuCu2WWHizraqwu9N9D1ImwbinLG2U=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KETkAVosjP+LP+sTnohTpbnBIxG4PY8e0M7c/6hadOzDdGl/qF5lUSDRxPI8FryTqxtirzxIJ71K7/QbzTCkBzaE4z8FKNjt+A4nle1zlGlk2ixp/KX1+ijjRVSdKjKl3ismapgkwUlcSIPc3nxSH8kYrOheN47UB2LW9c7paks= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=dXLLspR1; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="dXLLspR1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1770884258; bh=93IOVW/PcOxdSVuCu2WWHizraqwu9N9D1ImwbinLG2U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dXLLspR1PE9mT2qc723tWMcF3aqVtdsOcHAJJz6HI361KDOwpKQigVDsCkmq+K8oz KKgMHdRdlSpinhDcfgGPYahHgQfke7wJNadwtpZdc67QKsKCYAlEmfHUoMv7lTanBG p38I3aYSvWyIlWqd58S5W9A02HnsB4r7UUrLIvhVqL9JSD8Hq1TNMz2pF8FhrUJFXB uk2km7YT7GqVBi7Eb996dOf1OZdepp11D8kzSrxGhuc66yfeUDs8vB2N03c3JhHbzk A2clk/QVCZeB3FMGu3pJZkUsogPxbiHqHt42R3UnoiunbGjN3dT+OqRVf19Mk6uZVV sFh8avB6mH7+A== Received: from fedora (unknown [IPv6:2a01:e0a:2c:6930:d919:a6e:5ea1:8a9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id B787217E00AC; Thu, 12 Feb 2026 09:17:37 +0100 (CET) Date: Thu, 12 Feb 2026 09:17:34 +0100 From: Boris Brezillon To: Deborah Brouwer Cc: dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org, daniel.almeida@collabora.com, aliceryhl@google.com, beata.michalska@arm.com, lyude@redhat.com Subject: Re: [PATCH 06/12] drm/tyr: add shmem backing for GEM objects Message-ID: <20260212091734.0497dc87@fedora> In-Reply-To: <20260212013713.304343-7-deborah.brouwer@collabora.com> References: <20260212013713.304343-1-deborah.brouwer@collabora.com> <20260212013713.304343-7-deborah.brouwer@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.3.1 (GTK 3.24.51; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 11 Feb 2026 17:37:07 -0800 Deborah Brouwer wrote: > Add support for GEM buffer objects backed by shared memory. > > This introduces the BoCreateArgs structure for passing creation parameters > including flags, and adds a flags field to BoData. A new_dummy_object() > helper is provided to create a dummy GEM object for use as a GPUVM root. > > The Bo type alias is added to simplify working with Tyr's shmem-backed > GEM objects throughout the driver. > > Co-developed-by: Boris Brezillon > Signed-off-by: Boris Brezillon > Signed-off-by: Deborah Brouwer > --- > drivers/gpu/drm/tyr/gem.rs | 52 ++++++++++++++++++++++++++++++++------ > 1 file changed, 44 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/tyr/gem.rs b/drivers/gpu/drm/tyr/gem.rs > index c1208d332dea..6a58f2da88d3 100644 > --- a/drivers/gpu/drm/tyr/gem.rs > +++ b/drivers/gpu/drm/tyr/gem.rs > @@ -1,28 +1,64 @@ > // SPDX-License-Identifier: GPL-2.0 or MIT > +//! GEM buffer object management for the Tyr driver. > +//! > +//! This module provides buffer object (BO) management functionality using > +//! DRM's GEM subsystem with shmem backing. > > use kernel::{ > drm::{ > gem, > + gem::shmem, > DeviceContext, // > }, > - prelude::*, // > + prelude::*, > + sync::aref::ARef, // > }; > > -use crate::driver::TyrDrmDriver; > +use crate::driver::{ > + TyrDrmDevice, > + TyrDrmDriver, // > +}; > > -/// GEM Object inner driver data > +/// Tyr's DriverObject type for GEM objects. > #[pin_data] > -pub(crate) struct BoData {} > +pub(crate) struct BoData { > + flags: u32, > +} > + > +/// Provides a way to pass arguments when creating BoData > +/// as required by the gem::DriverObject trait. > +pub(crate) struct BoCreateArgs { > + flags: u32, > +} > > impl gem::DriverObject for BoData { > type Driver = TyrDrmDriver; > - type Args = (); > + type Args = BoCreateArgs; > > fn new( > - _dev: &kernel::drm::Device, > + _dev: &TyrDrmDevice, > _size: usize, > - _args: (), > + args: BoCreateArgs, > ) -> impl PinInit { > - try_pin_init!(BoData {}) > + try_pin_init!(Self { flags: args.flags }) > } > } > + > +/// Type alias for Tyr GEM buffer objects. > +pub(crate) type Bo = gem::shmem::Object; > + > +/// Creates a dummy GEM object to serve as the root of a GPUVM. > +#[expect(dead_code)] > +pub(crate) fn new_dummy_object(ddev: &TyrDrmDevice) -> Result> { > + let bo = gem::shmem::Object::::new( > + ddev, > + 4096, > + shmem::ObjectConfig { > + map_wc: true, > + parent_resv_obj: None, > + }, > + BoCreateArgs { flags: 0 }, > + )?; > + > + Ok(bo) > +} Nit: I'd probably move this new_dummy_object() addition to the commit introducing Vm support.