get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/817631/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 817631,
    "url": "http://patchwork.ozlabs.org/api/patches/817631/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170922160111.31885-5-f4bug@amsat.org/",
    "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": "<20170922160111.31885-5-f4bug@amsat.org>",
    "list_archive_url": null,
    "date": "2017-09-22T16:01:04",
    "name": "[27/34] hw/pci: declare pci_nic_init_nofail() in \"hw/net/pci.h\"",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "890db4d9c2537aabbb2e97189d1c0709f746c1ee",
    "submitter": {
        "id": 70924,
        "url": "http://patchwork.ozlabs.org/api/people/70924/?format=api",
        "name": "Philippe Mathieu-Daudé",
        "email": "f4bug@amsat.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170922160111.31885-5-f4bug@amsat.org/mbox/",
    "series": [
        {
            "id": 4657,
            "url": "http://patchwork.ozlabs.org/api/series/4657/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4657",
            "date": "2017-09-22T15:39:40",
            "name": "remove i386/pc dependency from non-PC world (part 1)",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/4657/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/817631/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/817631/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>)",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"lhldpALc\"; dkim-atps=neutral"
        ],
        "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 3xzJfq4K5vz9s7g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 23 Sep 2017 02:22:43 +1000 (AEST)",
            "from localhost ([::1]:59952 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 1dvQiv-0007TY-J2\n\tfor incoming@patchwork.ozlabs.org; Fri, 22 Sep 2017 12:22:41 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:51723)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dvQOs-0006Gt-DS\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 12:02:00 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dvQOo-0008Uo-6S\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 12:01:58 -0400",
            "from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:36751)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dvQOo-0008Ua-0a; Fri, 22 Sep 2017 12:01:54 -0400",
            "by mail-qk0-x242.google.com with SMTP id i14so908191qke.3;\n\tFri, 22 Sep 2017 09:01:53 -0700 (PDT)",
            "from yoga.lan ([181.93.89.178]) by smtp.gmail.com with ESMTPSA id\n\ty31sm108325qta.83.2017.09.22.09.01.48\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 22 Sep 2017 09:01:52 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=wB9cQWZ63jBoxAPIWOrQ2/o89ItltycECfcVfEDTyjQ=;\n\tb=lhldpALcRSql0uZYm52aXhsWNTvMsD+W6ubYEFrDV6+bdw3wPR2vtvt39jkUstDHDW\n\tgiRGamRumbLO2su4tvlsKcXZ45PQX/IRGpR9IW3e0fIpEQiXKKJwRtVfleFZtWMAf45a\n\ttI0sC1pgMA09BqS3XsmgWovxAq8j9Xnr6Eum1Yu6PenAx/ZJaO/LHFAUYmCHvytk6pDz\n\tyXQJIWr/0eDJfVQqaaBuDxX+DrabsIm9VmuexbyIn6eE+DUKwTLxLQnpycN7qLps506G\n\tSGOw0x6YYGJYlRdV4okmI6RjbbPW2i3n3tiLzHSFMwMn678+xQSsbpTkgCB65x2QQlyj\n\tRfvA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references:mime-version:content-transfer-encoding;\n\tbh=wB9cQWZ63jBoxAPIWOrQ2/o89ItltycECfcVfEDTyjQ=;\n\tb=f4l7lfd1ZLEFKHWE9c6Sh95eSGLQ9lFcYpy+BHCoTwtZ8zoVZbNUuBjRhUJ304RG7g\n\tjfpDQUzODwHbQwpPsJ4Fgknsqs/zFM0SjqiOpAfdqkeg0+IhU/4oq9O887jC/PtD08JD\n\tImDY2u0O5UjkhVZyCYHm6TdW8qnygPc+OR+kqpADV4GsYd+2jPpDxrFg0MixodpSEU4U\n\tf982CZPUE3zkc0nnEszO8abft+sgvbnb2bPIp78Fl6B+nRk3oguudiS+wWB4kf5u8crI\n\tyfKvQsTXp9e+P5z9JRuA8XIu3es5KFD3TF/MdL0QvIXJmHb0NU+XVRKSoXh4B6RrTDSo\n\tzoBg==",
        "X-Gm-Message-State": "AHPjjUie9uxoI5gZ3NP9JZSfFzggtZ+kGOsjlwvfOI/YJTZWzKA49Utw\n\tNDTRwH0/esUMfKF36Br7hic=",
        "X-Google-Smtp-Source": "AOwi7QBXhTISXJx2mHKlC8twiPktg6QBjr5KgqPlAeHQ4CRPKKuDQpwS1hd9VoWF4NjX8aGuSQ3ggg==",
        "X-Received": "by 10.55.54.12 with SMTP id d12mr7884240qka.20.1506096113283;\n\tFri, 22 Sep 2017 09:01:53 -0700 (PDT)",
        "From": "=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>",
        "To": "Peter Maydell <peter.maydell@linaro.org>, Thomas Huth <thuth@redhat.com>,\n\tPaolo Bonzini <pbonzini@redhat.com>,\n\t\"Michael S. Tsirkin\" <mst@redhat.com>, \n\tMarcel Apfelbaum <marcel@redhat.com>,\n\tAurelien Jarno <aurelien@aurel32.net>,\n\tYongbok Kim <yongbok.kim@imgtec.com>, Alexander Graf <agraf@suse.de>, \n\tDavid Gibson <david@gibson.dropbear.id.au>,\n\tJason Wang <jasowang@redhat.com>",
        "Date": "Fri, 22 Sep 2017 13:01:04 -0300",
        "Message-Id": "<20170922160111.31885-5-f4bug@amsat.org>",
        "X-Mailer": "git-send-email 2.14.1",
        "In-Reply-To": "<20170922154014.29350-1-f4bug@amsat.org>",
        "References": "<20170922154014.29350-1-f4bug@amsat.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-detected-operating-system": "by eggs.gnu.org: Genre and OS details not\n\trecognized.",
        "X-Received-From": "2607:f8b0:400d:c09::242",
        "Subject": "[Qemu-devel] [PATCH 27/34] hw/pci: declare pci_nic_init_nofail() in\n\t\"hw/net/pci.h\"",
        "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": "qemu-trivial@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org,\n\t=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>,\n\tqemu-devel@nongnu.org",
        "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": "Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n---\n hw/pci/pci_internal.h | 16 +++++++++++\n include/hw/net/pci.h  | 20 +++++++++++++\n include/hw/pci/pci.h  |  4 ---\n hw/arm/virt.c         |  1 +\n hw/mips/mips_malta.c  |  1 +\n hw/pci/pci.c          | 67 ++------------------------------------------\n hw/pci/pci_nic.c      | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++\n hw/ppc/e500.c         |  1 +\n hw/ppc/spapr.c        |  1 +\n hw/pci/Makefile.objs  |  1 +\n 10 files changed, 120 insertions(+), 69 deletions(-)\n create mode 100644 hw/pci/pci_internal.h\n create mode 100644 include/hw/net/pci.h\n create mode 100644 hw/pci/pci_nic.c",
    "diff": "diff --git a/hw/pci/pci_internal.h b/hw/pci/pci_internal.h\nnew file mode 100644\nindex 0000000000..d967468767\n--- /dev/null\n+++ b/hw/pci/pci_internal.h\n@@ -0,0 +1,16 @@\n+/*\n+ * QEMU PCI internal\n+ *\n+ * Copyright (c) 2005 Fabrice Bellard\n+ *\n+ * This work is licensed under the terms of the GNU GPL, version 2 or later.\n+ * See the COPYING file in the top-level directory.\n+ */\n+#ifndef QEMU_HW_PCI_INTERNAL_H\n+#define QEMU_HW_PCI_INTERNAL_H\n+\n+#include \"hw/pci/pci_bus.h\"\n+\n+PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr);\n+\n+#endif\ndiff --git a/include/hw/net/pci.h b/include/hw/net/pci.h\nnew file mode 100644\nindex 0000000000..529591b7f3\n--- /dev/null\n+++ b/include/hw/net/pci.h\n@@ -0,0 +1,20 @@\n+/*\n+ * QEMU network devices\n+ *\n+ * Copyright (c) 2005 Fabrice Bellard\n+ *\n+ * This work is licensed under the terms of the GNU GPL, version 2 or later.\n+ * See the COPYING file in the top-level directory.\n+ */\n+#ifndef QEMU_HW_NET_PCI_H\n+#define QEMU_HW_NET_PCI_H\n+\n+#include \"net/net.h\"\n+#include \"hw/pci/pci.h\"\n+#include \"hw/pci/pci_bus.h\"\n+\n+PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,\n+                               const char *default_model,\n+                               const char *default_devaddr);\n+\n+#endif\ndiff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h\nindex aa7ef9cf69..6a0f7b5472 100644\n--- a/include/hw/pci/pci.h\n+++ b/include/hw/pci/pci.h\n@@ -422,10 +422,6 @@ void pci_device_set_intx_routing_notifier(PCIDevice *dev,\n                                           PCIINTxRoutingNotifier notifier);\n void pci_device_reset(PCIDevice *dev);\n \n-PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,\n-                               const char *default_model,\n-                               const char *default_devaddr);\n-\n PCIDevice *pci_vga_init(PCIBus *bus);\n \n int pci_bus_num(PCIBus *s);\ndiff --git a/hw/arm/virt.c b/hw/arm/virt.c\nindex 9e18b410d7..39fab3acb9 100644\n--- a/hw/arm/virt.c\n+++ b/hw/arm/virt.c\n@@ -35,6 +35,7 @@\n #include \"hw/arm/primecell.h\"\n #include \"hw/arm/virt.h\"\n #include \"hw/devices.h\"\n+#include \"hw/net/pci.h\"\n #include \"net/net.h\"\n #include \"sysemu/block-backend.h\"\n #include \"sysemu/device_tree.h\"\ndiff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c\nindex 6945fa47c3..fb6a2f9363 100644\n--- a/hw/mips/mips_malta.c\n+++ b/hw/mips/mips_malta.c\n@@ -48,6 +48,7 @@\n #include \"hw/timer/mc146818rtc.h\"\n #include \"hw/input/i8042.h\"\n #include \"hw/timer/i8254.h\"\n+#include \"hw/net/pci.h\"\n #include \"sysemu/blockdev.h\"\n #include \"exec/address-spaces.h\"\n #include \"hw/sysbus.h\"             /* SysBusDevice */\ndiff --git a/hw/pci/pci.c b/hw/pci/pci.c\nindex 1e6fb88eba..9b678c8fd0 100644\n--- a/hw/pci/pci.c\n+++ b/hw/pci/pci.c\n@@ -28,7 +28,6 @@\n #include \"hw/pci/pci_bus.h\"\n #include \"hw/pci/pci_host.h\"\n #include \"monitor/monitor.h\"\n-#include \"net/net.h\"\n #include \"sysemu/sysemu.h\"\n #include \"hw/loader.h\"\n #include \"qemu/error-report.h\"\n@@ -41,6 +40,7 @@\n #include \"hw/hotplug.h\"\n #include \"hw/boards.h\"\n #include \"qemu/cutils.h\"\n+#include \"pci_internal.h\"\n \n //#define DEBUG_PCI\n #ifdef DEBUG_PCI\n@@ -671,8 +671,7 @@ static int pci_parse_devaddr(const char *addr, int *domp, int *busp,\n     return 0;\n }\n \n-static PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root,\n-                                 const char *devaddr)\n+PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr)\n {\n     int dom, bus;\n     unsigned slot;\n@@ -1812,68 +1811,6 @@ PciInfoList *qmp_query_pci(Error **errp)\n     return head;\n }\n \n-static const char * const pci_nic_models[] = {\n-    \"ne2k_pci\",\n-    \"i82551\",\n-    \"i82557b\",\n-    \"i82559er\",\n-    \"rtl8139\",\n-    \"e1000\",\n-    \"pcnet\",\n-    \"virtio\",\n-    \"sungem\",\n-    NULL\n-};\n-\n-static const char * const pci_nic_names[] = {\n-    \"ne2k_pci\",\n-    \"i82551\",\n-    \"i82557b\",\n-    \"i82559er\",\n-    \"rtl8139\",\n-    \"e1000\",\n-    \"pcnet\",\n-    \"virtio-net-pci\",\n-    \"sungem\",\n-    NULL\n-};\n-\n-/* Initialize a PCI NIC.  */\n-PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,\n-                               const char *default_model,\n-                               const char *default_devaddr)\n-{\n-    const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr;\n-    PCIBus *bus;\n-    PCIDevice *pci_dev;\n-    DeviceState *dev;\n-    int devfn;\n-    int i;\n-\n-    if (qemu_show_nic_models(nd->model, pci_nic_models)) {\n-        exit(0);\n-    }\n-\n-    i = qemu_find_nic_model(nd, pci_nic_models, default_model);\n-    if (i < 0) {\n-        exit(1);\n-    }\n-\n-    bus = pci_get_bus_devfn(&devfn, rootbus, devaddr);\n-    if (!bus) {\n-        error_report(\"Invalid PCI device address %s for device %s\",\n-                     devaddr, pci_nic_names[i]);\n-        exit(1);\n-    }\n-\n-    pci_dev = pci_create(bus, devfn, pci_nic_names[i]);\n-    dev = &pci_dev->qdev;\n-    qdev_set_nic_properties(dev, nd);\n-    qdev_init_nofail(dev);\n-\n-    return pci_dev;\n-}\n-\n PCIDevice *pci_vga_init(PCIBus *bus)\n {\n     switch (vga_interface_type) {\ndiff --git a/hw/pci/pci_nic.c b/hw/pci/pci_nic.c\nnew file mode 100644\nindex 0000000000..fb1a10ff12\n--- /dev/null\n+++ b/hw/pci/pci_nic.c\n@@ -0,0 +1,77 @@\n+/*\n+ * QEMU PCI network interface\n+ *\n+ * Copyright (c) 2004 Fabrice Bellard\n+ *\n+ * This work is licensed under the terms of the GNU GPL, version 2 or later.\n+ * See the COPYING file in the top-level directory.\n+ */\n+#include \"qemu/osdep.h\"\n+#include \"qemu/error-report.h\"\n+#include \"hw/pci/pci.h\"\n+#include \"hw/pci/pci_bus.h\"\n+#include \"hw/net/pci.h\"\n+#include \"net/net.h\"\n+#include \"pci_internal.h\"\n+\n+static const char *const pci_nic_models[] = {\n+    \"ne2k_pci\",\n+    \"i82551\",\n+    \"i82557b\",\n+    \"i82559er\",\n+    \"rtl8139\",\n+    \"e1000\",\n+    \"pcnet\",\n+    \"virtio\",\n+    \"sungem\",\n+    NULL\n+};\n+\n+static const char *const pci_nic_names[] = {\n+    \"ne2k_pci\",\n+    \"i82551\",\n+    \"i82557b\",\n+    \"i82559er\",\n+    \"rtl8139\",\n+    \"e1000\",\n+    \"pcnet\",\n+    \"virtio-net-pci\",\n+    \"sungem\",\n+    NULL\n+};\n+\n+/* Initialize a PCI NIC.  */\n+PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,\n+                               const char *default_model,\n+                               const char *default_devaddr)\n+{\n+    const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr;\n+    PCIBus *bus;\n+    PCIDevice *pci_dev;\n+    DeviceState *dev;\n+    int devfn;\n+    int i;\n+\n+    if (qemu_show_nic_models(nd->model, pci_nic_models)) {\n+        exit(0);\n+    }\n+\n+    i = qemu_find_nic_model(nd, pci_nic_models, default_model);\n+    if (i < 0) {\n+        exit(1);\n+    }\n+\n+    bus = pci_get_bus_devfn(&devfn, rootbus, devaddr);\n+    if (!bus) {\n+        error_report(\"Invalid PCI device address %s for device %s\",\n+                     devaddr, pci_nic_names[i]);\n+        exit(1);\n+    }\n+\n+    pci_dev = pci_create(bus, devfn, pci_nic_names[i]);\n+    dev = &pci_dev->qdev;\n+    qdev_set_nic_properties(dev, nd);\n+    qdev_init_nofail(dev);\n+\n+    return pci_dev;\n+}\ndiff --git a/hw/ppc/e500.c b/hw/ppc/e500.c\nindex db0e49ab8f..482757ca7b 100644\n--- a/hw/ppc/e500.c\n+++ b/hw/ppc/e500.c\n@@ -24,6 +24,7 @@\n #include \"hw/hw.h\"\n #include \"hw/char/serial.h\"\n #include \"hw/pci/pci.h\"\n+#include \"hw/net/pci.h\"\n #include \"hw/boards.h\"\n #include \"sysemu/sysemu.h\"\n #include \"sysemu/kvm.h\"\ndiff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c\nindex 17ea77618c..96007051e2 100644\n--- a/hw/ppc/spapr.c\n+++ b/hw/ppc/spapr.c\n@@ -56,6 +56,7 @@\n #include \"hw/pci-host/spapr.h\"\n #include \"hw/ppc/xics.h\"\n #include \"hw/pci/msi.h\"\n+#include \"hw/net/pci.h\"\n \n #include \"hw/pci/pci.h\"\n #include \"hw/scsi/scsi.h\"\ndiff --git a/hw/pci/Makefile.objs b/hw/pci/Makefile.objs\nindex 9f905e6344..125428fd54 100644\n--- a/hw/pci/Makefile.objs\n+++ b/hw/pci/Makefile.objs\n@@ -1,4 +1,5 @@\n common-obj-$(CONFIG_PCI) += pci.o pci_bridge.o\n+common-obj-$(CONFIG_PCI) += pci_nic.o\n common-obj-$(CONFIG_PCI) += msix.o msi.o\n common-obj-$(CONFIG_PCI) += shpc.o\n common-obj-$(CONFIG_PCI) += slotid_cap.o\n",
    "prefixes": [
        "27/34"
    ]
}