get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2224334,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2224334/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260417-sdcard-performance-b4-v4-2-119e66be10c2@avm.de/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260417-sdcard-performance-b4-v4-2-119e66be10c2@avm.de>",
    "list_archive_url": null,
    "date": "2026-04-17T09:51:35",
    "name": "[v4,2/7] hw/sd/sd: Allow multi-byte read/write for generic paths",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "8de49898289a35921fbd083018aedd408df5c650",
    "submitter": {
        "id": 91343,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/91343/?format=api",
        "name": "Christian Speich",
        "email": "c.speich@avm.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260417-sdcard-performance-b4-v4-2-119e66be10c2@avm.de/mbox/",
    "series": [
        {
            "id": 500297,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/500297/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500297",
            "date": "2026-04-17T09:51:34",
            "name": "hw/sd: Improve performance of read/write/erase",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/500297/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2224334/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2224334/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@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=avm.de header.i=@avm.de header.a=rsa-sha256\n header.s=mail header.b=E28HWfUH;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fxr0s2pD9z1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 19:58:05 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wDfxO-0003Ek-Ct; Fri, 17 Apr 2026 05:57:50 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <c.speich@avm.de>)\n id 1wDfx9-0002jW-I8; Fri, 17 Apr 2026 05:57:35 -0400",
            "from mail.avm.de ([212.42.244.119])\n by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <c.speich@avm.de>)\n id 1wDfx5-000302-HO; Fri, 17 Apr 2026 05:57:35 -0400",
            "from [172.16.0.1] (helo=mail.avm.de)\n by mail.avm.de with ESMTP (eXpurgate 4.55.2)\n (envelope-from <c.speich@avm.de>)\n id 69e20405-1e6c-7f0000032729-7f000001c518-1\n for <multiple-recipients>; Fri, 17 Apr 2026 11:57:25 +0200",
            "from mail-notes.avm.de (mail-notes.avm.de [172.16.0.1])\n by mail.avm.de (Postfix) with ESMTP;\n Fri, 17 Apr 2026 11:57:25 +0200 (CEST)",
            "from [127.0.1.1] ([172.17.89.139])\n by mail-notes.avm.de (HCL Domino Release 14.0FP4)\n with ESMTP id 2026041711572443-2975 ;\n Fri, 17 Apr 2026 11:57:24 +0200"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=avm.de; s=mail;\n t=1776419845; bh=hEncSpiJ83XFws/L5Xd2Q4V9lgBRfDDWRPUG5zSMWVU=;\n h=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n b=E28HWfUHpE7UwXsF/9AJCkDWBgBQMTs2CFrv+Y79SGIPEBnx1twKaG+80LpmPQcCG\n VKRtrAz5GGEp6yvdveMg7qdAvej/86a8GBoWYkcIwJOo6Ixgj5xETcy0Oiy6ExlpQ8\n 3xG4GXoft2Fa1WD1V8sFtMbWSMQCealMpA6DaKvA=",
        "From": "Christian Speich <c.speich@avm.de>",
        "Date": "Fri, 17 Apr 2026 11:51:35 +0200",
        "Subject": "[PATCH v4 2/7] hw/sd/sd: Allow multi-byte read/write for generic\n paths",
        "MIME-Version": "1.0",
        "Message-Id": "<20260417-sdcard-performance-b4-v4-2-119e66be10c2@avm.de>",
        "References": "<20260417-sdcard-performance-b4-v4-0-119e66be10c2@avm.de>",
        "In-Reply-To": "<20260417-sdcard-performance-b4-v4-0-119e66be10c2@avm.de>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n Bin Meng <bmeng.cn@gmail.com>, qemu-block@nongnu.org,\n Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,\n Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>,\n Christian Speich <c.speich@avm.de>",
        "X-Mailer": "b4 0.14.2",
        "X-MIMETrack": "Itemize by SMTP Server on ANIS1/AVM(Release 14.0FP4|March 10,\n 2025) at 17.04.2026 11:57:24,\n Serialize by Router on ANIS1/AVM(Release 14.0FP4|March 10, 2025) at\n 17.04.2026 11:57:24, Serialize complete at 17.04.2026 11:57:24",
        "X-TNEFEvaluated": "1",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "X-purgate-ID": "149429::1776419845-38707233-2F1C2574/0/0",
        "X-purgate-type": "clean",
        "X-purgate-size": "7064",
        "X-purgate-Ad": "Categorized by eleven eXpurgate (R) https://www.eleven.de",
        "X-purgate": [
            "This mail is considered clean (visit https://www.eleven.de for\n further information)",
            "clean"
        ],
        "Received-SPF": "pass client-ip=212.42.244.119; envelope-from=c.speich@avm.de;\n helo=mail.avm.de",
        "X-Spam_score_int": "-48",
        "X-Spam_score": "-4.9",
        "X-Spam_bar": "----",
        "X-Spam_report": "(-4.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "qemu development <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://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 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "Paths that use sd_generic_write/read_data can now write/read multiple\nbytes with one call.\n\nSigned-off-by: Christian Speich <c.speich@avm.de>\nReviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>\n---\n hw/sd/sd.c | 62 +++++++++++++++++++++++++++++++++++---------------------------\n 1 file changed, 35 insertions(+), 27 deletions(-)",
    "diff": "diff --git a/hw/sd/sd.c b/hw/sd/sd.c\nindex 135113add29b5ee3cb11d9d535355eba8f6cb3f7..2c81776df316feda75f97e15cc9bbd1538f1a21c 100644\n--- a/hw/sd/sd.c\n+++ b/hw/sd/sd.c\n@@ -1609,7 +1609,7 @@ static sd_rsp_type_t sd_cmd_optional(SDState *sd, SDRequest req)\n     return sd_illegal;\n }\n \n-/* Configure fields for following sd_generic_write_byte() calls */\n+/* Configure fields for following sd_generic_write_data() calls */\n static sd_rsp_type_t sd_cmd_to_receivingdata(SDState *sd, SDRequest req,\n                                              uint64_t start, size_t size)\n {\n@@ -1624,7 +1624,7 @@ static sd_rsp_type_t sd_cmd_to_receivingdata(SDState *sd, SDRequest req,\n     return sd_r1;\n }\n \n-/* Configure fields for following sd_generic_read_byte() calls */\n+/* Configure fields for following sd_generic_read_data() calls */\n static sd_rsp_type_t sd_cmd_to_sendingdata(SDState *sd, SDRequest req,\n                                            uint64_t start,\n                                            const void *data, size_t size)\n@@ -2614,11 +2614,15 @@ send_response:\n }\n \n /* Return true if buffer is consumed. Configured by sd_cmd_to_receivingdata() */\n-static bool sd_generic_write_byte(SDState *sd, uint8_t value)\n+static bool sd_generic_write_data(SDState *sd, const void *buf, size_t *len)\n {\n-    sd->data[sd->data_offset] = value;\n+    size_t to_write = MIN(sd->data_size - sd->data_offset, *len);\n \n-    if (++sd->data_offset >= sd->data_size) {\n+    memcpy(sd->data, buf, to_write);\n+    sd->data_offset += to_write;\n+    *len = to_write;\n+\n+    if (sd->data_offset >= sd->data_size) {\n         sd->state = sd_transfer_state;\n         return true;\n     }\n@@ -2626,11 +2630,15 @@ static bool sd_generic_write_byte(SDState *sd, uint8_t value)\n }\n \n /* Return true when buffer is consumed. Configured by sd_cmd_to_sendingdata() */\n-static bool sd_generic_read_byte(SDState *sd, uint8_t *value)\n+static bool sd_generic_read_data(SDState *sd, void *buf, size_t *len)\n {\n-    *value = sd->data[sd->data_offset];\n+    size_t to_read = MIN(sd->data_size - sd->data_offset, *len);\n+\n+    memcpy(buf, sd->data, to_read);\n+    sd->data_offset += to_read;\n+    *len = to_read;\n \n-    if (++sd->data_offset >= sd->data_size) {\n+    if (sd->data_offset >= sd->data_size) {\n         sd->state = sd_transfer_state;\n         return true;\n     }\n@@ -2657,18 +2665,12 @@ static size_t sd_write_data(SDState *sd, const void *buf, size_t length)\n     if (sd->card_status & (ADDRESS_ERROR | WP_VIOLATION))\n         return length;\n \n-    /*\n-     * Only read one byte at a time. We will be called again with the\n-     * remaining.\n-     */\n-    length = 1;\n-\n     trace_sdcard_write_data(sd->proto->name,\n                             sd->last_cmd_name,\n                             sd->current_cmd, sd->data_offset, value[0]);\n     switch (sd->current_cmd) {\n     case 24:  /* CMD24:  WRITE_SINGLE_BLOCK */\n-        if (sd_generic_write_byte(sd, value[0])) {\n+        if (sd_generic_write_data(sd, buf, &length)) {\n             /* TODO: Check CRC before committing */\n             sd->state = sd_programming_state;\n             sd_blk_write(sd, sd->data_start, sd->data_offset);\n@@ -2680,6 +2682,12 @@ static size_t sd_write_data(SDState *sd, const void *buf, size_t length)\n         break;\n \n     case 25:  /* CMD25:  WRITE_MULTIPLE_BLOCK */\n+        /*\n+         * Only read one byte at a time. We will be called again with the\n+         * remaining.\n+         */\n+        length = 1;\n+\n         if (sd->data_offset == 0) {\n             /* Start of the block - let's check the address is valid */\n             if (!address_in_range(sd, \"WRITE_MULTIPLE_BLOCK\",\n@@ -2723,7 +2731,7 @@ static size_t sd_write_data(SDState *sd, const void *buf, size_t length)\n         break;\n \n     case 26:  /* CMD26:  PROGRAM_CID */\n-        if (sd_generic_write_byte(sd, value[0])) {\n+        if (sd_generic_write_data(sd, buf, &length)) {\n             /* TODO: Check CRC before committing */\n             sd->state = sd_programming_state;\n             for (i = 0; i < sizeof(sd->cid); i ++)\n@@ -2741,7 +2749,7 @@ static size_t sd_write_data(SDState *sd, const void *buf, size_t length)\n         break;\n \n     case 27:  /* CMD27:  PROGRAM_CSD */\n-        if (sd_generic_write_byte(sd, value[0])) {\n+        if (sd_generic_write_data(sd, buf, &length)) {\n             /* TODO: Check CRC before committing */\n             sd->state = sd_programming_state;\n             for (i = 0; i < sizeof(sd->csd); i ++)\n@@ -2764,7 +2772,7 @@ static size_t sd_write_data(SDState *sd, const void *buf, size_t length)\n         break;\n \n     case 42:  /* CMD42:  LOCK_UNLOCK */\n-        if (sd_generic_write_byte(sd, value[0])) {\n+        if (sd_generic_write_data(sd, buf, &length)) {\n             /* TODO: Check CRC before committing */\n             sd->state = sd_programming_state;\n             sd_lock_command(sd);\n@@ -2774,7 +2782,7 @@ static size_t sd_write_data(SDState *sd, const void *buf, size_t length)\n         break;\n \n     case 56:  /* CMD56:  GEN_CMD */\n-        sd_generic_write_byte(sd, value[0]);\n+        sd_generic_write_data(sd, buf, &length);\n         break;\n \n     default:\n@@ -2809,12 +2817,6 @@ static size_t sd_read_data(SDState *sd, void *buf, size_t length)\n         return length;\n     }\n \n-    /*\n-     * We will only read one byte at a time. We will be called again with the\n-     * remaining buffer.\n-     */\n-    length = 1;\n-\n     io_len = sd_blk_len(sd);\n \n     trace_sdcard_read_data(sd->proto->name,\n@@ -2832,10 +2834,16 @@ static size_t sd_read_data(SDState *sd, void *buf, size_t length)\n     case 30: /* CMD30:  SEND_WRITE_PROT */\n     case 51: /* ACMD51: SEND_SCR */\n     case 56: /* CMD56:  GEN_CMD */\n-        sd_generic_read_byte(sd, value);\n+        sd_generic_read_data(sd, buf, &length);\n         break;\n \n     case 18:  /* CMD18:  READ_MULTIPLE_BLOCK */\n+        /*\n+         * We will only read one byte at a time. We will be called again with\n+         * the remaining buffer.\n+         */\n+        length = 1;\n+\n         if (sd->data_offset == 0) {\n             if (!address_in_range(sd, \"READ_MULTIPLE_BLOCK\",\n                                   sd->data_start, io_len)) {\n@@ -2868,7 +2876,7 @@ static size_t sd_read_data(SDState *sd, void *buf, size_t length)\n     default:\n         qemu_log_mask(LOG_GUEST_ERROR, \"%s: DAT read illegal for command %s\\n\",\n                                        __func__, sd->last_cmd_name);\n-        *value = dummy_byte;\n+        memset(buf, dummy_byte, length);\n     }\n \n     return length;\n",
    "prefixes": [
        "v4",
        "2/7"
    ]
}