Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C4DCC44501 for ; Tue, 7 Jul 2026 23:57:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1whFes-0001wq-Vb; Tue, 07 Jul 2026 19:56:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1whFef-0001sL-3d; Tue, 07 Jul 2026 19:56:45 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1whFeZ-0002ju-2o; Tue, 07 Jul 2026 19:56:44 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 667MmN651237782; Tue, 7 Jul 2026 23:56:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=WaamSiMM75dQw7PGr PDH//CmQ+M78D+laoj6m+0agsc=; b=HkFp6c6GqXs7dBHjw9joiJqFtJlWO3dZx rSErFU+ipAa1Qov/iTXle3y3XeJzUdWVAalmYQLgtq8tthnWo1gCgHa2cQVWQyGc GCKZkzmdTlU3GRmq1rZC/6i0NH5OlZ1hTpsqXeEWMcwk0e4umKyC0F2CDtsXTKmn 91YqyFhDEB54kMXUQ9kcDkD9tWKe8V0n/Gw5MAmwFJYU2plu0cp4CgV8qo6yUJke y+PZscX660WdwlL1rQljHHYPDZ0qSLGV6C19OZJttUxKvNPLdVSJW+CBCoGy+CS5 COykf16RpB6UHXbwHVoiLTuqWP/r1YkTMmRUVCxA8qs1LWU8g9P3A== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4f6suqsjj3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jul 2026 23:56:18 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 667Nnp95023702; Tue, 7 Jul 2026 23:56:17 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4f7eqg4xqg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jul 2026 23:56:17 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 667NuHoh6554278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Jul 2026 23:56:17 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D5175805A; Tue, 7 Jul 2026 23:56:17 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C7A0D58056; Tue, 7 Jul 2026 23:56:16 +0000 (GMT) Received: from fedora-workstation.lan (unknown [9.61.116.2]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 7 Jul 2026 23:56:16 +0000 (GMT) From: Zhuoying Cai To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v16 22/33] pc-bios/s390-ccw: Introduce ZiplBootMode enum for IPL mode selection Date: Tue, 7 Jul 2026 19:55:56 -0400 Message-ID: <20260707235615.2513487-2-zycai@linux.ibm.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260707231132.2492104-1-zycai@linux.ibm.com> References: <20260707231132.2492104-1-zycai@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzA3MDIzMyBTYWx0ZWRfX4Q6YFEwPkKtn uWc2hIg4HhAvQDDCE7GDhVMVDzN+Tdg8KpdjPHBwH5atPCOL23v0tnRKsRrwRpqEGQ3hsIl1AF8 Ux0WkioJ80rBAO1GKl9dtXEprgmblv0= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzA3MDIzMyBTYWx0ZWRfXwv6wQb8umV4K VvBDHMnavyZsn1Zx4o43AWr/ufPtVJDX4dsNfofa6I/DslA5TRA2d4QsRNNllTiCGTkRQEe+Df6 Fud2hRlZpiAKKA5ymKGSmbcWSIgzal0a+ahsPf8xS6IpNZ0005q1bfu7QzKJ8MNT7GlHwjJiMhT 62Nl5P6COjbobQ4H9u3MEKwcIjFoJjddJogbbY83D35PgoIuoy68MhPoc0ZyFbqoD53AWH2FDU4 a1wVC7bf5j0FNFsAh9T8FtE0ymdVZkkfNQoktiBG4vGaIVMD+Xjh3zEjh2RSgZSVDfscp05f6kG XHO/QisTZbZc6TvknyMkLZMKzU7sE3+feeByUrtYfWTaoxEoNuWMLaer0+CwboCyDxo4Wfp5fLY ALe/yKDcH30Q7LazoyUNZHRJy8lmdQCMyMkoLON8k1BdyYXUWqx3P2dmr+brZkEvriUeh4pYoy1 2SmjiM6kA+qlfa8dyaQ== X-Proofpoint-GUID: I5UlGn9Siz3eLUn_XK6fjOPpdmI9AZwb X-Authority-Analysis: v=2.4 cv=Oot/DS/t c=1 sm=1 tr=0 ts=6a4d9222 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=6Ycx5JGYSpe9m2xj7koA:9 X-Proofpoint-ORIG-GUID: I5UlGn9Siz3eLUn_XK6fjOPpdmI9AZwb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-07_06,2026-07-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 adultscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607070233 Received-SPF: pass client-ip=148.163.156.1; envelope-from=zycai@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add ZiplBootMode enumeration to support multiple IPL boot configurations. Boot modes differentiate between normal boot and secure IPL operations, enabled based on boot certificates specified via the boot-certs option. Normal Mode: IPL when no certificates are provided. No signature verification is performed. This prepares for future secure IPL modes requiring signature verification. Signed-off-by: Zhuoying Cai Reviewed-by: Collin Walling Reviewed-by: Jared Rossi --- docs/system/s390x/secure-ipl.rst | 21 +++++++++++++++++++++ pc-bios/s390-ccw/bootmap.c | 16 +++++++++++++++- pc-bios/s390-ccw/main.c | 6 ++++++ pc-bios/s390-ccw/s390-ccw.h | 6 ++++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/docs/system/s390x/secure-ipl.rst b/docs/system/s390x/secure-ipl.rst index 88df52ce2f..9d7d33f5ed 100644 --- a/docs/system/s390x/secure-ipl.rst +++ b/docs/system/s390x/secure-ipl.rst @@ -18,3 +18,24 @@ Note: certificate files must have a .pem extension. .. code-block:: shell qemu-system-s390x -machine s390-ccw-virtio,boot-certs.0.path=/.../qemu/certs,boot-certs.1.path=/another/path/cert.pem ... + + +IPL Modes +--------- + +Multiple IPL modes are available to differentiate between the various IPL +configurations. These modes are mutually exclusive and enabled based on the +``boot-certs`` option on the QEMU command line. + +Normal Mode +^^^^^^^^^^^ + +The absence of certificates will attempt to IPL a guest without secure IPL +operations. No checks are performed, and no warnings/errors are reported. +This is the default mode. + +Configuration: + +.. code-block:: shell + + qemu-system-s390x -machine s390-ccw-virtio ... diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index d0ac97795d..7791ca179a 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -330,6 +330,9 @@ static int run_eckd_boot_script(block_number_t bmt_block_nr, /* The S1B block number is NULL_BLOCK_NR if and only if it's an LD-IPL */ bool ldipl = (s1b_block_nr == NULL_BLOCK_NR); + IPL_assert((boot_mode == ZIPL_BOOT_MODE_NORMAL), + "Secure boot with the ECKD scheme is not supported!"); + if (menu_is_enabled_zipl() && !ldipl) { loadparm = eckd_get_boot_menu_index(s1b_block_nr); } @@ -729,7 +732,14 @@ static int zipl_run(ScsiBlockPtr *pte) /* Load image(s) into RAM */ entry = (ComponentEntry *)(&header[1]); - rc = zipl_run_normal(&entry, tmp_sec); + switch (boot_mode) { + case ZIPL_BOOT_MODE_NORMAL: + rc = zipl_run_normal(&entry, tmp_sec); + break; + default: + panic("Unknown boot mode"); + } + if (rc) { return rc; } @@ -1101,12 +1111,16 @@ void zipl_load(void) VDev *vdev = virtio_get_device(); if (vdev->is_cdrom) { + IPL_assert((boot_mode == ZIPL_BOOT_MODE_NORMAL), + "Secure boot from ISO image is not supported!"); ipl_iso_el_torito(); puts("Failed to IPL this ISO image!"); return; } if (virtio_get_device_type() == VIRTIO_ID_NET) { + IPL_assert((boot_mode == ZIPL_BOOT_MODE_NORMAL), + "Virtio net boot device does not support secure boot!"); netmain(); puts("Failed to IPL from this network!"); return; diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 44888e0c5c..40e568fc71 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -30,6 +30,7 @@ IplParameterBlock *iplb; bool have_iplb; static uint16_t cutype; LowCore *lowcore; /* Yes, this *is* a pointer to address 0 */ +ZiplBootMode boot_mode; #define LOADPARM_PROMPT "PROMPT " #define LOADPARM_EMPTY " " @@ -306,6 +307,9 @@ static void ipl_ccw_device(void) switch (cutype) { case CU_TYPE_DASD_3990: case CU_TYPE_DASD_2107: + IPL_assert((boot_mode == ZIPL_BOOT_MODE_NORMAL), + "Passthrough (vfio) CCW device does not support secure boot!"); + dasd_ipl(blk_schid, cutype); break; case CU_TYPE_VIRTIO: @@ -393,6 +397,8 @@ void main(void) probe_boot_device(); } + boot_mode = ZIPL_BOOT_MODE_NORMAL; + while (have_iplb) { boot_setup(); if (have_iplb && find_boot_device()) { diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index 1e1f71775e..5420443ad2 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -69,6 +69,12 @@ int sclp_read(char *str, size_t count); /* bootmap.c */ void zipl_load(void); +typedef enum ZiplBootMode { + ZIPL_BOOT_MODE_NORMAL = 0, +} ZiplBootMode; + +extern ZiplBootMode boot_mode; + /* jump2ipl.c */ void write_reset_psw(uint64_t psw); int jump_to_IPL_code(uint64_t address); -- 2.54.0