#include <palacios/vmm_swapping.h>
#endif
+#ifdef V3_CONFIG_MULTIBOOT
+#include <palacios/vmm_multiboot.h>
+#endif
+
#ifdef V3_CONFIG_HVM
#include <palacios/vmm_hvm.h>
#endif
V3_Print(VM_NONE, VCORE_NONE, "File index=%d id=%s\n", idx, id);
strncpy(file->tag, id, V3_MAX_TAG_LEN);
+ file->tag[V3_MAX_TAG_LEN-1] = 0 ;
if (version==0) {
struct file_hdr_v0 * hdr = &(files_v0->hdrs[idx]);
if (alignment != PAGE_SIZE_4KB) {
PrintError(VM_NONE, VCORE_NONE, "Aligned page allocations are not supported in this host (requested alignment=%d)\n", alignment);
PrintError(VM_NONE, VCORE_NONE, "Ignoring alignment request\n");
+ alignment = PAGE_SIZE_4KB;
}
#endif
// Amount of ram the Guest will have, always in MB
vm->mem_size = (addr_t)atoi(memory_str) * 1024 * 1024;
vm->mem_align = get_alignment(align_str);
+
+ // set up defaults for memory management for threads associated
+ // with this VM
+ vm->resource_control.pg_alignment=vm->mem_align;
+ vm->resource_control.pg_node_id=-1;
#ifdef V3_CONFIG_SWAPPING
if (v3_init_swapping_vm(vm,vm_cfg)) {
}
#endif
+ if (v3_init_vm(vm) == -1) {
+ PrintError(VM_NONE, VCORE_NONE, "Failed to initialize VM\n");
+ return -1;
+ }
+
+#ifdef V3_CONFIG_MULTIBOOT
+ if (v3_init_multiboot_vm(vm,vm_cfg)) {
+ PrintError(vm,VCORE_NONE,"Cannot initialize Multiboot for VM\n");
+ return -1;
+ }
+#endif
#ifdef V3_CONFIG_HVM
if (v3_init_hvm_vm(vm,vm_cfg)) {
PrintError(vm,VCORE_NONE,"Cannot initialize HVM for VM\n");
}
#endif
-
- if (v3_init_vm(vm) == -1) {
- PrintError(VM_NONE, VCORE_NONE, "Failed to initialize VM\n");
- return -1;
- }
-
-
-
if (schedule_hz_str) {
sched_hz = atoi(schedule_hz_str);
+ if (sched_hz==0) {
+ PrintError(vm,VCORE_NONE,"Cannot set sched Hz to 0\n");
+ return -1;
+ }
}
PrintDebug(VM_NONE, VCORE_NONE, "CPU_KHZ = %d, schedule_freq=%p\n", V3_CPU_KHZ(),
return -1;
}
+#ifdef V3_CONFIG_MULTIBOOT
+ if (v3_init_multiboot_core(info)) {
+ PrintError(info->vm_info, info, "Error Initializing Multiboot Core\n");
+ return -1;
+ }
+#endif
#ifdef V3_CONFIG_HVM
if (v3_init_hvm_core(info)) {
PrintError(info->vm_info, info, "Error Initializing HVM Core\n");
return vm;
}
+/*
+
+
+*/
struct v3_vm_info * v3_config_guest(void * cfg_blob, void * priv_data) {
v3_cfg_tree_t * cores_cfg = NULL;
v3_cfg_tree_t * per_core_cfg = NULL;
+
if (v3_mach_type == V3_INVALID_CPU) {
PrintError(VM_NONE, VCORE_NONE, "Configuring guest on invalid CPU\n");
return NULL;
cfg_data = parse_config(cfg_blob);
+
if (!cfg_data) {
PrintError(VM_NONE, VCORE_NONE, "Could not parse configuration\n");
return NULL;
}
+
cores_cfg = v3_cfg_subtree(cfg_data->cfg, "cores");
if (!cores_cfg) {
vm = allocate_guest(num_cores);
if (!vm) {
- PrintError(VM_NONE, VCORE_NONE, "Could not allocate %d core guest\n", vm->num_cores);
+ PrintError(VM_NONE, VCORE_NONE, "Could not allocate %d core guest\n", num_cores);
return NULL;
}
+#ifdef V3_CONFIG_CACHEPART
+ // Need to initialize cache management and resource control
+ // as early as possible so that allocations are done accordingly
+ if (v3_init_cachepart_vm(vm,cfg_data->cfg)) {
+ PrintError(VM_NONE, VCORE_NONE, "Could not initialize cache partioning\n");
+ V3_Free(vm);
+ return NULL;
+ }
+#endif
+
vm->host_priv_data = priv_data;
vm->cfg_data = cfg_data;