All of lore.kernel.org
 help / color / mirror / Atom feed
From: jrossi@linux.ibm.com
To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, thuth@redhat.com,
	mst@redhat.com
Cc: jjherne@linux.ibm.com, alifm@linux.ibm.com, farman@linux.ibm.com,
	mjrosato@linux.ibm.com, jrossi@linux.ibm.com,
	zycai@linux.ibm.com
Subject: [PATCH v5 04/15] s390x: Remove duplicate definitions of IPL types
Date: Sun,  8 Mar 2026 20:35:50 -0400	[thread overview]
Message-ID: <20260309003601.242634-5-jrossi@linux.ibm.com> (raw)
In-Reply-To: <20260309003601.242634-1-jrossi@linux.ibm.com>

From: Jared Rossi <jrossi@linux.ibm.com>

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>
---
 hw/s390x/ipl.h              |  5 -----
 include/hw/s390x/ipl/qipl.h | 10 ++++++++++
 pc-bios/s390-ccw/iplb.h     |  4 ----
 pc-bios/s390-ccw/main.c     | 14 ++++++++++----
 pc-bios/s390-ccw/virtio.h   |  1 +
 5 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h
index 086e57681c..c542d30ce2 100644
--- a/hw/s390x/ipl.h
+++ b/hw/s390x/ipl.h
@@ -103,11 +103,6 @@ QEMU_BUILD_BUG_MSG(offsetof(S390IPLState, iplb) & 3, "alignment of iplb wrong");
 #define DIAG308_PV_STORE            9
 #define DIAG308_PV_START            10
 
-#define S390_IPL_TYPE_FCP 0x00
-#define S390_IPL_TYPE_CCW 0x02
-#define S390_IPL_TYPE_PV 0x05
-#define S390_IPL_TYPE_QEMU_SCSI 0xff
-
 #define S390_IPLB_HEADER_LEN 8
 #define S390_IPLB_MIN_PV_LEN 148
 #define S390_IPLB_MIN_CCW_LEN 200
diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h
index 6824391111..6dc12dd859 100644
--- a/include/hw/s390x/ipl/qipl.h
+++ b/include/hw/s390x/ipl/qipl.h
@@ -20,6 +20,16 @@
 #define LOADPARM_LEN    8
 #define NO_LOADPARM "\0\0\0\0\0\0\0\0"
 
+enum S390IplType {
+    S390_IPL_TYPE_FCP = 0x00,
+    S390_IPL_TYPE_CCW = 0x02,
+    S390_IPL_TYPE_PV = 0x05,
+    S390_IPL_TYPE_QEMU_SCSI = 0xff
+};
+typedef enum S390IplType S390IplType;
+
+#define QEMU_DEFAULT_IPL S390_IPL_TYPE_CCW
+
 /*
  * The QEMU IPL Parameters will be stored at absolute address
  * 204 (0xcc) which means it is 32-bit word aligned but not
diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h
index 08f259ff31..926e8eed5d 100644
--- a/pc-bios/s390-ccw/iplb.h
+++ b/pc-bios/s390-ccw/iplb.h
@@ -23,10 +23,6 @@ extern QemuIplParameters qipl;
 extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
 extern bool have_iplb;
 
-#define S390_IPL_TYPE_FCP 0x00
-#define S390_IPL_TYPE_CCW 0x02
-#define S390_IPL_TYPE_QEMU_SCSI 0xff
-
 static inline bool manage_iplb(IplParameterBlock *iplb, bool store)
 {
     register unsigned long addr asm("0") = (unsigned long) iplb;
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 8e2c99bee1..2e9261904f 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -149,7 +149,7 @@ static bool find_subch(int dev_no)
     return false;
 }
 
-static void menu_setup(void)
+static void menu_setup(VDev *vdev)
 {
     if (memcmp(loadparm_str, LOADPARM_PROMPT, LOADPARM_LEN) == 0) {
         menu_set_parms(QIPL_FLAG_BM_OPTS_CMD, 0);
@@ -162,11 +162,13 @@ static void menu_setup(void)
         return;
     }
 
-    switch (iplb.pbt) {
+    switch (vdev->ipl_type) {
     case S390_IPL_TYPE_CCW:
     case S390_IPL_TYPE_QEMU_SCSI:
         menu_set_parms(qipl.qipl_flags & BOOT_MENU_FLAG_MASK,
                        qipl.boot_menu_timeout);
+        /* fall through */
+    default:
         return;
     }
 }
@@ -190,6 +192,7 @@ static void css_setup(void)
 static void boot_setup(void)
 {
     char lpmsg[] = "LOADPARM=[________]\n";
+    VDev *vdev = virtio_get_device();
 
     if (have_iplb && memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) {
         ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN);
@@ -198,7 +201,10 @@ static void boot_setup(void)
     }
 
     if (have_iplb) {
-        menu_setup();
+        vdev->ipl_type = iplb.pbt;
+        menu_setup(vdev);
+    } else {
+        vdev->ipl_type = QEMU_DEFAULT_IPL;
     }
 
     memcpy(lpmsg + 10, loadparm_str, 8);
@@ -216,7 +222,7 @@ static bool find_boot_device(void)
     VDev *vdev = virtio_get_device();
     bool found = false;
 
-    switch (iplb.pbt) {
+    switch (vdev->ipl_type) {
     case S390_IPL_TYPE_CCW:
         vdev->scsi_device_selected = false;
         debug_print_int("device no. ", iplb.ccw.devno);
diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h
index 06ba4e45ac..391d6ff2f7 100644
--- a/pc-bios/s390-ccw/virtio.h
+++ b/pc-bios/s390-ccw/virtio.h
@@ -238,6 +238,7 @@ struct VDev {
     VirtioGDN guessed_disk_nature;
     SubChannelId schid;
     SenseId senseid;
+    S390IplType ipl_type;
     union {
         VirtioBlkConfig blk;
         VirtioScsiConfig scsi;
-- 
2.52.0



  parent reply	other threads:[~2026-03-09  0:36 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09  0:35 [PATCH v5 00/15] s390x: Add support for virtio-blk-pci IPL device jrossi
2026-03-09  0:35 ` [PATCH v5 01/15] pc-bios/s390-ccw: Fix misattributed function prototypes jrossi
2026-03-09  0:35 ` [PATCH v5 02/15] pc-bios/s390-ccw: Remove redundant vring schid attribute jrossi
2026-03-09  0:35 ` [PATCH v5 03/15] pc-bios/s390-ccw: Always reset virtio device on failed boot attempt jrossi
2026-03-09  0:35 ` jrossi [this message]
2026-03-09  0:35 ` [PATCH v5 05/15] pc-bios/s390-ccw: Store device type independent of sense data jrossi
2026-03-09  0:35 ` [PATCH v5 06/15] pc-bios/s390-ccw: Split virtio-ccw and generic virtio jrossi
2026-03-10  5:28   ` Thomas Huth
2026-03-09  0:35 ` [PATCH v5 07/15] include/hw/s390x: Move CLP definitions for easier BIOS access jrossi
2026-03-09  0:35 ` [PATCH v5 08/15] pc-bios/s390-ccw: Introduce CLP Architecture jrossi
2026-03-09 13:21   ` Matthew Rosato
2026-03-09 17:16   ` Farhan Ali
2026-03-09  0:35 ` [PATCH v5 09/15] s390x: Add definitions for PCI IPL type jrossi
2026-03-09  0:35 ` [PATCH v5 10/15] pc-bios/s390-ccw: Introduce PCI device jrossi
2026-03-09 11:56   ` Thomas Huth
2026-03-09 13:29   ` Matthew Rosato
2026-03-09 17:09   ` Farhan Ali
2026-03-09  0:35 ` [PATCH v5 11/15] pc-bios/s390-ccw: Introduce virtio-pci functions jrossi
2026-03-09 11:59   ` Thomas Huth
2026-03-09 13:53   ` Matthew Rosato
2026-03-09 22:27   ` Eric Farman
2026-03-09  0:35 ` [PATCH v5 12/15] pc-bios/s390-ccw: Add support for virtio-blk-pci IPL jrossi
2026-03-09  0:35 ` [PATCH v5 13/15] s390x: Build IPLB for virtio-pci devices jrossi
2026-03-09  0:36 ` [PATCH v5 14/15] hw: Add "loadparm" property to virtio block PCI devices booting on s390x jrossi
2026-03-09  0:36 ` [PATCH v5 15/15] tests/qtest: Add s390x PCI boot test to cdrom-test.c jrossi
2026-03-09 16:49   ` Thomas Huth
2026-03-09 16:53     ` Thomas Huth
2026-03-09 17:11       ` Thomas Huth
2026-03-09 18:01         ` Jared Rossi
2026-03-09 14:00 ` [PATCH v5 00/15] s390x: Add support for virtio-blk-pci IPL device Matthew Rosato
2026-03-09 15:40   ` Thomas Huth
2026-03-09 16:17     ` Matthew Rosato
2026-03-23 16:55 ` Thomas Huth
2026-03-24 17:59   ` Jared Rossi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260309003601.242634-5-jrossi@linux.ibm.com \
    --to=jrossi@linux.ibm.com \
    --cc=alifm@linux.ibm.com \
    --cc=farman@linux.ibm.com \
    --cc=jjherne@linux.ibm.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=zycai@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.