From nobody Tue Apr 30 19:05:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512032147176591.7259878347666; Thu, 30 Nov 2017 00:55:47 -0800 (PST) Received: from localhost ([::1]:46861 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKd1-0006QU-0M for importer@patchew.org; Thu, 30 Nov 2017 03:55:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKat-0005AC-Co for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKKas-0006fy-MS for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60156) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKKap-0006dE-Ni; Thu, 30 Nov 2017 03:53:15 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BAABFC04AC41; Thu, 30 Nov 2017 08:53:14 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id D239E5D6A5; Thu, 30 Nov 2017 08:53:11 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 09:53:02 +0100 Message-Id: <1512031988-32490-2-git-send-email-thuth@redhat.com> In-Reply-To: <1512031988-32490-1-git-send-email-thuth@redhat.com> References: <1512031988-32490-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 30 Nov 2017 08:53:14 +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 for-2.12 1/7] tests/boot-serial-test: Make sure that we check the timeout regularly 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: Anthony Green , Laurent Vivier , qemu-arm@nongnu.org, Edgar Iglesias , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If the guest continuesly writes characters to the UART, we never leave the inner while loop and thus never check whether we've reached the timeout value. So if we fail to find the expected string in the UART output, the test just hangs and never finishs. Use a counter to regularly break out of the while loop to check the timeout. Signed-off-by: Thomas Huth --- tests/boot-serial-test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index c935d69..fa4183d 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -43,12 +43,13 @@ static testdef_t tests[] =3D { static void check_guest_output(const testdef_t *test, int fd) { bool output_ok =3D false; - int i, nbr, pos =3D 0; + int i, nbr, pos =3D 0, ccnt; char ch; =20 /* Poll serial output... Wait at most 60 seconds */ for (i =3D 0; i < 6000; ++i) { - while ((nbr =3D read(fd, &ch, 1)) =3D=3D 1) { + ccnt =3D 0; + while ((nbr =3D read(fd, &ch, 1)) =3D=3D 1 && ccnt++ < 512) { if (ch =3D=3D test->expect[pos]) { pos +=3D 1; if (test->expect[pos] =3D=3D '\0') { --=20 1.8.3.1 From nobody Tue Apr 30 19:05:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512032378785124.60280520047127; Thu, 30 Nov 2017 00:59:38 -0800 (PST) Received: from localhost ([::1]:46888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKgv-0001st-5c for importer@patchew.org; Thu, 30 Nov 2017 03:59:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKaw-0005Ck-Hp for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKKav-0006l7-HL for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60214) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKKas-0006fX-Sv; Thu, 30 Nov 2017 03:53:19 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BDD67C04D318; Thu, 30 Nov 2017 08:53:17 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22A425D6A5; Thu, 30 Nov 2017 08:53:14 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 09:53:03 +0100 Message-Id: <1512031988-32490-3-git-send-email-thuth@redhat.com> In-Reply-To: <1512031988-32490-1-git-send-email-thuth@redhat.com> References: <1512031988-32490-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 30 Nov 2017 08:53:17 +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 for-2.12 2/7] tests/boot-serial-test: Add code to allow to specify our own kernel or bios 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: Anthony Green , Laurent Vivier , qemu-arm@nongnu.org, Edgar Iglesias , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" QEMU only ships with some few firmware images, i.e. we can currently run the boot-serial test only on a very limited set of machines. But writing some characters to the default UART of a machine can often be done with some few lines of assembly, so we add the possibility to the boot-serial tester to use its own mini-kernels or mini-firmwares. We write such images then into a file that we can load with the "-kernel" or "-bios" parameter when we launch QEMU. Signed-off-by: Thomas Huth --- tests/Makefile.include | 2 ++ tests/boot-serial-test.c | 54 +++++++++++++++++++++++++++++++++++++-------= ---- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index c002352..41ca44c 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -297,6 +297,8 @@ gcov-files-x86_64-y =3D $(subst i386-softmmu/,x86_64-so= ftmmu/,$(gcov-files-i386-y) =20 check-qtest-alpha-y =3D tests/boot-serial-test$(EXESUF) =20 +check-qtest-m68k-y =3D tests/boot-serial-test$(EXESUF) + check-qtest-mips-y =3D tests/endianness-test$(EXESUF) =20 check-qtest-mips64-y =3D tests/endianness-test$(EXESUF) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index fa4183d..d997269 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -7,9 +7,10 @@ * or later. See the COPYING file in the top-level directory. * * This test is used to check that the serial output of the firmware - * (that we provide for some machines) contains an expected string. - * Thus we check that the firmware still boots at least to a certain - * point and so we know that the machine is not completely broken. + * (that we provide for some machines) or some small mini-kernels that + * we provide here contains an expected string. Thus we check that the + * firmware/kernel still boots at least to a certain point and so we + * know that the machine is not completely broken. */ =20 #include "qemu/osdep.h" @@ -20,6 +21,9 @@ typedef struct testdef { const char *machine; /* Name of the machine */ const char *extra; /* Additional parameters */ const char *expect; /* Expected string in the serial output */ + size_t codesize; /* Size of the kernel or bios data */ + const uint8_t *kernel; /* Set in case we use our own mini kernel */ + const uint8_t *bios; /* Set in case we use our own mini bios */ } testdef_t; =20 static testdef_t tests[] =3D { @@ -72,26 +76,52 @@ done: static void test_machine(const void *data) { const testdef_t *test =3D data; - char tmpname[] =3D "/tmp/qtest-boot-serial-XXXXXX"; - int fd; + char serialtmp[] =3D "/tmp/qtest-boot-serial-sXXXXXX"; + char codetmp[] =3D "/tmp/qtest-boot-serial-cXXXXXX"; + const char *codeparam =3D ""; + const uint8_t *code =3D NULL; + int ser_fd; =20 - fd =3D mkstemp(tmpname); - g_assert(fd !=3D -1); + ser_fd =3D mkstemp(serialtmp); + g_assert(ser_fd !=3D -1); + + if (test->kernel) { + code =3D test->kernel; + codeparam =3D "-kernel"; + } else if (test->bios) { + code =3D test->bios; + codeparam =3D "-bios"; + } + + if (code) { + ssize_t wlen; + int code_fd; + + code_fd =3D mkstemp(codetmp); + g_assert(code_fd !=3D -1); + wlen =3D write(code_fd, code, test->codesize); + g_assert(wlen =3D=3D test->codesize); + close(code_fd); + } =20 /* * Make sure that this test uses tcg if available: It is used as a * fast-enough smoketest for that. */ - global_qtest =3D qtest_startf("-M %s,accel=3Dtcg:kvm " + global_qtest =3D qtest_startf("%s %s -M %s,accel=3Dtcg:kvm " "-chardev file,id=3Dserial0,path=3D%s " "-no-shutdown -serial chardev:serial0 %s", - test->machine, tmpname, test->extra); - unlink(tmpname); + codeparam, code ? codetmp : "", + test->machine, serialtmp, test->extra); + unlink(serialtmp); + if (code) { + unlink(codetmp); + } =20 - check_guest_output(test, fd); + check_guest_output(test, ser_fd); qtest_quit(global_qtest); =20 - close(fd); + close(ser_fd); } =20 int main(int argc, char *argv[]) --=20 1.8.3.1 From nobody Tue Apr 30 19:05:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512032147541656.6036916123087; Thu, 30 Nov 2017 00:55:47 -0800 (PST) Received: from localhost ([::1]:46862 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKd3-0006Sv-Rl for importer@patchew.org; Thu, 30 Nov 2017 03:55:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKb1-0005Ft-Q8 for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKKaw-0006nB-V1 for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41962) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKKau-0006k2-Rh; Thu, 30 Nov 2017 03:53:20 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE92872D16; Thu, 30 Nov 2017 08:53:19 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B66B5D6A5; Thu, 30 Nov 2017 08:53:17 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 09:53:04 +0100 Message-Id: <1512031988-32490-4-git-send-email-thuth@redhat.com> In-Reply-To: <1512031988-32490-1-git-send-email-thuth@redhat.com> References: <1512031988-32490-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Nov 2017 08:53:20 +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 for-2.12 3/7] tests/boot-serial-test: Add support for the mcf5208evb board 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: Anthony Green , Laurent Vivier , qemu-arm@nongnu.org, Edgar Iglesias , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We can output a character quite easily here with some few lines of assembly that we provide as a mini-kernel for this board. Signed-off-by: Thomas Huth --- tests/boot-serial-test.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index d997269..dd3828c 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -16,6 +16,14 @@ #include "qemu/osdep.h" #include "libqtest.h" =20 +static const uint8_t kernel_mcf5208[] =3D { + 0x41, 0xf9, 0xfc, 0x06, 0x00, 0x00, /* lea 0xfc060000,%a0 */ + 0x10, 0x3c, 0x00, 0x54, /* move.b #'T',%d0 */ + 0x11, 0x7c, 0x00, 0x04, 0x00, 0x08, /* move.b #4,8(%a0) Enable= TX */ + 0x11, 0x40, 0x00, 0x0c, /* move.b %d0,12(%a0) Print = 'T' */ + 0x60, 0xfa /* bra.s loop */ +}; + typedef struct testdef { const char *arch; /* Target architecture */ const char *machine; /* Name of the machine */ @@ -41,6 +49,8 @@ static testdef_t tests[] =3D { { "x86_64", "q35", "-device sga", "SGABIOS" }, { "s390x", "s390-ccw-virtio", "-nodefaults -device sclpconsole,chardev=3Dserial0", "virtio device"= }, + { "m68k", "mcf5208evb", "", "TT", sizeof(kernel_mcf5208), kernel_mcf52= 08 }, + { NULL } }; =20 --=20 1.8.3.1 From nobody Tue Apr 30 19:05:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512032461719609.2664105802369; Thu, 30 Nov 2017 01:01:01 -0800 (PST) Received: from localhost ([::1]:46896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKi8-0002XQ-Ad for importer@patchew.org; Thu, 30 Nov 2017 04:00:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49094) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKb3-0005Hq-Rs for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKKb3-0006su-3U for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44754) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKKb0-0006qU-08; Thu, 30 Nov 2017 03:53:26 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EEC3285547; Thu, 30 Nov 2017 08:53:24 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 581C75D6A9; Thu, 30 Nov 2017 08:53:20 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 09:53:05 +0100 Message-Id: <1512031988-32490-5-git-send-email-thuth@redhat.com> In-Reply-To: <1512031988-32490-1-git-send-email-thuth@redhat.com> References: <1512031988-32490-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 30 Nov 2017 08:53:25 +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 for-2.12 4/7] tests/boot-serial-test: Add tests for microblaze boards 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: Anthony Green , Laurent Vivier , qemu-arm@nongnu.org, Edgar Iglesias , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This adds two simple TCG + UART tests for the microblaze boards, one in big endian mode, and one in little endian mode. Signed-off-by: Thomas Huth --- tests/Makefile.include | 2 ++ tests/boot-serial-test.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tests/Makefile.include b/tests/Makefile.include index 41ca44c..cd908da 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -299,6 +299,8 @@ check-qtest-alpha-y =3D tests/boot-serial-test$(EXESUF) =20 check-qtest-m68k-y =3D tests/boot-serial-test$(EXESUF) =20 +check-qtest-microblaze-y =3D tests/boot-serial-test$(EXESUF) + check-qtest-mips-y =3D tests/endianness-test$(EXESUF) =20 check-qtest-mips64-y =3D tests/endianness-test$(EXESUF) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index dd3828c..a39273a 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -24,6 +24,22 @@ static const uint8_t kernel_mcf5208[] =3D { 0x60, 0xfa /* bra.s loop */ }; =20 +static const uint8_t kernel_pls3adsp1800[] =3D { + 0xb0, 0x00, 0x84, 0x00, /* imm 0x8400 */ + 0x30, 0x60, 0x00, 0x04, /* addik r3,r0,4 */ + 0x30, 0x80, 0x00, 0x54, /* addik r4,r0,'T' */ + 0xf0, 0x83, 0x00, 0x00, /* sbi r4,r3,0 */ + 0xb8, 0x00, 0xff, 0xfc /* bri -4 loop */ +}; + +static const uint8_t kernel_plml605[] =3D { + 0xe0, 0x83, 0x00, 0xb0, /* imm 0x83e0 */ + 0x00, 0x10, 0x60, 0x30, /* addik r3,r0,0x1000 */ + 0x54, 0x00, 0x80, 0x30, /* addik r4,r0,'T' */ + 0x00, 0x00, 0x83, 0xf0, /* sbi r4,r3,0 */ + 0xfc, 0xff, 0x00, 0xb8 /* bri -4 loop */ +}; + typedef struct testdef { const char *arch; /* Target architecture */ const char *machine; /* Name of the machine */ @@ -50,6 +66,10 @@ static testdef_t tests[] =3D { { "s390x", "s390-ccw-virtio", "-nodefaults -device sclpconsole,chardev=3Dserial0", "virtio device"= }, { "m68k", "mcf5208evb", "", "TT", sizeof(kernel_mcf5208), kernel_mcf52= 08 }, + { "microblaze", "petalogix-s3adsp1800", "", "TT", + sizeof(kernel_pls3adsp1800), kernel_pls3adsp1800 }, + { "microblazeel", "petalogix-ml605", "", "TT", + sizeof(kernel_plml605), kernel_plml605 }, =20 { NULL } }; --=20 1.8.3.1 From nobody Tue Apr 30 19:05:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512032157041874.2325644741688; Thu, 30 Nov 2017 00:55:57 -0800 (PST) Received: from localhost ([::1]:46869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKdJ-0006iu-7b for importer@patchew.org; Thu, 30 Nov 2017 03:55:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKb6-0005K0-AV for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKKb5-0006uB-EA for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32948) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKKb3-0006sU-5p; Thu, 30 Nov 2017 03:53:29 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C9884A6F3; Thu, 30 Nov 2017 08:53:28 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5311E5D6A9; Thu, 30 Nov 2017 08:53:25 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 09:53:06 +0100 Message-Id: <1512031988-32490-6-git-send-email-thuth@redhat.com> In-Reply-To: <1512031988-32490-1-git-send-email-thuth@redhat.com> References: <1512031988-32490-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 30 Nov 2017 08:53:28 +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 for-2.12 5/7] hw/moxie/moxiesim: Add support for loading a BIOS on moxiesim 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: Anthony Green , Laurent Vivier , qemu-arm@nongnu.org, Edgar Iglesias , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The moxiesim machine already defines a memory region for a firmware, but does not provide the possibility to load an image via "-bios" yet. This will be needed for the boot-serial tester, so let's add support for "-bios" here now. Signed-off-by: Thomas Huth --- hw/moxie/moxiesim.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c index 3ba5848..00f56df 100644 --- a/hw/moxie/moxiesim.c +++ b/hw/moxie/moxiesim.c @@ -25,6 +25,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -41,6 +42,8 @@ #include "elf.h" =20 #define PHYS_MEM_BASE 0x80000000 +#define FIRMWARE_BASE 0x1000 +#define FIRMWARE_SIZE (128 * 0x1000) =20 typedef struct { uint64_t ram_size; @@ -123,8 +126,8 @@ static void moxiesim_init(MachineState *machine) memory_region_init_ram(ram, NULL, "moxiesim.ram", ram_size, &error_fat= al); memory_region_add_subregion(address_space_mem, ram_base, ram); =20 - memory_region_init_ram(rom, NULL, "moxie.rom", 128 * 0x1000, &error_fa= tal); - memory_region_add_subregion(get_system_memory(), 0x1000, rom); + memory_region_init_ram(rom, NULL, "moxie.rom", FIRMWARE_SIZE, &error_f= atal); + memory_region_add_subregion(get_system_memory(), FIRMWARE_BASE, rom); =20 if (kernel_filename) { loader_params.ram_size =3D ram_size; @@ -133,6 +136,11 @@ static void moxiesim_init(MachineState *machine) loader_params.initrd_filename =3D initrd_filename; load_kernel(cpu, &loader_params); } + if (bios_name) { + if (load_image_targphys(bios_name, FIRMWARE_BASE, FIRMWARE_SIZE) <= 0) { + error_report("Failed to load firmware '%s'", bios_name); + } + } =20 /* A single 16450 sits at offset 0x3f8. */ if (serial_hds[0]) { --=20 1.8.3.1 From nobody Tue Apr 30 19:05:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512032157891186.75317393775867; Thu, 30 Nov 2017 00:55:57 -0800 (PST) Received: from localhost ([::1]:46868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKdG-0006eL-4j for importer@patchew.org; Thu, 30 Nov 2017 03:55:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKbF-0005Rx-Bo for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKKbE-0006wu-Bm for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37732) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKKb8-0006v4-1Y; Thu, 30 Nov 2017 03:53:34 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 16B346146F; Thu, 30 Nov 2017 08:53:33 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 866C35D6B4; Thu, 30 Nov 2017 08:53:28 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 09:53:07 +0100 Message-Id: <1512031988-32490-7-git-send-email-thuth@redhat.com> In-Reply-To: <1512031988-32490-1-git-send-email-thuth@redhat.com> References: <1512031988-32490-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 30 Nov 2017 08:53:33 +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 for-2.12 6/7] tests/boot-serial-test: Add a test for the moxiesim machine 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: Anthony Green , Laurent Vivier , qemu-arm@nongnu.org, Edgar Iglesias , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that moxiesim supports the -bios parameter, we can check this machine in the boot-serial tester, too, by supplying a mini bios that only writes 'T' characters to the UART. Signed-off-by: Thomas Huth --- tests/Makefile.include | 2 ++ tests/boot-serial-test.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/tests/Makefile.include b/tests/Makefile.include index cd908da..00c1e11 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -307,6 +307,8 @@ check-qtest-mips64-y =3D tests/endianness-test$(EXESUF) =20 check-qtest-mips64el-y =3D tests/endianness-test$(EXESUF) =20 +check-qtest-moxie-y =3D tests/boot-serial-test$(EXESUF) + check-qtest-ppc-y =3D tests/endianness-test$(EXESUF) check-qtest-ppc-y +=3D tests/boot-order-test$(EXESUF) check-qtest-ppc-y +=3D tests/prom-env-test$(EXESUF) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index a39273a..1deddb8 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -40,6 +40,13 @@ static const uint8_t kernel_plml605[] =3D { 0xfc, 0xff, 0x00, 0xb8 /* bri -4 loop */ }; =20 +static const uint8_t bios_moxiesim[] =3D { + 0x20, 0x10, 0x00, 0x00, 0x03, 0xf8, /* ldi.s r1,0x3f8 */ + 0x1b, 0x20, 0x00, 0x00, 0x00, 0x54, /* ldi.b r2,'T' */ + 0x1e, 0x12, /* st.b r1,r2 */ + 0x1a, 0x00, 0x00, 0x00, 0x10, 0x00 /* jmpa 0x1000 */ +}; + typedef struct testdef { const char *arch; /* Target architecture */ const char *machine; /* Name of the machine */ @@ -70,6 +77,7 @@ static testdef_t tests[] =3D { sizeof(kernel_pls3adsp1800), kernel_pls3adsp1800 }, { "microblazeel", "petalogix-ml605", "", "TT", sizeof(kernel_plml605), kernel_plml605 }, + { "moxie", "moxiesim", "", "TT", sizeof(bios_moxiesim), 0, bios_moxies= im }, =20 { NULL } }; --=20 1.8.3.1 From nobody Tue Apr 30 19:05:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512032297873312.92821967578186; Thu, 30 Nov 2017 00:58:17 -0800 (PST) Received: from localhost ([::1]:46881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKfh-000129-4C for importer@patchew.org; Thu, 30 Nov 2017 03:58:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKKbF-0005SH-OI for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKKbF-0006xN-0n for qemu-devel@nongnu.org; Thu, 30 Nov 2017 03:53:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42156) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKKbC-0006vv-FE; Thu, 30 Nov 2017 03:53:38 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13E5C820FB; Thu, 30 Nov 2017 08:53:37 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71FBC5D6B4; Thu, 30 Nov 2017 08:53:33 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 09:53:08 +0100 Message-Id: <1512031988-32490-8-git-send-email-thuth@redhat.com> In-Reply-To: <1512031988-32490-1-git-send-email-thuth@redhat.com> References: <1512031988-32490-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 30 Nov 2017 08:53:37 +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 for-2.12 7/7] tests/boot-serial-test: Add support for the raspi2 machine 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: Anthony Green , Laurent Vivier , qemu-arm@nongnu.org, Edgar Iglesias , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The raspi2 machine supports loading firmware images, so we can easily load a small test sequence as raw binary blob here to test the UART. Signed-off-by: Thomas Huth --- tests/Makefile.include | 1 + tests/boot-serial-test.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/tests/Makefile.include b/tests/Makefile.include index 00c1e11..09025dc 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -361,6 +361,7 @@ check-qtest-arm-y +=3D tests/virtio-blk-test$(EXESUF) gcov-files-arm-y +=3D arm-softmmu/hw/block/virtio-blk.c check-qtest-arm-y +=3D tests/test-arm-mptimer$(EXESUF) gcov-files-arm-y +=3D hw/timer/arm_mptimer.c +check-qtest-arm-y +=3D tests/boot-serial-test$(EXESUF) =20 check-qtest-aarch64-y =3D tests/numa-test$(EXESUF) =20 diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index 1deddb8..663b78b 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -47,6 +47,14 @@ static const uint8_t bios_moxiesim[] =3D { 0x1a, 0x00, 0x00, 0x00, 0x10, 0x00 /* jmpa 0x1000 */ }; =20 +static const uint8_t bios_raspi2[] =3D { + 0x08, 0x30, 0x9f, 0xe5, /* ldr r3,[pc,#8] Get bas= e */ + 0x54, 0x20, 0xa0, 0xe3, /* mov r2,#'T' */ + 0x00, 0x20, 0xc3, 0xe5, /* strb r2,[r3] */ + 0xfb, 0xff, 0xff, 0xea, /* b loop */ + 0x00, 0x10, 0x20, 0x3f, /* 0x3f201000 =3D UART0 base a= ddr */ +}; + typedef struct testdef { const char *arch; /* Target architecture */ const char *machine; /* Name of the machine */ @@ -78,6 +86,7 @@ static testdef_t tests[] =3D { { "microblazeel", "petalogix-ml605", "", "TT", sizeof(kernel_plml605), kernel_plml605 }, { "moxie", "moxiesim", "", "TT", sizeof(bios_moxiesim), 0, bios_moxies= im }, + { "arm", "raspi2", "", "TT", sizeof(bios_raspi2), 0, bios_raspi2 }, =20 { NULL } }; --=20 1.8.3.1