get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2219396,
    "url": "http://patchwork.ozlabs.org/api/1.0/patches/2219396/?format=api",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.0/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": ""
    },
    "msgid": "<20260402221453.1602899-23-zycai@linux.ibm.com>",
    "date": "2026-04-02T22:14:44",
    "name": "[v10,22/30] pc-bios/s390-ccw: Add additional security checks for secure boot",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "12768c380accf4e66686b4d5ab81cf929ab621c2",
    "submitter": {
        "id": 90643,
        "url": "http://patchwork.ozlabs.org/api/1.0/people/90643/?format=api",
        "name": "Zhuoying Cai",
        "email": "zycai@linux.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260402221453.1602899-23-zycai@linux.ibm.com/mbox/",
    "series": [
        {
            "id": 498557,
            "url": "http://patchwork.ozlabs.org/api/1.0/series/498557/?format=api",
            "date": "2026-04-02T22:14:35",
            "name": "Secure IPL Support for SCSI Scheme of virtio-blk/virtio-scsi Devices",
            "version": 10,
            "mbox": "http://patchwork.ozlabs.org/series/498557/mbox/"
        }
    ],
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2219396/checks/",
    "tags": {},
    "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=FsZ5JBGO;\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 4fmx7b2Wgdz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 09:18:03 +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 1w8QL0-0002Fn-Jh; Thu, 02 Apr 2026 18:16:30 -0400",
            "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 1w8QKf-000115-G6; Thu, 02 Apr 2026 18:16:09 -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 1w8QKc-0004qk-PK; Thu, 02 Apr 2026 18:16:09 -0400",
            "from pps.filterd (m0353725.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 632BiTeo4172385; Thu, 2 Apr 2026 22:15:43 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 4d65dcnvfw-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 02 Apr 2026 22:15:42 +0000 (GMT)",
            "from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1])\n by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id\n 632KHlZI013936;\n Thu, 2 Apr 2026 22:15:42 GMT",
            "from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72])\n by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4d6ttkuuu7-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 02 Apr 2026 22:15:42 +0000",
            "from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com\n [10.241.53.104])\n by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 632MFedT27001392\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Thu, 2 Apr 2026 22:15:41 GMT",
            "from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 99B5C5805D;\n Thu,  2 Apr 2026 22:15:40 +0000 (GMT)",
            "from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 232F358068;\n Thu,  2 Apr 2026 22:15:39 +0000 (GMT)",
            "from fedora-workstation.ibmuc.com (unknown [9.61.183.185])\n by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP;\n Thu,  2 Apr 2026 22:15:39 +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=/h3e2EEmgdBV+1Ms3\n 70RkH5JlFVr4wpF6ShRXqrv5LI=; b=FsZ5JBGOCOW6UEf7rhibP/1c6Uz/12msX\n vto2B8RvTmm74kRMZSWbq1mJC0g2zPJXIlOUJTZ5NUskrFychbRnCli13+QntJcd\n w1Q6K0glHlhefLOLWII117EV9MOc6YoGdPccnQKDvB6so+tHs/1ESuomSwN9LHqm\n KNLQSAgIlYeFxczEyv+77LSiTeLpqb3VYWk3TCgdMvHKWNfqme4anMIlyMMsFvbo\n N5Rm/UZtVboD9LZgj8yXz0zVXLt0um91lw0+dx6Q5Cgodi7QnFGp0HZeEnjIiMK9\n G3NTUMPvU9YCTCm0Rd+VxylatZyFRfYUvn6XYpJ6yrWg3wEgcPvtw==",
        "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, pierrick.bouvier@linaro.org,\n 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, jdaley@linux.ibm.com",
        "Subject": "[PATCH v10 22/30] pc-bios/s390-ccw: Add additional security checks\n for secure boot",
        "Date": "Thu,  2 Apr 2026 18:14:44 -0400",
        "Message-ID": "<20260402221453.1602899-23-zycai@linux.ibm.com>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260402221453.1602899-1-zycai@linux.ibm.com>",
        "References": "<20260402221453.1602899-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=RsjI7SmK c=1 sm=1 tr=0 ts=69ceea8e cx=c_pps\n a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17\n a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=v9_7xbZuii4DBXc9P7YA:9",
        "X-Proofpoint-GUID": "0-YAqcpDkWoCa5ArTNxyHoYJFiMyOhle",
        "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDAyMDE5NSBTYWx0ZWRfX+p7JWJcXTECN\n ns+8ljjrMz+HIDVY32i6lp+5rwBlJu6oFQhhyrwt33ic6elUPfXyXZ8H2IlbCNdODgQZ0+2W2wU\n 8AsuLdtxn5uxwjxWfUaIMMDF2U+AH6v+nXOGuU+jVNi+1z5lc5/yIOPlT3YibKph0AxRHXGCBPa\n G7KDcR+8zx54wROvP/XwqpJsso/IrLYWt7QxSiyHsmgg/tsZOWTc+Aj8VFE766WatueibnCK4NV\n VfCdy9ZkdH1leEKT60m2VLRFPXASbgbdJMqPqsDXOcGaFUSUWhKGAgoJ6cCWsvJguFB4zzCUHwL\n xzK4Uq9KlOBaED0G8ZyZVHw5Rzw+VpnLgzp9VY+uQ6MKkHKWo6nhWxCJOApNWHKPVu4hkQyqK1y\n yYdFkNFfVcr6m7gL1lmrM/Q1D/nXsO9jaSJmDhTJkh5f4G+v6NXNFbxJLDwL1fxDTbREw0UFpN6\n EewGM6aXiv9MPhNoApQ==",
        "X-Proofpoint-ORIG-GUID": "0-YAqcpDkWoCa5ArTNxyHoYJFiMyOhle",
        "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-04-02_04,2026-04-02_05,2025-10-01_01",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n impostorscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0\n suspectscore=0 malwarescore=0 spamscore=0 clxscore=1015 phishscore=0\n adultscore=0 classifier=typeunknown authscore=0 authtc= authcc=\n route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001\n definitions=main-2604020195",
        "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,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,\n RCVD_IN_VALIDITY_RPBL_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 | 283 +++++++++++++++++++++++++++++++++-\n pc-bios/s390-ccw/secure-ipl.h |  49 ++++++\n 6 files changed, 365 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h\nindex dcb84f729a..ea9bd8bf8b 100644\n--- a/include/hw/s390x/ipl/qipl.h\n+++ b/include/hw/s390x/ipl/qipl.h\n@@ -156,10 +156,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@@ -183,13 +193,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 1b09aed8b1..e1a8097c95 100644\n--- a/pc-bios/s390-ccw/s390-ccw.h\n+++ b/pc-bios/s390-ccw/s390-ccw.h\n@@ -82,6 +82,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 /* bootmap.c */\ndiff --git a/pc-bios/s390-ccw/sclp.c b/pc-bios/s390-ccw/sclp.c\nindex 6283ae71bc..be6055bb40 100644\n--- a/pc-bios/s390-ccw/sclp.c\n+++ b/pc-bios/s390-ccw/sclp.c\n@@ -150,6 +150,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 d2079e19bc..d4e455ed0c 100644\n--- a/pc-bios/s390-ccw/secure-ipl.c\n+++ b/pc-bios/s390-ccw/secure-ipl.c\n@@ -134,6 +134,7 @@ static void comp_list_add(IplDeviceComponentList *comp_list, int comp_entry_idx,\n \n     comp_list->device_entries[comp_entry_idx].addr = comp_entry_info.addr;\n     comp_list->device_entries[comp_entry_idx].len = comp_entry_info.len;\n+    comp_list->device_entries[comp_entry_idx].cei = comp_entry_info.cei;\n     comp_list->device_entries[comp_entry_idx].flags = comp_entry_info.flags;\n     /* cert index field is meaningful only when S390_IPL_DEV_COMP_FLAG_SC is set */\n     comp_list->device_entries[comp_entry_idx].cert_index = comp_entry_info.cert_index;\n@@ -198,6 +199,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@@ -254,6 +261,259 @@ static void comp_addr_range_add(SecureIplCompAddrRangeList *range_list,\n     range_list->comp_addr_range[range_list->index].end_addr = end_addr;\n }\n \n+static void check_unsigned_addr(SecureIplCompEntryInfo *comp_entry_info)\n+{\n+    /* unsigned load address must be greater than or equal to 0x2000 */\n+    comp_entry_info->cei |= validate_comp_condition(\n+                    comp_entry_info->addr >= S390_SECURE_IPL_UNSIGNED_MIN_ADDR,\n+                    S390_CEI_INVALID_UNSIGNED_ADDR,\n+                    \"Load address is less than 0x2000\");\n+}\n+\n+static bool check_sclab_presence(uint8_t *sclab_magic, uint32_t *cei_flags)\n+{\n+    /* identifies the presence of SCLAB */\n+    if (magic_match(sclab_magic, ZIPL_MAGIC)) {\n+        return true;\n+    }\n+\n+    *cei_flags |= S390_CEI_INVALID_SCLAB;\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, uint32_t *cei_flags)\n+{\n+    *cei_flags |= validate_comp_condition(sclab_len >= S390_SECURE_IPL_SCLAB_MIN_LEN,\n+                                          S390_CEI_INVALID_SCLAB_LEN |\n+                                          S390_CEI_INVALID_SCLAB,\n+                                          \"Invalid SCLAB length\");\n+}\n+\n+static void check_sclab_format(uint8_t sclab_format, uint32_t *cei_flags)\n+{\n+    /* SCLAB format must set to zero, indicating a format-0 SCLAB being used */\n+    *cei_flags |= validate_comp_condition(sclab_format == 0,\n+                                          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, uint32_t *cei_flags)\n+{\n+    const char *msg;\n+\n+    if (!(sclab->flags & S390_SECURE_IPL_SCLAB_FLAG_OPSW)) {\n+        /* OPSW = 0 - Load PSW field in SCLAB must contain zeros */\n+        msg = \"Load PSW is not zero when Override PSW bit is zero\";\n+        *cei_flags |= validate_comp_condition(sclab->load_psw == 0,\n+                                              S390_CEI_SCLAB_LOAD_PSW_NOT_ZERO,\n+                                              msg);\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->global_load_psw = sclab->load_psw;\n+            sclab_info->global_flags = sclab->flags;\n+        }\n+\n+        /* OLA must set to one */\n+        msg = \"Override Load Address bit is not set to one in the global SCLAB\";\n+        *cei_flags |= validate_comp_condition(\n+                            sclab->flags & S390_SECURE_IPL_SCLAB_FLAG_OLA,\n+                            S390_CEI_SCLAB_OLA_NOT_ONE, msg);\n+    }\n+}\n+\n+static void check_sclab_ola(SecureCodeLoadingAttributesBlock *sclab,\n+                            uint64_t load_addr, uint32_t *cei_flags)\n+{\n+    const char *msg;\n+\n+    if (!(sclab->flags & S390_SECURE_IPL_SCLAB_FLAG_OLA)) {\n+        /* OLA = 0 - Load address field in SCLAB must contain zeros */\n+        msg = \"Load Address is not zero when Override Load Address bit is zero\";\n+        *cei_flags |= validate_comp_condition(sclab->load_addr == 0,\n+                                              S390_CEI_SCLAB_LOAD_ADDR_NOT_ZERO,\n+                                              msg);\n+    } else {\n+        /* OLA = 1 - Load address field must match storage address of the component */\n+        msg = \"Load Address does not match with component load address\";\n+        *cei_flags |= validate_comp_condition(sclab->load_addr == load_addr,\n+                                              S390_CEI_UNMATCHED_SCLAB_LOAD_ADDR,\n+                                              msg);\n+    }\n+}\n+\n+static void check_sclab_nuc(uint16_t sclab_flags, uint32_t *cei_flags)\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+    msg = \"No Unsigned Components bit is set, but not in the global SCLAB\";\n+    *cei_flags |= validate_comp_condition(!is_nuc_set || is_global_sclab,\n+                                          S390_CEI_NUC_NOT_IN_GLOBAL_SCLA, msg);\n+}\n+\n+static void check_sclab_sc(uint16_t sclab_flags, uint32_t *cei_flags)\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+    msg = \"Single Component bit is set, but not in the global SCLAB\";\n+    *cei_flags |= validate_comp_condition(!is_sc_set || is_global_sclab,\n+                                          S390_CEI_SC_NOT_IN_GLOBAL_SCLAB, msg);\n+}\n+\n+static bool is_psw_valid(uint64_t psw, SecureIplCompAddrRangeList *range_list)\n+{\n+    uint32_t addr = psw & 0x7fffffff;\n+\n+    /* PSW points within a signed binary code component */\n+    for (int i = 0; i < range_list->index; i++) {\n+        if (range_list->comp_addr_range[i].is_signed &&\n+            addr >= range_list->comp_addr_range[i].start_addr &&\n+            addr <= range_list->comp_addr_range[i].end_addr - 2) {\n+            return true;\n+       }\n+    }\n+    return false;\n+}\n+\n+static void check_load_psw(SecureIplCompAddrRangeList *range_list,\n+                           uint64_t sclab_load_psw,\n+                           SecureIplCompEntryInfo *comp_entry_info)\n+{\n+    bool valid;\n+    uint64_t load_psw;\n+\n+    load_psw = comp_entry_info->addr;\n+    valid = is_psw_valid(sclab_load_psw, range_list) &&\n+            is_psw_valid(load_psw, range_list);\n+    comp_entry_info->cei |= validate_comp_condition(valid,\n+                                                    S390_CEI_INVALID_LOAD_PSW,\n+                                                    \"Invalid PSW\");\n+\n+    /* compare load PSW with the PSW specified in component */\n+    comp_entry_info->cei |= validate_comp_condition(sclab_load_psw == load_psw,\n+                                          S390_CEI_UNMATCHED_SCLAB_LOAD_PSW,\n+                                         \"Load PSW does not match with PSW in component\");\n+}\n+\n+static void check_no_unsigned_comp(SecureIplSclabInfo sclab_info,\n+                                   IplDeviceComponentList *comp_list)\n+{\n+    bool is_nuc_set;\n+\n+    is_nuc_set = sclab_info.global_flags & S390_SECURE_IPL_SCLAB_FLAG_NUC;\n+    if (is_nuc_set && sclab_info.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_single_comp(SecureIplSclabInfo sclab_info,\n+                              IplDeviceComponentList *comp_list)\n+{\n+    bool is_sc_set;\n+\n+    is_sc_set = sclab_info.global_flags & S390_SECURE_IPL_SCLAB_FLAG_SC;\n+    if (is_sc_set &&\n+        sclab_info.signed_count != 1 &&\n+        sclab_info.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+                        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.global_flags) {\n+        /* Unsigned components are not allowed if NUC flag is set in the global SCLAB */\n+        check_no_unsigned_comp(sclab_info, comp_list);\n+\n+        /* Only one signed component is allowed is SC flag is set in the global SCLAB */\n+        check_single_comp(sclab_info, comp_list);\n+    }\n+}\n+\n+static void check_has_signed_comp(int signed_count, IplDeviceComponentList *comp_list)\n+{\n+    const char *msg;\n+\n+    msg = \"Secure boot is on, but components are not signed\";\n+    comp_list->ipl_info_header.iiei |=\n+                validate_comp_condition(signed_count > 0,\n+                                        S390_IIEI_NO_SIGNED_COMP, msg);\n+\n+}\n+\n+static void check_sclab_count(int count, IplDeviceComponentList *comp_list)\n+{\n+    comp_list->ipl_info_header.iiei |=\n+                validate_comp_condition(count > 0, S390_IIEI_NO_SCLAB,\n+                                        \"No recognizable SCLAB\");\n+}\n+\n+static void check_sclab(SecureIplCompEntryInfo *comp_entry_info,\n+                        SecureIplSclabInfo *sclab_info)\n+{\n+    SclabOriginLocator *sclab_locator;\n+    SecureCodeLoadingAttributesBlock *sclab;\n+\n+    /* sclab locator is located at the last 8 bytes of the signed comp */\n+    sclab_locator = (SclabOriginLocator *)(comp_entry_info->addr +\n+                                           comp_entry_info->len - 8);\n+\n+    /* return early if sclab does not exist */\n+    if (!check_sclab_presence(sclab_locator->magic, &comp_entry_info->cei)) {\n+        return;\n+    }\n+\n+    check_sclab_length(sclab_locator->len, &comp_entry_info->cei);\n+\n+    /* return early if sclab is invalid */\n+    if (comp_entry_info->cei & S390_CEI_INVALID_SCLAB) {\n+        return;\n+    }\n+\n+    sclab_info->count += 1;\n+    sclab = (SecureCodeLoadingAttributesBlock *)(comp_entry_info->addr +\n+                                                 comp_entry_info->len -\n+                                                 sclab_locator->len);\n+\n+    check_sclab_format(sclab->format, &comp_entry_info->cei);\n+    check_sclab_opsw(sclab, sclab_info, &comp_entry_info->cei);\n+    check_sclab_ola(sclab, comp_entry_info->addr, &comp_entry_info->cei);\n+    check_sclab_nuc(sclab->flags, &comp_entry_info->cei);\n+    check_sclab_sc(sclab->flags, &comp_entry_info->cei);\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@@ -297,7 +557,7 @@ int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec)\n      */\n     int cert_list_table[MAX_CERTIFICATES] = { [0 ... MAX_CERTIFICATES - 1] = -1 };\n     SecureIplCompAddrRangeList range_list = { 0 };\n-    int signed_count = 0;\n+    SecureIplSclabInfo sclab_info = { 0 };\n \n     if (!secure_ipl_supported()) {\n         panic(\"Unable to boot in secure/audit mode\");\n@@ -337,9 +597,15 @@ int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec)\n             range_list.index += 1;\n \n             if (!sig_len) {\n+                check_unsigned_addr(&comp_entry_info);\n+                comp_list_add(&comp_list, comp_entry_idx, comp_entry_info);\n+\n+                sclab_info.unsigned_count += 1;\n+                comp_entry_idx++;\n                 break;\n             }\n \n+            check_sclab(&comp_entry_info, &sclab_info);\n             verified = verify_signature(comp_entry_info,\n                                         sig_len, (uint64_t)sig,\n                                         &cert_len, &cert_table_idx);\n@@ -374,7 +640,7 @@ int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec)\n             }\n \n             comp_entry_idx++;\n-            signed_count += 1;\n+            sclab_info.signed_count += 1;\n             /* After a signature is used another new one can be accepted */\n             sig_len = 0;\n             break;\n@@ -391,10 +657,19 @@ 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.global_load_psw) {\n+        comp_entry_info = (SecureIplCompEntryInfo){ 0 };\n+        comp_entry_info.addr = entry->compdat.load_psw;\n+\n+        check_load_psw(&range_list, sclab_info.global_load_psw, &comp_entry_info);\n+        comp_list_add(&comp_list, comp_entry_idx, comp_entry_info);\n     }\n \n+    check_has_signed_comp(sclab_info.signed_count, &comp_list);\n+    check_sclab_count(sclab_info.count, &comp_list);\n+    check_global_sclab(sclab_info, &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 c625ac2e3a..75d1c8e046 100644\n--- a/pc-bios/s390-ccw/secure-ipl.h\n+++ b/pc-bios/s390-ccw/secure-ipl.h\n@@ -16,10 +16,47 @@\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+#define S390_SECURE_IPL_UNSIGNED_MIN_ADDR  0x2000\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+/* Custom struct used to consolidate SCLAB overhead */\n+typedef struct SecureIplSclabInfo {\n+    int count;\n+    int global_count;\n+    int signed_count;\n+    int unsigned_count;\n+    uint64_t global_load_psw;\n+    uint16_t global_flags;\n+} SecureIplSclabInfo;\n+\n /* Custom struct for secure IPL component entry information */\n typedef struct SecureIplCompEntryInfo {\n     uint64_t addr;\n     uint64_t len;\n+    uint32_t cei;\n     uint16_t cert_index;\n     uint8_t  flags;\n } SecureIplCompEntryInfo;\n@@ -50,6 +87,18 @@ static inline void zipl_secure_handle(const char *message)\n     }\n }\n \n+static inline uint32_t validate_comp_condition(bool condition, uint32_t flag,\n+                                               const char *message)\n+\n+{\n+    if (condition) {\n+        return 0;\n+    }\n+\n+    zipl_secure_handle(message);\n+    return flag;\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": [
        "v10",
        "22/30"
    ]
}