Re: [PATCH v4 05/15] KVM: s390: move pv gmap functions into kvm

Christoph Schlameuss
2025-01-27T08:06:58Z

With below nit fixed:

Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>

On Thu Jan 23, 2025 at 3:46 PM CET, Claudio Imbrenda wrote:
> Move gmap related functions from kernel/uv into kvm.
>
> Create a new file to collect gmap-related functions.
>
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> arch/s390/include/asm/gmap.h | 1 +
> arch/s390/include/asm/uv.h | 6 +-
> arch/s390/kernel/uv.c | 292 ++++-------------------------------
> arch/s390/kvm/Makefile | 2 +-
> arch/s390/kvm/gmap.c | 209 +++++++++++++++++++++++++
> arch/s390/kvm/gmap.h | 17 ++
> arch/s390/kvm/intercept.c | 1 +
> arch/s390/kvm/kvm-s390.c | 1 +
> arch/s390/kvm/pv.c | 1 +
> arch/s390/mm/gmap.c | 28 ++++
> 10 files changed, 291 insertions(+), 267 deletions(-)
> create mode 100644 arch/s390/kvm/gmap.c
> create mode 100644 arch/s390/kvm/gmap.h

[...]

> +int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)
> +{
> + struct kvm *kvm = gmap->private;
> + struct page *page;
> + int rc = 0;
> +
> + mmap_read_lock(gmap->mm);
> + scoped_guard(srcu, &kvm->srcu) {
> + page = gfn_to_page(kvm, gpa_to_gfn(gaddr));
> + }

nit: brackets are not desired for single line block

> + if (page)
> + rc = __gmap_make_secure(gmap, page, uvcb);
> + kvm_release_page_clean(page);
> + mmap_read_unlock(gmap->mm);
> +
> + return rc;
> +} …