From nobody Thu Jan 30 17:23:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1731676393; cv=pass; d=zohomail.com; s=zohoarc; b=fieJasGqDDb1KC+JXL5kGGG0r1VeGjo+BuMRLaacmPLBLRMNqsf/nuyPWlVwxjrGNsFhPRVxFt2xtxC6UYZTuQWqPh7JaFJeGEoSC4h1Q76Vz5uElLNTQ5bbQ6CTxaKjXQJ3cuyQWI7VvbxwVU1BsZUVytgOb2jIGA7hsAHT8Hs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731676393; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lC7UJWnbMWc4RpQfKr8UGN6FjxqhttPxoGHw6Bmoiok=; b=bsMl1cS4zZh5oDNice2+VqKwOkW5MeUReY1yXj3HjYnafHwdPyCuaAM20i31s9fbSOA2JyEQKePEIKS8QZR2fFi27atGMJ3hVeRK0QJ661zCvQGHyUOEfdraXSLwH7zDHRTYW4Eh1ls50yLsrCaW/oY5GQk28hyujX80IXtP6Zs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1731676393313595.4802251997122; Fri, 15 Nov 2024 05:13:13 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.837570.1253505 (Exim 4.92) (envelope-from ) id 1tBw89-0008EK-Iq; Fri, 15 Nov 2024 13:12:57 +0000 Received: by outflank-mailman (output) from mailman id 837570.1253505; Fri, 15 Nov 2024 13:12:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tBw89-0008ED-G8; Fri, 15 Nov 2024 13:12:57 +0000 Received: by outflank-mailman (input) for mailman id 837570; Fri, 15 Nov 2024 13:12:55 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tBw87-0006v7-CX for xen-devel@lists.xenproject.org; Fri, 15 Nov 2024 13:12:55 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5044f3bd-a353-11ef-99a3-01e77a169b0f; Fri, 15 Nov 2024 14:12:51 +0100 (CET) Received: by mx.zohomail.com with SMTPS id 1731676335598530.5770613675592; Fri, 15 Nov 2024 05:12:15 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5044f3bd-a353-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjEzNi4xNDMuMTg4LjUxIiwiaGVsbyI6InNlbmRlcjQtb2YtbzUxLnpvaG8uY29tIn0= X-Custom-Transaction: eyJpZCI6IjUwNDRmM2JkLWEzNTMtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMxNjc2MzcxLjM4NzQyOCwic2VuZGVyIjoiZHBzbWl0aEBhcGVydHVzc29sdXRpb25zLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 ARC-Seal: i=1; a=rsa-sha256; t=1731676337; cv=none; d=zohomail.com; s=zohoarc; b=YK4fThjfWMkx7UnS7pUTpgrBac5kNQwQjNGa2TF1XEjZ+nApX7OYRt9eiesEiMLHj5N83yJe4uQ4RoK0bAJpWe3i+UGTcqv9zU8bimccWgI2dyeI3Ls1HfN9+njWiZLfseMMdxl0723KgonHV7yXnjZe+o0UVZ1uQPHuMIc+9ng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731676337; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=lC7UJWnbMWc4RpQfKr8UGN6FjxqhttPxoGHw6Bmoiok=; b=fb0a3fpq/S9A5mkGf0IbAbisZfTPWEy692iO8T2NV9tHSU/lciibLl7AwZD5rGoMrNtqZB1glAB3cdeexdMiJAuoP5wznGERktEp17pAJhx2Z8jQZI/uLN22CQELXbkxKgmCH1YHUXToGRtyQ/HIh+yJjPM1FRSEWWNxoeW8a70= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1731676337; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=lC7UJWnbMWc4RpQfKr8UGN6FjxqhttPxoGHw6Bmoiok=; b=QMX62pqmtCSqfZm7BiRT9rNSaXG2tKNRwRpTrdPGbcImjUnl6bhWYfs/tDayC4la yjrMYxDTg5JRvnh8r7GRZfaNO+WM4rSg5ltmb2KkUiflVVxCe9I/D02wzeUNMR2XiZF Cjqv2wVFpU9dVHokHRk4IF4PkhkMGu4sSH2hk2ek= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v9 3/6] x86/boot: add start and size fields to struct boot_module Date: Fri, 15 Nov 2024 08:12:01 -0500 Message-Id: <20241115131204.32135-4-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241115131204.32135-1-dpsmith@apertussolutions.com> References: <20241115131204.32135-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1731676395535116600 Content-Type: text/plain; charset="utf-8" Introduce the start and size fields to struct boot_module and assigns their value during boot_info construction. All uses of module_t to = get the address and size of a module are replaced with start and size. The EFI entry point is a special case, as the EFI file loading boot service= may load a file beyond the 4G barrier. As a result, to make the address fit in = the 32bit integer used by the MB1 module_t structure, the frame number is store= d in mod_start and size in mod_end. Until the EFI entry point is enlightened to = work with boot_info and boot_module, multiboot_fill_boot_info will handle the alternate values in mod_start and mod_end when EFI is detected. A result of the switch to start/size removes all uses of the mod field in struct boot_modules, along with the uses of bootstra_map() and release_modu= le() functions. With all usage gone, they all are dropped here. Signed-off-by: Daniel P. Smith -- Changes since v8: - reversed logic for efi case in multiboot_fill_bootinfo() - corrected missed paddr_to_pfn() Changes since v7: - add the start/size change to bootstrap_map_bm() - convert all BM start/size when introduced, consolidates: x86/boot: populate boot module for xen entry x86/boot: transition relocation calculations to struct boot_module - consolidates all the removal commits Changes since v6: - put the efi conversion for mod_start and mod_end back along with check - dropped unnecessary cast - updated the population of start and size fields to take into account efi Changes since v5: - switched EFI population of mod_start/mod_end to addresses Reviewed-by: Jason Andryuk --- xen/arch/x86/cpu/microcode/core.c | 8 +-- xen/arch/x86/hvm/dom0_build.c | 6 +- xen/arch/x86/include/asm/bootinfo.h | 6 +- xen/arch/x86/include/asm/setup.h | 1 - xen/arch/x86/pv/dom0_build.c | 15 +++-- xen/arch/x86/setup.c | 89 ++++++++++++++--------------- xen/xsm/xsm_policy.c | 2 +- 7 files changed, 60 insertions(+), 67 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index fd4b08b45388..1176d5fbd502 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -709,8 +709,8 @@ static int __init cf_check microcode_init_cache(void) /* early_microcode_load() didn't leave us any work to do. */ return 0; =20 - size =3D bi->mods[early_mod_idx].mod->mod_end; - data =3D __mfn_to_virt(bi->mods[early_mod_idx].mod->mod_start); + size =3D bi->mods[early_mod_idx].size; + data =3D __va(bi->mods[early_mod_idx].start); =20 /* * If opt_scan is set, we're looking for a CPIO archive rather than a = raw @@ -786,7 +786,7 @@ static int __init early_microcode_load(struct boot_info= *bi) bm->type !=3D BOOTMOD_RAMDISK ) continue; =20 - size =3D bm->mod->mod_end; + size =3D bm->size; data =3D bootstrap_map_bm(bm); if ( !data ) { @@ -840,7 +840,7 @@ static int __init early_microcode_load(struct boot_info= *bi) } bi->mods[idx].type =3D BOOTMOD_MICROCODE; =20 - size =3D bi->mods[idx].mod->mod_end; + size =3D bi->mods[idx].size; data =3D bootstrap_map_bm(&bi->mods[idx]); if ( !data ) { diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index d1410e1a02b0..0bd1e4277bff 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -649,8 +649,8 @@ static int __init pvh_load_kernel( { void *image_base =3D bootstrap_map_bm(image); void *image_start =3D image_base + image->headroom; - unsigned long image_len =3D image->mod->mod_end; - unsigned long initrd_len =3D initrd ? initrd->mod->mod_end : 0; + unsigned long image_len =3D image->size; + unsigned long initrd_len =3D initrd ? initrd->size : 0; const char *cmdline =3D __va(image->cmdline_pa); struct elf_binary elf; struct elf_dom_parms parms; @@ -727,7 +727,7 @@ static int __init pvh_load_kernel( if ( initrd !=3D NULL ) { rc =3D hvm_copy_to_guest_phys( - last_addr, mfn_to_virt(initrd->mod->mod_start), initrd_len, v); + last_addr, __va(initrd->start), initrd_len, v); if ( rc ) { printk("Unable to copy initrd to guest\n"); diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index f76876386763..f8b422913063 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -26,9 +26,6 @@ enum bootmod_type { }; =20 struct boot_module { - /* Transitionary only */ - module_t *mod; - enum bootmod_type type; =20 /* @@ -62,6 +59,9 @@ struct boot_module { unsigned long headroom; =20 paddr_t cmdline_pa; + + paddr_t start; + size_t size; }; =20 /* diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index 4ad493637892..5c2391a8684b 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -38,7 +38,6 @@ void free_boot_modules(void); =20 struct boot_module; void *bootstrap_map_bm(const struct boot_module *bm); -void *bootstrap_map(const module_t *mod); void bootstrap_unmap(void); =20 void release_boot_module(struct boot_module *bm); diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index 2580162f3df4..09df12dce694 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -421,7 +421,7 @@ static int __init dom0_construct(struct boot_info *bi, = struct domain *d) =20 image =3D &bi->mods[i]; image_base =3D bootstrap_map_bm(image); - image_len =3D image->mod->mod_end; + image_len =3D image->size; image_start =3D image_base + image->headroom; cmdline =3D __va(image->cmdline_pa); =20 @@ -429,7 +429,7 @@ static int __init dom0_construct(struct boot_info *bi, = struct domain *d) if ( i < bi->nr_modules ) { initrd =3D &bi->mods[i]; - initrd_len =3D initrd->mod->mod_end; + initrd_len =3D initrd->size; } =20 d->max_pages =3D ~0U; @@ -631,7 +631,7 @@ static int __init dom0_construct(struct boot_info *bi, = struct domain *d) initrd_pfn =3D vinitrd_start ? (vinitrd_start - v_start) >> PAGE_SHIFT : domain_tot_pages(d); - initrd_mfn =3D initrd->mod->mod_start; + initrd_mfn =3D paddr_to_pfn(initrd->start); mfn =3D initrd_mfn; count =3D PFN_UP(initrd_len); if ( d->arch.physaddr_bitsize && @@ -647,8 +647,7 @@ static int __init dom0_construct(struct boot_info *bi, = struct domain *d) free_domheap_pages(page, order); page +=3D 1UL << order; } - memcpy(page_to_virt(page), mfn_to_virt(initrd->mod->mod_start), - initrd_len); + memcpy(page_to_virt(page), __va(initrd->start), initrd_len); /* * The initrd was copied but the initrd variable is reused in = the * calculations below. As to not leak the memory used for the @@ -656,7 +655,7 @@ static int __init dom0_construct(struct boot_info *bi, = struct domain *d) */ release_boot_module(initrd); initrd_mfn =3D mfn_x(page_to_mfn(page)); - initrd->mod->mod_start =3D initrd_mfn; + initrd->start =3D pfn_to_paddr(initrd_mfn); } else { @@ -683,7 +682,7 @@ static int __init dom0_construct(struct boot_info *bi, = struct domain *d) nr_pages - domain_tot_pages(d)); if ( initrd ) { - mpt_alloc =3D pfn_to_paddr(initrd->mod->mod_start); + mpt_alloc =3D initrd->start; printk("\n Init. ramdisk: %"PRIpaddr"->%"PRIpaddr, mpt_alloc, mpt_alloc + initrd_len); } @@ -911,7 +910,7 @@ static int __init dom0_construct(struct boot_info *bi, = struct domain *d) if ( pfn >=3D initrd_pfn ) { if ( pfn < initrd_pfn + PFN_UP(initrd_len) ) - mfn =3D initrd->mod->mod_start + (pfn - initrd_pfn); + mfn =3D paddr_to_pfn(initrd->start) + (pfn - initrd_pfn); else mfn -=3D PFN_UP(initrd_len); } diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 0bda1326a485..b4eba122d8a5 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -314,13 +314,29 @@ static struct boot_info *__init multiboot_fill_boot_i= nfo( */ for ( i =3D 0; i < MAX_NR_BOOTMODS && i < bi->nr_modules; i++ ) { - bi->mods[i].mod =3D &mods[i]; - bi->mods[i].cmdline_pa =3D mods[i].string; + + if ( efi_enabled(EFI_LOADER) ) + { + /* + * The EFI loader gives us modules which are in frame/size. Sw= itch + * to address/size. + */ + bi->mods[i].start =3D pfn_to_paddr(mods[i].mod_start); + bi->mods[i].size =3D mods[i].mod_end; + } + else + { + /* + * PVH and BIOS loaders give us modules which are start/end. + * Switch to address/size. + */ + bi->mods[i].start =3D mods[i].mod_start; + bi->mods[i].size =3D mods[i].mod_end - mods[i].mod_start; + } } =20 /* Variable 'i' should be one entry past the last module. */ - bi->mods[i].mod =3D &mods[bi->nr_modules]; bi->mods[i].type =3D BOOTMOD_XEN; =20 return bi; @@ -336,8 +352,8 @@ unsigned long __init initial_images_nrpages(nodeid_t no= de) =20 for ( nr =3D i =3D 0; i < bi->nr_modules; ++i ) { - unsigned long start =3D bi->mods[i].mod->mod_start; - unsigned long end =3D start + PFN_UP(bi->mods[i].mod->mod_end); + unsigned long start =3D paddr_to_pfn(bi->mods[i].start); + unsigned long end =3D start + PFN_UP(bi->mods[i].size); =20 if ( end > node_start && node_end > start ) nr +=3D min(node_end, end) - max(node_start, start); @@ -348,12 +364,9 @@ unsigned long __init initial_images_nrpages(nodeid_t n= ode) =20 void __init release_boot_module(struct boot_module *bm) { - uint64_t start =3D pfn_to_paddr(bm->mod->mod_start); - uint64_t size =3D bm->mod->mod_end; - ASSERT(!bm->released); =20 - init_domheap_pages(start, start + PAGE_ALIGN(size)); + init_domheap_pages(bm->start, bm->start + PAGE_ALIGN(bm->size)); =20 bm->released =3D true; } @@ -485,15 +498,9 @@ static void *__init bootstrap_map_addr(paddr_t start, = paddr_t end) return ret; } =20 -void *__init bootstrap_map(const module_t *mod) -{ - return bootstrap_map_addr(pfn_to_paddr(mod->mod_start), - pfn_to_paddr(mod->mod_start) + mod->mod_end); -} - void *__init bootstrap_map_bm(const struct boot_module *bm) { - return bootstrap_map(bm->mod); + return bootstrap_map_addr(bm->start, bm->start + bm->size); } =20 void __init bootstrap_unmap(void) @@ -671,8 +678,8 @@ static uint64_t __init consider_modules( =20 for ( i =3D 0; i < nr_mods ; ++i ) { - uint64_t start =3D pfn_to_paddr(mods[i].mod->mod_start); - uint64_t end =3D start + PAGE_ALIGN(mods[i].mod->mod_end); + uint64_t start =3D mods[i].start; + uint64_t end =3D start + PAGE_ALIGN(mods[i].size); =20 if ( i =3D=3D this_mod ) continue; @@ -1403,13 +1410,9 @@ void asmlinkage __init noreturn __start_xen(void) set_kexec_crash_area_size((u64)nr_pages << PAGE_SHIFT); kexec_reserve_area(); =20 - for ( i =3D 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ ) - { - if ( bi->mods[i].mod->mod_start & (PAGE_SIZE - 1) ) + for ( i =3D 0; i < bi->nr_modules; i++ ) + if ( bi->mods[i].start & (PAGE_SIZE - 1) ) panic("Bootloader didn't honor module alignment request\n"); - bi->mods[i].mod->mod_end -=3D bi->mods[i].mod->mod_start; - bi->mods[i].mod->mod_start >>=3D PAGE_SHIFT; - } =20 /* * TODO: load ucode earlier once multiboot modules become accessible @@ -1428,13 +1431,12 @@ void asmlinkage __init noreturn __start_xen(void) * respective reserve_e820_ram() invocation below. No need to * query efi_boot_mem_unused() here, though. */ - xen->mod->mod_start =3D virt_to_mfn(_stext); - xen->mod->mod_end =3D __2M_rwdata_end - _stext; + xen->start =3D virt_to_maddr(_stext); + xen->size =3D __2M_rwdata_end - _stext; } =20 bi->mods[0].headroom =3D - bzimage_headroom(bootstrap_map_bm(&bi->mods[0]), - bi->mods[0].mod->mod_end); + bzimage_headroom(bootstrap_map_bm(&bi->mods[0]), bi->mods[0].size); bootstrap_unmap(); =20 #ifndef highmem_start @@ -1515,7 +1517,7 @@ void asmlinkage __init noreturn __start_xen(void) for ( j =3D bi->nr_modules - 1; j >=3D 0; j-- ) { struct boot_module *bm =3D &bi->mods[j]; - unsigned long size =3D PAGE_ALIGN(bm->headroom + bm->mod->mod_= end); + unsigned long size =3D PAGE_ALIGN(bm->headroom + bm->size); =20 if ( bm->relocated ) continue; @@ -1527,14 +1529,11 @@ void asmlinkage __init noreturn __start_xen(void) if ( highmem_start && end > highmem_start ) continue; =20 - if ( s < end && - (bm->headroom || - ((end - size) >> PAGE_SHIFT) > bm->mod->mod_start) ) + if ( s < end && (bm->headroom || (end - size) > bm->start) ) { - move_memory(end - size + bm->headroom, - pfn_to_paddr(bm->mod->mod_start), bm->mod->mod= _end); - bm->mod->mod_start =3D (end - size) >> PAGE_SHIFT; - bm->mod->mod_end +=3D bm->headroom; + move_memory(end - size + bm->headroom, bm->start, bm->size= ); + bm->start =3D (end - size); + bm->size +=3D bm->headroom; bm->relocated =3D true; } } @@ -1565,10 +1564,9 @@ void asmlinkage __init noreturn __start_xen(void) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < bi->nr_modules; ++i ) { - const struct boot_module *bm =3D &bi->mods[i]; - uint64_t s =3D pfn_to_paddr(bm->mod->mod_start); + uint64_t s =3D bi->mods[i].start, l =3D bi->mods[i].size; =20 - reserve_e820_ram(&boot_e820, s, s + PAGE_ALIGN(bm->mod->mod_end)); + reserve_e820_ram(&boot_e820, s, s + PAGE_ALIGN(l)); } =20 if ( !xen_phys_start ) @@ -1646,8 +1644,7 @@ void asmlinkage __init noreturn __start_xen(void) map_e =3D boot_e820.map[j].addr + boot_e820.map[j].size; for ( j =3D 0; j < bi->nr_modules; ++j ) { - uint64_t end =3D pfn_to_paddr(bi->mods[j].mod->mod_sta= rt) + - bi->mods[j].mod->mod_end; + uint64_t end =3D bi->mods[j].start + bi->mods[j].size; =20 if ( map_e < end ) map_e =3D end; @@ -1721,13 +1718,11 @@ void asmlinkage __init noreturn __start_xen(void) =20 for ( i =3D 0; i < bi->nr_modules; ++i ) { - const struct boot_module *bm =3D &bi->mods[i]; + unsigned long s =3D bi->mods[i].start, l =3D bi->mods[i].size; =20 - set_pdx_range(bm->mod->mod_start, - bm->mod->mod_start + PFN_UP(bm->mod->mod_end)); - map_pages_to_xen((unsigned long)mfn_to_virt(bm->mod->mod_start), - _mfn(bm->mod->mod_start), - PFN_UP(bm->mod->mod_end), PAGE_HYPERVISOR); + set_pdx_range(paddr_to_pfn(s), paddr_to_pfn(s + l) + 1); + map_pages_to_xen((unsigned long)maddr_to_virt(s), maddr_to_mfn(s), + PFN_UP(l), PAGE_HYPERVISOR); } =20 #ifdef CONFIG_KEXEC diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index 76280903d5be..7f70d860bd65 100644 --- a/xen/xsm/xsm_policy.c +++ b/xen/xsm/xsm_policy.c @@ -43,7 +43,7 @@ int __init xsm_multiboot_policy_init( struct boot_module *bm =3D &bi->mods[i]; =20 _policy_start =3D bootstrap_map_bm(bm); - _policy_len =3D bm->mod->mod_end; + _policy_len =3D bm->size; =20 if ( (xsm_magic_t)(*_policy_start) =3D=3D XSM_MAGIC ) { --=20 2.30.2