[PATCH v4 07/14] mm: abstract io_remap_pfn_range() based on PFN

Lorenzo Stoakes lorenzo.stoakes at oracle.com
Wed Sep 17 23:26:14 PDT 2025


On Wed, Sep 17, 2025 at 06:19:44PM -0300, Jason Gunthorpe wrote:
> On Wed, Sep 17, 2025 at 08:11:09PM +0100, Lorenzo Stoakes wrote:
>
> > -#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
> > -	remap_pfn_range(vma, vaddr, pfn, size, prot)
> > +#define io_remap_pfn_range_pfn(pfn, size) (pfn)
>
> ??
>
> Just delete it? Looks like cargo cult cruft, see below about
> pgprot_decrypted().

?? yourself! I'm not responsible for the code I touch ;)

I very obviously did this to prevent pgprot_decrypted() being invoked,
keeping the code idempotent to the original.

I obviously didn't account for the fact it's a nop on these arches, which
is your main point here. Which is a great point and really neatly cleans
things up, thanks!

>
> > +#ifdef io_remap_pfn_range_pfn
> > +static inline unsigned long io_remap_pfn_range_prot(pgprot_t prot)
> > +{
> > +	/* We do not decrypt if arch customises PFN. */
> > +	return prot;
>
> pgprot_decrypted() is a NOP on all the arches that use this override,
> please drop this.

Yes that's a great insight that I missed, and radically simplifies this.

I think my discovering that the PFN is all that varies apart from this +
your pedan^W careful review has led us somewhere nice once I drop this
stuff.

>
> Soon future work will require something more complicated to compute if
> pgprot_decrypted() should be called so this unused stuff isn't going
> to hold up.

Right, not sure what you're getting at here, for these arches will be nop,
so we're all good?

>
> Otherwise looks good to me
>
> Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>

Thanks!

>
> Jason



More information about the kexec mailing list