diff options
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 26 | ||||
-rw-r--r-- | arch/s390/kvm/kvm-s390.h | 10 |
2 files changed, 24 insertions, 12 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 3fa0a10e4668..49292869a5cd 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -242,6 +242,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm) | |||
242 | kvm_free_physmem(kvm); | 242 | kvm_free_physmem(kvm); |
243 | free_page((unsigned long)(kvm->arch.sca)); | 243 | free_page((unsigned long)(kvm->arch.sca)); |
244 | debug_unregister(kvm->arch.dbf); | 244 | debug_unregister(kvm->arch.dbf); |
245 | cleanup_srcu_struct(&kvm->srcu); | ||
245 | kfree(kvm); | 246 | kfree(kvm); |
246 | } | 247 | } |
247 | 248 | ||
@@ -690,14 +691,12 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
690 | } | 691 | } |
691 | 692 | ||
692 | /* Section: memory related */ | 693 | /* Section: memory related */ |
693 | int kvm_arch_set_memory_region(struct kvm *kvm, | 694 | int kvm_arch_prepare_memory_region(struct kvm *kvm, |
694 | struct kvm_userspace_memory_region *mem, | 695 | struct kvm_memory_slot *memslot, |
695 | struct kvm_memory_slot old, | 696 | struct kvm_memory_slot old, |
696 | int user_alloc) | 697 | struct kvm_userspace_memory_region *mem, |
698 | int user_alloc) | ||
697 | { | 699 | { |
698 | int i; | ||
699 | struct kvm_vcpu *vcpu; | ||
700 | |||
701 | /* A few sanity checks. We can have exactly one memory slot which has | 700 | /* A few sanity checks. We can have exactly one memory slot which has |
702 | to start at guest virtual zero and which has to be located at a | 701 | to start at guest virtual zero and which has to be located at a |
703 | page boundary in userland and which has to end at a page boundary. | 702 | page boundary in userland and which has to end at a page boundary. |
@@ -720,14 +719,23 @@ int kvm_arch_set_memory_region(struct kvm *kvm, | |||
720 | if (!user_alloc) | 719 | if (!user_alloc) |
721 | return -EINVAL; | 720 | return -EINVAL; |
722 | 721 | ||
722 | return 0; | ||
723 | } | ||
724 | |||
725 | void kvm_arch_commit_memory_region(struct kvm *kvm, | ||
726 | struct kvm_userspace_memory_region *mem, | ||
727 | struct kvm_memory_slot old, | ||
728 | int user_alloc) | ||
729 | { | ||
730 | int i; | ||
731 | struct kvm_vcpu *vcpu; | ||
732 | |||
723 | /* request update of sie control block for all available vcpus */ | 733 | /* request update of sie control block for all available vcpus */ |
724 | kvm_for_each_vcpu(i, vcpu, kvm) { | 734 | kvm_for_each_vcpu(i, vcpu, kvm) { |
725 | if (test_and_set_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests)) | 735 | if (test_and_set_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests)) |
726 | continue; | 736 | continue; |
727 | kvm_s390_inject_sigp_stop(vcpu, ACTION_RELOADVCPU_ON_STOP); | 737 | kvm_s390_inject_sigp_stop(vcpu, ACTION_RELOADVCPU_ON_STOP); |
728 | } | 738 | } |
729 | |||
730 | return 0; | ||
731 | } | 739 | } |
732 | 740 | ||
733 | void kvm_arch_flush_shadow(struct kvm *kvm) | 741 | void kvm_arch_flush_shadow(struct kvm *kvm) |
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h index 06cce8285ba0..60f09ab3672c 100644 --- a/arch/s390/kvm/kvm-s390.h +++ b/arch/s390/kvm/kvm-s390.h | |||
@@ -67,10 +67,14 @@ static inline long kvm_s390_vcpu_get_memsize(struct kvm_vcpu *vcpu) | |||
67 | 67 | ||
68 | static inline void kvm_s390_vcpu_set_mem(struct kvm_vcpu *vcpu) | 68 | static inline void kvm_s390_vcpu_set_mem(struct kvm_vcpu *vcpu) |
69 | { | 69 | { |
70 | int idx; | ||
70 | struct kvm_memory_slot *mem; | 71 | struct kvm_memory_slot *mem; |
72 | struct kvm_memslots *memslots; | ||
71 | 73 | ||
72 | down_read(&vcpu->kvm->slots_lock); | 74 | idx = srcu_read_lock(&vcpu->kvm->srcu); |
73 | mem = &vcpu->kvm->memslots[0]; | 75 | memslots = rcu_dereference(vcpu->kvm->memslots); |
76 | |||
77 | mem = &memslots->memslots[0]; | ||
74 | 78 | ||
75 | vcpu->arch.sie_block->gmsor = mem->userspace_addr; | 79 | vcpu->arch.sie_block->gmsor = mem->userspace_addr; |
76 | vcpu->arch.sie_block->gmslm = | 80 | vcpu->arch.sie_block->gmslm = |
@@ -78,7 +82,7 @@ static inline void kvm_s390_vcpu_set_mem(struct kvm_vcpu *vcpu) | |||
78 | (mem->npages << PAGE_SHIFT) + | 82 | (mem->npages << PAGE_SHIFT) + |
79 | VIRTIODESCSPACE - 1ul; | 83 | VIRTIODESCSPACE - 1ul; |
80 | 84 | ||
81 | up_read(&vcpu->kvm->slots_lock); | 85 | srcu_read_unlock(&vcpu->kvm->srcu, idx); |
82 | } | 86 | } |
83 | 87 | ||
84 | /* implemented in priv.c */ | 88 | /* implemented in priv.c */ |