get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1745966,
    "url": "http://patchwork.ozlabs.org/api/patches/1745966/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20230221201925.9644-47-pali@kernel.org/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20230221201925.9644-47-pali@kernel.org>",
    "list_archive_url": null,
    "date": "2023-02-21T20:19:12",
    "name": "[RFC,u-boot-mvebu,46/59] tools: kwbimage: Add support for XIP SPI/NOR images",
    "commit_ref": "cccc5b4f3d06dd2b021eaf690f8f828c3d4c9af5",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "55497577c8594e0000c006d820a80cae11a3f80d",
    "submitter": {
        "id": 78810,
        "url": "http://patchwork.ozlabs.org/api/people/78810/?format=api",
        "name": "Pali Rohár",
        "email": "pali@kernel.org"
    },
    "delegate": {
        "id": 1696,
        "url": "http://patchwork.ozlabs.org/api/users/1696/?format=api",
        "username": "stroese",
        "first_name": "Stefan",
        "last_name": "Roese",
        "email": "sr@denx.de"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20230221201925.9644-47-pali@kernel.org/mbox/",
    "series": [
        {
            "id": 343058,
            "url": "http://patchwork.ozlabs.org/api/series/343058/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=343058",
            "date": "2023-02-21T20:18:27",
            "name": "arm: mvebu: Various fixes",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/343058/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1745966/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1745966/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)",
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=unad1Lcx;\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=kernel.org",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.b=\"unad1Lcx\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=kernel.org",
            "phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4PLvbp6kS0z240n\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Feb 2023 09:49:10 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 0195D85A63;\n\tTue, 21 Feb 2023 23:49:08 +0100 (CET)",
            "by phobos.denx.de (Postfix, from userid 109)\n id 7E98D85A63; Tue, 21 Feb 2023 23:49:06 +0100 (CET)",
            "from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id A28FC85A73\n for <u-boot@lists.denx.de>; Tue, 21 Feb 2023 23:49:02 +0100 (CET)",
            "from smtp.kernel.org (relay.kernel.org [52.25.139.140])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by ams.source.kernel.org (Postfix) with ESMTPS id 202CBB81109\n for <u-boot@lists.denx.de>; Tue, 21 Feb 2023 22:49:02 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 6C854C433EF\n for <u-boot@lists.denx.de>; Tue, 21 Feb 2023 22:49:00 +0000 (UTC)",
            "by pali.im (Postfix)\n id 213FB70C; Tue, 21 Feb 2023 23:48:58 +0100 (CET)",
            "by pali.im (Postfix)\n id 44954708; Tue, 21 Feb 2023 21:22:35 +0100 (CET)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,\n SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1677019740;\n bh=BKCDneQx+ojdzHCgh5kRTtQ/0qxhsjcws78HP/OwbIU=;\n h=Resent-From:Resent-Date:Resent-To:From:To:Cc:Subject:Date:\n In-Reply-To:References:From;\n b=unad1Lcxk9khOBQDrFhN+7WaTqvJnae5RXTWtW/nmMCjyisX3KUJM/v+5XNYWiJVm\n mNCVgnQLUXziB0p3Zr5NvXWepTUW00ba8E8FzItZhTPUVIUVgunxsG9WFCB+L4T4m7\n Pqt/58gnv7xwS/MXoSxEbKcjwZY6uOod6q99ZgYCmuWykllypJfV0HLgkaIxkjDGCP\n lahT+KCEcRHTRsb4hPA+bhlJu6PSRdSCnI6kt/ZiNewNV5c6ERyS04zwcQSY+exaqA\n ffA0UidanFW76YKelfEdLkzNG29rnBB0eRnwGGniIEO+IQtFP8vycA1bobS7RAWedv\n A7jRmFuHRlxWA==",
        "Resent-From": "Pali =?utf-8?b?Um9ow6Fy?= <pali@kernel.org>",
        "Resent-Date": "Tue, 21 Feb 2023 23:48:58 +0100",
        "Resent-Message-ID": "<20230221224858.dkaufgbtzerht5f4@pali>",
        "Resent-To": "u-boot@lists.denx.de",
        "From": "=?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org>",
        "To": "u-boot@lists.denx.de",
        "Cc": "Stefan Roese <sr@denx.de>, Tony Dinh <mibodhi@gmail.com>,\n Josua Mayer <josua@solid-run.com>",
        "Subject": "[PATCH RFC u-boot-mvebu 46/59] tools: kwbimage: Add support for XIP\n SPI/NOR images",
        "Date": "Tue, 21 Feb 2023 21:19:12 +0100",
        "Message-Id": "<20230221201925.9644-47-pali@kernel.org>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20230221201925.9644-1-pali@kernel.org>",
        "References": "<20230221201925.9644-1-pali@kernel.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.39",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.6 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "Marvell BootROM can execute SPI images directly from NOR (either SPI/serial\nor parallel) without copying them to DDR RAM. This is know at XIP - execute\nin place. To achieve that, destination address in kwbimage must be set to\n0xFFFFFFFF and execute address to the offset in bytes from the beginning of\nNOR memory.\n\nKirkwood and Dove which use kwbimage v0 format and have SPI address space\nmapped to physical memory at 0xE8000000-0xEFFFFFFF by BootROM.\n\nArmada SoCs use kwbimage v1 format and have SPI address space mapped to\nphysical memory at 0xD4000000-0xD7FFFFFF and Device bus address space (used\nfor parallel NOR) at 0xD8000000-0xDFFFFFFF.\n\nAdd support for generating XIP kwbimages by mkimage -x flag and mark xflag\nas valid option in kwbimage.c.\n\nSigned-off-by: Pali Rohár <pali@kernel.org>\n---\n tools/kwbimage.c | 96 ++++++++++++++++++++++++++++++++++++++++++++----\n 1 file changed, 89 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/tools/kwbimage.c b/tools/kwbimage.c\nindex da539541742d..7ebb625d03b9 100644\n--- a/tools/kwbimage.c\n+++ b/tools/kwbimage.c\n@@ -927,6 +927,71 @@ done:\n \treturn ret;\n }\n \n+static int image_fill_xip_header(void *image, struct image_tool_params *params)\n+{\n+\tstruct main_hdr_v1 *main_hdr = image; /* kwbimage v0 and v1 have same XIP members */\n+\tint version = kwbimage_version(image);\n+\tuint32_t srcaddr = le32_to_cpu(main_hdr->srcaddr);\n+\tuint32_t startaddr = 0;\n+\n+\tif (main_hdr->blockid != IBR_HDR_SPI_ID) {\n+\t\tfprintf(stderr, \"XIP is supported only for SPI images\\n\");\n+\t\treturn 0;\n+\t}\n+\n+\tif (version == 0 &&\n+\t\t   params->addr >= 0xE8000000 && params->addr < 0xEFFFFFFF &&\n+\t\t   params->ep >= 0xE8000000 && params->ep < 0xEFFFFFFF) {\n+\t\t/* Load and Execute address is in SPI address space (kwbimage v0) */\n+\t\tstartaddr = 0xE8000000;\n+\t} else if (version != 0 &&\n+\t\t   params->addr >= 0xD4000000 && params->addr < 0xD7FFFFFF &&\n+\t\t   params->ep >= 0xD4000000 && params->ep < 0xD7FFFFFF) {\n+\t\t/* Load and Execute address is in SPI address space (kwbimage v1) */\n+\t\tstartaddr = 0xD4000000;\n+\t} else if (version != 0 &&\n+\t\t   params->addr >= 0xD8000000 && params->addr < 0xDFFFFFFF &&\n+\t\t   params->ep >= 0xD8000000 && params->ep < 0xDFFFFFFF) {\n+\t\t/* Load and Execute address is in Device bus space (kwbimage v1) */\n+\t\tstartaddr = 0xD8000000;\n+\t} else if (params->addr != 0x0) {\n+\t\t/* Load address is non-zero */\n+\t\tif (version == 0)\n+\t\t\tfprintf(stderr, \"XIP Load Address or XIP Entry Point is not in SPI address space\\n\");\n+\t\telse\n+\t\t\tfprintf(stderr, \"XIP Load Address or XIP Entry Point is not in SPI nor in Device bus address space\\n\");\n+\t\treturn 0;\n+\t}\n+\n+\t/*\n+\t * For XIP destaddr must be set to 0xFFFFFFFF and\n+\t * execaddr relative to the start of XIP memory address space.\n+\t */\n+\tmain_hdr->destaddr = cpu_to_le32(0xFFFFFFFF);\n+\n+\tif (startaddr == 0) {\n+\t\t/*\n+\t\t * mkimage's --load-address 0x0 means that binary is Position\n+\t\t * Independent and in this case mkimage's --entry-point address\n+\t\t * is relative offset from beginning of the data part of image.\n+\t\t */\n+\t\tmain_hdr->execaddr = cpu_to_le32(srcaddr + params->ep);\n+\t} else {\n+\t\t/* The lowest possible load address is after the header at srcaddr. */\n+\t\tif (params->addr - startaddr < srcaddr) {\n+\t\t\tfprintf(stderr,\n+\t\t\t\t\"Invalid XIP Load Address 0x%08x.\\n\"\n+\t\t\t\t\"The lowest address for this configuration is 0x%08x.\\n\",\n+\t\t\t\tparams->addr, (unsigned)(startaddr + srcaddr));\n+\t\t\treturn 0;\n+\t\t}\n+\t\tmain_hdr->srcaddr = cpu_to_le32(params->addr - startaddr);\n+\t\tmain_hdr->execaddr = cpu_to_le32(params->ep - startaddr);\n+\t}\n+\n+\treturn 1;\n+}\n+\n static size_t image_headersz_align(size_t headersz, uint8_t blockid)\n {\n \t/*\n@@ -1022,6 +1087,14 @@ static void *image_create_v0(size_t *dataoff, struct image_tool_params *params,\n \tif (main_hdr->blockid == IBR_HDR_PEX_ID)\n \t\tmain_hdr->srcaddr = cpu_to_le32(0xFFFFFFFF);\n \n+\tif (params->xflag) {\n+\t\tif (!image_fill_xip_header(main_hdr, params)) {\n+\t\t\tfree(image);\n+\t\t\treturn NULL;\n+\t\t}\n+\t\t*dataoff = le32_to_cpu(main_hdr->srcaddr);\n+\t}\n+\n \t/* Generate the ext header */\n \tif (has_ext) {\n \t\tstruct ext_hdr_v0 *ext_hdr;\n@@ -1461,6 +1534,14 @@ static void *image_create_v1(size_t *dataoff, struct image_tool_params *params,\n \tif (main_hdr->blockid == IBR_HDR_PEX_ID)\n \t\tmain_hdr->srcaddr = cpu_to_le32(0xFFFFFFFF);\n \n+\tif (params->xflag) {\n+\t\tif (!image_fill_xip_header(main_hdr, params)) {\n+\t\t\tfree(image);\n+\t\t\treturn NULL;\n+\t\t}\n+\t\t*dataoff = le32_to_cpu(main_hdr->srcaddr);\n+\t}\n+\n \tif (image_get_csk_index() >= 0) {\n \t\t/*\n \t\t * only reserve the space here; we fill the header later since\n@@ -1915,8 +1996,13 @@ static void kwbimage_print_header(const void *ptr)\n \t\t       le32_to_cpu(mhdr->srcaddr) != 1 ? \"s\" : \"\");\n \telse\n \t\tgenimg_print_size(le32_to_cpu(mhdr->srcaddr));\n-\tprintf(\"Load Address: %08x\\n\", le32_to_cpu(mhdr->destaddr));\n-\tprintf(\"Entry Point:  %08x\\n\", le32_to_cpu(mhdr->execaddr));\n+\tif (mhdr->blockid == IBR_HDR_SPI_ID && le32_to_cpu(mhdr->destaddr) == 0xFFFFFFFF) {\n+\t\tprintf(\"Load Address: XIP\\n\");\n+\t\tprintf(\"Execute Offs: %08x\\n\", le32_to_cpu(mhdr->execaddr));\n+\t} else {\n+\t\tprintf(\"Load Address: %08x\\n\", le32_to_cpu(mhdr->destaddr));\n+\t\tprintf(\"Entry Point:  %08x\\n\", le32_to_cpu(mhdr->execaddr));\n+\t}\n }\n \n static int kwbimage_check_image_types(uint8_t type)\n@@ -2414,9 +2500,6 @@ static int kwbimage_extract_subimage(void *ptr, struct image_tool_params *params\n \treturn imagetool_save_subimage(params->outfile, image, size);\n }\n \n-/*\n- * Report Error if xflag is set in addition to default\n- */\n static int kwbimage_check_params(struct image_tool_params *params)\n {\n \tif (!params->lflag && !params->iflag && !params->pflag &&\n@@ -2429,8 +2512,7 @@ static int kwbimage_check_params(struct image_tool_params *params)\n \n \treturn (params->dflag && (params->fflag || params->lflag)) ||\n \t\t(params->fflag) ||\n-\t\t(params->lflag && (params->dflag || params->fflag)) ||\n-\t\t(params->xflag);\n+\t\t(params->lflag && (params->dflag || params->fflag));\n }\n \n /*\n",
    "prefixes": [
        "RFC",
        "u-boot-mvebu",
        "46/59"
    ]
}