Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807811/?format=api
{ "id": 807811, "url": "http://patchwork.ozlabs.org/api/patches/807811/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830170601.15855-5-david@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "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": "<20170830170601.15855-5-david@redhat.com>", "list_archive_url": null, "date": "2017-08-30T17:05:54", "name": "[v1,04/11] s390x: get rid of s390-virtio.c", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "a0a1b4572ee44c5b15309d42314f4d4bfbf784cf", "submitter": { "id": 70402, "url": "http://patchwork.ozlabs.org/api/people/70402/?format=api", "name": "David Hildenbrand", "email": "david@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830170601.15855-5-david@redhat.com/mbox/", "series": [ { "id": 666, "url": "http://patchwork.ozlabs.org/api/series/666/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=666", "date": "2017-08-30T17:06:00", "name": "next round of s390x cleanups", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/666/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807811/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807811/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>)", "ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=david@redhat.com" ], "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 3xjCcX5gN0z9sN7\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 03:46:52 +1000 (AEST)", "from localhost ([::1]:51902 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 1dn74k-00019u-9z\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 13:46:50 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:33367)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <david@redhat.com>) id 1dn6Rg-0005fj-D7\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:30 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <david@redhat.com>) id 1dn6Re-0002M2-KD\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:28 -0400", "from mx1.redhat.com ([209.132.183.28]:14818)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <david@redhat.com>) id 1dn6Re-0002LQ-AK\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:26 -0400", "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 362BF883AC;\n\tWed, 30 Aug 2017 17:06:25 +0000 (UTC)", "from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id DC2659B518;\n\tWed, 30 Aug 2017 17:06:20 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 362BF883AC", "From": "David Hildenbrand <david@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Wed, 30 Aug 2017 19:05:54 +0200", "Message-Id": "<20170830170601.15855-5-david@redhat.com>", "In-Reply-To": "<20170830170601.15855-1-david@redhat.com>", "References": "<20170830170601.15855-1-david@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tWed, 30 Aug 2017 17:06:25 +0000 (UTC)", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "209.132.183.28", "Subject": "[Qemu-devel] [PATCH v1 04/11] s390x: get rid of s390-virtio.c", "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": "thuth@redhat.com, david@redhat.com, cohuck@redhat.com,\n\tRichard Henderson <richard.henderson@linaro.org>,\n\tAlexander Graf <agraf@suse.de>, borntraeger@de.ibm.com,\n\tAurelien Jarno <aurelien@aurel32.net>", "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": "It is a leftover from the days where we had still the !ccw virtio\nmachine. As this one is long gone, let's move everything to\ns390-virtio-ccw.c.\n\nCornelia Huck <cohuck@redhat.com>\nSigned-off-by: David Hildenbrand <david@redhat.com>\n---\n hw/s390x/Makefile.objs | 1 -\n hw/s390x/s390-virtio-ccw.c | 120 ++++++++++++++++++++++++++++++++-\n hw/s390x/s390-virtio.c | 163 ---------------------------------------------\n hw/s390x/s390-virtio.h | 14 ----\n 4 files changed, 119 insertions(+), 179 deletions(-)\n delete mode 100644 hw/s390x/s390-virtio.c", "diff": "diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs\nindex 7ee19d3abc..dc704b57d6 100644\n--- a/hw/s390x/Makefile.objs\n+++ b/hw/s390x/Makefile.objs\n@@ -1,4 +1,3 @@\n-obj-y += s390-virtio.o\n obj-y += s390-virtio-hcall.o\n obj-y += sclp.o\n obj-y += event-facility.o\ndiff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c\nindex ffd56af834..41a9e976dc 100644\n--- a/hw/s390x/s390-virtio-ccw.c\n+++ b/hw/s390x/s390-virtio-ccw.c\n@@ -2,6 +2,7 @@\n * virtio ccw machine\n *\n * Copyright 2012 IBM Corp.\n+ * Copyright (c) 2009 Alexander Graf <agraf@suse.de>\n * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>\n *\n * This work is licensed under the terms of the GNU GPL, version 2 or (at\n@@ -31,6 +32,8 @@\n #include \"hw/s390x/css-bridge.h\"\n #include \"migration/register.h\"\n #include \"cpu_models.h\"\n+#include \"qapi/qmp/qerror.h\"\n+#include \"hw/nmi.h\"\n \n S390CPU *s390_cpu_addr2state(uint16_t cpu_addr)\n {\n@@ -133,7 +136,7 @@ static void virtio_ccw_register_hcalls(void)\n virtio_ccw_hcall_early_printk);\n }\n \n-void s390_memory_init(ram_addr_t mem_size)\n+static void s390_memory_init(ram_addr_t mem_size)\n {\n MemoryRegion *sysmem = get_system_memory();\n MemoryRegion *ram = g_new(MemoryRegion, 1);\n@@ -148,11 +151,104 @@ void s390_memory_init(ram_addr_t mem_size)\n s390_stattrib_init();\n }\n \n+#define S390_TOD_CLOCK_VALUE_MISSING 0x00\n+#define S390_TOD_CLOCK_VALUE_PRESENT 0x01\n+\n+static void gtod_save(QEMUFile *f, void *opaque)\n+{\n+ uint64_t tod_low;\n+ uint8_t tod_high;\n+ int r;\n+\n+ r = s390_get_clock(&tod_high, &tod_low);\n+ if (r) {\n+ fprintf(stderr, \"WARNING: Unable to get guest clock for migration. \"\n+ \"Error code %d. Guest clock will not be migrated \"\n+ \"which could cause the guest to hang.\\n\", r);\n+ qemu_put_byte(f, S390_TOD_CLOCK_VALUE_MISSING);\n+ return;\n+ }\n+\n+ qemu_put_byte(f, S390_TOD_CLOCK_VALUE_PRESENT);\n+ qemu_put_byte(f, tod_high);\n+ qemu_put_be64(f, tod_low);\n+}\n+\n+static int gtod_load(QEMUFile *f, void *opaque, int version_id)\n+{\n+ uint64_t tod_low;\n+ uint8_t tod_high;\n+ int r;\n+\n+ if (qemu_get_byte(f) == S390_TOD_CLOCK_VALUE_MISSING) {\n+ fprintf(stderr, \"WARNING: Guest clock was not migrated. This could \"\n+ \"cause the guest to hang.\\n\");\n+ return 0;\n+ }\n+\n+ tod_high = qemu_get_byte(f);\n+ tod_low = qemu_get_be64(f);\n+\n+ r = s390_set_clock(&tod_high, &tod_low);\n+ if (r) {\n+ fprintf(stderr, \"WARNING: Unable to set guest clock value. \"\n+ \"s390_get_clock returned error %d. This could cause \"\n+ \"the guest to hang.\\n\", r);\n+ }\n+\n+ return 0;\n+}\n+\n+\n static SaveVMHandlers savevm_gtod = {\n .save_state = gtod_save,\n .load_state = gtod_load,\n };\n \n+static void s390_init_ipl_dev(const char *kernel_filename,\n+ const char *kernel_cmdline,\n+ const char *initrd_filename, const char *firmware,\n+ const char *netboot_fw, bool enforce_bios)\n+{\n+ Object *new = object_new(TYPE_S390_IPL);\n+ DeviceState *dev = DEVICE(new);\n+\n+ if (kernel_filename) {\n+ qdev_prop_set_string(dev, \"kernel\", kernel_filename);\n+ }\n+ if (initrd_filename) {\n+ qdev_prop_set_string(dev, \"initrd\", initrd_filename);\n+ }\n+ qdev_prop_set_string(dev, \"cmdline\", kernel_cmdline);\n+ qdev_prop_set_string(dev, \"firmware\", firmware);\n+ qdev_prop_set_string(dev, \"netboot_fw\", netboot_fw);\n+ qdev_prop_set_bit(dev, \"enforce_bios\", enforce_bios);\n+ object_property_add_child(qdev_get_machine(), TYPE_S390_IPL,\n+ new, NULL);\n+ object_unref(new);\n+ qdev_init_nofail(dev);\n+}\n+\n+static void s390_create_virtio_net(BusState *bus, const char *name)\n+{\n+ int i;\n+\n+ for (i = 0; i < nb_nics; i++) {\n+ NICInfo *nd = &nd_table[i];\n+ DeviceState *dev;\n+\n+ if (!nd->model) {\n+ nd->model = g_strdup(\"virtio\");\n+ }\n+\n+ qemu_check_nic_model(nd, \"virtio\");\n+\n+ dev = qdev_create(bus, name);\n+ qdev_set_nic_properties(dev, nd);\n+ qdev_init_nofail(dev);\n+ }\n+}\n+\n static void ccw_init(MachineState *machine)\n {\n int ret;\n@@ -216,6 +312,19 @@ static void s390_cpu_plug(HotplugHandler *hotplug_dev,\n g_free(name);\n }\n \n+static void s390_machine_reset(void)\n+{\n+ S390CPU *ipl_cpu = S390_CPU(qemu_get_cpu(0));\n+\n+ s390_cmma_reset();\n+ qemu_devices_reset();\n+ s390_crypto_reset();\n+\n+ /* all cpus are stopped - configure and start the ipl cpu only */\n+ s390_ipl_prepare_cpu(ipl_cpu);\n+ s390_cpu_set_state(CPU_STATE_OPERATING, ipl_cpu);\n+}\n+\n static void s390_machine_device_plug(HotplugHandler *hotplug_dev,\n DeviceState *dev, Error **errp)\n {\n@@ -240,6 +349,15 @@ static void s390_hot_add_cpu(const int64_t id, Error **errp)\n s390x_new_cpu(machine->cpu_model, id, errp);\n }\n \n+static void s390_nmi(NMIState *n, int cpu_index, Error **errp)\n+{\n+ CPUState *cs = qemu_get_cpu(cpu_index);\n+\n+ if (s390_cpu_restart(S390_CPU(cs))) {\n+ error_setg(errp, QERR_UNSUPPORTED);\n+ }\n+}\n+\n static void ccw_machine_class_init(ObjectClass *oc, void *data)\n {\n MachineClass *mc = MACHINE_CLASS(oc);\ndiff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c\ndeleted file mode 100644\nindex 464b5c71f8..0000000000\n--- a/hw/s390x/s390-virtio.c\n+++ /dev/null\n@@ -1,163 +0,0 @@\n-/*\n- * QEMU S390 virtio target\n- *\n- * Copyright (c) 2009 Alexander Graf <agraf@suse.de>\n- * Copyright IBM Corp 2012\n- *\n- * This library is free software; you can redistribute it and/or\n- * modify it under the terms of the GNU Lesser General Public\n- * License as published by the Free Software Foundation; either\n- * version 2 of the License, or (at your option) any later version.\n- *\n- * This library is distributed in the hope that it will be useful,\n- * but WITHOUT ANY WARRANTY; without even the implied warranty of\n- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n- * Lesser General Public License for more details.\n- *\n- * Contributions after 2012-10-29 are licensed under the terms of the\n- * GNU GPL, version 2 or (at your option) any later version.\n- *\n- * You should have received a copy of the GNU (Lesser) General Public\n- * License along with this library; if not, see <http://www.gnu.org/licenses/>.\n- */\n-\n-#include \"qemu/osdep.h\"\n-#include \"qapi/error.h\"\n-#include \"hw/hw.h\"\n-#include \"qapi/qmp/qerror.h\"\n-#include \"qemu/error-report.h\"\n-#include \"sysemu/block-backend.h\"\n-#include \"sysemu/blockdev.h\"\n-#include \"sysemu/sysemu.h\"\n-#include \"net/net.h\"\n-#include \"hw/boards.h\"\n-#include \"hw/loader.h\"\n-#include \"hw/virtio/virtio.h\"\n-#include \"exec/address-spaces.h\"\n-#include \"sysemu/qtest.h\"\n-\n-#include \"hw/s390x/sclp.h\"\n-#include \"hw/s390x/s390_flic.h\"\n-#include \"hw/s390x/s390-virtio.h\"\n-#include \"hw/s390x/storage-keys.h\"\n-#include \"hw/s390x/ipl.h\"\n-#include \"cpu.h\"\n-\n-#define MAX_BLK_DEVS 10\n-\n-#define S390_TOD_CLOCK_VALUE_MISSING 0x00\n-#define S390_TOD_CLOCK_VALUE_PRESENT 0x01\n-\n-void s390_init_ipl_dev(const char *kernel_filename,\n- const char *kernel_cmdline,\n- const char *initrd_filename,\n- const char *firmware,\n- const char *netboot_fw,\n- bool enforce_bios)\n-{\n- Object *new = object_new(TYPE_S390_IPL);\n- DeviceState *dev = DEVICE(new);\n-\n- if (kernel_filename) {\n- qdev_prop_set_string(dev, \"kernel\", kernel_filename);\n- }\n- if (initrd_filename) {\n- qdev_prop_set_string(dev, \"initrd\", initrd_filename);\n- }\n- qdev_prop_set_string(dev, \"cmdline\", kernel_cmdline);\n- qdev_prop_set_string(dev, \"firmware\", firmware);\n- qdev_prop_set_string(dev, \"netboot_fw\", netboot_fw);\n- qdev_prop_set_bit(dev, \"enforce_bios\", enforce_bios);\n- object_property_add_child(qdev_get_machine(), TYPE_S390_IPL,\n- new, NULL);\n- object_unref(new);\n- qdev_init_nofail(dev);\n-}\n-\n-\n-void s390_create_virtio_net(BusState *bus, const char *name)\n-{\n- int i;\n-\n- for (i = 0; i < nb_nics; i++) {\n- NICInfo *nd = &nd_table[i];\n- DeviceState *dev;\n-\n- if (!nd->model) {\n- nd->model = g_strdup(\"virtio\");\n- }\n-\n- qemu_check_nic_model(nd, \"virtio\");\n-\n- dev = qdev_create(bus, name);\n- qdev_set_nic_properties(dev, nd);\n- qdev_init_nofail(dev);\n- }\n-}\n-\n-void gtod_save(QEMUFile *f, void *opaque)\n-{\n- uint64_t tod_low;\n- uint8_t tod_high;\n- int r;\n-\n- r = s390_get_clock(&tod_high, &tod_low);\n- if (r) {\n- fprintf(stderr, \"WARNING: Unable to get guest clock for migration. \"\n- \"Error code %d. Guest clock will not be migrated \"\n- \"which could cause the guest to hang.\\n\", r);\n- qemu_put_byte(f, S390_TOD_CLOCK_VALUE_MISSING);\n- return;\n- }\n-\n- qemu_put_byte(f, S390_TOD_CLOCK_VALUE_PRESENT);\n- qemu_put_byte(f, tod_high);\n- qemu_put_be64(f, tod_low);\n-}\n-\n-int gtod_load(QEMUFile *f, void *opaque, int version_id)\n-{\n- uint64_t tod_low;\n- uint8_t tod_high;\n- int r;\n-\n- if (qemu_get_byte(f) == S390_TOD_CLOCK_VALUE_MISSING) {\n- fprintf(stderr, \"WARNING: Guest clock was not migrated. This could \"\n- \"cause the guest to hang.\\n\");\n- return 0;\n- }\n-\n- tod_high = qemu_get_byte(f);\n- tod_low = qemu_get_be64(f);\n-\n- r = s390_set_clock(&tod_high, &tod_low);\n- if (r) {\n- fprintf(stderr, \"WARNING: Unable to set guest clock value. \"\n- \"s390_get_clock returned error %d. This could cause \"\n- \"the guest to hang.\\n\", r);\n- }\n-\n- return 0;\n-}\n-\n-void s390_nmi(NMIState *n, int cpu_index, Error **errp)\n-{\n- CPUState *cs = qemu_get_cpu(cpu_index);\n-\n- if (s390_cpu_restart(S390_CPU(cs))) {\n- error_setg(errp, QERR_UNSUPPORTED);\n- }\n-}\n-\n-void s390_machine_reset(void)\n-{\n- S390CPU *ipl_cpu = S390_CPU(qemu_get_cpu(0));\n-\n- s390_cmma_reset();\n- qemu_devices_reset();\n- s390_crypto_reset();\n-\n- /* all cpus are stopped - configure and start the ipl cpu only */\n- s390_ipl_prepare_cpu(ipl_cpu);\n- s390_cpu_set_state(CPU_STATE_OPERATING, ipl_cpu);\n-}\ndiff --git a/hw/s390x/s390-virtio.h b/hw/s390x/s390-virtio.h\nindex b6660e3ae9..d984cd4115 100644\n--- a/hw/s390x/s390-virtio.h\n+++ b/hw/s390x/s390-virtio.h\n@@ -12,23 +12,9 @@\n #ifndef HW_S390_VIRTIO_H\n #define HW_S390_VIRTIO_H\n \n-#include \"hw/nmi.h\"\n #include \"standard-headers/asm-s390/kvm_virtio.h\"\n #include \"standard-headers/asm-s390/virtio-ccw.h\"\n \n typedef int (*s390_virtio_fn)(const uint64_t *args);\n void s390_register_virtio_hypercall(uint64_t code, s390_virtio_fn fn);\n-\n-void s390_init_ipl_dev(const char *kernel_filename,\n- const char *kernel_cmdline,\n- const char *initrd_filename,\n- const char *firmware,\n- const char *netboot_fw,\n- bool enforce_bios);\n-void s390_create_virtio_net(BusState *bus, const char *name);\n-void s390_nmi(NMIState *n, int cpu_index, Error **errp);\n-void s390_machine_reset(void);\n-void s390_memory_init(ram_addr_t mem_size);\n-void gtod_save(QEMUFile *f, void *opaque);\n-int gtod_load(QEMUFile *f, void *opaque, int version_id);\n #endif\n", "prefixes": [ "v1", "04/11" ] }