s390x: Remove duplicate definitions of IPL types
Remove the duplicate definitions from hw/s390x/ipl.h and pc-bios/s390-ccw/iplb.h and add a shared definition. The new definition is an enum to enforce default handling in switches. Because the IPL type is determined by the IPLB, and because an IPLB is not strictly necessary, the IPL type is set to a default value if not otherwise specified. A default IPL type is required so future functionality may add IPL new bus and/or device types that dictate specific behavior during IPL. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com> Message-ID: <20260309003601.242634-5-jrossi@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Jared Rossi committed
Mar 8, 2026 at 20:35 UTC
4228a92b2a3ae41a5d7f26b36f42f0efdd0deb93
5 files changed
+21
-13
hw/s390x/ipl.h
-5
@@ -103,11 +103,6 @@ QEMU_BUILD_BUG_MSG(offsetof(S390IPLState, iplb) & 3, "alignment of iplb wrong");
103
#define DIAG308_PV_STORE 9
104
#define DIAG308_PV_START 10
105
106
-#define S390_IPL_TYPE_FCP 0x00
107
-#define S390_IPL_TYPE_CCW 0x02
108
-#define S390_IPL_TYPE_PV 0x05
109
-#define S390_IPL_TYPE_QEMU_SCSI 0xff
110
-
106
#define S390_IPLB_HEADER_LEN 8
107
#define S390_IPLB_MIN_PV_LEN 148
108
#define S390_IPLB_MIN_CCW_LEN 200
include/hw/s390x/ipl/qipl.h
+10
@@ -20,6 +20,16 @@
20
#define LOADPARM_LEN 8
21
#define NO_LOADPARM "\0\0\0\0\0\0\0\0"
22
23
+enum S390IplType {
24
+ S390_IPL_TYPE_FCP = 0x00,
25
+ S390_IPL_TYPE_CCW = 0x02,
26
+ S390_IPL_TYPE_PV = 0x05,
27
+ S390_IPL_TYPE_QEMU_SCSI = 0xff
28
+};
29
+typedef enum S390IplType S390IplType;
30
+
31
+#define QEMU_DEFAULT_IPL S390_IPL_TYPE_CCW
32
+
33
/*
34
* The QEMU IPL Parameters will be stored at absolute address
35
* 204 (0xcc) which means it is 32-bit word aligned but not
pc-bios/s390-ccw/iplb.h
-4
@@ -23,10 +23,6 @@ extern QemuIplParameters qipl;
23
extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
24
extern bool have_iplb;
25
26
-#define S390_IPL_TYPE_FCP 0x00
27
-#define S390_IPL_TYPE_CCW 0x02
28
-#define S390_IPL_TYPE_QEMU_SCSI 0xff
29
-
26
static inline bool manage_iplb(IplParameterBlock *iplb, bool store)
27
{
28
register unsigned long addr asm("0") = (unsigned long) iplb;
pc-bios/s390-ccw/main.c
+10
-4
@@ -149,7 +149,7 @@ static bool find_subch(int dev_no)
149
return false;
150
}
151
152
-static void menu_setup(void)
152
+static void menu_setup(VDev *vdev)
153
{
154
if (memcmp(loadparm_str, LOADPARM_PROMPT, LOADPARM_LEN) == 0) {
155
menu_set_parms(QIPL_FLAG_BM_OPTS_CMD, 0);
@@ -162,11 +162,13 @@ static void menu_setup(void)
162
return;
163
}
164
165
- switch (iplb.pbt) {
165
+ switch (vdev->ipl_type) {
166
case S390_IPL_TYPE_CCW:
167
case S390_IPL_TYPE_QEMU_SCSI:
168
menu_set_parms(qipl.qipl_flags & BOOT_MENU_FLAG_MASK,
169
qipl.boot_menu_timeout);
170
+ /* fall through */
171
+ default:
172
return;
173
}
174
}
@@ -190,6 +192,7 @@ static void css_setup(void)
192
static void boot_setup(void)
193
{
194
char lpmsg[] = "LOADPARM=[________]\n";
195
+ VDev *vdev = virtio_get_device();
196
197
if (have_iplb && memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) {
198
ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN);
@@ -198,7 +201,10 @@ static void boot_setup(void)
201
}
202
203
if (have_iplb) {
201
- menu_setup();
204
+ vdev->ipl_type = iplb.pbt;
205
+ menu_setup(vdev);
206
+ } else {
207
+ vdev->ipl_type = QEMU_DEFAULT_IPL;
208
}
209
210
memcpy(lpmsg + 10, loadparm_str, 8);
@@ -216,7 +222,7 @@ static bool find_boot_device(void)
222
VDev *vdev = virtio_get_device();
223
bool found = false;
224
219
- switch (iplb.pbt) {
225
+ switch (vdev->ipl_type) {
226
case S390_IPL_TYPE_CCW:
227
vdev->scsi_device_selected = false;
228
debug_print_int("device no. ", iplb.ccw.devno);
pc-bios/s390-ccw/virtio.h
+1
@@ -238,6 +238,7 @@ struct VDev {
238
VirtioGDN guessed_disk_nature;
239
SubChannelId schid;
240
SenseId senseid;
241
+ S390IplType ipl_type;
242
union {
243
VirtioBlkConfig blk;
244
VirtioScsiConfig scsi;