]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
plat/common: Make the amount of Memory Region Descriptors configurable
authorSergiu Moga <sergiu.moga@protonmail.com>
Tue, 21 Mar 2023 10:49:59 +0000 (12:49 +0200)
committerUnikraft <monkey@unikraft.io>
Fri, 11 Aug 2023 10:18:44 +0000 (10:18 +0000)
Sice `bootinfo` statically allocates space in the final image to store
Memory Region Descriptors at runtime and their actual amount is highly
variable depending on the platform, allow the user to configure a
precise maximum amount of such descriptors.

This allows flexibility in the size of the final image. One can check
at runtime whether `-ENOMEM` is returned by the memory region insertion
function or not and adjust `CONFIG_UKPLAT_MEMREGION_MAX_COUNT` accordingly.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #848

plat/Config.uk
plat/common/bootinfo.c

index 5179b95dcb91a639dac06f6ce945e315fa17d823..81fcdba2c9d1be43ca4201a1906dee1070cc2bdd 100644 (file)
@@ -5,6 +5,16 @@ config UKPLAT_MEMRNAME
        help
                Enable name field in memory region descriptors
 
+config UKPLAT_MEMREGION_MAX_COUNT
+       int "Maximum amount of Bootinfo Memory Region Descriptors"
+       default 128
+       help
+               The number of memory region descriptors depends on the platform. Some
+               may have less than 100, while others may have 100's of memory region
+               descriptors. In order to cope with this, the user is able to configure
+               the amount of statically allocated space in the image made available
+               for storing memory region descriptors' metadata.
+
 config UKPLAT_LCPU_MAXCOUNT
        int "Maximum number of supported logical CPUs"
        range 1 256
index 19468c851a11026e3bc83b02e44868f278ca518c..d946a30e49fbc58369551e474fa0f7333d317a59 100644 (file)
@@ -10,8 +10,8 @@
 /**
  * Space reservation for boot information. Will be populated by build script.
  */
-__section(".uk_bootinfo") __align(8) __used
-static char bi_bootinfo_sec[UKPLAT_BOOTINFO_SIZE(32)];
+__section(".uk_bootinfo") __align(8) __used static char
+bi_bootinfo_sec[UKPLAT_BOOTINFO_SIZE(CONFIG_UKPLAT_MEMREGION_MAX_COUNT)];
 
 /**
  * Pointer to boot information. Can be changed at runtime if the boot