···94389438depending on which executed at the time of an exit. Userspace must94399439take care to differentiate between these cases.9440944094419441+8.47 KVM_CAP_S390_VSIE_ESAMODE94429442+------------------------------94439443+94449444+:Architectures: s39094459445+94469446+The presence of this capability indicates that the nested KVM guest can94479447+start in ESA mode.94489448+944194499. Known KVM API problems94429450=========================94439451
+1
arch/s390/include/asm/kvm_host.h
···656656 int user_stsi;657657 int user_instr0;658658 int user_operexec;659659+ int allow_vsie_esamode;659660 struct s390_io_adapter *adapters[MAX_S390_IO_ADAPTERS];660661 wait_queue_head_t ipte_wq;661662 int ipte_lock_count;
···629629 case KVM_CAP_IRQFD_RESAMPLE:630630 case KVM_CAP_S390_USER_OPEREXEC:631631 case KVM_CAP_S390_KEYOP:632632+ case KVM_CAP_S390_VSIE_ESAMODE:632633 r = 1;633634 break;634635 case KVM_CAP_SET_GUEST_DEBUG2:···925924 VM_EVENT(kvm, 3, "%s", "ENABLE: CAP_S390_USER_OPEREXEC");926925 kvm->arch.user_operexec = 1;927926 icpt_operexc_on_all_vcpus(kvm);927927+ r = 0;928928+ break;929929+ case KVM_CAP_S390_VSIE_ESAMODE:930930+ VM_EVENT(kvm, 3, "%s", "ENABLE: CAP_S390_VSIE_ESAMODE");931931+ kvm->arch.allow_vsie_esamode = 1;928932 r = 0;929933 break;930934 default:···56545648 struct kvm_memory_slot *new,56555649 enum kvm_mr_change change)56565650{56575657- gpa_t size;56585658-56595659- if (kvm_is_ucontrol(kvm) && new->id < KVM_USER_MEM_SLOTS)56515651+ if (kvm_is_ucontrol(kvm) && new && new->id < KVM_USER_MEM_SLOTS)56605652 return -EINVAL;5661565356625654 /* When we are protected, we should not change the memory slots */···5663565956645660 if (change != KVM_MR_DELETE && change != KVM_MR_FLAGS_ONLY) {56655661 /*56665666- * A few sanity checks. We can have memory slots which have to be56675667- * located/ended at a segment boundary (1MB). The memory in userland is56685668- * ok to be fragmented into various different vmas. It is okay to mmap()56695669- * and munmap() stuff in this slot after doing this call at any time56625662+ * A few sanity checks. The memory in userland is ok to be56635663+ * fragmented into various different vmas. It is okay to mmap()56645664+ * and munmap() stuff in this slot after doing this call at any56655665+ * time.56705666 */56715671-56725672- if (new->userspace_addr & 0xffffful)56675667+ if (new->userspace_addr & ~PAGE_MASK)56735668 return -EINVAL;56745674-56755675- size = new->npages * PAGE_SIZE;56765676- if (size & 0xffffful)56775677- return -EINVAL;56785678-56795679- if ((new->base_gfn * PAGE_SIZE) + size > kvm->arch.mem_limit)56695669+ if ((new->base_gfn + new->npages) * PAGE_SIZE > kvm->arch.mem_limit)56805670 return -EINVAL;56815671 }56825672
···641641 }642642643643#ifdef __s390x__644644- /* Align to 1M (segment size) */645645- guest_test_phys_mem = align_down(guest_test_phys_mem, 1 << 20);646646-647644 /*648645 * The workaround in guest_code() to write all pages prior to the first649646 * iteration isn't compatible with the dirty ring, as the dirty ring
-4
tools/testing/selftests/kvm/include/kvm_util.h
···11271127{11281128 unsigned int n;11291129 n = vm_num_guest_pages(mode, vm_num_host_pages(mode, num_guest_pages));11301130-#ifdef __s390x__11311131- /* s390 requires 1M aligned guest sizes */11321132- n = (n + 255) & ~255;11331133-#endif11341130 return n;11351131}11361132
-3
tools/testing/selftests/kvm/kvm_page_table_test.c
···261261 guest_page_size;262262 else263263 guest_test_phys_mem = p->phys_offset;264264-#ifdef __s390x__265265- alignment = max(0x100000UL, alignment);266266-#endif267264 guest_test_phys_mem = align_down(guest_test_phys_mem, alignment);268265269266 /* Set up the shared data structure test_args */
+1-8
tools/testing/selftests/kvm/lib/kvm_util.c
···985985 struct userspace_mem_region *region;986986 size_t backing_src_pagesz = get_backing_src_pagesz(src_type);987987 size_t mem_size = npages * vm->page_size;988988- size_t alignment;988988+ size_t alignment = 1;989989990990 TEST_REQUIRE_SET_USER_MEMORY_REGION2();991991···10381038 region = calloc(1, sizeof(*region));10391039 TEST_ASSERT(region != NULL, "Insufficient Memory");10401040 region->mmap_size = mem_size;10411041-10421042-#ifdef __s390x__10431043- /* On s390x, the host address must be aligned to 1M (due to PGSTEs) */10441044- alignment = 0x100000;10451045-#else10461046- alignment = 1;10471047-#endif1048104110491042 /*10501043 * When using THP mmap is not guaranteed to returned a hugepage aligned