[patch 2/6] remove support for !KVM_CAP_SET_TSS_ADDR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kernels < 2.6.24 hardcoded slot 0 for the location of VMX rmode TSS
pages. Remove support for it.

Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx>

Index: qemu-kvm-memslot/qemu-kvm.c
===================================================================
--- qemu-kvm-memslot.orig/qemu-kvm.c
+++ qemu-kvm-memslot/qemu-kvm.c
@@ -157,24 +157,7 @@ static void init_slots(void)
 
 static int get_free_slot(kvm_context_t kvm)
 {
-    int i;
-    int tss_ext;
-
-#if defined(KVM_CAP_SET_TSS_ADDR) && !defined(__s390__)
-    tss_ext = kvm_ioctl(kvm_state, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
-#else
-    tss_ext = 0;
-#endif
-
-    /*
-     * on older kernels where the set tss ioctl is not supprted we must save
-     * slot 0 to hold the extended memory, as the vmx will use the last 3
-     * pages of this slot.
-     */
-    if (tss_ext > 0)
-        i = 0;
-    else
-        i = 1;
+    int i = 0;
 
     for (; i < KVM_MAX_NUM_MEM_REGIONS; ++i)
         if (!slots[i].len)
Index: qemu-kvm-memslot/qemu-kvm-x86.c
===================================================================
--- qemu-kvm-memslot.orig/qemu-kvm-x86.c
+++ qemu-kvm-memslot/qemu-kvm-x86.c
@@ -35,7 +35,6 @@ static int lm_capable_kernel;
 
 int kvm_set_tss_addr(kvm_context_t kvm, unsigned long addr)
 {
-#ifdef KVM_CAP_SET_TSS_ADDR
 	int r;
         /*
          * Tell fw_cfg to notify the BIOS to reserve the range.
@@ -45,22 +44,16 @@ int kvm_set_tss_addr(kvm_context_t kvm, 
             exit(1);
         }
 
-	r = kvm_ioctl(kvm_state, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
-	if (r > 0) {
-		r = kvm_vm_ioctl(kvm_state, KVM_SET_TSS_ADDR, addr);
-		if (r < 0) {
-			fprintf(stderr, "kvm_set_tss_addr: %m\n");
-			return r;
-		}
-		return 0;
+	r = kvm_vm_ioctl(kvm_state, KVM_SET_TSS_ADDR, addr);
+	if (r < 0) {
+		fprintf(stderr, "kvm_set_tss_addr: %m\n");
+		return r;
 	}
-#endif
-	return -ENOSYS;
+	return 0;
 }
 
 static int kvm_init_tss(kvm_context_t kvm)
 {
-#ifdef KVM_CAP_SET_TSS_ADDR
 	int r;
 
 	r = kvm_ioctl(kvm_state, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
@@ -74,9 +67,9 @@ static int kvm_init_tss(kvm_context_t kv
 			fprintf(stderr, "kvm_init_tss: unable to set tss addr\n");
 			return r;
 		}
-
+	} else {
+		fprintf(stderr, "kvm does not support KVM_CAP_SET_TSS_ADDR\n");
 	}
-#endif
 	return 0;
 }
 


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux