Introducing a common representation of boot info
cover Introducing a common representation of boot info
This series serves as a proposal to arrive at a common, cross-architecture way for boot information to be represented during startup. This proposal is derived from the structures devised to represent hyperlaunch boot information. The hyperlaunch boot information structures themselves were based on the boot info structures used by Arm and dom0less. A significant effort went into ensuring the structures are able to support dom0less as well as hyperlaunch.
Arm and x86 both have arch specific information that must be represented. The approach here sought to support this through arch structures while attempting to maximize what was retained in the common structures. For this series, the focus was on converting x86 over to the new boot info structures.
The motivation for this series is due to the fact that the multiboot v1 structures used by x86 are not sufficient for hyperlaunch. In the previously submited hyperlaunch RFC, this was managed by wrapping the mb structures inside⎄ the hyperlaunch structures. This at best was could be considered crude, but really it was just a hack. One of the goals of hyperlaunch is to unify as much as possible with dom0less to remove any unnecessary duplication. Adopting a common representation for boot information will provide a solid foundation for this unification. The added benefit is that in few places this will enable an unnecessary arch specific version of logic, XSM for example would be able to drop arch specific init functions.
This series being submitted as an RFC due to,
* the number of design decisions being made within the series
* the limited testing able to be completed
* how extensive the changes will be for x86
NB: This series is built on top of the v2 patch series, "xsm: refactor and optimize policy loading".
Daniel P. Smith (4):
kconfig: allow configuration of maximum modules
headers: introduce generalized boot info
x86: adopt new boot info structures
x86: refactor entrypoints to new boot info
xen/arch/Kconfig | 12 ++ xen/arch/arm/include/asm/setup.h | 5 +- xen/arch/x86/boot/boot_info32.h | 81 ++++++++ xen/arch/x86/boot/defs.h | 17 +- xen/arch/x86/boot/reloc.c | 187 +++++++++++------ xen/arch/x86/bzimage.c | 16 +- xen/arch/x86/cpu/microcode/core.c | 134 ++++++++----- xen/arch/x86/dom0_build.c | 13 +- xen/arch/x86/efi/efi-boot.h | 96 +++++---- xen/arch/x86/guest/xen/pvh-boot.c | 58 ++++-- xen/arch/x86/hvm/dom0_build.c | 42 ++-- xen/arch/x86/include/asm/bootinfo.h | 45 +++++ xen/arch/x86/include/asm/bzimage.h | 5 +- xen/arch/x86/include/asm/dom0_build.h | 15 +- xen/arch/x86/include/asm/guest/pvh-boot.h | 6 +- xen/arch/x86/include/asm/setup.h | 14 +- xen/arch/x86/pv/dom0_build.c | 34 ++-- xen/arch/x86/setup.c | 234 ++++++++++++---------- xen/common/efi/boot.c | 4 +- xen/include/xen/bootinfo.h | 101 ++++++++++ xen/include/xsm/xsm.h | 26 ++- xen/xsm/xsm_core.c | 22 +- xen/xsm/xsm_policy.c | 44 ++-- 23 files changed, 804 insertions(+), 407 deletions(-) create mode 100644 xen/arch/x86/boot/boot_info32.h create mode 100644 xen/arch/x86/include/asm/bootinfo.h create mode 100644 xen/include/xen/bootinfo.h
Signature · 1 line
2.20.1
RFC PATCH 4/4 x86: refactor entrypoints to new boot info
This previous commit added a transition point from multiboot v1 structures to the new boot info structures at the earliest common point for all the x86 entrypoints. The result is that each of the entrypoints would construct a multiboot v1 structure from the structures used by each entrypoint. This meant that multiboot2, EFI, and PVH all converted their structures over to mutliboot v1 to only be converted again upon entering __start_xen().
This commit drops the translation function and moves the population of the new boot info structures down into the various entrypoints.
--- xen/arch/x86/boot/boot_info32.h | 81 ++++++++++ xen/arch/x86/boot/defs.h | 17 +- xen/arch/x86/boot/reloc.c | 187 +++++++++++++++------- xen/arch/x86/efi/efi-boot.h | 96 ++++++----- xen/arch/x86/guest/xen/pvh-boot.c | 58 ++++--- xen/arch/x86/include/asm/guest/pvh-boot.h | 6 +- xen/arch/x86/setup.c | 71 +++----- xen/common/efi/boot.c | 4 +- 8 files changed, 342 insertions(+), 178 deletions(-) create mode 100644 xen/arch/x86/boot/boot_info32.h
xen/arch/x86/boot/boot_info32.h new file +81 -0
@@ -0,0 +1,81 @@ +#ifndef __BOOT_INFO32_H__ +#define __BOOT_INFO32_H__ + +#include "defs.h" + +typedef enum { +BOOTMOD_UNKNOWN , +BOOTMOD_XEN , +BOOTMOD_FDT , +BOOTMOD_KERNEL , +BOOTMOD_RAMDISK , +BOOTMOD_XSM , +BOOTMOD_UCODE , +BOOTMOD_GUEST_DTB , +}bootmodule_kind ; + +typedef enum { +BOOTSTR_EMPTY , +BOOTSTR_STRING , +BOOTSTR_CMDLINE , +}bootstring_kind ; + +#define BOOTMOD_MAX_STRING 1024 +struct boot_string { +u32 kind; +u64 arch; + +char bytes[BOOTMOD_MAX_STRING ]; +u64 len; +}; + +struct arch_bootmodule { +bool relocated; +u32 flags; +#define BOOTMOD_FLAG_X86_RELOCATED 1U << 0 +u32 headroom; +}; + +struct boot_module { +u32 kind; +u64 start; +u64 mfn; +u64 size; + +u64 arch; +struct boot_string string; +}; + +struct arch_boot_info { +u32 flags; +#define BOOTINFO_FLAG_X86_MEMLIMITS 1U << 0 +#define BOOTINFO_FLAG_X86_BOOTDEV 1U << 1 +#define BOOTINFO_FLAG_X86_CMDLINE 1U << 2 +#define BOOTINFO_FLAG_X86_MODULES 1U << 3 +#define BOOTINFO_FLAG_X86_AOUT_SYMS 1U << 4 +#define BOOTINFO_FLAG_X86_ELF_SYMS 1U << 5 +#define BOOTINFO_FLAG_X86_MEMMAP 1U << 6 +#define BOOTINFO_FLAG_X86_DRIVES 1U << 7 +#define BOOTINFO_FLAG_X86_BIOSCONFIG 1U << 8 +#define BOOTINFO_FLAG_X86_LOADERNAME 1U << 9 +#define BOOTINFO_FLAG_X86_APM 1U << 10 + +u64 boot_loader_name; + +u32 mem_lower; +u32 mem_upper; + +u32 mmap_length; +u64 mmap_addr; +}; + +struct boot_info { +u64 cmdline; + +u32 nr_mods; +u64 mods; + +u64 arch; +}; + +#endif
xen/arch/x86/boot/defs.h +9 -8
@@ -22,11 +22,11 @@#include "../../../include/xen/stdbool.h" -#define __maybe_unused __attribute__((__unused__)) -#define __packed __attribute__((__packed__)) -#define __stdcall __attribute__((__stdcall__)) +#define __maybe_unused __attribute__((__unused__)) +#define __packed __attribute__((__packed__)) +#define __stdcall __attribute__((__stdcall__)) -#define NULL ((void *)0) +#define NULL ((void *)0)#define ALIGN_UP (arg, align) \ (((arg) + (align) - 1) & ~((typeof(arg))(align) - 1))
@@ -43,9 +43,10 @@ (void ) (&_x == &_y); \ _x > _y ? _x : _y; }) -#define _p (val) ((void *)(unsigned long)(val)) +#define _p (val) ((void *)(unsigned long)(val)) +#define _addr (val) ((unsigned long)(void *)(val)) -#define tolower (c) ((c) | 0x20) +#define tolower (c) ((c) | 0x20)typedef unsigned char u8 ;typedef unsigned short u16 ;
@@ -57,7 +58,7 @@ typedef u16 uint16_t;typedef u32 uint32_t ;typedef u64 uint64_t ; -#define U16_MAX ((u16)(~0U)) -#define UINT_MAX (~0U) +#define U16_MAX ((u16)(~0U)) +#define UINT_MAX (~0U)#endif /* __BOOT_DEFS_H__ */
xen/arch/x86/boot/reloc.c +129 -58
285 lines not on this page · raw message
xen/arch/x86/efi/efi-boot.h +58 -38
160 lines not on this page · raw message
xen/arch/x86/guest/xen/pvh-boot.c +39 -19
104 lines not on this page · raw message
xen/arch/x86/include/asm/guest/pvh-boot.h +3 -3
@@ -19,13 +19,13 @@#ifndef __X86_PVH_BOOT_H__#define __X86_PVH_BOOT_H__ -#include <xen/multiboot.h> +#include <xen/bootinfo.h> #ifdef CONFIG_PVH_GUEST extern bool pvh_boot; -void pvh_init (multiboot_info_t **mbi,module_t **mod); +void __init pvh_init (struct boot_info **bi);void pvh_print_info (void );#else
@@ -34,7 +34,7 @@ void pvh_print_info(void);#define pvh_boot 0 -static inline void pvh_init (multiboot_info_t **mbi,module_t **mod) +static inline void __init pvh_init (struct boot_info **bi) {ASSERT_UNREACHABLE (); }
xen/arch/x86/setup.c +20 -51
105 lines not on this page · raw message
xen/common/efi/boot.c +3 -1
@@ -3,6 +3,7 @@#include <efi/efipciio.h> #include <public/xen.h> #include <xen/bitops.h> +#include <xen/bootinfo.h> #include <xen/compile.h> #include <xen/ctype.h> #include <xen/dmi.h>
@@ -11,7 +12,6 @@#include <xen/keyhandler.h> #include <xen/lib.h> #include <xen/mm.h> -#include <xen/multiboot.h> #include <xen/param.h> #include <xen/pci_regs.h> #include <xen/pfn.h>
@@ -1222,6 +1222,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)efi_arch_relocate_image (0 ); +efi_arch_bootinfo_init (); +if ( use_cfg_file ) {EFI_FILE_HANDLE dir_handle;
Signature · 1 line
2.20.1
RFC PATCH 1/4 kconfig: allow configuration of maximum modules
In reply to Daniel P. SmithFor x86 the number of allowable multiboot modules varies between the different entry points, non-efi boot, pvh boot, and efi boot. In the case of both Arm and x86 this value is fixed to values based on generalized assumptions. With hyperlaunch for x86 and dom0less on Arm, use of static sizes results in large allocations compiled into the hypervisor that will go unused by many use cases.
This commit introduces a Kconfig variable that is set with sane defaults based on configuration selection. This variable is in turned used as the array size for the cases where a static allocated array of boot modules is declared.
--- xen/arch/Kconfig | 12 ++++++++++++ xen/arch/arm/include/asm/setup.h | 5 +++-- xen/arch/x86/efi/efi-boot.h | 2 +- xen/arch/x86/guest/xen/pvh-boot.c | 2 +- xen/arch/x86/setup.c | 4 ++-- 5 files changed, 19 insertions(+), 6 deletions(-)
xen/arch/Kconfig +12 -0
@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading or similar technologies, this the number of logical threads which Xen will support. + +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64 + default "8" if X86 + default "32" if ARM + help + Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen. + + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.
xen/arch/arm/include/asm/setup.h +3 -2
@@ -10,7 +10,8 @@#define NR_MEM_BANKS 256 -#define MAX_MODULES 32/* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODS typedef enum { BOOTMOD_XEN,
@@ -38,7 +39,7 @@ struct meminfo {* The domU flag is set for kernels and ramdisks of "xen,domain" nodes. * The purpose of the domU flag is to avoid getting confused in * kernel_probe, where we try to guess which is the dom0 kernel and -* initrd to be compatible with all versions of the multiboot spec. +* initrd to be compatible with all versions of the multiboot spec. */ #define BOOTMOD_MAX_CMDLINE 1024struct bootmodule {
xen/arch/x86/efi/efi-boot.h +1 -1
@@ -18,7 +18,7 @@ static multiboot_info_t __initdata mbi = {* The array size needs to be one larger than the number of modules we * support - see __start_xen(). */ -static module_t __initdata mb_modules[5 ]; +static module_t __initdata mb_modules[CONFIG_NR_BOOTMODS +1 ];static void __init edd_put_string (u8 *dst,size_t n,const char *src) {
xen/arch/x86/guest/xen/pvh-boot.c +1 -1
@@ -32,7 +32,7 @@ bool __initdata pvh_boot;uint32_t __initdata pvh_start_info_pa;static multiboot_info_t __initdata pvh_mbi; -static module_t __initdata pvh_mbi_mods[8 ]; +static module_t __initdata pvh_mbi_mods[CONFIG_NR_BOOTMOD +1 ];static const char *__initdata pvh_loader ="PVH Directboot" ; static void __init convert_pvh_info(multiboot_info_t **mbi,
xen/arch/x86/setup.c +2 -2
@@ -1017,9 +1017,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)panic ("dom0 kernel not specified. Check bootloader configuration\n" );/* Check that we don't have a silly number of modules. */ -if ( mbi->mods_count >sizeof (module_map) *8 ) +if ( mbi->mods_count >CONFIG_NR_BOOTMODS ) { - mbi->mods_count =sizeof (module_map) *8 ; + mbi->mods_count =CONFIG_NR_BOOTMODS ;printk ("Excessive multiboot modules - using the first %u only\n" , mbi->mods_count); }
Signature · 1 line
2.20.1
RFC PATCH 3/4 x86: adopt new boot info structures
In reply to Daniel P. SmithThis commit replaces the use of the multiboot v1 structures starting at __start_xen(). The majority of this commit is converting the fields being accessed for the startup calculations. While adapting the ucode boot module location logic, this code was refactored to reduce some of the unnecessary complexity.
--- xen/arch/x86/bzimage.c | 16 +- xen/arch/x86/cpu/microcode/core.c | 134 ++++++++------ xen/arch/x86/dom0_build.c | 13 +- xen/arch/x86/hvm/dom0_build.c | 42 ++--- xen/arch/x86/include/asm/bzimage.h | 5 +- xen/arch/x86/include/asm/dom0_build.h | 15 +- xen/arch/x86/include/asm/setup.h | 14 +- xen/arch/x86/pv/dom0_build.c | 34 ++-- xen/arch/x86/setup.c | 249 +++++++++++++++----------- xen/include/xen/bootinfo.h | 47 +++++ xen/include/xsm/xsm.h | 26 ++- xen/xsm/xsm_core.c | 22 ++- xen/xsm/xsm_policy.c | 44 ++--- 13 files changed, 391 insertions(+), 270 deletions(-)
xen/arch/x86/bzimage.c +8 -8
@@ -69,10 +69,8 @@ static __init int bzimage_check(struct setup_header *hdr, unsigned long len)return 1 ; } -static unsigned long __initdata orig_image_len; - -unsigned long __init bzimage_headroom (void *image_start, -unsigned long image_length) +unsigned long __init bzimage_headroom ( +void *image_start,unsigned long image_length) {struct setup_header *hdr = (struct setup_header *)image_start;int err;
@@ -91,7 +89,6 @@ unsigned long __init bzimage_headroom(void *image_start,if (elf_is_elfbinary (image_start, image_length) )return 0 ; - orig_image_len = image_length; headroom =output_length (image_start, image_length);if (gzip_check (image_start, image_length)) {
@@ -104,12 +101,15 @@ unsigned long __init bzimage_headroom(void *image_start,return headroom; } -int __init bzimage_parse (void *image_base,void **image_start, -unsigned long *image_len) +int __init bzimage_parse ( +void *image_base,void **image_start,unsigned int headroom, +unsigned long *image_len) {struct setup_header *hdr = (struct setup_header *)(*image_start);int err =bzimage_check (hdr, *image_len); -unsigned long output_len; +unsigned long output_len, orig_image_len; + + orig_image_len = *image_len - headroom;if ( err <0 )return err;
xen/arch/x86/cpu/microcode/core.c +82 -52
204 lines not on this page · raw message
xen/arch/x86/dom0_build.c +7 -6
@@ -1,9 +1,10 @@/****************************************************************************** * dom0_build.c -* +* * Copyright (c) 2002-2005, K A Fraser */ +#include <xen/bootinfo.h> #include <xen/init.h> #include <xen/iocap.h> #include <xen/libelf.h>
@@ -574,9 +575,9 @@ int __init dom0_setup_permissions(struct domain *d)return rc; } -int __init construct_dom0 (struct domain *d,const module_t *image, -unsigned long image_headroom,module_t *initrd, -char *cmdline) +int __init construct_dom0 ( +struct domain *d,const struct boot_module *image, +struct boot_module *initrd,char *cmdline) {int rc;
@@ -588,9 +589,9 @@ int __init construct_dom0(struct domain *d, const module_t *image,process_pending_softirqs ();if (is_hvm_domain (d) ) - rc =dom0_construct_pvh (d, image, image_headroom, initrd, cmdline); + rc =dom0_construct_pvh (d, image, initrd, cmdline);else if (is_pv_domain (d) ) - rc =dom0_construct_pv (d, image, image_headroom, initrd, cmdline); + rc =dom0_construct_pv (d, image, initrd, cmdline);else panic ("Cannot construct Dom0. No guest interface available\n" );
xen/arch/x86/hvm/dom0_build.c +21 -21
94 lines not on this page · raw message
xen/arch/x86/include/asm/bzimage.h +3 -2
@@ -5,7 +5,8 @@unsigned long bzimage_headroom (void *image_start,unsigned long image_length); -int bzimage_parse (void *image_base,void **image_start, -unsigned long *image_len); +int bzimage_parse ( +void *image_base,void **image_start,unsigned int headroom, +unsigned long *image_len);#endif /* __X86_BZIMAGE_H__ */
xen/arch/x86/include/asm/dom0_build.h +7 -8
@@ -1,6 +1,7 @@#ifndef _DOM0_BUILD_H_#define _DOM0_BUILD_H_ +#include <xen/bootinfo.h> #include <xen/libelf.h> #include <xen/sched.h>
@@ -13,15 +14,13 @@ unsigned long dom0_compute_nr_pages(struct domain *d, unsigned long initrd_len);int dom0_setup_permissions (struct domain *d); -int dom0_construct_pv (struct domain *d,const module_t *image, -unsigned long image_headroom, -module_t *initrd, -char *cmdline); +int __init dom0_construct_pv ( +struct domain *d,const struct boot_module *image, +struct boot_module *initrd,char *cmdline); -int dom0_construct_pvh (struct domain *d,const module_t *image, -unsigned long image_headroom, -module_t *initrd, -char *cmdline); +int __init dom0_construct_pvh ( +struct domain *d,const struct boot_module *image, +struct boot_module *initrd,char *cmdline);unsigned long dom0_paging_pages (const struct domain *d,unsigned long nr_pages);
xen/arch/x86/include/asm/setup.h +6 -8
@@ -1,7 +1,8 @@#ifndef __X86_SETUP_H_#define __X86_SETUP_H_ -#include <xen/multiboot.h> +#include <xen/bootinfo.h> +#include <asm/numa.h> extern const char __2M_text_start[], __2M_text_end[];
@@ -33,20 +34,17 @@ static inline void vesa_init(void) {};#endif int construct_dom0 ( -struct domain *d, -const module_t *kernel,unsigned long kernel_headroom, -module_t *initrd, -char *cmdline); +struct domain *d,const struct boot_module *image, +struct boot_module *initrd,char *cmdline);void setup_io_bitmap (struct domain *d);unsigned long initial_images_nrpages (nodeid_t node);void discard_initial_images (void ); -void *bootstrap_map (const module_t *mod); +void *bootstrap_map (const struct boot_module *mod);int xen_in_range (unsigned long mfn); -void microcode_grab_module ( -unsigned long *,const multiboot_info_t *); +void __init microcode_grab_module (struct boot_info *bi);extern uint8_t kbd_shift_flags;
xen/arch/x86/pv/dom0_build.c +18 -16
@@ -4,6 +4,7 @@* Copyright (c) 2002-2005, K A Fraser */ +#include <xen/bootinfo.h> #include <xen/console.h> #include <xen/domain.h> #include <xen/domain_page.h>
@@ -294,11 +295,9 @@ static struct page_info * __init alloc_chunk(struct domain *d,return page; } -int __init dom0_construct_pv (struct domain *d, -const module_t *image, -unsigned long image_headroom, -module_t *initrd, -char *cmdline) +int __init dom0_construct_pv ( +struct domain *d,const struct boot_module *image, +struct boot_module *initrd,char *cmdline) {int i, rc, order, machine;bool compatible, compat;
@@ -314,9 +313,9 @@ int __init dom0_construct_pv(struct domain *d,start_info_t *si;struct vcpu *v = d->vcpu[0 ];void *image_base =bootstrap_map (image); -unsigned long image_len = image->mod_end; -void *image_start = image_base + image_headroom; -unsigned long initrd_len = initrd ? initrd->mod_end :0 ; +unsigned long image_len = image->size; +void *image_start = image_base + image->arch->headroom; +unsigned long initrd_len = initrd ? initrd->size :0 ;l4_pgentry_t *l4tab =NULL , *l4start =NULL ;l3_pgentry_t *l3tab =NULL , *l3start =NULL ;l2_pgentry_t *l2tab =NULL , *l2start =NULL ;
@@ -355,7 +354,9 @@ int __init dom0_construct_pv(struct domain *d, d->max_pages = ~0U ; -if ( (rc =bzimage_parse (image_base, &image_start, &image_len)) !=0 ) +if ( (rc = +bzimage_parse (image_base, &image_start, image->arch->headroom, + &image_len)) !=0 )return rc;if ( (rc =elf_init (&elf, image_start, image_len)) !=0 )
@@ -544,7 +545,7 @@ int __init dom0_construct_pv(struct domain *d, initrd_pfn = vinitrd_start ? (vinitrd_start - v_start) >>PAGE_SHIFT :domain_tot_pages (d); - initrd_mfn = mfn = initrd->mod_start; + initrd_mfn = mfn =mfn_x (initrd->mfn); count =PFN_UP (initrd_len);if ( d->arch.physaddr_bitsize && ((mfn + count -1 ) >> (d->arch.physaddr_bitsize -PAGE_SHIFT )) )
@@ -559,12 +560,13 @@ int __init dom0_construct_pv(struct domain *d,free_domheap_pages (page, order); page +=1UL << order; } -memcpy (page_to_virt (page),mfn_to_virt (initrd->mod_start), +memcpy (page_to_virt (page),maddr_to_virt (initrd->start), initrd_len); - mpt_alloc = (paddr_t )initrd->mod_start <<PAGE_SHIFT ; + mpt_alloc = initrd->start;init_domheap_pages (mpt_alloc, mpt_alloc +PAGE_ALIGN (initrd_len)); - initrd->mod_start = initrd_mfn =mfn_x (page_to_mfn (page)); +bootmodule_update_mfn (initrd,page_to_mfn (page)); + initrd_mfn =mfn_x (initrd->mfn); }else {
@@ -572,7 +574,7 @@ int __init dom0_construct_pv(struct domain *d,if (assign_pages (mfn_to_page (_mfn (mfn++)),1 , d,0 ) )BUG (); } - initrd->mod_end =0 ; + initrd->size =0 ; } printk("PHYSICAL MEMORY ARRANGEMENT:\n"
@@ -583,7 +585,7 @@ int __init dom0_construct_pv(struct domain *d, nr_pages - domain_tot_pages(d));if ( initrd ) { - mpt_alloc = (paddr_t )initrd->mod_start <<PAGE_SHIFT ; + mpt_alloc = initrd->start;printk ("\n Init. ramdisk: %" PRIpaddr"->%" PRIpaddr, mpt_alloc, mpt_alloc + initrd_len); }
@@ -804,7 +806,7 @@ int __init dom0_construct_pv(struct domain *d,if ( pfn >= initrd_pfn ) {if ( pfn < initrd_pfn +PFN_UP (initrd_len) ) - mfn = initrd->mod_start + (pfn - initrd_pfn); + mfn =mfn_x (initrd->mfn) + (pfn - initrd_pfn);else mfn -=PFN_UP (initrd_len); }
xen/arch/x86/setup.c +149 -100
493 lines not on this page · raw message
xen/include/xen/bootinfo.h +47 -0
51 lines not on this page · raw message
xen/include/xsm/xsm.h +12 -14
@@ -16,8 +16,8 @@#define __XSM_H__#include <xen/alternative-call.h> +#include <xen/bootinfo.h> #include <xen/sched.h> -#include <xen/multiboot.h> /* policy magic number (defined by XSM_MAGIC) */ typedef uint32_t xsm_magic_t ;
@@ -770,15 +770,14 @@ static inline int xsm_argo_send(const struct domain *d, const struct domain *t)#endif /* XSM_NO_WRAPPERS */ -#ifdef CONFIG_MULTIBOOT -int xsm_multiboot_init ( -unsigned long *module_map,const multiboot_info_t *mbi); -int xsm_multiboot_policy_init ( -unsigned long *module_map,const multiboot_info_t *mbi, -const unsigned char *policy_buffer[],size_t *policy_size); -#endif +#ifndef CONFIG_HAS_DEVICE_TREE +int xsm_bootmodule_init (const struct boot_info *bi); +int xsm_bootmodule_policy_init ( +const struct boot_info *bi,const unsigned char *policy_buffer[], +size_t *policy_size); + +#else -#ifdef CONFIG_HAS_DEVICE_TREE /* * Initialize XSM *
@@ -820,15 +819,14 @@ static const inline struct xsm_ops *silo_init(void)#include <xsm/dummy.h> -#ifdef CONFIG_MULTIBOOT -static inline int xsm_multiboot_init ( -unsigned long *module_map,const multiboot_info_t *mbi) +#ifndef CONFIG_HAS_DEVICE_TREE +static inline int xsm_bootmodule_init (const struct boot_info *bi) {return 0 ; } -#endif -#ifdef CONFIG_HAS_DEVICE_TREE +#else +static inline int xsm_dt_init (void ) {return 0 ;
xen/xsm/xsm_core.c +13 -9
@@ -10,6 +10,7 @@* as published by the Free Software Foundation. */ +#include <xen/bootinfo.h> #include <xen/errno.h> #include <xen/hypercall.h> #include <xen/init.h>
@@ -136,9 +137,13 @@ static int __init xsm_core_init(const void *policy_buffer, size_t policy_size)return 0 ; } -#ifdef CONFIG_MULTIBOOT -int __init xsm_multiboot_init ( -unsigned long *module_map,const multiboot_info_t *mbi) +/* +* ifdef'ing this against multiboot is no longer valid as the boot module +* is agnostic and it will be possible to dropped the ifndef should Arm +* adopt boot info +*/ +#ifndef CONFIG_HAS_DEVICE_TREE +int __init xsm_bootmodule_init (const struct boot_info *bi) {int ret =0 ;const unsigned char *policy_buffer;
@@ -148,8 +153,7 @@ int __init xsm_multiboot_init(if ( policy_file_required &&XSM_MAGIC ) { - ret =xsm_multiboot_policy_init (module_map, mbi, &policy_buffer, - &policy_size); + ret =xsm_bootmodule_policy_init (bi, &policy_buffer, &policy_size);if ( ret ) {bootstrap_map (NULL );
@@ -162,9 +166,9 @@ int __init xsm_multiboot_init( return 0; } -#endif -#ifdef CONFIG_HAS_DEVICE_TREE +#else +int __init xsm_dt_init (void ) {int ret =0 ;
@@ -215,9 +219,9 @@ bool __init has_xsm_magic(paddr_t start)return false; } -#endif +#endif /* CONFIG_HAS_DEVICE_TREE */ -#endif +#endif /* CONFIG_XSM */ long cf_check do_xsm_op (XEN_GUEST_HANDLE_PARAM (void ) op) {
xen/xsm/xsm_policy.c +18 -26
81 lines not on this page · raw message
Signature · 1 line
2.20.1
RFC PATCH 2/4 headers: introduce generalized boot info
In reply to Daniel P. SmithThe x86 and Arm architectures represent in memory the general boot information and boot modules differently despite having commonality. The x86 representations are bound to the multiboot v1 structures while the Arm representations are a slightly generalized meta-data container for the boot material. The multiboot structure does not lend itself well to being expanded to accommodate additional metadata, both general and boot module specific. The Arm structures are not bound to an external specification and thus are able to be expanded for solutions such as dom0less.
This commit introduces a set of structures patterned off the Arm structures to represent the boot information in a manner that captures common data. The structures provide an arch field to allow arch specific expansions to the structures. The intended goal of these new common structures is to enable commonality between the different architectures. Specifically to enable dom0less and hyperlaunch to have a common representation of boot-time constructed domains.
--- xen/arch/x86/include/asm/bootinfo.h | 45 ++++++++++++++++++++++++ xen/include/xen/bootinfo.h | 54 +++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 xen/arch/x86/include/asm/bootinfo.h create mode 100644 xen/include/xen/bootinfo.h
xen/arch/x86/include/asm/bootinfo.h new file +45 -0
@@ -0,0 +1,45 @@ +#ifndef __ARCH_X86_BOOTINFO_H__ +#define __ARCH_X86_BOOTINFO_H__ + +/* unused for x86 */ +struct arch_bootstring { }; + +struct __packed arch_bootmodule { +#define BOOTMOD_FLAG_X86_RELOCATED 1U << 0 +uint32_t flags; +uint32_t headroom; +}; + +struct __packed arch_boot_info { +uint32_t flags; +#define BOOTINFO_FLAG_X86_MEMLIMITS 1U << 0 +#define BOOTINFO_FLAG_X86_BOOTDEV 1U << 1 +#define BOOTINFO_FLAG_X86_CMDLINE 1U << 2 +#define BOOTINFO_FLAG_X86_MODULES 1U << 3 +#define BOOTINFO_FLAG_X86_AOUT_SYMS 1U << 4 +#define BOOTINFO_FLAG_X86_ELF_SYMS 1U << 5 +#define BOOTINFO_FLAG_X86_MEMMAP 1U << 6 +#define BOOTINFO_FLAG_X86_DRIVES 1U << 7 +#define BOOTINFO_FLAG_X86_BIOSCONFIG 1U << 8 +#define BOOTINFO_FLAG_X86_LOADERNAME 1U << 9 +#define BOOTINFO_FLAG_X86_APM 1U << 10 + +char *boot_loader_name; + +uint32_t mem_lower; +uint32_t mem_upper; + +uint32_t mmap_length; +paddr_t mmap_addr; +}; + +struct __packed mb_memmap { +uint32_t size; +uint32_t base_addr_low; +uint32_t base_addr_high; +uint32_t length_low; +uint32_t length_high; +uint32_t type; +}; + +#endif
xen/include/xen/bootinfo.h new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Daniel P. SmithHi Daniel,
Quoted 56 lines · Daniel P. Smith
For x86 the number of allowable multiboot modules varies between the different entry points, non-efi boot, pvh boot, and efi boot. In the case of both Arm and x86 this value is fixed to values based on generalized assumptions. With hyperlaunch for x86 and dom0less on Arm, use of static sizes results in large allocations compiled into the hypervisor that will go unused by many use cases.
This commit introduces a
Kconfigvariable that is set with sane defaults based on configuration selection. This variable is in turned used as the array size for the cases where a static allocated array of boot modules is declared.Signed-off-by Daniel P. Smith <[email protected]>---
xen/arch/Kconfig | 12 ++++++++++++ xen/arch/arm/include/asm/setup.h | 5 +++-- xen/arch/x86/efi/efi-boot.h | 2 +- xen/arch/x86/guest/xen/pvh-boot.c | 2 +- xen/arch/x86/setup.c | 4 ++-- 5 files changed, 19 insertions(+), 6 deletions(-)xen/arch/Kconfig +12
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading or similar technologies, this the number of logical threads which Xen will support. + +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64 + default "8" if X86 + default "32" if ARM + help + Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen. + + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +2
-1@@ -10,7 +10,8 @@#define NR_MEM_BANKS 256 -#define MAX_MODULES 32/* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODS typedef enum { BOOTMOD_XEN,
xen/arch/arm/include/asm/setup.h struct meminfo { · line 42
Quoted 5 lines
xen/arch/arm/include/asm/setup.h +1
-1@@ -38,7 +39,7 @@ struct meminfo {* The domU flag is set for kernels and ramdisks of "xen,domain" nodes. * The purpose of the domU flag is to avoid getting confused in * kernel_probe, where we try to guess which is the dom0 kernel and -* initrd to be compatible with all versions of the multiboot spec. +* initrd to be compatible with all versions of the multiboot spec.
This seems to be a spurious change.
With that fixed, for the arm part:
Cheers
Bertrand
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Daniel P. SmithHi,
xen/arch/Kconfig config NR_CPUS · line 23
Quoted 12 lines · Daniel P. Smith
xen/arch/Kconfig +4
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading or similar technologies, this the number of logical threads which Xen will support. + +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64
OOI, any reason to limit the size?
Quoted 13 lines
xen/arch/Kconfig +8
-0+ default "8" if X86 + default "32" if ARM + help + Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen. + + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +0
-0
xen/arch/arm/include/asm/setup.h line 14
Quoted 6 lines
xen/arch/arm/include/asm/setup.h +2
-1@@ -10,7 +10,8 @@#define NR_MEM_BANKS 256 -#define MAX_MODULES 32/* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODS
There are only a handful number of use of MAX_MODULES in Arm. So I would prefer if we replace all the use with CONFIG_NR_BOOTMODS.
Cheers,
Signature · 1 line
Julien Grall
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Bertrand MarquisQuoted 1 line · Bertrand Marquis
Hi Daniel,
Greetings Bertrand.
Quoted 53 lines
Quoted 53 lines · Daniel P. Smith
For x86 the number of allowable multiboot modules varies between the different entry points, non-efi boot, pvh boot, and efi boot. In the case of both Arm and x86 this value is fixed to values based on generalized assumptions. With hyperlaunch for x86 and dom0less on Arm, use of static sizes results in large allocations compiled into the hypervisor that will go unused by many use cases.
This commit introduces a
Kconfigvariable that is set with sane defaults based on configuration selection. This variable is in turned used as the array size for the cases where a static allocated array of boot modules is declared.Signed-off-by Daniel P. Smith <[email protected]>---
xen/arch/Kconfig | 12 ++++++++++++ xen/arch/arm/include/asm/setup.h | 5 +++-- xen/arch/x86/efi/efi-boot.h | 2 +- xen/arch/x86/guest/xen/pvh-boot.c | 2 +- xen/arch/x86/setup.c | 4 ++-- 5 files changed, 19 insertions(+), 6 deletions(-)xen/arch/Kconfig +12
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading or similar technologies, this the number of logical threads which Xen will support. + +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64 + default "8" if X86 + default "32" if ARM + help + Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen. + + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +2
-1@@ -10,7 +10,8 @@#define NR_MEM_BANKS 256 -#define MAX_MODULES 32/* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODS
Quoted 10 lines
xen/arch/arm/include/asm/setup.h struct meminfo { · line 42
Quoted 8 lines
xen/arch/arm/include/asm/setup.h +1
-1typedef enum { BOOTMOD_XEN,@@ -38,7 +39,7 @@ struct meminfo {* The domU flag is set for kernels and ramdisks of "xen,domain" nodes. * The purpose of the domU flag is to avoid getting confused in * kernel_probe, where we try to guess which is the dom0 kernel and -* initrd to be compatible with all versions of the multiboot spec. +* initrd to be compatible with all versions of the multiboot spec. This seems to be a spurious change.
I have been trying to clean up trailing white space when I see it nearby. I can drop this one if that is desired.
Quoted 2 lines
With that fixed, for the arm part:
Reviewed-by Bertrand Marquis <[email protected]>
Thank you, will add it in when I respin it for submission.
v/r,
dps
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
Hi Daniel,
Quoted 71 lines · Daniel P. Smith
Quoted 1 line · Bertrand Marquis
Hi Daniel,
Greetings Bertrand.
Quoted 53 lines
Quoted 53 lines · Daniel P. Smith
For x86 the number of allowable multiboot modules varies between the different entry points, non-efi boot, pvh boot, and efi boot. In the case of both Arm and x86 this value is fixed to values based on generalized assumptions. With hyperlaunch for x86 and dom0less on Arm, use of static sizes results in large allocations compiled into the hypervisor that will go unused by many use cases.
This commit introduces a
Kconfigvariable that is set with sane defaults based on configuration selection. This variable is in turned used as the array size for the cases where a static allocated array of boot modules is declared.Signed-off-by Daniel P. Smith <[email protected]>---
xen/arch/Kconfig | 12 ++++++++++++xen/arch/arm/include/asm/setup.h| 5 +++--xen/arch/x86/efi/efi-boot.h| 2 +-xen/arch/x86/guest/xen/pvh-boot.c| 2 +-xen/arch/x86/setup.c| 4 ++--5 files changed, 19 insertions(+), 6 deletions(-)xen/arch/Kconfig +12
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading or similar technologies, this the number of logical threads which Xen will support. + +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64 + default "8" if X86 + default "32" if ARM + help + Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen. + + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +2
-1@@ -10,7 +10,8 @@#define NR_MEM_BANKS 256 -#define MAX_MODULES 32/* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODSQuoted 10 lines
xen/arch/arm/include/asm/setup.h struct meminfo { · line 42
Quoted 8 lines
xen/arch/arm/include/asm/setup.h +1
-1typedef enum { BOOTMOD_XEN,@@ -38,7 +39,7 @@ struct meminfo {* The domU flag is set for kernels and ramdisks of "xen,domain" nodes. * The purpose of the domU flag is to avoid getting confused in * kernel_probe, where we try to guess which is the dom0 kernel and -* initrd to be compatible with all versions of the multiboot spec. +* initrd to be compatible with all versions of the multiboot spec. This seems to be a spurious change.
Quoted 2 lines
I have been trying to clean up trailing white space when I see it nearby. I can drop this one if that is desired.
If this is wanted this is ok, just mention it in the commit message so that we know it was on purpose.
Quoted 5 lines
Quoted 3 lines
With that fixed, for the arm part:
Reviewed-by Bertrand Marquis <[email protected]>Thank you, will add it in when I respin it for submission.
Cheers
Bertrand
Quoted 3 lines
v/r,
dps
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Julien GrallQuoted 18 lines · Julien Grall
Hi,
xen/arch/Kconfig config NR_CPUS · line 23
Quoted 13 lines · Daniel P. Smith
xen/arch/Kconfig +0
-0@@ -17,3 +17,15 @@ config NR_CPUSFor CPU cores which support Simultaneous Multi-Threading or similar
technologies, this the number of logical threads which Xen will support.xen/arch/Kconfig +4
-0+ +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64OOI, any reason to limit the size?
I modelled this entirely after NR_CPUS, which applied a limit, and it seemed reasonable to me at the time. I choose 64 since it was double currently what Arm had set for MAX_MODULES. As such, I have no hard reason for there to be a limit. It can easily be removed or adjusted to whatever the reviewers feel would be appropriate.
Quoted 13 lines
Quoted 13 lines
+ default "8" if X86
+ default "32" if ARM
+ help
+ Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen.xen/arch/Kconfig +3
-0+ + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +0
-0
Quoted 8 lines
xen/arch/arm/include/asm/setup.h line 14
Quoted 5 lines
xen/arch/arm/include/asm/setup.h +0
-0@@ -10,7 +10,8 @@ #define NR_MEM_BANKS 256-#define
MAX_MODULES32 /* Current maximum useful modules */xen/arch/arm/include/asm/setup.h +2
-0+/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODSThere are only a handful number of use of
MAX_MODULESin Arm. So I would prefer if we replace all the use withCONFIG_NR_BOOTMODS.
No problem, as I stated above, I mimicked what was done for NR_CPUS which did a similar #define for MAX_CPUS.
v/r,
dps
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Bertrand MarquisQuoted 73 lines · Bertrand Marquis
Hi Daniel,
Quoted 71 lines · Daniel P. Smith
Quoted 1 line · Bertrand Marquis
Hi Daniel,
Greetings Bertrand.
Quoted 63 lines
Quoted 56 lines · Daniel P. Smith
For x86 the number of allowable multiboot modules varies between the different entry points, non-efi boot, pvh boot, and efi boot. In the case of both Arm and x86 this value is fixed to values based on generalized assumptions. With hyperlaunch for x86 and dom0less on Arm, use of static sizes results in large allocations compiled into the hypervisor that will go unused by many use cases.
This commit introduces a
Kconfigvariable that is set with sane defaults based on configuration selection. This variable is in turned used as the array size for the cases where a static allocated array of boot modules is declared.Signed-off-by Daniel P. Smith <[email protected]>---
xen/arch/Kconfig | 12 ++++++++++++xen/arch/arm/include/asm/setup.h| 5 +++--xen/arch/x86/efi/efi-boot.h| 2 +-xen/arch/x86/guest/xen/pvh-boot.c| 2 +-xen/arch/x86/setup.c| 4 ++--5 files changed, 19 insertions(+), 6 deletions(-)xen/arch/Kconfig +12
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading or similar technologies, this the number of logical threads which Xen will support. + +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64 + default "8" if X86 + default "32" if ARM + help + Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen. + + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +2
-1@@ -10,7 +10,8 @@#define NR_MEM_BANKS 256 -#define MAX_MODULES 32/* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODS typedef enum { BOOTMOD_XEN,xen/arch/arm/include/asm/setup.h struct meminfo { · line 42
Quoted 5 lines
xen/arch/arm/include/asm/setup.h +1
-1@@ -38,7 +39,7 @@ struct meminfo {* The domU flag is set for kernels and ramdisks of "xen,domain" nodes. * The purpose of the domU flag is to avoid getting confused in * kernel_probe, where we try to guess which is the dom0 kernel and -* initrd to be compatible with all versions of the multiboot spec. +* initrd to be compatible with all versions of the multiboot spec. This seems to be a spurious change.
Quoted 4 lines
Quoted 2 lines
I have been trying to clean up trailing white space when I see it nearby. I can drop this one if that is desired.
If this is wanted this is ok, just mention it in the commit message so that we know it was on purpose.
Understood, I will update the commit message on this one and the others where there is done.
Quoted 13 lines
Quoted 5 lines
Quoted 3 lines
With that fixed, for the arm part:
Reviewed-by Bertrand Marquis <[email protected]>Thank you, will add it in when I respin it for submission.
Cheers
BertrandQuoted 3 lines
v/r,
dps
v/r,
dps
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Daniel P. SmithQuoted 69 lines · Daniel P. Smith
Quoted 1 line · Bertrand Marquis
Hi Daniel,
Greetings Bertrand.
Quoted 53 lines
Quoted 53 lines · Daniel P. Smith
For x86 the number of allowable multiboot modules varies between the different entry points, non-efi boot, pvh boot, and efi boot. In the case of both Arm and x86 this value is fixed to values based on generalized assumptions. With hyperlaunch for x86 and dom0less on Arm, use of static sizes results in large allocations compiled into the hypervisor that will go unused by many use cases.
This commit introduces a
Kconfigvariable that is set with sane defaults based on configuration selection. This variable is in turned used as the array size for the cases where a static allocated array of boot modules is declared.Signed-off-by Daniel P. Smith <[email protected]>---
xen/arch/Kconfig | 12 ++++++++++++ xen/arch/arm/include/asm/setup.h | 5 +++-- xen/arch/x86/efi/efi-boot.h | 2 +- xen/arch/x86/guest/xen/pvh-boot.c | 2 +- xen/arch/x86/setup.c | 4 ++-- 5 files changed, 19 insertions(+), 6 deletions(-)xen/arch/Kconfig +12
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading or similar technologies, this the number of logical threads which Xen will support. + +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64 + default "8" if X86 + default "32" if ARM + help + Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen. + + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +2
-1@@ -10,7 +10,8 @@#define NR_MEM_BANKS 256 -#define MAX_MODULES 32/* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODSQuoted 10 lines
xen/arch/arm/include/asm/setup.h struct meminfo { · line 42
Quoted 8 lines
xen/arch/arm/include/asm/setup.h +1
-1typedef enum { BOOTMOD_XEN,@@ -38,7 +39,7 @@ struct meminfo {* The domU flag is set for kernels and ramdisks of "xen,domain" nodes. * The purpose of the domU flag is to avoid getting confused in * kernel_probe, where we try to guess which is the dom0 kernel and -* initrd to be compatible with all versions of the multiboot spec. +* initrd to be compatible with all versions of the multiboot spec. This seems to be a spurious change.
Quoted 2 lines
I have been trying to clean up trailing white space when I see it nearby. I can drop this one if that is desired.
IMO it's best if such white space removal is only done when already modifying the line, or else it makes it harder to track changes when using git blame for example (not likely in this case since it's a multi line comment).
Thanks, Roger.
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
Quoted 70 lines · Roger Pau Monné
Quoted 69 lines · Daniel P. Smith
Quoted 1 line · Bertrand Marquis
Hi Daniel,
Greetings Bertrand.
Quoted 63 lines
Quoted 56 lines · Daniel P. Smith
For x86 the number of allowable multiboot modules varies between the different entry points, non-efi boot, pvh boot, and efi boot. In the case of both Arm and x86 this value is fixed to values based on generalized assumptions. With hyperlaunch for x86 and dom0less on Arm, use of static sizes results in large allocations compiled into the hypervisor that will go unused by many use cases.
This commit introduces a
Kconfigvariable that is set with sane defaults based on configuration selection. This variable is in turned used as the array size for the cases where a static allocated array of boot modules is declared.Signed-off-by Daniel P. Smith <[email protected]>---
xen/arch/Kconfig | 12 ++++++++++++ xen/arch/arm/include/asm/setup.h | 5 +++-- xen/arch/x86/efi/efi-boot.h | 2 +- xen/arch/x86/guest/xen/pvh-boot.c | 2 +- xen/arch/x86/setup.c | 4 ++-- 5 files changed, 19 insertions(+), 6 deletions(-)xen/arch/Kconfig +12
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading or similar technologies, this the number of logical threads which Xen will support. + +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64 + default "8" if X86 + default "32" if ARM + help + Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen. + + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +2
-1@@ -10,7 +10,8 @@#define NR_MEM_BANKS 256 -#define MAX_MODULES 32/* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODS typedef enum { BOOTMOD_XEN,xen/arch/arm/include/asm/setup.h struct meminfo { · line 42
Quoted 5 lines
xen/arch/arm/include/asm/setup.h +1
-1@@ -38,7 +39,7 @@ struct meminfo {* The domU flag is set for kernels and ramdisks of "xen,domain" nodes. * The purpose of the domU flag is to avoid getting confused in * kernel_probe, where we try to guess which is the dom0 kernel and -* initrd to be compatible with all versions of the multiboot spec. +* initrd to be compatible with all versions of the multiboot spec. This seems to be a spurious change.
Quoted 7 lines
Quoted 2 lines
I have been trying to clean up trailing white space when I see it nearby. I can drop this one if that is desired.
IMO it's best if such white space removal is only done when already modifying the line, or else it makes it harder to track changes when using
git blamefor example (not likely in this case since it's a multi line comment).
+1
Jan
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Roger Pau MonnéQuoted 74 lines · Roger Pau Monne
Quoted 69 lines · Daniel P. Smith
Quoted 1 line · Bertrand Marquis
Hi Daniel,
Greetings Bertrand.
Quoted 63 lines
Quoted 56 lines · Daniel P. Smith
For x86 the number of allowable multiboot modules varies between the different entry points, non-efi boot, pvh boot, and efi boot. In the case of both Arm and x86 this value is fixed to values based on generalized assumptions. With hyperlaunch for x86 and dom0less on Arm, use of static sizes results in large allocations compiled into the hypervisor that will go unused by many use cases.
This commit introduces a
Kconfigvariable that is set with sane defaults based on configuration selection. This variable is in turned used as the array size for the cases where a static allocated array of boot modules is declared.Signed-off-by Daniel P. Smith <[email protected]>---
xen/arch/Kconfig | 12 ++++++++++++xen/arch/arm/include/asm/setup.h| 5 +++--xen/arch/x86/efi/efi-boot.h| 2 +-xen/arch/x86/guest/xen/pvh-boot.c| 2 +-xen/arch/x86/setup.c| 4 ++--5 files changed, 19 insertions(+), 6 deletions(-)xen/arch/Kconfig +12
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading or similar technologies, this the number of logical threads which Xen will support. + +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64 + default "8" if X86 + default "32" if ARM + help + Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen. + + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +2
-1@@ -10,7 +10,8 @@#define NR_MEM_BANKS 256 -#define MAX_MODULES 32/* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODS typedef enum { BOOTMOD_XEN,xen/arch/arm/include/asm/setup.h struct meminfo { · line 42
Quoted 5 lines
xen/arch/arm/include/asm/setup.h +1
-1@@ -38,7 +39,7 @@ struct meminfo {* The domU flag is set for kernels and ramdisks of "xen,domain" nodes. * The purpose of the domU flag is to avoid getting confused in * kernel_probe, where we try to guess which is the dom0 kernel and -* initrd to be compatible with all versions of the multiboot spec. +* initrd to be compatible with all versions of the multiboot spec. This seems to be a spurious change.
Quoted 7 lines
Quoted 2 lines
I have been trying to clean up trailing white space when I see it nearby. I can drop this one if that is desired.
IMO it's best if such white space removal is only done when already modifying the line, or else it makes it harder to track changes when using
git blamefor example (not likely in this case since it's a multi line comment).
The down side of this is that you can’t use “automatically remove trailing whitespace on save” features of some editors.
Without such automation, I introduce loads of trailing whitespace. With such automation, I end up removing random trailing whitespace as I happen to touch files. I’ve always done this by just adding “While here, remove some trailing whitespace” to the commit message, and there haven’t been any complaints.
If we actually care about trailing whitespace, then I think we should accept random fix-ups as files are touched. OTOH if we want to avoid random fix-ups, we should remove the aversion to trailing whitespace.
-George
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
Quoted 77 lines · George Dunlap
Quoted 77 lines · Roger Pau Monne
Quoted 71 lines · Daniel P. Smith
Quoted 1 line · Bertrand Marquis
Hi Daniel,
Greetings Bertrand.
Quoted 53 lines
Quoted 53 lines · Daniel P. Smith
For x86 the number of allowable multiboot modules varies between the different entry points, non-efi boot, pvh boot, and efi boot. In the case of both Arm and x86 this value is fixed to values based on generalized assumptions. With hyperlaunch for x86 and dom0less on Arm, use of static sizes results in large allocations compiled into the hypervisor that will go unused by many use cases.
This commit introduces a
Kconfigvariable that is set with sane defaults based on configuration selection. This variable is in turned used as the array size for the cases where a static allocated array of boot modules is declared.Signed-off-by Daniel P. Smith <[email protected]>---
xen/arch/Kconfig | 12 ++++++++++++xen/arch/arm/include/asm/setup.h| 5 +++--xen/arch/x86/efi/efi-boot.h| 2 +-xen/arch/x86/guest/xen/pvh-boot.c| 2 +-xen/arch/x86/setup.c| 4 ++--5 files changed, 19 insertions(+), 6 deletions(-)xen/arch/Kconfig +12
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading or similar technologies, this the number of logical threads which Xen will support. + +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64 + default "8" if X86 + default "32" if ARM + help + Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen. + + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +2
-1@@ -10,7 +10,8 @@#define NR_MEM_BANKS 256 -#define MAX_MODULES 32/* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODSQuoted 10 lines
xen/arch/arm/include/asm/setup.h struct meminfo { · line 42
Quoted 8 lines
xen/arch/arm/include/asm/setup.h +1
-1typedef enum { BOOTMOD_XEN,@@ -38,7 +39,7 @@ struct meminfo {* The domU flag is set for kernels and ramdisks of "xen,domain" nodes. * The purpose of the domU flag is to avoid getting confused in * kernel_probe, where we try to guess which is the dom0 kernel and -* initrd to be compatible with all versions of the multiboot spec. +* initrd to be compatible with all versions of the multiboot spec. This seems to be a spurious change.
I have been trying to clean up trailing white space when I see it nearby. I can drop this one if that is desired.
Quoted 8 lines
Quoted 4 lines
IMO it's best if such white space removal is only done when already modifying the line, or else it makes it harder to track changes when using
git blamefor example (not likely in this case since it's a multi line comment).The down side of this is that you can’t use “automatically remove trailing whitespace on save” features of some editors.
Without such automation, I introduce loads of trailing whitespace. With such automation, I end up removing random trailing whitespace as I happen to touch files. I’ve always done this by just adding “While here, remove some trailing whitespace” to the commit message, and there haven’t been any complaints.
FWIW, I have an editor feature that highlights trailing whitespace, but doesn't remove it.
As said, I find it cumbersome to have to go through more jumps while using git blame or similar, just because of unrelated cleanups.
IMO I don't think it's good practice to wholesale replace all trailing whitespace from a file as part of an unrelated change. If people do think this is fine I'm OK with it, but it's not my preference. Just raised this because such changes make it harder to use git blame IMO (have to remember to use -w, but that won't help people using the web interface for example).
Thanks, Roger.
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Daniel P. SmithQuoted 20 lines · Daniel P. Smith
Quoted 18 lines · Julien Grall
Hi,
xen/arch/Kconfig config NR_CPUS · line 23
Quoted 13 lines · Daniel P. Smith
xen/arch/Kconfig +0
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading orsimilar
technologies, this the number of logical threads which Xen will support.xen/arch/Kconfig +4
-0+ +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64OOI, any reason to limit the size?
Quoted 1 line
I modelled this entirely after
NR_CPUS, which applied a limit
The limit for NR_CPUS makes sense because there are scalability issues after that (although 4095 seems quite high) and/or the HW impose a limit.
Quoted 5 lines
, and it
seemed reasonable to me at the time. I choose 64 since it was double currently what Arm had set forMAX_MODULES. As such, I have no hard reason for there to be a limit. It can easily be removed or adjusted to whatever the reviewers feel would be appropriate.
Ok. In which case I would drop the limit beause it also prevent a users to create more 64 dom0less domUs (actually a bit less because some modules are used by Xen). I don't think there are a strong reason to prevent that, right?
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
+ default "8" if X86
+ default "32" if ARM
+ help
+ Controls the build-time size of various arrays allocated for + parsing the boot modules passed by a loader when starting Xen.xen/arch/Kconfig +3
-0+ + This is of particular interest when using Xen's hypervisor domain + capabilities such as dom0less.xen/arch/arm/include/asm/setup.h +0
-0Quoted 8 lines
xen/arch/arm/include/asm/setup.h line 13
Quoted 5 lines
xen/arch/arm/include/asm/setup.h +2
-0@@ -10,7 +10,8 @@ #define NR_MEM_BANKS 256 -#define MAX_MODULES 32 /* Current maximum useful modules */ +/* Current maximum useful modules */ +#define MAX_MODULES CONFIG_NR_BOOTMODSThere are only a handful number of use of
MAX_MODULESin Arm. So I would prefer if we replace all the use withCONFIG_NR_BOOTMODS.
Quoted 2 lines
No problem, as I stated above, I mimicked what was done for
NR_CPUSwhich did a similar #define forMAX_CPUS.
Thanks!
Cheers,
Signature · 1 line
Julien Grall
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
Quoted 23 lines · Julien Grall
Quoted 20 lines · Daniel P. Smith
Quoted 18 lines · Julien Grall
Hi,
xen/arch/Kconfig config NR_CPUS · line 23
Quoted 13 lines · Daniel P. Smith
xen/arch/Kconfig +0
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading orsimilar
technologies, this the number of logical threads which Xen will support.xen/arch/Kconfig +4
-0+ +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64OOI, any reason to limit the size?
Quoted 4 lines
Quoted 1 line
I modelled this entirely after
NR_CPUS, which applied a limitThe limit for
NR_CPUSmakes sense because there are scalability issues after that (although 4095 seems quite high) and/or the HW impose a limit.
The 4095 is actually a software limit (due to how spinlocks are implemented).
Quoted 10 lines
Quoted 5 lines
, and it
seemed reasonable to me at the time. I choose 64 since it was double currently what Arm had set forMAX_MODULES. As such, I have no hard reason for there to be a limit. It can easily be removed or adjusted to whatever the reviewers feel would be appropriate.Ok. In which case I would drop the limit beause it also prevent a users to create more 64 dom0less domUs (actually a bit less because some modules are used by Xen). I don't think there are a strong reason to prevent that, right?
At least as per the kconfig language doc the upper bound is not optional, so if a range is specified (which I think it should be, to enforce the lower limit of 1) and upper bound is needed. To address your concern with dom0less - 32768 maybe?
Jan
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Daniel P. Smithxen/arch/x86/guest/xen/pvh-boot.c bool __initdata pvh_boot; · line 35
Quoted 8 lines · Daniel P. Smith
xen/arch/x86/guest/xen/pvh-boot.c +1
-1@@ -32,7 +32,7 @@ bool __initdata pvh_boot;uint32_t __initdata pvh_start_info_pa;static multiboot_info_t __initdata pvh_mbi; -static module_t __initdata pvh_mbi_mods[8 ]; +static module_t __initdata pvh_mbi_mods[CONFIG_NR_BOOTMOD +1 ];
Did this build successfully for you? Looks like the trailing S is missing ...
Quoted 4 lines
xen/arch/x86/setup.c +0
-0@@ -1017,9 +1017,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)panic ("dom0 kernel not specified. Check bootloader configuration\n" );
xen/arch/x86/setup.c void __init noreturn __start_xen(unsigned long mbi_p) · line 1025
Quoted 10 lines
xen/arch/x86/setup.c +2
-2/* Check that we don't have a silly number of modules. */ -if ( mbi->mods_count >sizeof (module_map) *8 ) +if ( mbi->mods_count >CONFIG_NR_BOOTMODS ) { - mbi->mods_count =sizeof (module_map) *8 ; + mbi->mods_count =CONFIG_NR_BOOTMODS ;printk ("Excessive multiboot modules - using the first %u only\n" , mbi->mods_count); }
You'll want to accompany this by a BUILD_BUG_ON() checking that the Kconfig value doesn't exceed the capacity of module_map. Without that it could be quite hard to notice that a bump of the upper bound in the Kconfig file would result in an issue here.
Jan
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Roger Pau MonnéQuoted 5 lines · Roger Pau Monné
Quoted 3 lines · George Dunlap
The down side of this is that you can’t use “automatically remove trailing whitespace on save” features of some editors.
Without such automation, I introduce loads of trailing whitespace. With such automation, I end up removing random trailing whitespace as I happen to touch files. I’ve always done this by just adding “While here, remove some trailing whitespace” to the commit message, and there haven’t been any complaints.
Quoted 8 lines
FWIW, I have an editor feature that highlights trailing whitespace, but doesn't remove it.
As said, I find it cumbersome to have to go through more jumps while using
git blameor similar, just because of unrelated cleanups.IMO I don't think it's good practice to wholesale replace all trailing whitespace from a file as part of an unrelated change.
+1
Cheers,
Signature · 1 line
Julien Grall
Re: [RFC PATCH 1/4] kconfig: allow configuration of maximum modules
In reply to Jan BeulichHi,
Quoted 43 lines · Jan Beulich
Quoted 23 lines · Julien Grall
Quoted 20 lines · Daniel P. Smith
Quoted 18 lines · Julien Grall
Hi,
xen/arch/Kconfig config NR_CPUS · line 23
Quoted 13 lines · Daniel P. Smith
xen/arch/Kconfig +0
-0@@ -17,3 +17,15 @@ config NR_CPUS For CPU cores which support Simultaneous Multi-Threading orsimilar
technologies, this the number of logical threads which Xen will support.xen/arch/Kconfig +4
-0+ +config NR_BOOTMODS + int "Maximum number of boot modules that a loader can pass" + range 1 64OOI, any reason to limit the size?
Quoted 4 lines
Quoted 1 line
I modelled this entirely after
NR_CPUS, which applied a limitThe limit for
NR_CPUSmakes sense because there are scalability issues after that (although 4095 seems quite high) and/or the HW impose a limit.The 4095 is actually a software limit (due to how spinlocks are implemented).
Quoted 10 lines
Quoted 5 lines
, and it
seemed reasonable to me at the time. I choose 64 since it was double currently what Arm had set forMAX_MODULES. As such, I have no hard reason for there to be a limit. It can easily be removed or adjusted to whatever the reviewers feel would be appropriate.Ok. In which case I would drop the limit beause it also prevent a users to create more 64 dom0less domUs (actually a bit less because some modules are used by Xen). I don't think there are a strong reason to prevent that, right?
Quoted 4 lines
At least as per the kconfig language doc the upper bound is not optional, so if a range is specified (which I think it should be, to enforce the lower limit of 1) and upper bound is needed. To address your concern with dom0less - 32768 maybe?
I am fine with that.
Cheers,
Signature · 1 line
Julien Grall
Hi,
It seems that this series has been stale for more than a month, with:
Patch #1 has some discussions in thread. Patch #2 #3 #4 need some feedback from maintainers.
So sending this email as a gentle reminder. Thanks!
Kind regards,
Henry
Quoted 78 lines
-----Original Message-----
Subject: [RFC PATCH 0/4] Introducing a common representation of boot infoThis series serves as a proposal to arrive at a common, cross-architecture way
for boot information to be represented during startup. This proposal is derived
from the structures devised to represent hyperlaunch boot information. The hyperlaunch boot information structures themselves were based on the boot info
structures used by Arm and dom0less. A significant effort went into ensuring the structures are able to support dom0less as well as hyperlaunch.Arm and x86 both have arch specific information that must be represented. The
approach here sought to support this through arch structures while attempting
to maximize what was retained in the common structures. For this series, the focus was on converting x86 over to the new boot info structures.The motivation for this series is due to the fact that the multiboot v1 structures used by x86 are not sufficient for hyperlaunch. In the previously submited hyperlaunch RFC, this was managed by wrapping the mb structures inside⎄ the hyperlaunch structures. This at best was could be considered crude, but really it was just a hack. One of the goals of hyperlaunch is to unify as much as possible with dom0less to remove any unnecessary duplication.
Adopting a common representation for boot information will provide a solid foundation for this unification. The added benefit is that in few places this will enable an unnecessary arch specific version of logic, XSM for example would be able to drop arch specific init functions.This series being submitted as an RFC due to,
* the number of design decisions being made within the series
* the limited testing able to be completed
* how extensive the changes will be for x86NB: This series is built on top of the v2 patch series, "xsm: refactor and optimize policy loading".
Daniel P. Smith (4):
kconfig: allow configuration of maximum modules
headers: introduce generalized boot info
x86: adopt new boot info structures
x86: refactor entrypoints to new boot infoxen/arch/Kconfig | 12 ++ xen/arch/arm/include/asm/setup.h | 5 +- xen/arch/x86/boot/boot_info32.h | 81 ++++++++ xen/arch/x86/boot/defs.h | 17 +- xen/arch/x86/boot/reloc.c | 187 +++++++++++------ xen/arch/x86/bzimage.c | 16 +- xen/arch/x86/cpu/microcode/core.c | 134 ++++++++----- xen/arch/x86/dom0_build.c | 13 +- xen/arch/x86/efi/efi-boot.h | 96 +++++---- xen/arch/x86/guest/xen/pvh-boot.c | 58 ++++-- xen/arch/x86/hvm/dom0_build.c | 42 ++-- xen/arch/x86/include/asm/bootinfo.h | 45 +++++ xen/arch/x86/include/asm/bzimage.h | 5 +- xen/arch/x86/include/asm/dom0_build.h | 15 +- xen/arch/x86/include/asm/guest/pvh-boot.h | 6 +- xen/arch/x86/include/asm/setup.h | 14 +- xen/arch/x86/pv/dom0_build.c | 34 ++-- xen/arch/x86/setup.c | 234 ++++++++++++---------- xen/common/efi/boot.c | 4 +- xen/include/xen/bootinfo.h | 101 ++++++++++ xen/include/xsm/xsm.h | 26 ++- xen/xsm/xsm_core.c | 22 +- xen/xsm/xsm_policy.c | 44 ++-- 23 files changed, 804 insertions(+), 407 deletions(-) create mode 100644 xen/arch/x86/boot/boot_info32.h create mode 100644 xen/arch/x86/include/asm/bootinfo.h create mode 100644 xen/include/xen/bootinfo.h--
2.20.1
Quoted 6 lines · Henry Wang
It seems that this series has been stale for more than a month, with:
Patch #1 has some discussions in thread. Patch #2 #3 #4 need some feedback from maintainers.
So sending this email as a gentle reminder. Thanks!
As a general remark: RFCs, at least in my view, take lower priority than "ordinary" patch submissions (and other work). I, for example, have this and other on my "to look at" list, but I can't really predict when all higher priority items would have been dealt with. It's the sad reality that in effect this often means RFCs won't be looked at at all. One of the many unfortunate effects of our limited review bandwidth.
Jan
Hi Jan,
Quoted 11 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Subject: Re: [RFC PATCH 0/4] Introducing a common representation of boot infoQuoted 5 lines · Henry Wang
It seems that this series has been stale for more than a month, with:
Patch #1 has some discussions in thread. Patch #2 #3 #4 need some feedback from maintainers.
Quoted 8 lines
Quoted 1 line
So sending this email as a gentle reminder. Thanks!
As a general remark: RFCs, at least in my view, take lower priority than "ordinary" patch submissions (and other work). I, for example, have this and other on my "to look at" list, but I can't really predict when all higher priority items would have been dealt with. It's the sad reality that in effect this often means RFCs won't be looked at at all. One of the many unfortunate effects of our limited review bandwidth.
I fully agree with you on that, and to be honest I think you have already Been really active in responding and reviewing series.
Just to clarify the purpose of me sending these reminder emails, from my perspective, those emails are simply for us to not forget these series (and also one of the responsibilities of me being a release manager) instead of pushing authors/maintainers and making them feel stressful - I will try to rephrase for better wording if my previously emails make people think in this way.
Kind regards,
Henry
Quoted 2 lines
Jan