From patchwork Wed Oct 20 08:29:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 268051 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9K8SuZW027732 for ; Wed, 20 Oct 2010 08:28:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752083Ab0JTI2v (ORCPT ); Wed, 20 Oct 2010 04:28:51 -0400 Received: from mga11.intel.com ([192.55.52.93]:62434 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752044Ab0JTI2u (ORCPT ); Wed, 20 Oct 2010 04:28:50 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 20 Oct 2010 01:28:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.57,354,1283756400"; d="scan'208";a="618484421" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.14]) by fmsmga002.fm.intel.com with ESMTP; 20 Oct 2010 01:28:49 -0700 Received: from yasker by syang10-desktop with local (Exim 4.71) (envelope-from ) id 1P8U3Y-0007p1-8N; Wed, 20 Oct 2010 16:29:56 +0800 From: Sheng Yang To: Avi Kivity , Marcelo Tosatti Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org, Sheng Yang Subject: [PATCH 1/5] qemu-kvm: Add kvm_enable_cap() interface for x86 Date: Wed, 20 Oct 2010 16:29:51 +0800 Message-Id: <1287563395-30039-2-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1287563395-30039-1-git-send-email-sheng@linux.intel.com> References: <1287563395-30039-1-git-send-email-sheng@linux.intel.com> 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 (demeter1.kernel.org [140.211.167.41]); Wed, 20 Oct 2010 08:28:56 +0000 (UTC) diff --git a/qemu-kvm.c b/qemu-kvm.c index 733d0a9..fbb68f6 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -540,6 +540,22 @@ int kvm_set_xcrs(CPUState *env, struct kvm_xcrs *xcrs) } #endif +#ifdef KVM_CAP_ENABLE_CAP +int kvm_enable_cap(CPUState *env, uint32_t cap) +{ + int r = 0; + struct kvm_enable_cap enable_cap = { + .cap = cap, + .flags = 0, + }; + + r = kvm_ioctl(kvm_state, KVM_CHECK_EXTENSION, KVM_CAP_ENABLE_CAP); + if (r > 0) + r = kvm_vcpu_ioctl(env, KVM_ENABLE_CAP, &enable_cap); + return r; +} +#endif + static int handle_mmio(CPUState *env) { unsigned long addr = env->kvm_run->mmio.phys_addr; diff --git a/qemu-kvm.h b/qemu-kvm.h index 9c08ab4..5cac0c2 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -316,6 +316,14 @@ int kvm_get_xcrs(CPUState *env, struct kvm_xcrs *xcrs); int kvm_set_xcrs(CPUState *env, struct kvm_xcrs *xcrs); #endif +#ifdef KVM_ENABLE_CAP +/*! + * * \brief Enable specific capability of KVM + * + */ +int kvm_enable_cap(CPUState *env, uint32_t cap); +#endif + /*! * \brief Simulate an external vectored interrupt *