All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/7]  Add aarch64_be-linux-user target
@ 2017-12-20 21:23 Michael Weiser
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 1/7] linux-user: Add support for big-endian aarch64 Michael Weiser
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Michael Weiser @ 2017-12-20 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Weiser, Riku Voipio, Laurent Vivier

Hello,

below patches add support for big-endian aarch64 to linux-user. Almost
everything is already in place. The patches just set up the CPU flags as
required for big-endianness, add a distinction in uname and make sure the
instructions for the signal trampoline end up in memory little-endian.
Finally, configure is extended to allow building of a
aarch64_be-linux-user target and scripts/qemu-binfmt-conf.sh to include
the binfmt magic for aarch64_be ELF files.

While at it, scripts/qemu-binfmt-conf.sh is changed again to separate
arm/aarch64 targets of differing endianness into separate families so
that the binfmt handler for the respective other endianness is indeed
registered.  Also, while not strictly relevant to aarch64 support, armeb
is actually added to the list of targets, binfmt handlers should
registered for.

With this I am able to run individual aarch64_be binaries as well as
chroot into a full-blown aarch64_be userland using binfmt_misc, running
and compiling things (Gentoo crossdev/native).

v3:
- drop changes to aarch64 host support from configure
- add binfmt arm CPU family separation
- add armeb to binfmt handler targets

v2:
- add binfmt magic to qemu-binfmt-conf.sh
- fix style problems (tab indenting)

Thanks,
Michael


Michael Weiser (7):
  linux-user: Add support for big-endian aarch64
  linux-user: Add separate aarch64_be uname
  linux-user: Fix endianess of aarch64 signal trampoline
  configure: Add aarch64_be-linux-user target
  linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh
  linux-user: Separate binfmt arm CPU families
  linux-user: Activate armeb handler registration

 configure                                 |  5 +++--
 default-configs/aarch64_be-linux-user.mak |  1 +
 linux-user/aarch64/target_syscall.h       |  4 ++++
 linux-user/main.c                         |  6 ++++++
 linux-user/signal.c                       | 10 +++++++---
 scripts/qemu-binfmt-conf.sh               | 15 +++++++++++----
 6 files changed, 32 insertions(+), 9 deletions(-)
 create mode 100644 default-configs/aarch64_be-linux-user.mak

-- 
2.15.1

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 1/7] linux-user: Add support for big-endian aarch64
  2017-12-20 21:23 [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target Michael Weiser
@ 2017-12-20 21:23 ` Michael Weiser
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 2/7] linux-user: Add separate aarch64_be uname Michael Weiser
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Michael Weiser @ 2017-12-20 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Weiser, Riku Voipio, Laurent Vivier

Enable big-endian mode for data accesses on aarch64 for big-endian linux
user mode. Activate it for all exception levels as documented by ARM:
Set the SCTLR EE bit for ELs 1 through 3. Additionally set bit E0E in
EL1 to enable it in EL0 as well.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/linux-user/main.c b/linux-user/main.c
index 71696ed33d..7a4dd0c9c3 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4622,6 +4622,12 @@ int main(int argc, char **argv, char **envp)
         }
         env->pc = regs->pc;
         env->xregs[31] = regs->sp;
+#ifdef TARGET_WORDS_BIGENDIAN
+        env->cp15.sctlr_el[1] |= SCTLR_E0E;
+        for (i = 1; i < 4; ++i) {
+            env->cp15.sctlr_el[i] |= SCTLR_EE;
+        }
+#endif
     }
 #elif defined(TARGET_ARM)
     {
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 2/7] linux-user: Add separate aarch64_be uname
  2017-12-20 21:23 [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target Michael Weiser
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 1/7] linux-user: Add support for big-endian aarch64 Michael Weiser
@ 2017-12-20 21:23 ` Michael Weiser
  2017-12-21 10:02   ` Laurent Vivier
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 3/7] linux-user: Fix endianess of aarch64 signal trampoline Michael Weiser
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Michael Weiser @ 2017-12-20 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Weiser, Riku Voipio, Laurent Vivier

Make big-endian aarch64 systems identify as aarch64_be as expected by
big-endian userland and toolchains.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/aarch64/target_syscall.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/target_syscall.h
index 1b62953eeb..604ab99b14 100644
--- a/linux-user/aarch64/target_syscall.h
+++ b/linux-user/aarch64/target_syscall.h
@@ -8,7 +8,11 @@ struct target_pt_regs {
     uint64_t        pstate;
 };
 
+#if defined(TARGET_WORDS_BIGENDIAN)
+#define UNAME_MACHINE "aarch64_be"
+#else
 #define UNAME_MACHINE "aarch64"
+#endif
 #define UNAME_MINIMUM_RELEASE "3.8.0"
 #define TARGET_CLONE_BACKWARDS
 #define TARGET_MINSIGSTKSZ       2048
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 3/7] linux-user: Fix endianess of aarch64 signal trampoline
  2017-12-20 21:23 [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target Michael Weiser
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 1/7] linux-user: Add support for big-endian aarch64 Michael Weiser
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 2/7] linux-user: Add separate aarch64_be uname Michael Weiser
@ 2017-12-20 21:23 ` Michael Weiser
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 4/7] configure: Add aarch64_be-linux-user target Michael Weiser
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Michael Weiser @ 2017-12-20 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Weiser, Riku Voipio, Laurent Vivier

Since for aarch64 the signal trampoline is synthesized directly into the
signal frame we need to make sure the instructions end up little-endian.
Otherwise the wrong endianness will cause a SIGILL upon return from the
signal handler on big-endian targets.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/signal.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index dae14d4a89..81b7fbeb1e 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -1599,9 +1599,13 @@ static void target_setup_frame(int usig, struct target_sigaction *ka,
     if (ka->sa_flags & TARGET_SA_RESTORER) {
         return_addr = ka->sa_restorer;
     } else {
-        /* mov x8,#__NR_rt_sigreturn; svc #0 */
-        __put_user(0xd2801168, &frame->tramp[0]);
-        __put_user(0xd4000001, &frame->tramp[1]);
+        /*
+         * mov x8,#__NR_rt_sigreturn; svc #0
+         * Since these are instructions they need to be put as little-endian
+         * regardless of target default or current CPU endianness.
+         */
+        __put_user_e(0xd2801168, &frame->tramp[0], le);
+        __put_user_e(0xd4000001, &frame->tramp[1], le);
         return_addr = frame_addr + offsetof(struct target_rt_sigframe, tramp);
     }
     env->xregs[0] = usig;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 4/7] configure: Add aarch64_be-linux-user target
  2017-12-20 21:23 [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target Michael Weiser
                   ` (2 preceding siblings ...)
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 3/7] linux-user: Fix endianess of aarch64 signal trampoline Michael Weiser
@ 2017-12-20 21:23 ` Michael Weiser
  2017-12-21 10:01   ` Laurent Vivier
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 5/7] linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh Michael Weiser
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Michael Weiser @ 2017-12-20 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Weiser, Riku Voipio, Laurent Vivier

Add target aarch64_be-linux-user. This allows a qemu-aarch64_be binary
to be built that will run big-endian aarch64 binaries.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 configure                                 | 5 +++--
 default-configs/aarch64_be-linux-user.mak | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
 create mode 100644 default-configs/aarch64_be-linux-user.mak

diff --git a/configure b/configure
index 9c8aa5a98b..95d5808be1 100755
--- a/configure
+++ b/configure
@@ -6369,7 +6369,7 @@ target_name=$(echo $target | cut -d '-' -f 1)
 target_bigendian="no"
 
 case "$target_name" in
-  armeb|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
+  armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
   target_bigendian=yes
   ;;
 esac
@@ -6424,7 +6424,8 @@ case "$target_name" in
     mttcg="yes"
     gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
   ;;
-  aarch64)
+  aarch64|aarch64_be)
+    TARGET_ARCH=aarch64
     TARGET_BASE_ARCH=arm
     bflt="yes"
     mttcg="yes"
diff --git a/default-configs/aarch64_be-linux-user.mak b/default-configs/aarch64_be-linux-user.mak
new file mode 100644
index 0000000000..a69d9d2e41
--- /dev/null
+++ b/default-configs/aarch64_be-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for aarch64_be-linux-user
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 5/7] linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh
  2017-12-20 21:23 [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target Michael Weiser
                   ` (3 preceding siblings ...)
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 4/7] configure: Add aarch64_be-linux-user target Michael Weiser
@ 2017-12-20 21:23 ` Michael Weiser
  2017-12-21 10:01   ` Laurent Vivier
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 6/7] linux-user: Separate binfmt arm CPU families Michael Weiser
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Michael Weiser @ 2017-12-20 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Weiser, Riku Voipio, Laurent Vivier

As we now have a linux-user aarch64_be target, we can add it to the list
of supported targets in qemu-binfmt-conf.sh

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
---
 scripts/qemu-binfmt-conf.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 8afc3eb5bb..d69953525c 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -4,7 +4,7 @@
 
 qemu_target_list="i386 i486 alpha arm sparc32plus ppc ppc64 ppc64le m68k \
 mips mipsel mipsn32 mipsn32el mips64 mips64el \
-sh4 sh4eb s390x aarch64 hppa"
+sh4 sh4eb s390x aarch64 aarch64_be hppa"
 
 i386_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00'
 i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
@@ -92,6 +92,10 @@ aarch64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
 aarch64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
 aarch64_family=arm
 
+aarch64_be_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'
+aarch64_be_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
+aarch64_be_family=arm
+
 hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f'
 hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
 hppa_family=hppa
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 6/7] linux-user: Separate binfmt arm CPU families
  2017-12-20 21:23 [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target Michael Weiser
                   ` (4 preceding siblings ...)
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 5/7] linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh Michael Weiser
@ 2017-12-20 21:23 ` Michael Weiser
  2017-12-21  9:59   ` Laurent Vivier
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 7/7] linux-user: Activate armeb handler registration Michael Weiser
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Michael Weiser @ 2017-12-20 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Weiser, Riku Voipio, Laurent Vivier

Give big-endian arm and aarch64 CPUs their own family in
qemu-binfmt-conf.sh to make sure we register qemu-user for binaries of
the opposite endianness on arm and aarch64. Apart from the family
assignments of the magic vales, qemu_get_family() needs to be able to
distinguish the two and recognise aarch64{,_be} as well.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
---
 scripts/qemu-binfmt-conf.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index d69953525c..597efdbe50 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -24,7 +24,7 @@ arm_family=arm
 
 armeb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28'
 armeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
-armeb_family=arm
+armeb_family=armeb
 
 sparc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02'
 sparc_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
@@ -94,7 +94,7 @@ aarch64_family=arm
 
 aarch64_be_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'
 aarch64_be_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
-aarch64_be_family=arm
+aarch64_be_family=armeb
 
 hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f'
 hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
@@ -115,9 +115,12 @@ qemu_get_family() {
     ppc64el|ppc64le)
         echo "ppcle"
         ;;
-    arm|armel|armhf|arm64|armv[4-9]*)
+    arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
         echo "arm"
         ;;
+    armeb|armv[4-9]*b|aarch64_be)
+        echo "armeb"
+        ;;
     sparc*)
         echo "sparc"
         ;;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 7/7] linux-user: Activate armeb handler registration
  2017-12-20 21:23 [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target Michael Weiser
                   ` (5 preceding siblings ...)
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 6/7] linux-user: Separate binfmt arm CPU families Michael Weiser
@ 2017-12-20 21:23 ` Michael Weiser
  2017-12-21  9:58   ` Laurent Vivier
  2017-12-20 21:52 ` [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target no-reply
  2018-01-08 12:06 ` Peter Maydell
  8 siblings, 1 reply; 15+ messages in thread
From: Michael Weiser @ 2017-12-20 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Weiser, Riku Voipio, Laurent Vivier

armeb is missing from the target list in qemu-binfmt-conf.sh. Add it so
the handler for those binaries gets registered by the script.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
---
 scripts/qemu-binfmt-conf.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 597efdbe50..ea5a748745 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -2,7 +2,7 @@
 # enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390/HPPA
 # program execution by the kernel
 
-qemu_target_list="i386 i486 alpha arm sparc32plus ppc ppc64 ppc64le m68k \
+qemu_target_list="i386 i486 alpha arm armeb sparc32plus ppc ppc64 ppc64le m68k \
 mips mipsel mipsn32 mipsn32el mips64 mips64el \
 sh4 sh4eb s390x aarch64 aarch64_be hppa"
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v3 0/7]  Add aarch64_be-linux-user target
  2017-12-20 21:23 [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target Michael Weiser
                   ` (6 preceding siblings ...)
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 7/7] linux-user: Activate armeb handler registration Michael Weiser
@ 2017-12-20 21:52 ` no-reply
  2018-01-08 12:06 ` Peter Maydell
  8 siblings, 0 replies; 15+ messages in thread
From: no-reply @ 2017-12-20 21:52 UTC (permalink / raw)
  To: michael.weiser; +Cc: famz, qemu-devel, riku.voipio, laurent

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20171220212308.12614-1-michael.weiser@gmx.de
Subject: [Qemu-devel] [PATCH v3 0/7]  Add aarch64_be-linux-user target

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/1513617273-7988-1-git-send-email-thuth@redhat.com -> patchew/1513617273-7988-1-git-send-email-thuth@redhat.com
Switched to a new branch 'test'
66f0907f64 linux-user: Activate armeb handler registration
da88dc8d67 linux-user: Separate binfmt arm CPU families
14ba0c4689 linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh
bfcb2786c6 configure: Add aarch64_be-linux-user target
69bf6c6262 linux-user: Fix endianess of aarch64 signal trampoline
17d95be0b5 linux-user: Add separate aarch64_be uname
7e24032d98 linux-user: Add support for big-endian aarch64

=== OUTPUT BEGIN ===
Checking PATCH 1/7: linux-user: Add support for big-endian aarch64...
Checking PATCH 2/7: linux-user: Add separate aarch64_be uname...
Checking PATCH 3/7: linux-user: Fix endianess of aarch64 signal trampoline...
Checking PATCH 4/7: configure: Add aarch64_be-linux-user target...
Checking PATCH 5/7: linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh...
WARNING: line over 80 characters
#30: FILE: scripts/qemu-binfmt-conf.sh:95:
+aarch64_be_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'

ERROR: line over 90 characters
#31: FILE: scripts/qemu-binfmt-conf.sh:96:
+aarch64_be_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'

total: 1 errors, 1 warnings, 18 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 6/7: linux-user: Separate binfmt arm CPU families...
Checking PATCH 7/7: linux-user: Activate armeb handler registration...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v3 7/7] linux-user: Activate armeb handler registration
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 7/7] linux-user: Activate armeb handler registration Michael Weiser
@ 2017-12-21  9:58   ` Laurent Vivier
  0 siblings, 0 replies; 15+ messages in thread
From: Laurent Vivier @ 2017-12-21  9:58 UTC (permalink / raw)
  To: Michael Weiser, qemu-devel; +Cc: Riku Voipio

Le 20/12/2017 à 22:23, Michael Weiser a écrit :
> armeb is missing from the target list in qemu-binfmt-conf.sh. Add it so
> the handler for those binaries gets registered by the script.
> 
> Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
> ---
>  scripts/qemu-binfmt-conf.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
> index 597efdbe50..ea5a748745 100755
> --- a/scripts/qemu-binfmt-conf.sh
> +++ b/scripts/qemu-binfmt-conf.sh
> @@ -2,7 +2,7 @@
>  # enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390/HPPA
>  # program execution by the kernel
>  
> -qemu_target_list="i386 i486 alpha arm sparc32plus ppc ppc64 ppc64le m68k \
> +qemu_target_list="i386 i486 alpha arm armeb sparc32plus ppc ppc64 ppc64le m68k \
>  mips mipsel mipsn32 mipsn32el mips64 mips64el \
>  sh4 sh4eb s390x aarch64 aarch64_be hppa"
>  
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v3 6/7] linux-user: Separate binfmt arm CPU families
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 6/7] linux-user: Separate binfmt arm CPU families Michael Weiser
@ 2017-12-21  9:59   ` Laurent Vivier
  0 siblings, 0 replies; 15+ messages in thread
From: Laurent Vivier @ 2017-12-21  9:59 UTC (permalink / raw)
  To: Michael Weiser, qemu-devel; +Cc: Riku Voipio

Le 20/12/2017 à 22:23, Michael Weiser a écrit :
> Give big-endian arm and aarch64 CPUs their own family in
> qemu-binfmt-conf.sh to make sure we register qemu-user for binaries of
> the opposite endianness on arm and aarch64. Apart from the family
> assignments of the magic vales, qemu_get_family() needs to be able to
> distinguish the two and recognise aarch64{,_be} as well.
> 
> Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
> ---
>  scripts/qemu-binfmt-conf.sh | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
> index d69953525c..597efdbe50 100755
> --- a/scripts/qemu-binfmt-conf.sh
> +++ b/scripts/qemu-binfmt-conf.sh
> @@ -24,7 +24,7 @@ arm_family=arm
>  
>  armeb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28'
>  armeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
> -armeb_family=arm
> +armeb_family=armeb
>  
>  sparc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02'
>  sparc_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
> @@ -94,7 +94,7 @@ aarch64_family=arm
>  
>  aarch64_be_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'
>  aarch64_be_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
> -aarch64_be_family=arm
> +aarch64_be_family=armeb
>  
>  hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f'
>  hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
> @@ -115,9 +115,12 @@ qemu_get_family() {
>      ppc64el|ppc64le)
>          echo "ppcle"
>          ;;
> -    arm|armel|armhf|arm64|armv[4-9]*)
> +    arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
>          echo "arm"
>          ;;
> +    armeb|armv[4-9]*b|aarch64_be)
> +        echo "armeb"
> +        ;;
>      sparc*)
>          echo "sparc"
>          ;;
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v3 5/7] linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 5/7] linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh Michael Weiser
@ 2017-12-21 10:01   ` Laurent Vivier
  0 siblings, 0 replies; 15+ messages in thread
From: Laurent Vivier @ 2017-12-21 10:01 UTC (permalink / raw)
  To: Michael Weiser, qemu-devel; +Cc: Riku Voipio

Le 20/12/2017 à 22:23, Michael Weiser a écrit :
> As we now have a linux-user aarch64_be target, we can add it to the list
> of supported targets in qemu-binfmt-conf.sh
> 
> Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
> ---
>  scripts/qemu-binfmt-conf.sh | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
> index 8afc3eb5bb..d69953525c 100755
> --- a/scripts/qemu-binfmt-conf.sh
> +++ b/scripts/qemu-binfmt-conf.sh
> @@ -4,7 +4,7 @@
>  
>  qemu_target_list="i386 i486 alpha arm sparc32plus ppc ppc64 ppc64le m68k \
>  mips mipsel mipsn32 mipsn32el mips64 mips64el \
> -sh4 sh4eb s390x aarch64 hppa"
> +sh4 sh4eb s390x aarch64 aarch64_be hppa"
>  
>  i386_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00'
>  i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
> @@ -92,6 +92,10 @@ aarch64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
>  aarch64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
>  aarch64_family=arm
>  
> +aarch64_be_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'
> +aarch64_be_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
> +aarch64_be_family=arm
> +
>  hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f'
>  hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
>  hppa_family=hppa
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v3 4/7] configure: Add aarch64_be-linux-user target
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 4/7] configure: Add aarch64_be-linux-user target Michael Weiser
@ 2017-12-21 10:01   ` Laurent Vivier
  0 siblings, 0 replies; 15+ messages in thread
From: Laurent Vivier @ 2017-12-21 10:01 UTC (permalink / raw)
  To: Michael Weiser, qemu-devel; +Cc: Riku Voipio

Le 20/12/2017 à 22:23, Michael Weiser a écrit :
> Add target aarch64_be-linux-user. This allows a qemu-aarch64_be binary
> to be built that will run big-endian aarch64 binaries.
> 
> Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  configure                                 | 5 +++--
>  default-configs/aarch64_be-linux-user.mak | 1 +
>  2 files changed, 4 insertions(+), 2 deletions(-)
>  create mode 100644 default-configs/aarch64_be-linux-user.mak
> 
> diff --git a/configure b/configure
> index 9c8aa5a98b..95d5808be1 100755
> --- a/configure
> +++ b/configure
> @@ -6369,7 +6369,7 @@ target_name=$(echo $target | cut -d '-' -f 1)
>  target_bigendian="no"
>  
>  case "$target_name" in
> -  armeb|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
> +  armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
>    target_bigendian=yes
>    ;;
>  esac
> @@ -6424,7 +6424,8 @@ case "$target_name" in
>      mttcg="yes"
>      gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
>    ;;
> -  aarch64)
> +  aarch64|aarch64_be)
> +    TARGET_ARCH=aarch64
>      TARGET_BASE_ARCH=arm
>      bflt="yes"
>      mttcg="yes"
> diff --git a/default-configs/aarch64_be-linux-user.mak b/default-configs/aarch64_be-linux-user.mak
> new file mode 100644
> index 0000000000..a69d9d2e41
> --- /dev/null
> +++ b/default-configs/aarch64_be-linux-user.mak
> @@ -0,0 +1 @@
> +# Default configuration for aarch64_be-linux-user
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v3 2/7] linux-user: Add separate aarch64_be uname
  2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 2/7] linux-user: Add separate aarch64_be uname Michael Weiser
@ 2017-12-21 10:02   ` Laurent Vivier
  0 siblings, 0 replies; 15+ messages in thread
From: Laurent Vivier @ 2017-12-21 10:02 UTC (permalink / raw)
  To: Michael Weiser, qemu-devel; +Cc: Riku Voipio

Le 20/12/2017 à 22:23, Michael Weiser a écrit :
> Make big-endian aarch64 systems identify as aarch64_be as expected by
> big-endian userland and toolchains.
> 
> Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  linux-user/aarch64/target_syscall.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/target_syscall.h
> index 1b62953eeb..604ab99b14 100644
> --- a/linux-user/aarch64/target_syscall.h
> +++ b/linux-user/aarch64/target_syscall.h
> @@ -8,7 +8,11 @@ struct target_pt_regs {
>      uint64_t        pstate;
>  };
>  
> +#if defined(TARGET_WORDS_BIGENDIAN)
> +#define UNAME_MACHINE "aarch64_be"
> +#else
>  #define UNAME_MACHINE "aarch64"
> +#endif
>  #define UNAME_MINIMUM_RELEASE "3.8.0"
>  #define TARGET_CLONE_BACKWARDS
>  #define TARGET_MINSIGSTKSZ       2048
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target
  2017-12-20 21:23 [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target Michael Weiser
                   ` (7 preceding siblings ...)
  2017-12-20 21:52 ` [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target no-reply
@ 2018-01-08 12:06 ` Peter Maydell
  8 siblings, 0 replies; 15+ messages in thread
From: Peter Maydell @ 2018-01-08 12:06 UTC (permalink / raw)
  To: Michael Weiser; +Cc: QEMU Developers, Riku Voipio, Laurent Vivier

On 20 December 2017 at 21:23, Michael Weiser <michael.weiser@gmx.de> wrote:
> Hello,
>
> below patches add support for big-endian aarch64 to linux-user. Almost
> everything is already in place. The patches just set up the CPU flags as
> required for big-endianness, add a distinction in uname and make sure the
> instructions for the signal trampoline end up in memory little-endian.
> Finally, configure is extended to allow building of a
> aarch64_be-linux-user target and scripts/qemu-binfmt-conf.sh to include
> the binfmt magic for aarch64_be ELF files.
>
> While at it, scripts/qemu-binfmt-conf.sh is changed again to separate
> arm/aarch64 targets of differing endianness into separate families so
> that the binfmt handler for the respective other endianness is indeed
> registered.  Also, while not strictly relevant to aarch64 support, armeb
> is actually added to the list of targets, binfmt handlers should
> registered for.
>
> With this I am able to run individual aarch64_be binaries as well as
> chroot into a full-blown aarch64_be userland using binfmt_misc, running
> and compiling things (Gentoo crossdev/native).
>
> v3:
> - drop changes to aarch64 host support from configure
> - add binfmt arm CPU family separation
> - add armeb to binfmt handler targets
>
> v2:
> - add binfmt magic to qemu-binfmt-conf.sh
> - fix style problems (tab indenting)

Thanks for this patchset -- I have applied it to target-arm.next.

-- PMM

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-01-08 12:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-20 21:23 [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target Michael Weiser
2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 1/7] linux-user: Add support for big-endian aarch64 Michael Weiser
2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 2/7] linux-user: Add separate aarch64_be uname Michael Weiser
2017-12-21 10:02   ` Laurent Vivier
2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 3/7] linux-user: Fix endianess of aarch64 signal trampoline Michael Weiser
2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 4/7] configure: Add aarch64_be-linux-user target Michael Weiser
2017-12-21 10:01   ` Laurent Vivier
2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 5/7] linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh Michael Weiser
2017-12-21 10:01   ` Laurent Vivier
2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 6/7] linux-user: Separate binfmt arm CPU families Michael Weiser
2017-12-21  9:59   ` Laurent Vivier
2017-12-20 21:23 ` [Qemu-devel] [PATCH v3 7/7] linux-user: Activate armeb handler registration Michael Weiser
2017-12-21  9:58   ` Laurent Vivier
2017-12-20 21:52 ` [Qemu-devel] [PATCH v3 0/7] Add aarch64_be-linux-user target no-reply
2018-01-08 12:06 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.