diff options
| author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2012-12-20 09:32:11 -0500 |
|---|---|---|
| committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-01-07 16:53:42 -0500 |
| commit | d6712df95bcfea597fc3ea2405ec13e8b69a7b8c (patch) | |
| tree | 5079dabfbf47e1d43af960248e93193e768d02bc | |
| parent | f379aae558b8daff0f7a1c5fc225af5d35c741f7 (diff) | |
KVM: s390: Base infrastructure for enabling capabilities.
Make s390 support KVM_ENABLE_CAP.
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| -rw-r--r-- | Documentation/virtual/kvm/api.txt | 2 | ||||
| -rw-r--r-- | arch/s390/kvm/kvm-s390.c | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 8a0de309932f..73bd159c5559 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt | |||
| @@ -913,7 +913,7 @@ documentation when it pops into existence). | |||
| 913 | 4.37 KVM_ENABLE_CAP | 913 | 4.37 KVM_ENABLE_CAP |
| 914 | 914 | ||
| 915 | Capability: KVM_CAP_ENABLE_CAP | 915 | Capability: KVM_CAP_ENABLE_CAP |
| 916 | Architectures: ppc | 916 | Architectures: ppc, s390 |
| 917 | Type: vcpu ioctl | 917 | Type: vcpu ioctl |
| 918 | Parameters: struct kvm_enable_cap (in) | 918 | Parameters: struct kvm_enable_cap (in) |
| 919 | Returns: 0 on success; -1 on error | 919 | Returns: 0 on success; -1 on error |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index f718bc65835c..5ff26033825c 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
| @@ -140,6 +140,7 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
| 140 | #endif | 140 | #endif |
| 141 | case KVM_CAP_SYNC_REGS: | 141 | case KVM_CAP_SYNC_REGS: |
| 142 | case KVM_CAP_ONE_REG: | 142 | case KVM_CAP_ONE_REG: |
| 143 | case KVM_CAP_ENABLE_CAP: | ||
| 143 | r = 1; | 144 | r = 1; |
| 144 | break; | 145 | break; |
| 145 | case KVM_CAP_NR_VCPUS: | 146 | case KVM_CAP_NR_VCPUS: |
| @@ -808,6 +809,22 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr) | |||
| 808 | return 0; | 809 | return 0; |
| 809 | } | 810 | } |
| 810 | 811 | ||
| 812 | static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, | ||
| 813 | struct kvm_enable_cap *cap) | ||
| 814 | { | ||
| 815 | int r; | ||
| 816 | |||
| 817 | if (cap->flags) | ||
| 818 | return -EINVAL; | ||
| 819 | |||
| 820 | switch (cap->cap) { | ||
| 821 | default: | ||
| 822 | r = -EINVAL; | ||
| 823 | break; | ||
| 824 | } | ||
| 825 | return r; | ||
| 826 | } | ||
| 827 | |||
| 811 | long kvm_arch_vcpu_ioctl(struct file *filp, | 828 | long kvm_arch_vcpu_ioctl(struct file *filp, |
| 812 | unsigned int ioctl, unsigned long arg) | 829 | unsigned int ioctl, unsigned long arg) |
| 813 | { | 830 | { |
| @@ -894,6 +911,15 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
| 894 | r = 0; | 911 | r = 0; |
| 895 | break; | 912 | break; |
| 896 | } | 913 | } |
| 914 | case KVM_ENABLE_CAP: | ||
| 915 | { | ||
| 916 | struct kvm_enable_cap cap; | ||
| 917 | r = -EFAULT; | ||
| 918 | if (copy_from_user(&cap, argp, sizeof(cap))) | ||
| 919 | break; | ||
| 920 | r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); | ||
| 921 | break; | ||
| 922 | } | ||
| 897 | default: | 923 | default: |
| 898 | r = -ENOTTY; | 924 | r = -ENOTTY; |
| 899 | } | 925 | } |
