[PATCH v3 07/13] mm: introduce io_remap_pfn_range_[prepare, complete]()
Lorenzo Stoakes
lorenzo.stoakes at oracle.com
Tue Sep 16 10:34:20 PDT 2025
On Tue, Sep 16, 2025 at 02:19:30PM -0300, Jason Gunthorpe wrote:
> On Tue, Sep 16, 2025 at 03:11:53PM +0100, Lorenzo Stoakes wrote:
> >
> > -int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long vaddr,
> > - unsigned long pfn, unsigned long size, pgprot_t prot)
> > +static unsigned long calc_pfn(unsigned long pfn, unsigned long size)
> > {
> > phys_addr_t phys_addr = fixup_bigphys_addr(pfn << PAGE_SHIFT, size);
> >
> > - return remap_pfn_range(vma, vaddr, phys_addr >> PAGE_SHIFT, size, prot);
> > + return phys_addr >> PAGE_SHIFT;
> > +}
>
> Given you changed all of these to add a calc_pfn why not make that
> the arch abstraction?
OK that's reasonable, will do.
>
> static unsigned long arch_io_remap_remap_pfn(unsigned long pfn, unsigned long size)
> {
> ..
> }
> #define arch_io_remap_remap_pfn arch_io_remap_remap_pfn
>
> [..]
>
> #ifndef arch_io_remap_remap_pfn
> static inline unsigned long arch_io_remap_remap_pfn(unsigned long pfn, unsigned long size)
> {
> return pfn;
> }
> #endif
>
> static inline void io_remap_pfn_range_prepare(struct vm_area_desc *desc, unsigned long pfn,
> unsigned long size)
> {
> return remap_pfn_range_prepare(desc, arch_io_remap_remap_pfn(pfn));
> }
>
> etc
>
> Removes alot of the maze here.
Actually nice to restrict what arches can do here also... :)
>
> Jason
More information about the kexec
mailing list