All of lore.kernel.org
 help / color / mirror / Atom feed
* [mchinth:sep_socwatch_linux_5_7 19/34] drivers/platform/x86/socwatch/sw_driver.c:1309:52: sparse: warning: incorrect type in argument 1 (different address spaces)
@ 2020-04-23  1:04 kbuild test robot
  0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2020-04-23  1:04 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 35729 bytes --]

tree:   https://github.com/mchinth/linux sep_socwatch_linux_5_7
head:   d0b187de0054ca718a325a5e30511873147ef526
commit: 074947f0245b650da1907cc66b8efc5696c8417c [19/34] platform/x86: Use $(srctree) instead of $(src) to adapt to kbuild regression
reproduce:
        # apt-get install sparse
        # sparse version: 
        git checkout 074947f0245b650da1907cc66b8efc5696c8417c
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> drivers/platform/x86/socwatch/sw_driver.c:1309:52: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_driver.c:1309:52: sparse:    expected void [noderef] <asn:1> *to
   drivers/platform/x86/socwatch/sw_driver.c:1309:52: sparse:    got char *[assigned] out_arg
   drivers/platform/x86/socwatch/sw_driver.c:1053:58: sparse: warning: incorrect type in argument 2 (different address spaces)
   drivers/platform/x86/socwatch/sw_driver.c:1053:58: sparse:    expected void [noderef] <asn:1> *buffer
   drivers/platform/x86/socwatch/sw_driver.c:1053:58: sparse:    got char *remote_buffer
   drivers/platform/x86/socwatch/sw_driver.c:1070:39: sparse: warning: incorrect type in argument 2 (different address spaces)
   drivers/platform/x86/socwatch/sw_driver.c:1070:39: sparse:    expected void const [noderef] <asn:1> *from
   drivers/platform/x86/socwatch/sw_driver.c:1070:39: sparse:    got char *remote_cfg
--
>> drivers/platform/x86/socwatch/sw_hardware_io.c:149:55: sparse: warning: incorrect type in argument 2 (different base types)
   drivers/platform/x86/socwatch/sw_hardware_io.c:149:55: sparse:    expected unsigned int flags
   drivers/platform/x86/socwatch/sw_hardware_io.c:149:55: sparse:    got restricted gfp_t
--
>> drivers/platform/x86/socwatch/sw_output_buffer.c:344:22: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_output_buffer.c:344:22: sparse:    expected void [noderef] <asn:1> *to
   drivers/platform/x86/socwatch/sw_output_buffer.c:344:22: sparse:    got void *dest
   drivers/platform/x86/socwatch/sw_output_buffer.c:352:43: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_output_buffer.c:352:43: sparse:    expected void [noderef] <asn:1> *to
   drivers/platform/x86/socwatch/sw_output_buffer.c:352:43: sparse:    got void *
>> drivers/platform/x86/socwatch/sw_output_buffer.c:378:46: sparse: warning: incorrect type in argument 1 (different base types)
   drivers/platform/x86/socwatch/sw_output_buffer.c:378:46: sparse:    expected unsigned int flags
   drivers/platform/x86/socwatch/sw_output_buffer.c:378:46: sparse:    got restricted gfp_t
>> drivers/platform/x86/socwatch/sw_output_buffer.c:398:6: sparse: warning: symbol 'reset_output_buffers' was not declared. Should it be static?
   drivers/platform/x86/socwatch/sw_output_buffer.c:562:46: sparse: warning: incorrect type in argument 2 (different base types)
   drivers/platform/x86/socwatch/sw_output_buffer.c:562:46: sparse:    expected unsigned int flags
   drivers/platform/x86/socwatch/sw_output_buffer.c:562:46: sparse:    got restricted gfp_t
   drivers/platform/x86/socwatch/sw_output_buffer.c:575:67: sparse: warning: incorrect type in argument 1 (different base types)
   drivers/platform/x86/socwatch/sw_output_buffer.c:575:67: sparse:    expected unsigned int flags
   drivers/platform/x86/socwatch/sw_output_buffer.c:575:67: sparse:    got restricted gfp_t
   drivers/platform/x86/socwatch/sw_output_buffer.c:774:48: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_output_buffer.c:774:48: sparse:    expected void *dest
   drivers/platform/x86/socwatch/sw_output_buffer.c:774:48: sparse:    got void [noderef] <asn:1> *buffer
--
>> drivers/platform/x86/socwatch/sw_tracepoint_handlers.c:237:44: sparse: warning: incorrect type in argument 2 (different base types)
   drivers/platform/x86/socwatch/sw_tracepoint_handlers.c:237:44: sparse:    expected unsigned int flags
   drivers/platform/x86/socwatch/sw_tracepoint_handlers.c:237:44: sparse:    got restricted gfp_t
--
>> drivers/platform/x86/socwatch/sw_mem.c:141:18: sparse: warning: cast to restricted gfp_t
   drivers/platform/x86/socwatch/sw_mem.c:305:38: sparse: warning: cast to restricted gfp_t
--
>> drivers/platform/x86/socwatch/sw_collector.c:99:68: sparse: warning: incorrect type in argument 2 (different base types)
   drivers/platform/x86/socwatch/sw_collector.c:99:68: sparse:    expected unsigned int flags
   drivers/platform/x86/socwatch/sw_collector.c:99:68: sparse:    got restricted gfp_t
>> drivers/platform/x86/socwatch/sw_collector.c:85:33: sparse: warning: symbol 'sw_copy_driver_interface_info_i' was not declared. Should it be static?
>> drivers/platform/x86/socwatch/sw_collector.c:116:5: sparse: warning: symbol 'sw_init_driver_interface_info_i' was not declared. Should it be static?
>> drivers/platform/x86/socwatch/sw_collector.c:138:5: sparse: warning: symbol 'sw_init_ops_i' was not declared. Should it be static?
   drivers/platform/x86/socwatch/sw_collector.c:186:57: sparse: warning: incorrect type in argument 2 (different base types)
   drivers/platform/x86/socwatch/sw_collector.c:186:57: sparse:    expected unsigned int flags
   drivers/platform/x86/socwatch/sw_collector.c:186:57: sparse:    got restricted gfp_t
   drivers/platform/x86/socwatch/sw_collector.c:214:57: sparse: warning: incorrect type in argument 2 (different base types)
   drivers/platform/x86/socwatch/sw_collector.c:214:57: sparse:    expected unsigned int flags
   drivers/platform/x86/socwatch/sw_collector.c:214:57: sparse:    got restricted gfp_t
>> drivers/platform/x86/socwatch/sw_collector.c:211:24: sparse: warning: symbol 'sw_alloc_ops_i' was not declared. Should it be static?
>> drivers/platform/x86/socwatch/sw_collector.c:323:6: sparse: warning: symbol 'sw_free_driver_interface_info_i' was not declared. Should it be static?
>> drivers/platform/x86/socwatch/sw_collector.c:329:6: sparse: warning: symbol 'sw_free_ops_i' was not declared. Should it be static?
>> drivers/platform/x86/socwatch/sw_collector.c:335:5: sparse: warning: symbol 'sw_reset_driver_interface_info_i' was not declared. Should it be static?
>> drivers/platform/x86/socwatch/sw_collector.c:453:6: sparse: warning: symbol 'sw_free_collector_msg_i' was not declared. Should it be static?
>> drivers/platform/x86/socwatch/sw_collector.c:459:6: sparse: warning: symbol 'sw_handle_per_cpu_msg_i' was not declared. Should it be static?
   drivers/platform/x86/socwatch/sw_collector.c:516:51: sparse: warning: incorrect type in argument 2 (different base types)
   drivers/platform/x86/socwatch/sw_collector.c:516:51: sparse:    expected unsigned int flags
   drivers/platform/x86/socwatch/sw_collector.c:516:51: sparse:    got restricted gfp_t
--
   drivers/platform/x86/socwatch/sw_telem.c:239:39: sparse: error: undefined identifier 'ioremap_nocache'
   drivers/platform/x86/socwatch/sw_telem.c:239:33: sparse: error: cast from unknown type
   drivers/platform/x86/socwatch/sw_telem.c:242:34: sparse: error: undefined identifier 'ioremap_nocache'
   drivers/platform/x86/socwatch/sw_telem.c:242:28: sparse: error: cast from unknown type
   drivers/platform/x86/socwatch/sw_telem.c:245:64: sparse: error: undefined identifier 'ioremap_nocache'
   drivers/platform/x86/socwatch/sw_telem.c:245:58: sparse: error: cast from unknown type
>> drivers/platform/x86/socwatch/sw_telem.c:260:25: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_telem.c:260:25: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/platform/x86/socwatch/sw_telem.c:260:25: sparse:    got unsigned long long volatile [usertype] *static [toplevel] s_punitInterfaceAddr
   drivers/platform/x86/socwatch/sw_telem.c:264:25: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_telem.c:264:25: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/platform/x86/socwatch/sw_telem.c:264:25: sparse:    got unsigned long long volatile [usertype] *static [toplevel] s_punitDataAddr
   drivers/platform/x86/socwatch/sw_telem.c:268:54: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_telem.c:268:54: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/platform/x86/socwatch/sw_telem.c:268:54: sparse:    got unsigned long long volatile [usertype] *ssram_virt_addr
   drivers/platform/x86/socwatch/sw_telem.c:280:34: sparse: error: undefined identifier 'ioremap_nocache'
   drivers/platform/x86/socwatch/sw_telem.c:280:28: sparse: error: cast from unknown type
   drivers/platform/x86/socwatch/sw_telem.c:283:34: sparse: error: undefined identifier 'ioremap_nocache'
   drivers/platform/x86/socwatch/sw_telem.c:283:28: sparse: error: cast from unknown type
   drivers/platform/x86/socwatch/sw_telem.c:286:35: sparse: error: undefined identifier 'ioremap_nocache'
   drivers/platform/x86/socwatch/sw_telem.c:286:29: sparse: error: cast from unknown type
   drivers/platform/x86/socwatch/sw_telem.c:289:35: sparse: error: undefined identifier 'ioremap_nocache'
   drivers/platform/x86/socwatch/sw_telem.c:289:29: sparse: error: cast from unknown type
   drivers/platform/x86/socwatch/sw_telem.c:292:62: sparse: error: undefined identifier 'ioremap_nocache'
   drivers/platform/x86/socwatch/sw_telem.c:292:56: sparse: error: cast from unknown type
   drivers/platform/x86/socwatch/sw_telem.c:307:25: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_telem.c:307:25: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/platform/x86/socwatch/sw_telem.c:307:25: sparse:    got unsigned long long volatile [usertype] *static [toplevel] s_pmcIPCCmdAddr
   drivers/platform/x86/socwatch/sw_telem.c:311:25: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_telem.c:311:25: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/platform/x86/socwatch/sw_telem.c:311:25: sparse:    got unsigned long long volatile [usertype] *static [toplevel] s_pmcIPCStsAddr
   drivers/platform/x86/socwatch/sw_telem.c:315:25: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_telem.c:315:25: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/platform/x86/socwatch/sw_telem.c:315:25: sparse:    got unsigned long long volatile [usertype] *static [toplevel] s_pmcIPCWBufAddr
   drivers/platform/x86/socwatch/sw_telem.c:319:25: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_telem.c:319:25: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/platform/x86/socwatch/sw_telem.c:319:25: sparse:    got unsigned long long volatile [usertype] *static [toplevel] s_pmcIPCRBufAddr
   drivers/platform/x86/socwatch/sw_telem.c:323:52: sparse: warning: incorrect type in argument 1 (different address spaces)
   drivers/platform/x86/socwatch/sw_telem.c:323:52: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/platform/x86/socwatch/sw_telem.c:323:52: sparse:    got unsigned long long volatile [usertype] *ssram_virt_addr
>> drivers/platform/x86/socwatch/sw_telem.c:671:5: sparse: warning: symbol 'read_telem' was not declared. Should it be static?
--
>> drivers/platform/x86/socwatch/sw_internal.c:176:50: sparse: warning: incorrect type in argument 2 (different base types)
   drivers/platform/x86/socwatch/sw_internal.c:176:50: sparse:    expected unsigned int flags
   drivers/platform/x86/socwatch/sw_internal.c:176:50: sparse:    got restricted gfp_t

vim +1309 drivers/platform/x86/socwatch/sw_driver.c

b0cc42c089f7fc Jon Moeller    2018-11-13  1115  
b0cc42c089f7fc Jon Moeller    2018-11-13  1116  static long sw_unlocked_handle_ioctl_i(unsigned int ioctl_num,
b0cc42c089f7fc Jon Moeller    2018-11-13  1117  					   void *p_local_args)
b0cc42c089f7fc Jon Moeller    2018-11-13  1118  {
b0cc42c089f7fc Jon Moeller    2018-11-13  1119  	struct sw_driver_ioctl_arg local_args;
b0cc42c089f7fc Jon Moeller    2018-11-13  1120  	int local_in_len, local_out_len;
b0cc42c089f7fc Jon Moeller    2018-11-13  1121  
b0cc42c089f7fc Jon Moeller    2018-11-13  1122  	if (!p_local_args) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1123  		pw_pr_error("ERROR: NULL p_local_args value?!\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1124  		return -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1125  	}
b0cc42c089f7fc Jon Moeller    2018-11-13  1126  
b0cc42c089f7fc Jon Moeller    2018-11-13  1127  	/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1128  	 * (1) Sanity check:
b0cc42c089f7fc Jon Moeller    2018-11-13  1129  	 * Before doing anything, double check to
b0cc42c089f7fc Jon Moeller    2018-11-13  1130  	 * make sure this IOCTL was really intended
b0cc42c089f7fc Jon Moeller    2018-11-13  1131  	 * for us!
b0cc42c089f7fc Jon Moeller    2018-11-13  1132  	 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1133  	if (_IOC_TYPE(ioctl_num) != APWR_IOCTL_MAGIC_NUM) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1134  		pw_pr_error(
e62dab7842638a Faycal Benmlih 2019-04-23  1135  			"ERROR: requested IOCTL TYPE (%d) != \
e62dab7842638a Faycal Benmlih 2019-04-23  1136  				APWR_IOCTL_MAGIC_NUM (%d)\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1137  			_IOC_TYPE(ioctl_num), APWR_IOCTL_MAGIC_NUM);
b0cc42c089f7fc Jon Moeller    2018-11-13  1138  		return -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1139  	}
b0cc42c089f7fc Jon Moeller    2018-11-13  1140  	/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1141  	 * (2) Extract arg lengths.
b0cc42c089f7fc Jon Moeller    2018-11-13  1142  	 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1143  	local_args = *((struct sw_driver_ioctl_arg *)p_local_args);
b0cc42c089f7fc Jon Moeller    2018-11-13  1144  
b0cc42c089f7fc Jon Moeller    2018-11-13  1145  	local_in_len = local_args.in_len;
b0cc42c089f7fc Jon Moeller    2018-11-13  1146  	local_out_len = local_args.out_len;
b0cc42c089f7fc Jon Moeller    2018-11-13  1147  	pw_pr_debug("GU: local_in_len = %d, local_out_len = %d\n", local_in_len,
b0cc42c089f7fc Jon Moeller    2018-11-13  1148  		local_out_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1149  	/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1150  	 * (3) Service individual IOCTL requests.
b0cc42c089f7fc Jon Moeller    2018-11-13  1151  	 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1152  	if (MATCH_IOCTL(ioctl_num, PW_IOCTL_CONFIG)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1153  		pw_pr_debug("PW_IOCTL_CONFIG\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1154  		return sw_set_driver_infos_i(
b0cc42c089f7fc Jon Moeller    2018-11-13  1155  			(struct sw_driver_interface_msg __user *)
b0cc42c089f7fc Jon Moeller    2018-11-13  1156  				local_args.in_arg,
b0cc42c089f7fc Jon Moeller    2018-11-13  1157  			local_in_len);
e62dab7842638a Faycal Benmlih 2019-04-23  1158  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_CONFIG_CONTINUOUS)) {
e62dab7842638a Faycal Benmlih 2019-04-23  1159  		pw_pr_debug("DEBUG: PW_IOCTL_CONFIG_CONTINUOUS\n");
e62dab7842638a Faycal Benmlih 2019-04-23  1160  		return sw_set_continuous_i(
e62dab7842638a Faycal Benmlih 2019-04-23  1161  			(struct sw_driver_continuous_collect __user *)
e62dab7842638a Faycal Benmlih 2019-04-23  1162  				local_args.in_arg,
e62dab7842638a Faycal Benmlih 2019-04-23  1163  			local_in_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1164  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_CMD)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1165  		sw_driver_collection_cmd_t local_cmd;
b0cc42c089f7fc Jon Moeller    2018-11-13  1166  
b0cc42c089f7fc Jon Moeller    2018-11-13  1167  		pw_pr_debug("PW_IOCTL_CMD\n");
e62dab7842638a Faycal Benmlih 2019-04-23  1168  	if (get_user(local_cmd,
e62dab7842638a Faycal Benmlih 2019-04-23  1169  		(sw_driver_collection_cmd_t __user *)local_args.in_arg)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1170  		pw_pr_error("ERROR: could NOT extract cmd value!\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1171  		return -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1172  	}
e62dab7842638a Faycal Benmlih 2019-04-23  1173  	return sw_handle_cmd_i(local_cmd, (u64 __user *)local_args.out_arg);
b0cc42c089f7fc Jon Moeller    2018-11-13  1174  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_POLL)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1175  		pw_pr_debug("PW_IOCTL_POLL\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1176  		return DO_PER_CPU_OVERHEAD_FUNC_RET(int, sw_collection_poll_i);
b0cc42c089f7fc Jon Moeller    2018-11-13  1177  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_IMMEDIATE_IO)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1178  		struct sw_driver_interface_info *local_info;
b0cc42c089f7fc Jon Moeller    2018-11-13  1179  		struct sw_driver_io_descriptor *local_descriptor = NULL;
b0cc42c089f7fc Jon Moeller    2018-11-13  1180  		int retVal = PW_SUCCESS;
b0cc42c089f7fc Jon Moeller    2018-11-13  1181  		char *src_vals = NULL;
b0cc42c089f7fc Jon Moeller    2018-11-13  1182  		char *dst_vals = NULL;
b0cc42c089f7fc Jon Moeller    2018-11-13  1183  
b0cc42c089f7fc Jon Moeller    2018-11-13  1184  		pw_pr_debug("PW_IOCTL_IMMEDIATE_IO\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1185  		pw_pr_debug("local_in_len = %u\n", local_in_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1186  
b0cc42c089f7fc Jon Moeller    2018-11-13  1187  		src_vals = vmalloc(local_in_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1188  		if (!src_vals) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1189  			pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1190  				"ERROR allocating space for immediate IO\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1191  			return -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1192  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1193  		if (local_out_len) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1194  			dst_vals = vmalloc(local_out_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1195  			if (!dst_vals) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1196  				vfree(src_vals);
b0cc42c089f7fc Jon Moeller    2018-11-13  1197  				pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1198  					"ERROR allocating space for immediate IO\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1199  				return -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1200  			}
b0cc42c089f7fc Jon Moeller    2018-11-13  1201  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1202  		if (copy_from_user(src_vals, (char __user *)local_args.in_arg,
b0cc42c089f7fc Jon Moeller    2018-11-13  1203  				   local_in_len)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1204  			pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1205  				"ERROR copying in immediate IO descriptor\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1206  			retVal = -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1207  			goto ret_immediate_io;
b0cc42c089f7fc Jon Moeller    2018-11-13  1208  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1209  		local_info = (struct sw_driver_interface_info *)src_vals;
b0cc42c089f7fc Jon Moeller    2018-11-13  1210  		pw_pr_debug(
b0cc42c089f7fc Jon Moeller    2018-11-13  1211  			"OK, asked to perform immediate IO on cpu(s) %d, # descriptors = %d\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1212  			local_info->cpu_mask, local_info->num_io_descriptors);
b0cc42c089f7fc Jon Moeller    2018-11-13  1213  		/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1214  		 * For now, require only a single descriptor.
b0cc42c089f7fc Jon Moeller    2018-11-13  1215  		 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1216  		if (local_info->num_io_descriptors != 1) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1217  			pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1218  				"ERROR: told to perform immediate IO with %d descriptors -- MAX of 1 descriptor allowed!\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1219  				local_info->num_io_descriptors);
b0cc42c089f7fc Jon Moeller    2018-11-13  1220  			retVal = -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1221  			goto ret_immediate_io;
b0cc42c089f7fc Jon Moeller    2018-11-13  1222  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1223  		local_descriptor = ((struct sw_driver_io_descriptor *)
b0cc42c089f7fc Jon Moeller    2018-11-13  1224  						local_info->descriptors);
b0cc42c089f7fc Jon Moeller    2018-11-13  1225  		pw_pr_debug("Collection type after %d\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1226  				local_descriptor->collection_type);
b0cc42c089f7fc Jon Moeller    2018-11-13  1227  		/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1228  		 * Check cpu mask for correctness here. For now, we do NOT allow
b0cc42c089f7fc Jon Moeller    2018-11-13  1229  		 * reading on ALL cpus.
b0cc42c089f7fc Jon Moeller    2018-11-13  1230  		 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1231  		if ((int)local_info->cpu_mask < -1 ||
b0cc42c089f7fc Jon Moeller    2018-11-13  1232  			(int)local_info->cpu_mask >= (int)sw_max_num_cpus) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1233  			pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1234  				"ERROR: invalid cpu mask %d specified in immediate IO; valid values are: -1, [0 -- %d]!\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1235  				local_info->cpu_mask, sw_max_num_cpus - 1);
b0cc42c089f7fc Jon Moeller    2018-11-13  1236  			retVal = -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1237  			goto ret_immediate_io;
b0cc42c089f7fc Jon Moeller    2018-11-13  1238  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1239  		/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1240  		 * Check collection type for correctness here
b0cc42c089f7fc Jon Moeller    2018-11-13  1241  		 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1242  		pw_pr_debug(
b0cc42c089f7fc Jon Moeller    2018-11-13  1243  			"Asked to perform immediate IO with descriptor with type = %d, on cpu = %d\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1244  			local_descriptor->collection_type,
b0cc42c089f7fc Jon Moeller    2018-11-13  1245  			local_info->cpu_mask);
b0cc42c089f7fc Jon Moeller    2018-11-13  1246  		if (sw_is_valid_hw_op_id(local_descriptor->collection_type) ==
b0cc42c089f7fc Jon Moeller    2018-11-13  1247  			false) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1248  			pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1249  				"ERROR: invalid collection type %d specified for immediate IO\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1250  				(int)local_descriptor->collection_type);
b0cc42c089f7fc Jon Moeller    2018-11-13  1251  			retVal = -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1252  			goto ret_immediate_io;
b0cc42c089f7fc Jon Moeller    2018-11-13  1253  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1254  		/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1255  		 * Check collection cmd for correctness here
b0cc42c089f7fc Jon Moeller    2018-11-13  1256  		 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1257  		if (local_descriptor->collection_command < SW_IO_CMD_READ ||
b0cc42c089f7fc Jon Moeller    2018-11-13  1258  			local_descriptor->collection_command > SW_IO_CMD_WRITE) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1259  			pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1260  				"ERROR: invalid collection command %d specified for immediate IO\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1261  				local_descriptor->collection_command);
b0cc42c089f7fc Jon Moeller    2018-11-13  1262  			retVal = -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1263  			goto ret_immediate_io;
b0cc42c089f7fc Jon Moeller    2018-11-13  1264  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1265  		/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1266  		 * Initialize the descriptor -- 'MMIO' and 'IPC' reads may need
b0cc42c089f7fc Jon Moeller    2018-11-13  1267  		 * an "ioremap_nocache"
b0cc42c089f7fc Jon Moeller    2018-11-13  1268  		 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1269  		if (sw_init_driver_io_descriptor(local_descriptor)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1270  			pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1271  				"ERROR initializing immediate IO descriptor\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1272  			retVal = -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1273  			goto ret_immediate_io;
b0cc42c089f7fc Jon Moeller    2018-11-13  1274  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1275  		/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1276  		 * OK, perform the actual IO.
b0cc42c089f7fc Jon Moeller    2018-11-13  1277  		 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1278  		{
b0cc42c089f7fc Jon Moeller    2018-11-13  1279  			struct sw_immediate_request_info request_info = {
b0cc42c089f7fc Jon Moeller    2018-11-13  1280  				local_descriptor, dst_vals, &retVal
b0cc42c089f7fc Jon Moeller    2018-11-13  1281  			};
b0cc42c089f7fc Jon Moeller    2018-11-13  1282  			struct cpumask cpumask;
b0cc42c089f7fc Jon Moeller    2018-11-13  1283  
b0cc42c089f7fc Jon Moeller    2018-11-13  1284  			cpumask_clear(&cpumask);
b0cc42c089f7fc Jon Moeller    2018-11-13  1285  			switch (local_info->cpu_mask) {
dc34286db0e280 Jon Moeller    2018-12-15  1286  			case -1: /* IO on ANY CPU (assume current CPU) */
b0cc42c089f7fc Jon Moeller    2018-11-13  1287  				cpumask_set_cpu(RAW_CPU(), &cpumask);
b0cc42c089f7fc Jon Moeller    2018-11-13  1288  				pw_pr_debug("ANY CPU\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1289  				break;
dc34286db0e280 Jon Moeller    2018-12-15  1290  			default: /* IO on a particular CPU */
b0cc42c089f7fc Jon Moeller    2018-11-13  1291  				cpumask_set_cpu(local_info->cpu_mask, &cpumask);
b0cc42c089f7fc Jon Moeller    2018-11-13  1292  				pw_pr_debug("[%d] setting for %d\n", RAW_CPU(),
b0cc42c089f7fc Jon Moeller    2018-11-13  1293  						local_info->cpu_mask);
b0cc42c089f7fc Jon Moeller    2018-11-13  1294  				break;
b0cc42c089f7fc Jon Moeller    2018-11-13  1295  			}
b0cc42c089f7fc Jon Moeller    2018-11-13  1296  			sw_schedule_work(&cpumask,
b0cc42c089f7fc Jon Moeller    2018-11-13  1297  					 &sw_handle_immediate_request_i,
b0cc42c089f7fc Jon Moeller    2018-11-13  1298  					 &request_info);
b0cc42c089f7fc Jon Moeller    2018-11-13  1299  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1300  		if (retVal != PW_SUCCESS) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1301  			pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1302  				"ERROR performing immediate IO on one (or more) CPUs!\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1303  			goto ret_immediate_io_reset;
b0cc42c089f7fc Jon Moeller    2018-11-13  1304  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1305  		/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1306  		 * OK, all done.
b0cc42c089f7fc Jon Moeller    2018-11-13  1307  		 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1308  		if (local_descriptor->collection_command == SW_IO_CMD_READ) {
b0cc42c089f7fc Jon Moeller    2018-11-13 @1309  			if (copy_to_user(local_args.out_arg, dst_vals,
b0cc42c089f7fc Jon Moeller    2018-11-13  1310  					 local_out_len)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1311  				pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1312  					"ERROR copying %u bytes of value to userspace!\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1313  					local_out_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1314  				retVal = -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1315  				goto ret_immediate_io_reset;
b0cc42c089f7fc Jon Moeller    2018-11-13  1316  			}
b0cc42c089f7fc Jon Moeller    2018-11-13  1317  			pw_pr_debug(
b0cc42c089f7fc Jon Moeller    2018-11-13  1318  				"OK, copied %u bytes of value to userspace addr %p!\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1319  				local_out_len, local_args.out_arg);
b0cc42c089f7fc Jon Moeller    2018-11-13  1320  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1321  ret_immediate_io_reset:
b0cc42c089f7fc Jon Moeller    2018-11-13  1322  		/*
b0cc42c089f7fc Jon Moeller    2018-11-13  1323  		 * Reset the descriptor -- 'MMIO' and 'IPC' reads may have
b0cc42c089f7fc Jon Moeller    2018-11-13  1324  		 * performed an "ioremap_nocache" which now needs to be
b0cc42c089f7fc Jon Moeller    2018-11-13  1325  		 * unmapped.
b0cc42c089f7fc Jon Moeller    2018-11-13  1326  		 */
b0cc42c089f7fc Jon Moeller    2018-11-13  1327  		if (sw_reset_driver_io_descriptor(local_descriptor)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1328  			pw_pr_error(
b0cc42c089f7fc Jon Moeller    2018-11-13  1329  				"ERROR resetting immediate IO descriptor\n");
b0cc42c089f7fc Jon Moeller    2018-11-13  1330  			retVal = -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1331  			goto ret_immediate_io;
b0cc42c089f7fc Jon Moeller    2018-11-13  1332  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1333  ret_immediate_io:
b0cc42c089f7fc Jon Moeller    2018-11-13  1334  		vfree(src_vals);
e62dab7842638a Faycal Benmlih 2019-04-23  1335  		if (dst_vals)
b0cc42c089f7fc Jon Moeller    2018-11-13  1336  			vfree(dst_vals);
e62dab7842638a Faycal Benmlih 2019-04-23  1337  
b0cc42c089f7fc Jon Moeller    2018-11-13  1338  		return retVal;
b0cc42c089f7fc Jon Moeller    2018-11-13  1339  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_GET_SCU_FW_VERSION)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1340  		u32 local_data = (u32)sw_scu_fw_major_minor;
b0cc42c089f7fc Jon Moeller    2018-11-13  1341  
b0cc42c089f7fc Jon Moeller    2018-11-13  1342  		if (put_user(local_data, (u32 __user *)local_args.out_arg)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1343  			pw_pr_error(
e62dab7842638a Faycal Benmlih 2019-04-23  1344  				"ERROR copying scu fw version to userspace!\n"
e62dab7842638a Faycal Benmlih 2019-04-23  1345  				);
b0cc42c089f7fc Jon Moeller    2018-11-13  1346  			return -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1347  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1348  		return PW_SUCCESS;
b0cc42c089f7fc Jon Moeller    2018-11-13  1349  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_GET_DRIVER_VERSION)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1350  		pw_u64_t local_version =
b0cc42c089f7fc Jon Moeller    2018-11-13  1351  			(pw_u64_t)SW_DRIVER_VERSION_MAJOR << 32 |
b0cc42c089f7fc Jon Moeller    2018-11-13  1352  			(pw_u64_t)SW_DRIVER_VERSION_MINOR << 16 |
b0cc42c089f7fc Jon Moeller    2018-11-13  1353  			(pw_u64_t)SW_DRIVER_VERSION_OTHER;
e62dab7842638a Faycal Benmlih 2019-04-23  1354  		if (put_user(local_version,
e62dab7842638a Faycal Benmlih 2019-04-23  1355  			(u64 __user *)local_args.out_arg)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1356  			pw_pr_error(
e62dab7842638a Faycal Benmlih 2019-04-23  1357  				"ERROR copying driver version to userspace!\n"
e62dab7842638a Faycal Benmlih 2019-04-23  1358  				);
b0cc42c089f7fc Jon Moeller    2018-11-13  1359  			return -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1360  		}
b0cc42c089f7fc Jon Moeller    2018-11-13  1361  		return PW_SUCCESS;
e62dab7842638a Faycal Benmlih 2019-04-23  1362  	} else if (MATCH_IOCTL(ioctl_num,
e62dab7842638a Faycal Benmlih 2019-04-23  1363  			PW_IOCTL_GET_AVAILABLE_TRACEPOINTS)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1364  		pw_pr_debug("DEBUG: AVAIL tracepoints! local_out_len = %u\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1365  			local_out_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1366  		return sw_get_available_name_id_mappings_i(
b0cc42c089f7fc Jon Moeller    2018-11-13  1367  			SW_NAME_TYPE_TRACEPOINT,
b0cc42c089f7fc Jon Moeller    2018-11-13  1368  			(struct sw_name_info_msg __user *)local_args.out_arg,
b0cc42c089f7fc Jon Moeller    2018-11-13  1369  			local_out_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1370  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_GET_AVAILABLE_NOTIFIERS)) {
e62dab7842638a Faycal Benmlih 2019-04-23  1371  		pw_pr_debug("DEBUG: AVAIL notifiers! local_out_len = %u\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1372  			local_out_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1373  		return sw_get_available_name_id_mappings_i(
b0cc42c089f7fc Jon Moeller    2018-11-13  1374  			SW_NAME_TYPE_NOTIFIER,
b0cc42c089f7fc Jon Moeller    2018-11-13  1375  			(struct sw_name_info_msg __user *)local_args.out_arg,
b0cc42c089f7fc Jon Moeller    2018-11-13  1376  			local_out_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1377  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_GET_AVAILABLE_COLLECTORS)) {
e62dab7842638a Faycal Benmlih 2019-04-23  1378  		pw_pr_debug("DEBUG: AVAIL collectors! local_out_len = %u\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1379  			local_out_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1380  		return sw_get_available_name_id_mappings_i(
b0cc42c089f7fc Jon Moeller    2018-11-13  1381  			SW_NAME_TYPE_COLLECTOR,
b0cc42c089f7fc Jon Moeller    2018-11-13  1382  			(struct sw_name_info_msg __user *)local_args.out_arg,
b0cc42c089f7fc Jon Moeller    2018-11-13  1383  			local_out_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1384  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_GET_TOPOLOGY_CHANGES)) {
b0cc42c089f7fc Jon Moeller    2018-11-13  1385  		pw_pr_debug("DEBUG: TOPOLOGY changes! local_out_len = %u\n",
b0cc42c089f7fc Jon Moeller    2018-11-13  1386  			local_out_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1387  		return sw_get_topology_changes_i(
b0cc42c089f7fc Jon Moeller    2018-11-13  1388  			(struct sw_driver_topology_msg __user *)
e62dab7842638a Faycal Benmlih 2019-04-23  1389  				local_args.out_arg, local_out_len);
e62dab7842638a Faycal Benmlih 2019-04-23  1390  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_READ_CONTINUOUS)) {
e62dab7842638a Faycal Benmlih 2019-04-23  1391  		pw_pr_debug("DEBUG: READ_CONTINUOUS!\n");
e62dab7842638a Faycal Benmlih 2019-04-23  1392  		return sw_read_continuous_i(local_args.out_arg, local_out_len);
e62dab7842638a Faycal Benmlih 2019-04-23  1393  	} else if (MATCH_IOCTL(ioctl_num, PW_IOCTL_SET_TELEM_BAR)) {
e62dab7842638a Faycal Benmlih 2019-04-23  1394  		pw_pr_debug("DEBUG: got a request to set telem bar!\n");
e62dab7842638a Faycal Benmlih 2019-04-23  1395  		return sw_set_telem_cfgs_i(local_args.in_arg, local_in_len);
b0cc42c089f7fc Jon Moeller    2018-11-13  1396  	}
e62dab7842638a Faycal Benmlih 2019-04-23  1397  
e62dab7842638a Faycal Benmlih 2019-04-23  1398  	pw_pr_error("ERROR: invalid ioctl num: %u\n", _IOC_NR(ioctl_num));
b0cc42c089f7fc Jon Moeller    2018-11-13  1399  	return -PW_ERROR;
b0cc42c089f7fc Jon Moeller    2018-11-13  1400  }
b0cc42c089f7fc Jon Moeller    2018-11-13  1401  

:::::: The code@line 1309 was first introduced by commit
:::::: b0cc42c089f7fcfb09833e572ec9304e5b8e87ef platform/x86: add sep and socwatch drivers without socperf.

:::::: TO: Jon Moeller <jon.moeller@intel.com>
:::::: CC: Faycal Benmlih <faycal.benmlih@intel.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-23  1:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23  1:04 [mchinth:sep_socwatch_linux_5_7 19/34] drivers/platform/x86/socwatch/sw_driver.c:1309:52: sparse: warning: incorrect type in argument 1 (different address spaces) kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.