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 12E3FC43458 for ; Tue, 7 Jul 2026 23:43:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1whFPf-0002Um-MP; Tue, 07 Jul 2026 19:41:15 -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 1whFPe-0002UB-3s; Tue, 07 Jul 2026 19:41:14 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1whFPc-0006Ga-Bl; Tue, 07 Jul 2026 19:41:13 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 667MmdxT184831; Tue, 7 Jul 2026 23:41:09 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=7DEsHgDQ8qYO/RbaH 2jDxgq0RdhnuicsuS/DuVijqOE=; b=ERP386LUzNgCEighXTevWyYFRG9DkzCk9 EosmYyUmG/1Ch9zuRmFEIqy2GiFajjIhXHZyPv491JlJyM/zFcHmgiyZvGw7Wyhb cJNBGsEXPpoCvTKHJmmsznUS0bpa0fgUipQptSfuuZ/SKfIx/54alQo5xs840kRu yKruKh7YnVU+pdEdWfyhS93c4vOa9403A3ZR0PmFh47J9CPqRdehlGPnJf62QajJ 9+EBDsuoMSATxY23lie2O/IBlqFc0eEcS5NzR5i9soCiT/7eRkjLNRlj2C1pER7S lYaogvsr1nHuEfr4SOa2l7W5vUHkTtMkFKiJa6p32JLWHTHPrFFUQ== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4f6rkdtasp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jul 2026 23:41:09 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 667NYcnF032620; Tue, 7 Jul 2026 23:41:08 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4f7cvw5a61-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jul 2026 23:41:08 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 667Nf7rY33751622 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Jul 2026 23:41:07 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6770A5805D; Tue, 7 Jul 2026 23:41:07 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 857A158056; Tue, 7 Jul 2026 23:41:05 +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:05 +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 28/33] hw/s390x/ipl: Set IPIB flags for secure IPL Date: Tue, 7 Jul 2026 19:40:41 -0400 Message-ID: <20260707234047.2499921-9-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=M7J97Sws c=1 sm=1 tr=0 ts=6a4d8e95 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=20KFwNOVAAAA:8 a=MUQpW0jNMHjpGy_Q9scA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzA3MDIyOSBTYWx0ZWRfXzSzn8eFjguyB J87wZ7uwGrHxhmGswkxeJfwwub6BzgC2VC4ZyBKE4Oz+0w+dkyyn+/rnWmZlTLYfKsaRw36mcq9 hkxBDIoUQiseLMsHjJ/JGIMg0BlJ5qlIwZspM4csVvk8jX27JPy6nULfnwqMuAKkM5qyV1MyTqh zL7aDG3Kg81htDe/xFa+qAWQAP+yYW/liCffa01xRexJWmk7sJTFUh7AdbBuzWM+BBP9c7EVvlW pc6kzHRQ0/Vy682trK/WnN1Vi5NhHejFqOpc4bwpxOB6a/jXpuIf5z3qMM4f4zJ/fjA2sIIxRgI /B6/CjGZHxJdC5pqI+dTFJ2L+nrvUaRjfrPCLRanqWjrfymcjhCXkIfMG2YBhnQdU2iWxhzfRxQ yRzSsKFSYrfya6WhNuYgdPk04SCBy8pQg8AP+vrFoa3loob/1bVImfVvpZTy41me51fVGle/XY5 qnEpJwEHjSgt7Yg7n2w== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzA3MDIyOSBTYWx0ZWRfX6L8G3DIKMYXy 4rRhJ+t+Ym1oR5BR3Sw7dJbeEIPAhKSaK7T+XV5U7RMhRL42VyDhwyyKM24dampg6y2S6nS2fIm fqJzACou/osIxhgxqetrY34Uq/0q5xo= X-Proofpoint-GUID: 08_1hpgNOFUUbGySHxoViXVFtwFui951 X-Proofpoint-ORIG-GUID: 08_1hpgNOFUUbGySHxoViXVFtwFui951 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 suspectscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 adultscore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=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.158.5; envelope-from=zycai@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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 If `-M secure-boot=on` is specified on the command line option, indicating true secure IPL enabled, set Secure-IPL bit and IPL-Information-Report bit on in IPIB Flags field, and trigger true secure IPL in the S390 BIOS. Any error that occurs during true secure IPL will cause the IPL to terminate. Signed-off-by: Zhuoying Cai Reviewed-by: Thomas Huth Reviewed-by: Collin Walling --- hw/s390x/ipl.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index d0dbf47d74..08294af4d0 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -468,15 +468,30 @@ static bool s390_has_certificate(void) return ipl->cert_store.count > 0; } +static bool s390_secure_boot_enabled(void) +{ + return S390_CCW_MACHINE(qdev_get_machine())->secure_boot; +} + static void s390_set_secure_boot_flags(IplParameterBlock *iplb, - bool audit_mode) + bool secure_boot, bool audit_mode) { - if (!audit_mode) { + if (!secure_boot && !audit_mode) { return; } /* - * For audit mode, enable the IPL Information + * If secure-boot is enabled, then toggle the secure IPL flags (SIPL) to + * trigger secure boot in the s390 BIOS. + * + * Boot process will terminate if any error occurs during secure boot. + */ + if (secure_boot) { + iplb->hdr_flags |= DIAG308_IPIB_FLAGS_SIPL; + } + + /* + * For both secure boot and audit mode, enable the IPL Information * Report (IPLIR) flag so that the firmware generates an IPL * Information Report Block (IIRB). * @@ -545,7 +560,8 @@ 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_has_certificate()); + s390_set_secure_boot_flags(iplb, s390_secure_boot_enabled(), + s390_has_certificate()); return true; } @@ -699,7 +715,9 @@ void s390_ipl_update_diag308(IplParameterBlock *iplb) * The kernel does not preserve secure boot flags across a reboot. * Re-apply them here based on the current machine configuration. */ - s390_set_secure_boot_flags(&ipl->iplb, s390_has_certificate()); + s390_set_secure_boot_flags(&ipl->iplb, + s390_secure_boot_enabled(), + s390_has_certificate()); } update_machine_ipl_properties(iplb); -- 2.54.0