Re: [PATCH v6] rust: iommu: add io_pgtable abstraction

From: Alice Ryhl

Date: Sun Jan 18 2026 - 16:26:57 EST


On Sun, Jan 18, 2026 at 4:57 PM Gary Guo <gary@xxxxxxxxxxx> wrote:
>
> On Sun Jan 18, 2026 at 10:08 AM GMT, Alice Ryhl wrote:
> > +// For the initial users of these rust bindings, the GPU FW is managing the IOTLB and performs all
> > +// required invalidations using a range. There is no need for it get ARM style invalidation
> > +// instructions from the page table code.
> > +//
> > +// Support for flushing the TLB with ARM style invalidation instructions may be added in the
> > +// future.
> > +static NOOP_FLUSH_OPS: bindings::iommu_flush_ops = bindings::iommu_flush_ops {
> > + tlb_flush_all: Some(rust_tlb_flush_all_noop),
> > + tlb_flush_walk: Some(rust_tlb_flush_walk_noop),
> > + tlb_add_page: None,
> > +};
> > +
> > +#[no_mangle]
> > +extern "C" fn rust_tlb_flush_all_noop(_cookie: *mut core::ffi::c_void) {}
>
> Any reason that these needs to be `#[no_mangle]`? Would just `extern "C"` not be
> enough? If there is a good reason, I think this should be noted as such (note
> that `#[no_mangle]` would be unsafe in edition 2024 so we probably would want to
> avoid using it if possible.

No, it's not required because these are referenced only via function
pointers stored in NOOP_FLUSH_OPS. In principle #[no_mangle] may be
removed here.

However, keeping it doesn't hurt either. There's no particular risk of
overlap with other symbols of the same name. I won't send another
version just for this. Joerg may remove it if he cares, but I don't
think it's a big deal.

> The rest LGTM, so
>
> Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>

Thanks for the review!

Alice