public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org
Cc: avi@redhat.com, jan.kiszka@web.de, Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 2/6] remove support for !KVM_CAP_SET_TSS_ADDR
Date: Mon, 03 May 2010 19:48:21 -0300	[thread overview]
Message-ID: <20100503224905.320538072@amt.cnet> (raw)
In-Reply-To: 20100503224819.773169076@amt.cnet

[-- Attachment #1: remove-no-tss-ext-support --]
[-- Type: text/plain, Size: 2315 bytes --]

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@redhat.com>

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



  parent reply	other threads:[~2010-05-03 22:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-03 22:48 [patch 0/6] qemu-kvm: use upstream memslot code Marcelo Tosatti
2010-05-03 22:48 ` [patch 1/6] remove alias support Marcelo Tosatti
2010-05-03 22:48 ` Marcelo Tosatti [this message]
2010-05-03 22:48 ` [patch 3/6] remove unused kvm_get_dirty_pages Marcelo Tosatti
2010-05-03 22:48 ` [patch 4/6] remove unused kvm_dirty_bitmap array Marcelo Tosatti
2010-05-03 22:48 ` [patch 5/6] introduce qemu_ram_map Marcelo Tosatti
2010-05-03 22:48 ` [patch 6/6] use upstream memslot management code Marcelo Tosatti
2010-05-05  8:49 ` [patch 0/6] qemu-kvm: use upstream memslot code Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100503224905.320538072@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox