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 DD9D3C43458 for ; Tue, 7 Jul 2026 23:43:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1whFPl-0002Wn-2v; Tue, 07 Jul 2026 19:41:21 -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 1whFPj-0002WX-NV; Tue, 07 Jul 2026 19:41:19 -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 1whFPi-0006HT-1O; Tue, 07 Jul 2026 19:41:19 -0400 Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 667MmDkI920442; Tue, 7 Jul 2026 23:41:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=ctsHirudJ25PUav1g KZnP5seYl2oQ2gD915FatB8nQc=; b=hxii+h6VZV/IQPTM5C4qJhSaijBsCQzec c2mwPBsdWenfgdJ7yDwFvNh0jejAExQQ5L2WUb0bN19+TofadoDqECTXyXOEJII4 40+6Ur+T8CjmcJy9fxjD03ZaYmfHz9mrP8iVPZ9UCDgntPZJsCX47yml5HQGLFK5 9oC+4iH5nWDNR5kEiU4wbW9SeH3ycAMDOElxke/7Q0ILnws/RCYXgP8mdA2WYQur kXP9txNJjWY8U8aBDvklA50m3g8Qq0iLM8PYD/GPn7b0DjsdU1U9PoqJKLkHCIFP tlB5dcsbT4JEFzOr/2nfBfZcxx+/3VT+hqJx2yIVzPyG0fgnQQRDQ== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4f6sp3sva0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jul 2026 23:41:14 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 667NYfw4026319; Tue, 7 Jul 2026 23:41:13 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4f7e0hd1gy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jul 2026 23:41:13 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 667NfBgA27263508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Jul 2026 23:41:11 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B70C5805D; Tue, 7 Jul 2026 23:41:11 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9674D58056; Tue, 7 Jul 2026 23:41:09 +0000 (GMT) Received: from fedora-workstation.lan (unknown [9.61.116.2]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 7 Jul 2026 23:41:09 +0000 (GMT) From: Zhuoying Cai To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Cc: jrossi@linux.ibm.com, cohuck@redhat.com, berrange@redhat.com, richard.henderson@linaro.org, david@kernel.org, walling@linux.ibm.com, jjherne@linux.ibm.com, pasic@linux.ibm.com, borntraeger@linux.ibm.com, farman@linux.ibm.com, mjrosato@linux.ibm.com, iii@linux.ibm.com, eblake@redhat.com, armbru@redhat.com, zycai@linux.ibm.com, alifm@linux.ibm.com, brueckner@linux.ibm.com, pierrick.bouvier@oss.qualcomm.com, jdaley@linux.ibm.com Subject: [PATCH v16 30/33] hw/s390x/ipl: Handle secure boot with multiple boot devices Date: Tue, 7 Jul 2026 19:40:43 -0400 Message-ID: <20260707234047.2499921-11-zycai@linux.ibm.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260707234047.2499921-1-zycai@linux.ibm.com> References: <20260707231132.2492104-1-zycai@linux.ibm.com> <20260707234047.2499921-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=KsJ9H2WN c=1 sm=1 tr=0 ts=6a4d8e9a cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=20KFwNOVAAAA:8 a=8E_wKCjR_O7UhaygiVUA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzA3MDIyOSBTYWx0ZWRfX3M4kCHCObFYl CI3TEaWgqaL5+ffGCApDSY+5xb3wkbNNI3J2rXavWwNsORRfrc/ZEG4x+EPuvztVYyxEP/rxSe1 mJR3ww4CViqWsiuTnJzc13ZOjMi6dMs= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzA3MDIyOSBTYWx0ZWRfX/J8/WNvaRPDg 9jPQSUwT1kZ/+N5Qnq2yy2OSRLJOdMt1q74uN85Wo+xmaEq0sj5NGAib2TkgBt1Lu9A0ftqr4id ucQAjH2Nc1rWu5p6BZvLhDT1qsLaEEXS7niHbiGXTySBGDOx7fhLLyLr2/C9aVlDpEWeXRb0IPt L3nElxaabbYf3V3hfpS162vvCj4zSEMjftfhMrqICwfH9gsOBp4rnl8TsFnsCfsZ0SZX412A41L SS69Ui/iO8MYdhI/1hPvKHpyP4nYmgesElc3dnSdyLDhCuT3ezmT6hKz3yXXIU/PRP/hzDNwnIE M5tio+AQqY4GritxwoIBXwiZAOkHGS9TE2JJbENalbVf5rlRSH4onwmVaOUEnC6zBlobpOoQ6pO QoYvFPMvb9jTdpVmJG1QlWuLrBbxn7i8k2iesxl1F8HU/QjEXTq9WlLlt/VqOO0cce818RjZ/Df Ao5ENrDAOA9skxH+CxA== X-Proofpoint-ORIG-GUID: FsYPEtSh9Viuf2T85X5UVJRGCImOh83Q X-Proofpoint-GUID: FsYPEtSh9Viuf2T85X5UVJRGCImOh83Q 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 impostorscore=0 malwarescore=0 spamscore=0 adultscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607070229 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 The current approach to enable secure boot relies on providing secure-boot and boot-certs parameters of s390-ccw-virtio machine type option, which apply to all boot devices. With the possibility of multiple boot devices, secure boot expects all provided devices to be supported and eligible (e.g., virtio-blk/virtio-scsi using the SCSI scheme). If multiple boot devices are provided and include an unsupported (e.g., ECKD, VFIO) or a non-eligible (e.g., Net) device, the boot process will terminate with an error logged to the console. Signed-off-by: Zhuoying Cai Reviewed-by: Thomas Huth Reviewed-by: Matthew Rosato --- hw/s390x/ipl.c | 40 ++++++++++++++++++++++++++++++++++++++-- pc-bios/s390-ccw/main.c | 3 --- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 35bdfe03d8..d59ed36c78 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -504,6 +504,37 @@ static void s390_set_secure_boot_flags(IplParameterBlock *iplb, iplb->len = cpu_to_be32(S390_IPLB_MAX_LEN); } +static bool s390_validate_secure_boot_device(int devtype, Error **errp) +{ + switch (devtype) { + case CCW_DEVTYPE_VFIO: + error_setg(errp, "Passthrough (vfio) CCW device does not support secure boot!"); + return false; + case CCW_DEVTYPE_VIRTIO_NET: + error_setg(errp, "Virtio net boot device does not support secure boot!"); + return false; + default: + return true; + } +} + +static void s390_apply_secure_boot(IplParameterBlock *iplb, int devtype, + bool secure_boot, bool audit_mode) +{ + Error *local_error = NULL; + + if (!secure_boot && !audit_mode) { + return; + } + + if (!s390_validate_secure_boot_device(devtype, &local_error)) { + error_report_err(local_error); + exit(1); + } + + s390_set_secure_boot_flags(iplb, secure_boot, audit_mode); +} + static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) { CcwDevice *ccw_dev = NULL; @@ -560,14 +591,19 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) s390_ipl_convert_loadparm((char *)lp, iplb->loadparm); iplb->flags |= DIAG308_FLAGS_LP_VALID; - s390_set_secure_boot_flags(iplb, s390_secure_boot_enabled(), - s390_has_certificate()); + s390_apply_secure_boot(iplb, devtype, s390_secure_boot_enabled(), + s390_has_certificate()); return true; } pbdev = s390_get_pci_device(dev_st, &devtype); if (pbdev) { + if (s390_secure_boot_enabled() || s390_has_certificate()) { + error_report("Virtio pci boot device does not support secure boot!"); + exit(1); + } + pci_lp = object_property_get_str(OBJECT(pbdev->pdev), "loadparm", NULL); if (pci_lp && strlen(pci_lp) > 0) { lp = pci_lp; diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index c5c093534c..8fc1cbf653 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -308,9 +308,6 @@ 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: -- 2.54.0