diff options
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/hypfs/inode.c | 42 | ||||
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 26 | ||||
-rw-r--r-- | arch/s390/kvm/kvm-s390.h | 10 |
3 files changed, 37 insertions, 41 deletions
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index 341aff2687a5..cd128b07beda 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c | |||
@@ -288,46 +288,30 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent) | |||
288 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; | 288 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; |
289 | sb->s_magic = HYPFS_MAGIC; | 289 | sb->s_magic = HYPFS_MAGIC; |
290 | sb->s_op = &hypfs_s_ops; | 290 | sb->s_op = &hypfs_s_ops; |
291 | if (hypfs_parse_options(data, sb)) { | 291 | if (hypfs_parse_options(data, sb)) |
292 | rc = -EINVAL; | 292 | return -EINVAL; |
293 | goto err_alloc; | ||
294 | } | ||
295 | root_inode = hypfs_make_inode(sb, S_IFDIR | 0755); | 293 | root_inode = hypfs_make_inode(sb, S_IFDIR | 0755); |
296 | if (!root_inode) { | 294 | if (!root_inode) |
297 | rc = -ENOMEM; | 295 | return -ENOMEM; |
298 | goto err_alloc; | ||
299 | } | ||
300 | root_inode->i_op = &simple_dir_inode_operations; | 296 | root_inode->i_op = &simple_dir_inode_operations; |
301 | root_inode->i_fop = &simple_dir_operations; | 297 | root_inode->i_fop = &simple_dir_operations; |
302 | root_dentry = d_alloc_root(root_inode); | 298 | sb->s_root = root_dentry = d_alloc_root(root_inode); |
303 | if (!root_dentry) { | 299 | if (!root_dentry) { |
304 | iput(root_inode); | 300 | iput(root_inode); |
305 | rc = -ENOMEM; | 301 | return -ENOMEM; |
306 | goto err_alloc; | ||
307 | } | 302 | } |
308 | if (MACHINE_IS_VM) | 303 | if (MACHINE_IS_VM) |
309 | rc = hypfs_vm_create_files(sb, root_dentry); | 304 | rc = hypfs_vm_create_files(sb, root_dentry); |
310 | else | 305 | else |
311 | rc = hypfs_diag_create_files(sb, root_dentry); | 306 | rc = hypfs_diag_create_files(sb, root_dentry); |
312 | if (rc) | 307 | if (rc) |
313 | goto err_tree; | 308 | return rc; |
314 | sbi->update_file = hypfs_create_update_file(sb, root_dentry); | 309 | sbi->update_file = hypfs_create_update_file(sb, root_dentry); |
315 | if (IS_ERR(sbi->update_file)) { | 310 | if (IS_ERR(sbi->update_file)) |
316 | rc = PTR_ERR(sbi->update_file); | 311 | return PTR_ERR(sbi->update_file); |
317 | goto err_tree; | ||
318 | } | ||
319 | hypfs_update_update(sb); | 312 | hypfs_update_update(sb); |
320 | sb->s_root = root_dentry; | ||
321 | pr_info("Hypervisor filesystem mounted\n"); | 313 | pr_info("Hypervisor filesystem mounted\n"); |
322 | return 0; | 314 | return 0; |
323 | |||
324 | err_tree: | ||
325 | hypfs_delete_tree(root_dentry); | ||
326 | d_genocide(root_dentry); | ||
327 | dput(root_dentry); | ||
328 | err_alloc: | ||
329 | kfree(sbi); | ||
330 | return rc; | ||
331 | } | 315 | } |
332 | 316 | ||
333 | static int hypfs_get_super(struct file_system_type *fst, int flags, | 317 | static int hypfs_get_super(struct file_system_type *fst, int flags, |
@@ -340,12 +324,12 @@ static void hypfs_kill_super(struct super_block *sb) | |||
340 | { | 324 | { |
341 | struct hypfs_sb_info *sb_info = sb->s_fs_info; | 325 | struct hypfs_sb_info *sb_info = sb->s_fs_info; |
342 | 326 | ||
343 | if (sb->s_root) { | 327 | if (sb->s_root) |
344 | hypfs_delete_tree(sb->s_root); | 328 | hypfs_delete_tree(sb->s_root); |
329 | if (sb_info->update_file) | ||
345 | hypfs_remove(sb_info->update_file); | 330 | hypfs_remove(sb_info->update_file); |
346 | kfree(sb->s_fs_info); | 331 | kfree(sb->s_fs_info); |
347 | sb->s_fs_info = NULL; | 332 | sb->s_fs_info = NULL; |
348 | } | ||
349 | kill_litter_super(sb); | 333 | kill_litter_super(sb); |
350 | } | 334 | } |
351 | 335 | ||
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 */ |