From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
borntraeger@de.ibm.com, frankja@linux.ibm.com, nrb@linux.ibm.com,
seiden@linux.ibm.com, schlameuss@linux.ibm.com,
gra@linux.ibm.com, david@kernel.org
Subject: [PATCH v3 3/6] KVM: s390: Allow 4k granularity for memslots
Date: Thu, 2 Apr 2026 17:01:32 +0200 [thread overview]
Message-ID: <20260402150135.196943-4-imbrenda@linux.ibm.com> (raw)
In-Reply-To: <20260402150135.196943-1-imbrenda@linux.ibm.com>
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.
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
---
arch/s390/kvm/kvm-s390.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index bc7d6fa66eaf..be2a721e2574 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -5636,8 +5636,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;
@@ -5647,20 +5645,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;
}
--
2.53.0
next prev parent reply other threads:[~2026-04-02 15:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 15:01 [PATCH v3 0/6] KVM: s390: Enable 4k granularity for memslots Claudio Imbrenda
2026-04-02 15:01 ` [PATCH v3 1/6] KVM: s390: Add some useful mask macros Claudio Imbrenda
2026-04-07 12:13 ` Steffen Eiden
2026-04-09 13:41 ` Christoph Schlameuss
2026-04-02 15:01 ` [PATCH v3 2/6] KVM: s390: Add alignment checks for hugepages Claudio Imbrenda
2026-04-07 12:30 ` Steffen Eiden
2026-04-10 9:15 ` Christoph Schlameuss
2026-04-02 15:01 ` Claudio Imbrenda [this message]
2026-04-07 12:33 ` [PATCH v3 3/6] KVM: s390: Allow 4k granularity for memslots Steffen Eiden
2026-04-10 10:02 ` Christoph Schlameuss
2026-04-02 15:01 ` [PATCH v3 4/6] KVM: selftests: Remove 1M alignment requirement for s390 Claudio Imbrenda
2026-04-07 12:44 ` Steffen Eiden
2026-04-10 11:28 ` Christoph Schlameuss
2026-04-02 15:01 ` [PATCH v3 5/6] KVM: s390: selftests: enable some common memory-related tests Claudio Imbrenda
2026-04-07 12:47 ` Steffen Eiden
2026-04-07 13:04 ` Claudio Imbrenda
2026-04-07 13:41 ` Steffen Eiden
2026-04-07 15:19 ` Steffen Eiden
2026-04-09 8:50 ` Claudio Imbrenda
2026-04-10 12:02 ` Christoph Schlameuss
2026-04-02 15:01 ` [PATCH v3 6/6] KVM: s390: ucontrol: Fix memslot handling Claudio Imbrenda
2026-04-07 12:55 ` Steffen Eiden
2026-04-07 13:05 ` Claudio Imbrenda
2026-04-10 9:25 ` Christoph Schlameuss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260402150135.196943-4-imbrenda@linux.ibm.com \
--to=imbrenda@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=david@kernel.org \
--cc=frankja@linux.ibm.com \
--cc=gra@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=schlameuss@linux.ibm.com \
--cc=seiden@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox