diff mbox series

[7/7] tests/fw_cfg: Run the tests on big-endian targets

Message ID 20191003225437.16651-8-philmd@redhat.com
State New
Headers show
Series fw_cfg: Run tests on big-endian | expand

Commit Message

Philippe Mathieu-Daudé Oct. 3, 2019, 10:54 p.m. UTC
We have been restricting our fw_cfg tests to the PC machine,
which is a little-endian architecture.
The fw_cfg device is also used on the SPARC and PowerPC
architectures, which can run in big-endian configuration.

Since we want to be sure our device does not regress
regardless the endianess used, enable this test one
these targets.

The NUMA selector is X86 specific, restrict it to this arch.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/Makefile.include |  2 ++
 tests/fw_cfg-test.c    | 18 +++++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

Comments

Laurent Vivier Oct. 4, 2019, 8:05 a.m. UTC | #1
On 04/10/2019 00:54, Philippe Mathieu-Daudé wrote:
> We have been restricting our fw_cfg tests to the PC machine,
> which is a little-endian architecture.
> The fw_cfg device is also used on the SPARC and PowerPC
> architectures, which can run in big-endian configuration.
> 
> Since we want to be sure our device does not regress
> regardless the endianess used, enable this test one
> these targets.
> 
> The NUMA selector is X86 specific, restrict it to this arch.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/Makefile.include |  2 ++
>  tests/fw_cfg-test.c    | 18 +++++++++++++++---
>  2 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 3543451ed3..322bdb36ff 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -242,6 +242,7 @@ check-qtest-ppc64-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
>  check-qtest-ppc64-y += tests/numa-test$(EXESUF)
>  check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
>  check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
> +check-qtest-ppc64-y += tests/fw_cfg-test$(EXESUF)

Perhaps only a detail, but ppc64 (pseries) doesn't use fw_cfg, but ppc
(mac99, g3beige and prep) does, so perhaps you should rather add the
test to check-qtest-ppc-y (and it will be inherited by ppc64)?

Thanks,
Laurent
Philippe Mathieu-Daudé Oct. 4, 2019, 8:53 a.m. UTC | #2
On 10/4/19 10:05 AM, Laurent Vivier wrote:
> On 04/10/2019 00:54, Philippe Mathieu-Daudé wrote:
>> We have been restricting our fw_cfg tests to the PC machine,
>> which is a little-endian architecture.
>> The fw_cfg device is also used on the SPARC and PowerPC
>> architectures, which can run in big-endian configuration.
>>
>> Since we want to be sure our device does not regress
>> regardless the endianess used, enable this test one
>> these targets.
>>
>> The NUMA selector is X86 specific, restrict it to this arch.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>   tests/Makefile.include |  2 ++
>>   tests/fw_cfg-test.c    | 18 +++++++++++++++---
>>   2 files changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/Makefile.include b/tests/Makefile.include
>> index 3543451ed3..322bdb36ff 100644
>> --- a/tests/Makefile.include
>> +++ b/tests/Makefile.include
>> @@ -242,6 +242,7 @@ check-qtest-ppc64-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
>>   check-qtest-ppc64-y += tests/numa-test$(EXESUF)
>>   check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
>>   check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
>> +check-qtest-ppc64-y += tests/fw_cfg-test$(EXESUF)
> 
> Perhaps only a detail, but ppc64 (pseries) doesn't use fw_cfg, but ppc
> (mac99, g3beige and prep) does, so perhaps you should rather add the
> test to check-qtest-ppc-y (and it will be inherited by ppc64)?

The test only runs the mac99 machine.

What happens when running "qemu-system-ppc64 -M mac99"? Does it runs in 
64-bit? Else it is probably pointless to run the test in ppc64, and I 
should restrict it the ppc[32].
Laurent Vivier Oct. 4, 2019, 8:59 a.m. UTC | #3
On 04/10/2019 10:53, Philippe Mathieu-Daudé wrote:
> On 10/4/19 10:05 AM, Laurent Vivier wrote:
>> On 04/10/2019 00:54, Philippe Mathieu-Daudé wrote:
>>> We have been restricting our fw_cfg tests to the PC machine,
>>> which is a little-endian architecture.
>>> The fw_cfg device is also used on the SPARC and PowerPC
>>> architectures, which can run in big-endian configuration.
>>>
>>> Since we want to be sure our device does not regress
>>> regardless the endianess used, enable this test one
>>> these targets.
>>>
>>> The NUMA selector is X86 specific, restrict it to this arch.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>>   tests/Makefile.include |  2 ++
>>>   tests/fw_cfg-test.c    | 18 +++++++++++++++---
>>>   2 files changed, 17 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/tests/Makefile.include b/tests/Makefile.include
>>> index 3543451ed3..322bdb36ff 100644
>>> --- a/tests/Makefile.include
>>> +++ b/tests/Makefile.include
>>> @@ -242,6 +242,7 @@ check-qtest-ppc64-$(CONFIG_VGA) +=
>>> tests/display-vga-test$(EXESUF)
>>>   check-qtest-ppc64-y += tests/numa-test$(EXESUF)
>>>   check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) +=
>>> tests/ivshmem-test$(EXESUF)
>>>   check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
>>> +check-qtest-ppc64-y += tests/fw_cfg-test$(EXESUF)
>>
>> Perhaps only a detail, but ppc64 (pseries) doesn't use fw_cfg, but ppc
>> (mac99, g3beige and prep) does, so perhaps you should rather add the
>> test to check-qtest-ppc-y (and it will be inherited by ppc64)?
> 
> The test only runs the mac99 machine.
> 
> What happens when running "qemu-system-ppc64 -M mac99"? Does it runs in
> 64-bit? 

Yes, it's way used to emulate a ppc64 powermac (G5)

$ qemu-system-ppc64 -M mac99 -serial tdio
>> =============================================================
>> OpenBIOS 1.1 [Feb 2 2019 05:05]
>> Configuration device id QEMU version 1 machine id 3
>> CPUs: 1
>> Memory: 128M
>> UUID: 00000000-0000-0000-0000-000000000000
>> CPU type PowerPC,970FX

$ qemu-system-ppc -M mac99 -serial stdio
>> =============================================================
>> OpenBIOS 1.1 [Feb 2 2019 05:05]
>> Configuration device id QEMU version 1 machine id 1
>> CPUs: 1
>> Memory: 128M
>> UUID: 00000000-0000-0000-0000-000000000000
>> CPU type PowerPC,G4

Thanks,
Laurent
Philippe Mathieu-Daudé Oct. 4, 2019, 9:03 a.m. UTC | #4
On 10/4/19 10:59 AM, Laurent Vivier wrote:
> On 04/10/2019 10:53, Philippe Mathieu-Daudé wrote:
>> On 10/4/19 10:05 AM, Laurent Vivier wrote:
>>> On 04/10/2019 00:54, Philippe Mathieu-Daudé wrote:
>>>> We have been restricting our fw_cfg tests to the PC machine,
>>>> which is a little-endian architecture.
>>>> The fw_cfg device is also used on the SPARC and PowerPC
>>>> architectures, which can run in big-endian configuration.
>>>>
>>>> Since we want to be sure our device does not regress
>>>> regardless the endianess used, enable this test one
>>>> these targets.
>>>>
>>>> The NUMA selector is X86 specific, restrict it to this arch.
>>>>
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>>> ---
>>>>    tests/Makefile.include |  2 ++
>>>>    tests/fw_cfg-test.c    | 18 +++++++++++++++---
>>>>    2 files changed, 17 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/tests/Makefile.include b/tests/Makefile.include
>>>> index 3543451ed3..322bdb36ff 100644
>>>> --- a/tests/Makefile.include
>>>> +++ b/tests/Makefile.include
>>>> @@ -242,6 +242,7 @@ check-qtest-ppc64-$(CONFIG_VGA) +=
>>>> tests/display-vga-test$(EXESUF)
>>>>    check-qtest-ppc64-y += tests/numa-test$(EXESUF)
>>>>    check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) +=
>>>> tests/ivshmem-test$(EXESUF)
>>>>    check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
>>>> +check-qtest-ppc64-y += tests/fw_cfg-test$(EXESUF)
>>>
>>> Perhaps only a detail, but ppc64 (pseries) doesn't use fw_cfg, but ppc
>>> (mac99, g3beige and prep) does, so perhaps you should rather add the
>>> test to check-qtest-ppc-y (and it will be inherited by ppc64)?
>>
>> The test only runs the mac99 machine.
>>
>> What happens when running "qemu-system-ppc64 -M mac99"? Does it runs in
>> 64-bit?
> 
> Yes, it's way used to emulate a ppc64 powermac (G5)

Oh.

> $ qemu-system-ppc64 -M mac99 -serial tdio
>>> =============================================================
>>> OpenBIOS 1.1 [Feb 2 2019 05:05]
>>> Configuration device id QEMU version 1 machine id 3
>>> CPUs: 1
>>> Memory: 128M
>>> UUID: 00000000-0000-0000-0000-000000000000
>>> CPU type PowerPC,970FX

So this would test the 64-bit/big-endian,

> $ qemu-system-ppc -M mac99 -serial stdio
>>> =============================================================
>>> OpenBIOS 1.1 [Feb 2 2019 05:05]
>>> Configuration device id QEMU version 1 machine id 1
>>> CPUs: 1
>>> Memory: 128M
>>> UUID: 00000000-0000-0000-0000-000000000000
>>> CPU type PowerPC,G4

and this the 32-bit/big-endian device, is that correct?
Laurent Vivier Oct. 4, 2019, 9:14 a.m. UTC | #5
On 04/10/2019 11:03, Philippe Mathieu-Daudé wrote:
> On 10/4/19 10:59 AM, Laurent Vivier wrote:
>> On 04/10/2019 10:53, Philippe Mathieu-Daudé wrote:
>>> On 10/4/19 10:05 AM, Laurent Vivier wrote:
>>>> On 04/10/2019 00:54, Philippe Mathieu-Daudé wrote:
>>>>> We have been restricting our fw_cfg tests to the PC machine,
>>>>> which is a little-endian architecture.
>>>>> The fw_cfg device is also used on the SPARC and PowerPC
>>>>> architectures, which can run in big-endian configuration.
>>>>>
>>>>> Since we want to be sure our device does not regress
>>>>> regardless the endianess used, enable this test one
>>>>> these targets.
>>>>>
>>>>> The NUMA selector is X86 specific, restrict it to this arch.
>>>>>
>>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>>>> ---
>>>>>    tests/Makefile.include |  2 ++
>>>>>    tests/fw_cfg-test.c    | 18 +++++++++++++++---
>>>>>    2 files changed, 17 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/tests/Makefile.include b/tests/Makefile.include
>>>>> index 3543451ed3..322bdb36ff 100644
>>>>> --- a/tests/Makefile.include
>>>>> +++ b/tests/Makefile.include
>>>>> @@ -242,6 +242,7 @@ check-qtest-ppc64-$(CONFIG_VGA) +=
>>>>> tests/display-vga-test$(EXESUF)
>>>>>    check-qtest-ppc64-y += tests/numa-test$(EXESUF)
>>>>>    check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) +=
>>>>> tests/ivshmem-test$(EXESUF)
>>>>>    check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
>>>>> +check-qtest-ppc64-y += tests/fw_cfg-test$(EXESUF)
>>>>
>>>> Perhaps only a detail, but ppc64 (pseries) doesn't use fw_cfg, but ppc
>>>> (mac99, g3beige and prep) does, so perhaps you should rather add the
>>>> test to check-qtest-ppc-y (and it will be inherited by ppc64)?
>>>
>>> The test only runs the mac99 machine.
>>>
>>> What happens when running "qemu-system-ppc64 -M mac99"? Does it runs in
>>> 64-bit?
>>
>> Yes, it's way used to emulate a ppc64 powermac (G5)
> 
> Oh.
> 
>> $ qemu-system-ppc64 -M mac99 -serial tdio
>>>> =============================================================
>>>> OpenBIOS 1.1 [Feb 2 2019 05:05]
>>>> Configuration device id QEMU version 1 machine id 3
>>>> CPUs: 1
>>>> Memory: 128M
>>>> UUID: 00000000-0000-0000-0000-000000000000
>>>> CPU type PowerPC,970FX
> 
> So this would test the 64-bit/big-endian,
> 
>> $ qemu-system-ppc -M mac99 -serial stdio
>>>> =============================================================
>>>> OpenBIOS 1.1 [Feb 2 2019 05:05]
>>>> Configuration device id QEMU version 1 machine id 1
>>>> CPUs: 1
>>>> Memory: 128M
>>>> UUID: 00000000-0000-0000-0000-000000000000
>>>> CPU type PowerPC,G4
> 
> and this the 32-bit/big-endian device, is that correct?

Yes.

Note: G4 (ppc) can be either little or big endian, but 970FX, aka G5,
(ppc64) is only big-endian.
Philippe Mathieu-Daudé Oct. 4, 2019, 9:18 a.m. UTC | #6
On 10/4/19 11:14 AM, Laurent Vivier wrote:
> On 04/10/2019 11:03, Philippe Mathieu-Daudé wrote:
>> On 10/4/19 10:59 AM, Laurent Vivier wrote:
>>> On 04/10/2019 10:53, Philippe Mathieu-Daudé wrote:
>>>> On 10/4/19 10:05 AM, Laurent Vivier wrote:
>>>>> On 04/10/2019 00:54, Philippe Mathieu-Daudé wrote:
>>>>>> We have been restricting our fw_cfg tests to the PC machine,
>>>>>> which is a little-endian architecture.
>>>>>> The fw_cfg device is also used on the SPARC and PowerPC
>>>>>> architectures, which can run in big-endian configuration.
>>>>>>
>>>>>> Since we want to be sure our device does not regress
>>>>>> regardless the endianess used, enable this test one
>>>>>> these targets.
>>>>>>
>>>>>> The NUMA selector is X86 specific, restrict it to this arch.
>>>>>>
>>>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>>>>> ---
>>>>>>     tests/Makefile.include |  2 ++
>>>>>>     tests/fw_cfg-test.c    | 18 +++++++++++++++---
>>>>>>     2 files changed, 17 insertions(+), 3 deletions(-)
>>>>>>
>>>>>> diff --git a/tests/Makefile.include b/tests/Makefile.include
>>>>>> index 3543451ed3..322bdb36ff 100644
>>>>>> --- a/tests/Makefile.include
>>>>>> +++ b/tests/Makefile.include
>>>>>> @@ -242,6 +242,7 @@ check-qtest-ppc64-$(CONFIG_VGA) +=
>>>>>> tests/display-vga-test$(EXESUF)
>>>>>>     check-qtest-ppc64-y += tests/numa-test$(EXESUF)
>>>>>>     check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) +=
>>>>>> tests/ivshmem-test$(EXESUF)
>>>>>>     check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
>>>>>> +check-qtest-ppc64-y += tests/fw_cfg-test$(EXESUF)
>>>>>
>>>>> Perhaps only a detail, but ppc64 (pseries) doesn't use fw_cfg, but ppc
>>>>> (mac99, g3beige and prep) does, so perhaps you should rather add the
>>>>> test to check-qtest-ppc-y (and it will be inherited by ppc64)?
>>>>
>>>> The test only runs the mac99 machine.
>>>>
>>>> What happens when running "qemu-system-ppc64 -M mac99"? Does it runs in
>>>> 64-bit?
>>>
>>> Yes, it's way used to emulate a ppc64 powermac (G5)
>>
>> Oh.
>>
>>> $ qemu-system-ppc64 -M mac99 -serial tdio
>>>>> =============================================================
>>>>> OpenBIOS 1.1 [Feb 2 2019 05:05]
>>>>> Configuration device id QEMU version 1 machine id 3
>>>>> CPUs: 1
>>>>> Memory: 128M
>>>>> UUID: 00000000-0000-0000-0000-000000000000
>>>>> CPU type PowerPC,970FX
>>
>> So this would test the 64-bit/big-endian,
>>
>>> $ qemu-system-ppc -M mac99 -serial stdio
>>>>> =============================================================
>>>>> OpenBIOS 1.1 [Feb 2 2019 05:05]
>>>>> Configuration device id QEMU version 1 machine id 1
>>>>> CPUs: 1
>>>>> Memory: 128M
>>>>> UUID: 00000000-0000-0000-0000-000000000000
>>>>> CPU type PowerPC,G4
>>
>> and this the 32-bit/big-endian device, is that correct?
> 
> Yes.
> 
> Note: G4 (ppc) can be either little or big endian, but 970FX, aka G5,
> (ppc64) is only big-endian.

OK thanks! I'll update the tests and add few comments.

Regards,

Phil.
Thomas Huth Oct. 7, 2019, 6:17 a.m. UTC | #7
----- Original Message -----
> Sent: Friday, October 4, 2019 10:05:09 AM
> On 04/10/2019 00:54, Philippe Mathieu-Daudé wrote:
[...]
> > diff --git a/tests/Makefile.include b/tests/Makefile.include
> > index 3543451ed3..322bdb36ff 100644
> > --- a/tests/Makefile.include
> > +++ b/tests/Makefile.include
> > @@ -242,6 +242,7 @@ check-qtest-ppc64-$(CONFIG_VGA) +=
> > tests/display-vga-test$(EXESUF)
> >  check-qtest-ppc64-y += tests/numa-test$(EXESUF)
> >  check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
> >  check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
> > +check-qtest-ppc64-y += tests/fw_cfg-test$(EXESUF)
> 
> Perhaps only a detail, but ppc64 (pseries) doesn't use fw_cfg, but ppc
> (mac99, g3beige and prep) does, so perhaps you should rather add the
> test to check-qtest-ppc-y (and it will be inherited by ppc64)?

Yes, this should go into check-qtest-ppc-y instead of check-qtest-ppc64-y.

 Thanks,
  Thomas
diff mbox series

Patch

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 3543451ed3..322bdb36ff 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -242,6 +242,7 @@  check-qtest-ppc64-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
 check-qtest-ppc64-y += tests/numa-test$(EXESUF)
 check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
 check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
+check-qtest-ppc64-y += tests/fw_cfg-test$(EXESUF)
 
 check-qtest-sh4-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 
@@ -250,6 +251,7 @@  check-qtest-sh4eb-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 check-qtest-sparc-y += tests/prom-env-test$(EXESUF)
 check-qtest-sparc-y += tests/m48t59-test$(EXESUF)
 check-qtest-sparc-y += tests/boot-serial-test$(EXESUF)
+check-qtest-sparc-y += tests/fw_cfg-test$(EXESUF)
 
 check-qtest-sparc64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 check-qtest-sparc64-y += tests/prom-env-test$(EXESUF)
diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index 12dbaf4e67..39bbc9647e 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -209,13 +209,22 @@  static void test_fw_cfg_splash_time(const void *opaque)
 
 int main(int argc, char **argv)
 {
+    const char *arch = qtest_get_arch();
     QTestCtx *ctx = g_new(QTestCtx, 1);
     int ret;
 
     g_test_init(&argc, &argv, NULL);
 
-    ctx->machine_name = "pc";
-    ctx->fw_cfg = pc_fw_cfg_init();
+    if (g_str_equal(arch, "i386") || g_str_equal(arch, "x86_64")) {
+        ctx->machine_name = "pc";
+        ctx->fw_cfg = pc_fw_cfg_init();
+    } else if (g_str_equal(arch, "sparc")) {
+        ctx->machine_name = "SS-5";
+        ctx->fw_cfg = mm_fw_cfg_init(0xd00000510ULL);
+    } else if (g_str_equal(arch, "ppc64")) {
+        ctx->machine_name = "mac99";
+        ctx->fw_cfg = mm_fw_cfg_init(0xf0000510);
+    }
 
     qtest_add_data_func("fw_cfg/signature", ctx, test_fw_cfg_signature);
     qtest_add_data_func("fw_cfg/id", ctx, test_fw_cfg_id);
@@ -230,12 +239,15 @@  int main(int argc, char **argv)
     qtest_add_func("fw_cfg/boot_device", test_fw_cfg_boot_device);
 #endif
     qtest_add_data_func("fw_cfg/max_cpus", ctx, test_fw_cfg_max_cpus);
-    qtest_add_data_func("fw_cfg/numa", ctx, test_fw_cfg_numa);
     qtest_add_data_func("fw_cfg/boot_menu", ctx, test_fw_cfg_boot_menu);
     qtest_add_data_func("fw_cfg/reboot_timeout", ctx,
                         test_fw_cfg_reboot_timeout);
     qtest_add_data_func("fw_cfg/splash_time", ctx, test_fw_cfg_splash_time);
 
+    if (g_str_equal(arch, "i386") || g_str_equal(arch, "x86_64")) {
+        qtest_add_data_func("fw_cfg/numa", ctx, test_fw_cfg_numa);
+    }
+
     ret = g_test_run();
 
     g_free(ctx->fw_cfg);