diff mbox

[2/6] remove support for !KVM_CAP_SET_TSS_ADDR

Message ID 20100503224905.320538072@amt.cnet (mailing list archive)
State New, archived
Headers show

Commit Message

Marcelo Tosatti May 3, 2010, 10:48 p.m. UTC
None
diff mbox

Patch

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;
 }