[PATCH 00/17] kvm-unit-tests/arm: initial drop

2014-01-21 Thread Andrew Jones
This is a v3 of a series that introduces arm to kvm-unit-tests.
First, it does some tidying up of the repo. Then, it adds support
for virtio-testdev. Next, it adds the basic infrastructure for
booting a test case (guest), and adds a single simple test,
which is a self-test. Finally, it adds support for vectors and
self-tests for that support.

This initial drop doesn't require kvmarm. Only qemu-system-arm,
recent enough to have mach-virt, and the virtio-testdev patch[1],
is required.

[1] http://lists.nongnu.org/archive/html/qemu-devel/2013-12/msg00690.html

These patches are also available from a git repo here
https://github.com/rhdrjones/kvm-unit-tests/commits/arm-branch/master

Andrew Jones (16):
  remove unused files
  makefile and run_tests tweaks
  clean root dir of all x86-ness
  gitignore: Ignore more
  add 'make cscope' support
  Add halt() and some error codes
  move x86's simple heap management to common code
  Introduce libio to common code for io read/write
  libfdt: Import libfdt source
  libfdt: get libfdt to build
  add support for device trees
  Introduce virtio-testdev
  arm: initial drop
  printf: support field padding
  arm: add useful headers from the linux kernel
  arm: vectors support

Christoffer Dall (1):
  arm: Add IO accessors to avoid register-writeback

 .gitignore   |6 +
 Makefile |   50 +-
 README   |   55 +-
 arm/cstart.S |  196 ++
 arm/flat.lds |   23 +
 arm/run  |   19 +
 arm/selftest.c   |  149 +
 arm/unittests.cfg|   29 +
 config-i386.mak  |   13 -
 config-ia64.mak  |7 -
 config-powerpc-440.mak   |   15 -
 config-powerpc.mak   |   39 --
 config-x86-common.mak|  122 
 config-x86_64.mak|   14 -
 config/config-arm.mak|   80 +++
 config/config-i386.mak   |   12 +
 config/config-x86-common.mak |  121 
 config/config-x86_64.mak |   13 +
 configure|   27 +-
 docs/testdev.txt |   11 +
 flat.lds |   21 -
 formats  |   31 -
 iotable.c|   53 --
 iotable.h|   40 --
 kvmtrace.c   |  706 
 kvmtrace_format  |  532 ---
 lib/argv.c   |6 +
 lib/arm/asm-offsets.h|   27 +
 lib/arm/cp15.h   |   36 +
 lib/arm/eabi_compat.c|   20 +
 lib/arm/io.c |   44 ++
 lib/arm/io.h |   78 +++
 lib/arm/processor.c  |  103 +++
 lib/arm/processor.h  |   35 +
 lib/arm/ptrace.h |  100 +++
 lib/arm/setup.c  |   46 ++
 lib/arm/sysinfo.h|   12 +
 lib/devicetree.c |  257 +++
 lib/devicetree.h |   95 +++
 lib/errno.h  |   22 +
 lib/fwcfg.c  |   58 --
 lib/heap.c   |   45 ++
 lib/heap.h   |8 +
 lib/libcflat.h   |   13 +-
 lib/libfdt/Makefile.libfdt   |   10 +
 lib/libfdt/README|4 +
 lib/libfdt/fdt.c |  250 +++
 lib/libfdt/fdt.h |  111 
 lib/libfdt/fdt_empty_tree.c  |   84 +++
 lib/libfdt/fdt_ro.c  |  573 
 lib/libfdt/fdt_rw.c  |  492 ++
 lib/libfdt/fdt_strerror.c|   96 +++
 lib/libfdt/fdt_sw.c  |  256 +++
 lib/libfdt/fdt_wip.c |  118 
 lib/libfdt/libfdt.h  | 1514 ++
 lib/libfdt/libfdt_env.h  |  112 
 lib/libfdt/libfdt_internal.h |   95 +++
 lib/libfdt/version.lds   |   60 ++
 lib/libio.h  |  177 +
 lib/panic.c  |   13 -
 lib/powerpc/44x/map.c|   51 --
 lib/powerpc/44x/timebase.S   |   28 -
 lib/powerpc/44x/timebase.h   |   25 -
 lib/powerpc/44x/tlbwe.S  |   29 -
 lib/powerpc/io.c |   35 -
 lib/printf.c |   82 ++-
 lib/string.c |   51 ++
 lib/virtio-testdev.c |  139 
 lib/virtio-testdev.h |9 +
 lib/virtio.c |  126 
 lib/virtio.h |   74 +++
 lib/x86/vm.c |   33 +-
 main-ppc.c   |  383 ---
 powerpc/44x/tlbsx.S  |   33 -
 powerpc/44x/tlbwe.S  |   27 -
 powerpc/44x/tlbwe_16KB.S |   35 -
 powerpc/44x/tlbwe_hole.S |   27 -
 powerpc/cstart.S |   38 --
 powerpc/exit.c   |   23 -
 powerpc/helloworld.c |   27 -
 powerpc/io.S |   32 -
 powerpc/spin.S   |4 -
 powerpc/sprg.S   |7 -
 run_tests.sh |   19 +-
 scripts/arm/asm-offsets.c|   40 ++
 testdev.txt  |   14 -
 x86-run  |   41 --
 x86/README   |   60 +-
 x86/flat.lds |   21 +
 x86/print.h 

Re: [PATCH 00/17] kvm-unit-tests/arm: initial drop

2014-01-29 Thread Andrew Jones
On Tue, Jan 28, 2014 at 07:16:11PM +0100, María Soler Heredia wrote:
> Hello Andrew,
> 
> I have been experimenting a little with your tests and I have some comments
> and questions. I have already compiled and run versions v1 and v2, which
> work with kvm disabled, but I cannot run v3 using the same qemu, version
> 1.6.90 with these two sets of patches:
> 
>- 
> http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg02142.html(Adds
> 'virt' platform)
>- 
> http://lists.nongnu.org/archive/html/qemu-devel/2013-10/msg01815.html(Introduces
> virtio-testdev)
> 
> that you indicated on [PATCH 0/9] kvm-unit-tests/arm: initial drop.
> 
> >  Only qemu-system-arm, recent enough to have mach-virt, and the
> > virtio-testdev patch[1],
> > is required.
> >
> > [1] http://lists.nongnu.org/archive/html/qemu-devel/2013-12/msg00690.html
> >
> 
> Then I thought maybe the problem was that my qemu was too old, so I
> upgraded to version 1.7.50, the newest available version at git://
> git.qemu-project.org/qemu.git and applied patch[1] but it seems to be
> incompatible with that version of qemu, since it doesn't compile:
> ---
> hw/virtio/virtio-testdev.c: In function 'virtio_testdev_class_init':
> hw/virtio/virtio-testdev.c:136:8: error: 'VirtioDeviceClass' has no member
> named 'init'
> ---

The latest git://git.qemu.org/qemu.git with the v3 of virtio-testdev that
I just sent[*] works for me. virtio-testdev needed to be converted from init
to realize.

[*] http://lists.nongnu.org/archive/html/qemu-devel/2014-01/msg04041.html

> 
> I modified hw/virtio/virtio-testdev.c to stop this error from happening,
> but it won't run the already compiled (with qemu 1.6.90) v1 and v2 or make
> a runnable version of either v1, v2 or v3 when recompiling them.
> 
> The error that I get when I run the v3 of the test (with qemu 1.6.90) is as
> follows:
> 
> $ ./run_tests.sh -v
> ./arm-run arm/selftest.flat -smp 1 -m 256 -append 'mem 256'
> qemu: fatal: Trying to execute code outside RAM or ROM at 0x
> 
> R00=fff7 R01= R02= R03=2ff20112
> R04= R05= R06= R07=
> R08= R09= R10= R11=
> R12= R13=40017ff8 R14=080117b0 R15=
> PSR=a1d3 N-C- A svc32
> s00= s01= d00=
> ...
> s62= s63= d31=
> FPSCR: 
> ./arm-run: line 16:  4839 Aborted (core dumped) $command
> "$@"
> FAIL selftest_mem
> ./arm-run arm/selftest.flat -smp 1 -append 'vectors'
> qemu: fatal: Trying to execute code outside RAM or ROM at 0x
> 
> R00=fff7 R01= R02= R03=2ff20112
> R04= R05= R06= R07=
> R08= R09= R10= R11=
> R12= R13=40017ff8 R14=080117b0 R15=
> PSR=a1d3 N-C- A svc32
> s00= s01= d00=
> ...
> s62= s63= d31=
> FPSCR: 
> ./arm-run: line 16:  4845 Aborted (core dumped) $command
> "$@"
> FAIL selftest_vectors
> ./arm-run arm/selftest.flat -smp 1 -append 'vectors_usr'
> qemu: fatal: Trying to execute code outside RAM or ROM at 0x
> 
> R00=fff7 R01= R02= R03=2ff20112
> R04= R05= R06= R07=
> R08= R09= R10= R11=
> R12= R13=40017ff8 R14=080117b0 R15=
> PSR=a1d3 N-C- A svc32
> s00= s01= d00=
> ...
> s62= s63= d31=
> FPSCR: 
> ./arm-run: line 16:  4851 Aborted (core dumped) $command
> "$@"
> FAIL selftest_vectors_usr
> 
> Am I using the wrong qemu? Is there a new dependency that is not mentioned
> and that may cause this problem? Any other ideas on why this could happen?

Are you sure you have the latest mach-virt patches for qemu? v3 of
kvm-unit-tests/arm sets the load address to 0x4000, which matches the
latest mach-virt.

I can run these tests on my x86_64 machine, without kvm enabled, as well as
on an armv7 machine with kvm enabled. Are you still running on the
FastModel? I never got around to setting one up to see if that works or not.

thanks,
drew
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/17] kvm-unit-tests/arm: initial drop

2014-02-01 Thread Christoffer Dall
On Tue, Jan 21, 2014 at 05:21:46PM +0100, Andrew Jones wrote:
> This is a v3 of a series that introduces arm to kvm-unit-tests.

Just a meta-comment:

It would be helpful if you include the "v3" in your subjects so it's
easy to go back and track previous review comments.

git format-patch --subject-prefix "PATCH v3"

is your friend here.

-Christoffer
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/17] kvm-unit-tests/arm: initial drop

2014-02-03 Thread Andrew Jones
On Sat, Feb 01, 2014 at 06:22:03PM -0800, Christoffer Dall wrote:
> On Tue, Jan 21, 2014 at 05:21:46PM +0100, Andrew Jones wrote:
> > This is a v3 of a series that introduces arm to kvm-unit-tests.
> 
> Just a meta-comment:
> 
> It would be helpful if you include the "v3" in your subjects so it's
> easy to go back and track previous review comments.
> 
> git format-patch --subject-prefix "PATCH v3"
> 

I meant to do that... v4 will get the right subject.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/17] kvm-unit-tests/arm: initial drop

2014-02-04 Thread Andrew Jones
On Tue, Feb 04, 2014 at 09:19:30AM +0100, Maria Soler wrote:
> On 29 January 2014 16:35, Andrew Jones  wrote:
> 
> > On Tue, Jan 28, 2014 at 07:16:11PM +0100, María Soler Heredia wrote:
> > > Hello Andrew,
> > >
> > > I have been experimenting a little with your tests and I have some
> > comments
> > > and questions. I have already compiled and run versions v1 and v2, which
> > > work with kvm disabled, but I cannot run v3 using the same qemu, version
> > > 1.6.90 with these two sets of patches:
> > >
> > >-
> > http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg02142.html(Adds
> > > 'virt' platform)
> > >-
> > http://lists.nongnu.org/archive/html/qemu-devel/2013-10/msg01815.html(Introduces
> > > virtio-testdev)
> > >
> > > that you indicated on [PATCH 0/9] kvm-unit-tests/arm: initial drop.
> > >
> > > >  Only qemu-system-arm, recent enough to have mach-virt, and the
> > > > virtio-testdev patch[1],
> > > > is required.
> > > >
> > > > [1]
> > http://lists.nongnu.org/archive/html/qemu-devel/2013-12/msg00690.html
> > > >
> > >
> > > Then I thought maybe the problem was that my qemu was too old, so I
> > > upgraded to version 1.7.50, the newest available version at git://
> > > git.qemu-project.org/qemu.git and applied patch[1] but it seems to be
> > > incompatible with that version of qemu, since it doesn't compile:
> > >
> > ---
> > > hw/virtio/virtio-testdev.c: In function 'virtio_testdev_class_init':
> > > hw/virtio/virtio-testdev.c:136:8: error: 'VirtioDeviceClass' has no
> > member
> > > named 'init'
> > >
> > ---
> >
> > The latest git://git.qemu.org/qemu.git with the v3 of virtio-testdev that
> > I just sent[*] works for me. virtio-testdev needed to be converted from
> > init
> > to realize.
> >
> > [*] http://lists.nongnu.org/archive/html/qemu-devel/2014-01/msg04041.html
> >
> > >
> > > I modified hw/virtio/virtio-testdev.c to stop this error from happening,
> > > but it won't run the already compiled (with qemu 1.6.90) v1 and v2 or
> > make
> > > a runnable version of either v1, v2 or v3 when recompiling them.
> > >
> > > The error that I get when I run the v3 of the test (with qemu 1.6.90) is
> > as
> > > follows:
> > >
> > > $ ./run_tests.sh -v
> > > ./arm-run arm/selftest.flat -smp 1 -m 256 -append 'mem 256'
> > > qemu: fatal: Trying to execute code outside RAM or ROM at 0x
> > >
> > > R00=fff7 R01= R02= R03=2ff20112
> > > R04= R05= R06= R07=
> > > R08= R09= R10= R11=
> > > R12= R13=40017ff8 R14=080117b0 R15=
> > > PSR=a1d3 N-C- A svc32
> > > s00= s01= d00=
> > > ...
> > > s62= s63= d31=
> > > FPSCR: 
> > > ./arm-run: line 16:  4839 Aborted (core dumped) $command
> > > "$@"
> > > FAIL selftest_mem
> > > ./arm-run arm/selftest.flat -smp 1 -append 'vectors'
> > > qemu: fatal: Trying to execute code outside RAM or ROM at 0x
> > >
> > > R00=fff7 R01= R02= R03=2ff20112
> > > R04= R05= R06= R07=
> > > R08= R09= R10= R11=
> > > R12= R13=40017ff8 R14=080117b0 R15=
> > > PSR=a1d3 N-C- A svc32
> > > s00= s01= d00=
> > > ...
> > > s62= s63= d31=
> > > FPSCR: 
> > > ./arm-run: line 16:  4845 Aborted (core dumped) $command
> > > "$@"
> > > FAIL selftest_vectors
> > > ./arm-run arm/selftest.flat -smp 1 -append 'vectors_usr'
> > > qemu: fatal: Trying to execute code outside RAM or ROM at 0x
> > >
> > > R00=fff7 R01= R02= R03=2ff20112
> > > R04= R05= R06= R07=
> > > R08= R09= R10= R11=
> > > R12= R13=40017ff8 R14=080117b0 R15=
> > > PSR=a1d3 N-C- A svc32
> > > s00= s01= d00=
> > > ...
> > > s62= s63= d31=
> > > FPSCR: 
> > > ./arm-run: line 16:  4851 Aborted (core dumped) $command
> > > "$@"
> > > FAIL selftest_vectors_usr
> > >
> > > Am I using the wrong qemu? Is there a new dependency that is not
> > mentioned
> > > and that may cause this problem? Any other ideas on why this could
> > happen?
> >
> > Are you sure you have the latest mach-virt patches for qemu? v3 of
> > kvm-unit-tests/arm sets the load address to 0x4000, which matches the
> > latest mach-virt.
> >
> > I can run these tests on my x86_64 machine, without kvm enabled, as well as
> > on an armv7 machine with kvm enabled. Are you still running on the
> > FastModel? I neve