@samitouri / QOSamiQemu / commits / e4a2805118

s390x/ipl: Introduce IPL Information Report Block (IIRB)

The IPL information report block (IIRB) contains information used to locate IPL records and to report the results of signature verification of one or more secure components of the load device. IIRB is stored immediately following the IPL Parameter Block. Results on component verification in any case (failure or success) are stored. The IIRB data is reserved and protected by the guest kernel during early boot to prevent it from being overwritten before the certificate data is permanently saved. Signed-off-by: Zhuoying Cai <zycai@linux.ibm.com> Reviewed-by: Farhan Ali <alifm@linux.ibm.com> Reviewed-by: Collin Walling <walling@linux.ibm.com> Link: https://lore.kernel.org/qemu-devel/20260730214624.2328883-16-zycai@linux.ibm.com Signed-off-by: Eric Farman <farman@linux.ibm.com>

Zhuoying Cai committed Jul 30, 2026 at 17:46 UTC e4a2805118af211087b99ca9f77016bb5e922fe5
2 files changed +83
docs/specs/s390x-secure-ipl.rst
+21
@@ -101,3 +101,24 @@ Subcode 1 - perform signature verification
101 * ``0x0302``: PKCS#7 format signature is invalid
102 * ``0x0402``: signature-verification failed
103 * ``0x0502``: length of Diag508SigVerifBlock is invalid
104 +
105 +IPL Information Report Block
106 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107 +
108 +The IPL Parameter Block (IPLB), utilized for IPL operation, is extended with an
109 +IPL Information Report Block (IIRB), which contains the results from secure IPL
110 +operations such as:
111 +
112 +* component data
113 +* verification results
114 +* certificate data
115 +
116 +During early boot, the guest kernel reserves the memory region
117 +containing the IIRB. This preserves the data while the guest kernel is
118 +operating and during re-IPL.
119 +
120 +The guest kernel uses the contents in the IIRB for:
121 +
122 +* Boot logging: reports which components were loaded and verified.
123 +* kexec operations: builds the next kernel’s IPL report from the existing one.
124 +* Keying: installs IPL certificates into the platform trusted keyring.
include/hw/s390x/ipl/qipl.h
+62
@@ -34,6 +34,9 @@ typedef enum S390IplType S390IplType;
34 #define QEMU_DEFAULT_IPL S390_IPL_TYPE_CCW
35
36 #define MAX_CERTIFICATES 64
37 +/* largest supported block size - same as VIRTIO_DASD_DEFAULT_BLOCK_SIZE */
38 +#define VIRTIO_MAX_BLOCK_SIZE 4096
39 +#define MAX_COMP_ENTRIES ((VIRTIO_MAX_BLOCK_SIZE - 32) / 32)
40
41 /*
42 * The QEMU IPL Parameters will be stored at absolute address
@@ -148,4 +151,63 @@ union IplParameterBlock {
151 } QEMU_PACKED;
152 typedef union IplParameterBlock IplParameterBlock;
153
154 +struct IplInfoReportBlockHeader {
155 + uint32_t len;
156 + uint8_t flags;
157 + uint8_t reserved1[11];
158 +};
159 +typedef struct IplInfoReportBlockHeader IplInfoReportBlockHeader;
160 +
161 +struct IplInfoBlockHeader {
162 + uint32_t len;
163 + uint8_t type;
164 + uint8_t reserved1[11];
165 +};
166 +typedef struct IplInfoBlockHeader IplInfoBlockHeader;
167 +
168 +enum IplInfoBlockType {
169 + IPL_INFO_BLOCK_TYPE_CERTIFICATES = 1,
170 + IPL_INFO_BLOCK_TYPE_COMPONENTS = 2,
171 +};
172 +
173 +struct IplSignatureCertificateEntry {
174 + uint64_t addr;
175 + uint64_t len;
176 +};
177 +typedef struct IplSignatureCertificateEntry IplSignatureCertificateEntry;
178 +
179 +struct IplSignatureCertificateList {
180 + IplInfoBlockHeader ipl_info_header;
181 + IplSignatureCertificateEntry cert_entries[MAX_CERTIFICATES];
182 +};
183 +typedef struct IplSignatureCertificateList IplSignatureCertificateList;
184 +
185 +#define S390_IPL_DEV_COMP_FLAG_SC 0x80
186 +#define S390_IPL_DEV_COMP_FLAG_CSV 0x40
187 +
188 +struct IplDeviceComponentEntry {
189 + uint64_t addr;
190 + uint64_t len;
191 + uint8_t flags;
192 + uint8_t reserved1[5];
193 + uint16_t cert_index;
194 + uint8_t reserved2[8];
195 +};
196 +typedef struct IplDeviceComponentEntry IplDeviceComponentEntry;
197 +
198 +struct IplDeviceComponentList {
199 + IplInfoBlockHeader ipl_info_header;
200 + IplDeviceComponentEntry device_entries[MAX_COMP_ENTRIES];
201 +};
202 +typedef struct IplDeviceComponentList IplDeviceComponentList;
203 +
204 +#define COMP_LIST_MAX sizeof(IplDeviceComponentList)
205 +#define CERT_LIST_MAX sizeof(IplSignatureCertificateList)
206 +
207 +struct IplInfoReportBlock {
208 + IplInfoReportBlockHeader hdr;
209 + uint8_t info_blks[COMP_LIST_MAX + CERT_LIST_MAX];
210 +};
211 +typedef struct IplInfoReportBlock IplInfoReportBlock;
212 +
213 #endif