From: Marcelo Tosatti Subject: [patch 2/6] remove support for !KVM_CAP_SET_TSS_ADDR Date: Mon, 03 May 2010 19:48:21 -0300 Message-ID: <20100503224905.320538072@amt.cnet> References: <20100503224819.773169076@amt.cnet> Cc: avi@redhat.com, jan.kiszka@web.de, Marcelo Tosatti To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:49555 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756121Ab0ECW44 (ORCPT ); Mon, 3 May 2010 18:56:56 -0400 Content-Disposition: inline; filename=remove-no-tss-ext-support Sender: kvm-owner@vger.kernel.org List-ID: Kernels < 2.6.24 hardcoded slot 0 for the location of VMX rmode TSS pages. Remove support for it. Signed-off-by: Marcelo Tosatti 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; }