From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 13/15] KVM: Add support for enabling capabilities per-vcpu Date: Tue, 09 Mar 2010 14:56:51 +0200 Message-ID: <4B964593.1020406@redhat.com> References: <1268071402-27112-1-git-send-email-agraf@suse.de> <1268071402-27112-14-git-send-email-agraf@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org To: Alexander Graf Return-path: Received: from mx1.redhat.com ([209.132.183.28]:5380 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752Ab0CIM45 (ORCPT ); Tue, 9 Mar 2010 07:56:57 -0500 In-Reply-To: <1268071402-27112-14-git-send-email-agraf@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: On 03/08/2010 08:03 PM, Alexander Graf wrote: > Some times we don't want all capabilities to be available to all > our vcpus. One example for that is the OSI interface, implemented > in the next patch. > > In order to have a generic mechanism in how to enable capabilities > individually, this patch introduces a new ioctl that can be used > for this purpose. That way features we don't want in all guests or > userspace configurations can just not be enabled and we're good. > > > diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt > index d170cb4..6a19ab6 100644 > --- a/Documentation/kvm/api.txt > +++ b/Documentation/kvm/api.txt > @@ -749,6 +749,21 @@ Writes debug registers into the vcpu. > See KVM_GET_DEBUGREGS for the data structure. The flags field is unused > yet and must be cleared on entry. > > +4.34 KVM_ENABLE_CAP > + > +Capability: basic > Capability: basic means that the feature was present in 2.6.22. Otherwise you need to specify the KVM_CAP_ that presents this feature. > +Architectures: all > > But it's implemented for ppc only (other arches will get ENOTTY). > +Not all extensions are enabled by default. Using this ioctl the application > +can enable an extension, making it available to the guest. > + > +On systems that do not support this ioctl, it always fails. On systems that > +do support it, it only works for extensions that are supported for enablement. > +As of writing this the only enablement enabled extenion is KVM_CAP_PPC_OSI. > That needs to be documented. It also needs to be discoverable separately - we can have a kernel with KVM_ENABLE_CAP but without KVM_CAP_PPC_OSI. btw, KVM_CAP_PPC_OSI conflicts with the KVM_CAP_ namespace. Please choose another namespace. Need to document the structure fields. > > /* > @@ -696,6 +705,8 @@ struct kvm_clock_data { > /* Available with KVM_CAP_DEBUGREGS */ > #define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs) > #define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs) > +/* No need for CAP, because then it just always fails */ > +#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap) > The CAPs are needed so you can discover what you have without running guests. -- error compiling committee.c: too many arguments to function