lkml.org 
[lkml]   [2017]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/3] soc: xilinx: zynqmp: Add firmware interface
From
Date
On 16.8.2017 17:05, Arnd Bergmann wrote:
> On Wed, Aug 16, 2017 at 4:34 PM, Michal Simek <michal.simek@xilinx.com> wrote:
>> On 16.8.2017 16:00, Michal Simek wrote:
>>> On 16.8.2017 14:41, Arnd Bergmann wrote:
>>>
>>
>> What do you think?
>> ret_payload[0] = lower_32_bits(le64_to_cpu(res.a0));
>> ret_payload[1] = upper_32_bits(le64_to_cpu(res.a0));
>> ret_payload[2] = lower_32_bits(le64_to_cpu(res.a1));
>> ret_payload[3] = upper_32_bits(le64_to_cpu(res.a1));
>> ret_payload[4] = lower_32_bits(le64_to_cpu(res.a2));
>>
>> There should be probably also change in invoke_pm_fn to do conversion
>> from cpu to le64.
>>
>> int invoke_pm_fn(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3,
>> u32 *ret_payload)
>> {
>> /*
>> * Added SIP service call Function Identifier
>> * Make sure to stay in x0 register
>> */
>> u64 smc_arg[4];
>>
>> smc_arg[0] = cpu_to_le64(PM_SIP_SVC | pm_api_id);
>> smc_arg[1] = cpu_to_le64(((u64)arg1 << 32) | arg0);
>> smc_arg[2] = cpu_to_le64(((u64)arg3 << 32) | arg2);
>>
>> return do_fw_call(smc_arg[0], smc_arg[1], smc_arg[2], ret_payload);
>> }
>>
>> This is not tested on BE just on LE.
>
> 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?

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;
};

Thanks,
Michal

\
 
 \ /
  Last update: 2017-08-17 12:48    [W:0.099 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site