Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c038e6b authored by Dominik Dingel's avatar Dominik Dingel Committed by Christian Borntraeger
Browse files

KVM: async_pf: Async page fault support on s390



This patch enables async page faults for s390 kvm guests.
It provides the userspace API to enable and disable_wait this feature.
The disable_wait will enforce that the feature is off by waiting on it.
Also it includes the diagnose code, called by the guest to enable async page faults.

The async page faults will use an already existing guest interface for this
purpose, as described in "CP Programming Services (SC24-6084)".

Signed-off-by: default avatarDominik Dingel <dingel@linux.vnet.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent 9f2ceda4
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@ FLIC provides support to
- add interrupts (KVM_DEV_FLIC_ENQUEUE)
- add interrupts (KVM_DEV_FLIC_ENQUEUE)
- inspect currently pending interrupts (KVM_FLIC_GET_ALL_IRQS)
- inspect currently pending interrupts (KVM_FLIC_GET_ALL_IRQS)
- purge all pending floating interrupts (KVM_DEV_FLIC_CLEAR_IRQS)
- purge all pending floating interrupts (KVM_DEV_FLIC_CLEAR_IRQS)
- enable/disable for the guest transparent async page faults


Groups:
Groups:
  KVM_DEV_FLIC_ENQUEUE
  KVM_DEV_FLIC_ENQUEUE
@@ -34,3 +35,12 @@ Groups:
  KVM_DEV_FLIC_CLEAR_IRQS
  KVM_DEV_FLIC_CLEAR_IRQS
    Simply deletes all elements from the list of currently pending floating
    Simply deletes all elements from the list of currently pending floating
    interrupts.  No interrupts are injected into the guest.
    interrupts.  No interrupts are injected into the guest.

  KVM_DEV_FLIC_APF_ENABLE
    Enables async page faults for the guest. So in case of a major page fault
    the host is allowed to handle this async and continues the guest.

  KVM_DEV_FLIC_APF_DISABLE_WAIT
    Disables async page faults for the guest and waits until already pending
    async page faults are done. This is necessary to trigger a completion interrupt
    for every init interrupt before migrating the interrupt list.
+22 −0
Original line number Original line Diff line number Diff line
@@ -231,6 +231,10 @@ struct kvm_vcpu_arch {
		u64		stidp_data;
		u64		stidp_data;
	};
	};
	struct gmap *gmap;
	struct gmap *gmap;
#define KVM_S390_PFAULT_TOKEN_INVALID	(-1UL)
	unsigned long pfault_token;
	unsigned long pfault_select;
	unsigned long pfault_compare;
};
};


struct kvm_vm_stat {
struct kvm_vm_stat {
@@ -257,6 +261,24 @@ static inline bool kvm_is_error_hva(unsigned long addr)
	return IS_ERR_VALUE(addr);
	return IS_ERR_VALUE(addr);
}
}


#define ASYNC_PF_PER_VCPU	64
struct kvm_vcpu;
struct kvm_async_pf;
struct kvm_arch_async_pf {
	unsigned long pfault_token;
};

bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu);

void kvm_arch_async_page_ready(struct kvm_vcpu *vcpu,
			       struct kvm_async_pf *work);

void kvm_arch_async_page_not_present(struct kvm_vcpu *vcpu,
				     struct kvm_async_pf *work);

void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
				 struct kvm_async_pf *work);

extern int sie64a(struct kvm_s390_sie_block *, u64 *);
extern int sie64a(struct kvm_s390_sie_block *, u64 *);
extern char sie_exit;
extern char sie_exit;
#endif
#endif
+2 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,8 @@
#define KVM_DEV_FLIC_GET_ALL_IRQS	1
#define KVM_DEV_FLIC_GET_ALL_IRQS	1
#define KVM_DEV_FLIC_ENQUEUE		2
#define KVM_DEV_FLIC_ENQUEUE		2
#define KVM_DEV_FLIC_CLEAR_IRQS		3
#define KVM_DEV_FLIC_CLEAR_IRQS		3
#define KVM_DEV_FLIC_APF_ENABLE		4
#define KVM_DEV_FLIC_APF_DISABLE_WAIT	5
/*
/*
 * We can have up to 4*64k pending subchannels + 8 adapter interrupts,
 * We can have up to 4*64k pending subchannels + 8 adapter interrupts,
 * as well as up  to ASYNC_PF_PER_VCPU*KVM_MAX_VCPUS pfault done interrupts.
 * as well as up  to ASYNC_PF_PER_VCPU*KVM_MAX_VCPUS pfault done interrupts.
+2 −0
Original line number Original line Diff line number Diff line
@@ -23,6 +23,8 @@ config KVM
	select ANON_INODES
	select ANON_INODES
	select HAVE_KVM_CPU_RELAX_INTERCEPT
	select HAVE_KVM_CPU_RELAX_INTERCEPT
	select HAVE_KVM_EVENTFD
	select HAVE_KVM_EVENTFD
	select KVM_ASYNC_PF
	select KVM_ASYNC_PF_SYNC
	---help---
	---help---
	  Support hosting paravirtualized guest machines using the SIE
	  Support hosting paravirtualized guest machines using the SIE
	  virtualization capability on the mainframe. This should work
	  virtualization capability on the mainframe. This should work
+1 −1
Original line number Original line Diff line number Diff line
@@ -7,7 +7,7 @@
# as published by the Free Software Foundation.
# as published by the Free Software Foundation.


KVM := ../../../virt/kvm
KVM := ../../../virt/kvm
common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o
common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o  $(KVM)/async_pf.o


ccflags-y := -Ivirt/kvm -Iarch/s390/kvm
ccflags-y := -Ivirt/kvm -Iarch/s390/kvm


Loading