@@ -2,4 +2,8 @@
void kvm__arch_validate_cfg(struct kvm *kvm)
{
+ if (kvm->cfg.ram_size > ARM_LOMAP_MAX_MEMORY) {
+ die("RAM size 0x%llx exceeds maximum allowed 0x%llx",
+ kvm->cfg.ram_size, ARM_LOMAP_MAX_MEMORY);
+ }
}
@@ -39,6 +39,11 @@ int vcpu_affinity_parser(const struct option *opt, const char *arg, int unset)
void kvm__arch_validate_cfg(struct kvm *kvm)
{
+ if (kvm->cfg.arch.aarch32_guest &&
+ kvm->cfg.ram_size > ARM_LOMAP_MAX_MEMORY) {
+ die("RAM size 0x%llx exceeds maximum allowed 0x%llx",
+ kvm->cfg.ram_size, ARM_LOMAP_MAX_MEMORY);
+ }
}
/*
@@ -65,7 +65,7 @@ void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
* If using THP, then our minimal alignment becomes 2M.
* 2M trumps 64K, so let's go with that.
*/
- kvm->ram_size = min(ram_size, (u64)ARM_MAX_MEMORY(kvm));
+ kvm->ram_size = ram_size;
kvm->arch.ram_alloc_size = kvm->ram_size + SZ_2M;
kvm->arch.ram_alloc_start = mmap_anon_or_hugetlbfs(kvm, hugetlbfs_path,
kvm->arch.ram_alloc_size);