From patchwork Tue Feb 25 17:25:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 3718001 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D0F7DBF13A for ; Tue, 25 Feb 2014 17:25:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0582A201E4 for ; Tue, 25 Feb 2014 17:25:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1FB7D201BA for ; Tue, 25 Feb 2014 17:25:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753458AbaBYRZu (ORCPT ); Tue, 25 Feb 2014 12:25:50 -0500 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:40261 "EHLO e06smtp15.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753384AbaBYRZg (ORCPT ); Tue, 25 Feb 2014 12:25:36 -0500 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Feb 2014 17:25:34 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 25 Feb 2014 17:25:32 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 1567D1B0807A; Tue, 25 Feb 2014 17:25:12 +0000 (GMT) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s1PHPJdX3080492; Tue, 25 Feb 2014 17:25:19 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s1PHPU6L020446; Tue, 25 Feb 2014 10:25:31 -0700 Received: from gondolin.boeblingen.de.ibm.com (dyn-9-152-224-49.boeblingen.de.ibm.com [9.152.224.49]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s1PHPQN6020319; Tue, 25 Feb 2014 10:25:30 -0700 From: Cornelia Huck To: kvm@vger.kernel.org, linux-s390@vger.kernel.org, qemu-devel@nongnu.org Cc: borntraeger@de.ibm.com, agraf@suse.de, pbonzini@redhat.com, gleb@kernel.org, Cornelia Huck Subject: [PATCH 3/6] kvm: add kvm_enable_cap_{vm,vcpu} Date: Tue, 25 Feb 2014 18:25:17 +0100 Message-Id: <1393349120-18228-4-git-send-email-cornelia.huck@de.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1393349120-18228-1-git-send-email-cornelia.huck@de.ibm.com> References: <1393349120-18228-1-git-send-email-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14022517-0342-0000-0000-000007ECB278 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Provide helper functions for enabling capabilities (on a vcpu and on a vm). Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- include/sysemu/kvm.h | 4 ++++ kvm-all.c | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 3b25f27..9d2df88 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -272,6 +272,10 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cpu); int kvm_check_extension(KVMState *s, unsigned int extension); +int kvm_enable_cap_vm(KVMState *s, unsigned int capability); + +int kvm_enable_cap_vcpu(CPUState *cpu, unsigned int capability); + uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function, uint32_t index, int reg); diff --git a/kvm-all.c b/kvm-all.c index 2ca9143..6e6a804 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -499,7 +499,24 @@ int kvm_check_extension(KVMState *s, unsigned int extension) return ret; } -static int kvm_set_ioeventfd_mmio(int fd, hwaddr addr, uint32_t val, +int kvm_enable_cap_vm(KVMState *s, unsigned int capability) +{ + struct kvm_enable_cap cap = {}; + + cap.cap = capability; + return kvm_vm_ioctl(s, KVM_ENABLE_CAP, &cap); +} + +int kvm_enable_cap_vcpu(CPUState *cpu, unsigned int capability) +{ + struct kvm_enable_cap cap = {}; + + cap.cap = capability; + return kvm_vcpu_ioctl(cpu, KVM_ENABLE_CAP, &cap); +} + + +static int kvm_set_ioeventfd_mmio(int fd, uint32_t addr, uint32_t val, bool assign, uint32_t size, bool datamatch) { int ret;