kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Christoffer Dall <christoffer.dall@linaro.org>
Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, gleb@redhat.com
Subject: Re: [PATCH 8/9] arm: initial drop
Date: Thu, 17 Oct 2013 12:16:18 +0200	[thread overview]
Message-ID: <20131017101617.GD2172@hawk.usersys.redhat.com> (raw)
In-Reply-To: <20131017010635.GK24837@cbox>

On Wed, Oct 16, 2013 at 06:06:35PM -0700, Christoffer Dall wrote:
> > diff --git a/arm/boot.c b/arm/boot.c
> > new file mode 100644
> > index 0000000000000..375e8708a7c54
> 
> this file's indentation is also funny, you should really check your
> editor configuration :)

Actually the editor prefers kernel style, I had to keep trying to
force the other style on it, and now see below that I wasn't always
successful. '++expected' should have had just a tab, not a
tab+4spaces...

> > --- /dev/null
> > +++ b/arm/boot.c
> > @@ -0,0 +1,27 @@
> > +#include "libcflat.h"
> > +#include "arm/bootinfo.h"
> > +
> > +static bool info_check(u32 var, char *expected)
> > +{
> > +    char var_str[9];
> > +    snprintf(var_str, 9, "%x", var);
> > +    while (*expected == '0' || *expected == 'x')
> > +	    ++expected;
> > +    return !strcmp(var_str, expected);
> > +}
> > +
> > +int main(int argc, char **argv)
> > +{
> > +    int ret = 0;
> > +
> > +    if (argc < 3) {
> > +	printf("Not enough arguments. Can't test\n");
> > +	return 1;
> > +    }
> > +
> > +    if (!strcmp(argv[0], "info"))
> > +	ret = !info_check(mem32.size, argv[1])
> > +		|| !info_check(core.pagesize, argv[2]);
> > +
> > +    return ret;
> > +}
> 
> I'm actually a little confused, when does this main get invoked and by
> whom and what are we testing for here?

See cstart.S:start 'bl main' below for the who invokes. And
arm/unittests.cfg, also below, for the (poorly documented) test case
definition. You'll see we config the test to have 256G memory, and then
here we confirm that we read the bootinfo correctly, i.e. it says 256G.
There's also a check for pagesize, which isn't really necessary, but as
that info comes from a different ATAG, it (sort of) checks something
else.

> 
> > diff --git a/arm/cstart.S b/arm/cstart.S
> > new file mode 100644
> > index 0000000000000..a65809824d4f1
> > --- /dev/null
> > +++ b/arm/cstart.S
> > @@ -0,0 +1,47 @@
> > +
> > +#define CR_B	(1 << 7)
> > +
> > +.arm
> > +
> > +.section .init
> > +
> > +.globl start
> > +start:
> > +	/* bootloader params are in r0-r2 */
> > +	ldr	sp, =stacktop
> > +	push	{ r0-r3 }		@push r3 too for 8-byte alignment
> > +
> > +	mrc	p15, 0, r8, c1, c0, 0	@r8 = sctrl
> > +	bl	get_endianness
> > +	bl	io_init
> > +
> > +	pop	{ r0-r3 }
> > +	bl	read_bootinfo
> > +	bl	__setup_args
> > +	ldr	r0, =__argc
> > +	ldr	r0, [r0]
> > +	ldr	r1, =__argv
> > +	bl	main
> > +	bl	exit
> > +	b	halt
> > +
> > +get_endianness:
> > +	and	r0, r8, #CR_B
> > +	cmp	r0, #0
> > +	beq	1f
> > +	ldr	r1, =cpu_is_be
> > +	mov	r0, #1
> > +	str	r0, [r1]
> > +1:	mov	pc, lr
> > +
> > +.text
> > +
> > +.globl halt
> > +halt:
> > +1:	wfi
> > +	b	1b
> > +
> > +.data
> > +
> > +.globl cpu_is_be
> > +cpu_is_be:	.word 0

[snip]

> > diff --git a/arm/unittests.cfg b/arm/unittests.cfg
> > new file mode 100644
> > index 0000000000000..fb78cd906839a
> > --- /dev/null
> > +++ b/arm/unittests.cfg
> > @@ -0,0 +1,11 @@
> > +# Define your new unittest following the convention:
> > +# [unittest_name]
> > +# file = foo.flat # Name of the flat file to be used
> > +# smp = 2 # Number of processors the VM will use during this test
> > +# extra_params = -append <params...> # Additional parameters used
> > +# arch = arm/arm64 # Only if the test case works only on one of them
> > +# groups = group1 group2 # Used to identify test cases with run_tests -g ...
> > +
> > +[boot_info]
> > +file = boot.flat
> > +extra_params = -m 256 -append 'info 0x10000000 0x1000'
> > diff --git a/config/config-arm.mak b/config/config-arm.mak

[snip]

drew

  reply	other threads:[~2013-10-17 10:16 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14 16:23 [PATCH 0/9] kvm-unit-tests/arm: initial drop Andrew Jones
2013-10-14 16:23 ` [PATCH 1/9] remove unused files Andrew Jones
2013-10-16 12:52   ` Gleb Natapov
2013-10-16 13:13     ` Alexander Graf
2013-10-16 13:18     ` Andrew Jones
2013-10-14 16:23 ` [PATCH 2/9] makefile and run_tests tweaks Andrew Jones
2013-10-14 16:23 ` [PATCH 3/9] clean root dir of all x86-ness Andrew Jones
2013-10-17  1:06   ` Christoffer Dall
2013-10-17  9:35     ` Andrew Jones
2013-10-17 19:01       ` Christoffer Dall
2013-10-20 16:37         ` Andrew Jones
2013-10-14 16:23 ` [PATCH 4/9] Introduce a simple iomap structure Andrew Jones
2013-10-14 16:23 ` [PATCH 5/9] Add halt() and some error codes Andrew Jones
2013-10-14 16:23 ` [PATCH 6/9] Introduce virtio-testdev Andrew Jones
2013-10-15  8:39   ` Andrew Jones
2013-10-17  1:06   ` Christoffer Dall
2013-10-17  9:51     ` Andrew Jones
2013-10-17 19:01       ` Christoffer Dall
2013-10-17  1:06   ` Christoffer Dall
2013-10-14 16:23 ` [PATCH 7/9] arm: replace arbitrary divisions Andrew Jones
2013-10-17  1:06   ` Christoffer Dall
2013-10-17 10:03     ` Andrew Jones
2013-10-17 18:59       ` Christoffer Dall
2013-10-14 16:23 ` [PATCH 8/9] arm: initial drop Andrew Jones
2013-10-17  1:06   ` Christoffer Dall
2013-10-17 10:16     ` Andrew Jones [this message]
2013-10-17 13:28       ` Andrew Jones
2013-10-17 18:39         ` Christoffer Dall
2013-10-14 16:23 ` [PATCH 9/9] arm: add vectors support Andrew Jones
2013-10-17  1:06   ` Christoffer Dall
2013-10-17 10:38     ` Andrew Jones
2013-10-17 18:58       ` Christoffer Dall
2013-10-20 16:35         ` Andrew Jones
2013-10-21  9:59           ` Christoffer Dall
2013-11-20 23:06 ` [PATCH 0/9] kvm-unit-tests/arm: initial drop María Soler Heredia
2013-11-26 17:23   ` Andrew Jones
2013-12-29  9:24 ` Christoffer Dall
2014-01-02 18:56   ` Andrew Jones

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=20131017101617.GD2172@hawk.usersys.redhat.com \
    --to=drjones@redhat.com \
    --cc=christoffer.dall@linaro.org \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    /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).