diff options
author | Dave Voutila <dv@cvs.openbsd.org> | 2022-05-03 21:39:20 +0000 |
---|---|---|
committer | Dave Voutila <dv@cvs.openbsd.org> | 2022-05-03 21:39:20 +0000 |
commit | d479378255c624fc6c59decbdb6d7bb1e8116f90 (patch) | |
tree | caf894147d0004510e88894ede3de641155504ff /sys/arch | |
parent | 0f1c45970db92052b0289d483f6692318feda2f8 (diff) |
vmm/vmd/vmctl: standardize memory units to bytes
At different points in the vm lifecycle vmm(4), vmctl(8), and vmd(8)
refer to a vm's memory range sizes in either bytes or megabytes.
This is needlessly complex.
Switch to using bytes everywhere and adjust types and constants
accordingly. While this makes it possible to specify vm's with
memory in fractions of megabytes, the logic requiring whole
megabyte values remains.
Feedback from deraadt@, mlarkin@, and Matthew Martin.
ok mlarkin@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/vmm.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/include/vmmvar.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index 765fc19bca5..d218407f5bb 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.306 2022/04/27 14:23:37 dv Exp $ */ +/* $OpenBSD: vmm.c,v 1.307 2022/05/03 21:39:18 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -1575,7 +1575,7 @@ vm_create_check_mem_ranges(struct vm_create_params *vcp) { size_t i, memsize = 0; struct vm_mem_range *vmr, *pvmr; - const paddr_t maxgpa = (uint64_t)VMM_MAX_VM_MEM_SIZE * 1024 * 1024; + const paddr_t maxgpa = VMM_MAX_VM_MEM_SIZE; if (vcp->vcp_nmemranges == 0 || vcp->vcp_nmemranges > VMM_MAX_MEM_RANGES) diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h index 94bb172832d..f798674dd0f 100644 --- a/sys/arch/amd64/include/vmmvar.h +++ b/sys/arch/amd64/include/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.74 2021/09/13 22:16:27 dv Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.75 2022/05/03 21:39:19 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -31,7 +31,7 @@ #define VMM_MAX_KERNEL_PATH 128 #define VMM_MAX_VCPUS 512 #define VMM_MAX_VCPUS_PER_VM 64 -#define VMM_MAX_VM_MEM_SIZE 32768 +#define VMM_MAX_VM_MEM_SIZE 32L * 1024 * 1024 * 1024 /* 32 GiB */ #define VMM_MAX_NICS_PER_VM 4 #define VMM_PCI_MMIO_BAR_BASE 0xF0000000ULL |