From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6A182D2486 for ; Fri, 23 Jan 2026 09:23:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769160217; cv=none; b=s/jADJ+/CFFXaAJylV47sznCg3enRe+ODZuFBAgV1LmTs/Xea8L32WxAaXWigCGjMPpZ8yp89GYxR5rWuj9G0oa4FxGHtTT6nn2IPsZj3ev2dz4InuRbLc75/8p0NLgXE7gE61bof1j6iOtLVlp/Mga6skkAPHicSCUBEBnS7Wc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769160217; c=relaxed/simple; bh=Yp5JC+o9XfhjXZIR9DSkxgJ9QPtnq0F7Bb2nhqBIVM4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=MsxAGZimLbU56c9ATj/rlUbNr2Bzw88QQ7nbIduf3v0Mz/Tvj0chyNjD1WMsdTiiot2kh7HhhWeZvJzTW//zMzRRjnllLqql49l0kHkdjoYZp7FvN4rzMXUJpssOX9l4ohrwbtLaRrk8g0asYaEjKXbpKwhX7TJRhwsThg+C/cA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=s9+kzCeb; arc=none smtp.client-ip=209.85.208.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="s9+kzCeb" Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-64db7bc9921so18288a12.2 for ; Fri, 23 Jan 2026 01:23:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769160214; x=1769765014; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=C+T0dti8ZBhNnJy4fxtj+vryGifAMmqjwXPe5o6PeaE=; b=s9+kzCebjKSUNbNfRG1gMardqJ0Zy7Mq59yFSgLenxmO1ATBEIs1GV7bHBrcTLkcpH JS3Mgl46qAU+BCa5L5mxNIbzZGGtg/SC5Jjfw2lfNTrsL4P88W4IGjcnofphSOjeW4DJ tnmRCzl2mVL/0wolAPVpbUP0Vp4dALFPZsZ9ZpcJdmzDt4NSvshDqd2Oo+vQS5jW9XQW eIzIpzMA5BQB+ivOJqCT/9xKEqp00OsRYz0BaoV+kB4Ntr/41KqiuCkLzaOW562HeP83 0WkdAkOfSQ8GhFoisMLLeIp8yK6Xt57jZ4u8tcM9ifUaHSQ5qvqZTzYUoCos/calmADO /PUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769160214; x=1769765014; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=C+T0dti8ZBhNnJy4fxtj+vryGifAMmqjwXPe5o6PeaE=; b=Q3u4qrvTf1BHAyroV+cy8+vyzY74oZODhdHZYy5REukJVSH8Fwyk3/CJblnImlvMRd Oix4quEkNYtX2lAdKY6OsxfbPJHSySdf5HyNebS14AQrl+6hci7YCIaKZvum5i1ZvK/s WzZ2Fl3VaeCn8wA79sBVrDTPpfpDlLhRoXFh1f02FsfhmaYLXbUmJbAAdYIppWd4WNHE 56Z9h1Ar7DLBbF7p4ydQMuAm9T5SXhU0g6Jfzr0FVDDyKqV754I97SOYSEEKGmHkVF28 Zqz2wvdKUjC1yttd6/ujsWyYvIi6d/TOlFWSYKBUS2AslVjIDmHGCUXSitoiME0wnvcN 3N1w== X-Forwarded-Encrypted: i=1; AJvYcCVLOIYfVmTpuFtrHX6wTA8PPbfvf6RyZfEWRP8OXTpEsV3QYsT5p5+oGz3fBpApxdYbvMAfQ3DvamhuMhM=@vger.kernel.org X-Gm-Message-State: AOJu0YwxaZAo3NG/zIDN5w2o5SyWRV94OJyPodeCw7viprNZA7SQg7E/ 1082edV/ZwRteWQdQFwqijsRN6sRrp8Pu502t3bWdAnonRboKr9WLMEI39SlltK6RKsaz0atrin 74tuVhgvIyDxkxTnvuA== X-Received: from edqv18.prod.google.com ([2002:aa7:d812:0:b0:64b:9dfc:134d]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:524a:b0:658:eca:df89 with SMTP id 4fb4d7f45d1cf-6584876375cmr1714402a12.13.1769160214158; Fri, 23 Jan 2026 01:23:34 -0800 (PST) Date: Fri, 23 Jan 2026 09:23:33 +0000 In-Reply-To: <9C5177DB-CEBA-4DD5-8E93-DB39CB1F2079@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260121-gpuvm-rust-v3-0-dd95c04aec35@google.com> <20260121-gpuvm-rust-v3-6-dd95c04aec35@google.com> <9C5177DB-CEBA-4DD5-8E93-DB39CB1F2079@collabora.com> Message-ID: Subject: Re: [PATCH v3 6/6] rust: gpuvm: add GpuVmCore::sm_map() From: Alice Ryhl To: Daniel Almeida Cc: Danilo Krummrich , Boris Brezillon , Janne Grunau , Matthew Brost , "Thomas =?utf-8?Q?Hellstr=C3=B6m?=" , Lyude Paul , Asahi Lina , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 22, 2026 at 07:58:34PM -0300, Daniel Almeida wrote: > Hi Alice, >=20 > > On 21 Jan 2026, at 08:31, Alice Ryhl wrote: > >=20 > > Finally also add the operation for creating new mappings. Mapping > > operations need extra data in the context since they involve a vm_bo > > coming from the outside. > >=20 > > Co-developed-by: Asahi Lina > > Signed-off-by: Asahi Lina > > Signed-off-by: Alice Ryhl > > --- > > rust/kernel/drm/gpuvm/mod.rs | 9 ++- > > rust/kernel/drm/gpuvm/sm_ops.rs | 154 +++++++++++++++++++++++++++++++++= +++++-- > > 2 files changed, 157 insertions(+), 6 deletions(-) > >=20 > > diff --git a/rust/kernel/drm/gpuvm/mod.rs b/rust/kernel/drm/gpuvm/mod.r= s > > index 165a25666ccc3d62e59b73483d4eedff044423e9..557c0d629eec912a97fc4ef= 18495d5bf0807db0a 100644 > > --- a/rust/kernel/drm/gpuvm/mod.rs > > +++ b/rust/kernel/drm/gpuvm/mod.rs > > @@ -93,7 +93,7 @@ const fn vtable() -> &'static bindings::drm_gpuvm_ops= { > > vm_bo_alloc: GpuVmBo::::ALLOC_FN, > > vm_bo_free: GpuVmBo::::FREE_FN, > > vm_bo_validate: None, > > - sm_step_map: None, > > + sm_step_map: Some(Self::sm_step_map), > > sm_step_unmap: Some(Self::sm_step_unmap), > > sm_step_remap: Some(Self::sm_step_remap), > > } > > @@ -248,6 +248,13 @@ pub trait DriverGpuVm: Sized { > > /// The private data passed to callbacks. > > type SmContext<'ctx>; > >=20 > > + /// Indicates that a new mapping should be created. > > + fn sm_step_map<'op, 'ctx>( > > + &mut self, > > + op: OpMap<'op, Self>, > > + context: &mut Self::SmContext<'ctx>, > > + ) -> Result, Error>; > > + > > /// Indicates that an existing mapping should be removed. > > fn sm_step_unmap<'op, 'ctx>( > > &mut self, > > diff --git a/rust/kernel/drm/gpuvm/sm_ops.rs b/rust/kernel/drm/gpuvm/sm= _ops.rs > > index 3c29d10d63f0b0a1976c714a86d486948ba81a15..5f3c5d3918147a6962e5658= 443c343835baa10b8 100644 > > --- a/rust/kernel/drm/gpuvm/sm_ops.rs > > +++ b/rust/kernel/drm/gpuvm/sm_ops.rs > > @@ -8,6 +8,100 @@ struct SmData<'a, 'ctx, T: DriverGpuVm> { > > user_context: &'a mut T::SmContext<'ctx>, > > } > >=20 > > +#[repr(C)] > > +struct SmMapData<'a, 'ctx, T: DriverGpuVm> { > > + sm_data: SmData<'a, 'ctx, T>, > > + vm_bo: GpuVmBoResident, > > +} > > + > > +/// The argument for [`GpuVmCore::sm_map`]. > > +pub struct OpMapRequest<'a, 'ctx, T: DriverGpuVm> { > > + /// Address in GPU virtual address space. > > + pub addr: u64, > > + /// Length of mapping to create. > > + pub range: u64, > > + /// Offset in GEM object. > > + pub offset: u64, >=20 > I=E2=80=99d rename this gem_offset. A bit vague/confusing otherwise. Sure. I'll rename. Alice