All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/4] KVM: s390 patches for kvm/next
@ 2016-04-20 12:54 Cornelia Huck
  2016-04-20 12:54 ` [PULL 1/4] KVM: s390/perf: provide additional sigp events Cornelia Huck
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Cornelia Huck @ 2016-04-20 12:54 UTC (permalink / raw)
  To: pbonzini, rkrcmar
  Cc: borntraeger, kvm, linux-s390, jfrei, agraf, Cornelia Huck

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(-)

-- 
2.8.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PULL 1/4] KVM: s390/perf: provide additional sigp events
  2016-04-20 12:54 [PULL 0/4] KVM: s390 patches for kvm/next Cornelia Huck
@ 2016-04-20 12:54 ` Cornelia Huck
  2016-04-20 12:54 ` [PULL 2/4] KVM: s390: implement has_attr for FLIC Cornelia Huck
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Cornelia Huck @ 2016-04-20 12:54 UTC (permalink / raw)
  To: pbonzini, rkrcmar
  Cc: borntraeger, kvm, linux-s390, jfrei, agraf, Cornelia Huck

From: Christian Borntraeger <borntraeger@de.ibm.com>

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

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/include/uapi/asm/sie.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/s390/include/uapi/asm/sie.h b/arch/s390/include/uapi/asm/sie.h
index 5dbaa72..8fb5d4a 100644
--- a/arch/s390/include/uapi/asm/sie.h
+++ b/arch/s390/include/uapi/asm/sie.h
@@ -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" },				\
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 2/4] KVM: s390: implement has_attr for FLIC
  2016-04-20 12:54 [PULL 0/4] KVM: s390 patches for kvm/next Cornelia Huck
  2016-04-20 12:54 ` [PULL 1/4] KVM: s390/perf: provide additional sigp events Cornelia Huck
@ 2016-04-20 12:54 ` Cornelia Huck
  2016-04-20 12:54 ` [PULL 3/4] KVM: s390: document FLIC behavior on unsupported Cornelia Huck
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Cornelia Huck @ 2016-04-20 12:54 UTC (permalink / raw)
  To: pbonzini, rkrcmar
  Cc: borntraeger, kvm, linux-s390, jfrei, agraf, Halil Pasic, Cornelia Huck

From: Halil Pasic <pasic@linux.vnet.ibm.com>

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

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/interrupt.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 84efc2b..4c2cdb2 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -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,
 };
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 3/4] KVM: s390: document FLIC behavior on unsupported
  2016-04-20 12:54 [PULL 0/4] KVM: s390 patches for kvm/next Cornelia Huck
  2016-04-20 12:54 ` [PULL 1/4] KVM: s390/perf: provide additional sigp events Cornelia Huck
  2016-04-20 12:54 ` [PULL 2/4] KVM: s390: implement has_attr for FLIC Cornelia Huck
@ 2016-04-20 12:54 ` Cornelia Huck
  2016-04-20 12:54 ` [PULL 4/4] KVM: s390: add clear I/O irq operation for FLIC Cornelia Huck
  2016-04-20 16:41 ` [PULL 0/4] KVM: s390 patches for kvm/next Radim Krčmář
  4 siblings, 0 replies; 6+ messages in thread
From: Cornelia Huck @ 2016-04-20 12:54 UTC (permalink / raw)
  To: pbonzini, rkrcmar
  Cc: borntraeger, kvm, linux-s390, jfrei, agraf, Halil Pasic, Cornelia Huck

From: Halil Pasic <pasic@linux.vnet.ibm.com>

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.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 Documentation/virtual/kvm/devices/s390_flic.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/virtual/kvm/devices/s390_flic.txt b/Documentation/virtual/kvm/devices/s390_flic.txt
index e3e314c..646f474 100644
--- a/Documentation/virtual/kvm/devices/s390_flic.txt
+++ b/Documentation/virtual/kvm/devices/s390_flic.txt
@@ -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.
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 4/4] KVM: s390: add clear I/O irq operation for FLIC
  2016-04-20 12:54 [PULL 0/4] KVM: s390 patches for kvm/next Cornelia Huck
                   ` (2 preceding siblings ...)
  2016-04-20 12:54 ` [PULL 3/4] KVM: s390: document FLIC behavior on unsupported Cornelia Huck
@ 2016-04-20 12:54 ` Cornelia Huck
  2016-04-20 16:41 ` [PULL 0/4] KVM: s390 patches for kvm/next Radim Krčmář
  4 siblings, 0 replies; 6+ messages in thread
From: Cornelia Huck @ 2016-04-20 12:54 UTC (permalink / raw)
  To: pbonzini, rkrcmar
  Cc: borntraeger, kvm, linux-s390, jfrei, agraf, Halil Pasic, Cornelia Huck

From: Halil Pasic <pasic@linux.vnet.ibm.com>

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.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 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(+)

diff --git a/Documentation/virtual/kvm/devices/s390_flic.txt b/Documentation/virtual/kvm/devices/s390_flic.txt
index 646f474..8478de1 100644
--- a/Documentation/virtual/kvm/devices/s390_flic.txt
+++ b/Documentation/virtual/kvm/devices/s390_flic.txt
@@ -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.
diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h
index 347fe5a..3b8e99e 100644
--- a/arch/s390/include/uapi/asm/kvm.h
+++ b/arch/s390/include/uapi/asm/kvm.h
@@ -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.
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 4c2cdb2..e550404 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -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;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PULL 0/4] KVM: s390 patches for kvm/next
  2016-04-20 12:54 [PULL 0/4] KVM: s390 patches for kvm/next Cornelia Huck
                   ` (3 preceding siblings ...)
  2016-04-20 12:54 ` [PULL 4/4] KVM: s390: add clear I/O irq operation for FLIC Cornelia Huck
@ 2016-04-20 16:41 ` Radim Krčmář
  4 siblings, 0 replies; 6+ messages in thread
From: Radim Krčmář @ 2016-04-20 16:41 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: pbonzini, borntraeger, kvm, linux-s390, jfrei, agraf

2016-04-20 14:54+0200, Cornelia Huck:
> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-20 16:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-20 12:54 [PULL 0/4] KVM: s390 patches for kvm/next Cornelia Huck
2016-04-20 12:54 ` [PULL 1/4] KVM: s390/perf: provide additional sigp events Cornelia Huck
2016-04-20 12:54 ` [PULL 2/4] KVM: s390: implement has_attr for FLIC Cornelia Huck
2016-04-20 12:54 ` [PULL 3/4] KVM: s390: document FLIC behavior on unsupported Cornelia Huck
2016-04-20 12:54 ` [PULL 4/4] KVM: s390: add clear I/O irq operation for FLIC Cornelia Huck
2016-04-20 16:41 ` [PULL 0/4] KVM: s390 patches for kvm/next Radim Krčmář

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.