lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5B875DFB-D655-4BAC-A475-43AE309520E2@collabora.com>
Date: Wed, 28 May 2025 14:29:44 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Miguel Ojeda <ojeda@...nel.org>,
 Alex Gaynor <alex.gaynor@...il.com>,
 Boqun Feng <boqun.feng@...il.com>,
 Gary Guo <gary@...yguo.net>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>,
 Benno Lossin <benno.lossin@...ton.me>,
 Andreas Hindborg <a.hindborg@...nel.org>,
 Alice Ryhl <aliceryhl@...gle.com>,
 Trevor Gross <tmgross@...ch.edu>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 "Rafael J. Wysocki" <rafael@...nel.org>,
 Andrew Morton <akpm@...ux-foundation.org>,
 Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
 Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
 Bjorn Helgaas <bhelgaas@...gle.com>,
 Mika Westerberg <mika.westerberg@...ux.intel.com>,
 Ying Huang <huang.ying.caritas@...il.com>,
 linux-kernel@...r.kernel.org,
 rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v8 3/3] rust: platform: allow ioremap of platform
 resources

Hi Danilo,

[…]

> 
>> +    ///     let offset = 0; // Some offset.
>> +    ///
>> +    ///     // If the size is known at compile time, use `ioremap_resource_sized`.
>> +    ///     // No runtime checks will apply when reading and writing.
>> +    ///     let resource = pdev.resource(0).ok_or(ENODEV)?;
>> +    ///     let iomem = pdev.ioremap_resource_sized::<42>(&resource)?;
>> +    ///
>> +    ///     // Read and write a 32-bit value at `offset`. Calling `try_access()` on
>> +    ///     // the `Devres` makes sure that the resource is still valid.
>> +    ///     let data = iomem.try_access().ok_or(ENODEV)?.read32_relaxed(offset);
>> +    ///
>> +    ///     iomem.try_access().ok_or(ENODEV)?.write32_relaxed(data, offset);
> 
> Since this won't land for v6.16, can you please use Devres::access() [1]
> instead? I.e.
> 
> let iomem = pdev.ioremap_resource_sized::<42>(&resource)?;
> let io = Devres::access(pdev.as_ref())?;
> 
> let data = io.read32_relaxed(offset);
> io.write32_relaxed(data, offset);
> 
> Devres::access() is in nova-next and lands in v6.16.
> 
> [1] https://gitlab.freedesktop.org/drm/nova/-/commit/f301cb978c068faa8fcd630be2cb317a2d0ec063

Devres:access takes &Device<Bound>, but the argument in probe() is
&Device<Core>.

Are these two types supposed to convert between them? I see no explicit
function to do so.

— Daniel


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ