Re: [PATCH v3] rust: iommu: add device lifetime to IoPageTable

Alice Ryhl <[email protected]> Fri, 31 Jul 2026 12:48:19 +0000
Newsgroups dev.linux.lists.iommu,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Thu, Jul 30, 2026 at 02:37:30PM +0200, Joerg Roedel (AMD) wrote:
> On Fri, Jul 03, 2026 at 05:28:44PM -0700, Deborah Brouwer wrote:
> > Currently, using a raw IoPageTable is unsafe because the returned
> > IoPageTable is not tied to the device driver binding lifetime.
> > 
> > Since device drivers now receive a lifetime parameter <'bound>
> > representing the interval during which a device driver is bound to its bus
> > device, add a lifetime parameter to IoPageTable. This ensures that
> > the returned IoPageTable cannot outlive the bus device binding.
> > 
> > Also remove the option to create a page table as a device resource since
> > currently Devres is not compatible with resources that have a lifetime
> > parameter. This option can be restored once the lifetime-aware
> > wrapper for devres is available and if a use-case appears for it.
> > 
> > Suggested-by: Boris Brezillon <[email protected]>
> > Signed-off-by: Deborah Brouwer <[email protected]>
> > ---
> > Changes in v3:
> > - Rename 'bound to 'a since the page table could have a shorter
> >   lifetime than the whole device bound.
> > - Remove the TODO comment about restoring the devres option.
> > - Link to v2: https://lore.kernel.org/r/[email protected]
> > 
> > Changes in v2:
> > - Renamed new_raw() to new(), since the constructor is now safe.
> > - Link to v1: https://lore.kernel.org/rust-for-linux/[email protected]
> > ---
> >  rust/kernel/iommu/pgtable.rs | 32 +++++++++-----------------------
> >  1 file changed, 9 insertions(+), 23 deletions(-)
> 
> Acked-by: Joerg Roedel <[email protected]>

Applied to drm-rust-next. Thanks!