From: Peter Dinda Date: Tue, 5 Oct 2010 22:14:04 +0000 (-0500) Subject: Merge branch 'devel' of ssh://palacios@newskysaw.cs.northwestern.edu//home/palacios... X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0c113197cc4f189d1e2d34ede358b7733d73e4d;p=palacios.git Merge branch 'devel' of ssh://palacios@newskysaw.cs.northwestern.edu//home/palacios/palacios into devel Conflicts: palacios/include/palacios/vm_guest.h palacios/src/devices/apic.c palacios/src/devices/io_apic.c palacios/src/palacios/vmm_config.c palacios/src/palacios/vmm_direct_paging_64.h palacios/src/palacios/vmm_mem.c utils/guest_creator/default.xml --- e0c113197cc4f189d1e2d34ede358b7733d73e4d diff --cc palacios/include/palacios/vm_guest.h index c8bc2e0,3635f8c..322f390 --- a/palacios/include/palacios/vm_guest.h +++ b/palacios/include/palacios/vm_guest.h @@@ -116,11 -126,10 +126,12 @@@ struct guest_info struct v3_vm_info { v3_vm_class_t vm_class; - addr_t mem_size; // In bytes for now + addr_t mem_size; /* In bytes for now */ + uint32_t mem_align; struct v3_mem_map mem_map; + v3_paging_size_t paging_size; // for nested paging + struct v3_mem_hooks mem_hooks; struct v3_shdw_impl_state shdw_impl; diff --cc palacios/src/devices/apic.c index a0d17df,655c1fb..f7cf5e6 --- a/palacios/src/devices/apic.c +++ b/palacios/src/devices/apic.c @@@ -889,13 -895,15 +899,16 @@@ static int apic_write(struct guest_inf case INT_CMD_LO_OFFSET: apic->int_cmd.lo = op_val; + // ICC??? - PrintDebug("apic %u: core %u: sending cmd 0x%llx to apic %u\n",apic->lapic_id.val,core->cpu_id, + PrintDebug("apic %u: core %u: sending cmd 0x%llx to apic %u\n", + apic->clapic_id.val, core->cpu_id, apic->int_cmd.val, apic->int_cmd.dst); - - v3_icc_send_ipi(apic->icc_bus, apic->lapic_id.val, apic->int_cmd.val, 0); + if (v3_icc_send_ipi(apic->icc_bus, apic->lapic_id.val, apic->int_cmd.val,apic->dst_fmt.val,0)==-1) { + return -1; + } break; + case INT_CMD_HI_OFFSET: apic->int_cmd.hi = op_val; break; diff --cc palacios/src/devices/io_apic.c index dbbab94,e6a9f3a..00587ef --- a/palacios/src/devices/io_apic.c +++ b/palacios/src/devices/io_apic.c @@@ -290,10 -291,9 +291,12 @@@ static int ioapic_raise_irq(struct v3_v icr.rem_rd_status=0; icr.dst_shorthand=0; // no shorthand icr.rsvd2=0; + + // Note: 0 yhere is "cluster model", but it should be irrelevant + // since we are sending this as a physical destination - v3_icc_send_ipi(ioapic->icc_bus, ioapic->ioapic_id.val,icr.val, 0, irq); + PrintDebug("io apic %u: raising irq %u on ICC bus.\n", + ioapic->ioapic_id.id, irq); - v3_icc_send_ipi(ioapic->icc_bus, ioapic->ioapic_id.id,icr.val, irq); ++ v3_icc_send_ipi(ioapic->icc_bus, ioapic->ioapic_id.id,icr.val, 0, irq); } return 0; diff --cc palacios/src/palacios/vmm_config.c index 86eb1dd,e65563c..c2c8c57 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@@ -270,17 -301,9 +301,18 @@@ static int determine_paging_mode(struc info->shdw_pg_mode = SHADOW_PAGING; } + if (info->shdw_pg_mode == NESTED_PAGING) { PrintDebug("Guest Paging Mode: NESTED_PAGING\n"); + if (strcasecmp(page_size, "4kb") == 0) { /* TODO: this may not be an ideal place for this */ + info->vm_info->paging_size = PAGING_4KB; + } else if (strcasecmp(page_size, "2mb") == 0) { + info->vm_info->paging_size = PAGING_2MB; + } else { + PrintError("Invalid VM paging size: '%s'\n", page_size); + return -1; + } + PrintDebug("VM page size=%s\n", page_size); } else if (info->shdw_pg_mode == SHADOW_PAGING) { PrintDebug("Guest Paging Mode: SHADOW_PAGING\n"); } else { diff --cc palacios/src/palacios/vmm_mem.c index 89fd64f,a795f58..7994cc4 --- a/palacios/src/palacios/vmm_mem.c +++ b/palacios/src/palacios/vmm_mem.c @@@ -63,11 -61,14 +61,15 @@@ int v3_init_mem_map(struct v3_vm_info // There is an underlying region that contains all of the guest memory // PrintDebug("Mapping %d pages of memory (%u bytes)\n", (int)mem_pages, (uint_t)info->mem_size); + // 2MB page alignment needed for 2MB hardware nested paging map->base_region.guest_start = 0; map->base_region.guest_end = mem_pages * PAGE_SIZE_4KB; - map->base_region.host_addr = (addr_t)V3_AllocAlignedPages(mem_pages, PAGE_SIZE_2MB); + + #ifdef CONFIG_ALIGNED_PG_ALLOC + map->base_region.host_addr = (addr_t)V3_AllocAlignedPages(mem_pages, vm->mem_align); + #else + map->base_region.host_addr = (addr_t)V3_AllocPages(mem_pages); + #endif map->base_region.flags.read = 1; map->base_region.flags.write = 1;