get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2233175,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2233175/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260505201905.997996-5-zycai@linux.ibm.com/",
    "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": "<20260505201905.997996-5-zycai@linux.ibm.com>",
    "list_archive_url": null,
    "date": "2026-05-05T20:18:36",
    "name": "[v11,04/32] hw/s390x/ipl: Create certificate store",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a63f3e3f1e4aee033b31d7697a867644c5817cd3",
    "submitter": {
        "id": 90643,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/90643/?format=api",
        "name": "Zhuoying Cai",
        "email": "zycai@linux.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260505201905.997996-5-zycai@linux.ibm.com/mbox/",
    "series": [
        {
            "id": 502896,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/502896/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502896",
            "date": "2026-05-05T20:18:37",
            "name": "Secure IPL Support for SCSI Scheme of virtio-blk/virtio-scsi Devices",
            "version": 11,
            "mbox": "http://patchwork.ozlabs.org/series/502896/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2233175/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2233175/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 (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=bO1shbbi;\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 4g98yB5LcNz1yJ0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 06:20:02 +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 1wKMEr-0007Ux-1P; Tue, 05 May 2026 16:19:29 -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 <zycai@linux.ibm.com>)\n id 1wKMEn-0007Sd-3n; Tue, 05 May 2026 16:19:25 -0400",
            "from mx0a-001b2d01.pphosted.com ([148.163.156.1])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <zycai@linux.ibm.com>)\n id 1wKMEk-0000AR-FQ; Tue, 05 May 2026 16:19:24 -0400",
            "from pps.filterd (m0356517.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 645K6qFX2808530; Tue, 5 May 2026 20:19:18 GMT",
            "from ppma11.dal12v.mail.ibm.com\n (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dw9y1dm5t-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Tue, 05 May 2026 20:19:17 +0000 (GMT)",
            "from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1])\n by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id\n 645K9QnA015555;\n Tue, 5 May 2026 20:19:17 GMT",
            "from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6])\n by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dwx9yb23q-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Tue, 05 May 2026 20:19:17 +0000 (GMT)",
            "from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com\n [10.39.53.229])\n by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 645KJFei18023072\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Tue, 5 May 2026 20:19:16 GMT",
            "from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id B7B535805B;\n Tue,  5 May 2026 20:19:15 +0000 (GMT)",
            "from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 1BF5358059;\n Tue,  5 May 2026 20:19:14 +0000 (GMT)",
            "from fedora-workstation.pok.ibm.com (unknown [9.12.79.241])\n by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP;\n Tue,  5 May 2026 20:19:14 +0000 (GMT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n :content-transfer-encoding:date:from:in-reply-to:message-id\n :mime-version:references:subject:to; s=pp1; bh=pOXwa/C5Ccxd1Ft32\n dfLPhKxEnVCMg/9jORuZ+/oVwM=; b=bO1shbbiUPQSHGBuFikMSeykR6i91xWcU\n GK5vfF1xgjMY47iQsceNfKEXoCdn4K28shggbFo8dmXet5biTN3TBlvLq3qVAIHz\n u+WQ+I1C44Lf3ufwwbcR6N85ntXfbFV6MSv8cuhbbEn4cwk4X44mUnqmZrb6NE67\n VYidp1ASc5Gg1mwwQo+nWiau6dfQg2a74+mZqjU66YLsn/hqc4k0zgTPCsRMKfsH\n wTHzYNzVzbstVCTM4gG2h8qEjVq6fw4CBM7HWVToY0WhOvQ5JnmN7czfkcMVyV2Q\n WQlQCM20XudRVXEtrT/D1iGKcz9REQVOmmSUC1lsV5x3qUYW3GIcw==",
        "From": "Zhuoying Cai <zycai@linux.ibm.com>",
        "To": "qemu-s390x@nongnu.org, qemu-devel@nongnu.org",
        "Cc": "jrossi@linux.ibm.com, cohuck@redhat.com, berrange@redhat.com,\n richard.henderson@linaro.org, david@kernel.org, walling@linux.ibm.com,\n jjherne@linux.ibm.com, pasic@linux.ibm.com, borntraeger@linux.ibm.com,\n farman@linux.ibm.com, mjrosato@linux.ibm.com, iii@linux.ibm.com,\n eblake@redhat.com, armbru@redhat.com, zycai@linux.ibm.com,\n alifm@linux.ibm.com, brueckner@linux.ibm.com,\n pierrick.bouvier@oss.qualcomm.com, jdaley@linux.ibm.com",
        "Subject": "[PATCH v11 04/32] hw/s390x/ipl: Create certificate store",
        "Date": "Tue,  5 May 2026 16:18:36 -0400",
        "Message-ID": "<20260505201905.997996-5-zycai@linux.ibm.com>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260505201905.997996-1-zycai@linux.ibm.com>",
        "References": "<20260505201905.997996-1-zycai@linux.ibm.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-TM-AS-GCONF": "00",
        "X-Proofpoint-ORIG-GUID": "soDwgNC0BJvmqaCqbXgCKOkieEO2wSPX",
        "X-Proofpoint-GUID": "soDwgNC0BJvmqaCqbXgCKOkieEO2wSPX",
        "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNTA1MDE5NSBTYWx0ZWRfXxeIHNPFPZ/4i\n FYC1b+YAuLW8isQIyNw5avLjyzuc2oOgVHuQq4RRBlgbTN3H14uDKZXk4bCZhKhNa1LCx7IW4Ef\n 8xSZG8HRHvH4IZfSvVAY1vkwqdURLjeoHipK0wyihJ/9VH5bc8WkD0GTWE/ZhOctuyYdtiegALX\n K+z4UaqPU4oixhR9qMzKPI8+ik3vrqgVRr13+fGJtjCorNX7cNbqRCm9tGTyu4yLVi/wSSO62ok\n ErV7mBIQ3CTeotqw9aGrT6CaH630fjH0lqg3hHZxq6wi0c0CfT3DZsX1gYURBDw0X8QmP+5bH2t\n MeLQn9WKLJJ7C13vBHUynMjoOi3aO7tlNXH4N1F74rzlPBcGUAA4X74CYwoa7Cf9eUisZIb7XAR\n fqoQtZfAFptNejOo4Z/xcdvuQHJZzRRS7H54oF2c0AyWwL+bhctZtnwLWh5Uo4CfKNY7pScITcH\n v3yHxqxV/1592BVdQOA==",
        "X-Authority-Analysis": "v=2.4 cv=UbFhjqSN c=1 sm=1 tr=0 ts=69fa50c5 cx=c_pps\n a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17\n a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=6ph8WD7lSjxTzuMCr3kA:9",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-05-05_02,2026-04-30_02,2025-10-01_01",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n clxscore=1015 spamscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0\n adultscore=0 priorityscore=1501 bulkscore=0 phishscore=0 impostorscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605050195",
        "Received-SPF": "pass client-ip=148.163.156.1; envelope-from=zycai@linux.ibm.com;\n helo=mx0a-001b2d01.pphosted.com",
        "X-Spam_score_int": "-26",
        "X-Spam_score": "-2.7",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\n RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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": "Create a certificate store for boot certificates used for secure IPL.\n\nLoad certificates from the `boot-certs` parameter of s390-ccw-virtio\nmachine type option into the cert store.\n\nCurrently, only X.509 certificates in PEM format are supported, as the\nQEMU command line accepts certificates in PEM format only.\n\nSigned-off-by: Zhuoying Cai <zycai@linux.ibm.com>\nReviewed-by: Farhan Ali<alifm@linux.ibm.com>\n---\n docs/specs/index.rst            |   1 +\n docs/specs/s390x-secure-ipl.rst |  16 +++\n hw/s390x/cert-store.c           | 221 ++++++++++++++++++++++++++++++++\n hw/s390x/cert-store.h           |  39 ++++++\n hw/s390x/ipl.c                  |  10 ++\n hw/s390x/ipl.h                  |   3 +\n hw/s390x/meson.build            |   1 +\n include/hw/s390x/ipl/qipl.h     |   2 +\n 8 files changed, 293 insertions(+)\n create mode 100644 docs/specs/s390x-secure-ipl.rst\n create mode 100644 hw/s390x/cert-store.c\n create mode 100644 hw/s390x/cert-store.h",
    "diff": "diff --git a/docs/specs/index.rst b/docs/specs/index.rst\nindex b7909a108a..76d439782c 100644\n--- a/docs/specs/index.rst\n+++ b/docs/specs/index.rst\n@@ -40,3 +40,4 @@ guest hardware that is specific to QEMU.\n    riscv-aia\n    aspeed-intc\n    iommu-testdev\n+   s390x-secure-ipl\ndiff --git a/docs/specs/s390x-secure-ipl.rst b/docs/specs/s390x-secure-ipl.rst\nnew file mode 100644\nindex 0000000000..1cdf19783f\n--- /dev/null\n+++ b/docs/specs/s390x-secure-ipl.rst\n@@ -0,0 +1,16 @@\n+.. SPDX-License-Identifier: GPL-2.0-or-later\n+\n+s390 Certificate Store and Functions\n+------------------------------------\n+\n+s390 Certificate Store\n+^^^^^^^^^^^^^^^^^^^^^^\n+\n+A certificate store is implemented for s390-ccw guests to retain within\n+memory all certificates provided by the user via the command-line, which\n+are expected to be stored somewhere on the host's file system. The store\n+will keep track of the number of certificates, their respective size,\n+and a summation of the sizes.\n+\n+Note: A maximum of 64 certificates are allowed to be stored in the certificate\n+store.\ndiff --git a/hw/s390x/cert-store.c b/hw/s390x/cert-store.c\nnew file mode 100644\nindex 0000000000..a4f15627e9\n--- /dev/null\n+++ b/hw/s390x/cert-store.c\n@@ -0,0 +1,221 @@\n+/*\n+ * S390 certificate store implementation\n+ *\n+ * Copyright 2025 IBM Corp.\n+ * Author(s): Zhuoying Cai <zycai@linux.ibm.com>\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include \"cert-store.h\"\n+#include \"qapi/error.h\"\n+#include \"qemu/error-report.h\"\n+#include \"qemu/option.h\"\n+#include \"qemu/config-file.h\"\n+#include \"hw/s390x/ebcdic.h\"\n+#include \"hw/s390x/s390-virtio-ccw.h\"\n+#include \"qemu/cutils.h\"\n+#include \"crypto/x509-utils.h\"\n+#include \"qapi/qapi-types-machine-s390x.h\"\n+\n+static BootCertificatesList *s390_get_boot_certs(void)\n+{\n+    return S390_CCW_MACHINE(qdev_get_machine())->boot_certs;\n+}\n+\n+static S390IPLCertificate *init_cert(char *path, Error **errp)\n+{\n+    int rc;\n+    char *buf;\n+    size_t size;\n+    size_t der_len;\n+    char name[CERT_NAME_MAX_LEN];\n+    g_autofree gchar *filename = NULL;\n+    S390IPLCertificate *cert = NULL;\n+    g_autofree uint8_t *cert_der = NULL;\n+    Error *local_err = NULL;\n+\n+    filename = g_path_get_basename(path);\n+\n+    if (!g_file_get_contents(path, &buf, &size, NULL)) {\n+        error_setg(errp, \"Failed to load certificate: %s\", path);\n+        return NULL;\n+    }\n+\n+    rc = qcrypto_x509_convert_cert_der((uint8_t *)buf, size,\n+                                       &cert_der, &der_len, &local_err);\n+    if (rc != 0) {\n+        error_propagate_prepend(errp, local_err,\n+                                \"Failed to initialize certificate: %s: \", path);\n+        g_free(buf);\n+        return NULL;\n+    }\n+\n+    cert = g_new0(S390IPLCertificate, 1);\n+    cert->size = size;\n+    /*\n+     * Store DER length only - reused for size calculation.\n+     * cert_der is discarded because DER certificate data will be used once\n+     * and can be regenerated from cert->raw.\n+     */\n+    cert->der_size = der_len;\n+    /* store raw pointer - ownership transfers to cert */\n+    cert->raw = (uint8_t *)buf;\n+\n+    /*\n+     * Left justified certificate name with padding on the right with blanks.\n+     * Convert certificate name to EBCDIC.\n+     */\n+    strpadcpy(name, CERT_NAME_MAX_LEN, filename, ' ');\n+    ebcdic_put(cert->name, name, CERT_NAME_MAX_LEN);\n+\n+    return cert;\n+}\n+\n+static void update_cert_store(S390IPLCertificateStore *cert_store,\n+                              S390IPLCertificate *cert)\n+{\n+    size_t data_buf_size;\n+    size_t keyid_buf_size;\n+    size_t hash_buf_size;\n+    size_t cert_buf_size;\n+\n+    /* length field is word aligned for later DIAG use */\n+    keyid_buf_size = ROUND_UP(CERT_KEY_ID_LEN, 4);\n+    hash_buf_size = ROUND_UP(CERT_HASH_LEN, 4);\n+    cert_buf_size = ROUND_UP(cert->der_size, 4);\n+    data_buf_size = keyid_buf_size + hash_buf_size + cert_buf_size;\n+\n+    if (cert_store->largest_cert_size < data_buf_size) {\n+        cert_store->largest_cert_size = data_buf_size;\n+    }\n+\n+    g_assert(cert_store->count < MAX_CERTIFICATES);\n+\n+    cert_store->certs[cert_store->count] = *cert;\n+    cert_store->total_bytes += data_buf_size;\n+    cert_store->count++;\n+}\n+\n+static GPtrArray *get_cert_paths(Error **errp)\n+{\n+    struct stat st;\n+    BootCertificatesList *path_list = NULL;\n+    BootCertificatesList *list = NULL;\n+    gchar *cert_path;\n+    GDir *dir = NULL;\n+    const gchar *filename;\n+    bool is_empty;\n+    g_autoptr(GError) err = NULL;\n+    g_autoptr(GPtrArray) cert_path_builder = g_ptr_array_new_full(0, g_free);\n+\n+    path_list = s390_get_boot_certs();\n+\n+    for (list = path_list; list; list = list->next) {\n+        cert_path = list->value->path;\n+\n+        if (g_strcmp0(cert_path, \"\") == 0) {\n+            error_setg(errp, \"Empty path in certificate path list is not allowed\");\n+            goto fail;\n+        }\n+\n+        if (stat(cert_path, &st) != 0) {\n+            error_setg(errp, \"Failed to stat path '%s': %s\",\n+                       cert_path, g_strerror(errno));\n+            goto fail;\n+        }\n+\n+        if (S_ISREG(st.st_mode)) {\n+            if (!g_str_has_suffix(cert_path, \".pem\")) {\n+                error_setg(errp, \"Certificate file '%s' must have a .pem extension\",\n+                           cert_path);\n+                goto fail;\n+            }\n+\n+            g_ptr_array_add(cert_path_builder, g_strdup(cert_path));\n+        } else if (S_ISDIR(st.st_mode)) {\n+            dir = g_dir_open(cert_path, 0, &err);\n+            if (dir == NULL) {\n+                error_setg(errp, \"Failed to open directory '%s': %s\",\n+                           cert_path, err->message);\n+\n+                goto fail;\n+            }\n+\n+            is_empty = true;\n+            while ((filename = g_dir_read_name(dir))) {\n+                is_empty = false;\n+\n+                if (g_str_has_suffix(filename, \".pem\")) {\n+                    g_ptr_array_add(cert_path_builder,\n+                                    g_build_filename(cert_path, filename, NULL));\n+                } else {\n+                    warn_report(\"skipping '%s': not a .pem file\", filename);\n+                }\n+            }\n+\n+            if (is_empty) {\n+                warn_report(\"'%s' directory is empty\", cert_path);\n+            }\n+\n+            g_dir_close(dir);\n+        } else {\n+            error_setg(errp, \"Path '%s' is neither a file nor a directory\", cert_path);\n+            goto fail;\n+        }\n+    }\n+\n+    qapi_free_BootCertificatesList(path_list);\n+    return g_steal_pointer(&cert_path_builder);\n+\n+fail:\n+    qapi_free_BootCertificatesList(path_list);\n+    return NULL;\n+}\n+\n+void s390_ipl_create_cert_store(S390IPLCertificateStore *cert_store)\n+{\n+    GPtrArray *cert_path_builder;\n+    Error *err = NULL;\n+\n+    /* If cert store is already populated, then no work to do */\n+    if (cert_store->count) {\n+        return;\n+    }\n+\n+    cert_path_builder = get_cert_paths(&err);\n+    if (cert_path_builder == NULL) {\n+        error_report_err(err);\n+        exit(1);\n+    }\n+\n+    if (cert_path_builder->len == 0) {\n+        g_ptr_array_free(cert_path_builder, TRUE);\n+        return;\n+    }\n+\n+    if (cert_path_builder->len > MAX_CERTIFICATES) {\n+        error_report(\"Cert store exceeds maximum of %d certificates\", MAX_CERTIFICATES);\n+        g_ptr_array_free(cert_path_builder, TRUE);\n+        exit(1);\n+    }\n+\n+    cert_store->largest_cert_size = 0;\n+    cert_store->total_bytes = 0;\n+\n+    for (int i = 0; i < cert_path_builder->len; i++) {\n+        g_autofree S390IPLCertificate *cert =\n+                    init_cert((char *) cert_path_builder->pdata[i],\n+                              &err);\n+        if (!cert) {\n+            error_report_err(err);\n+            g_ptr_array_free(cert_path_builder, TRUE);\n+            exit(1);\n+        }\n+\n+        update_cert_store(cert_store, cert);\n+    }\n+\n+    g_ptr_array_free(cert_path_builder, TRUE);\n+}\ndiff --git a/hw/s390x/cert-store.h b/hw/s390x/cert-store.h\nnew file mode 100644\nindex 0000000000..7fc9503cb9\n--- /dev/null\n+++ b/hw/s390x/cert-store.h\n@@ -0,0 +1,39 @@\n+/*\n+ * S390 certificate store\n+ *\n+ * Copyright 2025 IBM Corp.\n+ * Author(s): Zhuoying Cai <zycai@linux.ibm.com>\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#ifndef HW_S390_CERT_STORE_H\n+#define HW_S390_CERT_STORE_H\n+\n+#include \"hw/s390x/ipl/qipl.h\"\n+#include \"crypto/x509-utils.h\"\n+\n+#define CERT_NAME_MAX_LEN  64\n+\n+#define CERT_KEY_ID_LEN    QCRYPTO_HASH_DIGEST_LEN_SHA256\n+#define CERT_HASH_LEN      QCRYPTO_HASH_DIGEST_LEN_SHA256\n+\n+struct S390IPLCertificate {\n+    uint8_t name[CERT_NAME_MAX_LEN];\n+    size_t  size;\n+    size_t  der_size;\n+    uint8_t *raw;\n+};\n+typedef struct S390IPLCertificate S390IPLCertificate;\n+\n+struct S390IPLCertificateStore {\n+    uint16_t count;\n+    size_t   largest_cert_size;\n+    size_t   total_bytes;\n+    S390IPLCertificate certs[MAX_CERTIFICATES];\n+};\n+typedef struct S390IPLCertificateStore S390IPLCertificateStore;\n+\n+void s390_ipl_create_cert_store(S390IPLCertificateStore *cert_store);\n+\n+#endif\ndiff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c\nindex 1babcd2b7d..fbef46aee5 100644\n--- a/hw/s390x/ipl.c\n+++ b/hw/s390x/ipl.c\n@@ -38,6 +38,7 @@\n #include \"qemu/option.h\"\n #include \"qemu/ctype.h\"\n #include \"standard-headers/linux/virtio_ids.h\"\n+#include \"cert-store.h\"\n \n #define KERN_IMAGE_START                0x010000UL\n #define LINUX_MAGIC_ADDR                0x010008UL\n@@ -453,6 +454,13 @@ void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp)\n     }\n }\n \n+S390IPLCertificateStore *s390_ipl_get_certificate_store(void)\n+{\n+    S390IPLState *ipl = get_ipl_device();\n+\n+    return &ipl->cert_store;\n+}\n+\n static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb)\n {\n     CcwDevice *ccw_dev = NULL;\n@@ -771,6 +779,8 @@ void s390_ipl_prepare_cpu(S390CPU *cpu)\n     cpu->env.psw.addr = ipl->start_addr;\n     cpu->env.psw.mask = IPL_PSW_MASK;\n \n+    s390_ipl_create_cert_store(&ipl->cert_store);\n+\n     if (!ipl->kernel || ipl->iplb_valid) {\n         cpu->env.psw.addr = ipl->bios_start_addr;\n         if (!ipl->iplb_valid) {\ndiff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h\nindex fac30763df..f5a49a4431 100644\n--- a/hw/s390x/ipl.h\n+++ b/hw/s390x/ipl.h\n@@ -13,6 +13,7 @@\n #ifndef HW_S390_IPL_H\n #define HW_S390_IPL_H\n \n+#include \"cert-store.h\"\n #include \"target/s390x/cpu.h\"\n #include \"exec/target_page.h\"\n #include \"system/address-spaces.h\"\n@@ -35,6 +36,7 @@ int s390_ipl_pv_unpack(struct S390PVResponse *pv_resp);\n void s390_ipl_prepare_cpu(S390CPU *cpu);\n IplParameterBlock *s390_ipl_get_iplb(void);\n IplParameterBlock *s390_ipl_get_iplb_pv(void);\n+S390IPLCertificateStore *s390_ipl_get_certificate_store(void);\n \n enum s390_reset {\n     /* default is a reset not triggered by a CPU e.g. issued by QMP */\n@@ -63,6 +65,7 @@ struct S390IPLState {\n     IplParameterBlock iplb;\n     IplParameterBlock iplb_pv;\n     QemuIplParameters qipl;\n+    S390IPLCertificateStore cert_store;\n     uint64_t start_addr;\n     uint64_t compat_start_addr;\n     uint64_t bios_start_addr;\ndiff --git a/hw/s390x/meson.build b/hw/s390x/meson.build\nindex 57cc2a6be3..6b39ad012f 100644\n--- a/hw/s390x/meson.build\n+++ b/hw/s390x/meson.build\n@@ -17,6 +17,7 @@ s390x_ss.add(files(\n   'sclpcpu.c',\n   'sclpquiesce.c',\n   'tod.c',\n+  'cert-store.c',\n ))\n s390x_ss.add(when: 'CONFIG_KVM', if_true: files(\n   'tod-kvm.c',\ndiff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h\nindex 8d3c83a80b..ed1a91182a 100644\n--- a/include/hw/s390x/ipl/qipl.h\n+++ b/include/hw/s390x/ipl/qipl.h\n@@ -31,6 +31,8 @@ typedef enum S390IplType S390IplType;\n \n #define QEMU_DEFAULT_IPL S390_IPL_TYPE_CCW\n \n+#define MAX_CERTIFICATES  64\n+\n /*\n  * The QEMU IPL Parameters will be stored at absolute address\n  * 204 (0xcc) which means it is 32-bit word aligned but not\n",
    "prefixes": [
        "v11",
        "04/32"
    ]
}