Re: [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support

2016-03-01 Thread Peter Crosthwaite
On Tue, Mar 1, 2016 at 1:34 PM, Andrew Baumann
 wrote:
>> From: Peter Crosthwaite [mailto:crosthwaitepe...@gmail.com]
>> Sent: Tuesday, 1 March 2016 10:44 AM
>>
>> On Mon, Feb 29, 2016 at 9:27 PM, Stefan Weil  wrote:
>> > Am 18.01.2016 um 08:12 schrieb Peter Crosthwaite:
>> >> Hi All,
>> >>
>> >> This patch series adds system-mode big-endian support for ARM. It also
>> >> implements the setend instruction, and loading of BE binaries even in
>> >> LE emulation mode.
>> >>
>> >> Based on Paolo's original work. I have moved all the BE32 related work
>> >> to the back of the series. Multiple parties are interested in the BE8
>> >> work just on its own, so that could potentially be merged w/o BE32.
>> >> PMM requested BE32 be at least thought out architecturally, so this
>> >> series sees BE32 functionality through.
>> >>
>> >> I have tested all of LE. BE8 and BE32 in both linux-user mode (for
>> >> regressions) and system mode (BE8 and BE32 are new here).
>> >> My test application is here, the README gives some example command
>> >> lines you can run:
>> >>
>> >> https://github.com/pcrost/arm-be-test
>> >>
>> >> Regards,
>> >> Peter
>> >
>> > It would be nice to get at least the emulation for 'setend' into the
>> > next version, because it is needed for the Raspberry Pi emulation.
>> >
>>
>> BTW if you can link me binaries and a failing command line for the
>> failing rPI work I can test it, I am currently doing my own standalone
>> tests (of linux user as well).
>
> Download and unzip:
> https://downloads.raspberrypi.org/raspbian_lite_latest
>
> Then, mount the boot partition, and grab a copy of kernel7.img. You should 
> now be able to boot on a current qemu with:
>
> qemu-system-arm -M raspi2 -kernel kernel7.img -sd 
> 2016-02-26-raspbian-jessie-lite.img -append "rw earlyprintk loglevel=8 
> console=ttyAMA0 root=/dev/mmcblk0p2 rootwait" -serial stdio -d unimp
>
> At present, this fails with:
>
> [   10.535232] VFS: Mounted root (ext4 filesystem) on device 179:2.
> [   10.729685] devtmpfs: mounted
> [   10.805125] Freeing unused kernel memory: 416K (80776000 - 807de000)
> [   17.317286] random: systemd urandom read with 6 bits of entropy available
> arm: unimplemented setend
> [   17.366656] Kernel panic - not syncing: Attempted to kill init! 
> exitcode=0x0004
> [   17.366656]
> [   17.384625] CPU: 0 PID: 1 Comm: systemd Not tainted 4.1.7-v7+ #817
> [   17.395562] Hardware name: BCM2709
> [   17.404738] [<80018440>] (unwind_backtrace) from [<80013e0c>] 
> (show_stack+0x20/0x24)
> [   17.419042] [<80013e0c>] (show_stack) from [<80558548>] 
> (dump_stack+0x98/0xe0)
> [   17.432237] [<80558548>] (dump_stack) from [<8055473c>] (panic+0xa4/0x204)
> [   17.444761] [<8055473c>] (panic) from [<8002937c>] (do_exit+0xa0c/0xa64)
> [   17.452507] [<8002937c>] (do_exit) from [<80029470>] 
> (do_group_exit+0x50/0xcc)
> [   17.462827] [<80029470>] (do_group_exit) from [<80033ed4>] 
> (get_signal+0x2b0/0x6e0)
> [   17.474429] [<80033ed4>] (get_signal) from [<80013194>] 
> (do_signal+0x98/0x3ac)
> [   17.482176] [<80013194>] (do_signal) from [<80013690>] 
> (do_work_pending+0xb8/0xc8)
> [   17.490129] [<80013690>] (do_work_pending) from [<8000f9e4>] 
> (work_pending+0xc/0x20)
> [   17.501020] ---[ end Kernel panic - not syncing: Attempted to kill init! 
> exitcode=0x0004
> [   17.501020]
>

Reproduced. With my patch series I am now getting further:

[5.570600] VFS: Mounted root (ext4 filesystem) on device 179:2.
[5.628967] devtmpfs: mounted
[5.667292] Freeing unused kernel memory: 448K (8078a000 - 807fa000)
[7.829100] random: systemd urandom read with 2 bits of entropy available
[7.902604] systemd[1]: systemd 215 running in system mode. (+PAM
+AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ
-SECCOMP -APPARMOR)
[7.913866] systemd[1]: Detected architecture 'arm'.

Welcome to Raspbian GNU/Linux 8 (jessie)!

[8.625874] NET: Registered protocol family 10
[8.645330] systemd[1]: Inserted module 'ipv6'
[8.671989] systemd[1]: Set hostname to .
[   12.670915] systemd[1]: Cannot add dependency job for unit
display-manager.service, ignoring: Unit display-manager.service failed
to load: No such file or directory.
[   12.720439] systemd[1]: Starting Forward Password Requests to Wall
Directory Watch.
[   12.731310] systemd[1]: Started Forward Password Requests to Wall
Directory Watch.
[   12.734406] systemd[1]: Expecting device dev-ttyAMA0.device...
 Expecting device dev-ttyAMA0.device...

...

[  OK  ] Started Permit User Sessions.
[  OK  ] Started Login Service.
[  OK  ] Started System Logging Service.
[  OK  ] Started LSB: Apply config from /boot/os_config.json.
[  OK  ] Started dhcpcd on all interfaces.
[  OK  ] Reached target Network.
 Starting /etc/rc.local Compatibility...
[  OK  ] Reached target Network is Online.
 Starting LSB: Start NTP daemon...
[  OK  ] Started /etc/rc.local Compatibility.
 Starting Wait for Plymouth Boot Screen to Quit..

Re: [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support

2016-03-01 Thread Andrew Baumann
> From: Peter Crosthwaite [mailto:crosthwaitepe...@gmail.com]
> Sent: Tuesday, 1 March 2016 10:44 AM
> 
> On Mon, Feb 29, 2016 at 9:27 PM, Stefan Weil  wrote:
> > Am 18.01.2016 um 08:12 schrieb Peter Crosthwaite:
> >> Hi All,
> >>
> >> This patch series adds system-mode big-endian support for ARM. It also
> >> implements the setend instruction, and loading of BE binaries even in
> >> LE emulation mode.
> >>
> >> Based on Paolo's original work. I have moved all the BE32 related work
> >> to the back of the series. Multiple parties are interested in the BE8
> >> work just on its own, so that could potentially be merged w/o BE32.
> >> PMM requested BE32 be at least thought out architecturally, so this
> >> series sees BE32 functionality through.
> >>
> >> I have tested all of LE. BE8 and BE32 in both linux-user mode (for
> >> regressions) and system mode (BE8 and BE32 are new here).
> >> My test application is here, the README gives some example command
> >> lines you can run:
> >>
> >> https://github.com/pcrost/arm-be-test
> >>
> >> Regards,
> >> Peter
> >
> > It would be nice to get at least the emulation for 'setend' into the
> > next version, because it is needed for the Raspberry Pi emulation.
> >
> 
> BTW if you can link me binaries and a failing command line for the
> failing rPI work I can test it, I am currently doing my own standalone
> tests (of linux user as well).

Download and unzip:
https://downloads.raspberrypi.org/raspbian_lite_latest

Then, mount the boot partition, and grab a copy of kernel7.img. You should now 
be able to boot on a current qemu with:

qemu-system-arm -M raspi2 -kernel kernel7.img -sd 
2016-02-26-raspbian-jessie-lite.img -append "rw earlyprintk loglevel=8 
console=ttyAMA0 root=/dev/mmcblk0p2 rootwait" -serial stdio -d unimp

At present, this fails with:

[   10.535232] VFS: Mounted root (ext4 filesystem) on device 179:2.
[   10.729685] devtmpfs: mounted
[   10.805125] Freeing unused kernel memory: 416K (80776000 - 807de000)
[   17.317286] random: systemd urandom read with 6 bits of entropy available
arm: unimplemented setend
[   17.366656] Kernel panic - not syncing: Attempted to kill init! 
exitcode=0x0004
[   17.366656]
[   17.384625] CPU: 0 PID: 1 Comm: systemd Not tainted 4.1.7-v7+ #817
[   17.395562] Hardware name: BCM2709
[   17.404738] [<80018440>] (unwind_backtrace) from [<80013e0c>] 
(show_stack+0x20/0x24)
[   17.419042] [<80013e0c>] (show_stack) from [<80558548>] 
(dump_stack+0x98/0xe0)
[   17.432237] [<80558548>] (dump_stack) from [<8055473c>] (panic+0xa4/0x204)
[   17.444761] [<8055473c>] (panic) from [<8002937c>] (do_exit+0xa0c/0xa64)
[   17.452507] [<8002937c>] (do_exit) from [<80029470>] 
(do_group_exit+0x50/0xcc)
[   17.462827] [<80029470>] (do_group_exit) from [<80033ed4>] 
(get_signal+0x2b0/0x6e0)
[   17.474429] [<80033ed4>] (get_signal) from [<80013194>] 
(do_signal+0x98/0x3ac)
[   17.482176] [<80013194>] (do_signal) from [<80013690>] 
(do_work_pending+0xb8/0xc8)
[   17.490129] [<80013690>] (do_work_pending) from [<8000f9e4>] 
(work_pending+0xc/0x20)
[   17.501020] ---[ end Kernel panic - not syncing: Attempted to kill init! 
exitcode=0x0004
[   17.501020]

Cheers,
Andrew


Re: [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support

2016-03-01 Thread Paolo Bonzini
On 01/03/2016 19:43, Peter Crosthwaite wrote:
> On Mon, Feb 29, 2016 at 9:27 PM, Stefan Weil  wrote:
>> It would be nice to get at least the emulation for 'setend' into the
>> next version, because it is needed for the Raspberry Pi emulation.
> 
> BTW if you can link me binaries and a failing command line for the
> failing rPI work I can test it, I am currently doing my own standalone
> tests (of linux user as well).

Try the repository at https://github.com/bavison/arm-mem.  IIRC you have
to change the "#if 0" in test.c to "#if 1".

Paolo



Re: [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support

2016-03-01 Thread Peter Crosthwaite
On Mon, Feb 29, 2016 at 9:27 PM, Stefan Weil  wrote:
> Am 18.01.2016 um 08:12 schrieb Peter Crosthwaite:
>> Hi All,
>>
>> This patch series adds system-mode big-endian support for ARM. It also
>> implements the setend instruction, and loading of BE binaries even in
>> LE emulation mode.
>>
>> Based on Paolo's original work. I have moved all the BE32 related work
>> to the back of the series. Multiple parties are interested in the BE8
>> work just on its own, so that could potentially be merged w/o BE32.
>> PMM requested BE32 be at least thought out architecturally, so this
>> series sees BE32 functionality through.
>>
>> I have tested all of LE. BE8 and BE32 in both linux-user mode (for
>> regressions) and system mode (BE8 and BE32 are new here).
>> My test application is here, the README gives some example command
>> lines you can run:
>>
>> https://github.com/pcrost/arm-be-test
>>
>> Regards,
>> Peter
>
> It would be nice to get at least the emulation for 'setend' into the
> next version, because it is needed for the Raspberry Pi emulation.
>

BTW if you can link me binaries and a failing command line for the
failing rPI work I can test it, I am currently doing my own standalone
tests (of linux user as well).

Regards,
Peter

> Peter C., are you planning a new pull request? Maybe the number
> of commits needed can be reduced by adding the already reviewed
> ones to QEMU.
>
> Regards,
> Stefan
>
>



Re: [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support

2016-03-01 Thread Peter Crosthwaite
On Mon, Feb 29, 2016 at 9:27 PM, Stefan Weil  wrote:
> Am 18.01.2016 um 08:12 schrieb Peter Crosthwaite:
>> Hi All,
>>
>> This patch series adds system-mode big-endian support for ARM. It also
>> implements the setend instruction, and loading of BE binaries even in
>> LE emulation mode.
>>
>> Based on Paolo's original work. I have moved all the BE32 related work
>> to the back of the series. Multiple parties are interested in the BE8
>> work just on its own, so that could potentially be merged w/o BE32.
>> PMM requested BE32 be at least thought out architecturally, so this
>> series sees BE32 functionality through.
>>
>> I have tested all of LE. BE8 and BE32 in both linux-user mode (for
>> regressions) and system mode (BE8 and BE32 are new here).
>> My test application is here, the README gives some example command
>> lines you can run:
>>
>> https://github.com/pcrost/arm-be-test
>>
>> Regards,
>> Peter
>
> It would be nice to get at least the emulation for 'setend' into the
> next version, because it is needed for the Raspberry Pi emulation.
>
> Peter C., are you planning a new pull request? Maybe the number
> of commits needed can be reduced by adding the already reviewed
> ones to QEMU.
>

I have the respun branch based on Peter's comments tested as working.
I automated my tests so the last thing to do is bisect-ability test it
(test every commit for regressions) before I post it. I am stretched
and still have a series to review at the front of my todo list though.

Regards,
Peter

> Regards,
> Stefan
>
>



Re: [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support

2016-02-29 Thread Stefan Weil
Am 18.01.2016 um 08:12 schrieb Peter Crosthwaite:
> Hi All,
>
> This patch series adds system-mode big-endian support for ARM. It also
> implements the setend instruction, and loading of BE binaries even in
> LE emulation mode.
>
> Based on Paolo's original work. I have moved all the BE32 related work
> to the back of the series. Multiple parties are interested in the BE8
> work just on its own, so that could potentially be merged w/o BE32.
> PMM requested BE32 be at least thought out architecturally, so this
> series sees BE32 functionality through.
>
> I have tested all of LE. BE8 and BE32 in both linux-user mode (for
> regressions) and system mode (BE8 and BE32 are new here).
> My test application is here, the README gives some example command
> lines you can run:
>
> https://github.com/pcrost/arm-be-test
>
> Regards,
> Peter

It would be nice to get at least the emulation for 'setend' into the
next version, because it is needed for the Raspberry Pi emulation.

Peter C., are you planning a new pull request? Maybe the number
of commits needed can be reduced by adding the already reviewed
ones to QEMU.

Regards,
Stefan




signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support

2016-01-19 Thread Peter Maydell
On 18 January 2016 at 07:12, Peter Crosthwaite
 wrote:
> Hi All,
>
> This patch series adds system-mode big-endian support for ARM. It also
> implements the setend instruction, and loading of BE binaries even in
> LE emulation mode.
>
> Based on Paolo's original work. I have moved all the BE32 related work
> to the back of the series. Multiple parties are interested in the BE8
> work just on its own, so that could potentially be merged w/o BE32.
> PMM requested BE32 be at least thought out architecturally, so this
> series sees BE32 functionality through.
>
> I have tested all of LE. BE8 and BE32 in both linux-user mode (for
> regressions) and system mode (BE8 and BE32 are new here).
> My test application is here, the README gives some example command
> lines you can run:
>
> https://github.com/pcrost/arm-be-test

Thanks for picking this up again. I've sent out my review comments on it now.

-- PMM



[Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support

2016-01-17 Thread Peter Crosthwaite
Hi All,

This patch series adds system-mode big-endian support for ARM. It also
implements the setend instruction, and loading of BE binaries even in
LE emulation mode.

Based on Paolo's original work. I have moved all the BE32 related work
to the back of the series. Multiple parties are interested in the BE8
work just on its own, so that could potentially be merged w/o BE32.
PMM requested BE32 be at least thought out architecturally, so this
series sees BE32 functionality through.

I have tested all of LE. BE8 and BE32 in both linux-user mode (for
regressions) and system mode (BE8 and BE32 are new here).
My test application is here, the README gives some example command
lines you can run:

https://github.com/pcrost/arm-be-test

Regards,
Peter


Paolo Bonzini (8):
  linux-user: arm: fix coding style for some linux-user signal functions
  linux-user: arm: handle CPSR.E correctly in strex emulation
  target-arm: pass DisasContext to gen_aa32_ld*/st*
  target-arm: introduce disas flag for endianness
  target-arm: implement setend
  linux-user: arm: pass env to get_user_code_*
  target-arm: implement SCTLR.B, drop bswap_code
  target-arm: implement BE32 mode in system emulation

Peter Crosthwaite (9):
  linux-user: arm: set CPSR.E/SCTLR.E0E correctly for BE mode
  target-arm: implement SCTLR.EE
  target-arm: a64: Add endianness support
  target-arm: cpu: Move cpu_is_big_endian to header
  target-arm: introduce tbflag for endianness
  arm: linux-user: don't set CPSR.E in BE32 mode
  loader: add API to load elf header
  loader: Add data swap option to load-elf
  arm: boot: Support big-endian elfs

 hw/alpha/dp264.c   |   4 +-
 hw/arm/armv7m.c|   2 +-
 hw/arm/boot.c  |  96 --
 hw/core/loader.c   |  57 +-
 hw/cris/boot.c |   2 +-
 hw/i386/multiboot.c|   3 +-
 hw/lm32/lm32_boards.c  |   4 +-
 hw/lm32/milkymist.c|   2 +-
 hw/m68k/an5206.c   |   2 +-
 hw/m68k/dummy_m68k.c   |   2 +-
 hw/m68k/mcf5208.c  |   2 +-
 hw/microblaze/boot.c   |   4 +-
 hw/mips/mips_fulong2e.c|   2 +-
 hw/mips/mips_malta.c   |   2 +-
 hw/mips/mips_mipssim.c |   2 +-
 hw/mips/mips_r4k.c |   2 +-
 hw/moxie/moxiesim.c|   3 +-
 hw/openrisc/openrisc_sim.c |   3 +-
 hw/pci-host/prep.c |   2 +-
 hw/ppc/e500.c  |   2 +-
 hw/ppc/mac_newworld.c  |   5 +-
 hw/ppc/mac_oldworld.c  |   5 +-
 hw/ppc/ppc440_bamboo.c |   3 +-
 hw/ppc/spapr.c |   6 +-
 hw/ppc/virtex_ml507.c  |   3 +-
 hw/s390x/ipl.c |   4 +-
 hw/sparc/leon3.c   |   2 +-
 hw/sparc/sun4m.c   |   4 +-
 hw/sparc64/sun4u.c |   4 +-
 hw/tricore/tricore_testboard.c |   2 +-
 hw/xtensa/sim.c|   4 +-
 hw/xtensa/xtfpga.c |   2 +-
 include/hw/arm/arm.h   |   9 +
 include/hw/elf_ops.h   |  22 ++-
 include/hw/loader.h|   3 +-
 linux-user/main.c  |  77 ++--
 linux-user/signal.c| 110 +--
 target-arm/arm_ldst.h  |   8 +-
 target-arm/cpu.c   |  21 +--
 target-arm/cpu.h   | 103 ++-
 target-arm/helper.c|  50 +++--
 target-arm/helper.h|   1 +
 target-arm/op_helper.c |   5 +
 target-arm/translate-a64.c |  56 +++---
 target-arm/translate.c | 407 -
 target-arm/translate.h |   3 +-
 46 files changed, 752 insertions(+), 365 deletions(-)

-- 
1.9.1