get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1326508,
    "url": "http://patchwork.ozlabs.org/api/patches/1326508/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20200710052340.737567-11-oohall@gmail.com/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<20200710052340.737567-11-oohall@gmail.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20200710052340.737567-11-oohall@gmail.com/",
    "date": "2020-07-10T05:23:35",
    "name": "[10/15] powerpc/powernv/pci: Refactor pnv_ioda_alloc_pe()",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "232b70942f4275e81a514f5c3df4174b241d0f72",
    "submitter": {
        "id": 68108,
        "url": "http://patchwork.ozlabs.org/api/people/68108/?format=api",
        "name": "Oliver O'Halloran",
        "email": "oohall@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20200710052340.737567-11-oohall@gmail.com/mbox/",
    "series": [
        {
            "id": 188782,
            "url": "http://patchwork.ozlabs.org/api/series/188782/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=188782",
            "date": "2020-07-10T05:23:26",
            "name": "[01/15] powernv/pci: Add pci_bus_to_pnvhb() helper",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/188782/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1326508/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1326508/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4B32Ff5VS2z9s1x\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 10 Jul 2020 15:50:30 +1000 (AEST)",
            "from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4B32Ff3k0NzDrMv\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 10 Jul 2020 15:50:30 +1000 (AEST)",
            "from mail-wr1-x444.google.com (mail-wr1-x444.google.com\n [IPv6:2a00:1450:4864:20::444])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4B31gW18FfzDrHq\n for <linuxppc-dev@lists.ozlabs.org>; Fri, 10 Jul 2020 15:24:23 +1000 (AEST)",
            "by mail-wr1-x444.google.com with SMTP id b6so4535992wrs.11\n for <linuxppc-dev@lists.ozlabs.org>; Thu, 09 Jul 2020 22:24:22 -0700 (PDT)",
            "from 192-168-1-18.tpgi.com.au ([220.240.245.68])\n by smtp.gmail.com with ESMTPSA id 92sm9090941wrr.96.2020.07.09.22.24.17\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 09 Jul 2020 22:24:18 -0700 (PDT)"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20161025 header.b=DLqOqUOa;\n\tdkim-atps=neutral",
            "lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::444;\n helo=mail-wr1-x444.google.com; envelope-from=oohall@gmail.com;\n receiver=<UNKNOWN>)",
            "lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "lists.ozlabs.org; dkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20161025 header.b=DLqOqUOa; dkim-atps=neutral"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=DcM0wquoQP+oo4DewDurr7YaCCp1MlfqSM/65NyMvoc=;\n b=DLqOqUOa4B+tVQvhUIBxUw5nlmkDFcb3SveDxqiMhEK/ZSLq2SW1+5sMlTULX0BT94\n cAbMvvuSD5RznyZyeUGl3eQxSwqe1WGfoPWS1Ogo3XekMAwTHxhryE+I/U3ou3oQvDyF\n ccxsmGIXOVODfo2zlYm+C3/3KbnC9gMIaD84o6z7SSO6gDEV3aELTW5mN1KfSRk9+1vK\n U5WaPFsIuXCEZR3yy/EDet98QUYnJry+zUH51+dZTRNHFhQnIhrhY8o/YNYKDyrS2hj8\n tn6NOBpgmZtSp+37loLOW/bPcx6uLzoSqLGLcBH4IOajGm+mYLxBK8NZP2ELnZ7PYU/3\n aURA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=DcM0wquoQP+oo4DewDurr7YaCCp1MlfqSM/65NyMvoc=;\n b=JMYc7gEl6cHgasbLnCCR4bZcs0LqaAOM4fc2eCcUefDvPyIXEhkYbBVwGdptNuVqBg\n s/c0CRwjdxV6ONTA081qQc9o1Pw3YllONcJ2R4OpGKuskJdi1LkYIyEuIPdN/ZP1Wh3b\n Vlj70ybB4fS6DOqy5Ys6M/Azyynndn6Bq/LmQqR2ItyzBckdKjjxWMeOsA0wFztSJKn/\n yFBq5Iuuod7vyMA34M6tvB9zskyBNxmnjyt1RfSemflYuJl5IaogysAw0l40BhyfDTZq\n pxFLReuwkF97vxbQbvkjg+GAEu58C59qDsVM5b3KuPZx0cEZrCRaxddDrQeaKPHhKsgG\n eJfw==",
        "X-Gm-Message-State": "AOAM530/D3Zp+D1x7Z6L1w4N6BKMvzm3aXL+3V+niO28kEnsQP1PZKnN\n qlbH9jU4t8DYvP3NeVA6XJNTPOP1TrE=",
        "X-Google-Smtp-Source": "\n ABdhPJywiYU2Z5trAalfaGI77dGLeJI43BPsaGx/SJStsSV1vujeNtZS2+J0r3pqbxPVEuvsCPX1mw==",
        "X-Received": "by 2002:adf:db86:: with SMTP id u6mr32168177wri.27.1594358659117;\n Thu, 09 Jul 2020 22:24:19 -0700 (PDT)",
        "From": "Oliver O'Halloran <oohall@gmail.com>",
        "To": "linuxppc-dev@lists.ozlabs.org",
        "Subject": "[PATCH 10/15] powerpc/powernv/pci: Refactor pnv_ioda_alloc_pe()",
        "Date": "Fri, 10 Jul 2020 15:23:35 +1000",
        "Message-Id": "<20200710052340.737567-11-oohall@gmail.com>",
        "X-Mailer": "git-send-email 2.26.2",
        "In-Reply-To": "<20200710052340.737567-1-oohall@gmail.com>",
        "References": "<20200710052340.737567-1-oohall@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "linuxppc-dev@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org>",
        "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>",
        "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>",
        "Cc": "Oliver O'Halloran <oohall@gmail.com>",
        "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org",
        "Sender": "\"Linuxppc-dev\"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"
    },
    "content": "Rework the PE allocation logic to allow allocating blocks of PEs rather\nthan individually. We'll use this to allocate contigious blocks of PEs for\nthe SR-IOVs.\n\nSigned-off-by: Oliver O'Halloran <oohall@gmail.com>\n---\n arch/powerpc/platforms/powernv/pci-ioda.c | 41 ++++++++++++++++++-----\n arch/powerpc/platforms/powernv/pci.h      |  2 +-\n 2 files changed, 34 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c\nindex 2d36a9ebf0e9..c9c25fb0783c 100644\n--- a/arch/powerpc/platforms/powernv/pci-ioda.c\n+++ b/arch/powerpc/platforms/powernv/pci-ioda.c\n@@ -145,23 +145,45 @@ static void pnv_ioda_reserve_pe(struct pnv_phb *phb, int pe_no)\n \t\treturn;\n \t}\n \n+\tmutex_lock(&phb->ioda.pe_alloc_mutex);\n \tif (test_and_set_bit(pe_no, phb->ioda.pe_alloc))\n \t\tpr_debug(\"%s: PE %x was reserved on PHB#%x\\n\",\n \t\t\t __func__, pe_no, phb->hose->global_number);\n+\tmutex_unlock(&phb->ioda.pe_alloc_mutex);\n \n \tpnv_ioda_init_pe(phb, pe_no);\n }\n \n-struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb)\n+struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb, int count)\n {\n-\tlong pe;\n+\tstruct pnv_ioda_pe *ret = NULL;\n+\tint run = 0, pe, i;\n \n+\tmutex_lock(&phb->ioda.pe_alloc_mutex);\n+\n+\t/* scan backwards for a run of @count cleared bits */\n \tfor (pe = phb->ioda.total_pe_num - 1; pe >= 0; pe--) {\n-\t\tif (!test_and_set_bit(pe, phb->ioda.pe_alloc))\n-\t\t\treturn pnv_ioda_init_pe(phb, pe);\n+\t\tif (test_bit(pe, phb->ioda.pe_alloc)) {\n+\t\t\trun = 0;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\trun++;\n+\t\tif (run == count)\n+\t\t\tbreak;\n \t}\n+\tif (run != count)\n+\t\tgoto out;\n \n-\treturn NULL;\n+\tfor (i = pe; i < pe + count; i++) {\n+\t\tset_bit(i, phb->ioda.pe_alloc);\n+\t\tpnv_ioda_init_pe(phb, i);\n+\t}\n+\tret = &phb->ioda.pe_array[pe];\n+\n+out:\n+\tmutex_unlock(&phb->ioda.pe_alloc_mutex);\n+\treturn ret;\n }\n \n void pnv_ioda_free_pe(struct pnv_ioda_pe *pe)\n@@ -173,7 +195,10 @@ void pnv_ioda_free_pe(struct pnv_ioda_pe *pe)\n \tWARN_ON(pe->npucomp); /* NPUs for nvlink are not supposed to be freed */\n \tkfree(pe->npucomp);\n \tmemset(pe, 0, sizeof(struct pnv_ioda_pe));\n+\n+\tmutex_lock(&phb->ioda.pe_alloc_mutex);\n \tclear_bit(pe_num, phb->ioda.pe_alloc);\n+\tmutex_unlock(&phb->ioda.pe_alloc_mutex);\n }\n \n /* The default M64 BAR is shared by all PEs */\n@@ -976,7 +1001,7 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)\n \tif (pdn->pe_number != IODA_INVALID_PE)\n \t\treturn NULL;\n \n-\tpe = pnv_ioda_alloc_pe(phb);\n+\tpe = pnv_ioda_alloc_pe(phb, 1);\n \tif (!pe) {\n \t\tpr_warn(\"%s: Not enough PE# available, disabling device\\n\",\n \t\t\tpci_name(dev));\n@@ -1047,7 +1072,7 @@ static struct pnv_ioda_pe *pnv_ioda_setup_bus_PE(struct pci_bus *bus, bool all)\n \n \t/* The PE number isn't pinned by M64 */\n \tif (!pe)\n-\t\tpe = pnv_ioda_alloc_pe(phb);\n+\t\tpe = pnv_ioda_alloc_pe(phb, 1);\n \n \tif (!pe) {\n \t\tpr_warn(\"%s: Not enough PE# available for PCI bus %04x:%02x\\n\",\n@@ -3065,7 +3090,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,\n \t\tpnv_ioda_reserve_pe(phb, phb->ioda.root_pe_idx);\n \t} else {\n \t\t/* otherwise just allocate one */\n-\t\troot_pe = pnv_ioda_alloc_pe(phb);\n+\t\troot_pe = pnv_ioda_alloc_pe(phb, 1);\n \t\tphb->ioda.root_pe_idx = root_pe->pe_number;\n \t}\n \ndiff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h\nindex 58c97e60c3db..b4c9bdba7217 100644\n--- a/arch/powerpc/platforms/powernv/pci.h\n+++ b/arch/powerpc/platforms/powernv/pci.h\n@@ -223,7 +223,7 @@ int pnv_ioda_deconfigure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe);\n void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe);\n void pnv_pci_ioda2_release_pe_dma(struct pnv_ioda_pe *pe);\n \n-struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb);\n+struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb, int count);\n void pnv_ioda_free_pe(struct pnv_ioda_pe *pe);\n \n #ifdef CONFIG_PCI_IOV\n",
    "prefixes": [
        "10/15"
    ]
}