Skip to contentSkip to conversation

KVM: s390 patches for kvm/next

GIT PULL Cornelia Huck 2 participants 6 messages Apr 20, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Paolo, Radim,

here are some s390 patches for 4.7. Christian had them in the -next branch for a while; I'm sending them out in his place today.

The following changes since commit 5e1b59abef69e405eabfbe0ad09ad6b6e5303c7d:

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm (2016-04-13 08:53:26 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git tags/kvms390-20160420

for you to fetch changes up to 6d28f789bf81540d4069342b1a28bfd41dab38a3:

KVM: s390: add clear I/O irq operation for FLIC (2016-04-20 14:27:32 +0200)

----------------------------------------------------------------
KVM/s390 patches for 4.7:
- improve perf output
- cleanup and a new feature in the floating interrupt controller (FLIC)

----------------------------------------------------------------

Christian Borntraeger (1):
KVM: s390/perf: provide additional sigp events

Halil Pasic (3):
KVM: s390: implement has_attr for FLIC
KVM: s390: document FLIC behavior on unsupported
KVM: s390: add clear I/O irq operation for FLIC

 Documentation/virtual/kvm/devices/s390_flic.txt | 12 +++++++
 arch/s390/include/uapi/asm/kvm.h                |  1 +
 arch/s390/include/uapi/asm/sie.h                |  7 ++++-
 arch/s390/kvm/interrupt.c                       | 42 +++++++++++++++++++++++++
 4 files changed, 61 insertions(+), 1 deletion(-)
Signature · 1 line
2.8.1
#1 lore raw

[PULL 1/4] KVM: s390/perf: provide additional sigp events

From: Christian Borntraeger <[email protected]>

perf kvm stat can decode sigp events, let's make
the list complete by adding the missing ones.

---
 arch/s390/include/uapi/asm/sie.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/s390/include/uapi/asm/sie.h +6 -1
index 5dbaa72..8fb5d4a 100644
@@ -16,14 +16,19 @@
 	{ 0x01, "SIGP sense" },					\
 	{ 0x02, "SIGP external call" },				\
 	{ 0x03, "SIGP emergency signal" },			\
+	{ 0x04, "SIGP start" },					\
 	{ 0x05, "SIGP stop" },					\
 	{ 0x06, "SIGP restart" },				\
 	{ 0x09, "SIGP stop and store status" },			\
 	{ 0x0b, "SIGP initial cpu reset" },			\
+	{ 0x0c, "SIGP cpu reset" },				\
 	{ 0x0d, "SIGP set prefix" },				\
 	{ 0x0e, "SIGP store status at address" },		\
 	{ 0x12, "SIGP set architecture" },			\
-	{ 0x15, "SIGP sense running" }
+	{ 0x13, "SIGP conditional emergency signal" },		\
+	{ 0x15, "SIGP sense running" },				\
+	{ 0x16, "SIGP set multithreading"},			\
+	{ 0x17, "SIGP store additional status ait address"}
 
 #define icpt_prog_codes						\
 	{ 0x0001, "Prog Operation" },				\
Signature · 1 line
2.8.1
#2 lore raw

[PULL 2/4] KVM: s390: implement has_attr for FLIC

In reply to Cornelia Huck

From: Halil Pasic <[email protected]>

HAS_ATTR is useful for determining the supported attributes; let's implement it.

---
 arch/s390/kvm/interrupt.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/s390/kvm/interrupt.c +17 -0
index 84efc2b..4c2cdb2 100644
@@ -2074,6 +2074,22 @@ static int flic_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
 	return r;
 }
 
+static int flic_has_attr(struct kvm_device *dev,
+			     struct kvm_device_attr *attr)
+{
+	switch (attr->group) {
+	case KVM_DEV_FLIC_GET_ALL_IRQS:
+	case KVM_DEV_FLIC_ENQUEUE:
+	case KVM_DEV_FLIC_CLEAR_IRQS:
+	case KVM_DEV_FLIC_APF_ENABLE:
+	case KVM_DEV_FLIC_APF_DISABLE_WAIT:
+	case KVM_DEV_FLIC_ADAPTER_REGISTER:
+	case KVM_DEV_FLIC_ADAPTER_MODIFY:
+		return 0;
+	}
+	return -ENXIO;
+}
+
 static int flic_create(struct kvm_device *dev, u32 type)
 {
 	if (!dev)
@@ -2095,6 +2111,7 @@ struct kvm_device_ops kvm_flic_ops = {
 	.name = "kvm-flic",
 	.get_attr = flic_get_attr,
 	.set_attr = flic_set_attr,
+	.has_attr = flic_has_attr,
 	.create = flic_create,
 	.destroy = flic_destroy,
 };
Signature · 1 line
2.8.1
#3 lore raw

[PULL 3/4] KVM: s390: document FLIC behavior on unsupported

In reply to Cornelia Huck

From: Halil Pasic <[email protected]>

FLIC behavior deviates from the API documentation in reporting EINVAL instead of ENXIO for KVM_SET_DEVICE_ATTR/KVM_GET_DEVICE_ATTR when the group or attribute is unknown/unsupported. Unfortunately this can not be fixed for historical reasons. Let us at least have it documented.

---
 Documentation/virtual/kvm/devices/s390_flic.txt | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/virtual/kvm/devices/s390_flic.txt +6 -0
index e3e314c..646f474 100644
@@ -94,3 +94,9 @@ struct kvm_s390_io_adapter_req {
     KVM_S390_IO_ADAPTER_UNMAP
       release a userspace page for the translated address specified in addr
       from the list of mappings
+
+Note: The KVM_SET_DEVICE_ATTR/KVM_GET_DEVICE_ATTR device ioctls executed on
+FLIC with an unknown group or attribute gives the error code EINVAL (instead of
+ENXIO, as specified in the API documentation). It is not possible to conclude
+that a FLIC operation is unavailable based on the error code resulting from a
+usage attempt.
Signature · 1 line
2.8.1
#4 lore raw

[PULL 4/4] KVM: s390: add clear I/O irq operation for FLIC

In reply to Cornelia Huck

From: Halil Pasic <[email protected]>

Introduce a FLIC operation for clearing I/O interrupts for a subchannel.

Rationale: According to the platform specification, pending I/O interruption requests have to be revoked in certain situations. For instance, according to the Principles of Operation (page 17-27), a subchannel put into the installed parameters initialized state is in the same state as after an I/O system reset (just parameters possibly changed). This implies that any I/O interrupts for that subchannel are no longer pending (as I/O system resets clear I/O interrupts). Therefore, we need an interface to clear pending I/O interrupts.

---
 Documentation/virtual/kvm/devices/s390_flic.txt |  6 ++++++
 arch/s390/include/uapi/asm/kvm.h                |  1 +
 arch/s390/kvm/interrupt.c                       | 25 +++++++++++++++++++++++++
 3 files changed, 32 insertions(+)
Documentation/virtual/kvm/devices/s390_flic.txt +6 -0
index 646f474..8478de1 100644
@@ -11,6 +11,7 @@ FLIC provides support to
 - add interrupts (KVM_DEV_FLIC_ENQUEUE)
 - inspect currently pending interrupts (KVM_FLIC_GET_ALL_IRQS)
 - purge all pending floating interrupts (KVM_DEV_FLIC_CLEAR_IRQS)
+- purge one pending floating I/O interrupt (KVM_DEV_FLIC_CLEAR_IO_IRQ)
 - enable/disable for the guest transparent async page faults
 - register and modify adapter interrupt sources (KVM_DEV_FLIC_ADAPTER_*)
 
@@ -40,6 +41,11 @@ Groups:
     Simply deletes all elements from the list of currently pending floating
     interrupts.  No interrupts are injected into the guest.
 
+  KVM_DEV_FLIC_CLEAR_IO_IRQ
+    Deletes one (if any) I/O interrupt for a subchannel identified by the
+    subsystem identification word passed via the buffer specified by
+    attr->addr (address) and attr->attr (length).
+
   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.
arch/s390/include/uapi/asm/kvm.h +1 -0
index 347fe5a..3b8e99e 100644
@@ -25,6 +25,7 @@
 #define KVM_DEV_FLIC_APF_DISABLE_WAIT	5
 #define KVM_DEV_FLIC_ADAPTER_REGISTER	6
 #define KVM_DEV_FLIC_ADAPTER_MODIFY	7
+#define KVM_DEV_FLIC_CLEAR_IO_IRQ	8
 /*
  * 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.
arch/s390/kvm/interrupt.c +25 -0
index 4c2cdb2..e550404 100644
@@ -2034,6 +2034,27 @@ static int modify_io_adapter(struct kvm_device *dev,
 	return ret;
 }
 
+static int clear_io_irq(struct kvm *kvm, struct kvm_device_attr *attr)
+
+{
+	const u64 isc_mask = 0xffUL << 24; /* all iscs set */
+	u32 schid;
+
+	if (attr->flags)
+		return -EINVAL;
+	if (attr->attr != sizeof(schid))
+		return -EINVAL;
+	if (copy_from_user(&schid, (void __user *) attr->addr, sizeof(schid)))
+		return -EFAULT;
+	kfree(kvm_s390_get_io_int(kvm, isc_mask, schid));
+	/*
+	 * If userspace is conforming to the architecture, we can have at most
+	 * one pending I/O interrupt per subchannel, so this is effectively a
+	 * clear all.
+	 */
+	return 0;
+}
+
 static int flic_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
 {
 	int r = 0;
@@ -2067,6 +2088,9 @@ static int flic_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
 	case KVM_DEV_FLIC_ADAPTER_MODIFY:
 		r = modify_io_adapter(dev, attr);
 		break;
+	case KVM_DEV_FLIC_CLEAR_IO_IRQ:
+		r = clear_io_irq(dev->kvm, attr);
+		break;
 	default:
 		r = -EINVAL;
 	}
@@ -2085,6 +2109,7 @@ static int flic_has_attr(struct kvm_device *dev,
 	case KVM_DEV_FLIC_APF_DISABLE_WAIT:
 	case KVM_DEV_FLIC_ADAPTER_REGISTER:
 	case KVM_DEV_FLIC_ADAPTER_MODIFY:
+	case KVM_DEV_FLIC_CLEAR_IO_IRQ:
 		return 0;
 	}
 	return -ENXIO;
Signature · 1 line
2.8.1
#5 lore raw
In reply to Cornelia Huck

2016-04-20 14:54+0200, Cornelia Huck:

Quoted 4 lines

Paolo, Radim,

here are some s390 patches for 4.7. Christian had them in the -next branch for a while; I'm sending them out in his place today.

Pulled, thanks.