Skip to contentSkip to conversation

linux-user: some patches for hppa

PATCH Superseded Laurent Vivier 3 participants 6 messages Jan 25, 2017 exec and binfmt

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover linux-user: some patches for hppa

This short series enables hppa in qemu-binfmt-conf.sh, and fixes a bug in the netlink functions that has been found by Adrian Glaubitz while he was testing a debian chroot with qemu-hppa. I think the problem doesn't appear on other architectures I have tested as they should use NR_socketcall syscall instead of NR_socket syscall.

v2:
added the hppa UTS machine name fix
added R-b and T-b

Laurent Vivier (3):
linux-user: add hppa magic numbers in qemu-binfmt-conf.sh
linux-user: fix "apt-get update" on linux-user hppa
linux-user: define correct UTS machine name for hppa

 linux-user/syscall.c        | 1 -
 linux-user/uname.c          | 2 ++
 scripts/qemu-binfmt-conf.sh | 9 +++++++--
 3 files changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH v2 1/3 linux-user: add hppa magic numbers in qemu-binfmt-conf.sh

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

---
 scripts/qemu-binfmt-conf.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
scripts/qemu-binfmt-conf.sh +7 -2
index de4d1c1..0f1aa63 100755
@@ -1,9 +1,10 @@
 #!/bin/sh
-# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390 program execution by the kernel
+# 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 \
 mips mipsel mipsn32 mipsn32el mips64 mips64el \
-sh4 sh4eb s390x aarch64"
+sh4 sh4eb s390x aarch64 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'
@@ -91,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
 
+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
+
 qemu_get_family() {
     cpu=${HOST_ARCH:-$(uname -m)}
     case "$cpu" in
Signature · 1 line
2.9.3
#2 lore raw

PATCH v2 2/3 linux-user: fix "apt-get update" on linux-user hppa

In reply to Laurent Vivier

apt-get was hanging on linux-user hppa.

strace has shown the netlink data stream was not correctly byte swapped.

It appears the fd translator function is unregistered just after it has been registered, so the translator function is not called.

This patch removes the fd_trans_unregister() after the do_socket() in the TARGET_NR_socket case.

This fd_trans_unregister() was added by commit
e36800c linux-user: add signalfd/signalfd4 syscalls
when do_socket() was not registering any fd translator.
And as now it is, we must remove this fd_trans_unregister() to keep them.

---
 linux-user/syscall.c | 1 -
 1 file changed, 1 deletion(-)
linux-user/syscall.c +0 -1
index 11a311f..9be8e95 100644
@@ -9343,7 +9343,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #ifdef TARGET_NR_socket
     case TARGET_NR_socket:
         ret = do_socket(arg1, arg2, arg3);
-        fd_trans_unregister(ret);
         break;
 #endif
 #ifdef TARGET_NR_socketpair
Signature · 1 line
2.9.3
#3 lore raw

PATCH v2 3/3 linux-user: define correct UTS machine name for hppa

In reply to Laurent Vivier

the correct UTS machine name (as expected by systemd) is "parisc", not "hppa".

---
 linux-user/uname.c | 2 ++
 1 file changed, 2 insertions(+)
linux-user/uname.c +2 -0
index 313b79d..daad002 100644
@@ -63,6 +63,8 @@ const char *cpu_to_uname_machine(void *cpu_env)
         return "i586";
     }
     return "i686";
+#elif defined(TARGET_HPPA)
+    return "parisc";
 #else
     /* default is #define-d in each arch/ subdir */
     return UNAME_MACHINE;
Signature · 1 line
2.9.3
#4 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] linux-user: define correct UTS machine name for hppa

Quoted 13 lines · Laurent Vivier

the correct UTS machine name (as expected by systemd) is "parisc", not "hppa".

---
 linux-user/uname.c | 2 ++
 1 file changed, 2 insertions(+)
linux-user/uname.c +0 -0
index 313b79d..daad002 100644

linux-user/uname.c const char *cpu_to_uname_machine(void *cpu_env) · line 70

Quoted 8 lines
linux-user/uname.c +2 -0
@@ -63,6 +63,8 @@ const char *cpu_to_uname_machine(void *cpu_env)
         return "i586";
     }
     return "i686";
+#elif defined(TARGET_HPPA)
+    return "parisc";
 #else
     /* default is #define-d in each arch/ subdir */
     return UNAME_MACHINE;

This function is for when the uname string has to be determined at runtime. If this target has a fixed string, then you should just set UNAME_MACHINE correctly in linux-user/$ARCH/target_syscall.h.

thanks
-- PMM

#5 lore raw
In reply to Laurent Vivier
Your series seems to have some coding style problems. See output below for more information:

Hi,

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

Type: series
Subject: [Qemu-devel] [PATCH v2 0/3] linux-user: some patches for hppa
Message-id: [email protected]

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

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

# Useful git options
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
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
c426c84 linux-user: define correct UTS machine name for hppa 1566132 linux-user: fix "apt-get update" on linux-user hppa 97a848f linux-user: add hppa magic numbers in qemu-binfmt-conf.sh

=== OUTPUT BEGIN ===
Checking PATCH 1/3: linux-user: add hppa magic numbers in qemu-binfmt-conf.sh...
ERROR: line over 90 characters
#34: FILE: scripts/qemu-binfmt-conf.sh:95:
+hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f'

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

total: 2 errors, 0 warnings, 22 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 2/3: linux-user: fix "apt-get update" on linux-user hppa... Checking PATCH 3/3: linux-user: define correct UTS machine name for hppa... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]