Re: [PATCH v3 09/15] KVM: s390: move some gmap shadowing functions away from mm/gmap.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/17/25 8:09 PM, Claudio Imbrenda wrote:
Move some gmap shadowing functions from mm/gmap.c to kvm/kvm-s390.c and
the newly created kvm/gmap-vsie.c

This is a step toward removing gmap from mm.

Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
---
  arch/s390/include/asm/gmap.h |   9 +-
  arch/s390/kvm/Makefile       |   2 +-
  arch/s390/kvm/gmap-vsie.c    | 142 +++++++++++++++++++++
  arch/s390/kvm/gmap.h         |  20 +++
  arch/s390/kvm/kvm-s390.c     |  62 ++++++++-
  arch/s390/kvm/kvm-s390.h     |   2 +
  arch/s390/kvm/vsie.c         |   2 +
  arch/s390/mm/gmap.c          | 238 +++++------------------------------
  8 files changed, 259 insertions(+), 218 deletions(-)
  create mode 100644 arch/s390/kvm/gmap-vsie.c
[...]
  /**
   * gmap_get - increase reference counter for guest address space
@@ -958,86 +960,40 @@ static int gmap_protect_pte(struct gmap *gmap, unsigned long gaddr,
   * @prot: indicates access rights: PROT_NONE, PROT_READ or PROT_WRITE
   * @bits: pgste notification bits to set
   *
- * Returns 0 if successfully protected, -ENOMEM if out of memory and
- * -EFAULT if gaddr is invalid (or mapping for shadows is missing).
+ * Returns:
+ *   PAGE_SIZE if a small page was successfully protected;
+ *   HPAGE_SIZE if a large page was successfully protected;
+ *   -ENOMEM if out of memory;
+ *   -EFAULT if gaddr is invalid (or mapping for shadows is missing);
+ *   -EAGAIN if the guest mapping is missing and should be fixed by the caller.
   *
- * Called with sg->mm->mmap_lock in read.
+ * Context: Called with sg->mm->mmap_lock in read.
   */
-static int gmap_protect_range(struct gmap *gmap, unsigned long gaddr,
-			      unsigned long len, int prot, unsigned long bits)
+int gmap_protect_one(struct gmap *gmap, unsigned long gaddr, int prot, unsigned long bits)
  {

That's a lot nicer than the nested conditionals that we had before.

Reviewed-by: Janosch Frank <frankja@xxxxxxxxxxxxx>




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux