get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2233191,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2233191/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260505201905.997996-25-zycai@linux.ibm.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260505201905.997996-25-zycai@linux.ibm.com>",
    "list_archive_url": null,
    "date": "2026-05-05T20:18:56",
    "name": "[v11,24/32] pc-bios/s390-ccw: Add additional security checks for secure boot",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "3287ae3e8437de6f9c9de1f840496c5b7ad0cde1",
    "submitter": {
        "id": 90643,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/90643/?format=api",
        "name": "Zhuoying Cai",
        "email": "zycai@linux.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260505201905.997996-25-zycai@linux.ibm.com/mbox/",
    "series": [
        {
            "id": 502896,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/502896/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502896",
            "date": "2026-05-05T20:18:37",
            "name": "Secure IPL Support for SCSI Scheme of virtio-blk/virtio-scsi Devices",
            "version": 11,
            "mbox": "http://patchwork.ozlabs.org/series/502896/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2233191/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2233191/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=bljmqm0h;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.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 4g990R3vfNz1yJx\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 06:21:59 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wKMFl-00012w-1Z; Tue, 05 May 2026 16:20:25 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.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 1wKMFg-0000rX-7r; Tue, 05 May 2026 16:20:20 -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 1wKMFd-0000K7-F2; Tue, 05 May 2026 16:20:19 -0400",
            "from pps.filterd (m0356516.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 645Ia1Ea3104130; Tue, 5 May 2026 20:19:53 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 4dw9w6d6rf-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Tue, 05 May 2026 20:19:53 +0000 (GMT)",
            "from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1])\n by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id\n 645K9Q9p031250;\n Tue, 5 May 2026 20:19:52 GMT",
            "from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74])\n by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dwukqbfut-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Tue, 05 May 2026 20:19:52 +0000 (GMT)",
            "from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com\n [10.39.53.229])\n by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 645KJp4t18481782\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Tue, 5 May 2026 20:19:51 GMT",
            "from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 18E635805B;\n Tue,  5 May 2026 20:19:51 +0000 (GMT)",
            "from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 7883658059;\n Tue,  5 May 2026 20:19:49 +0000 (GMT)",
            "from fedora-workstation.pok.ibm.com (unknown [9.12.79.241])\n by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP;\n Tue,  5 May 2026 20:19:49 +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=Zz7EiADkthVdJEbU3\n 9QqR4utmQM/3sce6PdtmXWyb0U=; b=bljmqm0hWOXk+hw7QEl9mO8R9jsAq7sRa\n witSz1AHEJihhP9wxELuWUkxfLZFCLNr0vDFRjZ8PUQrp+dTWjlBn8UE7o1GtN2m\n sfNQJjPLbtGvD6RtQ2mKx0124QCnVArFRCtNph2J3j93wWzJxEYzAxTqxzbpaDmt\n vKrMmU31QF3BYwiXj0wNYSmJobM3eiijHezdraw8o8n9hAq6MngqoJ5Yafztz9Ei\n qK6PrR3jd8Y2YDr+LkdLPEJ7eZt0xbSSyub+2WInVYYmJa0sMU4+Pht7M8r2F2k/\n jrBEv3syqjZFI4+1kj/2Xq+6Ij9out/ACB5vy9zSz1yZ+Qqxv2dTg==",
        "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, david@kernel.org, walling@linux.ibm.com,\n jjherne@linux.ibm.com, pasic@linux.ibm.com, borntraeger@linux.ibm.com,\n farman@linux.ibm.com, mjrosato@linux.ibm.com, iii@linux.ibm.com,\n eblake@redhat.com, armbru@redhat.com, zycai@linux.ibm.com,\n alifm@linux.ibm.com, brueckner@linux.ibm.com,\n pierrick.bouvier@oss.qualcomm.com, jdaley@linux.ibm.com",
        "Subject": "[PATCH v11 24/32] pc-bios/s390-ccw: Add additional security checks\n for secure boot",
        "Date": "Tue,  5 May 2026 16:18:56 -0400",
        "Message-ID": "<20260505201905.997996-25-zycai@linux.ibm.com>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260505201905.997996-1-zycai@linux.ibm.com>",
        "References": "<20260505201905.997996-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=XPQAjwhE c=1 sm=1 tr=0 ts=69fa50e9 cx=c_pps\n a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17\n a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=AiDkTBMeNQRD_TXbAJEA:9",
        "X-Proofpoint-ORIG-GUID": "GG8mZ0644LlYa05usLazY6Jzg-4jqLIr",
        "X-Proofpoint-GUID": "GG8mZ0644LlYa05usLazY6Jzg-4jqLIr",
        "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNTA1MDE5NSBTYWx0ZWRfX/EIoAzLc+gJ/\n 0wNumIgvFru91n2HXCWBfudRJXvzAZt4sZTA+ClpxN/0pMfWiw2c/hL08+ScKqz3Cf3iWvnvbjF\n 82zc1emisP8e5xswrdRK2SA/L30PkVYGsV2X1ryFQfu89o6bxs/tLd26bK04Q5KZReNbXyfJYqU\n WCf0qmC8HW0aLTdp9s5cvtwZjBdviAgeapfCt+FzvRRh4bv6hVa4vSz4Kw1Sn9VVMoFg/i2TKy2\n c/qteDUi/i528nv5r/2lMvRBXCB++TPG6mXt6SolKAcfKvQQzTWoYEgOgf03DDE5oZoDXk7VVAg\n bxp/K+2kTqhrSAvFxrdslsrsop/jE12AY9Ajhl3n0jDfvKI8/PzqdPqavFii84Kl7hsjOotm5PS\n A+IzjXKy1hl3uEXA06p0ZBWRdj6J0E2i7hw0BNgPpona8ta5Rr09C6OlyT9OPmGWux6vkw6MkpQ\n zGIWAHxtgM8JWlJIZ0Q==",
        "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-05-05_02,2026-04-30_02,2025-10-01_01",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n bulkscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 spamscore=0\n priorityscore=1501 impostorscore=0 phishscore=0 malwarescore=0 clxscore=1015\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605050195",
        "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, SPF_HELO_NONE=0.001,\n 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.\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/sclp.h       |   1 +\n pc-bios/s390-ccw/secure-ipl.c | 210 +++++++++++++++++++++++++++++++++-\n pc-bios/s390-ccw/secure-ipl.h |  62 ++++++++++\n 4 files changed, 296 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h\nindex a2180719b1..2a3ae6b9f5 100644\n--- a/include/hw/s390x/ipl/qipl.h\n+++ b/include/hw/s390x/ipl/qipl.h\n@@ -167,10 +167,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@@ -194,13 +204,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_SCLAB   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/sclp.h b/pc-bios/s390-ccw/sclp.h\nindex a8a41cd004..cae65b29b5 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 fdac74aa97..9c992149ee 100644\n--- a/pc-bios/s390-ccw/secure-ipl.c\n+++ b/pc-bios/s390-ccw/secure-ipl.c\n@@ -140,6 +140,7 @@ static void comp_list_add(IplDeviceComponentList *comp_list,\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     if (comp_entry_info.flags & S390_IPL_DEV_COMP_FLAG_SC) {\n@@ -207,6 +208,12 @@ bool secure_ipl_supported(void)\n         return false;\n     }\n \n+    if (!sclp_is_fac_ipl_flag_on(SCCB_FAC_IPL_SCLAF_BIT)) {\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@@ -265,6 +272,179 @@ static void comp_addr_range_add(SecureIplCompAddrRangeList *range_list,\n     range_list->num += 1;\n }\n \n+static void check_sclab_opsw(SclaBlock *sclab, SecureIplSclabInfo *sclab_info,\n+                             uint32_t *cei_flags)\n+{\n+    if (!(sclab->flags & S390_SCLAB_OPSW)) {\n+        /* OPSW = 0 - Load PSW field in SCLAB must contain zeros */\n+        zipl_secure_validate(sclab->load_psw == 0, cei_flags,\n+                             S390_CEI_SCLAB_LOAD_PSW_NOT_ZERO,\n+                             \"Load PSW is not zero when Override PSW bit is zero\");\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+        /* override load address flag must set to one */\n+        zipl_secure_validate(sclab->flags & S390_SCLAB_OLA, cei_flags,\n+                             S390_CEI_SCLAB_LOAD_PSW_NOT_ZERO,\n+                             \"OLA flag is not set to one in the global SCLAB\");\n+    }\n+}\n+\n+static void check_sclab_ola(SclaBlock *sclab, uint64_t load_addr, uint32_t *cei_flags)\n+{\n+    if (!(sclab->flags & S390_SCLAB_OLA)) {\n+        /* OLA = 0 - Load address field in SCLAB must contain zeros */\n+        zipl_secure_validate(sclab->load_addr == 0, cei_flags,\n+                             S390_CEI_SCLAB_LOAD_ADDR_NOT_ZERO,\n+                             \"Load Address is not zero when OLA flag is zero\");\n+    } else {\n+        /* OLA = 1 - Load address field must match storage address of the component */\n+        zipl_secure_validate(sclab->load_addr == load_addr, cei_flags,\n+                             S390_CEI_UNMATCHED_SCLAB_LOAD_ADDR,\n+                             \"Load Address does not match with component load address\");\n+    }\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->num; 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+    uint64_t load_psw;\n+\n+    load_psw = comp_entry_info->addr;\n+    zipl_secure_validate(is_psw_valid(sclab_load_psw, range_list) &&\n+                         is_psw_valid(load_psw, range_list),\n+                         &comp_entry_info->cei, S390_CEI_INVALID_LOAD_PSW, \"Invalid PSW\");\n+\n+    /* compare load PSW with the PSW specified in component */\n+    zipl_secure_validate(sclab_load_psw == load_psw, &comp_entry_info->cei,\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_SCLAB_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_error(\"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_SCLAB_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_error(\"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_error(\"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_error(\"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_sclab(SecureIplCompEntryInfo *comp_entry_info,\n+                        SecureIplSclabInfo *sclab_info)\n+{\n+    SclabOriginLocator *sclab_locator;\n+    SclaBlock *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+    zipl_secure_validate(magic_match(sclab_locator->magic, ZIPL_MAGIC),\n+                         &comp_entry_info->cei, S390_CEI_INVALID_SCLAB,\n+                         \"Magic does not match. SCLAB does not exist\");\n+\n+    if (comp_entry_info->cei & S390_CEI_INVALID_SCLAB) {\n+        return;\n+    }\n+\n+    zipl_secure_validate(sclab_locator->len >= S390_SCLAB_MIN_LEN, &comp_entry_info->cei,\n+                         S390_CEI_INVALID_SCLAB_LEN | S390_CEI_INVALID_SCLAB,\n+                         \"Invalid SCLAB length\");\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 = (SclaBlock *)(comp_entry_info->addr + comp_entry_info->len -\n+                          sclab_locator->len);\n+\n+    zipl_secure_validate(sclab->format == 0, &comp_entry_info->cei,\n+                         S390_CEI_INVALID_SCLAB_FORMAT,\n+                         \"Format-0 SCLAB is not being used\");\n+\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+\n+    zipl_secure_validate(~sclab->flags & S390_SCLAB_NUC || sclab->flags & S390_SCLAB_OPSW,\n+                         &comp_entry_info->cei, S390_CEI_NUC_NOT_IN_GLOBAL_SCLAB,\n+                         \"NUC bit is set, but not in the global SCLAB\");\n+\n+    zipl_secure_validate(~sclab->flags & S390_SCLAB_SC || sclab->flags & S390_SCLAB_OPSW,\n+                         &comp_entry_info->cei, S390_CEI_SC_NOT_IN_GLOBAL_SCLAB,\n+                         \"SC bit is set, but not in the global SCLAB\");\n+\n+}\n+\n static int zipl_load_signature(ComponentEntry *entry, uint64_t sig)\n {\n     if (entry->compdat.sig_info.format != DER_SIGNATURE_FORMAT) {\n@@ -307,7 +487,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     init_lists(&comp_list, &cert_list);\n     cert_buf = malloc(get_total_certs_length());\n@@ -343,6 +523,13 @@ int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec)\n \n             /* no signature present (unsigned component) */\n             if (!sig_entry_info.len) {\n+                zipl_secure_validate(comp_entry_info.addr >= S390_UNSIGNED_MIN_ADDR,\n+                                     &comp_entry_info.cei, S390_CEI_INVALID_UNSIGNED_ADDR,\n+                                     \"Load address is less than 0x2000\");\n+\n+                comp_list_add(&comp_list, comp_entry_info);\n+\n+                sclab_info.unsigned_count += 1;\n                 break;\n             }\n \n@@ -352,6 +539,7 @@ int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec)\n              */\n             comp_entry_info.flags = S390_IPL_DEV_COMP_FLAG_SC;\n \n+            check_sclab(&comp_entry_info, &sclab_info);\n             verified = verify_signature(comp_entry_info, sig_entry_info,\n                                         &cert_len, &cert_table_idx);\n \n@@ -378,7 +566,7 @@ int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec)\n \n             comp_list_add(&comp_list, comp_entry_info);\n \n-            signed_count += 1;\n+            sclab_info.signed_count += 1;\n             /* After a signature is used another new one can be accepted */\n             sig_entry_info.len = 0;\n             break;\n@@ -395,10 +583,24 @@ int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec)\n         }\n     }\n \n-    if (signed_count == 0) {\n-        zipl_secure_error(\"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_info);\n     }\n \n+    zipl_secure_validate(sclab_info.signed_count > 0,\n+                         &comp_list.ipl_info_header.iiei, S390_IIEI_NO_SIGNED_COMP,\n+                         \"Secure boot is on, but components are not signed\");\n+\n+    zipl_secure_validate(sclab_info.count > 0, &comp_list.ipl_info_header.iiei,\n+                         S390_IIEI_NO_SCLAB, \"No recognizable SCLAB\");\n+\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 29bbf65c6c..950cd45b3c 100644\n--- a/pc-bios/s390-ccw/secure-ipl.h\n+++ b/pc-bios/s390-ccw/secure-ipl.h\n@@ -16,10 +16,48 @@\n VCStorageSizeBlock *zipl_secure_get_vcssb(void);\n int zipl_run_secure(ComponentEntry **entry_ptr, uint8_t *tmp_sec);\n \n+#define S390_SCLAB_OPSW    0x8000   /* override PSW flag */\n+#define S390_SCLAB_OLA     0x4000   /* override load address flag */\n+#define S390_SCLAB_NUC     0x2000   /* no unsigned components flag */\n+#define S390_SCLAB_SC      0x1000   /* single component flag */\n+\n+#define S390_SCLAB_MIN_LEN      32\n+#define S390_UNSIGNED_MIN_ADDR  0x2000\n+\n+/* Secure Code Loading Attributes Block */\n+struct SclaBlock {\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 SclaBlock SclaBlock;\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 +88,30 @@ static inline void zipl_secure_error(const char *message)\n     }\n }\n \n+static inline void zipl_secure_validate_u16(bool condition, uint16_t *flags,\n+                                            uint16_t flag, const char *message)\n+{\n+    if (!condition) {\n+        *flags |= flag;\n+        zipl_secure_error(message);\n+    }\n+}\n+\n+static inline void zipl_secure_validate_u32(bool condition, uint32_t *flags,\n+                                            uint32_t flag, const char *message)\n+{\n+    if (!condition) {\n+        *flags |= flag;\n+        zipl_secure_error(message);\n+    }\n+}\n+\n+#define zipl_secure_validate(condition, flags, flag, message)   \\\n+    _Generic((flags),                                           \\\n+        uint16_t * : zipl_secure_validate_u16,                  \\\n+        uint32_t * : zipl_secure_validate_u32                   \\\n+    )(condition, flags, flag, message)\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": [
        "v11",
        "24/32"
    ]
}