Commit a4850b55 authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

Merge tag 'kvm-s390-next-5.20-1' of...

Merge tag 'kvm-s390-next-5.20-1' of https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD

KVM: s390x: Fixes and features for 5.20

* First part of deferred teardown
* CPU Topology
* interpretive execution for PCI instructions
* PV attestation
* Minor fixes
parents 8031d87a f5ecfee9
Loading
Loading
Loading
Loading
+71 −0
Original line number Diff line number Diff line
@@ -5955,6 +5955,52 @@ KVM_PV_DUMP_CPU
  Provides encrypted dump data like register values.
  The length of the returned data is provided by uv_info.guest_cpu_stor_len.

4.137 KVM_S390_ZPCI_OP
----------------------

:Capability: KVM_CAP_S390_ZPCI_OP
:Architectures: s390
:Type: vm ioctl
:Parameters: struct kvm_s390_zpci_op (in)
:Returns: 0 on success, <0 on error

Used to manage hardware-assisted virtualization features for zPCI devices.

Parameters are specified via the following structure::

  struct kvm_s390_zpci_op {
	/* in */
	__u32 fh;		/* target device */
	__u8  op;		/* operation to perform */
	__u8  pad[3];
	union {
		/* for KVM_S390_ZPCIOP_REG_AEN */
		struct {
			__u64 ibv;	/* Guest addr of interrupt bit vector */
			__u64 sb;	/* Guest addr of summary bit */
			__u32 flags;
			__u32 noi;	/* Number of interrupts */
			__u8 isc;	/* Guest interrupt subclass */
			__u8 sbo;	/* Offset of guest summary bit vector */
			__u16 pad;
		} reg_aen;
		__u64 reserved[8];
	} u;
  };

The type of operation is specified in the "op" field.
KVM_S390_ZPCIOP_REG_AEN is used to register the VM for adapter event
notification interpretation, which will allow firmware delivery of adapter
events directly to the vm, with KVM providing a backup delivery mechanism;
KVM_S390_ZPCIOP_DEREG_AEN is used to subsequently disable interpretation of
adapter event notifications.

The target zPCI function must also be specified via the "fh" field.  For the
KVM_S390_ZPCIOP_REG_AEN operation, additional information to establish firmware
delivery must be provided via the "reg_aen" struct.

The "pad" and "reserved" fields may be used for future extensions and should be
set to 0s by userspace.

5. The kvm_run structure
========================
@@ -8223,6 +8269,31 @@ The capability has no effect if the nx_huge_pages module parameter is not set.

This capability may only be set before any vCPUs are created.

8.39 KVM_CAP_S390_CPU_TOPOLOGY
------------------------------

:Capability: KVM_CAP_S390_CPU_TOPOLOGY
:Architectures: s390
:Type: vm

This capability indicates that KVM will provide the S390 CPU Topology
facility which consist of the interpretation of the PTF instruction for
the function code 2 along with interception and forwarding of both the
PTF instruction with function codes 0 or 1 and the STSI(15,1,x)
instruction to the userland hypervisor.

The stfle facility 11, CPU Topology facility, should not be indicated
to the guest without this capability.

When this capability is present, KVM provides a new attribute group
on vm fd, KVM_S390_VM_CPU_TOPOLOGY.
This new attribute allows to get, set or clear the Modified Change
Topology Report (MTCR) bit of the SCA through the kvm_device_attr
structure.

When getting the Modified Change Topology Report value, the attr->addr
must point to a byte where the value will be stored or retrieved from.

9. Known KVM API problems
=========================

+1 −0
Original line number Diff line number Diff line
@@ -17453,6 +17453,7 @@ M: Eric Farman <farman@linux.ibm.com>
L:	linux-s390@vger.kernel.org
L:	kvm@vger.kernel.org
S:	Supported
F:	arch/s390/kvm/pci*
F:	drivers/vfio/pci/vfio_pci_zdev.c
F:	include/uapi/linux/vfio_zdev.h
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ void uv_query_info(void)
		uv_info.supp_se_hdr_pcf = uvcb.supp_se_hdr_pcf;
		uv_info.conf_dump_storage_state_len = uvcb.conf_dump_storage_state_len;
		uv_info.conf_dump_finalize_len = uvcb.conf_dump_finalize_len;
		uv_info.supp_att_req_hdr_ver = uvcb.supp_att_req_hdr_ver;
		uv_info.supp_att_pflags = uvcb.supp_att_pflags;
	}

#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
+5 −2
Original line number Diff line number Diff line
@@ -12,10 +12,11 @@

#include <linux/bit_spinlock.h>
#include <linux/dma-mapping.h>
#include <asm/tpi.h>

struct airq_struct {
	struct hlist_node list;		/* Handler queueing. */
	void (*handler)(struct airq_struct *airq, bool floating);
	void (*handler)(struct airq_struct *airq, struct tpi_info *tpi_info);
	u8 *lsi_ptr;			/* Local-Summary-Indicator pointer */
	u8 lsi_mask;			/* Local-Summary-Indicator mask */
	u8 isc;				/* Interrupt-subclass */
@@ -46,8 +47,10 @@ struct airq_iv {
#define AIRQ_IV_PTR		4	/* Allocate the ptr array */
#define AIRQ_IV_DATA		8	/* Allocate the data array */
#define AIRQ_IV_CACHELINE	16	/* Cacheline alignment for the vector */
#define AIRQ_IV_GUESTVEC	32	/* Vector is a pinned guest page */

struct airq_iv *airq_iv_create(unsigned long bits, unsigned long flags);
struct airq_iv *airq_iv_create(unsigned long bits, unsigned long flags,
			       unsigned long *vec);
void airq_iv_release(struct airq_iv *iv);
unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num);
void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num);
+38 −1
Original line number Diff line number Diff line
@@ -147,5 +147,42 @@ int gmap_mprotect_notify(struct gmap *, unsigned long start,
void gmap_sync_dirty_log_pmd(struct gmap *gmap, unsigned long dirty_bitmap[4],
			     unsigned long gaddr, unsigned long vmaddr);
int gmap_mark_unmergeable(void);
void s390_reset_acc(struct mm_struct *mm);
void s390_unlist_old_asce(struct gmap *gmap);
int s390_replace_asce(struct gmap *gmap);
void s390_uv_destroy_pfns(unsigned long count, unsigned long *pfns);
int __s390_uv_destroy_range(struct mm_struct *mm, unsigned long start,
			    unsigned long end, bool interruptible);

/**
 * s390_uv_destroy_range - Destroy a range of pages in the given mm.
 * @mm: the mm on which to operate on
 * @start: the start of the range
 * @end: the end of the range
 *
 * This function will call cond_sched, so it should not generate stalls, but
 * it will otherwise only return when it completed.
 */
static inline void s390_uv_destroy_range(struct mm_struct *mm, unsigned long start,
					 unsigned long end)
{
	(void)__s390_uv_destroy_range(mm, start, end, false);
}

/**
 * s390_uv_destroy_range_interruptible - Destroy a range of pages in the
 * given mm, but stop when a fatal signal is received.
 * @mm: the mm on which to operate on
 * @start: the start of the range
 * @end: the end of the range
 *
 * This function will call cond_sched, so it should not generate stalls. If
 * a fatal signal is received, it will return with -EINTR immediately,
 * without finishing destroying the whole range. Upon successful
 * completion, 0 is returned.
 */
static inline int s390_uv_destroy_range_interruptible(struct mm_struct *mm, unsigned long start,
						      unsigned long end)
{
	return __s390_uv_destroy_range(mm, start, end, true);
}
#endif /* _ASM_S390_GMAP_H */
Loading