From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Cornelia Huck <cohuck@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Victor Kaplansky <victork@redhat.com>
Subject: [Qemu-devel] [PATCH] tests/pxe: Check virtio-net-ccw on s390x
Date: Thu, 3 Aug 2017 15:30:19 +0200 [thread overview]
Message-ID: <1501767019-4989-1-git-send-email-thuth@redhat.com> (raw)
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 <thuth@redhat.com>
---
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(-)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 59e536b..f9af5e3 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -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)
diff --git a/tests/boot-sector.c b/tests/boot-sector.c
index e3880f4..87a8fb5 100644
--- a/tests/boot-sector.c
+++ b/tests/boot-sector.c
@@ -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);
diff --git a/tests/pxe-test.c b/tests/pxe-test.c
index cf6e225..0d70afc 100644
--- a/tests/pxe-test.c
+++ b/tests/pxe-test.c
@@ -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);
--
1.8.3.1
next reply other threads:[~2017-08-03 13:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-03 13:30 Thomas Huth [this message]
2017-08-03 15:20 ` [Qemu-devel] [PATCH] tests/pxe: Check virtio-net-ccw on s390x Cornelia Huck
2017-08-07 16:09 ` Cornelia Huck
2017-08-07 20:35 ` Michael S. Tsirkin
2017-08-08 5:19 ` Thomas Huth
2017-08-08 7:26 ` Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1501767019-4989-1-git-send-email-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=victork@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).