diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2017-08-05 05:49:38 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2017-08-05 05:49:38 +0000 |
commit | 289f5e5ff29ac649cc4b562ada9cb946635c2206 (patch) | |
tree | 6b99aaeb1f16ccf728f3d76133739ce5699d61f3 | |
parent | 46807792e98a63b0e295e5bd25fc42d3c9d2f7f0 (diff) |
vmm: support more than 3855MB guest memory
guest VMs can now use MAXDSIZ ram.
ok deraadt@, stefan@, pd@
-rw-r--r-- | sys/arch/amd64/amd64/vmm.c | 22 | ||||
-rw-r--r-- | sys/arch/amd64/include/vmmvar.h | 6 |
2 files changed, 19 insertions, 9 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index c37f229700b..023eeb6c986 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.157 2017/07/02 19:49:31 mlarkin Exp $ */ +/* $OpenBSD: vmm.c,v 1.158 2017/08/05 05:49:37 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -949,7 +949,6 @@ stop_vmm_on_cpu(struct cpu_info *ci) size_t vm_create_check_mem_ranges(struct vm_create_params *vcp) { - int disjunct_range; size_t i, memsize = 0; struct vm_mem_range *vmr, *pvmr; const paddr_t maxgpa = (uint64_t)VMM_MAX_VM_MEM_SIZE * 1024 * 1024; @@ -982,10 +981,21 @@ vm_create_check_mem_ranges(struct vm_create_params *vcp) vmr->vmr_size >= VM_MAXUSER_ADDRESS - vmr->vmr_va) return (0); - /* Specifying ranges within the PCI MMIO space is forbidden */ - disjunct_range = (vmr->vmr_gpa > VMM_PCI_MMIO_BAR_END) || - (vmr->vmr_gpa + vmr->vmr_size <= VMM_PCI_MMIO_BAR_BASE); - if (!disjunct_range) + /* + * Specifying ranges within the PCI MMIO space is forbidden. + * Disallow ranges that start inside the MMIO space: + * [VMM_PCI_MMIO_BAR_BASE .. VMM_PCI_MMIO_BAR_END] + */ + if (vmr->vmr_gpa >= VMM_PCI_MMIO_BAR_BASE && + vmr->vmr_gpa <= VMM_PCI_MMIO_BAR_END) + return (0); + + /* + * ... and disallow ranges that end inside the MMIO space: + * [VMM_PCI_MMIO_BAR_BASE .. VMM_PCI_MMIO_BAR_END] + */ + if (vmr->vmr_gpa + vmr->vmr_size >= VMM_PCI_MMIO_BAR_BASE && + vmr->vmr_gpa + vmr->vmr_size <= VMM_PCI_MMIO_BAR_END) return (0); /* diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h index 6a7a887b50a..472107aa84b 100644 --- a/sys/arch/amd64/include/vmmvar.h +++ b/sys/arch/amd64/include/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.43 2017/07/12 05:32:50 mlarkin Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.44 2017/08/05 05:49:37 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -32,8 +32,8 @@ #define VMM_MAX_VM_MEM_SIZE 32768 #define VMM_MAX_NICS_PER_VM 4 -#define VMM_PCI_MMIO_BAR_BASE 0xF0000000 -#define VMM_PCI_MMIO_BAR_END 0xFFFFFFFF +#define VMM_PCI_MMIO_BAR_BASE 0xF0000000ULL +#define VMM_PCI_MMIO_BAR_END 0xFFFFFFFFULL #define VMM_PCI_MMIO_BAR_SIZE 0x00010000 #define VMM_PCI_IO_BAR_BASE 0x1000 #define VMM_PCI_IO_BAR_END 0xFFFF |