Commit 8435aadbb9 for qemu.org

commit 8435aadbb9add09c4c2e16f803b37441b4c6a32f
Author: Jared Rossi <jrossi@linux.ibm.com>
Date:   Mon Aug 31 15:49:13 2026 -0400

    hw/s390x/ipl: Fix incorrect PCI IPL block lengths

    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: qemu-stable@nongnu.org
    Fixes: 395116781df5 ("s390x: Build IPLB for virtio-pci devices")
    Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
    Reviewed-by: Eric Farman <farman@linux.ibm.com>
    Link: https://lore.kernel.org/qemu-devel/20260831194919.3830270-3-jrossi@linux.ibm.com
    Signed-off-by: Eric Farman <farman@linux.ibm.com>

diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index b0da3cbb27..b2b87beefd 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -610,6 +610,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