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

From: Joerg Roedel (AMD)

Date: Thu Jul 30 2026 - 08:44:25 EST


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 <boris.brezillon@xxxxxxxxxxxxx>
> Signed-off-by: Deborah Brouwer <deborah.brouwer@xxxxxxxxxxxxx>
> ---
> 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/20260703-pgtable_lt_b4-v2-1-f14da6d4106d@xxxxxxxxxxxxx
>
> Changes in v2:
> - Renamed new_raw() to new(), since the constructor is now safe.
> - Link to v1: https://lore.kernel.org/rust-for-linux/20260702-pgtable_lt_v1-v1-1-18d9c9812a1a@xxxxxxxxxxxxx
> ---
> rust/kernel/iommu/pgtable.rs | 32 +++++++++-----------------------
> 1 file changed, 9 insertions(+), 23 deletions(-)

Acked-by: Joerg Roedel <joerg.roedel@xxxxxxx>