get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 807762,
    "url": "http://patchwork.ozlabs.org/api/patches/807762/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830165252.13421-20-cohuck@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": "<20170830165252.13421-20-cohuck@redhat.com>",
    "list_archive_url": null,
    "date": "2017-08-30T16:52:27",
    "name": "[PULL,19/44] s390x/sclp: properly guard pci-specific functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "f5ff7537b6b704f3bef9e99a12cab58e31da26dd",
    "submitter": {
        "id": 71914,
        "url": "http://patchwork.ozlabs.org/api/people/71914/?format=api",
        "name": "Cornelia Huck",
        "email": "cohuck@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830165252.13421-20-cohuck@redhat.com/mbox/",
    "series": [
        {
            "id": 656,
            "url": "http://patchwork.ozlabs.org/api/series/656/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=656",
            "date": "2017-08-30T16:52:08",
            "name": "[PULL,01/44] s390x/css: use macro for event-information pending error recover code",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/656/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/807762/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/807762/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-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=cohuck@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 3xjBxB0zxgz9s8P\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 03:16:14 +1000 (AEST)",
            "from localhost ([::1]:51721 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 1dn6b5-0005Wh-OH\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 13:16:11 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:57095)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <cohuck@redhat.com>) id 1dn6G2-0002P5-Dz\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:54:30 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <cohuck@redhat.com>) id 1dn6G1-0005Qm-9B\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:54:26 -0400",
            "from mx1.redhat.com ([209.132.183.28]:37558)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <cohuck@redhat.com>) id 1dn6G0-0005QV-Vp\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:54:25 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\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 DBA6E5F7B1;\n\tWed, 30 Aug 2017 16:54:23 +0000 (UTC)",
            "from localhost (ovpn-116-210.ams2.redhat.com [10.36.116.210])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 18D2187CB7;\n\tWed, 30 Aug 2017 16:54:20 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com DBA6E5F7B1",
        "From": "Cornelia Huck <cohuck@redhat.com>",
        "To": "peter.maydell@linaro.org",
        "Date": "Wed, 30 Aug 2017 18:52:27 +0200",
        "Message-Id": "<20170830165252.13421-20-cohuck@redhat.com>",
        "In-Reply-To": "<20170830165252.13421-1-cohuck@redhat.com>",
        "References": "<20170830165252.13421-1-cohuck@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tWed, 30 Aug 2017 16:54:24 +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] [PULL 19/44] s390x/sclp: properly guard pci-specific\n\tfunctions",
        "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, Cornelia Huck <cohuck@redhat.com>,\n\tagraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com,\n\trth@twiddle.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": "If we do not provide zpci, pci reconfiguration via sclp is not available\neither. I/O adapter configuration, however, should always be present.\n\nRename the values that refer to I/O adapter configuration (instead of only\npci) to make things clearer.\n\nMove length checking of the sccb for I/O adapter configuration into the\ncommon sclp code (out of the pci code). This also fixes an issue that\nthe pci code would refer to a field in the sccb before checking whether\nit was actually long enough.\n\nCheck for the adapter type in the sccb and return unrecognized adapter\ntype if the guest tries to issue I/O adapter configure/deconfigure for\na type other than pci or for pci if the zpci facility is not provided.\n\nReviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>\nReviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Cornelia Huck <cohuck@redhat.com>\n---\n hw/s390x/s390-pci-bus.c | 14 ++------------\n hw/s390x/s390-pci-bus.h |  8 --------\n hw/s390x/sclp.c         | 39 ++++++++++++++++++++++++++++++++++-----\n include/hw/s390x/sclp.h | 16 ++++++++++++----\n 4 files changed, 48 insertions(+), 29 deletions(-)",
    "diff": "diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c\nindex c57f6ebae0..0a31a4ae88 100644\n--- a/hw/s390x/s390-pci-bus.c\n+++ b/hw/s390x/s390-pci-bus.c\n@@ -122,16 +122,11 @@ S390PCIBusDevice *s390_pci_find_dev_by_fid(S390pciState *s, uint32_t fid)\n \n void s390_pci_sclp_configure(SCCB *sccb)\n {\n-    PciCfgSccb *psccb = (PciCfgSccb *)sccb;\n+    IoaCfgSccb *psccb = (IoaCfgSccb *)sccb;\n     S390PCIBusDevice *pbdev = s390_pci_find_dev_by_fid(s390_get_phb(),\n                                                        be32_to_cpu(psccb->aid));\n     uint16_t rc;\n \n-    if (be16_to_cpu(sccb->h.length) < 16) {\n-        rc = SCLP_RC_INSUFFICIENT_SCCB_LENGTH;\n-        goto out;\n-    }\n-\n     if (!pbdev) {\n         DPRINTF(\"sclp config no dev found\\n\");\n         rc = SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED;\n@@ -155,16 +150,11 @@ out:\n \n void s390_pci_sclp_deconfigure(SCCB *sccb)\n {\n-    PciCfgSccb *psccb = (PciCfgSccb *)sccb;\n+    IoaCfgSccb *psccb = (IoaCfgSccb *)sccb;\n     S390PCIBusDevice *pbdev = s390_pci_find_dev_by_fid(s390_get_phb(),\n                                                        be32_to_cpu(psccb->aid));\n     uint16_t rc;\n \n-    if (be16_to_cpu(sccb->h.length) < 16) {\n-        rc = SCLP_RC_INSUFFICIENT_SCCB_LENGTH;\n-        goto out;\n-    }\n-\n     if (!pbdev) {\n         DPRINTF(\"sclp deconfig no dev found\\n\");\n         rc = SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED;\ndiff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h\nindex 5df6292509..bd636abc28 100644\n--- a/hw/s390x/s390-pci-bus.h\n+++ b/hw/s390x/s390-pci-bus.h\n@@ -244,14 +244,6 @@ typedef struct ChscSeiNt2Res {\n     uint8_t ccdf[4016];\n } QEMU_PACKED ChscSeiNt2Res;\n \n-typedef struct PciCfgSccb {\n-    SCCBHeader header;\n-    uint8_t atype;\n-    uint8_t reserved1;\n-    uint16_t reserved2;\n-    uint32_t aid;\n-} QEMU_PACKED PciCfgSccb;\n-\n typedef struct S390MsixInfo {\n     bool available;\n     uint8_t table_bar;\ndiff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c\nindex 9253dbbc64..7ae6a0e37a 100644\n--- a/hw/s390x/sclp.c\n+++ b/hw/s390x/sclp.c\n@@ -80,7 +80,7 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)\n     prepare_cpu_entries(sclp, read_info->entries, cpu_count);\n \n     read_info->facilities = cpu_to_be64(SCLP_HAS_CPU_INFO |\n-                                        SCLP_HAS_PCI_RECONFIG);\n+                                        SCLP_HAS_IOA_RECONFIG);\n \n     /* Memory Hotplug is only supported for the ccw machine type */\n     if (mhd) {\n@@ -354,6 +354,35 @@ static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB *sccb)\n     sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION);\n }\n \n+static void sclp_configure_io_adapter(SCLPDevice *sclp, SCCB *sccb,\n+                                      bool configure)\n+{\n+    int rc;\n+\n+    if (be16_to_cpu(sccb->h.length) < 16) {\n+        rc = SCLP_RC_INSUFFICIENT_SCCB_LENGTH;\n+        goto out_err;\n+    }\n+\n+    switch (((IoaCfgSccb *)sccb)->atype) {\n+    case SCLP_RECONFIG_PCI_ATYPE:\n+        if (s390_has_feat(S390_FEAT_ZPCI)) {\n+            if (configure) {\n+                s390_pci_sclp_configure(sccb);\n+            } else {\n+                s390_pci_sclp_deconfigure(sccb);\n+            }\n+            return;\n+        }\n+        /* fallthrough */\n+    default:\n+        rc = SCLP_RC_ADAPTER_TYPE_NOT_RECOGNIZED;\n+    }\n+\n+ out_err:\n+    sccb->h.response_code = cpu_to_be16(rc);\n+}\n+\n static void sclp_execute(SCLPDevice *sclp, SCCB *sccb, uint32_t code)\n {\n     SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);\n@@ -384,11 +413,11 @@ static void sclp_execute(SCLPDevice *sclp, SCCB *sccb, uint32_t code)\n     case SCLP_UNASSIGN_STORAGE:\n         sclp_c->unassign_storage(sclp, sccb);\n         break;\n-    case SCLP_CMDW_CONFIGURE_PCI:\n-        s390_pci_sclp_configure(sccb);\n+    case SCLP_CMDW_CONFIGURE_IOA:\n+        sclp_configure_io_adapter(sclp, sccb, true);\n         break;\n-    case SCLP_CMDW_DECONFIGURE_PCI:\n-        s390_pci_sclp_deconfigure(sccb);\n+    case SCLP_CMDW_DECONFIGURE_IOA:\n+        sclp_configure_io_adapter(sclp, sccb, false);\n         break;\n     default:\n         efc->command_handler(ef, sccb, code);\ndiff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h\nindex fe54442ecd..a72d096081 100644\n--- a/include/hw/s390x/sclp.h\n+++ b/include/hw/s390x/sclp.h\n@@ -44,10 +44,10 @@\n #define SCLP_CMDW_DECONFIGURE_CPU               0x00100001\n \n /* SCLP PCI codes */\n-#define SCLP_HAS_PCI_RECONFIG                   0x0000000040000000ULL\n-#define SCLP_CMDW_CONFIGURE_PCI                 0x001a0001\n-#define SCLP_CMDW_DECONFIGURE_PCI               0x001b0001\n-#define SCLP_RECONFIG_PCI_ATPYE                 2\n+#define SCLP_HAS_IOA_RECONFIG                   0x0000000040000000ULL\n+#define SCLP_CMDW_CONFIGURE_IOA                 0x001a0001\n+#define SCLP_CMDW_DECONFIGURE_IOA               0x001b0001\n+#define SCLP_RECONFIG_PCI_ATYPE                 2\n \n /* SCLP response codes */\n #define SCLP_RC_NORMAL_READ_COMPLETION          0x0010\n@@ -168,6 +168,14 @@ typedef struct AssignStorage {\n     uint16_t rn;\n } QEMU_PACKED AssignStorage;\n \n+typedef struct IoaCfgSccb {\n+    SCCBHeader header;\n+    uint8_t atype;\n+    uint8_t reserved1;\n+    uint16_t reserved2;\n+    uint32_t aid;\n+} QEMU_PACKED IoaCfgSccb;\n+\n typedef struct SCCB {\n     SCCBHeader h;\n     char data[SCCB_DATA_LEN];\n",
    "prefixes": [
        "PULL",
        "19/44"
    ]
}