Skip to contentSkip to conversation

KVM: s390: virtio-ccw adapter interrupts.

RFC PATCH Superseded Cornelia Huck 2 participants 7 messages Jul 9, 2013 – Jul 10, 2013

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

v2 cover KVM: s390: virtio-ccw adapter interrupts.

Hi,

next version of the guest exploitation of virtio-ccw adapter interrupts.

Changes from the last version:

- adapt to latest kvm-next
- changed housekeeping for indicator locations: we now use cacheline-sized and aligned areas
- minor tweaks

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 | 314 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 305 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.2.2
#1 lore raw

RFC PATCH v2 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.2.2
#4 lore raw

RFC PATCH v2 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.2.2
#5 lore raw

RFC PATCH v2 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 | 303 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 296 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 54b0995..2fd938b 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 +294 -9

401 lines not on this page · raw message

Signature · 1 line
1.8.2.2
#6 lore raw

RFC PATCH v2 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 | 303 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 296 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 54b0995..2fd938b 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 +294 -9

401 lines not on this page · raw message

Signature · 1 line
1.8.2.2
Acked-by on v2 1/2
#2 lore raw

Re: [RFC PATCH v2 1/2] KVM: s390: virtio-ccw: Handle command rejects.

In reply to Cornelia Huck
Quoted 5 lines · 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.

Quoted 27 lines
---
 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:
Acked-by on v2 1/2
#3 lore raw

Re: [RFC PATCH v2 1/2] KVM: s390: virtio-ccw: Handle command rejects.

In reply to Cornelia Huck
Quoted 5 lines · 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.

Quoted 27 lines
---
 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: