[PATCH v5 15/15] tests/qtest: Add s390x PCI boot test to cdrom-test.c

jrossi@linux.ibm.com posted 15 patches 1 month ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Jared Rossi <jrossi@linux.ibm.com>, Zhuoying Cai <zycai@linux.ibm.com>, Richard Henderson <richard.henderson@linaro.org>, Ilya Leoshkevich <iii@linux.ibm.com>, David Hildenbrand <david@kernel.org>, Halil Pasic <pasic@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Farhan Ali <alifm@linux.ibm.com>, John Snow <jsnow@redhat.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
[PATCH v5 15/15] tests/qtest: Add s390x PCI boot test to cdrom-test.c
Posted by jrossi@linux.ibm.com 1 month ago
From: Jared Rossi <jrossi@linux.ibm.com>

Add a rudimentary test for s390x IPL to verify that a guest may boot using
virtio-blk-pci device.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
---
 tests/qtest/cdrom-test.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c
index 56e2d283a9..a65854d2bc 100644
--- a/tests/qtest/cdrom-test.c
+++ b/tests/qtest/cdrom-test.c
@@ -246,6 +246,13 @@ static void add_s390x_tests(void)
                             "-drive if=none,id=d2,media=cdrom,file=",
                             test_cdboot);
     }
+    if (qtest_has_device("virtio-blk-pci")) {
+        qtest_add_data_func("cdrom/boot/pci-bus-with-bootindex",
+                            "-device virtio-scsi -device virtio-serial "
+                            "-device virtio-blk-pci,drive=d1,bootindex=1 "
+                            "-drive if=none,id=d1,media=cdrom,file=",
+                            test_cdboot);
+    }
 }
 
 int main(int argc, char **argv)
-- 
2.52.0
Re: [PATCH v5 15/15] tests/qtest: Add s390x PCI boot test to cdrom-test.c
Posted by Thomas Huth 1 month ago
On 09/03/2026 01.36, jrossi@linux.ibm.com wrote:
> From: Jared Rossi <jrossi@linux.ibm.com>
> 
> Add a rudimentary test for s390x IPL to verify that a guest may boot using
> virtio-blk-pci device.
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
> ---
>   tests/qtest/cdrom-test.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c
> index 56e2d283a9..a65854d2bc 100644
> --- a/tests/qtest/cdrom-test.c
> +++ b/tests/qtest/cdrom-test.c
> @@ -246,6 +246,13 @@ static void add_s390x_tests(void)
>                               "-drive if=none,id=d2,media=cdrom,file=",
>                               test_cdboot);
>       }
> +    if (qtest_has_device("virtio-blk-pci")) {
> +        qtest_add_data_func("cdrom/boot/pci-bus-with-bootindex",
> +                            "-device virtio-scsi -device virtio-serial "
> +                            "-device virtio-blk-pci,drive=d1,bootindex=1 "
> +                            "-drive if=none,id=d1,media=cdrom,file=",
> +                            test_cdboot);
> +    }
>   }

  Hi Jared!

While testing your series, it seems like the cdrom-test is now triggering a 
segmentation fault in QEMU here ... not sure whether I did something wrong 
on my side while building the bios, or whether there is a bug somewhere? 
Does this qtest work for you with this v5 series?

  Thomas
Re: [PATCH v5 15/15] tests/qtest: Add s390x PCI boot test to cdrom-test.c
Posted by Thomas Huth 1 month ago
On 09/03/2026 17.49, Thomas Huth wrote:
> On 09/03/2026 01.36, jrossi@linux.ibm.com wrote:
>> From: Jared Rossi <jrossi@linux.ibm.com>
>>
>> Add a rudimentary test for s390x IPL to verify that a guest may boot using
>> virtio-blk-pci device.
>>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
>> ---
>>   tests/qtest/cdrom-test.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c
>> index 56e2d283a9..a65854d2bc 100644
>> --- a/tests/qtest/cdrom-test.c
>> +++ b/tests/qtest/cdrom-test.c
>> @@ -246,6 +246,13 @@ static void add_s390x_tests(void)
>>                               "-drive if=none,id=d2,media=cdrom,file=",
>>                               test_cdboot);
>>       }
>> +    if (qtest_has_device("virtio-blk-pci")) {
>> +        qtest_add_data_func("cdrom/boot/pci-bus-with-bootindex",
>> +                            "-device virtio-scsi -device virtio-serial "
>> +                            "-device virtio-blk-pci,drive=d1,bootindex=1 "
>> +                            "-drive if=none,id=d1,media=cdrom,file=",
>> +                            test_cdboot);
>> +    }
>>   }
> 
>   Hi Jared!
> 
> While testing your series, it seems like the cdrom-test is now triggering a 
> segmentation fault in QEMU here ... not sure whether I did something wrong 
> on my side while building the bios, or whether there is a bug somewhere? 
> Does this qtest work for you with this v5 series?

Ah, it's working on my s390x LPAR, but it's failing on my x86 laptop ... 
maybe there is some endianness issue left somewhere?

  Thomas


Re: [PATCH v5 15/15] tests/qtest: Add s390x PCI boot test to cdrom-test.c
Posted by Thomas Huth 1 month ago
On 09/03/2026 17.53, Thomas Huth wrote:
> On 09/03/2026 17.49, Thomas Huth wrote:
>> On 09/03/2026 01.36, jrossi@linux.ibm.com wrote:
>>> From: Jared Rossi <jrossi@linux.ibm.com>
>>>
>>> Add a rudimentary test for s390x IPL to verify that a guest may boot using
>>> virtio-blk-pci device.
>>>
>>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
>>> ---
>>>   tests/qtest/cdrom-test.c | 7 +++++++
>>>   1 file changed, 7 insertions(+)
>>>
>>> diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c
>>> index 56e2d283a9..a65854d2bc 100644
>>> --- a/tests/qtest/cdrom-test.c
>>> +++ b/tests/qtest/cdrom-test.c
>>> @@ -246,6 +246,13 @@ static void add_s390x_tests(void)
>>>                               "-drive if=none,id=d2,media=cdrom,file=",
>>>                               test_cdboot);
>>>       }
>>> +    if (qtest_has_device("virtio-blk-pci")) {
>>> +        qtest_add_data_func("cdrom/boot/pci-bus-with-bootindex",
>>> +                            "-device virtio-scsi -device virtio-serial "
>>> +                            "-device virtio-blk-pci,drive=d1,bootindex=1 "
>>> +                            "-drive if=none,id=d1,media=cdrom,file=",
>>> +                            test_cdboot);
>>> +    }
>>>   }
>>
>>   Hi Jared!
>>
>> While testing your series, it seems like the cdrom-test is now triggering 
>> a segmentation fault in QEMU here ... not sure whether I did something 
>> wrong on my side while building the bios, or whether there is a bug 
>> somewhere? Does this qtest work for you with this v5 series?
> 
> Ah, it's working on my s390x LPAR, but it's failing on my x86 laptop ... 
> maybe there is some endianness issue left somewhere?

Yes, it's a missing swap of endianness data, this patch fixes it:

diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -524,9 +524,9 @@ static bool s390_build_iplb(DeviceState *dev_st, 
IplParameterBlock *iplb)

          switch (devtype) {
          case PCI_DEVTYPE_VIRTIO:
-            iplb->len = S390_IPLB_MIN_PCI_LEN;
+            iplb->len = cpu_to_be32(S390_IPLB_MIN_PCI_LEN);
              iplb->pbt = S390_IPL_TYPE_PCI;
-            iplb->pci.fid = pbdev->fid;
+            iplb->pci.fid = cpu_to_be32(pbdev->fid);
              break;
          default:
              return false;

If you agree, I can squash this into patch 13.

  Thomas


Re: [PATCH v5 15/15] tests/qtest: Add s390x PCI boot test to cdrom-test.c
Posted by Jared Rossi 1 month ago

On 3/9/26 1:11 PM, Thomas Huth wrote:
> On 09/03/2026 17.53, Thomas Huth wrote:
>> On 09/03/2026 17.49, Thomas Huth wrote:
>>> On 09/03/2026 01.36, jrossi@linux.ibm.com wrote:
>>>> From: Jared Rossi <jrossi@linux.ibm.com>
>>>>
>>>> Add a rudimentary test for s390x IPL to verify that a guest may 
>>>> boot using
>>>> virtio-blk-pci device.
>>>>
>>>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>>> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
>>>> ---
>>>>   tests/qtest/cdrom-test.c | 7 +++++++
>>>>   1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c
>>>> index 56e2d283a9..a65854d2bc 100644
>>>> --- a/tests/qtest/cdrom-test.c
>>>> +++ b/tests/qtest/cdrom-test.c
>>>> @@ -246,6 +246,13 @@ static void add_s390x_tests(void)
>>>>                               "-drive 
>>>> if=none,id=d2,media=cdrom,file=",
>>>>                               test_cdboot);
>>>>       }
>>>> +    if (qtest_has_device("virtio-blk-pci")) {
>>>> + qtest_add_data_func("cdrom/boot/pci-bus-with-bootindex",
>>>> +                            "-device virtio-scsi -device 
>>>> virtio-serial "
>>>> +                            "-device 
>>>> virtio-blk-pci,drive=d1,bootindex=1 "
>>>> +                            "-drive if=none,id=d1,media=cdrom,file=",
>>>> +                            test_cdboot);
>>>> +    }
>>>>   }
>>>
>>>   Hi Jared!
>>>
>>> While testing your series, it seems like the cdrom-test is now 
>>> triggering a segmentation fault in QEMU here ... not sure whether I 
>>> did something wrong on my side while building the bios, or whether 
>>> there is a bug somewhere? Does this qtest work for you with this v5 
>>> series?
>>
>> Ah, it's working on my s390x LPAR, but it's failing on my x86 laptop 
>> ... maybe there is some endianness issue left somewhere?
>
> Yes, it's a missing swap of endianness data, this patch fixes it:
>
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -524,9 +524,9 @@ static bool s390_build_iplb(DeviceState *dev_st, 
> IplParameterBlock *iplb)
>
>          switch (devtype) {
>          case PCI_DEVTYPE_VIRTIO:
> -            iplb->len = S390_IPLB_MIN_PCI_LEN;
> +            iplb->len = cpu_to_be32(S390_IPLB_MIN_PCI_LEN);
>              iplb->pbt = S390_IPL_TYPE_PCI;
> -            iplb->pci.fid = pbdev->fid;
> +            iplb->pci.fid = cpu_to_be32(pbdev->fid);
>              break;
>          default:
>              return false;
>
> If you agree, I can squash this into patch 13.
>

Hi Thomas,

Thanks for identifying the problem.  Yes, please do squash it into patch 13.

Regards,
Jared Rossi