diff --git a/src/libs/kata-types/src/config/hypervisor/mod.rs b/src/libs/kata-types/src/config/hypervisor/mod.rs index 69c25200de..fc59e8cd2a 100644 --- a/src/libs/kata-types/src/config/hypervisor/mod.rs +++ b/src/libs/kata-types/src/config/hypervisor/mod.rs @@ -653,6 +653,13 @@ pub struct MemoryInfo { /// If swap_in_bytes and memory_limit_in_bytes is not set, the size should be default_memory. #[serde(default)] pub enable_guest_swap: bool, + + /// Default maximum memory in MiB per SB / VM + /// unspecified or == 0 --> will be set to the actual amount of physical RAM + /// > 0 <= amount of physical RAM --> will be set to the specified number + /// > amount of physical RAM --> will be set to the actual amount of physical RAM + #[serde(default)] + pub default_maxmemory: u32, } impl MemoryInfo { diff --git a/src/runtime-rs/Makefile b/src/runtime-rs/Makefile index fef3ee3728..b48b1436a0 100644 --- a/src/runtime-rs/Makefile +++ b/src/runtime-rs/Makefile @@ -124,6 +124,8 @@ DEFMEMSZ := 2048 # - vm template memory # - hugepage memory DEFMEMSLOTS := 10 +# Default maximum memory in MiB +DEFMAXMEMSZ := 0 ##VAR DEFBRIDGES= Default number of bridges DEFBRIDGES := 0 DEFENABLEANNOTATIONS := [\"kernel_params\"] @@ -307,6 +309,7 @@ USER_VARS += DEFMAXVCPUS_ACRN USER_VARS += DEFMAXVCPUS_DB USER_VARS += DEFMEMSZ USER_VARS += DEFMEMSLOTS +USER_VARS += DEFMAXMEMSZ USER_VARS += DEFBRIDGES USER_VARS += DEFNETWORKMODEL_DB USER_VARS += DEFNETWORKMODEL_CLH diff --git a/src/runtime-rs/config/configuration-dragonball.toml.in b/src/runtime-rs/config/configuration-dragonball.toml.in index 4c057af5c4..7f08a7db92 100644 --- a/src/runtime-rs/config/configuration-dragonball.toml.in +++ b/src/runtime-rs/config/configuration-dragonball.toml.in @@ -101,6 +101,13 @@ default_bridges = @DEFBRIDGES@ # If unspecified then it will be set @DEFMEMSZ@ MiB. default_memory = @DEFMEMSZ@ +# Default maximum memory in MiB per SB / VM +# unspecified or == 0 --> will be set to the actual amount of physical RAM +# > 0 <= amount of physical RAM --> will be set to the specified number +# > amount of physical RAM --> will be set to the actual amount of physical RAM +default_maxmemory = @DEFMAXMEMSZ@ + + # Block storage driver to be used for the hypervisor in case the container # rootfs is backed by a block device. DB only supports virtio-blk. block_device_driver = "@DEFBLOCKSTORAGEDRIVER_DB@"