tree:
https://android.googlesource.com/kernel/common android-trusty-5.4
head: 055ccbe92295978be3d8d20275b35b5e8779664d
commit: f96574c5bf1e925b1c511416914d9c1b666b34fd [2/32] ANDROID: trusty: Add trusty
driver
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.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
git checkout f96574c5bf1e925b1c511416914d9c1b666b34fd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
> drivers/trusty/trusty.c:37:5: error: redefinition of
'trusty_fast_call32'
37 | s32 trusty_fast_call32(struct device *dev,
u32 smcnr, u32 a0, u32 a1, u32 a2)
| ^~~~~~~~~~~~~~~~~~
In file included from drivers/trusty/trusty.c:24:
include/linux/trusty/trusty.h:32:19: note: previous definition of
'trusty_fast_call32' was here
32 | static inline s32 trusty_fast_call32(struct device *dev, u32 smcnr,
| ^~~~~~~~~~~~~~~~~~
drivers/trusty/trusty.c: In function 'trusty_std_call_helper':
drivers/trusty/trusty.c:88:23: warning: unused variable 's'
[-Wunused-variable]
88 | struct trusty_state *s = platform_get_drvdata(to_platform_device(dev));
| ^
drivers/trusty/trusty.c: At top level:
> drivers/trusty/trusty.c:116:5: error: redefinition of
'trusty_std_call32'
116 | s32 trusty_std_call32(struct device *dev, u32
smcnr, u32 a0, u32 a1, u32 a2)
| ^~~~~~~~~~~~~~~~~
In file included from drivers/trusty/trusty.c:24:
include/linux/trusty/trusty.h:27:19: note: previous definition of
'trusty_std_call32' was here
27 | static inline s32 trusty_std_call32(struct device *dev, u32 smcnr,
| ^~~~~~~~~~~~~~~~~
vim +/trusty_fast_call32 +37 drivers/trusty/trusty.c
24 #include <linux/trusty/trusty.h>
25
26 #include "trusty-smc.h"
27
28 struct trusty_state {
29 struct mutex smc_lock;
30 };
31
32 static inline ulong smc(ulong r0, ulong r1, ulong r2, ulong r3)
33 {
34 return trusty_smc8(r0, r1, r2, r3, 0, 0, 0, 0).r0;
35 }
36
37 s32 trusty_fast_call32(struct device *dev, u32 smcnr, u32 a0, u32
a1, u32 a2)
38 {
39 struct trusty_state *s = platform_get_drvdata(to_platform_device(dev));
40
41 BUG_ON(!s);
42 BUG_ON(!SMC_IS_FASTCALL(smcnr));
43 BUG_ON(SMC_IS_SMC64(smcnr));
44
45 return smc(smcnr, a0, a1, a2);
46 }
47 EXPORT_SYMBOL(trusty_fast_call32);
48
49 #ifdef CONFIG_64BIT
50 s64 trusty_fast_call64(struct device *dev, u64 smcnr, u64 a0, u64 a1, u64 a2)
51 {
52 struct trusty_state *s = platform_get_drvdata(to_platform_device(dev));
53
54 BUG_ON(!s);
55 BUG_ON(!SMC_IS_FASTCALL(smcnr));
56 BUG_ON(!SMC_IS_SMC64(smcnr));
57
58 return smc(smcnr, a0, a1, a2);
59 }
60 #endif
61
62 static ulong trusty_std_call_inner(struct device *dev, ulong smcnr,
63 ulong a0, ulong a1, ulong a2)
64 {
65 ulong ret;
66 int retry = 5;
67
68 dev_dbg(dev, "%s(0x%lx 0x%lx 0x%lx 0x%lx)\n",
69 __func__, smcnr, a0, a1, a2);
70 while (true) {
71 ret = smc(smcnr, a0, a1, a2);
72 if ((int)ret != SM_ERR_BUSY || !retry)
73 break;
74
75 dev_dbg(dev, "%s(0x%lx 0x%lx 0x%lx 0x%lx) returned busy, retry\n",
76 __func__, smcnr, a0, a1, a2);
77 retry--;
78 }
79
80 return ret;
81 }
82
83 static ulong trusty_std_call_helper(struct device *dev, ulong smcnr,
84 ulong a0, ulong a1, ulong a2)
85 {
86 ulong ret;
87 int sleep_time = 1;
88 struct trusty_state *s = platform_get_drvdata(to_platform_device(dev));
89
90 while (true) {
91 ret = trusty_std_call_inner(dev, smcnr, a0, a1, a2);
92 if ((int)ret != SM_ERR_BUSY)
93 break;
94
95 if (sleep_time == 256)
96 dev_warn(dev, "%s(0x%lx 0x%lx 0x%lx 0x%lx) returned busy\n",
97 __func__, smcnr, a0, a1, a2);
98 dev_dbg(dev, "%s(0x%lx 0x%lx 0x%lx 0x%lx) returned busy, wait %d
ms\n",
99 __func__, smcnr, a0, a1, a2, sleep_time);
100
101 msleep(sleep_time);
102 if (sleep_time < 1000)
103 sleep_time <<= 1;
104
105 dev_dbg(dev, "%s(0x%lx 0x%lx 0x%lx 0x%lx) retry\n",
106 __func__, smcnr, a0, a1, a2);
107 }
108
109 if (sleep_time > 256)
110 dev_warn(dev, "%s(0x%lx 0x%lx 0x%lx 0x%lx) busy cleared\n",
111 __func__, smcnr, a0, a1, a2);
112
113 return ret;
114 }
115
116 s32 trusty_std_call32(struct device *dev, u32 smcnr, u32 a0, u32
a1, u32 a2)
117 {
118 int ret;
119 struct trusty_state *s = platform_get_drvdata(to_platform_device(dev));
120
121 BUG_ON(SMC_IS_FASTCALL(smcnr));
122 BUG_ON(SMC_IS_SMC64(smcnr));
123
124 mutex_lock(&s->smc_lock);
125
126 dev_dbg(dev, "%s(0x%x 0x%x 0x%x 0x%x) started\n",
127 __func__, smcnr, a0, a1, a2);
128
129 ret = trusty_std_call_helper(dev, smcnr, a0, a1, a2);
130 while (ret == SM_ERR_INTERRUPTED) {
131 dev_dbg(dev, "%s(0x%x 0x%x 0x%x 0x%x) interrupted\n",
132 __func__, smcnr, a0, a1, a2);
133 ret = trusty_std_call_helper(dev, SMC_SC_RESTART_LAST, 0, 0, 0);
134 }
135 dev_dbg(dev, "%s(0x%x 0x%x 0x%x 0x%x) returned 0x%x\n",
136 __func__, smcnr, a0, a1, a2, ret);
137
138 WARN_ONCE(ret == SM_ERR_PANIC, "trusty crashed");
139
140 mutex_unlock(&s->smc_lock);
141
142 return ret;
143 }
144 EXPORT_SYMBOL(trusty_std_call32);
145
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org