Skip to contentSkip to conversation

virtio-ccw: new status accessor in device

RFC PATCH New Cornelia Huck 1 participant 5 messages Sep 11, 2015 virtio core

lore
Share & tools
lore
#0 lore raw

cover virtio-ccw: new status accessor in device

These patches implement the new read status command in qemu and bump the revision to 2 (as this ccw is currently the only thing new with that revision).

Patches are on top of v2 of "virtio-1/virtio-ccw related patches".

Pierre Morel (2):
s390x/virtio-ccw: respond to READ_STATUS command s390x/virtio-ccw: set revision 2 as maximum revision number

 hw/s390x/virtio-ccw.c | 20 ++++++++++++++++++++
 hw/s390x/virtio-ccw.h |  3 ++-
 2 files changed, 22 insertions(+), 1 deletion(-)
Signature · 1 line
2.3.8
#1 lore raw

RFC PATCH 1/2 s390x/virtio-ccw: respond to READ_STATUS command

From: Pierre Morel <[email protected]>

This patch adds the response to the READ_STATUS CCW command.

---
 hw/s390x/virtio-ccw.c | 20 ++++++++++++++++++++
 hw/s390x/virtio-ccw.h |  1 +
 2 files changed, 21 insertions(+)
hw/s390x/virtio-ccw.c +20 -0
index fb103b7..dcd0fff 100644
@@ -586,6 +586,26 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
             }
         }
         break;
+    case CCW_CMD_READ_STATUS:
+        if (check_len) {
+            if (ccw.count != sizeof(status)) {
+                ret = -EINVAL;
+                break;
+            }
+        } else if (ccw.count < sizeof(status)) {
+            /* Can't execute command. */
+            ret = -EINVAL;
+            break;
+        }
+        if (!ccw.cda) {
+            ret = -EFAULT;
+        } else {
+            address_space_stb(&address_space_memory, ccw.cda, vdev->status,
+                                        MEMTXATTRS_UNSPECIFIED, NULL);
+            sch->curr_status.scsw.count = ccw.count - sizeof(vdev->status);;
+            ret = 0;
+        }
+        break;
     case CCW_CMD_WRITE_STATUS:
         if (check_len) {
             if (ccw.count != sizeof(status)) {
hw/s390x/virtio-ccw.h +1 -0
index 7ab8367..453fdf7 100644
@@ -40,6 +40,7 @@
 #define CCW_CMD_SET_IND      0x43
 #define CCW_CMD_SET_CONF_IND 0x53
 #define CCW_CMD_READ_VQ_CONF 0x32
+#define CCW_CMD_READ_STATUS  0x72
 #define CCW_CMD_SET_IND_ADAPTER 0x73
 #define CCW_CMD_SET_VIRTIO_REV 0x83
 
Signature · 1 line
2.3.8
#2 lore raw

RFC PATCH 1/2 s390x/virtio-ccw: respond to READ_STATUS command

In reply to Cornelia Huck

From: Pierre Morel <[email protected]>

This patch adds the response to the READ_STATUS CCW command.

---
 hw/s390x/virtio-ccw.c | 20 ++++++++++++++++++++
 hw/s390x/virtio-ccw.h |  1 +
 2 files changed, 21 insertions(+)
hw/s390x/virtio-ccw.c +20 -0
index fb103b7..dcd0fff 100644
@@ -586,6 +586,26 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
             }
         }
         break;
+    case CCW_CMD_READ_STATUS:
+        if (check_len) {
+            if (ccw.count != sizeof(status)) {
+                ret = -EINVAL;
+                break;
+            }
+        } else if (ccw.count < sizeof(status)) {
+            /* Can't execute command. */
+            ret = -EINVAL;
+            break;
+        }
+        if (!ccw.cda) {
+            ret = -EFAULT;
+        } else {
+            address_space_stb(&address_space_memory, ccw.cda, vdev->status,
+                                        MEMTXATTRS_UNSPECIFIED, NULL);
+            sch->curr_status.scsw.count = ccw.count - sizeof(vdev->status);;
+            ret = 0;
+        }
+        break;
     case CCW_CMD_WRITE_STATUS:
         if (check_len) {
             if (ccw.count != sizeof(status)) {
hw/s390x/virtio-ccw.h +1 -0
index 7ab8367..453fdf7 100644
@@ -40,6 +40,7 @@
 #define CCW_CMD_SET_IND      0x43
 #define CCW_CMD_SET_CONF_IND 0x53
 #define CCW_CMD_READ_VQ_CONF 0x32
+#define CCW_CMD_READ_STATUS  0x72
 #define CCW_CMD_SET_IND_ADAPTER 0x73
 #define CCW_CMD_SET_VIRTIO_REV 0x83
 
Signature · 1 line
2.3.8
#3 lore raw

RFC PATCH 2/2 s390x/virtio-ccw: set revision 2 as maximum revision number

In reply to Cornelia Huck

From: Pierre Morel <[email protected]>

We have everything needed for virtio-ccw revision 2 wired up now. Bump the maximum supported revision reported to the guest so they can make use of it.

---
 hw/s390x/virtio-ccw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/virtio-ccw.h +1 -1
index 453fdf7..da07bfa 100644
@@ -104,7 +104,7 @@ struct VirtioCcwDevice {
 };
 
 /* The maximum virtio revision we support. */
-#define VIRTIO_CCW_MAX_REV 1
+#define VIRTIO_CCW_MAX_REV 2
 static inline int virtio_ccw_rev_max(VirtioCcwDevice *dev)
 {
     return dev->max_rev;
Signature · 1 line
2.3.8
#4 lore raw

RFC PATCH 2/2 s390x/virtio-ccw: set revision 2 as maximum revision number

In reply to Cornelia Huck

From: Pierre Morel <[email protected]>

We have everything needed for virtio-ccw revision 2 wired up now. Bump the maximum supported revision reported to the guest so they can make use of it.

---
 hw/s390x/virtio-ccw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/virtio-ccw.h +1 -1
index 453fdf7..da07bfa 100644
@@ -104,7 +104,7 @@ struct VirtioCcwDevice {
 };
 
 /* The maximum virtio revision we support. */
-#define VIRTIO_CCW_MAX_REV 1
+#define VIRTIO_CCW_MAX_REV 2
 static inline int virtio_ccw_rev_max(VirtioCcwDevice *dev)
 {
     return dev->max_rev;
Signature · 1 line
2.3.8