[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] x86/PV: make better use of assign_pages()



commit 8ec581a1180d878bbd8af76fb9c18246309a7bdd
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Oct 13 11:11:53 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Oct 13 11:11:53 2026 +0200

    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 <jbeulich@xxxxxxxx>
    Reviewed-by: George Dunlap <gwd@xxxxxxxxxxxxxx>
---
 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
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.