linux/arch/s390/kvm
Jaehoon Kim 9972befc3e KVM: s390: Fall back to short-term pinning in MAP ioctl
FOLL_LONGTERM pinning fails for some memory types, such as file-backed
guest memory. As a result, kvm_s390_adapter_map() returns -EINVAL and
irqfd adapter registration fails even though interrupt delivery could
still work via the existing non-atomic path.

When FOLL_LONGTERM pinning fails, verify that the page is accessible
using a short-term pin instead. If the short-term pin succeeds, unpin
the page and add a map entry with pinned=false to preserve MAP/UNMAP
symmetry. The non-atomic irqfd path already performs short-term pinning
for interrupt delivery, so this restores the previous behavior for
memory that cannot be pinned long-term.

get_map_info() is updated to return NULL for unpinned entries so that
the atomic irqfd fast path falls back to the non-atomic path.
kvm_s390_adapter_unmap() and kvm_s390_unmap_all_adapters() skip dirty
marking and unpin for unpinned entries.

Update Documentation/virt/kvm/devices/s390_flic.rst to reflect the
new MAP/UNMAP behavior.

Fixes: c9a5688380 ("KVM: s390: Add map/unmap ioctl and clean mappings post-guest")
Signed-off-by: Jaehoon Kim <jhkim@linux.ibm.com>
Reviewed-by: Douglas Freimuth <freimuth@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
2026-07-27 09:23:53 +02:00
..
dat.c KVM: s390: Fix dat_crste_walk_range() early return 2026-07-09 10:26:10 +02:00
dat.h KVM: s390: New features for 7.2 2026-06-15 15:36:43 +02:00
diag.c KVM: s390: Switch to new gmap 2026-02-04 17:00:10 +01:00
faultin.c KVM: s390: Fix possible reference leak in fault-in code 2026-06-02 19:29:33 +02:00
faultin.h KVM: s390: Add helper functions for fault handling 2026-02-04 17:00:09 +01:00
gaccess.c KVM: s390: vsie: Use mmu cache to allocate rmap 2026-06-11 13:50:09 +02:00
gaccess.h KVM: s390: Switch to new gmap 2026-02-04 17:00:10 +01:00
gmap.c KVM: s390: vsie: Avoid potential deadlock with real spaces 2026-07-09 10:26:10 +02:00
gmap.h KVM: s390: Fix S390_USER_OPEREXEC and more gmap fixes 2026-06-24 13:41:41 +02:00
guestdbg.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
intercept.c KVM: s390: Introducing kvm_arch_set_irq_inatomic fast inject 2026-06-15 14:18:37 +02:00
interrupt.c KVM: s390: Fall back to short-term pinning in MAP ioctl 2026-07-27 09:23:53 +02:00
Kconfig KVM: s390: Implement KVM_PRE_FAULT_MEMORY 2026-05-28 13:05:53 +02:00
kvm-s390.c KVM: s390: Improve kvm_s390_vm_stop_migration() 2026-07-09 10:26:10 +02:00
kvm-s390.h KVM: s390: Introducing kvm_arch_set_irq_inatomic fast inject 2026-06-15 14:18:37 +02:00
Makefile KVM: s390: Switch to new gmap 2026-02-04 17:00:10 +01:00
pci.c KVM: s390: pci: Validate AIBV and AISB before pinning guest pages 2026-07-24 11:26:54 +02:00
pci.h KVM: s390: pci: Fix memory accounting for pinned/unpinned pages 2026-07-24 11:26:53 +02:00
priv.c KVM: s390: Fix cmma dirty tracking 2026-06-24 10:08:57 +02:00
pv.c KVM: s390: New features for 7.2 2026-06-15 15:36:43 +02:00
sigp.c KVM: s390: Refactor kvm_is_error_gpa() into kvm_is_gpa_in_memslot() 2024-02-20 07:37:45 -08:00
trace-s390.h KVM: s390: Don't use %pK through tracepoints 2025-03-17 08:55:46 +00:00
trace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vsie.c KVM: s390: vsie: Implement ASTFLEIE facility 2 2026-06-12 15:13:30 +02:00