Skip to contentSkip to conversation

KVM: s390: virtio-ccw adapter interrupts.

RFC PATCH New Cornelia Huck 1 participant 5 messages Jun 7, 2013

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

cover KVM: s390: virtio-ccw adapter interrupts.

Hi,

here's the guest driver support for adapter interrupts in virtio-ccw.

We use one summary indicator per page of indicators. For each device, we try to find a space in an indicator where all of its virtqueues fit.

Locking probably needs some more love, but it seems to work fine so far.

Cornelia Huck (2):
KVM: s390: virtio-ccw: Handle command rejects.
KVM: s390: virtio-ccw adapter interrupt support.

 arch/s390/include/asm/irq.h   |   1 +
 arch/s390/kernel/irq.c        |   1 +
 drivers/s390/kvm/virtio_ccw.c | 307 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 298 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.1.6
#1 lore raw

RFC PATCH 1/2 KVM: s390: virtio-ccw: Handle command rejects.

A command reject for a ccw may happen if we run on a host not supporting a certain feature. We want to be able to handle this as special case of command failure, so let's split this off from the generic -EIO error code.

---
 drivers/s390/kvm/virtio_ccw.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/s390/kvm/virtio_ccw.c +9 -2
index 779dc51..d6c7aba 100644
@@ -639,8 +639,15 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev,
 	     (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND))) {
 		/* OK */
 	}
-	if (irb_is_error(irb))
-		vcdev->err = -EIO; /* XXX - use real error */
+	if (irb_is_error(irb)) {
+		/* Command reject? */
+		if ((scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK) &&
+		    (irb->ecw[0] & SNS0_CMD_REJECT))
+			vcdev->err = -EOPNOTSUPP;
+		else
+			/* Map everything else to -EIO. */
+			vcdev->err = -EIO;
+	}
 	if (vcdev->curr_io & activity) {
 		switch (activity) {
 		case VIRTIO_CCW_DOING_READ_FEAT:
Signature · 1 line
1.8.1.6
#2 lore raw

RFC PATCH 1/2 KVM: s390: virtio-ccw: Handle command rejects.

In reply to Cornelia Huck

A command reject for a ccw may happen if we run on a host not supporting a certain feature. We want to be able to handle this as special case of command failure, so let's split this off from the generic -EIO error code.

---
 drivers/s390/kvm/virtio_ccw.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/s390/kvm/virtio_ccw.c +9 -2
index 779dc51..d6c7aba 100644
@@ -639,8 +639,15 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev,
 	     (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND))) {
 		/* OK */
 	}
-	if (irb_is_error(irb))
-		vcdev->err = -EIO; /* XXX - use real error */
+	if (irb_is_error(irb)) {
+		/* Command reject? */
+		if ((scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK) &&
+		    (irb->ecw[0] & SNS0_CMD_REJECT))
+			vcdev->err = -EOPNOTSUPP;
+		else
+			/* Map everything else to -EIO. */
+			vcdev->err = -EIO;
+	}
 	if (vcdev->curr_io & activity) {
 		switch (activity) {
 		case VIRTIO_CCW_DOING_READ_FEAT:
Signature · 1 line
1.8.1.6
#3 lore raw

RFC PATCH 2/2 KVM: s390: virtio-ccw adapter interrupt support.

In reply to Cornelia Huck

Implement the new CCW_CMD_SET_IND_ADAPTER command and try to enable adapter interrupts for every device on the first startup. If the host does not support adapter interrupts, fall back to normal I/O interrupts.

virtio-ccw adapter interrupts use the same isc as normal I/O subchannels and share a summary indicator for all devices sharing the same indicator area.

Indicator bits for the individual virtqueues may be contained in the same indicator area for different devices.

---
 arch/s390/include/asm/irq.h   |   1 +
 arch/s390/kernel/irq.c        |   1 +
 drivers/s390/kvm/virtio_ccw.c | 296 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 289 insertions(+), 9 deletions(-)
arch/s390/include/asm/irq.h +1 -0
index 87c17bf..ba75d32 100644
@@ -42,6 +42,7 @@ enum interruption_class {
 	IRQIO_PCI,
 	IRQIO_MSI,
 	IRQIO_VIR,
+	IRQIO_VAI,
 	NMI_NMI,
 	CPU_RST,
 	NR_ARCH_IRQS
arch/s390/kernel/irq.c +1 -0
index f7fb589..39237cc 100644
@@ -82,6 +82,7 @@ static const struct irq_class irqclass_sub_desc[NR_ARCH_IRQS] = {
 	[IRQIO_PCI]  = {.name = "PCI", .desc = "[I/O] PCI Interrupt" },
 	[IRQIO_MSI]  = {.name = "MSI", .desc = "[I/O] MSI Interrupt" },
 	[IRQIO_VIR]  = {.name = "VIR", .desc = "[I/O] Virtual I/O Devices"},
+	[IRQIO_VAI]  = {.name = "VAI", .desc = "[I/O] Virtual I/O Devices AI"},
 	[NMI_NMI]    = {.name = "NMI", .desc = "[NMI] Machine Check"},
 	[CPU_RST]    = {.name = "RST", .desc = "[CPU] CPU Restart"},
 };
drivers/s390/kvm/virtio_ccw.c +287 -9

388 lines not on this page · raw message

Signature · 1 line
1.8.1.6
#4 lore raw

RFC PATCH 2/2 KVM: s390: virtio-ccw adapter interrupt support.

In reply to Cornelia Huck

Implement the new CCW_CMD_SET_IND_ADAPTER command and try to enable adapter interrupts for every device on the first startup. If the host does not support adapter interrupts, fall back to normal I/O interrupts.

virtio-ccw adapter interrupts use the same isc as normal I/O subchannels and share a summary indicator for all devices sharing the same indicator area.

Indicator bits for the individual virtqueues may be contained in the same indicator area for different devices.

---
 arch/s390/include/asm/irq.h   |   1 +
 arch/s390/kernel/irq.c        |   1 +
 drivers/s390/kvm/virtio_ccw.c | 296 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 289 insertions(+), 9 deletions(-)
arch/s390/include/asm/irq.h +1 -0
index 87c17bf..ba75d32 100644
@@ -42,6 +42,7 @@ enum interruption_class {
 	IRQIO_PCI,
 	IRQIO_MSI,
 	IRQIO_VIR,
+	IRQIO_VAI,
 	NMI_NMI,
 	CPU_RST,
 	NR_ARCH_IRQS
arch/s390/kernel/irq.c +1 -0
index f7fb589..39237cc 100644
@@ -82,6 +82,7 @@ static const struct irq_class irqclass_sub_desc[NR_ARCH_IRQS] = {
 	[IRQIO_PCI]  = {.name = "PCI", .desc = "[I/O] PCI Interrupt" },
 	[IRQIO_MSI]  = {.name = "MSI", .desc = "[I/O] MSI Interrupt" },
 	[IRQIO_VIR]  = {.name = "VIR", .desc = "[I/O] Virtual I/O Devices"},
+	[IRQIO_VAI]  = {.name = "VAI", .desc = "[I/O] Virtual I/O Devices AI"},
 	[NMI_NMI]    = {.name = "NMI", .desc = "[NMI] Machine Check"},
 	[CPU_RST]    = {.name = "RST", .desc = "[CPU] CPU Restart"},
 };
drivers/s390/kvm/virtio_ccw.c +287 -9

388 lines not on this page · raw message

Signature · 1 line
1.8.1.6