diff mbox series

[2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters

Message ID 20230409181918.29270-3-quic_nkela@quicinc.com (mailing list archive)
State New, archived
Headers show
Series Allow parameter in smc/hvc calls | expand

Commit Message

Nikunj Kela April 9, 2023, 6:19 p.m. UTC
This patch add support for passing parameters to smc/hvc calls.
This patch is useful when multiple scmi instances are using same
smc-id and firmware needs to distiguish among the instances.

Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com>
---
 drivers/firmware/arm_scmi/smc.c | 66 ++++++++++++++++++++++++++++++++-
 1 file changed, 65 insertions(+), 1 deletion(-)

Comments

kernel test robot April 9, 2023, 10:22 p.m. UTC | #1
Hi Nikunj,

kernel test robot noticed the following build errors:

[auto build test ERROR on robh/for-next]
[also build test ERROR on linus/master v6.3-rc6 next-20230406]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Nikunj-Kela/dt-bindings-firmware-arm-scmi-support-parameter-passing-in-smc-hvc/20230410-022129
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20230409181918.29270-3-quic_nkela%40quicinc.com
patch subject: [PATCH 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20230410/202304100606.kUjhsRYf-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/9c34de66aa243da9824e8bbe749b24e36b0db483
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Nikunj-Kela/dt-bindings-firmware-arm-scmi-support-parameter-passing-in-smc-hvc/20230410-022129
        git checkout 9c34de66aa243da9824e8bbe749b24e36b0db483
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304100606.kUjhsRYf-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/firmware/arm_scmi/smc.c:9:
   drivers/firmware/arm_scmi/smc.c: In function 'smc_send_message':
>> include/linux/arm-smccc.h:436:29: error: register specified for 'arg1' isn't suitable for data type
     436 |         register typeof(a1) arg1 asm("r1") = __a1;                      \
         |                             ^~~~
   include/linux/arm-smccc.h:442:9: note: in expansion of macro '__declare_arg_3'
     442 |         __declare_arg_3(a0, a1, a2, a3, res);                           \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:447:9: note: in expansion of macro '__declare_arg_4'
     447 |         __declare_arg_4(a0, a1, a2, a3, a4, res);                       \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:452:9: note: in expansion of macro '__declare_arg_5'
     452 |         __declare_arg_5(a0, a1, a2, a3, a4, a5, res);                   \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:457:9: note: in expansion of macro '__declare_arg_6'
     457 |         __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res);               \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:460:37: note: in expansion of macro '__declare_arg_7'
     460 | #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:461:37: note: in expansion of macro '___declare_args'
     461 | #define __declare_args(count, ...)  ___declare_args(count, __VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:479:17: note: in expansion of macro '__declare_args'
     479 |                 __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
         |                 ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:518:33: note: in expansion of macro '__arm_smccc_1_1'
     518 | #define arm_smccc_1_1_hvc(...)  __arm_smccc_1_1(SMCCC_HVC_INST, __VA_ARGS__)
         |                                 ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:552:25: note: in expansion of macro 'arm_smccc_1_1_hvc'
     552 |                         arm_smccc_1_1_hvc(__VA_ARGS__);                 \
         |                         ^~~~~~~~~~~~~~~~~
   drivers/firmware/arm_scmi/smc.c:250:17: note: in expansion of macro 'arm_smccc_1_1_invoke'
     250 |                 arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x,
         |                 ^~~~~~~~~~~~~~~~~~~~
>> include/linux/arm-smccc.h:438:29: error: register specified for 'arg3' isn't suitable for data type
     438 |         register typeof(a3) arg3 asm("r3") = __a3
         |                             ^~~~
   include/linux/arm-smccc.h:442:9: note: in expansion of macro '__declare_arg_3'
     442 |         __declare_arg_3(a0, a1, a2, a3, res);                           \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:447:9: note: in expansion of macro '__declare_arg_4'
     447 |         __declare_arg_4(a0, a1, a2, a3, a4, res);                       \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:452:9: note: in expansion of macro '__declare_arg_5'
     452 |         __declare_arg_5(a0, a1, a2, a3, a4, a5, res);                   \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:457:9: note: in expansion of macro '__declare_arg_6'
     457 |         __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res);               \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:460:37: note: in expansion of macro '__declare_arg_7'
     460 | #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:461:37: note: in expansion of macro '___declare_args'
     461 | #define __declare_args(count, ...)  ___declare_args(count, __VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:479:17: note: in expansion of macro '__declare_args'
     479 |                 __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
         |                 ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:518:33: note: in expansion of macro '__arm_smccc_1_1'
     518 | #define arm_smccc_1_1_hvc(...)  __arm_smccc_1_1(SMCCC_HVC_INST, __VA_ARGS__)
         |                                 ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:552:25: note: in expansion of macro 'arm_smccc_1_1_hvc'
     552 |                         arm_smccc_1_1_hvc(__VA_ARGS__);                 \
         |                         ^~~~~~~~~~~~~~~~~
   drivers/firmware/arm_scmi/smc.c:250:17: note: in expansion of macro 'arm_smccc_1_1_invoke'
     250 |                 arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x,
         |                 ^~~~~~~~~~~~~~~~~~~~
>> include/linux/arm-smccc.h:448:29: error: register specified for 'arg5' isn't suitable for data type
     448 |         register typeof(a5) arg5 asm("r5") = __a5
         |                             ^~~~
   include/linux/arm-smccc.h:452:9: note: in expansion of macro '__declare_arg_5'
     452 |         __declare_arg_5(a0, a1, a2, a3, a4, a5, res);                   \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:457:9: note: in expansion of macro '__declare_arg_6'
     457 |         __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res);               \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:460:37: note: in expansion of macro '__declare_arg_7'
     460 | #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:461:37: note: in expansion of macro '___declare_args'
     461 | #define __declare_args(count, ...)  ___declare_args(count, __VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:479:17: note: in expansion of macro '__declare_args'
     479 |                 __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
         |                 ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:518:33: note: in expansion of macro '__arm_smccc_1_1'
     518 | #define arm_smccc_1_1_hvc(...)  __arm_smccc_1_1(SMCCC_HVC_INST, __VA_ARGS__)
         |                                 ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:552:25: note: in expansion of macro 'arm_smccc_1_1_hvc'
     552 |                         arm_smccc_1_1_hvc(__VA_ARGS__);                 \
         |                         ^~~~~~~~~~~~~~~~~
   drivers/firmware/arm_scmi/smc.c:250:17: note: in expansion of macro 'arm_smccc_1_1_invoke'
     250 |                 arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x,
         |                 ^~~~~~~~~~~~~~~~~~~~
>> include/linux/arm-smccc.h:436:29: error: register specified for 'arg1' isn't suitable for data type
     436 |         register typeof(a1) arg1 asm("r1") = __a1;                      \
         |                             ^~~~
   include/linux/arm-smccc.h:442:9: note: in expansion of macro '__declare_arg_3'
     442 |         __declare_arg_3(a0, a1, a2, a3, res);                           \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:447:9: note: in expansion of macro '__declare_arg_4'
     447 |         __declare_arg_4(a0, a1, a2, a3, a4, res);                       \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:452:9: note: in expansion of macro '__declare_arg_5'
     452 |         __declare_arg_5(a0, a1, a2, a3, a4, a5, res);                   \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:457:9: note: in expansion of macro '__declare_arg_6'
     457 |         __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res);               \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:460:37: note: in expansion of macro '__declare_arg_7'
     460 | #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:461:37: note: in expansion of macro '___declare_args'
     461 | #define __declare_args(count, ...)  ___declare_args(count, __VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:479:17: note: in expansion of macro '__declare_args'
     479 |                 __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
         |                 ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:502:33: note: in expansion of macro '__arm_smccc_1_1'
     502 | #define arm_smccc_1_1_smc(...)  __arm_smccc_1_1(SMCCC_SMC_INST, __VA_ARGS__)
         |                                 ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:555:25: note: in expansion of macro 'arm_smccc_1_1_smc'
     555 |                         arm_smccc_1_1_smc(__VA_ARGS__);                 \
         |                         ^~~~~~~~~~~~~~~~~
   drivers/firmware/arm_scmi/smc.c:250:17: note: in expansion of macro 'arm_smccc_1_1_invoke'
     250 |                 arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x,
         |                 ^~~~~~~~~~~~~~~~~~~~
>> include/linux/arm-smccc.h:438:29: error: register specified for 'arg3' isn't suitable for data type
     438 |         register typeof(a3) arg3 asm("r3") = __a3
         |                             ^~~~
   include/linux/arm-smccc.h:442:9: note: in expansion of macro '__declare_arg_3'
     442 |         __declare_arg_3(a0, a1, a2, a3, res);                           \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:447:9: note: in expansion of macro '__declare_arg_4'
     447 |         __declare_arg_4(a0, a1, a2, a3, a4, res);                       \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:452:9: note: in expansion of macro '__declare_arg_5'
     452 |         __declare_arg_5(a0, a1, a2, a3, a4, a5, res);                   \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:457:9: note: in expansion of macro '__declare_arg_6'
     457 |         __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res);               \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:460:37: note: in expansion of macro '__declare_arg_7'
     460 | #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:461:37: note: in expansion of macro '___declare_args'
     461 | #define __declare_args(count, ...)  ___declare_args(count, __VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:479:17: note: in expansion of macro '__declare_args'
     479 |                 __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
         |                 ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:502:33: note: in expansion of macro '__arm_smccc_1_1'
     502 | #define arm_smccc_1_1_smc(...)  __arm_smccc_1_1(SMCCC_SMC_INST, __VA_ARGS__)
         |                                 ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:555:25: note: in expansion of macro 'arm_smccc_1_1_smc'
     555 |                         arm_smccc_1_1_smc(__VA_ARGS__);                 \
         |                         ^~~~~~~~~~~~~~~~~
   drivers/firmware/arm_scmi/smc.c:250:17: note: in expansion of macro 'arm_smccc_1_1_invoke'
     250 |                 arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x,
         |                 ^~~~~~~~~~~~~~~~~~~~
>> include/linux/arm-smccc.h:448:29: error: register specified for 'arg5' isn't suitable for data type
     448 |         register typeof(a5) arg5 asm("r5") = __a5
         |                             ^~~~
   include/linux/arm-smccc.h:452:9: note: in expansion of macro '__declare_arg_5'
     452 |         __declare_arg_5(a0, a1, a2, a3, a4, a5, res);                   \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:457:9: note: in expansion of macro '__declare_arg_6'
     457 |         __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res);               \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:460:37: note: in expansion of macro '__declare_arg_7'
     460 | #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:461:37: note: in expansion of macro '___declare_args'
     461 | #define __declare_args(count, ...)  ___declare_args(count, __VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:479:17: note: in expansion of macro '__declare_args'
     479 |                 __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
         |                 ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:502:33: note: in expansion of macro '__arm_smccc_1_1'
     502 | #define arm_smccc_1_1_smc(...)  __arm_smccc_1_1(SMCCC_SMC_INST, __VA_ARGS__)
         |                                 ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:555:25: note: in expansion of macro 'arm_smccc_1_1_smc'
     555 |                         arm_smccc_1_1_smc(__VA_ARGS__);                 \
         |                         ^~~~~~~~~~~~~~~~~
   drivers/firmware/arm_scmi/smc.c:250:17: note: in expansion of macro 'arm_smccc_1_1_invoke'
     250 |                 arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x,
         |                 ^~~~~~~~~~~~~~~~~~~~
>> include/linux/arm-smccc.h:436:29: error: register specified for 'arg1' isn't suitable for data type
     436 |         register typeof(a1) arg1 asm("r1") = __a1;                      \
         |                             ^~~~
   include/linux/arm-smccc.h:442:9: note: in expansion of macro '__declare_arg_3'
     442 |         __declare_arg_3(a0, a1, a2, a3, res);                           \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:447:9: note: in expansion of macro '__declare_arg_4'
     447 |         __declare_arg_4(a0, a1, a2, a3, a4, res);                       \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:452:9: note: in expansion of macro '__declare_arg_5'
     452 |         __declare_arg_5(a0, a1, a2, a3, a4, a5, res);                   \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:457:9: note: in expansion of macro '__declare_arg_6'
     457 |         __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res);               \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:460:37: note: in expansion of macro '__declare_arg_7'
     460 | #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:461:37: note: in expansion of macro '___declare_args'
     461 | #define __declare_args(count, ...)  ___declare_args(count, __VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:527:17: note: in expansion of macro '__declare_args'
     527 |                 __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
         |                 ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:558:25: note: in expansion of macro '__fail_smccc_1_1'
     558 |                         __fail_smccc_1_1(__VA_ARGS__);                  \
         |                         ^~~~~~~~~~~~~~~~
   drivers/firmware/arm_scmi/smc.c:250:17: note: in expansion of macro 'arm_smccc_1_1_invoke'
     250 |                 arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x,
         |                 ^~~~~~~~~~~~~~~~~~~~
>> include/linux/arm-smccc.h:438:29: error: register specified for 'arg3' isn't suitable for data type
     438 |         register typeof(a3) arg3 asm("r3") = __a3
         |                             ^~~~
   include/linux/arm-smccc.h:442:9: note: in expansion of macro '__declare_arg_3'
     442 |         __declare_arg_3(a0, a1, a2, a3, res);                           \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:447:9: note: in expansion of macro '__declare_arg_4'
     447 |         __declare_arg_4(a0, a1, a2, a3, a4, res);                       \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:452:9: note: in expansion of macro '__declare_arg_5'
     452 |         __declare_arg_5(a0, a1, a2, a3, a4, a5, res);                   \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:457:9: note: in expansion of macro '__declare_arg_6'
     457 |         __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res);               \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:460:37: note: in expansion of macro '__declare_arg_7'
     460 | #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:461:37: note: in expansion of macro '___declare_args'
     461 | #define __declare_args(count, ...)  ___declare_args(count, __VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:527:17: note: in expansion of macro '__declare_args'
     527 |                 __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
         |                 ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:558:25: note: in expansion of macro '__fail_smccc_1_1'
     558 |                         __fail_smccc_1_1(__VA_ARGS__);                  \
         |                         ^~~~~~~~~~~~~~~~
   drivers/firmware/arm_scmi/smc.c:250:17: note: in expansion of macro 'arm_smccc_1_1_invoke'
     250 |                 arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x,
         |                 ^~~~~~~~~~~~~~~~~~~~
>> include/linux/arm-smccc.h:448:29: error: register specified for 'arg5' isn't suitable for data type
     448 |         register typeof(a5) arg5 asm("r5") = __a5
         |                             ^~~~
   include/linux/arm-smccc.h:452:9: note: in expansion of macro '__declare_arg_5'
     452 |         __declare_arg_5(a0, a1, a2, a3, a4, a5, res);                   \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:457:9: note: in expansion of macro '__declare_arg_6'
     457 |         __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res);               \
         |         ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:460:37: note: in expansion of macro '__declare_arg_7'
     460 | #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:461:37: note: in expansion of macro '___declare_args'
     461 | #define __declare_args(count, ...)  ___declare_args(count, __VA_ARGS__)
         |                                     ^~~~~~~~~~~~~~~
   include/linux/arm-smccc.h:527:17: note: in expansion of macro '__declare_args'
     527 |                 __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
         |                 ^~~~~~~~~~~~~~
   include/linux/arm-smccc.h:558:25: note: in expansion of macro '__fail_smccc_1_1'
     558 |                         __fail_smccc_1_1(__VA_ARGS__);                  \
         |                         ^~~~~~~~~~~~~~~~
   drivers/firmware/arm_scmi/smc.c:250:17: note: in expansion of macro 'arm_smccc_1_1_invoke'
     250 |                 arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x,
         |                 ^~~~~~~~~~~~~~~~~~~~


vim +436 include/linux/arm-smccc.h

f2d3b2e8759a58 Marc Zyngier 2018-02-06  411  
f2d3b2e8759a58 Marc Zyngier 2018-02-06  412  #define __declare_arg_0(a0, res)					\
f2d3b2e8759a58 Marc Zyngier 2018-02-06  413  	struct arm_smccc_res   *___res = res;				\
0794a974d74dc7 Andrew Scull 2020-09-15  414  	register unsigned long arg0 asm("r0") = (u32)a0
f2d3b2e8759a58 Marc Zyngier 2018-02-06  415  
f2d3b2e8759a58 Marc Zyngier 2018-02-06  416  #define __declare_arg_1(a0, a1, res)					\
755a8bf5579d22 Marc Zyngier 2018-08-24  417  	typeof(a1) __a1 = a1;						\
f2d3b2e8759a58 Marc Zyngier 2018-02-06  418  	struct arm_smccc_res   *___res = res;				\
0794a974d74dc7 Andrew Scull 2020-09-15  419  	register unsigned long arg0 asm("r0") = (u32)a0;			\
0794a974d74dc7 Andrew Scull 2020-09-15  420  	register typeof(a1) arg1 asm("r1") = __a1
f2d3b2e8759a58 Marc Zyngier 2018-02-06  421  
f2d3b2e8759a58 Marc Zyngier 2018-02-06  422  #define __declare_arg_2(a0, a1, a2, res)				\
755a8bf5579d22 Marc Zyngier 2018-08-24  423  	typeof(a1) __a1 = a1;						\
755a8bf5579d22 Marc Zyngier 2018-08-24  424  	typeof(a2) __a2 = a2;						\
f2d3b2e8759a58 Marc Zyngier 2018-02-06  425  	struct arm_smccc_res   *___res = res;				\
0794a974d74dc7 Andrew Scull 2020-09-15  426  	register unsigned long arg0 asm("r0") = (u32)a0;			\
0794a974d74dc7 Andrew Scull 2020-09-15  427  	register typeof(a1) arg1 asm("r1") = __a1;			\
0794a974d74dc7 Andrew Scull 2020-09-15  428  	register typeof(a2) arg2 asm("r2") = __a2
f2d3b2e8759a58 Marc Zyngier 2018-02-06  429  
f2d3b2e8759a58 Marc Zyngier 2018-02-06  430  #define __declare_arg_3(a0, a1, a2, a3, res)				\
755a8bf5579d22 Marc Zyngier 2018-08-24  431  	typeof(a1) __a1 = a1;						\
755a8bf5579d22 Marc Zyngier 2018-08-24  432  	typeof(a2) __a2 = a2;						\
755a8bf5579d22 Marc Zyngier 2018-08-24  433  	typeof(a3) __a3 = a3;						\
f2d3b2e8759a58 Marc Zyngier 2018-02-06  434  	struct arm_smccc_res   *___res = res;				\
0794a974d74dc7 Andrew Scull 2020-09-15  435  	register unsigned long arg0 asm("r0") = (u32)a0;			\
0794a974d74dc7 Andrew Scull 2020-09-15 @436  	register typeof(a1) arg1 asm("r1") = __a1;			\
0794a974d74dc7 Andrew Scull 2020-09-15  437  	register typeof(a2) arg2 asm("r2") = __a2;			\
0794a974d74dc7 Andrew Scull 2020-09-15 @438  	register typeof(a3) arg3 asm("r3") = __a3
f2d3b2e8759a58 Marc Zyngier 2018-02-06  439  
f2d3b2e8759a58 Marc Zyngier 2018-02-06  440  #define __declare_arg_4(a0, a1, a2, a3, a4, res)			\
755a8bf5579d22 Marc Zyngier 2018-08-24  441  	typeof(a4) __a4 = a4;						\
f2d3b2e8759a58 Marc Zyngier 2018-02-06  442  	__declare_arg_3(a0, a1, a2, a3, res);				\
0794a974d74dc7 Andrew Scull 2020-09-15  443  	register typeof(a4) arg4 asm("r4") = __a4
f2d3b2e8759a58 Marc Zyngier 2018-02-06  444  
f2d3b2e8759a58 Marc Zyngier 2018-02-06  445  #define __declare_arg_5(a0, a1, a2, a3, a4, a5, res)			\
755a8bf5579d22 Marc Zyngier 2018-08-24  446  	typeof(a5) __a5 = a5;						\
f2d3b2e8759a58 Marc Zyngier 2018-02-06  447  	__declare_arg_4(a0, a1, a2, a3, a4, res);			\
0794a974d74dc7 Andrew Scull 2020-09-15 @448  	register typeof(a5) arg5 asm("r5") = __a5
f2d3b2e8759a58 Marc Zyngier 2018-02-06  449
diff mbox series

Patch

diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c
index 93272e4bbd12..39582d1e2c9f 100644
--- a/drivers/firmware/arm_scmi/smc.c
+++ b/drivers/firmware/arm_scmi/smc.c
@@ -20,6 +20,16 @@ 
 
 #include "common.h"
 
+#define MAX_PARAM_COUNT 6
+
+/**
+ * scmi_smc_param_t - parameter type for SCMI smc/hvc call
+ */
+typedef union {
+	u64 x;
+	u32 w;
+} scmi_smc_param_t;
+
 /**
  * struct scmi_smc - Structure representing a SCMI smc transport
  *
@@ -30,6 +40,8 @@ 
  * @inflight: Atomic flag to protect access to Tx/Rx shared memory area.
  *	      Used when operating in atomic mode.
  * @func_id: smc/hvc call function id
+ * @is_smc64: A flag, indicating smc64 calling convention.
+ * @params: Optional, smc/hvc call parameters.
  */
 
 struct scmi_smc {
@@ -40,8 +52,51 @@  struct scmi_smc {
 #define INFLIGHT_NONE	MSG_TOKEN_MAX
 	atomic_t inflight;
 	u32 func_id;
+	bool is_smc64;
+	scmi_smc_param_t params[MAX_PARAM_COUNT];
 };
 
+static void populate_smc_params(struct device *dev, struct scmi_smc *scmi_info)
+{
+	struct device_node *np = dev->of_node;
+	u64 params64[MAX_PARAM_COUNT] = { 0 };
+	u32 params32[MAX_PARAM_COUNT] = { 0 };
+	int i, count;
+
+	if (scmi_info->is_smc64) {
+		count = of_property_read_variable_u64_array(np,
+							    "arm,smc64-params",
+							    &params64[0], 1,
+							    MAX_PARAM_COUNT);
+		if (count == -EINVAL)  /* if property is not defined */
+			return;
+
+		if (count > 0)	/* populate the parameters */
+			for (i = 0; i < count; i++)
+				scmi_info->params[i].x = params64[i];
+		else
+			goto param_err;
+	} else {
+		count = of_property_read_variable_u32_array(np,
+							    "arm,smc32-params",
+							    &params32[0], 1,
+							    MAX_PARAM_COUNT);
+		if (count == -EINVAL)  /* if property is not defined */
+			return;
+
+		if (count > 0)	/* populate the parameters */
+			for (i = 0; i < count; i++)
+				scmi_info->params[i].w = params32[i];
+		else
+			goto param_err;
+	}
+
+	return;
+
+param_err:
+	dev_warn(dev, "failed to read smc/hvc call parameters\n");
+}
+
 static irqreturn_t smc_msg_done_isr(int irq, void *data)
 {
 	struct scmi_smc *scmi_info = data;
@@ -156,6 +211,8 @@  static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
 	}
 
 	scmi_info->func_id = func_id;
+	scmi_info->is_smc64 = ARM_SMCCC_IS_64(func_id);
+	populate_smc_params(dev, scmi_info);
 	scmi_info->cinfo = cinfo;
 	smc_channel_lock_init(scmi_info);
 	cinfo->transport_info = scmi_info;
@@ -179,6 +236,7 @@  static int smc_send_message(struct scmi_chan_info *cinfo,
 {
 	struct scmi_smc *scmi_info = cinfo->transport_info;
 	struct arm_smccc_res res;
+	scmi_smc_param_t *p = scmi_info->params;
 
 	/*
 	 * Channel will be released only once response has been
@@ -188,7 +246,13 @@  static int smc_send_message(struct scmi_chan_info *cinfo,
 
 	shmem_tx_prepare(scmi_info->shmem, xfer, cinfo);
 
-	arm_smccc_1_1_invoke(scmi_info->func_id, 0, 0, 0, 0, 0, 0, 0, &res);
+	if (scmi_info->is_smc64)
+		arm_smccc_1_1_invoke(scmi_info->func_id, p[0].x, p[1].x, p[2].x,
+				     p[3].x, p[4].x, p[5].x, 0, &res);
+	else
+		arm_smccc_1_1_invoke(scmi_info->func_id, p[0].w, p[1].w, p[2].w,
+				     p[3].w, p[4].w, p[5].w, 0, &res);
+
 
 	/* Only SMCCC_RET_NOT_SUPPORTED is valid error code */
 	if (res.a0) {