summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Imbrenda <imbrenda@linux.ibm.com>2026-04-02 18:01:32 +0300
committerClaudio Imbrenda <imbrenda@linux.ibm.com>2026-04-07 18:07:22 +0300
commit06a20c3ab6042ea7f9927fbeb50aa4e79894c136 (patch)
tree301cca8942291e3c970d106211387cdf5688cb9b
parent4204067f99820eda590ab99ae068463b4f930a33 (diff)
downloadlinux-06a20c3ab6042ea7f9927fbeb50aa4e79894c136.tar.xz
KVM: s390: Allow 4k granularity for memslots
Until now memslots on s390 needed to have 1M granularity and be 1M aligned. Since the new gmap code can handle memslots with 4k granularity and alignment, remove the restrictions. Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
-rw-r--r--arch/s390/kvm/kvm-s390.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index a583c0a00efd..156878c95e06 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -5642,8 +5642,6 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *new,
enum kvm_mr_change change)
{
- gpa_t size;
-
if (kvm_is_ucontrol(kvm) && new->id < KVM_USER_MEM_SLOTS)
return -EINVAL;
@@ -5653,20 +5651,14 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
if (change != KVM_MR_DELETE && change != KVM_MR_FLAGS_ONLY) {
/*
- * A few sanity checks. We can have memory slots which have to be
- * located/ended at a segment boundary (1MB). The memory in userland is
- * ok to be fragmented into various different vmas. It is okay to mmap()
- * and munmap() stuff in this slot after doing this call at any time
+ * A few sanity checks. The memory in userland is ok to be
+ * fragmented into various different vmas. It is okay to mmap()
+ * and munmap() stuff in this slot after doing this call at any
+ * time.
*/
-
- if (new->userspace_addr & 0xffffful)
+ if (new->userspace_addr & ~PAGE_MASK)
return -EINVAL;
-
- size = new->npages * PAGE_SIZE;
- if (size & 0xffffful)
- return -EINVAL;
-
- if ((new->base_gfn * PAGE_SIZE) + size > kvm->arch.mem_limit)
+ if ((new->base_gfn + new->npages) * PAGE_SIZE > kvm->arch.mem_limit)
return -EINVAL;
}