linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: trusted_foundations: Maintain CPU endianness
@ 2015-03-20 15:36 Dmitry Osipenko
  2015-03-20 15:47 ` Dmitry Osipenko
  2015-03-20 16:07 ` Stephen Warren
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Osipenko @ 2015-03-20 15:36 UTC (permalink / raw)
  To: linux-arm-kernel

Convert CPU reset vector address to LE to support big-endian kernel.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 arch/arm/firmware/trusted_foundations.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/firmware/trusted_foundations.c b/arch/arm/firmware/trusted_foundations.c
index 3fb1b5a..865103a 100644
--- a/arch/arm/firmware/trusted_foundations.c
+++ b/arch/arm/firmware/trusted_foundations.c
@@ -50,7 +50,7 @@ static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2)
 
 static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
 {
-	cpu_boot_addr = boot_addr;
+	cpu_boot_addr = cpu_to_le32(boot_addr);
 	tf_generic_smc(TF_SET_CPU_BOOT_ADDR_SMC, cpu_boot_addr, 0);
 
 	return 0;
-- 
2.3.3

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

* [PATCH] ARM: trusted_foundations: Maintain CPU endianness
  2015-03-20 15:36 [PATCH] ARM: trusted_foundations: Maintain CPU endianness Dmitry Osipenko
@ 2015-03-20 15:47 ` Dmitry Osipenko
  2015-03-20 16:20   ` Dave Martin
  2015-03-20 16:07 ` Stephen Warren
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Osipenko @ 2015-03-20 15:47 UTC (permalink / raw)
  To: linux-arm-kernel

This patch not tested. I assume that firmware save/restore cp15 context, i.e. it 
doesn't require switching to LE before smc call and restore endianness after.

-- 
Dmitry

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

* [PATCH] ARM: trusted_foundations: Maintain CPU endianness
  2015-03-20 15:36 [PATCH] ARM: trusted_foundations: Maintain CPU endianness Dmitry Osipenko
  2015-03-20 15:47 ` Dmitry Osipenko
@ 2015-03-20 16:07 ` Stephen Warren
  2015-03-20 16:41   ` Dmitry Osipenko
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2015-03-20 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/20/2015 09:36 AM, Dmitry Osipenko wrote:
> Convert CPU reset vector address to LE to support big-endian kernel.

Naively this sounds a little odd; the value here is in a CPU register 
all the time, not in memory, so I'm not sure why endianness is relevant? 
Presumably the CPU doesn't end up byte-swapping values in registers when 
running in BE mode or it takes an SMC? If it does, why don't we need 
cpu_to_le32(TF_SET_CPU_BOOT_ADDR_SMC) too?

Sorry if this is a silly question; I haven't followed any of the BE 
kernel patches.

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

* [PATCH] ARM: trusted_foundations: Maintain CPU endianness
  2015-03-20 15:47 ` Dmitry Osipenko
@ 2015-03-20 16:20   ` Dave Martin
  0 siblings, 0 replies; 5+ messages in thread
From: Dave Martin @ 2015-03-20 16:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 20, 2015 at 06:47:18PM +0300, Dmitry Osipenko wrote:
> This patch not tested. I assume that firmware save/restore cp15
> context, i.e. it doesn't require switching to LE before smc call and
> restore endianness after.

That assumption should be valid.

However, I think this patch must be tested before assuming it is
correct.  If the arguments were passed in memory then there might
force LE order for that data block, but there should not be a need for
this if the values are in registers.

Cheers
---Dave

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

* [PATCH] ARM: trusted_foundations: Maintain CPU endianness
  2015-03-20 16:07 ` Stephen Warren
@ 2015-03-20 16:41   ` Dmitry Osipenko
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Osipenko @ 2015-03-20 16:41 UTC (permalink / raw)
  To: linux-arm-kernel

20.03.2015 19:07, Stephen Warren ?????:
> On 03/20/2015 09:36 AM, Dmitry Osipenko wrote:
>> Convert CPU reset vector address to LE to support big-endian kernel.
>
> Naively this sounds a little odd; the value here is in a CPU register all the
> time, not in memory, so I'm not sure why endianness is relevant? Presumably the
> CPU doesn't end up byte-swapping values in registers when running in BE mode or
> it takes an SMC? If it does, why don't we need
> cpu_to_le32(TF_SET_CPU_BOOT_ADDR_SMC) too?
>
> Sorry if this is a silly question; I haven't followed any of the BE kernel patches.

You absolutely right. I goofed it by replacing 'smc' with 'str' without adding 
reg reverse for BE when was testing and then blindly made patch. Please ignore 
it and sorry for the noise.

-- 
Dmitry

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 15:36 [PATCH] ARM: trusted_foundations: Maintain CPU endianness Dmitry Osipenko
2015-03-20 15:47 ` Dmitry Osipenko
2015-03-20 16:20   ` Dave Martin
2015-03-20 16:07 ` Stephen Warren
2015-03-20 16:41   ` Dmitry Osipenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).