On 8/31/26 3:49 PM, [email protected] wrote:
From: Jared Rossi <[email protected]>
The length of the PCI IPLB is calculated by size of the IplBlockPci struct
plus the number of bytes used for common IPLB fields.
Fix the S390_IPLB_MIN_PCI_LEN to reflect this, and assign a valid blk0_len
while we are at it.
Cc: [email protected]
Fixes: 395116781df5 ("s390x: Build IPLB for virtio-pci devices")
Signed-off-by: Jared Rossi <[email protected]>
---
hw/s390x/ipl.c | 2 ++
include/hw/s390x/ipl/qipl.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index d59ed36c78..ba69ee89bb 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -615,6 +615,8 @@ static bool s390_build_iplb(DeviceState *dev_st,
IplParameterBlock *iplb)
switch (devtype) {
case PCI_DEVTYPE_VIRTIO:
iplb->len = cpu_to_be32(S390_IPLB_MIN_PCI_LEN);
+ iplb->blk0_len =
+ cpu_to_be32(S390_IPLB_MIN_PCI_LEN - S390_IPLB_HEADER_LEN);
iplb->pbt = S390_IPL_TYPE_PCI;
iplb->pci.fid = cpu_to_be32(pbdev->fid);
break;
diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h
index 3fa9649112..69b0023ea3 100644
--- a/include/hw/s390x/ipl/qipl.h
+++ b/include/hw/s390x/ipl/qipl.h
@@ -39,7 +39,7 @@ typedef enum S390IplType S390IplType;
#define S390_IPLB_MIN_PV_LEN 148
#define S390_IPLB_MIN_CCW_LEN 200
#define S390_IPLB_MIN_FCP_LEN 384
-#define S390_IPLB_MIN_PCI_LEN 376
+#define S390_IPLB_MIN_PCI_LEN (offsetof(IplParameterBlock, pci) +
sizeof(IplBlockPci))
#define S390_IPLB_MIN_QEMU_SCSI_LEN 200
#define S390_IPLB_MAX_LEN 4096
Reviewed-by: Jason J. Herne <[email protected]>