Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2233197/?format=api
{ "id": 2233197, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2233197/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260505201905.997996-12-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-12-zycai@linux.ibm.com>", "list_archive_url": null, "date": "2026-05-05T20:18:43", "name": "[v11,11/32] s390x/diag: Introduce DIAG 508 for secure IPL operations", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "9699e73a64ad9f7cc4fe8cbc7e416ddba7c4e435", "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-12-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/2233197/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2233197/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=EhU+3TpS;\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 4g990j5TZHz1yJx\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 06:22:13 +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 1wKMF6-0007nH-Kc; Tue, 05 May 2026 16:19:44 -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 1wKMEz-0007gG-B8; Tue, 05 May 2026 16:19:37 -0400", "from mx0b-001b2d01.pphosted.com ([148.163.158.5])\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 1wKMEv-0000EP-Qw; Tue, 05 May 2026 16:19:37 -0400", "from pps.filterd (m0356516.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 645K7ESw3351555; Tue, 5 May 2026 20:19:30 GMT", "from ppma23.wdc07v.mail.ibm.com\n (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dw9w6d6q2-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Tue, 05 May 2026 20:19:30 +0000 (GMT)", "from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1])\n by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id\n 645K9SMZ026683;\n Tue, 5 May 2026 20:19:29 GMT", "from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6])\n by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4dww3h38j8-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Tue, 05 May 2026 20:19:29 +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 645KJSWS30278178\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Tue, 5 May 2026 20:19:28 GMT", "from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 278C758059;\n Tue, 5 May 2026 20:19:28 +0000 (GMT)", "from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 763C45805B;\n Tue, 5 May 2026 20:19:26 +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:26 +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=GOw7F0Orf7CHYqChZ\n djOxmqV36P4/I+0nJIam4l+HaM=; b=EhU+3TpSWUHs/WybkwRVbQY1jleKXveEQ\n y84gNDHYu3vVpz+ayXISeyI67pRv2AypmR+mnATixS9vISvcKo5yl0FAlCqfJ/pZ\n M/uk6WFanHMyufz7xO91vBjCf84ux38J6QdrwuBzWcyBNeekn4PfPdA06RQVUjWZ\n Td26yDDG4yfIezcDplMzNvkHCq1UwJZ+N/AQMr0IPtDF1UDbu2T3Hi9Lv5HbB4+D\n 4xiZ25WBAke24DuUPOJ0lKIBA+nAvXEehqrEnO+oYdHQREf8lQoDz5uq8LsfdTvG\n +VrPb3J9uPLv9CAjxMA4QNkEx6dKDj2fyWp1CkYWEyYDz2tvI/0Pg==", "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 11/32] s390x/diag: Introduce DIAG 508 for secure IPL\n operations", "Date": "Tue, 5 May 2026 16:18:43 -0400", "Message-ID": "<20260505201905.997996-12-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-Authority-Analysis": "v=2.4 cv=XPQAjwhE c=1 sm=1 tr=0 ts=69fa50d2 cx=c_pps\n a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17\n a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=20KFwNOVAAAA:8\n a=hXQcL9AfcS-IPDpH2m0A:9", "X-Proofpoint-ORIG-GUID": "pQibc-ojBSXirh76yQ3PC3k125tF4qsi", "X-Proofpoint-GUID": "pQibc-ojBSXirh76yQ3PC3k125tF4qsi", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNTA1MDE5NSBTYWx0ZWRfX7Ani8arbPrRk\n iNyWPM0Fela2A+BMGGS1vpBi0JNMq596cKo/HFHgy6mTw2H9ygrFhvumbVihjyiBZGvVasVK2Le\n 4UWzde1hkdNmmTZSrgZBP27g2y8b8/8v1l3Ie/wETnpd51TL22GL4eDQqrxVEYKNGs0klFXk2c4\n GvUCmcb/IACPBAN8dZHX78jdxTl701azbq9iCCfp59n1pr7jJFKbxx3s0SM+OdnUaYfPzVYrIJM\n dSPN0sH1LX6JHb6Xmk30uxDTpHoHqMY/XfI5Ax7GNue5hYj+cBm0asn86PyLpOvUcDerWoauz6U\n WO5YkzkKzEjxDsHcXiXepNnrff8ZGfptq7rBDZ+WxiaS5t5p0B+eLdqkeqqBYhdjKlmsEK5nEey\n DVqeVHhS7C/KeamZuYtMIXG0n6mSpLRCDVE1aqk+X1tzkorkOJpcBpHIWtXS5hdF7tiFGRD6gn8\n fJKo/YYkOP/sv92+2Qg==", "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 bulkscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 spamscore=0\n priorityscore=1501 impostorscore=0 phishscore=0 malwarescore=0 clxscore=1015\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.158.5; envelope-from=zycai@linux.ibm.com;\n helo=mx0b-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": "From: Collin Walling <walling@linux.ibm.com>\n\nIn order to support secure IPL (aka secure boot) for the s390-ccw BIOS,\na new s390 DIAGNOSE instruction is introduced to leverage QEMU for\nhandling operations such as signature verification and certificate\nretrieval.\n\nCurrently, only subcode 0 is supported with this patch, which is used to\nquery a bitmap of which subcodes are supported.\n\nSigned-off-by: Collin Walling <walling@linux.ibm.com>\nReviewed-by: Farhan Ali <alifm@linux.ibm.com>\nReviewed-by: Thomas Huth <thuth@redhat.com>\n---\n docs/specs/s390x-secure-ipl.rst | 18 ++++++++++++++++++\n include/hw/s390x/ipl/diag508.h | 15 +++++++++++++++\n target/s390x/diag.c | 27 +++++++++++++++++++++++++++\n target/s390x/kvm/kvm.c | 14 ++++++++++++++\n target/s390x/s390x-internal.h | 2 ++\n target/s390x/tcg/misc_helper.c | 7 +++++++\n 6 files changed, 83 insertions(+)\n create mode 100644 include/hw/s390x/ipl/diag508.h", "diff": "diff --git a/docs/specs/s390x-secure-ipl.rst b/docs/specs/s390x-secure-ipl.rst\nindex d9c5c24ec7..488981339d 100644\n--- a/docs/specs/s390x-secure-ipl.rst\n+++ b/docs/specs/s390x-secure-ipl.rst\n@@ -62,3 +62,21 @@ Subcode 2 - store verification certificates\n contiguously in a VCE (with zero-padding). Following the header, the\n key-id is immediately stored. The hash and certificate data follow and\n may be accessed via the respective offset fields stored in the VCE.\n+\n+\n+Secure IPL Data Structures, Facilities, and Functions\n+-----------------------------------------------------\n+\n+DIAGNOSE function code 'X'508' - IPL extensions\n+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n+\n+DIAGNOSE 'X'508' is reserved for guest use in order to facilitate communication\n+of additional IPL operations that cannot be handled by guest code, such as\n+signature verification for secure IPL.\n+\n+If the function code specifies 0x508, IPL extension functions are performed.\n+These functions are meant to provide extended functionality for s390 guest boot\n+that requires assistance from QEMU.\n+\n+Subcode 0 - query installed subcodes\n+ Returns a 64-bit mask indicating which subcodes are supported.\ndiff --git a/include/hw/s390x/ipl/diag508.h b/include/hw/s390x/ipl/diag508.h\nnew file mode 100644\nindex 0000000000..6281ad8299\n--- /dev/null\n+++ b/include/hw/s390x/ipl/diag508.h\n@@ -0,0 +1,15 @@\n+/*\n+ * S/390 DIAGNOSE 508 definitions and structures\n+ *\n+ * Copyright 2025 IBM Corp.\n+ * Author(s): Collin Walling <walling@linux.ibm.com>\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#ifndef S390X_DIAG508_H\n+#define S390X_DIAG508_H\n+\n+#define DIAG_508_SUBC_QUERY_SUBC 0x0000\n+\n+#endif\ndiff --git a/target/s390x/diag.c b/target/s390x/diag.c\nindex 0645fe39dc..390a543ede 100644\n--- a/target/s390x/diag.c\n+++ b/target/s390x/diag.c\n@@ -20,6 +20,7 @@\n #include \"hw/s390x/cert-store.h\"\n #include \"hw/s390x/ipl.h\"\n #include \"hw/s390x/ipl/diag320.h\"\n+#include \"hw/s390x/ipl/diag508.h\"\n #include \"hw/s390x/s390-virtio-ccw.h\"\n #include \"system/kvm.h\"\n #include \"kvm/kvm_s390x.h\"\n@@ -638,3 +639,29 @@ void handle_diag_320(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)\n break;\n }\n }\n+\n+void handle_diag_508(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)\n+{\n+ uint64_t subcode = env->regs[r3];\n+ int rc;\n+\n+ if (env->psw.mask & PSW_MASK_PSTATE) {\n+ s390_program_interrupt(env, PGM_PRIVILEGED, ra);\n+ return;\n+ }\n+\n+ if ((subcode & ~0x0ffffULL) || (r1 & 1)) {\n+ s390_program_interrupt(env, PGM_SPECIFICATION, ra);\n+ return;\n+ }\n+\n+ switch (subcode) {\n+ case DIAG_508_SUBC_QUERY_SUBC:\n+ rc = 0;\n+ break;\n+ default:\n+ s390_program_interrupt(env, PGM_SPECIFICATION, ra);\n+ return;\n+ }\n+ env->regs[r1 + 1] = rc;\n+}\ndiff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c\nindex a5411859a8..82f7fed9ec 100644\n--- a/target/s390x/kvm/kvm.c\n+++ b/target/s390x/kvm/kvm.c\n@@ -102,6 +102,7 @@\n #define DIAG_CERT_STORE 0x320\n #define DIAG_KVM_HYPERCALL 0x500\n #define DIAG_KVM_BREAKPOINT 0x501\n+#define DIAG_SECURE_IPL 0x508\n \n #define ICPT_INSTRUCTION 0x04\n #define ICPT_PROGRAM 0x08\n@@ -1542,6 +1543,16 @@ static void kvm_handle_diag_320(S390CPU *cpu, struct kvm_run *run)\n handle_diag_320(&cpu->env, r1, r3, RA_IGNORED);\n }\n \n+static void kvm_handle_diag_508(S390CPU *cpu, struct kvm_run *run)\n+{\n+ uint64_t r1, r3;\n+\n+ r1 = (run->s390_sieic.ipa & 0x00f0) >> 4;\n+ r3 = run->s390_sieic.ipa & 0x000f;\n+\n+ handle_diag_508(&cpu->env, r1, r3, RA_IGNORED);\n+}\n+\n #define DIAG_KVM_CODE_MASK 0x000000000000ffff\n \n static int handle_diag(S390CPU *cpu, struct kvm_run *run, uint32_t ipb)\n@@ -1575,6 +1586,9 @@ static int handle_diag(S390CPU *cpu, struct kvm_run *run, uint32_t ipb)\n case DIAG_CERT_STORE:\n kvm_handle_diag_320(cpu, run);\n break;\n+ case DIAG_SECURE_IPL:\n+ kvm_handle_diag_508(cpu, run);\n+ break;\n default:\n trace_kvm_insn_diag(func_code);\n kvm_s390_program_interrupt(cpu, PGM_SPECIFICATION);\ndiff --git a/target/s390x/s390x-internal.h b/target/s390x/s390x-internal.h\nindex b16490bce6..367df65970 100644\n--- a/target/s390x/s390x-internal.h\n+++ b/target/s390x/s390x-internal.h\n@@ -390,6 +390,8 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3,\n uintptr_t ra);\n void handle_diag_320(CPUS390XState *env, uint64_t r1, uint64_t r3,\n uintptr_t ra);\n+void handle_diag_508(CPUS390XState *env, uint64_t r1, uint64_t r3,\n+ uintptr_t ra);\n \n \n /* translate.c */\ndiff --git a/target/s390x/tcg/misc_helper.c b/target/s390x/tcg/misc_helper.c\nindex 4d73475d95..562dde9cb3 100644\n--- a/target/s390x/tcg/misc_helper.c\n+++ b/target/s390x/tcg/misc_helper.c\n@@ -149,6 +149,13 @@ void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num)\n bql_unlock();\n r = 0;\n break;\n+ case 0x508:\n+ /* secure ipl operations */\n+ bql_lock();\n+ handle_diag_508(env, r1, r3, GETPC());\n+ bql_unlock();\n+ r = 0;\n+ break;\n default:\n r = -1;\n break;\n", "prefixes": [ "v11", "11/32" ] }