On 09.12.2011, at 12:23, Carsten Otte wrote: > This patch introduces a new config option for user controlled kernel > virtual machines. It introduces an optional parameter to > KVM_CREATE_VM in order to create a user controlled virtual machine. > The parameter is passed to kvm_arch_init_vm for all architectures. > Valid values for the new parameter are KVM_VM_REGULAR (defined to 0 > for backward compatibility to old KVM_CREATE_VM) and > KVM_VM_UCONTROL for s390 only. > Note that the user controlled virtual machines require CAP_SYS_ADMIN > privileges. > > Signed-off-by: Carsten Otte <cotte@xxxxxxxxxx> > --- > --- > Documentation/virtual/kvm/api.txt | 7 ++++++- > arch/ia64/kvm/kvm-ia64.c | 5 ++++- > arch/powerpc/kvm/powerpc.c | 5 ++++- > arch/s390/kvm/Kconfig | 9 +++++++++ > arch/s390/kvm/kvm-s390.c | 30 +++++++++++++++++++++++++----- > arch/s390/kvm/kvm-s390.h | 10 ++++++++++ > arch/x86/kvm/x86.c | 5 ++++- > include/linux/kvm.h | 3 +++ > include/linux/kvm_host.h | 2 +- > virt/kvm/kvm_main.c | 19 +++++++++++++------ > 10 files changed, 79 insertions(+), 16 deletions(-) > > --- a/Documentation/virtual/kvm/api.txt > +++ b/Documentation/virtual/kvm/api.txt > @@ -95,7 +95,7 @@ described as 'basic' will be available. > Capability: basic > Architectures: all > Type: system ioctl > -Parameters: none > +Parameters: machine type identifier (KVM_VM_*) > Returns: a VM fd that can be used to control the new virtual machine. > > The new VM has no virtual cpus and no memory. An mmap() of a VM fd > @@ -103,6 +103,11 @@ will access the virtual machine's physic > corresponds to guest physical address zero. Use of mmap() on a VM fd > is discouraged if userspace memory allocation (KVM_CAP_USER_MEMORY) is > available. > +You most certainly want to use KVM_VM_REGULAR as machine type. > + > +In order to create user controlled virtual machines on S390, check > +KVM_CAP_UCONTROL KVM_S390_CAP_UCONTROL > and use KVM_VM_UCONTROL as machine type as > +privileged user (CAP_SYS_ADMIN). Why not KVM_ENABLE_CAP(KVM_S390_CAP_UCONTROL)? It doesn't look like you can't switch from kernel-controlled to user controlled mode during runtime. All you need to do is remove the gmap again and you should be fine, no? We do something similar on PPC where we just call ENABLE_CAP to switch to PAPR mode. If otherwise too difficult you can for example also define that the ENABLE_CAP has to happen before your first VCPU_RUN. Alex -- 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