From patchwork Mon May 3 22:48:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 96582 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o43MuxPY031803 for ; Mon, 3 May 2010 22:56:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759457Ab0ECW45 (ORCPT ); Mon, 3 May 2010 18:56:57 -0400 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 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o43MuuoL017149 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 3 May 2010 18:56:56 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o43Muujl008761; Mon, 3 May 2010 18:56:56 -0400 Received: from amt.cnet (vpn-8-8.rdu.redhat.com [10.11.8.8]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o43Mus0w006970; Mon, 3 May 2010 18:56:55 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 8EDC5656078; Mon, 3 May 2010 19:56:08 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o43Mu2Ht026876; Mon, 3 May 2010 19:56:02 -0300 Message-Id: <20100503224905.320538072@amt.cnet> User-Agent: quilt/0.47-1 Date: Mon, 03 May 2010 19:48:21 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: avi@redhat.com, jan.kiszka@web.de, Marcelo Tosatti Subject: [patch 2/6] remove support for !KVM_CAP_SET_TSS_ADDR References: <20100503224819.773169076@amt.cnet> Content-Disposition: inline; filename=remove-no-tss-ext-support X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 03 May 2010 22:56:59 +0000 (UTC) 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; }