get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2196091,
    "url": "http://patchwork.ozlabs.org/api/patches/2196091/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260212204352.1044699-23-zycai@linux.ibm.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/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": "<20260212204352.1044699-23-zycai@linux.ibm.com>",
    "list_archive_url": null,
    "date": "2026-02-12T20:43:43",
    "name": "[v8,22/30] pc-bios/s390-ccw: Add additional security checks for secure boot",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "6e95e220ea5430675e88dfc89b41e2702dc58672",
    "submitter": {
        "id": 90643,
        "url": "http://patchwork.ozlabs.org/api/people/90643/?format=api",
        "name": "Zhuoying Cai",
        "email": "zycai@linux.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260212204352.1044699-23-zycai@linux.ibm.com/mbox/",
    "series": [
        {
            "id": 492021,
            "url": "http://patchwork.ozlabs.org/api/series/492021/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=492021",
            "date": "2026-02-12T20:43:36",
            "name": "Secure IPL Support for SCSI Scheme of virtio-blk/virtio-scsi Devices",
            "version": 8,
            "mbox": "http://patchwork.ozlabs.org/series/492021/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2196091/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2196091/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=tH+T9U79;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.gnu.org (lists.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 4fBnSG1FRfz1xpY\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 13 Feb 2026 07:47:58 +1100 (AEDT)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vqdYO-00013A-Nb; Thu, 12 Feb 2026 15:44:48 -0500",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.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 1vqdYN-00011T-0b; Thu, 12 Feb 2026 15:44:47 -0500",
            "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 1vqdYK-00085g-H0; Thu, 12 Feb 2026 15:44:46 -0500",
            "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 61CJt1dQ451836; Thu, 12 Feb 2026 20:44:40 GMT",
            "from ppma12.dal12v.mail.ibm.com\n (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4c696ur4ds-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 12 Feb 2026 20:44:39 +0000 (GMT)",
            "from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1])\n by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id\n 61CJjjSO002548;\n Thu, 12 Feb 2026 20:44:39 GMT",
            "from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7])\n by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4c6fqsvbk2-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 12 Feb 2026 20:44:39 +0000",
            "from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com\n [10.39.53.233])\n by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 61CKiboI32113222\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Thu, 12 Feb 2026 20:44:38 GMT",
            "from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 9DECD5804E;\n Thu, 12 Feb 2026 20:44:37 +0000 (GMT)",
            "from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id DC37D58054;\n Thu, 12 Feb 2026 20:44:35 +0000 (GMT)",
            "from fedora-workstation.ibmuc.com (unknown [9.61.112.15])\n by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP;\n Thu, 12 Feb 2026 20:44:35 +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=cIgVhZ9btDTwnYhfJ\n kIfjg+vv6+OiuOgjFGBYmtDbeo=; b=tH+T9U79LWqjUl26JyuKhiiYLxVIAWMmo\n Mn3z9+u4bBmi/M8UelvBv1wTHVdgY3C2qPpXhBZ8+bueIeKvM/0dU/otsnntsbZ0\n gkKuC/M3ildGzXWkMBvtF5mRhIA9Yj3ZDBUNVCk9ZNZObXE5MsvGRo6bDxB67ibH\n 1knAs0xNSYpgB7s+F+WS/hlYOhXHtJ8kOps59MhA2jNN+cc6ijvVfZ9xPGDslBoh\n DPp4mRKCZJ9B4OgXxMVKhODCJLzXOTQ4ZS98xoL6aA3KuBLe5JyoCBXAivdGgwnU\n y4aiLTiO4Uu8784Odl5zCPazW8v2oG8z/skO0skE1hEmNjIT+BClQ==",
        "From": "Zhuoying Cai <zycai@linux.ibm.com>",
        "To": "thuth@redhat.com, berrange@redhat.com, richard.henderson@linaro.org,\n jrossi@linux.ibm.com, qemu-s390x@nongnu.org, qemu-devel@nongnu.org",
        "Cc": "david@kernel.org, walling@linux.ibm.com, jjherne@linux.ibm.com,\n pasic@linux.ibm.com, borntraeger@linux.ibm.com, farman@linux.ibm.com,\n mjrosato@linux.ibm.com, iii@linux.ibm.com, eblake@redhat.com,\n armbru@redhat.com, zycai@linux.ibm.com, alifm@linux.ibm.com,\n brueckner@linux.ibm.com",
        "Subject": "[PATCH v8 22/30] pc-bios/s390-ccw: Add additional security checks for\n secure boot",
        "Date": "Thu, 12 Feb 2026 15:43:43 -0500",
        "Message-ID": "<20260212204352.1044699-23-zycai@linux.ibm.com>",
        "X-Mailer": "git-send-email 2.52.0",
        "In-Reply-To": "<20260212204352.1044699-1-zycai@linux.ibm.com>",
        "References": "<20260212204352.1044699-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=YZiwJgRf c=1 sm=1 tr=0 ts=698e3bb8 cx=c_pps\n a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17\n a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22\n a=GgsMoib0sEa3-_RKJdDe:22 a=VnNF1IyMAAAA:8 a=IaLYFdo72UbvXhH_9PYA:9",
        "X-Proofpoint-ORIG-GUID": "LM2gbbcrdFCXQK1eD4AdwQSlv9iWPfHQ",
        "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMjEyMDE1NyBTYWx0ZWRfX3lkLfwY2Bf7T\n r4CEXNeCtFFvGCibE+LxHzkq1MIzxADmbjVbCkQHhtFmp0gX6tBH9gmTUC088co1KEzMUTigEDp\n 24eDibAOeVCkWPWnr/W2xnPcGi8cZZKgIZJZirBRrzRQt5peUXFEW50NfcnKJLQ6uL7zd8S+UQt\n Fs8g3Ov7pnRVMgQiexysVRp2YmHZPYIwVr4n+z+sDmR13hGSfjneBbVDFZ3ZSMewx21HZu1e7Py\n bF2r4JlCCQW3w46TSDXqbxXfixBp784kLar9QmnEa2wYjeuk4DcOE7Tm8anymKIok3oN+bUyRA2\n YKFAMYmy+5Q59HbLIcanTrhb5ejPuBYBHtCcBonYBKzHpdV+5NAjzhKVGjJ+3Or2m8BaFiCUcX4\n 0dUmiAmynEZfIVFRmlq3DqFvSno5grLPbjRpdp9dSlPPxNrRXacQGF949hkLLZyYrxXltpFB6SZ\n 5cG9R9Y6pkJWrk4TLXw==",
        "X-Proofpoint-GUID": "LM2gbbcrdFCXQK1eD4AdwQSlv9iWPfHQ",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-02-12_05,2026-02-12_03,2025-10-01_01",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n priorityscore=1501 spamscore=0 impostorscore=0 suspectscore=0 malwarescore=0\n phishscore=0 bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602120157",
        "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": "-19",
        "X-Spam_score": "-2.0",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001,\n RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n 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 <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": "Add additional checks to ensure that components do not overlap with\nsigned components when loaded into memory.\n\nAdd additional checks to ensure the load addresses of unsigned components\nare greater than or equal to 0x2000.\n\nWhen the secure IPL code loading attributes facility (SCLAF) is installed,\nall signed components must contain a secure code loading attributes block\n(SCLAB).\n\nThe SCLAB provides further validation of information on where to load the\nsigned binary code from the load device, and where to start the execution\nof the loaded OS code.\n\nWhen SCLAF is installed, its content must be evaluated during secure IPL.\nHowever, a missing SCLAB will not be reported in audit mode. The SCALB\nchecking will be skipped in this case.\n\nAdd IPL Information Error Indicators (IIEI) and Component Error\nIndicators (CEI) for IPL Information Report Block (IIRB).\n\nWhen SCLAF is installed, additional secure boot checks are performed\nduring zipl and store results of verification into IIRB.\n\nSigned-off-by: Zhuoying Cai <zycai@linux.ibm.com>\n---\n include/hw/s390x/ipl/qipl.h   |  29 +++-\n pc-bios/s390-ccw/s390-ccw.h   |   1 +\n pc-bios/s390-ccw/sclp.c       |   8 +\n pc-bios/s390-ccw/sclp.h       |   1 +\n pc-bios/s390-ccw/secure-ipl.c | 318 +++++++++++++++++++++++++++++++++-\n pc-bios/s390-ccw/secure-ipl.h |  42 +++++\n 6 files changed, 395 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h\nindex 1b6cb3231d..9518fcb1dc 100644\n--- a/include/hw/s390x/ipl/qipl.h\n+++ b/include/hw/s390x/ipl/qipl.h\n@@ -136,10 +136,20 @@ struct IplInfoReportBlockHeader {\n };\n typedef struct IplInfoReportBlockHeader IplInfoReportBlockHeader;\n \n+/* IPL Info Error Indicators */\n+#define S390_IIEI_NO_SIGNED_COMP      0x8000 /* bit 0 */\n+#define S390_IIEI_NO_SCLAB            0x4000 /* bit 1 */\n+#define S390_IIEI_NO_GLOBAL_SCLAB     0x2000 /* bit 2 */\n+#define S390_IIEI_MORE_GLOBAL_SCLAB   0x1000 /* bit 3 */\n+#define S390_IIEI_FOUND_UNSIGNED_COMP 0x800 /* bit 4 */\n+#define S390_IIEI_MORE_SIGNED_COMP    0x400 /* bit 5 */\n+\n struct IplInfoBlockHeader {\n     uint32_t len;\n     uint8_t  type;\n-    uint8_t  reserved1[11];\n+    uint8_t  reserved1[3];\n+    uint16_t iiei;\n+    uint8_t  reserved2[6];\n };\n typedef struct IplInfoBlockHeader IplInfoBlockHeader;\n \n@@ -163,13 +173,28 @@ typedef struct IplSignatureCertificateList IplSignatureCertificateList;\n #define S390_IPL_DEV_COMP_FLAG_SC  0x80\n #define S390_IPL_DEV_COMP_FLAG_CSV 0x40\n \n+/* IPL Device Component Error Indicators */\n+#define S390_CEI_INVALID_SCLAB             0x80000000 /* bit 0 */\n+#define S390_CEI_INVALID_SCLAB_LEN         0x40000000 /* bit 1 */\n+#define S390_CEI_INVALID_SCLAB_FORMAT      0x20000000 /* bit 2 */\n+#define S390_CEI_UNMATCHED_SCLAB_LOAD_ADDR 0x10000000 /* bit 3 */\n+#define S390_CEI_UNMATCHED_SCLAB_LOAD_PSW  0x8000000  /* bit 4 */\n+#define S390_CEI_INVALID_LOAD_PSW          0x4000000  /* bit 5 */\n+#define S390_CEI_NUC_NOT_IN_GLOBAL_SCLA    0x2000000  /* bit 6 */\n+#define S390_CEI_SCLAB_OLA_NOT_ONE         0x1000000  /* bit 7 */\n+#define S390_CEI_SC_NOT_IN_GLOBAL_SCLAB    0x800000   /* bit 8 */\n+#define S390_CEI_SCLAB_LOAD_ADDR_NOT_ZERO  0x400000   /* bit 9 */\n+#define S390_CEI_SCLAB_LOAD_PSW_NOT_ZERO   0x200000   /* bit 10 */\n+#define S390_CEI_INVALID_UNSIGNED_ADDR     0x100000   /* bit 11 */\n+\n struct IplDeviceComponentEntry {\n     uint64_t addr;\n     uint64_t len;\n     uint8_t  flags;\n     uint8_t  reserved1[5];\n     uint16_t cert_index;\n-    uint8_t  reserved2[8];\n+    uint32_t cei;\n+    uint8_t  reserved2[4];\n };\n typedef struct IplDeviceComponentEntry IplDeviceComponentEntry;\n \ndiff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h\nindex 1b43817af9..8dbfb846d2 100644\n--- a/pc-bios/s390-ccw/s390-ccw.h\n+++ b/pc-bios/s390-ccw/s390-ccw.h\n@@ -69,6 +69,7 @@ void sclp_setup(void);\n void sclp_get_loadparm_ascii(char *loadparm);\n bool sclp_is_diag320_on(void);\n bool sclp_is_sipl_on(void);\n+bool sclp_is_sclaf_on(void);\n int sclp_read(char *str, size_t count);\n \n /* virtio.c */\ndiff --git a/pc-bios/s390-ccw/sclp.c b/pc-bios/s390-ccw/sclp.c\nindex f7514b0245..e7aea51d5b 100644\n--- a/pc-bios/s390-ccw/sclp.c\n+++ b/pc-bios/s390-ccw/sclp.c\n@@ -156,6 +156,14 @@ bool sclp_is_sipl_on(void)\n     return fac_ipl & SCCB_FAC_IPL_SIPL_BIT;\n }\n \n+bool sclp_is_sclaf_on(void)\n+{\n+    uint16_t fac_ipl = 0;\n+\n+    sclp_get_fac_ipl(&fac_ipl);\n+    return fac_ipl & SCCB_FAC_IPL_SCLAF_BIT;\n+}\n+\n int sclp_read(char *str, size_t count)\n {\n     ReadEventData *sccb = (void *)_sccb;\ndiff --git a/pc-bios/s390-ccw/sclp.h b/pc-bios/s390-ccw/sclp.h\nindex cf147f4634..3441020d6b 100644\n--- a/pc-bios/s390-ccw/sclp.h\n+++ b/pc-bios/s390-ccw/sclp.h\n@@ -52,6 +52,7 @@ typedef struct SCCBHeader {\n #define SCCB_DATA_LEN (SCCB_SIZE - sizeof(SCCBHeader))\n #define SCCB_FAC134_DIAG320_BIT 0x4\n #define SCCB_FAC_IPL_SIPL_BIT 0x4000\n+#define SCCB_FAC_IPL_SCLAF_BIT 0x1000\n \n typedef struct ReadInfo {\n     SCCBHeader h;\ndiff --git a/pc-bios/s390-ccw/secure-ipl.c b/pc-bios/s390-ccw/secure-ipl.c\nindex 27d2833642..54e41ec11c 100644\n--- a/pc-bios/s390-ccw/secure-ipl.c\n+++ b/pc-bios/s390-ccw/secure-ipl.c\n@@ -197,6 +197,12 @@ static bool secure_ipl_supported(void)\n         return false;\n     }\n \n+    if (!sclp_is_sclaf_on()) {\n+        puts(\"Secure IPL Code Loading Attributes Facility is not supported by\"\n+             \" the hypervisor!\");\n+        return false;\n+    }\n+\n     return true;\n }\n \n@@ -259,6 +265,290 @@ static void addr_overlap_check(SecureIplCompAddrRange *comp_addr_range,\n     *addr_range_index += 1;\n }\n \n+static void check_unsigned_addr(uint64_t load_addr, IplDeviceComponentEntry *comp_entry)\n+{\n+    /* unsigned load address must be greater than or equal to 0x2000 */\n+    if (load_addr >= 0x2000) {\n+        return;\n+    }\n+\n+    set_comp_cei_with_log(comp_entry, S390_CEI_INVALID_UNSIGNED_ADDR,\n+                          \"Load address is less than 0x2000\");\n+}\n+\n+static bool check_sclab_presence(uint8_t *sclab_magic,\n+                                 IplDeviceComponentEntry *comp_entry)\n+{\n+    /* identifies the presence of SCLAB */\n+    if (magic_match(sclab_magic, ZIPL_MAGIC)) {\n+        return true;\n+    }\n+\n+    if (comp_entry) {\n+        comp_entry->cei |= S390_CEI_INVALID_SCLAB;\n+    }\n+\n+    /* a missing SCLAB will not be reported in audit mode */\n+    return false;\n+}\n+\n+static void check_sclab_length(uint16_t sclab_len, IplDeviceComponentEntry *comp_entry)\n+{\n+    if (sclab_len >= S390_SECURE_IPL_SCLAB_MIN_LEN) {\n+        return;\n+    }\n+\n+    set_comp_cei_with_log(comp_entry,\n+                          S390_CEI_INVALID_SCLAB_LEN | S390_CEI_INVALID_SCLAB,\n+                          \"Invalid SCLAB length\");\n+}\n+\n+static void check_sclab_format(uint8_t sclab_format, IplDeviceComponentEntry *comp_entry)\n+{\n+    /* SCLAB format must set to zero, indicating a format-0 SCLAB being used */\n+    if (sclab_format == 0) {\n+        return;\n+    }\n+\n+    set_comp_cei_with_log(comp_entry, S390_CEI_INVALID_SCLAB_FORMAT,\n+                          \"Format-0 SCLAB is not being used\");\n+}\n+\n+static void check_sclab_opsw(SecureCodeLoadingAttributesBlock *sclab,\n+                             SecureIplSclabInfo *sclab_info,\n+                             IplDeviceComponentEntry *comp_entry)\n+{\n+    const char *msg;\n+    uint32_t cei_flag = 0;\n+\n+    if (!(sclab->flags & S390_SECURE_IPL_SCLAB_FLAG_OPSW)) {\n+        /* OPSW = 0 - Load PSW field in SCLAB must contain zeros */\n+        if (sclab->load_psw != 0) {\n+            cei_flag |= S390_CEI_SCLAB_LOAD_PSW_NOT_ZERO;\n+            msg = \"Load PSW is not zero when Override PSW bit is zero\";\n+        }\n+    } else {\n+        /* OPSW = 1 indicating global SCLAB */\n+        sclab_info->global_count += 1;\n+        if (sclab_info->global_count == 1) {\n+            sclab_info->load_psw = sclab->load_psw;\n+            sclab_info->flags = sclab->flags;\n+        }\n+\n+        /* OLA must set to one */\n+        if (!(sclab->flags & S390_SECURE_IPL_SCLAB_FLAG_OLA)) {\n+            cei_flag |= S390_CEI_SCLAB_OLA_NOT_ONE;\n+            msg = \"Override Load Address bit is not set to one in the global SCLAB\";\n+        }\n+    }\n+\n+    if (!cei_flag) {\n+        return;\n+    }\n+\n+    set_comp_cei_with_log(comp_entry, cei_flag, msg);\n+}\n+\n+static void check_sclab_ola(SecureCodeLoadingAttributesBlock *sclab, uint64_t load_addr,\n+                            IplDeviceComponentEntry *comp_entry)\n+{\n+    const char *msg;\n+    uint32_t cei_flag = 0;\n+\n+    if (!(sclab->flags & S390_SECURE_IPL_SCLAB_FLAG_OLA)) {\n+        /* OLA = 0 - Load address field in SCLAB must contain zeros */\n+        if (sclab->load_addr != 0) {\n+            cei_flag |= S390_CEI_SCLAB_LOAD_ADDR_NOT_ZERO;\n+            msg = \"Load Address is not zero when Override Load Address bit is zero\";\n+        }\n+    } else {\n+        /* OLA = 1 - Load address field must match storage address of the component */\n+        if (sclab->load_addr != load_addr) {\n+            cei_flag |= S390_CEI_UNMATCHED_SCLAB_LOAD_ADDR;\n+            msg = \"Load Address does not match with component load address\";\n+        }\n+    }\n+\n+    if (!cei_flag) {\n+        return;\n+    }\n+\n+    set_comp_cei_with_log(comp_entry, cei_flag, msg);\n+}\n+\n+static void check_sclab_nuc(uint16_t sclab_flags, IplDeviceComponentEntry *comp_entry)\n+{\n+    const char *msg;\n+    bool is_nuc_set;\n+    bool is_global_sclab;\n+\n+    is_nuc_set = sclab_flags & S390_SECURE_IPL_SCLAB_FLAG_NUC;\n+    is_global_sclab = sclab_flags & S390_SECURE_IPL_SCLAB_FLAG_OPSW;\n+    if (is_nuc_set && !is_global_sclab) {\n+        msg = \"No Unsigned Components bit is set, but not in the global SCLAB\";\n+        set_comp_cei_with_log(comp_entry, S390_CEI_NUC_NOT_IN_GLOBAL_SCLA, msg);\n+    }\n+}\n+\n+static void check_sclab_sc(uint16_t sclab_flags, IplDeviceComponentEntry *comp_entry)\n+{\n+    const char *msg;\n+    bool is_sc_set;\n+    bool is_global_sclab;\n+\n+    is_sc_set = sclab_flags & S390_SECURE_IPL_SCLAB_FLAG_SC;\n+    is_global_sclab = sclab_flags & S390_SECURE_IPL_SCLAB_FLAG_OPSW;\n+    if (is_sc_set && !is_global_sclab) {\n+        msg = \"Single Component bit is set, but not in the global SCLAB\";\n+        set_comp_cei_with_log(comp_entry, S390_CEI_SC_NOT_IN_GLOBAL_SCLAB, msg);\n+    }\n+}\n+\n+static bool is_psw_valid(uint64_t psw, SecureIplCompAddrRange *comp_addr_range,\n+                         int range_index)\n+{\n+    uint32_t addr = psw & 0x7fffffff;\n+\n+    /* PSW points within a signed binary code component */\n+    for (int i = 0; i < range_index; i++) {\n+        if (comp_addr_range[i].is_signed &&\n+            addr >= comp_addr_range[i].start_addr &&\n+            addr <= comp_addr_range[i].end_addr - 2) {\n+            return true;\n+       }\n+    }\n+\n+    return false;\n+}\n+\n+static void check_load_psw(SecureIplCompAddrRange *comp_addr_range,\n+                           int addr_range_index, uint64_t sclab_load_psw,\n+                           uint64_t load_psw, IplDeviceComponentEntry *comp_entry)\n+{\n+    bool valid;\n+\n+    valid = is_psw_valid(sclab_load_psw, comp_addr_range, addr_range_index) &&\n+            is_psw_valid(load_psw, comp_addr_range, addr_range_index);\n+    if (!valid) {\n+        set_comp_cei_with_log(comp_entry, S390_CEI_INVALID_LOAD_PSW, \"Invalid PSW\");\n+    }\n+\n+    /* compare load PSW with the PSW specified in component */\n+    if (sclab_load_psw != load_psw) {\n+        set_comp_cei_with_log(comp_entry, S390_CEI_UNMATCHED_SCLAB_LOAD_PSW,\n+                              \"Load PSW does not match with PSW in component\");\n+    }\n+}\n+\n+static void check_nuc(uint16_t global_sclab_flags, int unsigned_count,\n+                      IplDeviceComponentList *comp_list)\n+{\n+    bool is_nuc_set;\n+\n+    is_nuc_set = global_sclab_flags & S390_SECURE_IPL_SCLAB_FLAG_NUC;\n+    if (is_nuc_set && unsigned_count > 0) {\n+        comp_list->ipl_info_header.iiei |= S390_IIEI_FOUND_UNSIGNED_COMP;\n+        zipl_secure_handle(\"Unsigned components are not allowed\");\n+    }\n+}\n+\n+static void check_sc(uint16_t global_sclab_flags,\n+                     int signed_count, int unsigned_count,\n+                     IplDeviceComponentList *comp_list)\n+{\n+    bool is_sc_set;\n+\n+    is_sc_set = global_sclab_flags & S390_SECURE_IPL_SCLAB_FLAG_SC;\n+    if (is_sc_set && signed_count != 1 && unsigned_count >= 0) {\n+        comp_list->ipl_info_header.iiei |= S390_IIEI_MORE_SIGNED_COMP;\n+        zipl_secure_handle(\"Only one signed component is allowed\");\n+    }\n+}\n+\n+void check_global_sclab(SecureIplSclabInfo sclab_info,\n+                        int unsigned_count, int signed_count,\n+                        IplDeviceComponentList *comp_list)\n+{\n+    if (sclab_info.count == 0) {\n+        return;\n+    }\n+\n+    if (sclab_info.global_count == 0) {\n+        comp_list->ipl_info_header.iiei |= S390_IIEI_NO_GLOBAL_SCLAB;\n+        zipl_secure_handle(\"Global SCLAB does not exists\");\n+        return;\n+    }\n+\n+    if (sclab_info.global_count > 1) {\n+        comp_list->ipl_info_header.iiei |= S390_IIEI_MORE_GLOBAL_SCLAB;\n+        zipl_secure_handle(\"More than one global SCLAB\");\n+        return;\n+    }\n+\n+    if (sclab_info.flags) {\n+        /* Unsigned components are not allowed if NUC flag is set in the global SCLAB */\n+        check_nuc(sclab_info.flags, unsigned_count, comp_list);\n+\n+        /* Only one signed component is allowed is SC flag is set in the global SCLAB */\n+        check_sc(sclab_info.flags, signed_count, unsigned_count, comp_list);\n+    }\n+}\n+\n+static void check_signed_comp(int signed_count, IplDeviceComponentList *comp_list)\n+{\n+    if (signed_count > 0) {\n+        return;\n+    }\n+\n+    comp_list->ipl_info_header.iiei |= S390_IIEI_NO_SIGNED_COMP;\n+    zipl_secure_handle(\"Secure boot is on, but components are not signed\");\n+}\n+\n+static void check_sclab_count(int count, IplDeviceComponentList *comp_list)\n+{\n+    if (count > 0) {\n+        return;\n+    }\n+\n+    comp_list->ipl_info_header.iiei |= S390_IIEI_NO_SCLAB;\n+    zipl_secure_handle(\"No recognizable SCLAB\");\n+}\n+\n+static void check_sclab(uint64_t comp_addr, uint64_t comp_len,\n+                        IplDeviceComponentEntry *comp_entry,\n+                        SecureIplSclabInfo *sclab_info)\n+{\n+    SclabOriginLocator *sclab_locator;\n+    SecureCodeLoadingAttributesBlock *sclab;\n+    bool exist;\n+\n+    /* sclab locator is located at the last 8 bytes of the signed comp */\n+    sclab_locator = (SclabOriginLocator *)(comp_addr + comp_len - 8);\n+\n+    /* return early if sclab does not exist */\n+    exist = check_sclab_presence(sclab_locator->magic, comp_entry);\n+    if (!exist) {\n+        return;\n+    }\n+\n+    check_sclab_length(sclab_locator->len, comp_entry);\n+\n+    /* return early if sclab is invalid */\n+    if (comp_entry && (comp_entry->cei & S390_CEI_INVALID_SCLAB)) {\n+        return;\n+    }\n+\n+    sclab_info->count += 1;\n+    sclab = (SecureCodeLoadingAttributesBlock *)(comp_addr + comp_len -\n+                                                 sclab_locator->len);\n+\n+    check_sclab_format(sclab->format, comp_entry);\n+    check_sclab_opsw(sclab, sclab_info, comp_entry);\n+    check_sclab_ola(sclab, comp_addr, comp_entry);\n+    check_sclab_nuc(sclab->flags, comp_entry);\n+    check_sclab_sc(sclab->flags, comp_entry);\n+}\n+\n static int zipl_load_signature(ComponentEntry *entry, uint64_t sig_sec)\n {\n     if (zipl_load_segment(entry, sig_sec) < 0) {\n@@ -305,6 +595,9 @@ int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec)\n     SecureIplCompAddrRange comp_addr_range[MAX_CERTIFICATES];\n     int addr_range_index = 0;\n     int signed_count = 0;\n+    int unsigned_count = 0;\n+    SecureIplSclabInfo sclab_info = { 0 };\n+    IplDeviceComponentEntry *comp_entry;\n \n     if (!secure_ipl_supported()) {\n         return -1;\n@@ -336,10 +629,21 @@ int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec)\n             addr_overlap_check(comp_addr_range, &addr_range_index,\n                                comp_addr, comp_addr + comp_len, sig_len > 0);\n \n+            comp_entry = (comp_entry_idx < MAX_CERTIFICATES) ?\n+                         &comp_list.device_entries[comp_entry_idx] : NULL;\n+\n             if (!sig_len) {\n+                check_unsigned_addr(comp_addr, comp_entry);\n+                comp_list_add(&comp_list, comp_entry_idx, cert_entry_idx,\n+                              comp_addr, comp_len, 0x00);\n+\n+                unsigned_count += 1;\n+                comp_entry_idx++;\n                 break;\n             }\n \n+            check_sclab(comp_addr, comp_len,\n+                        &comp_list.device_entries[comp_entry_idx], &sclab_info);\n             verified = verify_signature(comp_len, comp_addr, sig_len, (uint64_t)sig,\n                                         &cert_len, &cert_table_idx);\n \n@@ -392,10 +696,20 @@ int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec)\n         }\n     }\n \n-    if (signed_count == 0) {\n-        zipl_secure_handle(\"Secure boot is on, but components are not signed\");\n+    /* validate load PSW with PSW specified in the final entry */\n+    if (sclab_info.load_psw) {\n+        comp_entry = (comp_entry_idx < MAX_CERTIFICATES) ?\n+                     &comp_list.device_entries[comp_entry_idx] : NULL;\n+        check_load_psw(comp_addr_range, addr_range_index,\n+                       sclab_info.load_psw, entry->compdat.load_psw, comp_entry);\n+        comp_list_add(&comp_list, comp_entry_idx, -1,\n+                      entry->compdat.load_psw, 0, 0x00);\n     }\n \n+    check_signed_comp(signed_count, &comp_list);\n+    check_sclab_count(sclab_info.count, &comp_list);\n+    check_global_sclab(sclab_info, unsigned_count, signed_count, &comp_list);\n+\n     update_iirb(&comp_list, &cert_list);\n \n     *entry_ptr = entry;\ndiff --git a/pc-bios/s390-ccw/secure-ipl.h b/pc-bios/s390-ccw/secure-ipl.h\nindex 69edfce241..4e9f4f08b9 100644\n--- a/pc-bios/s390-ccw/secure-ipl.h\n+++ b/pc-bios/s390-ccw/secure-ipl.h\n@@ -16,6 +16,38 @@\n VCStorageSizeBlock *zipl_secure_get_vcssb(void);\n int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec);\n \n+#define S390_SECURE_IPL_SCLAB_FLAG_OPSW    0x8000\n+#define S390_SECURE_IPL_SCLAB_FLAG_OLA     0x4000\n+#define S390_SECURE_IPL_SCLAB_FLAG_NUC     0x2000\n+#define S390_SECURE_IPL_SCLAB_FLAG_SC      0x1000\n+\n+#define S390_SECURE_IPL_SCLAB_MIN_LEN      32\n+\n+struct SecureCodeLoadingAttributesBlock {\n+    uint8_t  format;\n+    uint8_t  reserved1;\n+    uint16_t flags;\n+    uint8_t  reserved2[4];\n+    uint64_t load_psw;\n+    uint64_t load_addr;\n+    uint64_t reserved3[];\n+} __attribute__ ((packed));\n+typedef struct SecureCodeLoadingAttributesBlock SecureCodeLoadingAttributesBlock;\n+\n+struct SclabOriginLocator {\n+    uint8_t reserved[2];\n+    uint16_t len;\n+    uint8_t magic[4];\n+} __attribute__ ((packed));\n+typedef struct SclabOriginLocator SclabOriginLocator;\n+\n+typedef struct SecureIplSclabInfo {\n+    int count;\n+    int global_count;\n+    uint64_t load_psw;\n+    uint16_t flags;\n+} SecureIplSclabInfo;\n+\n typedef struct SecureIplCompAddrRange {\n     bool is_signed;\n     uint64_t start_addr;\n@@ -33,6 +65,16 @@ static inline void zipl_secure_handle(const char *message)\n     }\n }\n \n+static inline void set_comp_cei_with_log(IplDeviceComponentEntry *comp_entry,\n+                                         uint32_t flag, const char *message)\n+{\n+    if (comp_entry) {\n+        comp_entry->cei |= flag;\n+    }\n+\n+    zipl_secure_handle(message);\n+}\n+\n static inline uint64_t diag320(void *data, unsigned long subcode)\n {\n     register unsigned long addr asm(\"0\") = (unsigned long)data;\n",
    "prefixes": [
        "v8",
        "22/30"
    ]
}