On 12/01/2011 02:57 PM, Carsten Otte wrote: > This patch introduces a new config option for user controlled kernel > virtual machines. It introduces a new ioctl named > KVM_S390_ENABLE_UCONTROL on the kvm file descriptor which allows for > a one way transition from a regular kernel virtual machine to a > user controlled virtual machine. The virtual machine must not have > any memory slots installed, and no virtual cpus defined. > Note that the user controlled virtual machines require CAP_SYS_ADMIN > privileges. > > Signed-off-by: Carsten Otte <cotte@xxxxxxxxxx> > --- > --- > arch/s390/kvm/Kconfig | 9 +++++++++ > arch/s390/kvm/kvm-s390.c | 30 ++++++++++++++++++++++++++++++ > arch/s390/kvm/kvm-s390.h | 10 ++++++++++ > include/linux/kvm.h | 3 +++ > 4 files changed, 52 insertions(+) Documentation/virtual/kvm/api.txt +++++++++++++++++++ > > +int kvm_s390_enable_ucontrol(struct kvm *kvm) > +{ > +#ifdef CONFIG_KVM_UCONTROL > + int i; > + > + if (!capable(CAP_SYS_ADMIN)) > + return -EPERM; > + > + for (i = 0; i < KVM_MAX_VCPUS; i++) > + if (kvm->vcpus[i]) > + return -EINVAL; > + > + if (kvm->memslots->nmemslots) > + return -EPERM; Why different errors? > + > + if (kvm->arch.gmap) > + gmap_free(kvm->arch.gmap); > + > + kvm->arch.gmap = NULL; Locking? What happens if a vcpu is created afterwards? I guess you don't mind too much since this is a privileged interface for a single purpose. > --- a/include/linux/kvm.h > +++ b/include/linux/kvm.h > @@ -654,6 +654,9 @@ struct kvm_clock_data { > struct kvm_userspace_memory_region) > #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) > #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) > +/* enable ucontrol for s390 */ > +#define KVM_S390_ENABLE_UCONTROL _IO(KVMIO, 0x49) > + > /* Device model IOC */ > #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) > #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) > #define KVM_CAP_S390_UCONTROL -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html