tests/pxe: Check virtio-net-ccw on s390x
PATCH 1/1 tests/pxe: Check virtio-net-ccw on s390x
Now that we've got a firmware that can do TFTP booting on s390x (i.e. the pc-bios/s390-netboot.img), we can enable the PXE tester for this architecture, too.
---
Since this only adds a test, I guess this could still be included for 2.10 ... otherwise, I think it's also OK to simply postpone this to 2.11 instead
tests/Makefile.include | 1 + tests/boot-sector.c | 25 ++++++++++++++++++++++--- tests/pxe-test.c | 7 +++++++ 3 files changed, 30 insertions(+), 3 deletions(-)
tests/Makefile.include +1 -0
@@ -337,6 +337,7 @@ check-qtest-microblazeel-y = $(check-qtest-microblaze-y) check-qtest-xtensaeb-y = $(check-qtest-xtensa-y) check-qtest-s390x-y = tests/boot-serial-test$(EXESUF) +check-qtest-s390x-y += tests/pxe-test$(EXESUF) check-qtest-generic-y += tests/qom-test$(EXESUF) check-qtest-generic-y += tests/test-hmp$(EXESUF)
tests/boot-sector.c +22 -3
@@ -21,6 +21,7 @@#define SIGNATURE 0xdead#define SIGNATURE_OFFSET 0x10#define BOOT_SECTOR_ADDRESS 0x7c00 +#define SIGNATURE_ADDR (BOOT_SECTOR_ADDRESS + SIGNATURE_OFFSET)/* Boot sector code: write SIGNATURE into memory, * then halt.
@@ -73,6 +74,7 @@ int boot_sector_init(char *fname) {int fd, ret;size_t len =sizeof boot_sector; +const char *arch =qtest_get_arch (); fd =mkstemp (fname);if (fd <0 ) {
@@ -81,10 +83,27 @@ int boot_sector_init(char *fname) }/* For Open Firmware based system, we can use a Forth script instead */ -if (strcmp (qtest_get_arch (),"ppc64" ) ==0 ) { +if (g_str_equal (arch,"ppc64" )) { len =sprintf ((char *)boot_sector,"\\ Bootscript\n%x %x c! %x %x c!\n" , -LOW (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET , -HIGH (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET +1 ); +LOW (SIGNATURE ),SIGNATURE_ADDR , +HIGH (SIGNATURE ),SIGNATURE_ADDR +1 ); + }else if (g_str_equal (arch,"s390x" )) { +/* For s390x, fake a kernel signature */ +const uint8_t psw[] = { +0x00 ,0x08 ,0x00 ,0x00 ,0x80 ,0x01 ,0x00 ,0x00 + }; +const uint8_t code[] = { +0xa7 ,0xf4 ,0x00 ,0x0a ,/* j 0x10010 */ +0x00 ,0x00 ,0x00 ,0x00 , +'S' ,'3' ,'9' ,'0' , +'E' ,'P' ,0x00 ,0x01 , +0xa7 ,0x38 ,HIGH (SIGNATURE_ADDR ),LOW (SIGNATURE_ADDR ),/* lhi r3 */ +0xa7 ,0x48 ,LOW (SIGNATURE ),HIGH (SIGNATURE ),/* lhi r4,0xadde */ +0x40 ,0x40 ,0x30 ,0x00 ,/* sth r4,0(r3) */ +0xa7 ,0xf4 ,0xff ,0xfa /* j 0x10010 */ + }; +memcpy (boot_sector, psw,8 ); +memcpy (&boot_sector[0x10000 ], code,sizeof (code)); } ret =write (fd, boot_sector, len);
tests/pxe-test.c +7 -0
@@ -51,6 +51,11 @@ static void test_pxe_spapr_vlan(void)test_pxe_one ("-device spapr-vlan,netdev=" NETNAME , true); } +static void test_pxe_virtio_ccw (void ) +{ +test_pxe_one ("-device virtio-net-ccw,bootindex=1,netdev=" NETNAME , false); +} +int main (int argc,char *argv[]) {int ret;
@@ -68,6 +73,8 @@ int main(int argc, char *argv[]) }else if (strcmp (arch,"ppc64" ) ==0 ) {qtest_add_func ("pxe/virtio" , test_pxe_virtio_pci);qtest_add_func ("pxe/spapr-vlan" , test_pxe_spapr_vlan); + }else if (g_str_equal (arch,"s390x" )) { +qtest_add_func ("pxe/virtio-ccw" , test_pxe_virtio_ccw); } ret =g_test_run ();boot_sector_cleanup (disk);
Signature · 1 line
1.8.3.1
Quoted 9 lines · On Thu, 3 Aug 2017 15:30:19 +0200 Thomas Huth <[email protected]> wrote:
Now that we've got a firmware that can do TFTP booting on s390x (i.e. the pc-bios/s390-netboot.img), we can enable the PXE tester for this architecture, too.
Signed-off-by Thomas Huth <[email protected]>---
Since this only adds a test, I guess this could still be included for 2.10 ... otherwise, I think it's also OK to simply postpone this to 2.11 instead
Personally, I think it is a bit late for non-bugfixes - even if it is just a test.
Quoted 86 lines
tests/Makefile.include | 1 + tests/boot-sector.c | 25 ++++++++++++++++++++++--- tests/pxe-test.c | 7 +++++++ 3 files changed, 30 insertions(+), 3 deletions(-)tests/Makefile.include +1
-0@@ -337,6 +337,7 @@ check-qtest-microblazeel-y = $(check-qtest-microblaze-y) check-qtest-xtensaeb-y = $(check-qtest-xtensa-y) check-qtest-s390x-y = tests/boot-serial-test$(EXESUF) +check-qtest-s390x-y += tests/pxe-test$(EXESUF) check-qtest-generic-y += tests/qom-test$(EXESUF) check-qtest-generic-y += tests/test-hmp$(EXESUF)tests/boot-sector.c +22
-3@@ -21,6 +21,7 @@#define SIGNATURE 0xdead#define SIGNATURE_OFFSET 0x10#define BOOT_SECTOR_ADDRESS 0x7c00 +#define SIGNATURE_ADDR (BOOT_SECTOR_ADDRESS + SIGNATURE_OFFSET)/* Boot sector code: write SIGNATURE into memory, * then halt. @@ -73,6 +74,7 @@ int boot_sector_init(char *fname) {int fd, ret;size_t len =sizeof boot_sector; +const char *arch =qtest_get_arch (); fd =mkstemp (fname);if (fd <0 ) {@@ -81,10 +83,27 @@ int boot_sector_init(char *fname) }/* For Open Firmware based system, we can use a Forth script instead */ -if (strcmp (qtest_get_arch (),"ppc64" ) ==0 ) { +if (g_str_equal (arch,"ppc64" )) { len =sprintf ((char *)boot_sector,"\\ Bootscript\n%x %x c! %x %x c!\n" , -LOW (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET , -HIGH (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET +1 ); +LOW (SIGNATURE ),SIGNATURE_ADDR , +HIGH (SIGNATURE ),SIGNATURE_ADDR +1 ); + }else if (g_str_equal (arch,"s390x" )) { +/* For s390x, fake a kernel signature */ +const uint8_t psw[] = { +0x00 ,0x08 ,0x00 ,0x00 ,0x80 ,0x01 ,0x00 ,0x00 + }; +const uint8_t code[] = { +0xa7 ,0xf4 ,0x00 ,0x0a ,/* j 0x10010 */ +0x00 ,0x00 ,0x00 ,0x00 , +'S' ,'3' ,'9' ,'0' , +'E' ,'P' ,0x00 ,0x01 , +0xa7 ,0x38 ,HIGH (SIGNATURE_ADDR ),LOW (SIGNATURE_ADDR ),/* lhi r3 */ +0xa7 ,0x48 ,LOW (SIGNATURE ),HIGH (SIGNATURE ),/* lhi r4,0xadde */ +0x40 ,0x40 ,0x30 ,0x00 ,/* sth r4,0(r3) */ +0xa7 ,0xf4 ,0xff ,0xfa /* j 0x10010 */ + }; +memcpy (boot_sector, psw,8 ); +memcpy (&boot_sector[0x10000 ], code,sizeof (code)); } ret =write (fd, boot_sector, len);tests/pxe-test.c +5
-0@@ -51,6 +51,11 @@ static void test_pxe_spapr_vlan(void)test_pxe_one ("-device spapr-vlan,netdev=" NETNAME , true); } +static void test_pxe_virtio_ccw (void ) +{ +test_pxe_one ("-device virtio-net-ccw,bootindex=1,netdev=" NETNAME , false); +} +int main (int argc,char *argv[]) {int ret;
tests/pxe-test.c int main(int argc, char *argv[]) · line 80
Quoted 8 lines
tests/pxe-test.c +2
-0@@ -68,6 +73,8 @@ int main(int argc, char *argv[]) }else if (strcmp (arch,"ppc64" ) ==0 ) {qtest_add_func ("pxe/virtio" , test_pxe_virtio_pci);qtest_add_func ("pxe/spapr-vlan" , test_pxe_spapr_vlan); + }else if (g_str_equal (arch,"s390x" )) { +qtest_add_func ("pxe/virtio-ccw" , test_pxe_virtio_ccw); } ret =g_test_run ();boot_sector_cleanup (disk);
No objection, but I'll have to look at this some more as I'm not familiar with the test.
Quoted 3 lines · On Thu, 3 Aug 2017 15:30:19 +0200 Thomas Huth <[email protected]> wrote:
Now that we've got a firmware that can do TFTP booting on s390x (i.e. the pc-bios/s390-netboot.img), we can enable the PXE tester for this architecture, too.
I'll take this through the s390x tree, unless someone objects.
Quoted 11 lines
Signed-off-by Thomas Huth <[email protected]>---
Since this only adds a test, I guess this could still be included for 2.10 ... otherwise, I think it's also OK to simply postpone this to 2.11 insteadtests/Makefile.include | 1 + tests/boot-sector.c | 25 ++++++++++++++++++++++--- tests/pxe-test.c | 7 +++++++ 3 files changed, 30 insertions(+), 3 deletions(-)
Quoted 9 lines · Thomas Huth
Now that we've got a firmware that can do TFTP booting on s390x (i.e. the pc-bios/s390-netboot.img), we can enable the PXE tester for this architecture, too.
Signed-off-by Thomas Huth <[email protected]>---
Since this only adds a test, I guess this could still be included for 2.10 ... otherwise, I think it's also OK to simply postpone this to 2.11 instead
I think 2.11 is preferable.
Quoted 55 lines
tests/Makefile.include | 1 + tests/boot-sector.c | 25 ++++++++++++++++++++++--- tests/pxe-test.c | 7 +++++++ 3 files changed, 30 insertions(+), 3 deletions(-)tests/Makefile.include +1
-0@@ -337,6 +337,7 @@ check-qtest-microblazeel-y = $(check-qtest-microblaze-y) check-qtest-xtensaeb-y = $(check-qtest-xtensa-y) check-qtest-s390x-y = tests/boot-serial-test$(EXESUF) +check-qtest-s390x-y += tests/pxe-test$(EXESUF) check-qtest-generic-y += tests/qom-test$(EXESUF) check-qtest-generic-y += tests/test-hmp$(EXESUF)tests/boot-sector.c +12
-3@@ -21,6 +21,7 @@#define SIGNATURE 0xdead#define SIGNATURE_OFFSET 0x10#define BOOT_SECTOR_ADDRESS 0x7c00 +#define SIGNATURE_ADDR (BOOT_SECTOR_ADDRESS + SIGNATURE_OFFSET)/* Boot sector code: write SIGNATURE into memory, * then halt. @@ -73,6 +74,7 @@ int boot_sector_init(char *fname) {int fd, ret;size_t len =sizeof boot_sector; +const char *arch =qtest_get_arch (); fd =mkstemp (fname);if (fd <0 ) {@@ -81,10 +83,27 @@ int boot_sector_init(char *fname) }/* For Open Firmware based system, we can use a Forth script instead */ -if (strcmp (qtest_get_arch (),"ppc64" ) ==0 ) { +if (g_str_equal (arch,"ppc64" )) { len =sprintf ((char *)boot_sector,"\\ Bootscript\n%x %x c! %x %x c!\n" , -LOW (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET , -HIGH (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET +1 ); +LOW (SIGNATURE ),SIGNATURE_ADDR , +HIGH (SIGNATURE ),SIGNATURE_ADDR +1 ); + }else if (g_str_equal (arch,"s390x" )) { +/* For s390x, fake a kernel signature */ +const uint8_t psw[] = { +0x00 ,0x08 ,0x00 ,0x00 ,0x80 ,0x01 ,0x00 ,0x00 + }; +const uint8_t code[] = { +0xa7 ,0xf4 ,0x00 ,0x0a ,/* j 0x10010 */
tests/boot-sector.c int boot_sector_init(char *fname) · line 106
Quoted 10 lines
tests/boot-sector.c +10
-0+0x00 ,0x00 ,0x00 ,0x00 , +'S' ,'3' ,'9' ,'0' , +'E' ,'P' ,0x00 ,0x01 , +0xa7 ,0x38 ,HIGH (SIGNATURE_ADDR ),LOW (SIGNATURE_ADDR ),/* lhi r3 */ +0xa7 ,0x48 ,LOW (SIGNATURE ),HIGH (SIGNATURE ),/* lhi r4,0xadde */ +0x40 ,0x40 ,0x30 ,0x00 ,/* sth r4,0(r3) */ +0xa7 ,0xf4 ,0xff ,0xfa /* j 0x10010 */ + }; +memcpy (boot_sector, psw,8 ); +memcpy (&boot_sector[0x10000 ], code,sizeof (code));
Could we avoid overwriting boot sector?
We really should havex86_boot_sectorppc64_boot_sectors390_boot_sector
And write out the correct thing.
Also:
* Q35 machine requires a minimum 0x7e000 bytes disk.
* (bug or feature?)
probably does not apply to s390x, does it?
BTW I'm guessing it actually does not apply to the pxe test at all.
Quoted 30 lines
tests/boot-sector.c +0
-0} ret =write (fd, boot_sector, len);tests/pxe-test.c +7
-0@@ -51,6 +51,11 @@ static void test_pxe_spapr_vlan(void)test_pxe_one ("-device spapr-vlan,netdev=" NETNAME , true); } +static void test_pxe_virtio_ccw (void ) +{ +test_pxe_one ("-device virtio-net-ccw,bootindex=1,netdev=" NETNAME , false); +} +int main (int argc,char *argv[]) {int ret;@@ -68,6 +73,8 @@ int main(int argc, char *argv[]) }else if (strcmp (arch,"ppc64" ) ==0 ) {qtest_add_func ("pxe/virtio" , test_pxe_virtio_pci);qtest_add_func ("pxe/spapr-vlan" , test_pxe_spapr_vlan); + }else if (g_str_equal (arch,"s390x" )) { +qtest_add_func ("pxe/virtio-ccw" , test_pxe_virtio_ccw); } ret =g_test_run ();boot_sector_cleanup (disk);Signature · 1 line
1.8.3.1
Quoted 86 lines · Michael S. Tsirkin
Quoted 9 lines · Thomas Huth
Now that we've got a firmware that can do TFTP booting on s390x (i.e. the pc-bios/s390-netboot.img), we can enable the PXE tester for this architecture, too.
Signed-off-by Thomas Huth <[email protected]>---
Since this only adds a test, I guess this could still be included for 2.10 ... otherwise, I think it's also OK to simply postpone this to 2.11 insteadI think 2.11 is preferable.
Quoted 55 lines
tests/Makefile.include | 1 + tests/boot-sector.c | 25 ++++++++++++++++++++++--- tests/pxe-test.c | 7 +++++++ 3 files changed, 30 insertions(+), 3 deletions(-)tests/Makefile.include +1
-0@@ -337,6 +337,7 @@ check-qtest-microblazeel-y = $(check-qtest-microblaze-y) check-qtest-xtensaeb-y = $(check-qtest-xtensa-y) check-qtest-s390x-y = tests/boot-serial-test$(EXESUF) +check-qtest-s390x-y += tests/pxe-test$(EXESUF) check-qtest-generic-y += tests/qom-test$(EXESUF) check-qtest-generic-y += tests/test-hmp$(EXESUF)tests/boot-sector.c +12
-3@@ -21,6 +21,7 @@#define SIGNATURE 0xdead#define SIGNATURE_OFFSET 0x10#define BOOT_SECTOR_ADDRESS 0x7c00 +#define SIGNATURE_ADDR (BOOT_SECTOR_ADDRESS + SIGNATURE_OFFSET)/* Boot sector code: write SIGNATURE into memory, * then halt. @@ -73,6 +74,7 @@ int boot_sector_init(char *fname) {int fd, ret;size_t len =sizeof boot_sector; +const char *arch =qtest_get_arch (); fd =mkstemp (fname);if (fd <0 ) {@@ -81,10 +83,27 @@ int boot_sector_init(char *fname) }/* For Open Firmware based system, we can use a Forth script instead */ -if (strcmp (qtest_get_arch (),"ppc64" ) ==0 ) { +if (g_str_equal (arch,"ppc64" )) { len =sprintf ((char *)boot_sector,"\\ Bootscript\n%x %x c! %x %x c!\n" , -LOW (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET , -HIGH (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET +1 ); +LOW (SIGNATURE ),SIGNATURE_ADDR , +HIGH (SIGNATURE ),SIGNATURE_ADDR +1 ); + }else if (g_str_equal (arch,"s390x" )) { +/* For s390x, fake a kernel signature */ +const uint8_t psw[] = { +0x00 ,0x08 ,0x00 ,0x00 ,0x80 ,0x01 ,0x00 ,0x00 + }; +const uint8_t code[] = { +0xa7 ,0xf4 ,0x00 ,0x0a ,/* j 0x10010 */ tests/boot-sector.c int boot_sector_init(char *fname) · line 106
Quoted 10 lines
tests/boot-sector.c +10
-0+0x00 ,0x00 ,0x00 ,0x00 , +'S' ,'3' ,'9' ,'0' , +'E' ,'P' ,0x00 ,0x01 , +0xa7 ,0x38 ,HIGH (SIGNATURE_ADDR ),LOW (SIGNATURE_ADDR ),/* lhi r3 */ +0xa7 ,0x48 ,LOW (SIGNATURE ),HIGH (SIGNATURE ),/* lhi r4,0xadde */ +0x40 ,0x40 ,0x30 ,0x00 ,/* sth r4,0(r3) */ +0xa7 ,0xf4 ,0xff ,0xfa /* j 0x10010 */ + }; +memcpy (boot_sector, psw,8 ); +memcpy (&boot_sector[0x10000 ], code,sizeof (code));Could we avoid overwriting boot sector?
We really should havex86_boot_sectorppc64_boot_sectors390_boot_sector
Quoted 1 line
And write out the correct thing.
Ok, I don't mind either way ... I can try to come up with a patch.
Quoted 5 lines
Also:
* Q35 machine requires a minimum0x7e000bytes disk.
* (bug or feature?)probably does not apply to s390x, does it?
We can also just load 0x10000 + sizeof(code) bytes here. I'll fix it.
Cornelia, please unqueue the patch, I'll send a v2...
Thomas
Quoted 44 lines · On Tue, 8 Aug 2017 07:19:54 +0200 Thomas Huth <[email protected]> wrote:
Quoted 43 lines · Michael S. Tsirkin
Quoted 24 lines · Thomas Huth
Now that we've got a firmware that can do TFTP booting on s390x (i.e. the pc-bios/s390-netboot.img), we can enable the PXE tester for this architecture, too.
Signed-off-by Thomas Huth <[email protected]>tests/boot-sector.c +10
-3@@ -81,10 +83,27 @@ int boot_sector_init(char *fname) }/* For Open Firmware based system, we can use a Forth script instead */ -if (strcmp (qtest_get_arch (),"ppc64" ) ==0 ) { +if (g_str_equal (arch,"ppc64" )) { len =sprintf ((char *)boot_sector,"\\ Bootscript\n%x %x c! %x %x c!\n" , -LOW (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET , -HIGH (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET +1 ); +LOW (SIGNATURE ),SIGNATURE_ADDR , +HIGH (SIGNATURE ),SIGNATURE_ADDR +1 ); + }else if (g_str_equal (arch,"s390x" )) { +/* For s390x, fake a kernel signature */ +const uint8_t psw[] = { +0x00 ,0x08 ,0x00 ,0x00 ,0x80 ,0x01 ,0x00 ,0x00 + }; +const uint8_t code[] = { +0xa7 ,0xf4 ,0x00 ,0x0a ,/* j 0x10010 */ tests/boot-sector.c int boot_sector_init(char *fname) · line 106
Quoted 10 lines
tests/boot-sector.c +10
-0+0x00 ,0x00 ,0x00 ,0x00 , +'S' ,'3' ,'9' ,'0' , +'E' ,'P' ,0x00 ,0x01 , +0xa7 ,0x38 ,HIGH (SIGNATURE_ADDR ),LOW (SIGNATURE_ADDR ),/* lhi r3 */ +0xa7 ,0x48 ,LOW (SIGNATURE ),HIGH (SIGNATURE ),/* lhi r4,0xadde */ +0x40 ,0x40 ,0x30 ,0x00 ,/* sth r4,0(r3) */ +0xa7 ,0xf4 ,0xff ,0xfa /* j 0x10010 */ + }; +memcpy (boot_sector, psw,8 ); +memcpy (&boot_sector[0x10000 ], code,sizeof (code));Could we avoid overwriting boot sector?
We really should havex86_boot_sectorppc64_boot_sectors390_boot_sector
Quoted 1 line
Quoted 1 line
And write out the correct thing.
That sounds good.
Quoted 7 lines
Ok, I don't mind either way ... I can try to come up with a patch.
Quoted 4 lines
Also:
* Q35 machine requires a minimum0x7e000bytes disk.
* (bug or feature?)
Quoted 5 lines
Quoted 1 line
probably does not apply to s390x, does it?
We can also just load
0x10000+ sizeof(code) bytes here. I'll fix it.Cornelia, please unqueue the patch, I'll send a v2...
OK, I had not yet pushed out anyway.