{"id":812875,"url":"http://patchwork.ozlabs.org/api/patches/812875/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/a30f50d543182914e83cba5501f615a8ded2b858.1505225353.git.alifm@linux.vnet.ibm.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<a30f50d543182914e83cba5501f615a8ded2b858.1505225353.git.alifm@linux.vnet.ibm.com>","list_archive_url":null,"date":"2017-09-12T14:26:21","name":"[v1,2/2] virtio-gpu-ccw: Create a virtio gpu device for the ccw bus","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"82e373228fb4386222eafc9ed3e629d36be7f17a","submitter":{"id":71051,"url":"http://patchwork.ozlabs.org/api/people/71051/?format=json","name":"Farhan Ali","email":"alifm@linux.vnet.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/a30f50d543182914e83cba5501f615a8ded2b858.1505225353.git.alifm@linux.vnet.ibm.com/mbox/","series":[{"id":2716,"url":"http://patchwork.ozlabs.org/api/series/2716/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2716","date":"2017-09-12T14:26:20","name":"Virtio GPU for S390","version":1,"mbox":"http://patchwork.ozlabs.org/series/2716/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/812875/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/812875/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xs6c715V5z9sNV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 00:28:55 +1000 (AEST)","from localhost ([::1]:36205 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drmBJ-0001xN-9k\n\tfor incoming@patchwork.ozlabs.org; Tue, 12 Sep 2017 10:28:53 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:42552)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <alifm@linux.vnet.ibm.com>) id 1drm92-0000OC-Uw\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:26:34 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <alifm@linux.vnet.ibm.com>) id 1drm8z-0003hF-Gb\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:26:32 -0400","from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48170\n\thelo=mx0a-001b2d01.pphosted.com)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <alifm@linux.vnet.ibm.com>)\n\tid 1drm8z-0003gz-BX\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:26:29 -0400","from pps.filterd (m0098421.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv8CEOeGI041730\n\tfor <qemu-devel@nongnu.org>; Tue, 12 Sep 2017 10:26:28 -0400","from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2cxfq7x193-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <qemu-devel@nongnu.org>; Tue, 12 Sep 2017 10:26:28 -0400","from localhost\n\tby e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <qemu-devel@nongnu.org> from <alifm@linux.vnet.ibm.com>;\n\tTue, 12 Sep 2017 08:26:27 -0600","from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18)\n\tby e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tTue, 12 Sep 2017 08:26:26 -0600","from b03ledav003.gho.boulder.ibm.com\n\t(b03ledav003.gho.boulder.ibm.com [9.17.130.234])\n\tby b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v8CEQQEF65273862; Tue, 12 Sep 2017 07:26:26 -0700","from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id E6D146A03D;\n\tTue, 12 Sep 2017 08:26:25 -0600 (MDT)","from alifm-ThinkPad-W540.pok.ibm.com (unknown [9.56.58.110])\n\tby b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTPS id\n\t587CE6A03C; Tue, 12 Sep 2017 08:26:25 -0600 (MDT)"],"From":"Farhan Ali <alifm@linux.vnet.ibm.com>","To":"qemu-devel@nongnu.org","Date":"Tue, 12 Sep 2017 10:26:21 -0400","X-Mailer":"git-send-email 1.9.1","In-Reply-To":["<cover.1505225353.git.alifm@linux.vnet.ibm.com>","<cover.1505225353.git.alifm@linux.vnet.ibm.com>"],"References":["<cover.1505225353.git.alifm@linux.vnet.ibm.com>","<cover.1505225353.git.alifm@linux.vnet.ibm.com>"],"X-TM-AS-GCONF":"00","x-cbid":"17091214-8235-0000-0000-00000C42509D","X-IBM-SpamModules-Scores":"","X-IBM-SpamModules-Versions":"BY=3.00007711; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000227; SDB=6.00915972; UDB=6.00459921;\n\tIPR=6.00696203; \n\tBA=6.00005587; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017126;\n\tXFM=3.00000015; UTC=2017-09-12 14:26:27","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17091214-8236-0000-0000-00003D9D7B7B","Message-Id":"<a30f50d543182914e83cba5501f615a8ded2b858.1505225353.git.alifm@linux.vnet.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-12_04:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=1\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709120202","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy]","X-Received-From":"148.163.158.5","Subject":"[Qemu-devel] [PATCH v1 2/2] virtio-gpu-ccw: Create a virtio gpu\n\tdevice for the ccw bus","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"borntraeger@de.ibm.com, thuth@redhat.com, cohuck@redhat.com,\n\tkraxel@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Wire up the virtio-gpu device for the CCW bus. The virtio-gpu\nis a virtio-1 device, so disable revision 0.\n\nSigned-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\n---\n hw/s390x/virtio-ccw.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++\n hw/s390x/virtio-ccw.h | 10 ++++++++++\n 2 files changed, 64 insertions(+)","diff":"diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c\nindex b1976fd..3078bf0 100644\n--- a/hw/s390x/virtio-ccw.c\n+++ b/hw/s390x/virtio-ccw.c\n@@ -1007,6 +1007,20 @@ static void virtio_ccw_crypto_realize(VirtioCcwDevice *ccw_dev, Error **errp)\n                              NULL);\n }\n \n+static void virtio_ccw_gpu_realize(VirtioCcwDevice *ccw_dev, Error **errp)\n+{\n+    VirtIOGPUCcw *dev = VIRTIO_GPU_CCW(ccw_dev);\n+    DeviceState *vdev = DEVICE(&dev->vdev);\n+    Error *err = NULL;\n+\n+    qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));\n+    object_property_set_bool(OBJECT(vdev), true, \"realized\", &err);\n+    if (err) {\n+        error_propagate(errp, err);\n+        return;\n+    }\n+}\n+\n /* DeviceState to VirtioCcwDevice. Note: used on datapath,\n  * be careful and test performance if you change this.\n  */\n@@ -1616,6 +1630,45 @@ static const TypeInfo virtio_ccw_crypto = {\n     .class_init    = virtio_ccw_crypto_class_init,\n };\n \n+static Property virtio_ccw_gpu_properties[] = {\n+    DEFINE_PROP_BIT(\"ioeventfd\", VirtioCcwDevice, flags,\n+                    VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true),\n+    DEFINE_PROP_UINT32(\"max_revision\", VirtioCcwDevice, max_rev,\n+                       VIRTIO_CCW_MAX_REV),\n+    DEFINE_PROP_END_OF_LIST(),\n+};\n+\n+static void virtio_ccw_gpu_instance_init(Object *obj)\n+{\n+    VirtIOGPUCcw *dev = VIRTIO_GPU_CCW(obj);\n+    VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);\n+\n+    ccw_dev->force_revision_1 = true;\n+    virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),\n+                                TYPE_VIRTIO_GPU);\n+}\n+\n+static void virtio_ccw_gpu_class_init(ObjectClass *klass, void *data)\n+{\n+    DeviceClass *dc = DEVICE_CLASS(klass);\n+    VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);\n+\n+    k->realize = virtio_ccw_gpu_realize;\n+    k->exit = virtio_ccw_exit;\n+    dc->reset = virtio_ccw_reset;\n+    dc->props = virtio_ccw_gpu_properties;\n+    dc->hotpluggable = false;\n+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);\n+}\n+\n+static const TypeInfo virtio_ccw_gpu = {\n+    .name          = TYPE_VIRTIO_GPU_CCW,\n+    .parent        = TYPE_VIRTIO_CCW_DEVICE,\n+    .instance_size = sizeof(VirtIOGPUCcw),\n+    .instance_init = virtio_ccw_gpu_instance_init,\n+    .class_init    = virtio_ccw_gpu_class_init,\n+};\n+\n static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp)\n {\n     VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;\n@@ -1815,6 +1868,7 @@ static void virtio_ccw_register(void)\n     type_register_static(&vhost_vsock_ccw_info);\n #endif\n     type_register_static(&virtio_ccw_crypto);\n+    type_register_static(&virtio_ccw_gpu);\n }\n \n type_init(virtio_ccw_register)\ndiff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h\nindex 41d4010..541fdd2 100644\n--- a/hw/s390x/virtio-ccw.h\n+++ b/hw/s390x/virtio-ccw.h\n@@ -27,6 +27,7 @@\n #ifdef CONFIG_VHOST_VSOCK\n #include \"hw/virtio/vhost-vsock.h\"\n #endif /* CONFIG_VHOST_VSOCK */\n+#include \"hw/virtio/virtio-gpu.h\"\n \n #include \"hw/s390x/s390_flic.h\"\n #include \"hw/s390x/css.h\"\n@@ -223,4 +224,13 @@ typedef struct VHostVSockCCWState {\n \n #endif /* CONFIG_VHOST_VSOCK */\n \n+#define TYPE_VIRTIO_GPU_CCW \"virtio-gpu-ccw\"\n+#define VIRTIO_GPU_CCW(obj) \\\n+        OBJECT_CHECK(VirtIOGPUCcw, (obj), TYPE_VIRTIO_GPU_CCW)\n+\n+typedef struct VirtIOGPUCcw {\n+    VirtioCcwDevice parent_obj;\n+    VirtIOGPU vdev;\n+} VirtIOGPUCcw;\n+\n #endif\n","prefixes":["v1","2/2"]}