From 5c23e88cf2a1d04c43d32a73324857fcb57cf597 Mon Sep 17 00:00:00 2001 From: Alexander Sadovskiy Date: Wed, 7 Dec 2011 14:52:29 +0400 Subject: [PATCH 30/32] Minor fixes io_apic.c - removed my debug message about interrupts that cannot be handled pci_passthrough.c - fixed small memory leak and replaced more \t by spaces vmm_symspy.c - fixed one small annoying typo vmm_symbiotic.c - refactored (and added case for UG) in the function that chooses which signature to tell to linux kernel symbiotic patch --- palacios/src/devices/io_apic.c | 1 - palacios/src/devices/pci_passthrough.c | 26 ++++++++++++-------------- palacios/src/palacios/vmm_symbiotic.c | 24 +++++++++++++++++------- palacios/src/palacios/vmm_symspy.c | 2 +- 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/palacios/src/devices/io_apic.c b/palacios/src/devices/io_apic.c index dd861cf..2115623 100644 --- a/palacios/src/devices/io_apic.c +++ b/palacios/src/devices/io_apic.c @@ -280,7 +280,6 @@ static int ioapic_raise_irq(struct v3_vm_info * vm, void * private_data, struct // check whether this IRQ can be processed by IOAPIC if(irq_data.flags.valid && !irq_data.flags.uses_irqline) { - PrintError("ioapic %u: IRQ %d cannot be processed\n", ioapic->ioapic_id.id, irq); return -1; } diff --git a/palacios/src/devices/pci_passthrough.c b/palacios/src/devices/pci_passthrough.c index 3946b3f..f1ea953 100644 --- a/palacios/src/devices/pci_passthrough.c +++ b/palacios/src/devices/pci_passthrough.c @@ -1857,8 +1857,8 @@ static int passthrough_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { memset(state, 0, sizeof(struct pt_dev_state)); if (!pci) { - PrintError("Could not find PCI device\n"); - return -1; + PrintError("Could not find PCI device\n"); + return -1; } state->pci_bus = pci; @@ -1868,20 +1868,20 @@ static int passthrough_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { dev = v3_add_device(vm, dev_id, &dev_ops, state); if (dev == NULL) { - PrintError("Could not attach device %s\n", dev_id); - V3_Free(state); - return -1; + PrintError("Could not attach device %s\n", dev_id); + V3_Free(state); + return -1; } if (find_real_pci_dev(atox(v3_cfg_val(cfg, "vendor_id")), - atox(v3_cfg_val(cfg, "device_id")), - state) == -1) { - PrintError("Could not find PCI Device %s:%s\n", - v3_cfg_val(cfg, "vendor_id"), - v3_cfg_val(cfg, "device_id")); - v3_remove_device(dev); - return 0; + atox(v3_cfg_val(cfg, "device_id")), + state) == -1) { + PrintError("Could not find PCI Device %s:%s\n", + v3_cfg_val(cfg, "vendor_id"), v3_cfg_val(cfg, "device_id")); + v3_remove_device(dev); + V3_Free(state); + return 0; } setup_virt_pci_dev(vm, dev, cfg); @@ -1894,8 +1894,6 @@ static int passthrough_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { state->pci_dev->is_passthrough = 1; - - return 0; } diff --git a/palacios/src/palacios/vmm_symbiotic.c b/palacios/src/palacios/vmm_symbiotic.c index 8fda86e..0829e0a 100644 --- a/palacios/src/palacios/vmm_symbiotic.c +++ b/palacios/src/palacios/vmm_symbiotic.c @@ -32,15 +32,25 @@ static int cpuid_fn(struct guest_info * core, uint32_t cpuid, *eax = *(uint32_t *)"V3V"; - if ((v3_cpu_types[0] == V3_SVM_CPU) || - (v3_cpu_types[0] == V3_SVM_REV3_CPU)) { - *ebx = *(uint32_t *)"SVM"; - } else if ((v3_cpu_types[0] == V3_VMX_CPU) || - (v3_cpu_types[0] == V3_VMX_EPT_CPU)) { - *ebx = *(uint32_t *)"VMX"; + switch(v3_cpu_types[core->pcpu_id]) { + #ifdef V3_CONFIG_SVM + case V3_SVM_CPU: + case V3_SVM_REV3_CPU: + *ebx = *(uint32_t *)"SVM"; + break; + #endif + #ifdef V3_CONFIG_VMX + case V3_VMX_CPU: + case V3_VMX_EPT_CPU: + case V3_VMX_EPT_UG_CPU: + *ebx = *(uint32_t *)"VMX"; + break; + #endif + default: + PrintError("Symbiotic CPUID: guest will fail due to unknown arch_type\n"); + *ebx = 0; } - return 0; } diff --git a/palacios/src/palacios/vmm_symspy.c b/palacios/src/palacios/vmm_symspy.c index caf1a8c..967b9f1 100644 --- a/palacios/src/palacios/vmm_symspy.c +++ b/palacios/src/palacios/vmm_symspy.c @@ -52,7 +52,7 @@ static int symspy_msr_write(struct guest_info * core, uint_t msr, struct v3_msr if (msr == SYMSPY_GLOBAL_MSR) { struct v3_symspy_global_state * global_state = &(core->vm_info->sym_vm_state.symspy_state); - PrintDebug("Symbiotic Glbal MSR write for page %p\n", (void *)(addr_t)src.value); + PrintDebug("Symbiotic Global MSR write for page %p\n", (void *)(addr_t)src.value); if (global_state->active == 1) { // unmap page -- 1.7.5.4