get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2234473,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2234473/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/20260507-winbond-v6-18-rc1-spi-nor-swp-v5-20-93453e1a9597@bootlin.com/",
    "project": {
        "id": 3,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/3/?format=api",
        "name": "Linux MTD development",
        "link_name": "linux-mtd",
        "list_id": "linux-mtd.lists.infradead.org",
        "list_email": "linux-mtd@lists.infradead.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260507-winbond-v6-18-rc1-spi-nor-swp-v5-20-93453e1a9597@bootlin.com>",
    "list_archive_url": null,
    "date": "2026-05-07T16:47:01",
    "name": "[v5,20/28] mtd: spi-nor: Add steps for testing locking support",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "3774a4781f4d085877bc4b946f677d54c5691a77",
    "submitter": {
        "id": 73368,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/73368/?format=api",
        "name": "Miquel Raynal",
        "email": "miquel.raynal@bootlin.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-mtd/patch/20260507-winbond-v6-18-rc1-spi-nor-swp-v5-20-93453e1a9597@bootlin.com/mbox/",
    "series": [
        {
            "id": 503226,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/503226/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/list/?series=503226",
            "date": "2026-05-07T16:46:51",
            "name": "mtd: spi-nor: Enhance software protection",
            "version": 5,
            "mbox": "http://patchwork.ozlabs.org/series/503226/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2234473/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2234473/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=HKPd5hxX;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256\n header.s=dkim header.b=sSJSM5CI;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBJ8C6YZqz1yM5\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 02:47:39 +1000 (AEST)",
            "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux))\n\tid 1wL1st-00000004NY4-1tDP;\n\tThu, 07 May 2026 16:47:35 +0000",
            "from smtpout-04.galae.net ([185.171.202.116])\n\tby bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux))\n\tid 1wL1sr-00000004NTd-1NER\n\tfor linux-mtd@lists.infradead.org;\n\tThu, 07 May 2026 16:47:34 +0000",
            "from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])\n\tby smtpout-04.galae.net (Postfix) with ESMTPS id 86818C5DC60;\n\tThu,  7 May 2026 16:48:19 +0000 (UTC)",
            "from mail.galae.net (mail.galae.net [212.83.136.155])\n\tby smtpout-01.galae.net (Postfix) with ESMTPS id BBAD4605CF;\n\tThu,  7 May 2026 16:47:31 +0000 (UTC)",
            "from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon)\n with ESMTPSA id 7880A108194E4;\n\tThu,  7 May 2026 18:47:29 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id\n\t:MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=nwOgf2cr731/Zt2c7UhJN9v9RDh0h5sYiOZGAQzFTqk=; b=HKPd5hxXc201GY\n\t7yaeBXlU/km5PEXHL8nNSMFfYbKGyOFzwQc6qIUiyWgWdn3n52pPLvgbXRDgSd2SyMnJ0L0hOUV/D\n\tySQtE20KsgTqYgHPrmCfjwf7tq2xhtb0TxIxw8wTocdWBQeNVun7fXaOs+LoeekEsn4f0q1D6sHO4\n\t6EElsz7XFlNPtAs7CxlkaoYjPv+j8LXiRgS0kYJWgFcjLGd3i/uQZNRUn1c57TU1V2khf3AMGwMbu\n\t364VEYhvVMspUpcdOgntN+dAGnsnjqZKSgPt24gmT297Ev0uZwKZLGsiyY1d5qKdA87yNwseUFRRX\n\tK90g30Feolzyi9h1nILw==;",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;\n\tt=1778172450; h=from:subject:date:message-id:to:cc:mime-version:content-type:\n\t content-transfer-encoding:in-reply-to:references;\n\tbh=vA9icDvy306xR1K0kstfOr9lQ8ml0UsecMyKCH6123E=;\n\tb=sSJSM5CIVUqsQmJyHSjIkwVY1iX+Hb6ixlo1qEYgw1Fax9vw+DsYRjbXKgvvWouhm7iviY\n\tAPYKq+AFbFz0FaGLsV7wqkZh1daxWLmwCE59yquiGgxGFKIjHWlDziu+LnJqE6QwXi7tr0\n\tImc0fMQug8rXb90fs5DehToANzrc6kR/tILsM9tMkhmNH6nSpTGsZU/2qSThVOyfV+sP1I\n\tntOPEVN3ngcxcfYmA5o5UTU495r7UCqDtqmzTtwMpPYn04mI2n1baRT/P80pocvFHPUTWQ\n\thbfWWGOb+dY4NwnuSY7MMF/9dL1jX86TbV2lpHO+nRcPY2ajx7c4jSuRVUmjPA=="
        ],
        "From": "Miquel Raynal <miquel.raynal@bootlin.com>",
        "Date": "Thu, 07 May 2026 18:47:01 +0200",
        "Subject": "[PATCH v5 20/28] mtd: spi-nor: Add steps for testing locking\n support",
        "MIME-Version": "1.0",
        "Message-Id": "\n <20260507-winbond-v6-18-rc1-spi-nor-swp-v5-20-93453e1a9597@bootlin.com>",
        "References": "\n <20260507-winbond-v6-18-rc1-spi-nor-swp-v5-0-93453e1a9597@bootlin.com>",
        "In-Reply-To": "\n <20260507-winbond-v6-18-rc1-spi-nor-swp-v5-0-93453e1a9597@bootlin.com>",
        "To": "Pratyush Yadav <pratyush@kernel.org>, Michael Walle <mwalle@kernel.org>,\n Takahiro Kuwano <takahiro.kuwano@infineon.com>,\n Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com>,\n Jonathan Corbet <corbet@lwn.net>, Tudor Ambarus <tudor.ambarus@linaro.org>,\n Shuah Khan <skhan@linuxfoundation.org>",
        "Cc": "Sean Anderson <sean.anderson@linux.dev>,\n Thomas Petazzoni <thomas.petazzoni@bootlin.com>,\n Steam Lin <STLin2@winbond.com>, linux-mtd@lists.infradead.org,\n linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,\n Miquel Raynal <miquel.raynal@bootlin.com>",
        "X-Mailer": "b4 0.14.3",
        "X-Last-TLS-Session-Version": "TLSv1.3",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20260507_094733_662827_26CEC9FE ",
        "X-CRM114-Status": "GOOD (  15.10  )",
        "X-Spam-Score": "-2.1 (--)",
        "X-Spam-Report": "Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam.  The original\n message has been attached to this so you can view it or label\n similar future email.  If you have any questions, see\n the administrator of that system for details.\n Content preview:  As recently raised on the mailing list, it may be useful to\n    propose a list of steps to go through in order to proove the devices have\n    been described correctly, especially since all the block protectio [...]\n Content analysis details:   (-2.1 points, 5.0 required)\n  pts rule name              description\n ---- ----------------------\n --------------------------------------------------\n -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record\n -0.0 SPF_PASS               SPF: sender matches SPF record\n -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from\n                             envelope-from domain\n -0.1 DKIM_VALID             Message has at least one valid DKIM or DK\n signature\n -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from\n author's\n                             domain\n  0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n not necessarily valid\n -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n                             [score: 0.0000]\n -0.0 DMARC_PASS             DMARC pass policy",
        "X-BeenThere": "linux-mtd@lists.infradead.org",
        "X-Mailman-Version": "2.1.34",
        "Precedence": "list",
        "List-Id": "Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-mtd>,\n <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/linux-mtd/>",
        "List-Post": "<mailto:linux-mtd@lists.infradead.org>",
        "List-Help": "<mailto:linux-mtd-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>",
        "Errors-To": "linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "As recently raised on the mailing list, it may be useful to propose a\nlist of steps to go through in order to proove the devices have been\ndescribed correctly, especially since all the block protection\ninformation is not stored in any kind of table and is instead filled\nmanually by developpers.\n\nUse the debugfs output to ease the comparison between expectations and\nreality.\n\nSigned-off-by: Miquel Raynal <miquel.raynal@bootlin.com>\n---\n Documentation/driver-api/mtd/spi-nor.rst | 132 +++++++++++++++++++++++++++++++\n 1 file changed, 132 insertions(+)",
    "diff": "diff --git a/Documentation/driver-api/mtd/spi-nor.rst b/Documentation/driver-api/mtd/spi-nor.rst\nindex 148fa4288760..b42de32c6eba 100644\n--- a/Documentation/driver-api/mtd/spi-nor.rst\n+++ b/Documentation/driver-api/mtd/spi-nor.rst\n@@ -203,3 +203,135 @@ section, after the ``---`` marker.\n     mtd.writesize = 1\n     mtd.oobsize = 0\n     regions = 0\n+\n+5) If your flash supports locking, please go through the following test\n+   procedure to make sure it correctly behaves. The below example\n+   expects the typical situation where eraseblocks and lock sectors have\n+   the same size. In case you enabled MTD_SPI_NOR_USE_4K_SECTORS, you\n+   must adapt `bs` accordingly.\n+\n+   Warning: These tests may hard lock your device! Make sure:\n+   - The device is not hard locked already (#WP strapped to low and\n+     SR_SRWD bit set)\n+   - If you have a WPn pin, you may want to set `no-wp` in your DT for\n+     the time of the test, to only make use of software protection.\n+     Otherwise, clearing the locking state depends on the WPn\n+     signal and if it is tied to low, the flash will be permanently\n+     locked.\n+\n+   Test full chip locking and make sure expectations, the MEMISLOCKED\n+   ioctl output, the debugfs output and experimental results are all\n+   aligned::\n+\n+    root@1:~# alias show_sectors='grep -A4 \"locked sectors\" /sys/kernel/debug/spi-nor/spi0.0/params'\n+    root@1:~# flash_lock -u /dev/mtd0\n+    root@1:~# flash_lock -i /dev/mtd0\n+    Device: /dev/mtd0\n+    Start: 0\n+    Len: 0x4000000\n+    Lock status: unlocked\n+    Return code: 0\n+    root@1:~# mtd_debug erase /dev/mtd0 0 2097152\n+    Erased 2097152 bytes from address 0x00000000 in flash\n+    root@1:~# mtd_debug write /dev/mtd0 0 2097152 spi_test\n+    Copied 2097152 bytes from spi_test to address 0x00000000 in flash\n+    root@1:~# mtd_debug read /dev/mtd0 0 2097152 spi_read\n+    Copied 2097152 bytes from address 0x00000000 in flash to spi_read\n+    root@1:~# sha256sum spi*\n+    c444216a6ba2a4a66cccd60a0dd062bce4b865dd52b200ef5e21838c4b899ac8  spi_read\n+    c444216a6ba2a4a66cccd60a0dd062bce4b865dd52b200ef5e21838c4b899ac8  spi_test\n+    root@1:~# show_sectors\n+    software locked sectors\n+     region (in hex)   | status   | #sectors\n+     ------------------+----------+---------\n+     00000000-03ffffff | unlocked | 1024\n+\n+    root@1:~# flash_lock -l /dev/mtd0\n+    root@1:~# flash_lock -i /dev/mtd0\n+    Device: /dev/mtd0\n+    Start: 0\n+    Len: 0x4000000\n+    Lock status: locked\n+    Return code: 1\n+    root@1:~# mtd_debug erase /dev/mtd0 0 2097152\n+    Erased 2097152 bytes from address 0x00000000 in flash\n+    root@1:~# mtd_debug read /dev/mtd0 0 2097152 spi_read\n+    Copied 2097152 bytes from address 0x00000000 in flash to spi_read\n+    root@1:~# sha256sum spi*\n+    c444216a6ba2a4a66cccd60a0dd062bce4b865dd52b200ef5e21838c4b899ac8  spi_read\n+    c444216a6ba2a4a66cccd60a0dd062bce4b865dd52b200ef5e21838c4b899ac8  spi_test\n+    root@1:~# dd if=/dev/urandom of=./spi_test2 bs=1M count=2\n+    2+0 records in\n+    2+0 records out\n+    root@1:~# mtd_debug write /dev/mtd0 0 2097152 spi_test2\n+    Copied 2097152 bytes from spi_test to address 0x00000000 in flash\n+    root@1:~# mtd_debug read /dev/mtd0 0 2097152 spi_read2\n+    Copied 2097152 bytes from address 0x00000000 in flash to spi_read\n+    root@1:~# sha256sum spi*\n+    c444216a6ba2a4a66cccd60a0dd062bce4b865dd52b200ef5e21838c4b899ac8  spi_read\n+    c444216a6ba2a4a66cccd60a0dd062bce4b865dd52b200ef5e21838c4b899ac8  spi_read2\n+    c444216a6ba2a4a66cccd60a0dd062bce4b865dd52b200ef5e21838c4b899ac8  spi_test\n+    bea9334df51c620440f86751cba0799214a016329f1736f9456d40cf40efdc88  spi_test2\n+    root@1:~# show_sectors\n+    software locked sectors\n+     region (in hex)   | status   | #sectors\n+     ------------------+----------+---------\n+     00000000-03ffffff |   locked | 1024\n+    root@1:~# flash_lock -u /dev/mtd0\n+\n+   Once we trust the debugfs output we can use it to test various\n+   situations. Check top locking/unlocking (end of the device)::\n+\n+    root@1:~# size=$(cat /sys/class/mtd/mtd0/size)\n+    root@1:~# bs=$(cat /sys/class/mtd/mtd0/erasesize)\n+    root@1:~# nsectors=$(grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params | sed -e 's/.*unlocked | //')\n+    root@1:~# ss=$(($size / $nsectors))\n+    root@1:~# bps=$(($ss / $bs))\n+\n+    root@1:~# flash_lock -u /dev/mtd0\n+    root@1:~# flash_lock -l /dev/mtd0 $(($size - (2 * $ss))) $((2 * $bps)) # last two\n+    root@1:~# show_sectors\n+    software locked sectors\n+     region (in hex)   | status   | #sectors\n+     ------------------+----------+---------\n+     00000000-03fdffff | unlocked | 1022\n+     03fe0000-03ffffff |   locked | 2\n+    root@1:~# flash_lock -u /dev/mtd0 $(($size - (2 * $ss))) $((1 * $bps)) # last one\n+    root@1:~# show_sectors\n+    software locked sectors\n+     region (in hex)   | status   | #sectors\n+     ------------------+----------+---------\n+     00000000-03feffff | unlocked | 1023\n+     03ff0000-03ffffff |   locked | 1\n+\n+   If the flash features 4 block protection bits (BP), we can protect\n+   more than 4MB (typically 128 64kiB-blocks or more), with a finer\n+   grain than locking the entire device::\n+\n+    root@1:~# flash_lock -u /dev/mtd0\n+    root@1:~# flash_lock -l /dev/mtd0 $(($size - (2**7 * $ss))) $((2**7 * $bps))\n+    root@1:~# show_sectors\n+    software locked sectors\n+     region (in hex)   | status   | #sectors\n+     ------------------+----------+---------\n+     00000000-037fffff | unlocked | 896\n+     03800000-03ffffff |   locked | 128\n+\n+   If the flash features a Top/Bottom (TB) bit, we can protect the\n+   beginning of the flash::\n+\n+    root@1:~# flash_lock -u /dev/mtd0\n+    root@1:~# flash_lock -l /dev/mtd0 0 $((2 * $bps)) # first two\n+    root@1:~# show_sectors\n+    software locked sectors\n+     region (in hex)   | status   | #sectors\n+     ------------------+----------+---------\n+     00000000-0001ffff |   locked | 2\n+     00020000-03ffffff | unlocked | 1022\n+    root@1:~# flash_lock -u /dev/mtd0 $ss $((1 * $bps)) # first one\n+    root@1:~# show_sectors\n+    software locked sectors\n+     region (in hex)   | status   | #sectors\n+     ------------------+----------+---------\n+     00000000-0000ffff |   locked | 1\n+     00010000-03ffffff | unlocked | 1023\n",
    "prefixes": [
        "v5",
        "20/28"
    ]
}