summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyvectl
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2013-03-18 22:38:30 +0000
committerneel <neel@FreeBSD.org>2013-03-18 22:38:30 +0000
commit8d05d984e8a9a632b3de9eed9ad8c765b40f88d9 (patch)
treea6c9b082e1d8d2eb2520edd75fe30f56de9a96a3 /usr.sbin/bhyvectl
parentee34459918e9cf13e4840cef3ebcc8df7fa218bf (diff)
downloadFreeBSD-src-8d05d984e8a9a632b3de9eed9ad8c765b40f88d9.zip
FreeBSD-src-8d05d984e8a9a632b3de9eed9ad8c765b40f88d9.tar.gz
Simplify the assignment of memory to virtual machines by requiring a single
command line option "-m <memsize in MB>" to specify the memory size. Prior to this change the user needed to explicitly specify the amount of memory allocated below 4G (-m <lowmem>) and the amount above 4G (-M <highmem>). The "-M" option is no longer supported by 'bhyveload' and 'bhyve'. The start of the PCI hole is fixed at 3GB and cannot be directly changed using command line options. However it is still possible to change this in special circumstances via the 'vm_set_lowmem_limit()' API provided by libvmmapi. Submitted by: Dinakar Medavaram (initial version) Reviewed by: grehan Obtained from: NetApp
Diffstat (limited to 'usr.sbin/bhyvectl')
-rw-r--r--usr.sbin/bhyvectl/bhyvectl.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c
index 26c6c92..cf673d1 100644
--- a/usr.sbin/bhyvectl/bhyvectl.c
+++ b/usr.sbin/bhyvectl/bhyvectl.c
@@ -186,9 +186,8 @@ usage(void)
" [--set-x2apic-state=<state>]\n"
" [--get-x2apic-state]\n"
" [--unassign-pptdev=<bus/slot/func>]\n"
- " [--set-lowmem=<memory below 4GB in units of MB>]\n"
+ " [--set-mem=<memory in units of MB>]\n"
" [--get-lowmem]\n"
- " [--set-highmem=<memory above 4GB in units of MB>]\n"
" [--get-highmem]\n",
progname);
exit(1);
@@ -197,7 +196,7 @@ usage(void)
static int get_stats, getcap, setcap, capval;
static const char *capname;
static int create, destroy, get_lowmem, get_highmem;
-static uint64_t lowmem, highmem;
+static uint64_t memsize;
static int set_cr0, get_cr0, set_cr3, get_cr3, set_cr4, get_cr4;
static int set_efer, get_efer;
static int set_dr7, get_dr7;
@@ -351,8 +350,7 @@ vm_set_vmcs_field(struct vmctx *ctx, int vcpu, int field, uint64_t val)
enum {
VMNAME = 1000, /* avoid collision with return values from getopt */
VCPU,
- SET_LOWMEM,
- SET_HIGHMEM,
+ SET_MEM,
SET_EFER,
SET_CR0,
SET_CR3,
@@ -400,8 +398,7 @@ main(int argc, char *argv[])
struct option opts[] = {
{ "vm", REQ_ARG, 0, VMNAME },
{ "cpu", REQ_ARG, 0, VCPU },
- { "set-lowmem", REQ_ARG, 0, SET_LOWMEM },
- { "set-highmem",REQ_ARG, 0, SET_HIGHMEM },
+ { "set-mem", REQ_ARG, 0, SET_MEM },
{ "set-efer", REQ_ARG, 0, SET_EFER },
{ "set-cr0", REQ_ARG, 0, SET_CR0 },
{ "set-cr3", REQ_ARG, 0, SET_CR3 },
@@ -572,13 +569,9 @@ main(int argc, char *argv[])
case VCPU:
vcpu = atoi(optarg);
break;
- case SET_LOWMEM:
- lowmem = atoi(optarg) * MB;
- lowmem = roundup(lowmem, 2 * MB);
- break;
- case SET_HIGHMEM:
- highmem = atoi(optarg) * MB;
- highmem = roundup(highmem, 2 * MB);
+ case SET_MEM:
+ memsize = atoi(optarg) * MB;
+ memsize = roundup(memsize, 2 * MB);
break;
case SET_EFER:
efer = strtoul(optarg, NULL, 0);
@@ -702,11 +695,8 @@ main(int argc, char *argv[])
error = -1;
}
- if (!error && lowmem)
- error = vm_setup_memory(ctx, 0, lowmem, NULL);
-
- if (!error && highmem)
- error = vm_setup_memory(ctx, 4 * GB, highmem, NULL);
+ if (!error && memsize)
+ error = vm_setup_memory(ctx, memsize, VM_MMAP_NONE);
if (!error && set_efer)
error = vm_set_register(ctx, vcpu, VM_REG_GUEST_EFER, efer);
OpenPOWER on IntegriCloud