Re: [PATCH 3/3] soc: xilinx: zynqmp: Add firmware interface

From: Michal Simek
Date: Fri Aug 18 2017 - 08:15:21 EST


On 17.8.2017 23:11, Arnd Bergmann wrote:
> On Thu, Aug 17, 2017 at 12:48 PM, Michal Simek <michal.simek@xxxxxxxxxx> wrote:
>> On 16.8.2017 17:05, Arnd Bergmann wrote:
>>> On Wed, Aug 16, 2017 at 4:34 PM, Michal Simek <michal.simek@xxxxxxxxxx> wrote:
>>>
>>> Looks good, just make sure you also check with sparse (make C=1)
>>> to ensure you have the right __le64/__le32 types everywhere.
>>
>> Are you aware about any doc where it is written that data should be
>> passed as little endian?
>
> Looking at http://infocenter.arm.com/help/topic/com.arm.doc.den0028b/ARM_DEN0028B_SMC_Calling_Convention.pdf
> now, I think that the structure above is endian-neutral as the arguments
> get passed in registers rather than memory.
>
> However, if you pass pointers to data structures in memory, those
> data structures would have to be defined with __le32/__le64 types.

ok.

>
>> I was playing with it a little bit and this means that these 2(3 with
>> hvc) needs to be changed.
>>
>> asmlinkage void __arm_smccc_smc(__le64 a0, __le64 a1, __le64 a2,
>> __le64 a3,__le64 a4, __le64 a5, __le64 a6, __le64 a7,
>> struct arm_smccc_res *res, struct arm_smccc_quirk *quirk);
>>
>> struct arm_smccc_res {
>> - unsigned long a0;
>> - unsigned long a1;
>> - unsigned long a2;
>> - unsigned long a3;
>> + __le64 a0;
>> + __le64 a1;
>> + __le64 a2;
>> + __le64 a3;
>> };
>
> This is clearly wrong on 32-bit machines, I think this is intentionally
> defined as 'unsigned long' to have register sized arguments.

Yep, I know.

Let me integrate that changes which Marc wanted and will send next version.

Thanks,
Michal