All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc: Add a proper syscall for switching endianness
@ 2015-03-13  4:39 Michael Ellerman
  2015-03-13  4:39 ` [PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall Michael Ellerman
  2015-03-13  6:38 ` [PATCH 1/2] powerpc: Add a proper syscall for switching endianness Michael Ellerman
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Ellerman @ 2015-03-13  4:39 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Jeremy Kerr

We currently have a "special" syscall for switching endianness. This is
syscall number 0x1ebe, which is handled explicitly in the 64-bit syscall
exception entry.

That has a few problems, firstly the syscall number is outside of the
usual range, which confuses various tools. For example strace doesn't
recognise the syscall at all.

Secondly it's handled explicitly as a special case in the syscall
exception entry, which is complicated enough without it.

As a first step toward removing the special syscall, we need to add a
regular syscall that implements the same functionality.

The logic is simple, it simply toggles the MSR_LE bit in the userspace
MSR. This is the same as the special syscall, with the caveat that the
special syscall clobbers fewer registers.

This version clobbers r9-r12, XER, CTR, and CR0-1,5-7.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

fixup
---
 arch/powerpc/include/asm/systbl.h      |  1 +
 arch/powerpc/include/asm/unistd.h      |  2 +-
 arch/powerpc/include/uapi/asm/unistd.h |  1 +
 arch/powerpc/kernel/entry_64.S         |  5 +++++
 arch/powerpc/kernel/syscalls.c         | 17 +++++++++++++++++
 5 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 91062eef582f..c3ee21a1d9cf 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -367,3 +367,4 @@ SYSCALL_SPU(getrandom)
 SYSCALL_SPU(memfd_create)
 SYSCALL_SPU(bpf)
 COMPAT_SYS(execveat)
+PPC_SYS(switch_endian)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 36b79c31eedd..f4f8b667d75b 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -12,7 +12,7 @@
 #include <uapi/asm/unistd.h>
 
 
-#define __NR_syscalls		363
+#define __NR_syscalls		364
 
 #define __NR__exit __NR_exit
 #define NR_syscalls	__NR_syscalls
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h
index ef5b5b1f3123..e4aa173dae62 100644
--- a/arch/powerpc/include/uapi/asm/unistd.h
+++ b/arch/powerpc/include/uapi/asm/unistd.h
@@ -385,5 +385,6 @@
 #define __NR_memfd_create	360
 #define __NR_bpf		361
 #define __NR_execveat		362
+#define __NR_switch_endian	363
 
 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index d180caf2d6de..afbc20019c2e 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -356,6 +356,11 @@ _GLOBAL(ppc64_swapcontext)
 	bl	sys_swapcontext
 	b	.Lsyscall_exit
 
+_GLOBAL(ppc_switch_endian)
+	bl	save_nvgprs
+	bl	sys_switch_endian
+	b	.Lsyscall_exit
+
 _GLOBAL(ret_from_fork)
 	bl	schedule_tail
 	REST_NVGPRS(r1)
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index b2702e87db0d..5fa92706444b 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -121,3 +121,20 @@ long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low,
 	return sys_fadvise64(fd, (u64)offset_high << 32 | offset_low,
 			     (u64)len_high << 32 | len_low, advice);
 }
+
+long sys_switch_endian(void)
+{
+	struct thread_info *ti;
+
+	current->thread.regs->msr ^= MSR_LE;
+
+	/*
+	 * Set TIF_RESTOREALL so that r3 isn't clobbered on return to
+	 * userspace. That also has the effect of restoring the non-volatile
+	 * GPRs, so we saved them on the way in here.
+	 */
+	ti = current_thread_info();
+	ti->flags |= _TIF_RESTOREALL;
+
+	return 0;
+}
-- 
2.1.0

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

* [PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall
  2015-03-13  4:39 [PATCH 1/2] powerpc: Add a proper syscall for switching endianness Michael Ellerman
@ 2015-03-13  4:39 ` Michael Ellerman
  2015-03-13  5:01   ` Michael Ellerman
  2015-03-13  7:10   ` Ram Pai
  2015-03-13  6:38 ` [PATCH 1/2] powerpc: Add a proper syscall for switching endianness Michael Ellerman
  1 sibling, 2 replies; 10+ messages in thread
From: Michael Ellerman @ 2015-03-13  4:39 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Jeremy Kerr

This adds a test of the switch_endian() syscall we added in the previous
commit.

We test it by calling the endian switch syscall, and then executing some
code in the other endian to check everything went as expected. That code
checks registers we expect to be maintained are, and then writes to
stdout and then does exit(0).

If the endian switch failed to happen that code sequence will be illegal
and cause the test to abort.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 tools/testing/selftests/powerpc/Makefile           |   2 +-
 tools/testing/selftests/powerpc/syscalls/Makefile  |  15 ++
 .../selftests/powerpc/syscalls/endian-test.S       | 247 +++++++++++++++++++++
 3 files changed, 263 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/syscalls/Makefile
 create mode 100644 tools/testing/selftests/powerpc/syscalls/endian-test.S

diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile
index 1d5e7ad2c460..5da93b7d1330 100644
--- a/tools/testing/selftests/powerpc/Makefile
+++ b/tools/testing/selftests/powerpc/Makefile
@@ -13,7 +13,7 @@ CFLAGS := -Wall -O2 -flto -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CUR
 
 export CC CFLAGS
 
-TARGETS = pmu copyloops mm tm primitives stringloops
+TARGETS = pmu copyloops mm tm primitives stringloops syscalls
 
 endif
 
diff --git a/tools/testing/selftests/powerpc/syscalls/Makefile b/tools/testing/selftests/powerpc/syscalls/Makefile
new file mode 100644
index 000000000000..b74201fa4f15
--- /dev/null
+++ b/tools/testing/selftests/powerpc/syscalls/Makefile
@@ -0,0 +1,15 @@
+PROGS := endian-test
+
+endian-test: ASFLAGS += -O2 -Wall -g -nostdlib -m64
+
+all: $(PROGS)
+
+run_tests: all
+	@-for PROG in $(PROGS); do \
+		./$$PROG; \
+	done;
+
+clean:
+	rm -f $(PROGS)
+
+.PHONY: all run_tests clean
diff --git a/tools/testing/selftests/powerpc/syscalls/endian-test.S b/tools/testing/selftests/powerpc/syscalls/endian-test.S
new file mode 100644
index 000000000000..0beca323247a
--- /dev/null
+++ b/tools/testing/selftests/powerpc/syscalls/endian-test.S
@@ -0,0 +1,247 @@
+#include <ppc-asm.h>
+#include <asm/unistd.h>
+
+#ifndef __NR_switch_endian
+#define __NR_switch_endian 363
+#endif
+
+	.data
+	.balign 8
+message:
+	.ascii "success: endian-test\n"
+
+	.section .toc
+	.balign 8
+pattern:
+	.llong 0x5555AAAA5555AAAA
+
+	.text
+FUNC_START(_start)
+	/* Load some addresses to start with */
+	ld	r14, message@got(%r2)
+	ld	r15, pattern@toc(%r2)
+
+	/* Setup CR, only CR2-CR4 are maintained */
+	lis	r3, 0x00FF
+	ori	r3, r3, 0xF000
+	mtcr	r3
+
+	/* Load the pattern slightly modified into the registers */
+	mr	r3, r15
+	addi	r4, r15, 4
+
+	addi	r5, r15, 32
+	mtlr	r5
+
+	addi	r5, r15, 5
+	addi	r6, r15, 6
+	addi	r7, r15, 7
+	addi	r8, r15, 8
+
+	/* r9 - r12 are clobbered */
+
+	addi	r13, r15, 13
+
+	/* Skip r14 & r15 we're using them */
+
+	addi	r16, r15, 16
+	addi	r17, r15, 17
+	addi	r18, r15, 18
+	addi	r19, r15, 19
+	addi	r20, r15, 20
+	addi	r21, r15, 21
+	addi	r22, r15, 22
+	addi	r23, r15, 23
+	addi	r24, r15, 24
+	addi	r25, r15, 25
+	addi	r26, r15, 26
+	addi	r27, r15, 27
+	addi	r28, r15, 28
+	addi	r29, r15, 29
+	addi	r30, r15, 30
+	addi	r31, r15, 31
+
+	/*
+	 * Call the syscall to switch endian.
+	 * It clobbers r9-r12, XER, CTR and CR0-1,5-7.
+	 */
+	li r0, __NR_switch_endian
+	sc
+
+	# cmpd    r15,r3
+	.long 0x00182f7c
+	# bne     1f
+	.long 0x50018240
+	# addi    r3,r15,4
+	.long 0x04006f38
+	# cmpd    r3,r4
+	.long 0x0020237c
+	# bne     1f
+	.long 0x44018240
+	# lis     r3,0x00FF
+	.long 0xff00603c
+	# ori     r3,r3,0xF000
+	.long 0x00f06360
+	# mfcr    r4
+	.long 0x2600807c
+	# and     r4,r4,r3
+	.long 0x3818847c
+	# cmpw    r3,r4
+	.long 0x0020037c
+	# addi    r3,r15,34
+	.long 0x22006f38
+	# bne     1f
+	.long 0x28018240
+	# addi    r3,r15,32
+	.long 0x20006f38
+	# mflr    r4
+	.long 0xa602887c
+	# cmpd    r3,r4
+	.long 0x0020237c
+	# bne     1f
+	.long 0x18018240
+	# addi    r3,r15,5
+	.long 0x05006f38
+	# cmpd    r3,r5
+	.long 0x0028237c
+	# bne     1f
+	.long 0x0c018240
+	# addi    r3,r15,6
+	.long 0x06006f38
+	# cmpd    r3,r6
+	.long 0x0030237c
+	# bne     1f
+	.long 0x00018240
+	# addi    r3,r15,7
+	.long 0x07006f38
+	# cmpd    r3,r7
+	.long 0x0038237c
+	# bne     1f
+	.long 0xf4008240
+	# addi    r3,r15,8
+	.long 0x08006f38
+	# cmpd    r3,r8
+	.long 0x0040237c
+	# bne     1f
+	.long 0xe8008240
+	# addi    r3,r15,13
+	.long 0x0d006f38
+	# cmpd    r3,r13
+	.long 0x0068237c
+	# bne     1f
+	.long 0xdc008240
+	# addi    r3,r15,16
+	.long 0x10006f38
+	# cmpd    r3,r16
+	.long 0x0080237c
+	# bne     1f
+	.long 0xd0008240
+	# addi    r3,r15,17
+	.long 0x11006f38
+	# cmpd    r3,r17
+	.long 0x0088237c
+	# bne     1f
+	.long 0xc4008240
+	# addi    r3,r15,18
+	.long 0x12006f38
+	# cmpd    r3,r18
+	.long 0x0090237c
+	# bne     1f
+	.long 0xb8008240
+	# addi    r3,r15,19
+	.long 0x13006f38
+	# cmpd    r3,r19
+	.long 0x0098237c
+	# bne     1f
+	.long 0xac008240
+	# addi    r3,r15,20
+	.long 0x14006f38
+	# cmpd    r3,r20
+	.long 0x00a0237c
+	# bne     1f
+	.long 0xa0008240
+	# addi    r3,r15,21
+	.long 0x15006f38
+	# cmpd    r3,r21
+	.long 0x00a8237c
+	# bne     1f
+	.long 0x94008240
+	# addi    r3,r15,22
+	.long 0x16006f38
+	# cmpd    r3,r22
+	.long 0x00b0237c
+	# bne     1f
+	.long 0x88008240
+	# addi    r3,r15,23
+	.long 0x17006f38
+	# cmpd    r3,r23
+	.long 0x00b8237c
+	# bne     1f
+	.long 0x7c008240
+	# addi    r3,r15,24
+	.long 0x18006f38
+	# cmpd    r3,r24
+	.long 0x00c0237c
+	# bne     1f
+	.long 0x70008240
+	# addi    r3,r15,25
+	.long 0x19006f38
+	# cmpd    r3,r25
+	.long 0x00c8237c
+	# bne     1f
+	.long 0x64008240
+	# addi    r3,r15,26
+	.long 0x1a006f38
+	# cmpd    r3,r26
+	.long 0x00d0237c
+	# bne     1f
+	.long 0x58008240
+	# addi    r3,r15,27
+	.long 0x1b006f38
+	# cmpd    r3,r27
+	.long 0x00d8237c
+	# bne     1f
+	.long 0x4c008240
+	# addi    r3,r15,28
+	.long 0x1c006f38
+	# cmpd    r3,r28
+	.long 0x00e0237c
+	# bne     1f
+	.long 0x40008240
+	# addi    r3,r15,29
+	.long 0x1d006f38
+	# cmpd    r3,r29
+	.long 0x00e8237c
+	# bne     1f
+	.long 0x34008240
+	# addi    r3,r15,30
+	.long 0x1e006f38
+	# cmpd    r3,r30
+	.long 0x00f0237c
+	# bne     1f
+	.long 0x28008240
+	# addi    r3,r15,31
+	.long 0x1f006f38
+	# cmpd    r3,r31
+	.long 0x00f8237c
+	# bne     1f
+	.long 0x1c008240
+	# li      r0,4
+	.long 0x04000038
+	# li      r3,1
+	.long 0x01006038
+	# mr      r4,r14
+	.long 0x7873c47d
+	# li      r5,21
+	.long 0x1500a038
+	# sc
+	.long 0x02000044
+	# li      r3,0
+	.long 0x00006038
+	# 1:
+	# li      r0, __NR_exit
+	.long 0x01000038
+	# sc
+	.long 0x02000044
+	# b       .
+	.long 0x00000048
-- 
2.1.0

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

* Re: [PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall
  2015-03-13  4:39 ` [PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall Michael Ellerman
@ 2015-03-13  5:01   ` Michael Ellerman
  2015-03-13  7:10   ` Ram Pai
  1 sibling, 0 replies; 10+ messages in thread
From: Michael Ellerman @ 2015-03-13  5:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Jeremy Kerr

On Fri, 2015-03-13 at 15:39 +1100, Michael Ellerman wrote:
> diff --git a/tools/testing/selftests/powerpc/syscalls/endian-test.S b/tools/testing/selftests/powerpc/syscalls/endian-test.S
> new file mode 100644
> index 000000000000..0beca323247a
> --- /dev/null
> +++ b/tools/testing/selftests/powerpc/syscalls/endian-test.S
> @@ -0,0 +1,247 @@
> +#include <ppc-asm.h>
> +#include <asm/unistd.h>
> +
> +#ifndef __NR_switch_endian
> +#define __NR_switch_endian 363
> +#endif
> +
> +	.data
> +	.balign 8
> +message:
> +	.ascii "success: endian-test\n"
> +
> +	.section .toc
> +	.balign 8
> +pattern:
> +	.llong 0x5555AAAA5555AAAA
> +
> +	.text
> +FUNC_START(_start)
> +	/* Load some addresses to start with */
> +	ld	r14, message@got(%r2)
> +	ld	r15, pattern@toc(%r2)


Because ... stupid, the "toc" references above break on big endian.

Fixed by doing:
	.section ".toc"

and:
	ld	r15, pattern@TOC(%r2)

cheers

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

* Re: [PATCH 1/2] powerpc: Add a proper syscall for switching endianness
  2015-03-13  4:39 [PATCH 1/2] powerpc: Add a proper syscall for switching endianness Michael Ellerman
  2015-03-13  4:39 ` [PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall Michael Ellerman
@ 2015-03-13  6:38 ` Michael Ellerman
  2015-03-13 19:50   ` Scott Wood
  2015-03-15 22:59   ` Tony Breeds
  1 sibling, 2 replies; 10+ messages in thread
From: Michael Ellerman @ 2015-03-13  6:38 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood, Jeremy Kerr

On Fri, 2015-03-13 at 15:39 +1100, Michael Ellerman wrote:
> We currently have a "special" syscall for switching endianness. This is
> syscall number 0x1ebe, which is handled explicitly in the 64-bit syscall
> exception entry.
> 
> diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
> index 91062eef582f..c3ee21a1d9cf 100644
> --- a/arch/powerpc/include/asm/systbl.h
> +++ b/arch/powerpc/include/asm/systbl.h
> @@ -367,3 +367,4 @@ SYSCALL_SPU(getrandom)
>  SYSCALL_SPU(memfd_create)
>  SYSCALL_SPU(bpf)
>  COMPAT_SYS(execveat)
> +PPC_SYS(switch_endian)

And of course I forgot about 32-bit.

According to Paul there are no working implementations of LE on 32-bit cpus, so
the syscall doesn't really make sense there.

Scott does that sound right to you for FSL stuff?

cheers

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

* Re: [PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall
  2015-03-13  4:39 ` [PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall Michael Ellerman
  2015-03-13  5:01   ` Michael Ellerman
@ 2015-03-13  7:10   ` Ram Pai
  2015-03-13  7:16     ` Michael Ellerman
  1 sibling, 1 reply; 10+ messages in thread
From: Ram Pai @ 2015-03-13  7:10 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Jeremy Kerr

On Fri, Mar 13, 2015 at 03:39:24PM +1100, Michael Ellerman wrote:
> This adds a test of the switch_endian() syscall we added in the previous
> commit.
> 
> We test it by calling the endian switch syscall, and then executing some
> code in the other endian to check everything went as expected. That code
> checks registers we expect to be maintained are, and then writes to
> stdout and then does exit(0).
> 
> If the endian switch failed to happen that code sequence will be illegal
> and cause the test to abort.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
..snip..
> +	.long 0x04000038
> +	# li      r3,1
> +	.long 0x01006038
> +	# mr      r4,r14
> +	.long 0x7873c47d
> +	# li      r5,21
> +	.long 0x1500a038
> +	# sc
> +	.long 0x02000044
> +	# li      r3,0
> +	.long 0x00006038
> +	# 1:
> +	# li      r0, __NR_exit

Would it make sense to toggle the endianness here,
checking for the same register sanity before exiting?

That way endian switching is tested both ways?

RP

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

* Re: [PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall
  2015-03-13  7:10   ` Ram Pai
@ 2015-03-13  7:16     ` Michael Ellerman
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Ellerman @ 2015-03-13  7:16 UTC (permalink / raw)
  To: Ram Pai; +Cc: linuxppc-dev, Jeremy Kerr

On Fri, 2015-03-13 at 00:10 -0700, Ram Pai wrote:
> On Fri, Mar 13, 2015 at 03:39:24PM +1100, Michael Ellerman wrote:
> > This adds a test of the switch_endian() syscall we added in the previous
> > commit.
> > 
> > We test it by calling the endian switch syscall, and then executing some
> > code in the other endian to check everything went as expected. That code
> > checks registers we expect to be maintained are, and then writes to
> > stdout and then does exit(0).
> > 
> > If the endian switch failed to happen that code sequence will be illegal
> > and cause the test to abort.
> > 
> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> > ---
> ..snip..
> > +	.long 0x04000038
> > +	# li      r3,1
> > +	.long 0x01006038
> > +	# mr      r4,r14
> > +	.long 0x7873c47d
> > +	# li      r5,21
> > +	.long 0x1500a038
> > +	# sc
> > +	.long 0x02000044
> > +	# li      r3,0
> > +	.long 0x00006038
> > +	# 1:
> > +	# li      r0, __NR_exit
> 
> Would it make sense to toggle the endianness here,
> checking for the same register sanity before exiting?
> 
> That way endian switching is tested both ways?

Yeah that is a good idea.

/me keeps working on this "trivial" patch ;)

cheers

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

* Re: [PATCH 1/2] powerpc: Add a proper syscall for switching endianness
  2015-03-13  6:38 ` [PATCH 1/2] powerpc: Add a proper syscall for switching endianness Michael Ellerman
@ 2015-03-13 19:50   ` Scott Wood
  2015-03-15 22:59   ` Tony Breeds
  1 sibling, 0 replies; 10+ messages in thread
From: Scott Wood @ 2015-03-13 19:50 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Jeremy Kerr

On Fri, 2015-03-13 at 17:38 +1100, Michael Ellerman wrote:
> On Fri, 2015-03-13 at 15:39 +1100, Michael Ellerman wrote:
> > We currently have a "special" syscall for switching endianness. This is
> > syscall number 0x1ebe, which is handled explicitly in the 64-bit syscall
> > exception entry.
> > 
> > diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
> > index 91062eef582f..c3ee21a1d9cf 100644
> > --- a/arch/powerpc/include/asm/systbl.h
> > +++ b/arch/powerpc/include/asm/systbl.h
> > @@ -367,3 +367,4 @@ SYSCALL_SPU(getrandom)
> >  SYSCALL_SPU(memfd_create)
> >  SYSCALL_SPU(bpf)
> >  COMPAT_SYS(execveat)
> > +PPC_SYS(switch_endian)
> 
> And of course I forgot about 32-bit.
> 
> According to Paul there are no working implementations of LE on 32-bit cpus, so
> the syscall doesn't really make sense there.
> 
> Scott does that sound right to you for FSL stuff?

We don't support LE on FSL chips.

-Scott

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

* Re: [PATCH 1/2] powerpc: Add a proper syscall for switching endianness
  2015-03-13  6:38 ` [PATCH 1/2] powerpc: Add a proper syscall for switching endianness Michael Ellerman
  2015-03-13 19:50   ` Scott Wood
@ 2015-03-15 22:59   ` Tony Breeds
  2015-03-16  0:07     ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 10+ messages in thread
From: Tony Breeds @ 2015-03-15 22:59 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Scott Wood, linuxppc-dev, Jeremy Kerr, Ian Munsie

[-- Attachment #1: Type: text/plain, Size: 383 bytes --]

On Fri, Mar 13, 2015 at 05:38:46PM +1100, Michael Ellerman wrote:

> According to Paul there are no working implementations of LE on 32-bit cpus, so
> the syscall doesn't really make sense there.

Ummm that doesn't sound right.  I don't think there is an LE linux userspace
but I'm pretty sure we had 32-bit working on 44x.  Check where Ian did the
initial LE patchset.

Yours Tony.

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 1/2] powerpc: Add a proper syscall for switching endianness
  2015-03-15 22:59   ` Tony Breeds
@ 2015-03-16  0:07     ` Benjamin Herrenschmidt
  2015-03-16  3:10       ` Michael Ellerman
  0 siblings, 1 reply; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2015-03-16  0:07 UTC (permalink / raw)
  To: Tony Breeds; +Cc: Scott Wood, Jeremy Kerr, Ian Munsie, linuxppc-dev

On Mon, 2015-03-16 at 09:59 +1100, Tony Breeds wrote:
> On Fri, Mar 13, 2015 at 05:38:46PM +1100, Michael Ellerman wrote:
> 
> > According to Paul there are no working implementations of LE on 32-bit cpus, so
> > the syscall doesn't really make sense there.
> 
> Ummm that doesn't sound right.  I don't think there is an LE linux userspace
> but I'm pretty sure we had 32-bit working on 44x.  Check where Ian did the
> initial LE patchset.

Yes but that's done by using a per-page endian flag, not a global MSR
bit, so we never supported a syscall to switch there and never will.

Cheers,
Ben.

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

* Re: [PATCH 1/2] powerpc: Add a proper syscall for switching endianness
  2015-03-16  0:07     ` Benjamin Herrenschmidt
@ 2015-03-16  3:10       ` Michael Ellerman
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Ellerman @ 2015-03-16  3:10 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Scott Wood, linuxppc-dev, Ian Munsie, Jeremy Kerr

On Mon, 2015-03-16 at 11:07 +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2015-03-16 at 09:59 +1100, Tony Breeds wrote:
> > On Fri, Mar 13, 2015 at 05:38:46PM +1100, Michael Ellerman wrote:
> > 
> > > According to Paul there are no working implementations of LE on 32-bit cpus, so
> > > the syscall doesn't really make sense there.
> > 
> > Ummm that doesn't sound right.  I don't think there is an LE linux userspace
> > but I'm pretty sure we had 32-bit working on 44x.  Check where Ian did the
> > initial LE patchset.
> 
> Yes but that's done by using a per-page endian flag, not a global MSR
> bit, so we never supported a syscall to switch there and never will.

Yeah sorry, I should have said "implementations of MSR_LE on 32-bit cpus".

We can always add a 32-bit version in future if we need to, but we can't remove
it once it's there, so for now we won't do it on 32-bit.

cheers

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

end of thread, other threads:[~2015-03-16  3:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13  4:39 [PATCH 1/2] powerpc: Add a proper syscall for switching endianness Michael Ellerman
2015-03-13  4:39 ` [PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall Michael Ellerman
2015-03-13  5:01   ` Michael Ellerman
2015-03-13  7:10   ` Ram Pai
2015-03-13  7:16     ` Michael Ellerman
2015-03-13  6:38 ` [PATCH 1/2] powerpc: Add a proper syscall for switching endianness Michael Ellerman
2015-03-13 19:50   ` Scott Wood
2015-03-15 22:59   ` Tony Breeds
2015-03-16  0:07     ` Benjamin Herrenschmidt
2015-03-16  3:10       ` Michael Ellerman

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.