Skip to contentSkip to conversation

Support ppc64le binfmt registration

PATCH In review Serge E. Hallyn 3 participants 10 messages Aug 27, 2014 – Aug 28, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support ppc64le binfmt registration

This is a part of a patch proposed by jaejunh at
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1358268
which enables running ppc64le binaries through qemu-user.

Not sure if it's the right way to do it, but it does allow me to chroot into a ppc64el rootfs on amd64 host.

---
 configure                            | 7 +++++++
 default-configs/ppcle-linux-user.mak | 2 ++
 linux-user/ppc/syscall.h             | 4 ++++
 3 files changed, 13 insertions(+)
 create mode 100644 default-configs/ppcle-linux-user.mak
configure +7 -0
index 2063cf6..0c52a3e 100755
@@ -5070,6 +5070,13 @@ case "$target_name" in
     TARGET_ABI_DIR=ppc
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
   ;;
+  ppcle)
+    TARGET_ARCH=ppc64
+    TARGET_BASE_ARCH=ppc
+    TARGET_ABI_DIR=ppc
+    echo "TARGET_ABI32=y" >> $config_target_mak
+    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+  ;;
   ppc64abi32)
     TARGET_ARCH=ppc64
     TARGET_BASE_ARCH=ppc
default-configs/ppcle-linux-user.mak new file +2 -0
new file mode 100644
index 0000000..aa09263
@@ -0,0 +1,2 @@
+# Default configuration for ppcle-linux-user
+CONFIG_LIBDECNUMBER=y
linux-user/ppc/syscall.h +4 -0
index 0daf5cd..a033323 100644
@@ -64,7 +64,11 @@ struct target_revectored_struct {
 #define UNAME_MACHINE "ppc64le"
 #endif
 #else
+#ifdef TARGET_WORDS_BIGENDIAN
 #define UNAME_MACHINE "ppc"
+#else
+#define UNAME_MACHINE "ppcle"
+#endif
 #endif
 #define UNAME_MINIMUM_RELEASE "2.6.32"
 
Signature · 1 line
2.1.0
#2 lore raw
Quoted 9 lines · Peter Maydell
Quoted 3 lines · Serge E. Hallyn

This is a part of a patch proposed by jaejunh at
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1358268
which enables running ppc64le binaries through qemu-user.

I'm confused -- wouldn't these be handled by the existing "ppc64le" support?

-- PMM

It looks to me like the point was to add a TARGET_ABI32=y version (and I dunno, something about CONFIG_LIBDECNUMBER=y for 32-bit).

#3 lore raw

[adding qemu-ppc]

Quoted 6 lines · Serge E. Hallyn
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Serge E. Hallyn

This is a part of a patch proposed by jaejunh at
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1358268
which enables running ppc64le binaries through qemu-user.

Quoted 6 lines
Quoted 2 lines

I'm confused -- wouldn't these be handled by the existing "ppc64le" support?

It looks to me like the point was to add a TARGET_ABI32=y version (and I dunno, something about CONFIG_LIBDECNUMBER=y for 32-bit).

Wouldn't that be a "ppc64leabi32" target? (something of a mouthful, admittedly). In any case I wouldn't expect it to be used by a ppc64le chroot as you suggest. Conversely, a "ppcle" ought to be a 32-bit little endian PPC, not a "32 bit ABI on 64 bit CPUs" variant. Anyway, this should be driven by "what are the ABIs that the kernel provides", on which question I defer to the PPC folks.

(It looks like some of this confusion stems from the original bug report being actually two separate bugs. The ppc64le related part is purely "ubuntu isn't registering the binfmt", which isn't an upstream issue at all.)

thanks
-- PMM

#4 lore raw
Quoted 9 lines · Peter Maydell

[adding qemu-ppc]

Quoted 6 lines · Serge E. Hallyn
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Serge E. Hallyn

This is a part of a patch proposed by jaejunh at
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1358268
which enables running ppc64le binaries through qemu-user.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I'm confused -- wouldn't these be handled by the existing "ppc64le" support?

It looks to me like the point was to add a TARGET_ABI32=y version (and I dunno, something about CONFIG_LIBDECNUMBER=y for 32-bit).

Wouldn't that be a "ppc64leabi32" target?

There is no LE support for 32bit on PPC :).

Alex

#5 lore raw
Quoted 15 lines · Alexander Graf
Quoted 12 lines · Peter Maydell

[adding qemu-ppc]

Quoted 8 lines · Serge E. Hallyn
Quoted 7 lines · Peter Maydell
Quoted 3 lines · Serge E. Hallyn

This is a part of a patch proposed by jaejunh at
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1358268
which enables running ppc64le binaries through qemu-user.

I'm confused -- wouldn't these be handled by the existing "ppc64le" support?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

It looks to me like the point was to add a TARGET_ABI32=y version (and I dunno, something about CONFIG_LIBDECNUMBER=y for 32-bit).

Wouldn't that be a "ppc64leabi32" target?

There is no LE support for 32bit on PPC :).

...in that case what is the original bug reporter actually asking for?

-- PMM

#6 lore raw
Quoted 20 lines · Peter Maydell
Quoted 19 lines · Alexander Graf
Quoted 16 lines · Peter Maydell

[adding qemu-ppc]

Quoted 12 lines · Serge E. Hallyn
Quoted 7 lines · Peter Maydell
Quoted 3 lines · Serge E. Hallyn

This is a part of a patch proposed by jaejunh at
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1358268
which enables running ppc64le binaries through qemu-user.

I'm confused -- wouldn't these be handled by the existing "ppc64le" support?

It looks to me like the point was to add a TARGET_ABI32=y version (and I dunno, something about CONFIG_LIBDECNUMBER=y for 32-bit).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Wouldn't that be a "ppc64leabi32" target?

There is no LE support for 32bit on PPC :).

...in that case what is the original bug reporter actually asking for?

Not sure - the only thing that remotely resembles what he's describing would be if you enable the 32bit personality:

  $ /uname-a.sh
  Linux tempranillo 3.17.0-rc1-2-default+ #1 SMP Thu Jan 1 01:04:00 CET
  1970 ppc64le ppc64le ppc64le GNU/Linux
  $ perl -e 'syscall(136, 8); exec "/uname-a.sh"'
  Linux tempranillo 3.17.0-rc1-2-default+ #1 SMP Thu Jan 1 01:04:00 CET
  1970 ppcle ppcle ppcle GNU/Linux

but that doesn't mean that there is an actual ABI change. The ABI is still ppc64le, as all binaries are still running in 64bit mode.

So before we add anything to QEMU, I would like to first see someone point me to kernel patches that actually enable LE on Linux for 32bit user space. So far I'm not aware of any (and I doubt it makes much sense).

Alex

#7 lore raw
Quoted 41 lines · Alexander Graf
Quoted 20 lines · Peter Maydell
Quoted 19 lines · Alexander Graf
Quoted 16 lines · Peter Maydell

[adding qemu-ppc]

Quoted 12 lines · Serge E. Hallyn
Quoted 7 lines · Peter Maydell
Quoted 3 lines · Serge E. Hallyn

This is a part of a patch proposed by jaejunh at
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1358268
which enables running ppc64le binaries through qemu-user.

I'm confused -- wouldn't these be handled by the existing "ppc64le" support?

It looks to me like the point was to add a TARGET_ABI32=y version (and I dunno, something about CONFIG_LIBDECNUMBER=y for 32-bit).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Wouldn't that be a "ppc64leabi32" target?

There is no LE support for 32bit on PPC :).

...in that case what is the original bug reporter actually asking for?

Not sure - the only thing that remotely resembles what he's describing would be if you enable the 32bit personality:

  $ /uname-a.sh
  Linux tempranillo 3.17.0-rc1-2-default+ #1 SMP Thu Jan 1 01:04:00 CET
  1970 ppc64le ppc64le ppc64le GNU/Linux
  $ perl -e 'syscall(136, 8); exec "/uname-a.sh"'
  Linux tempranillo 3.17.0-rc1-2-default+ #1 SMP Thu Jan 1 01:04:00 CET
  1970 ppcle ppcle ppcle GNU/Linux
Quoted 6 lines

but that doesn't mean that there is an actual ABI change. The ABI is still ppc64le, as all binaries are still running in 64bit mode.

So before we add anything to QEMU, I would like to first see someone point me to kernel patches that actually enable LE on Linux for 32bit user space. So far I'm not aware of any (and I doubt it makes much sense).

Thanks, guys, I'll ping him for that.

#8 lore raw
Quoted 42 lines · Serge E. Hallyn
Quoted 41 lines · Alexander Graf
Quoted 20 lines · Peter Maydell
Quoted 19 lines · Alexander Graf
Quoted 16 lines · Peter Maydell

[adding qemu-ppc]

Quoted 12 lines · Serge E. Hallyn
Quoted 7 lines · Peter Maydell
Quoted 3 lines · Serge E. Hallyn

This is a part of a patch proposed by jaejunh at
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1358268
which enables running ppc64le binaries through qemu-user.

I'm confused -- wouldn't these be handled by the existing "ppc64le" support?

It looks to me like the point was to add a TARGET_ABI32=y version (and I dunno, something about CONFIG_LIBDECNUMBER=y for 32-bit).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Wouldn't that be a "ppc64leabi32" target?

There is no LE support for 32bit on PPC :).

...in that case what is the original bug reporter actually asking for?

Not sure - the only thing that remotely resembles what he's describing would be if you enable the 32bit personality:

  $ /uname-a.sh
  Linux tempranillo 3.17.0-rc1-2-default+ #1 SMP Thu Jan 1 01:04:00 CET
  1970 ppc64le ppc64le ppc64le GNU/Linux
  $ perl -e 'syscall(136, 8); exec "/uname-a.sh"'
  Linux tempranillo 3.17.0-rc1-2-default+ #1 SMP Thu Jan 1 01:04:00 CET
  1970 ppcle ppcle ppcle GNU/Linux
Quoted 8 lines
Quoted 6 lines

but that doesn't mean that there is an actual ABI change. The ABI is still ppc64le, as all binaries are still running in 64bit mode.

So before we add anything to QEMU, I would like to first see someone point me to kernel patches that actually enable LE on Linux for 32bit user space. So far I'm not aware of any (and I doubt it makes much sense).

Thanks, guys, I'll ping him for that.

(Fwiw my reading of the original bug description is that in fact he is working on the kernel patch in question)

#9 lore raw
Quoted 10 lines · Serge E. Hallyn
Quoted 6 lines · Serge E. Hallyn
Quoted 3 lines · Alexander Graf

So before we add anything to QEMU, I would like to first see someone point me to kernel patches that actually enable LE on Linux for 32bit user space. So far I'm not aware of any (and I doubt it makes much sense).

Thanks, guys, I'll ping him for that.

(Fwiw my reading of the original bug description is that in fact he is working on the kernel patch in question)

My take on that would be that we would want to wait for kernel work to hit mainline before taking the corresponding QEMU changes. (In particular there's always the possibility of ABI changes like syscall numbering or struct layout being required as part of the kernel patch review process. We made this mistake before in letting the unicore support get in when it wasn't the upstream kernel ABI.)

-- PMM