From patchwork Thu Aug 3 13:30:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 9879113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5266060311 for ; Thu, 3 Aug 2017 13:31:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 447E527480 for ; Thu, 3 Aug 2017 13:31:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3934628900; Thu, 3 Aug 2017 13:31:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A8349288FA for ; Thu, 3 Aug 2017 13:31:06 +0000 (UTC) Received: from localhost ([::1]:42983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddGDR-0000Sx-E5 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 03 Aug 2017 09:31:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddGCs-0000SY-8p for qemu-devel@nongnu.org; Thu, 03 Aug 2017 09:30:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddGCo-0003ad-BL for qemu-devel@nongnu.org; Thu, 03 Aug 2017 09:30:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38016) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ddGCo-0003ZT-2R for qemu-devel@nongnu.org; Thu, 03 Aug 2017 09:30:26 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ACA93C04B927; Thu, 3 Aug 2017 13:30:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com ACA93C04B927 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=thuth@redhat.com Received: from thh440s.redhat.com (ovpn-117-212.ams2.redhat.com [10.36.117.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25A1278907; Thu, 3 Aug 2017 13:30:19 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Cornelia Huck Date: Thu, 3 Aug 2017 15:30:19 +0200 Message-Id: <1501767019-4989-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 03 Aug 2017 13:30:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] tests/pxe: Check virtio-net-ccw on s390x X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Borntraeger , Jason Wang , Victor Kaplansky , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);