From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 22/23] ARM: cci: driver need big endian fixes in asm code
Date: Tue, 15 Oct 2013 10:58:07 +0100 [thread overview]
Message-ID: <525D11AF.101@codethink.co.uk> (raw)
In-Reply-To: <alpine.LFD.2.03.1310142139270.1873@syhkavp.arg>
On 15/10/13 02:40, Nicolas Pitre wrote:
> On Mon, 14 Oct 2013, Ben Dooks wrote:
>
>> On 08/10/13 23:34, Ben Dooks wrote:
>>> From: Victor Kamensky<victor.kamensky@linaro.org>
>>>
>>> cci_enable_port_for_self written in asm and it works with h/w
>>> registers that are in little endian format. When run in big
>>> endian mode it needs byte swap before/after it writes/reads
>>> to/from such registers
>>>
>>> CC: Lorenzon Pieralisi<lorenzo.pieralisi@arm.com>
>>> Signed-off-by: Victor Kamensky<victor.kamensky@linaro.org>
>>> Signed-off-by: Ben Dooks<ben.dooks@codethink.co.uk>
>>> ---
>>> drivers/bus/arm-cci.c | 6 ++++++
>>> 1 file changed, 6 insertions(+)
>>>
>>> diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
>>> index 2009266..6db173e 100644
>>> --- a/drivers/bus/arm-cci.c
>>> +++ b/drivers/bus/arm-cci.c
>>> @@ -281,6 +281,9 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>>> /* Enable the CCI port */
>>> " ldr r0, [r0, %[offsetof_port_phys]] \n"
>>> " mov r3, #"__stringify(CCI_ENABLE_REQ)" \n"
>>> +#ifdef __ARMEB__
>>> +" rev r3, r3 \n"
>>> +#endif /* __ARMEB__ */
>>> " str r3, [r0, #"__stringify(CCI_PORT_CTRL)"] \n"
>>>
>>> /* poll the status reg for completion */
>>> @@ -288,6 +291,9 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>>> " ldr r0, [r1] \n"
>>> " ldr r0, [r0, r1] @ cci_ctrl_base \n"
>>> "4: ldr r1, [r0, #"__stringify(CCI_CTRL_STATUS)"] \n"
>>> +#ifdef __ARMEB__
>>> +" rev r1, r1 \n"
>>> +#endif /* __ARMEB__ */
>>> " tst r1, #1 \n"
>>> " bne 4b \n"
>>
>> I was just thinking if this would be a better way to change
>> the code:
>>
>> diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
>> index 6db173e..2ad2511 100644
>> --- a/drivers/bus/arm-cci.c
>> +++ b/drivers/bus/arm-cci.c
>> @@ -280,10 +280,7 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>>
>> /* Enable the CCI port */
>> " ldr r0, [r0, %[offsetof_port_phys]] \n"
>> -" mov r3, #"__stringify(CCI_ENABLE_REQ)" \n"
>> -#ifdef __ARMEB__
>> -" rev r3, r3 \n"
>> -#endif /* __ARMEB__ */
>> +" mov r3, %[cci_enable_req]\n"
>> " str r3, [r0, #"__stringify(CCI_PORT_CTRL)"] \n"
>>
>> /* poll the status reg for completion */
>> @@ -291,10 +288,7 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>> " ldr r0, [r1] \n"
>> " ldr r0, [r0, r1] @ cci_ctrl_base \n"
>> "4: ldr r1, [r0, #"__stringify(CCI_CTRL_STATUS)"] \n"
>> -#ifdef __ARMEB__
>> -" rev r1, r1 \n"
>> -#endif /* __ARMEB__ */
>> -" tst r1, #1 \n"
>> +" tst r1, %[cci_control_status_bits] \n"
>> " bne 4b \n"
>>
>> " mov r0, #0 \n"
>> @@ -307,6 +301,8 @@ asmlinkage void __naked cci_enable_port_for_self(void)
>> "7: .word cci_ctrl_phys - . \n"
>> : :
>> [sizeof_cpu_port] "i" (sizeof(cpu_port)),
>> + [cci_enable_req] "i" cpu_to_le32(CCI_ENABLE_REQ),
>> + [cci_control_status_bits] "i" cpu_to_le32(1),
>>
>> so swap the data bits before passing them into the code
>> which could also remove some of the use of the __stringify()
>> calls in there too.
> That certainly looks nicer to me.
>
>> It seems to compile ok, but is not complete.
>
> What do you mean?
I didn't have time to check I caught all cases in this.
Victor, any chance you could have a look at this and re-do the patch?
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
next prev parent reply other threads:[~2013-10-15 9:58 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-08 22:34 New big-endian patch series against 3.12-rc4 Ben Dooks
2013-10-08 22:34 ` [PATCH 01/23] ARM: fix ARCH_IXP4xx usage of ARCH_SUPPORTS_BIG_ENDIAN Ben Dooks
2013-10-08 22:34 ` [PATCH 02/23] ARM: asm: Add ARM_BE8() assembly helper Ben Dooks
2013-10-08 22:34 ` [PATCH 03/23] ARM: fixup_pv_table bug when CPU_ENDIAN_BE8 Ben Dooks
2013-10-08 22:34 ` [PATCH 04/23] ARM: set BE8 if LE in head code Ben Dooks
2013-10-08 22:34 ` [PATCH 05/23] ARM: pl01x debug code endian fix Ben Dooks
2013-10-08 22:34 ` [PATCH 06/23] ARM: twd: data " Ben Dooks
2013-10-08 22:34 ` [PATCH 07/23] ARM: smp_scu: data endian fixes Ben Dooks
2013-10-08 22:34 ` [PATCH 08/23] ARM: highbank: enable big-endian Ben Dooks
2013-10-08 22:34 ` [PATCH 09/23] ARM: mvebu: support running big-endian Ben Dooks
2013-10-08 22:34 ` [PATCH 10/23] ARM: vexpress: add big endian support Ben Dooks
2013-10-08 22:34 ` [PATCH 11/23] ARM: alignment: correctly decode instructions in BE8 mode Ben Dooks
2013-10-08 22:34 ` [PATCH 12/23] ARM: traps: use <asm/opcodes.h> to get correct instruction order Ben Dooks
2013-10-09 11:42 ` Will Deacon
2013-10-08 22:34 ` [PATCH 13/23] ARM: module: correctly relocate instructions in BE8 Ben Dooks
2013-10-08 22:34 ` [PATCH 14/23] ARM: set --be8 when linking modules Ben Dooks
2013-10-08 22:34 ` [PATCH 15/23] ARM: hardware: fix endian-ness in <hardware/coresight.h> Ben Dooks
2013-10-08 22:34 ` [PATCH 16/23] ARM: net: fix arm instruction endian-ness in bpf_jit_32.c Ben Dooks
2013-10-08 22:34 ` [PATCH 17/23] ARM: Correct BUG() assembly to ensure it is endian-agnostic Ben Dooks
2013-10-08 22:34 ` [PATCH 18/23] ARM: kdgb: use <asm/opcodes.h> for data to be assembled as intruction Ben Dooks
2013-10-08 22:34 ` [PATCH 19/23] ARM: atomic64: fix endian-ness in atomic.h Ben Dooks
2013-10-08 22:34 ` [PATCH 20/23] ARM: signal: sigreturn_codes should be endian neutral to work in BE8 Ben Dooks
2013-11-05 21:18 ` Uwe Kleine-König
2013-11-06 3:48 ` Victor Kamensky
2013-11-06 8:46 ` Uwe Kleine-König
2013-10-08 22:34 ` [PATCH 21/23] ARM: mcpm: fix big endian issue in mcpm startup code Ben Dooks
2013-10-08 22:34 ` [PATCH 22/23] ARM: cci: driver need big endian fixes in asm code Ben Dooks
2013-10-09 14:35 ` Dave Martin
2013-10-14 20:53 ` Ben Dooks
2013-10-15 1:40 ` Nicolas Pitre
2013-10-15 9:58 ` Ben Dooks [this message]
2013-10-08 22:34 ` [PATCH 23/23] ARM: tlb: ASID macro should give 32bit result for BE correct operation Ben Dooks
2013-10-09 6:20 ` New big-endian patch series against 3.12-rc4 Victor Kamensky
2013-10-09 7:10 ` Ben Dooks
2013-10-11 10:49 ` Marc Zyngier
2013-10-11 13:47 ` Thomas Petazzoni
2013-10-17 12:07 ` Thomas Petazzoni
2013-10-17 12:15 ` Will Deacon
2013-10-17 12:20 ` Thomas Petazzoni
2013-10-17 12:27 ` Will Deacon
2013-10-17 12:29 ` Thomas Petazzoni
[not found] <20131015092637.GA2312@localhost.localdomain>
2013-10-15 10:41 ` [PATCH 22/23] ARM: cci: driver need big endian fixes in asm code Ben Dooks
2013-10-15 14:02 ` Victor Kamensky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=525D11AF.101@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).