From 8ec581a1180d878bbd8af76fb9c18246309a7bdd Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Tue, 13 Oct 2026 11:11:53 +0200 Subject: [PATCH] x86/PV: make better use of assign_pages() As of the referenced commit there's no reason to open-code the loop anymore. With that replaced by a single call, there's then also no point in using the local "mfn" in this code. Amends: 5260e8fb93f0 ("xen: re-define assign_pages and introduce a new function assign_page") Signed-off-by: Jan Beulich Reviewed-by: George Dunlap --- xen/arch/x86/pv/dom0_build.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index ddeb144b06..24f2fa0b7f 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -618,12 +618,12 @@ static int __init dom0_construct(const struct boot_domain *bd) (vinitrd_start - v_start) >> PAGE_SHIFT : domain_tot_pages(d); initrd_mfn = paddr_to_pfn(initrd->start); - mfn = initrd_mfn; count = PFN_UP(initrd_len); #ifdef CONFIG_PV32 if ( d->arch.pv.physaddr_bitsize && - ((mfn + count - 1) >> (d->arch.pv.physaddr_bitsize - PAGE_SHIFT)) ) + ((initrd_mfn + count - 1) >> + (d->arch.pv.physaddr_bitsize - PAGE_SHIFT)) ) { order = get_order_from_pages(count); page = alloc_domheap_pages(d, order, MEMF_no_scrub); @@ -648,9 +648,8 @@ static int __init dom0_construct(const struct boot_domain *bd) else #endif { - while ( count-- ) - if ( assign_pages(mfn_to_page(_mfn(mfn++)), 1, d, 0) ) - BUG(); + if ( assign_pages(mfn_to_page(_mfn(initrd_mfn)), count, d, 0) ) + BUG(); /* * We have mapped the initrd directly into dom0, and assigned the * pages. Tell the boot_module handling that we've freed it, so the