[PATCH] arm64: patching: avoid early page_to_phys()
Christoph Hellwig
hch at lst.de
Mon Dec 2 16:46:11 PST 2024
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?
More information about the linux-arm-kernel
mailing list