Re: [RFC PATCH v2 2/5] dma-mapping: Use the correct phys_to_dma() for DMA_RESTRICTED_POOL

Jason Gunthorpe
2026-03-30T22:28:47Z

On Mon, Mar 30, 2026 at 08:47:41PM +0000, Mostafa Saleh wrote:
> > The force_dma_unencrypted() should only be done way up the call chain
> > where we decide to get a phys that is decrypted. Once we have a
> > decrypted phys it should be carried with an annotation throughout all
> > the other places.
>
> Can you please clarify what you mean by annotation in this context?
> As I believe any tracking in the vmemmap is a big NO.

It would have to be a flag pass along the phys, or phys & flag in a
struct or some kind of approach like that.

> As replied to the first patch I can attempt to implement this approach
> (by passing a flag around) and see how intrusive it would be.

I'm less concerned about intrusive and more about making this
understandable.

When we reach a function with a phys it should know what that phys is,
not call a bunch of random helpers to hopefully correctly guess what
it is, that's unmaintainable spaghetti even if it is fewer changes.

Jason