s390x: Rebuild IPLB for SCSI device directly from DIAG308

Because virtio-scsi type devices use a non-architected IPLB pbt code they cannot
be set and stored normally. Instead, the IPLB must be rebuilt during re-ipl.

As s390x does not natively support multiple boot devices, the devno field is
used to store the position in the boot order for the device.

Handling the rebuild as part of DIAG308 removes the need to check the devices
for invalid IPLBs later in the IPL.

Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20241020012953.1380075-17-jrossi@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Jared Rossi 2024-10-19 21:29:50 -04:00 committed by Thomas Huth
parent 0927875e70
commit 455e3bc3f7
5 changed files with 38 additions and 70 deletions

View file

@ -24,6 +24,7 @@
void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp);
void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp);
void s390_rebuild_iplb(uint16_t index, IplParameterBlock *iplb);
void s390_ipl_update_diag308(IplParameterBlock *iplb);
int s390_ipl_prepare_pv_header(Error **errp);
int s390_ipl_pv_unpack(void);
@ -65,7 +66,8 @@ struct S390IPLState {
bool enforce_bios;
bool iplb_valid;
bool iplb_valid_pv;
bool netboot;
bool rebuilt_iplb;
uint16_t iplb_index;
/* reset related properties don't have to be migrated or reset */
enum s390_reset reset_type;
int reset_cpu_index;
@ -172,11 +174,14 @@ static inline bool iplb_valid_pv(IplParameterBlock *iplb)
static inline bool iplb_valid(IplParameterBlock *iplb)
{
uint32_t len = be32_to_cpu(iplb->len);
switch (iplb->pbt) {
case S390_IPL_TYPE_FCP:
return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_FCP_LEN;
return len >= S390_IPLB_MIN_FCP_LEN;
case S390_IPL_TYPE_CCW:
return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_CCW_LEN;
return len >= S390_IPLB_MIN_CCW_LEN;
case S390_IPL_TYPE_QEMU_SCSI:
default:
return false;
}