From patchwork Tue Mar 9 00:47:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 84193 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 o290nV8Q020302 for ; Tue, 9 Mar 2010 00:49:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756231Ab0CIAt2 (ORCPT ); Mon, 8 Mar 2010 19:49:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55223 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755725Ab0CIAt1 (ORCPT ); Mon, 8 Mar 2010 19:49:27 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o290nRlr008046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 8 Mar 2010 19:49:27 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o290nRLI017462; Mon, 8 Mar 2010 19:49:27 -0500 Received: from amt.cnet (vpn-9-132.rdu.redhat.com [10.11.9.132]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o290nQCC000978; Mon, 8 Mar 2010 19:49:26 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 5C2E668A866; Mon, 8 Mar 2010 21:48:48 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o290mghQ019708; Mon, 8 Mar 2010 21:48:42 -0300 Message-Id: <20100309004834.786355886@redhat.com> User-Agent: quilt/0.47-1 Date: Mon, 08 Mar 2010 21:47:09 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: Marcelo Tosatti Subject: [patch 5/7] kvm-tpr-opt: remove dead code References: <20100309004704.049355766@redhat.com> Content-Disposition: inline; filename=kvm-tpr-start-cleanup X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 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]); Tue, 09 Mar 2010 00:49:31 +0000 (UTC) Index: qemu-kvm-tpr/qemu-kvm-x86.c =================================================================== --- qemu-kvm-tpr.orig/qemu-kvm-x86.c +++ qemu-kvm-tpr/qemu-kvm-x86.c @@ -597,30 +597,16 @@ int kvm_get_shadow_pages(kvm_context_t k } #ifdef KVM_CAP_VAPIC - -static int tpr_access_reporting(CPUState *env, int enabled) -{ - int r; - struct kvm_tpr_access_ctl tac = { - .enabled = enabled, - }; - - r = kvm_ioctl(kvm_state, KVM_CHECK_EXTENSION, KVM_CAP_VAPIC); - if (r <= 0) - return -ENOSYS; - return kvm_vcpu_ioctl(env, KVM_TPR_ACCESS_REPORTING, &tac); -} - -int kvm_enable_tpr_access_reporting(CPUState *env) +static int kvm_enable_tpr_access_reporting(CPUState *env) { - return tpr_access_reporting(env, 1); -} + int r; + struct kvm_tpr_access_ctl tac = { .enabled = 1 }; -int kvm_disable_tpr_access_reporting(CPUState *env) -{ - return tpr_access_reporting(env, 0); + r = kvm_ioctl(env->kvm_state, KVM_CHECK_EXTENSION, KVM_CAP_VAPIC); + if (r <= 0) + return -ENOSYS; + return kvm_vcpu_ioctl(env, KVM_TPR_ACCESS_REPORTING, &tac); } - #endif int kvm_qemu_create_memory_alias(uint64_t phys_start, @@ -1319,7 +1305,7 @@ int kvm_arch_init_vcpu(CPUState *cenv) #endif #ifdef KVM_EXIT_TPR_ACCESS - kvm_tpr_vcpu_start(cenv); + kvm_enable_tpr_access_reporting(cenv); #endif kvm_reset_mpstate(cenv); return 0; Index: qemu-kvm-tpr/qemu-kvm.h =================================================================== --- qemu-kvm-tpr.orig/qemu-kvm.h +++ qemu-kvm-tpr/qemu-kvm.h @@ -601,27 +601,6 @@ int kvm_get_pit2(kvm_context_t kvm, stru #ifdef KVM_CAP_VAPIC -/*! - * \brief Enable kernel tpr access reporting - * - * When tpr access reporting is enabled, the kernel will call the - * ->tpr_access() callback every time the guest vcpu accesses the tpr. - * - * \param kvm Pointer to the current kvm_context - * \param vcpu vcpu to enable tpr access reporting on - */ -int kvm_enable_tpr_access_reporting(CPUState *env); - -/*! - * \brief Disable kernel tpr access reporting - * - * Undoes the effect of kvm_enable_tpr_access_reporting(). - * - * \param kvm Pointer to the current kvm_context - * \param vcpu vcpu to disable tpr access reporting on - */ -int kvm_disable_tpr_access_reporting(CPUState *env); - int kvm_enable_vapic(CPUState *env, uint64_t vapic); #endif @@ -895,7 +874,6 @@ void qemu_kvm_aio_wait_end(void); void qemu_kvm_notify_work(void); void kvm_tpr_access_report(CPUState *env, uint64_t rip, int is_write); -void kvm_tpr_vcpu_start(CPUState *env); int qemu_kvm_get_dirty_pages(unsigned long phys_addr, void *buf); Index: qemu-kvm-tpr/kvm-tpr-opt.c =================================================================== --- qemu-kvm-tpr.orig/kvm-tpr-opt.c +++ qemu-kvm-tpr/kvm-tpr-opt.c @@ -318,11 +318,6 @@ void kvm_tpr_access_report(CPUState *env patch_instruction(env, rip); } -void kvm_tpr_vcpu_start(CPUState *env) -{ - kvm_enable_tpr_access_reporting(env); -} - static void tpr_save(QEMUFile *f, void *s) { int i;