tree: https://github.com/avpatel/linux.git v5.5-rc1_unleashed head: ab73ead92747e3a2041e7447329757d65a8d4775 commit: a34f89a34d92879ec5cbd2b2704fc7dfda3aeb1c [4/10] RISC-V: Add basic support for SBI v0.2 config: riscv-allnoconfig (attached as .config) compiler: riscv64-linux-gcc (GCC) 7.5.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout a34f89a34d92879ec5cbd2b2704fc7dfda3aeb1c # save the attached .config to linux build tree GCC_VERSION=7.5.0 make.cross ARCH=riscv If you fix the issue, kindly add following tag Reported-by: kbuild test robot All errors (new ones prefixed by >>): >> arch/riscv/kernel/sbi.c:8:34: error: 'SBI_SPEC_VERSION_DEFAULT' undeclared here (not in a function); did you mean 'PIDS_PER_CPU_DEFAULT'? unsigned long sbi_spec_version = SBI_SPEC_VERSION_DEFAULT; ^~~~~~~~~~~~~~~~~~~~~~~~ PIDS_PER_CPU_DEFAULT >> arch/riscv/kernel/sbi.c:11:15: error: return type is an incomplete type struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, ^~~~~~~~~ arch/riscv/kernel/sbi.c: In function 'sbi_ecall': >> arch/riscv/kernel/sbi.c:16:16: error: storage size of 'ret' isn't known struct sbiret ret; ^~~ arch/riscv/kernel/sbi.c:33:9: warning: 'return' with a value, in function returning void return ret; ^~~ arch/riscv/kernel/sbi.c:11:15: note: declared here struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, ^~~~~~~~~ arch/riscv/kernel/sbi.c:16:16: warning: unused variable 'ret' [-Wunused-variable] struct sbiret ret; ^~~ arch/riscv/kernel/sbi.c: In function 'sbi_err_map_linux_errno': >> arch/riscv/kernel/sbi.c:40:7: error: 'SBI_SUCCESS' undeclared (first use in this function) case SBI_SUCCESS: ^~~~~~~~~~~ arch/riscv/kernel/sbi.c:40:7: note: each undeclared identifier is reported only once for each function it appears in >> arch/riscv/kernel/sbi.c:42:7: error: 'SBI_ERR_DENIED' undeclared (first use in this function); did you mean 'TIMER_PINNED'? case SBI_ERR_DENIED: ^~~~~~~~~~~~~~ TIMER_PINNED >> arch/riscv/kernel/sbi.c:44:7: error: 'SBI_ERR_INVALID_PARAM' undeclared (first use in this function) case SBI_ERR_INVALID_PARAM: ^~~~~~~~~~~~~~~~~~~~~ >> arch/riscv/kernel/sbi.c:46:7: error: 'SBI_ERR_INVALID_ADDRESS' undeclared (first use in this function); did you mean 'SBI_ERR_INVALID_PARAM'? case SBI_ERR_INVALID_ADDRESS: ^~~~~~~~~~~~~~~~~~~~~~~ SBI_ERR_INVALID_PARAM >> arch/riscv/kernel/sbi.c:48:7: error: 'SBI_ERR_NOT_SUPPORTED' undeclared (first use in this function) case SBI_ERR_NOT_SUPPORTED: ^~~~~~~~~~~~~~~~~~~~~ >> arch/riscv/kernel/sbi.c:49:7: error: 'SBI_ERR_FAILURE' undeclared (first use in this function); did you mean 'SBI_ERR_DENIED'? case SBI_ERR_FAILURE: ^~~~~~~~~~~~~~~ SBI_ERR_DENIED arch/riscv/kernel/sbi.c: In function 'sbi_console_putchar': arch/riscv/kernel/sbi.c:63:12: error: 'SBI_EXT_0_1_CONSOLE_PUTCHAR' undeclared (first use in this function) sbi_ecall(SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, ch, 0, 0, 0, 0, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c: In function 'sbi_console_getchar': arch/riscv/kernel/sbi.c:74:16: error: storage size of 'ret' isn't known struct sbiret ret; ^~~ arch/riscv/kernel/sbi.c:76:18: error: 'SBI_EXT_0_1_CONSOLE_GETCHAR' undeclared (first use in this function) ret = sbi_ecall(SBI_EXT_0_1_CONSOLE_GETCHAR, 0, 0, 0, 0, 0, 0, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c:74:16: warning: unused variable 'ret' [-Wunused-variable] struct sbiret ret; ^~~ arch/riscv/kernel/sbi.c: In function 'sbi_set_timer': arch/riscv/kernel/sbi.c:94:12: error: 'SBI_EXT_0_1_SET_TIMER' undeclared (first use in this function) sbi_ecall(SBI_EXT_0_1_SET_TIMER, 0, stime_value, 0, 0, 0, 0, 0); ^~~~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c: In function 'sbi_shutdown': arch/riscv/kernel/sbi.c:106:12: error: 'SBI_EXT_0_1_SHUTDOWN' undeclared (first use in this function) sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0); ^~~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c: In function 'sbi_clear_ipi': arch/riscv/kernel/sbi.c:117:12: error: 'SBI_EXT_0_1_CLEAR_IPI' undeclared (first use in this function) sbi_ecall(SBI_EXT_0_1_CLEAR_IPI, 0, 0, 0, 0, 0, 0, 0); ^~~~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c: In function 'sbi_send_ipi': arch/riscv/kernel/sbi.c:128:12: error: 'SBI_EXT_0_1_SEND_IPI' undeclared (first use in this function) sbi_ecall(SBI_EXT_0_1_SEND_IPI, 0, (unsigned long)hart_mask, ^~~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c: In function 'sbi_remote_fence_i': >> arch/riscv/kernel/sbi.c:141:12: error: 'SBI_EXT_0_1_REMOTE_FENCE_I' undeclared (first use in this function) sbi_ecall(SBI_EXT_0_1_REMOTE_FENCE_I, 0, (unsigned long)hart_mask, ^~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c: In function 'sbi_remote_sfence_vma': arch/riscv/kernel/sbi.c:159:12: error: 'SBI_EXT_0_1_REMOTE_SFENCE_VMA' undeclared (first use in this function) sbi_ecall(SBI_EXT_0_1_REMOTE_SFENCE_VMA, 0, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c: In function 'sbi_remote_sfence_vma_asid': arch/riscv/kernel/sbi.c:180:12: error: 'SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID' undeclared (first use in this function) sbi_ecall(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID, 0, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c: In function 'sbi_probe_extension': arch/riscv/kernel/sbi.c:193:16: error: storage size of 'ret' isn't known struct sbiret ret; ^~~ >> arch/riscv/kernel/sbi.c:195:18: error: 'SBI_EXT_BASE' undeclared (first use in this function); did you mean 'BIT_MASK'? ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_PROBE_EXT, extid, 0, 0, 0, 0, 0); ^~~~~~~~~~~~ BIT_MASK >> arch/riscv/kernel/sbi.c:195:32: error: 'SBI_BASE_PROBE_EXT' undeclared (first use in this function) ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_PROBE_EXT, extid, 0, 0, 0, 0, 0); ^~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c:193:16: warning: unused variable 'ret' [-Wunused-variable] struct sbiret ret; ^~~ arch/riscv/kernel/sbi.c: In function 'sbi_get_spec_version': arch/riscv/kernel/sbi.c:206:16: error: storage size of 'ret' isn't known struct sbiret ret; ^~~ arch/riscv/kernel/sbi.c:208:18: error: 'SBI_EXT_BASE' undeclared (first use in this function); did you mean 'BIT_MASK'? ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_SPEC_VERSION, ^~~~~~~~~~~~ BIT_MASK >> arch/riscv/kernel/sbi.c:208:32: error: 'SBI_BASE_GET_SPEC_VERSION' undeclared (first use in this function) ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_SPEC_VERSION, ^~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c:206:16: warning: unused variable 'ret' [-Wunused-variable] struct sbiret ret; ^~~ arch/riscv/kernel/sbi.c: In function 'sbi_get_firmware_id': arch/riscv/kernel/sbi.c:218:16: error: storage size of 'ret' isn't known struct sbiret ret; ^~~ arch/riscv/kernel/sbi.c:220:18: error: 'SBI_EXT_BASE' undeclared (first use in this function); did you mean 'BIT_MASK'? ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_IMP_ID, ^~~~~~~~~~~~ BIT_MASK >> arch/riscv/kernel/sbi.c:220:32: error: 'SBI_BASE_GET_IMP_ID' undeclared (first use in this function) ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_IMP_ID, ^~~~~~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c:218:16: warning: unused variable 'ret' [-Wunused-variable] struct sbiret ret; ^~~ arch/riscv/kernel/sbi.c: In function 'sbi_get_firmware_version': arch/riscv/kernel/sbi.c:230:16: error: storage size of 'ret' isn't known struct sbiret ret; ^~~ arch/riscv/kernel/sbi.c:232:18: error: 'SBI_EXT_BASE' undeclared (first use in this function); did you mean 'BIT_MASK'? ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_IMP_VERSION, ^~~~~~~~~~~~ BIT_MASK >> arch/riscv/kernel/sbi.c:232:32: error: 'SBI_BASE_GET_IMP_VERSION' undeclared (first use in this function); did you mean '__GXX_ABI_VERSION'? ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_IMP_VERSION, ^~~~~~~~~~~~~~~~~~~~~~~~ __GXX_ABI_VERSION arch/riscv/kernel/sbi.c:230:16: warning: unused variable 'ret' [-Wunused-variable] struct sbiret ret; ^~~ In file included from include/linux/kernel.h:15:0, from include/linux/list.h:9, from include/linux/pm.h:11, from arch/riscv/kernel/sbi.c:4: arch/riscv/kernel/sbi.c: In function 'sbi_init': arch/riscv/kernel/sbi.c:255:3: error: implicit declaration of function 'sbi_major_version'; did you mean 'sbi_get_spec_version'? [-Werror=implicit-function-declaration] sbi_major_version(), sbi_minor_version()); ^ include/linux/printk.h:311:34: note: in definition of macro 'pr_info' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~ arch/riscv/kernel/sbi.c:255:24: error: implicit declaration of function 'sbi_minor_version'; did you mean 'sbi_get_spec_version'? [-Werror=implicit-function-declaration] sbi_major_version(), sbi_minor_version()); ^ include/linux/printk.h:311:34: note: in definition of macro 'pr_info' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~ In file included from include/linux/printk.h:7:0, from include/linux/kernel.h:15, from include/linux/list.h:9, from include/linux/pm.h:11, from arch/riscv/kernel/sbi.c:4: include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^ include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~~~~~ include/linux/printk.h:311:9: note: in expansion of macro 'KERN_INFO' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~ arch/riscv/kernel/sbi.c:254:2: note: in expansion of macro 'pr_info' pr_info("SBI specification v%lu.%lu detected\n", ^~~~~~~ arch/riscv/kernel/sbi.c:254:32: note: format string is defined here pr_info("SBI specification v%lu.%lu detected\n", ~~^ %u In file included from include/linux/printk.h:7:0, from include/linux/kernel.h:15, from include/linux/list.h:9, from include/linux/pm.h:11, from arch/riscv/kernel/sbi.c:4: include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^ include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~~~~~ include/linux/printk.h:311:9: note: in expansion of macro 'KERN_INFO' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~ arch/riscv/kernel/sbi.c:254:2: note: in expansion of macro 'pr_info' pr_info("SBI specification v%lu.%lu detected\n", ^~~~~~~ arch/riscv/kernel/sbi.c:254:36: note: format string is defined here pr_info("SBI specification v%lu.%lu detected\n", ~~^ %u >> arch/riscv/kernel/sbi.c:256:7: error: implicit declaration of function 'sbi_spec_is_0_1' [-Werror=implicit-function-declaration] if (!sbi_spec_is_0_1()) ^~~~~~~~~~~~~~~ arch/riscv/kernel/sbi.c: In function 'sbi_console_getchar': arch/riscv/kernel/sbi.c:79:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ arch/riscv/kernel/sbi.c: In function 'sbi_get_spec_version': arch/riscv/kernel/sbi.c:214:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ arch/riscv/kernel/sbi.c: In function 'sbi_get_firmware_id': arch/riscv/kernel/sbi.c:226:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ arch/riscv/kernel/sbi.c: In function 'sbi_get_firmware_version': arch/riscv/kernel/sbi.c:238:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- arch/riscv/kernel/setup.c: In function 'setup_arch': >> arch/riscv/kernel/setup.c:78:2: error: implicit declaration of function 'sbi_init'; did you mean 'smp_init'? [-Werror=implicit-function-declaration] sbi_init(); ^~~~~~~~ smp_init cc1: some warnings being treated as errors vim +8 arch/riscv/kernel/sbi.c 6 7 /* default SBI version is 0.1 */ > 8 unsigned long sbi_spec_version = SBI_SPEC_VERSION_DEFAULT; 9 EXPORT_SYMBOL(sbi_spec_version); 10 > 11 struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, 12 unsigned long arg1, unsigned long arg2, 13 unsigned long arg3, unsigned long arg4, 14 unsigned long arg5) 15 { > 16 struct sbiret ret; 17 18 register uintptr_t a0 asm ("a0") = (uintptr_t)(arg0); 19 register uintptr_t a1 asm ("a1") = (uintptr_t)(arg1); 20 register uintptr_t a2 asm ("a2") = (uintptr_t)(arg2); 21 register uintptr_t a3 asm ("a3") = (uintptr_t)(arg3); 22 register uintptr_t a4 asm ("a4") = (uintptr_t)(arg4); 23 register uintptr_t a5 asm ("a5") = (uintptr_t)(arg5); 24 register uintptr_t a6 asm ("a6") = (uintptr_t)(fid); 25 register uintptr_t a7 asm ("a7") = (uintptr_t)(ext); 26 asm volatile ("ecall" 27 : "+r" (a0), "+r" (a1) 28 : "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6), "r" (a7) 29 : "memory"); 30 ret.error = a0; 31 ret.value = a1; 32 33 return ret; 34 } 35 EXPORT_SYMBOL(sbi_ecall); 36 37 static int sbi_err_map_linux_errno(int err) 38 { 39 switch (err) { > 40 case SBI_SUCCESS: 41 return 0; > 42 case SBI_ERR_DENIED: 43 return -EPERM; > 44 case SBI_ERR_INVALID_PARAM: 45 return -EINVAL; > 46 case SBI_ERR_INVALID_ADDRESS: 47 return -EFAULT; > 48 case SBI_ERR_NOT_SUPPORTED: > 49 case SBI_ERR_FAILURE: 50 default: 51 return -ENOTSUPP; 52 }; 53 } 54 55 /** 56 * sbi_console_putchar() - Writes given character to the console device. 57 * @ch: The data to be written to the console. 58 * 59 * Return: None 60 */ 61 void sbi_console_putchar(int ch) 62 { 63 sbi_ecall(SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, ch, 0, 0, 0, 0, 0); 64 } 65 EXPORT_SYMBOL(sbi_console_putchar); 66 67 /** 68 * sbi_console_getchar() - Reads a byte from console device. 69 * 70 * Returns the value read from console. 71 */ 72 int sbi_console_getchar(void) 73 { 74 struct sbiret ret; 75 76 ret = sbi_ecall(SBI_EXT_0_1_CONSOLE_GETCHAR, 0, 0, 0, 0, 0, 0, 0); 77 78 return ret.error; 79 } 80 EXPORT_SYMBOL(sbi_console_getchar); 81 82 /** 83 * sbi_set_timer() - Program the timer for next timer event. 84 * @stime_value: The value after which next timer event should fire. 85 * 86 * Return: None 87 */ 88 void sbi_set_timer(uint64_t stime_value) 89 { 90 #if __riscv_xlen == 32 91 sbi_ecall(SBI_EXT_0_1_SET_TIMER, 0, stime_value, 92 stime_value >> 32, 0, 0, 0, 0); 93 #else 94 sbi_ecall(SBI_EXT_0_1_SET_TIMER, 0, stime_value, 0, 0, 0, 0, 0); 95 #endif 96 } 97 EXPORT_SYMBOL(sbi_set_timer); 98 99 /** 100 * sbi_shutdown() - Remove all the harts from executing supervisor code. 101 * 102 * Return: None 103 */ 104 void sbi_shutdown(void) 105 { 106 sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0); 107 } 108 EXPORT_SYMBOL(sbi_shutdown); 109 110 /** 111 * sbi_clear_ipi() - Clear any pending IPIs for the calling hart. 112 * 113 * Return: None 114 */ 115 void sbi_clear_ipi(void) 116 { > 117 sbi_ecall(SBI_EXT_0_1_CLEAR_IPI, 0, 0, 0, 0, 0, 0, 0); 118 } 119 120 /** 121 * sbi_send_ipi() - Send an IPI to any hart. 122 * @hart_mask: A cpu mask containing all the target harts. 123 * 124 * Return: None 125 */ 126 void sbi_send_ipi(const unsigned long *hart_mask) 127 { 128 sbi_ecall(SBI_EXT_0_1_SEND_IPI, 0, (unsigned long)hart_mask, 129 0, 0, 0, 0, 0); 130 } 131 EXPORT_SYMBOL(sbi_send_ipi); 132 133 /** 134 * sbi_remote_fence_i() - Execute FENCE.I instruction on given remote harts. 135 * @hart_mask: A cpu mask containing all the target harts. 136 * 137 * Return: None 138 */ 139 void sbi_remote_fence_i(const unsigned long *hart_mask) 140 { > 141 sbi_ecall(SBI_EXT_0_1_REMOTE_FENCE_I, 0, (unsigned long)hart_mask, 142 0, 0, 0, 0, 0); 143 } 144 EXPORT_SYMBOL(sbi_remote_fence_i); 145 146 /** 147 * sbi_remote_sfence_vma() - Execute SFENCE.VMA instructions on given remote 148 * harts for the specified virtual address range. 149 * @hart_mask: A cpu mask containing all the target harts. 150 * @start: Start of the virtual address 151 * @size: Total size of the virtual address range. 152 * 153 * Return: None 154 */ 155 void sbi_remote_sfence_vma(const unsigned long *hart_mask, 156 unsigned long start, 157 unsigned long size) 158 { 159 sbi_ecall(SBI_EXT_0_1_REMOTE_SFENCE_VMA, 0, 160 (unsigned long)hart_mask, start, size, 0, 0, 0); 161 } 162 EXPORT_SYMBOL(sbi_remote_sfence_vma); 163 164 /** 165 * sbi_remote_sfence_vma_asid() - Execute SFENCE.VMA instructions on given 166 * remote harts for a virtual address range belonging to a specific ASID. 167 * 168 * @hart_mask: A cpu mask containing all the target harts. 169 * @start: Start of the virtual address 170 * @size: Total size of the virtual address range. 171 * @asid: The value of address space identifier (ASID). 172 * 173 * Return: None 174 */ 175 void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask, 176 unsigned long start, 177 unsigned long size, 178 unsigned long asid) 179 { > 180 sbi_ecall(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID, 0, 181 (unsigned long)hart_mask, start, size, asid, 0, 0); 182 } 183 EXPORT_SYMBOL(sbi_remote_sfence_vma_asid); 184 185 /** 186 * sbi_probe_extension() - Check if an SBI extension ID is supported or not. 187 * @extid: The extension ID to be probed. 188 * 189 * Return: Extension specific nonzero value f yes, -ENOTSUPP otherwise. 190 */ 191 int sbi_probe_extension(long extid) 192 { > 193 struct sbiret ret; 194 > 195 ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_PROBE_EXT, extid, 0, 0, 0, 0, 0); 196 if (!ret.error) 197 if (ret.value) 198 return ret.value; 199 200 return -ENOTSUPP; 201 } 202 EXPORT_SYMBOL(sbi_probe_extension); 203 204 static long sbi_get_spec_version(void) 205 { > 206 struct sbiret ret; 207 208 ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_SPEC_VERSION, 209 0, 0, 0, 0, 0, 0); 210 if (!ret.error) 211 return ret.value; 212 else 213 return ret.error; 214 } 215 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation