diff options
Diffstat (limited to 'arch/s390/kvm/kvm-s390.c')
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 4cf35a0a79e7..c1c7c683fa26 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -142,12 +142,16 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
142 | case KVM_CAP_ONE_REG: | 142 | case KVM_CAP_ONE_REG: |
143 | case KVM_CAP_ENABLE_CAP: | 143 | case KVM_CAP_ENABLE_CAP: |
144 | case KVM_CAP_S390_CSS_SUPPORT: | 144 | case KVM_CAP_S390_CSS_SUPPORT: |
145 | case KVM_CAP_IOEVENTFD: | ||
145 | r = 1; | 146 | r = 1; |
146 | break; | 147 | break; |
147 | case KVM_CAP_NR_VCPUS: | 148 | case KVM_CAP_NR_VCPUS: |
148 | case KVM_CAP_MAX_VCPUS: | 149 | case KVM_CAP_MAX_VCPUS: |
149 | r = KVM_MAX_VCPUS; | 150 | r = KVM_MAX_VCPUS; |
150 | break; | 151 | break; |
152 | case KVM_CAP_NR_MEMSLOTS: | ||
153 | r = KVM_USER_MEM_SLOTS; | ||
154 | break; | ||
151 | case KVM_CAP_S390_COW: | 155 | case KVM_CAP_S390_COW: |
152 | r = MACHINE_HAS_ESOP; | 156 | r = MACHINE_HAS_ESOP; |
153 | break; | 157 | break; |
@@ -632,8 +636,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) | |||
632 | } else { | 636 | } else { |
633 | VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction"); | 637 | VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction"); |
634 | trace_kvm_s390_sie_fault(vcpu); | 638 | trace_kvm_s390_sie_fault(vcpu); |
635 | kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 639 | rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
636 | rc = 0; | ||
637 | } | 640 | } |
638 | } | 641 | } |
639 | VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", | 642 | VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", |
@@ -974,22 +977,13 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) | |||
974 | /* Section: memory related */ | 977 | /* Section: memory related */ |
975 | int kvm_arch_prepare_memory_region(struct kvm *kvm, | 978 | int kvm_arch_prepare_memory_region(struct kvm *kvm, |
976 | struct kvm_memory_slot *memslot, | 979 | struct kvm_memory_slot *memslot, |
977 | struct kvm_memory_slot old, | ||
978 | struct kvm_userspace_memory_region *mem, | 980 | struct kvm_userspace_memory_region *mem, |
979 | bool user_alloc) | 981 | enum kvm_mr_change change) |
980 | { | 982 | { |
981 | /* A few sanity checks. We can have exactly one memory slot which has | 983 | /* A few sanity checks. We can have memory slots which have to be |
982 | to start at guest virtual zero and which has to be located at a | 984 | located/ended at a segment boundary (1MB). The memory in userland is |
983 | page boundary in userland and which has to end at a page boundary. | 985 | ok to be fragmented into various different vmas. It is okay to mmap() |
984 | The memory in userland is ok to be fragmented into various different | 986 | and munmap() stuff in this slot after doing this call at any time */ |
985 | vmas. It is okay to mmap() and munmap() stuff in this slot after | ||
986 | doing this call at any time */ | ||
987 | |||
988 | if (mem->slot) | ||
989 | return -EINVAL; | ||
990 | |||
991 | if (mem->guest_phys_addr) | ||
992 | return -EINVAL; | ||
993 | 987 | ||
994 | if (mem->userspace_addr & 0xffffful) | 988 | if (mem->userspace_addr & 0xffffful) |
995 | return -EINVAL; | 989 | return -EINVAL; |
@@ -997,19 +991,26 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, | |||
997 | if (mem->memory_size & 0xffffful) | 991 | if (mem->memory_size & 0xffffful) |
998 | return -EINVAL; | 992 | return -EINVAL; |
999 | 993 | ||
1000 | if (!user_alloc) | ||
1001 | return -EINVAL; | ||
1002 | |||
1003 | return 0; | 994 | return 0; |
1004 | } | 995 | } |
1005 | 996 | ||
1006 | void kvm_arch_commit_memory_region(struct kvm *kvm, | 997 | void kvm_arch_commit_memory_region(struct kvm *kvm, |
1007 | struct kvm_userspace_memory_region *mem, | 998 | struct kvm_userspace_memory_region *mem, |
1008 | struct kvm_memory_slot old, | 999 | const struct kvm_memory_slot *old, |
1009 | bool user_alloc) | 1000 | enum kvm_mr_change change) |
1010 | { | 1001 | { |
1011 | int rc; | 1002 | int rc; |
1012 | 1003 | ||
1004 | /* If the basics of the memslot do not change, we do not want | ||
1005 | * to update the gmap. Every update causes several unnecessary | ||
1006 | * segment translation exceptions. This is usually handled just | ||
1007 | * fine by the normal fault handler + gmap, but it will also | ||
1008 | * cause faults on the prefix page of running guest CPUs. | ||
1009 | */ | ||
1010 | if (old->userspace_addr == mem->userspace_addr && | ||
1011 | old->base_gfn * PAGE_SIZE == mem->guest_phys_addr && | ||
1012 | old->npages * PAGE_SIZE == mem->memory_size) | ||
1013 | return; | ||
1013 | 1014 | ||
1014 | rc = gmap_map_segment(kvm->arch.gmap, mem->userspace_addr, | 1015 | rc = gmap_map_segment(kvm->arch.gmap, mem->userspace_addr, |
1015 | mem->guest_phys_addr, mem->memory_size); | 1016 | mem->guest_phys_addr, mem->memory_size); |