[PATCH] arm64: patching: avoid early page_to_phys()
Mike Rapoport
rppt at kernel.org
Tue Dec 3 00:55:19 PST 2024
On Tue, Dec 03, 2024 at 01:46:11AM +0100, Christoph Hellwig wrote:
> On Mon, Dec 02, 2024 at 05:03:59PM +0000, Mark Rutland wrote:
> > + phys_addr_t phys;
> > +
> > + if (is_image_text((unsigned long)addr)) {
> > + phys = __pa_symbol(addr);
> > + } else {
> > + struct page *page = vmalloc_to_page(addr);
> > + BUG_ON(!page);
> > + phys = page_to_phys(page) + offset_in_page(addr);
> > + }
> > +
> > + return (void *)set_fixmap_offset(fixmap, phys);
>
> This looks much better. Btw, I recently open coded the vmalloc to phys
> logic above in an unrelated fix, and noticed that
> arch/powerpc/mm/pgtable.c has a nice vmalloc_to_phys that could
> be generalized and move to common code. Does anyone have an opinion
> on that?
Maybe fold that check for !page into vmalloc_to_pfn() and make
vmalloc_to_phys() a static inline?
--
Sincerely yours,
Mike.
More information about the linux-arm-kernel
mailing list