From: Daniel Almeida <daniel.almeida@collabora.com>
To: sunke@kylinos.cn
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"Lorenzo Stoakes" <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
"Lyude Paul" <lyude@redhat.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Sami Tolvanen" <samitolvanen@google.com>,
rust-for-linux@vger.kernel.org, linux-mm@kvack.org,
dri-devel@lists.freedesktop.org, driver-core@lists.linux.dev,
"Alvin Sun" <alvin.sun@linux.dev>
Subject: Re: [PATCH v3 06/11] drm/tyr: add BO creation and lookup helpers
Date: Fri, 9 Oct 2026 11:28:29 -0300 [thread overview]
Message-ID: <84ADA150-9E7B-4EF9-ABD0-377E9746E293@collabora.com> (raw)
In-Reply-To: <20260929-tyr-ioctls-v3-6-26955fb111d5@kylinos.cn>
> On 28 Sep 2026, at 23:15, Ke Sun via B4 Relay <devnull+sunke.kylinos.cn@kernel.org> wrote:
>
> From: Alvin Sun <alvin.sun@linux.dev>
>
> Add helpers for the BO ioctls: new_object() creates a GEM object with
> the size aligned up to PAGE_SIZE, and lookup_handle() resolves a handle
> for a DRM file.
>
> Signed-off-by: Alvin Sun <alvin.sun@linux.dev>
> ---
> drivers/gpu/drm/tyr/gem.rs | 31 ++++++++++++++++++++++++++++++-
> 1 file changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/tyr/gem.rs b/drivers/gpu/drm/tyr/gem.rs
> index 3bf3787f5c3fd..0e0989a48678f 100644
> --- a/drivers/gpu/drm/tyr/gem.rs
> +++ b/drivers/gpu/drm/tyr/gem.rs
> @@ -9,8 +9,10 @@
> use kernel::{
> drm::gem::{
> self,
> - shmem, //
> + shmem,
> + BaseObject, //
> },
> + page::PAGE_SIZE,
> prelude::*,
> sync::{
> aref::ARef,
> @@ -23,6 +25,7 @@
> TyrDrmDevice,
> TyrDrmDriver, //
> },
> + file::TyrDrmFile,
> vm::{
> Vm,
> VmMapFlags, //
> @@ -53,6 +56,32 @@ fn new(_dev: &TyrDrmDevice, _size: usize, args: BoCreateArgs) -> impl PinInit<Se
> /// Type alias for Tyr GEM buffer objects.
> pub(crate) type Bo = gem::shmem::Object<BoData>;
>
> +/// Create a new GEM buffer object.
> +#[expect(dead_code)]
> +pub(crate) fn new_object(ddev: &TyrDrmDevice, size: usize, flags: u32) -> Result<ARef<Bo>> {
> + if size == 0 {
> + return Err(EINVAL);
> + }
> +
> + let aligned_size = size.checked_next_multiple_of(PAGE_SIZE).ok_or(EINVAL)?;
> +
> + Bo::new(
> + ddev,
> + aligned_size,
> + shmem::ObjectConfig {
> + map_wc: true,
> + parent_resv_obj: None,
> + },
> + BoCreateArgs { flags },
> + )
> +}
> +
> +/// Look up a GEM object by handle for a DRM file.
> +#[expect(dead_code)]
> +pub(crate) fn lookup_handle(file: &TyrDrmFile, handle: u32) -> Result<ARef<Bo>> {
> + Bo::lookup_handle(file, handle)
> +}
> +
> /// Creates a dummy GEM object to serve as the root of a GPUVM.
> pub(crate) fn new_dummy_object(ddev: &TyrDrmDevice) -> Result<ARef<Bo>> {
> let bo = Bo::new(
>
> --
> 2.43.0
>
>
>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
next prev parent reply other threads:[~2026-10-09 14:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 2:15 [PATCH v3 00/11] drm/tyr: add VM and BO ioctl support Ke Sun via B4 Relay
2026-09-29 2:15 ` [PATCH v3 01/11] rust: sizes: add SZ_4G constant Ke Sun via B4 Relay
2026-09-29 2:15 ` [PATCH v3 02/11] rust: mm: add `task_size` helper Ke Sun via B4 Relay
2026-09-29 2:15 ` [PATCH v3 03/11] rust: sync: arc: relax `ForeignOwnable` for `Arc<T>` Ke Sun via B4 Relay
2026-09-29 2:15 ` [PATCH v3 04/11] drm/tyr: add per-file VM pool Ke Sun via B4 Relay
2026-10-09 14:22 ` Daniel Almeida
2026-10-10 17:15 ` Deborah Brouwer
2026-10-10 19:33 ` Daniel Almeida
2026-09-29 2:15 ` [PATCH v3 05/11] drm/tyr: add user and MCU VM specifications Ke Sun via B4 Relay
2026-10-09 14:26 ` Daniel Almeida
2026-10-09 14:27 ` Daniel Almeida
2026-09-29 2:15 ` [PATCH v3 06/11] drm/tyr: add BO creation and lookup helpers Ke Sun via B4 Relay
2026-10-09 14:28 ` Daniel Almeida [this message]
2026-09-29 2:15 ` [PATCH v3 07/11] drm/tyr: add VM-related ioctls Ke Sun via B4 Relay
2026-10-09 14:36 ` Daniel Almeida
2026-09-29 2:15 ` [PATCH v3 08/11] drm/tyr: add BO-related ioctls Ke Sun via B4 Relay
2026-10-09 14:52 ` Daniel Almeida
2026-09-29 2:15 ` [PATCH v3 09/11] rust: device: expose dma_coherent() Ke Sun via B4 Relay
2026-09-29 18:40 ` Danilo Krummrich
2026-09-29 2:16 ` [PATCH v3 10/11] drm/tyr: gem: flush write-combine BOs from probe-time coherence Ke Sun via B4 Relay
2026-09-29 2:16 ` [PATCH v3 11/11] drm/tyr: gem: map cached BOs for DRM_PANTHOR_BO_WB_MMAP Ke Sun via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84ADA150-9E7B-4EF9-ABD0-377E9746E293@collabora.com \
--to=daniel.almeida@collabora.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=alvin.sun@linux.dev \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=samitolvanen@google.com \
--cc=simona@ffwll.ch \
--cc=sunke@kylinos.cn \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox