Subject: Re: [PATCH v5 3/3] mctp pcc: Implement MCTP over PCC Transport

From: kernel test robot <[email-masked]>
Date: Sat, 13 Jul 2024 15:53:02 +0800

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge linus/master v6.10-rc7 next-20240712]
[cannot apply to horms-ipvs/master]
[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/admiyo-os-amperecomputing-com/mctp-pcc-Check-before-sending-MCTP-PCC-response-ACK/20240712-104202
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20240712023626.1010559-4-admiyo%40os.amperecomputing.com
patch subject: [PATCH v5 3/3] mctp pcc: Implement MCTP over PCC Transport
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20240713/[email-masked]/config)
compiler: s390-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240713/[email-masked]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email-masked]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email-masked]/

All errors (new ones prefixed by >>):

   In file included from drivers/net/mctp/mctp-pcc.c:17:
   include/acpi/acpi_drivers.h:72:43: warning: 'struct acpi_pci_root' declared inside parameter list will not be visible outside of this definition or declaration
      72 | struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root);
         |                                           ^~~~~~~~~~~~~
   In file included from include/linux/printk.h:570,
                    from include/asm-generic/bug.h:22,
                    from arch/s390/include/asm/bug.h:69,
                    from include/linux/bug.h:5,
                    from arch/s390/include/asm/ctlreg.h:85,
                    from arch/s390/include/asm/lowcore.h:14,
                    from arch/s390/include/asm/current.h:13,
                    from arch/s390/include/asm/preempt.h:5,
                    from include/linux/preempt.h:79,
                    from include/linux/spinlock.h:56,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/slab.h:16,
                    from include/linux/resource_ext.h:11,
                    from include/linux/acpi.h:13,
                    from drivers/net/mctp/mctp-pcc.c:7:
   drivers/net/mctp/mctp-pcc.c: In function 'mctp_pcc_driver_add':
   drivers/net/mctp/mctp-pcc.c:212:26: error: invalid use of undefined type 'struct acpi_device'
     212 |         dev_dbg(&acpi_dev->dev, "Adding mctp_pcc device for HID  %s\n",
         |                          ^~
   include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:273:9: note: in expansion of macro '_dynamic_func_call'
     273 |         _dynamic_func_call(fmt, __dynamic_dev_dbg,              \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:165:9: note: in expansion of macro 'dynamic_dev_dbg'
     165 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~
   drivers/net/mctp/mctp-pcc.c:212:9: note: in expansion of macro 'dev_dbg'
     212 |         dev_dbg(&acpi_dev->dev, "Adding mctp_pcc device for HID  %s\n",
         |         ^~~~~~~
   drivers/net/mctp/mctp-pcc.c:213:17: error: implicit declaration of function 'acpi_device_hid'; did you mean 'acpi_device_dep'? [-Wimplicit-function-declaration]
     213 |                 acpi_device_hid(acpi_dev));
         |                 ^~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:273:9: note: in expansion of macro '_dynamic_func_call'
     273 |         _dynamic_func_call(fmt, __dynamic_dev_dbg,              \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:165:9: note: in expansion of macro 'dynamic_dev_dbg'
     165 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~
   drivers/net/mctp/mctp-pcc.c:212:9: note: in expansion of macro 'dev_dbg'
     212 |         dev_dbg(&acpi_dev->dev, "Adding mctp_pcc device for HID  %s\n",
         |         ^~~~~~~
   drivers/net/mctp/mctp-pcc.c:214:22: error: implicit declaration of function 'acpi_device_handle'; did you mean 'acpi_device_dep'? [-Wimplicit-function-declaration]
     214 |         dev_handle = acpi_device_handle(acpi_dev);
         |                      ^~~~~~~~~~~~~~~~~~
         |                      acpi_device_dep
   drivers/net/mctp/mctp-pcc.c:214:20: error: assignment to 'acpi_handle' {aka 'void *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
     214 |         dev_handle = acpi_device_handle(acpi_dev);
         |                    ^
   In file included from include/linux/device.h:15,
                    from include/linux/acpi.h:14:
   drivers/net/mctp/mctp-pcc.c:218:34: error: invalid use of undefined type 'struct acpi_device'
     218 |                 dev_err(&acpi_dev->dev, "FAILURE to lookup PCC indexes from CRS");
         |                                  ^~
   include/linux/dev_printk.h:110:25: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                         ^~~
   drivers/net/mctp/mctp-pcc.c:218:17: note: in expansion of macro 'dev_err'
     218 |                 dev_err(&acpi_dev->dev, "FAILURE to lookup PCC indexes from CRS");
         |                 ^~~~~~~
   drivers/net/mctp/mctp-pcc.c:223:24: error: invalid use of undefined type 'struct acpi_device'
     223 |         dev = &acpi_dev->dev;
         |                        ^~
   drivers/net/mctp/mctp-pcc.c:251:17: error: implicit declaration of function 'devm_ioremap' [-Wimplicit-function-declaration]
     251 |                 devm_ioremap(dev, mctp_pcc_dev->in_chan->shmem_base_addr,
         |                 ^~~~~~~~~~~~
>> drivers/net/mctp/mctp-pcc.c:250:43: error: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     250 |         mctp_pcc_dev->pcc_comm_inbox_addr =
         |                                           ^
   drivers/net/mctp/mctp-pcc.c:257:44: error: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     257 |         mctp_pcc_dev->pcc_comm_outbox_addr =
         |                                            ^
   drivers/net/mctp/mctp-pcc.c:268:17: error: invalid use of undefined type 'struct acpi_device'
     268 |         acpi_dev->driver_data = mctp_pcc_dev;
         |                 ^~
   drivers/net/mctp/mctp-pcc.c: In function 'mctp_pcc_driver_remove':
   drivers/net/mctp/mctp-pcc.c:297:47: error: implicit declaration of function 'acpi_driver_data'; did you mean 'acpi_get_data'? [-Wimplicit-function-declaration]
     297 |         struct mctp_pcc_ndev *mctp_pcc_ndev = acpi_driver_data(adev);
         |                                               ^~~~~~~~~~~~~~~~
         |                                               acpi_get_data
   drivers/net/mctp/mctp-pcc.c:297:47: error: initialization of 'struct mctp_pcc_ndev *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   drivers/net/mctp/mctp-pcc.c: At top level:
   drivers/net/mctp/mctp-pcc.c:309:15: error: variable 'mctp_pcc_driver' has initializer but incomplete type
     309 | static struct acpi_driver mctp_pcc_driver = {
         |               ^~~~~~~~~~~
   drivers/net/mctp/mctp-pcc.c:310:10: error: 'struct acpi_driver' has no member named 'name'
     310 |         .name = "mctp_pcc",
         |          ^~~~
   drivers/net/mctp/mctp-pcc.c:310:17: warning: excess elements in struct initializer
     310 |         .name = "mctp_pcc",
         |                 ^~~~~~~~~~
   drivers/net/mctp/mctp-pcc.c:310:17: note: (near initialization for 'mctp_pcc_driver')
   drivers/net/mctp/mctp-pcc.c:311:10: error: 'struct acpi_driver' has no member named 'class'
     311 |         .class = "Unknown",
         |          ^~~~~
   drivers/net/mctp/mctp-pcc.c:311:18: warning: excess elements in struct initializer
     311 |         .class = "Unknown",
         |                  ^~~~~~~~~
   drivers/net/mctp/mctp-pcc.c:311:18: note: (near initialization for 'mctp_pcc_driver')
   drivers/net/mctp/mctp-pcc.c:312:10: error: 'struct acpi_driver' has no member named 'ids'
     312 |         .ids = mctp_pcc_device_ids,
         |          ^~~
   drivers/net/mctp/mctp-pcc.c:312:16: warning: excess elements in struct initializer
     312 |         .ids = mctp_pcc_device_ids,
         |                ^~~~~~~~~~~~~~~~~~~
   drivers/net/mctp/mctp-pcc.c:312:16: note: (near initialization for 'mctp_pcc_driver')
   drivers/net/mctp/mctp-pcc.c:313:10: error: 'struct acpi_driver' has no member named 'ops'
     313 |         .ops = {
         |          ^~~
   drivers/net/mctp/mctp-pcc.c:313:16: error: extra brace group at end of initializer
     313 |         .ops = {
         |                ^
   drivers/net/mctp/mctp-pcc.c:313:16: note: (near initialization for 'mctp_pcc_driver')
   drivers/net/mctp/mctp-pcc.c:313:16: warning: excess elements in struct initializer
   drivers/net/mctp/mctp-pcc.c:313:16: note: (near initialization for 'mctp_pcc_driver')
   drivers/net/mctp/mctp-pcc.c:319:1: warning: data definition has no type or storage class
     319 | module_acpi_driver(mctp_pcc_driver);
         | ^~~~~~~~~~~~~~~~~~
   drivers/net/mctp/mctp-pcc.c:319:1: error: type defaults to 'int' in declaration of 'module_acpi_driver' [-Wimplicit-int]
   drivers/net/mctp/mctp-pcc.c:319:1: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
   drivers/net/mctp/mctp-pcc.c:309:27: error: storage size of 'mctp_pcc_driver' isn't known
     309 | static struct acpi_driver mctp_pcc_driver = {
         |                           ^~~~~~~~~~~~~~~
   drivers/net/mctp/mctp-pcc.c:309:27: warning: 'mctp_pcc_driver' defined but not used [-Wunused-variable]

vim +250 drivers/net/mctp/mctp-pcc.c

   197	
   198	static int mctp_pcc_driver_add(struct acpi_device *acpi_dev)
   199	{
   200		struct lookup_context context = {0, 0, 0};
   201		struct mctp_pcc_ndev *mctp_pcc_dev;
   202		struct net_device *ndev;
   203		acpi_handle dev_handle;
   204		acpi_status status;
   205		struct device *dev;
   206		int mctp_pcc_mtu;
   207		int outbox_index;
   208		int inbox_index;
   209		char name[32];
   210		int rc;
   211	
   212		dev_dbg(&acpi_dev->dev, "Adding mctp_pcc device for HID  %s\n",
   213			acpi_device_hid(acpi_dev));
   214		dev_handle = acpi_device_handle(acpi_dev);
   215		status = acpi_walk_resources(dev_handle, "_CRS", lookup_pcct_indices,
   216					     &context);
   217		if (!ACPI_SUCCESS(status)) {
   218			dev_err(&acpi_dev->dev, "FAILURE to lookup PCC indexes from CRS");
   219			return -EINVAL;
   220		}
   221		inbox_index = context.inbox_index;
   222		outbox_index = context.outbox_index;
   223		dev = &acpi_dev->dev;
   224	
   225		snprintf(name, sizeof(name), "mctpipcc%d", inbox_index);
   226		ndev = alloc_netdev(sizeof(struct mctp_pcc_ndev), name, NET_NAME_ENUM,
   227				    mctp_pcc_setup);
   228		if (!ndev)
   229			return -ENOMEM;
   230		mctp_pcc_dev = netdev_priv(ndev);
   231		spin_lock_init(&mctp_pcc_dev->lock);
   232	
   233		mctp_pcc_dev->hw_addr.inbox_index = inbox_index;
   234		mctp_pcc_dev->hw_addr.outbox_index = outbox_index;
   235		mctp_pcc_dev->inbox_client.rx_callback = mctp_pcc_client_rx_callback;
   236		mctp_pcc_dev->out_chan =
   237			pcc_mbox_request_channel(&mctp_pcc_dev->outbox_client,
   238						 outbox_index);
   239		if (IS_ERR(mctp_pcc_dev->out_chan)) {
   240			rc = PTR_ERR(mctp_pcc_dev->out_chan);
   241			goto free_netdev;
   242		}
   243		mctp_pcc_dev->in_chan =
   244			pcc_mbox_request_channel(&mctp_pcc_dev->inbox_client,
   245						 inbox_index);
   246		if (IS_ERR(mctp_pcc_dev->in_chan)) {
   247			rc = PTR_ERR(mctp_pcc_dev->in_chan);
   248			goto cleanup_out_channel;
   249		}
 > 250		mctp_pcc_dev->pcc_comm_inbox_addr =
   251			devm_ioremap(dev, mctp_pcc_dev->in_chan->shmem_base_addr,
   252				     mctp_pcc_dev->in_chan->shmem_size);
   253		if (!mctp_pcc_dev->pcc_comm_inbox_addr) {
   254			rc = -EINVAL;
   255			goto cleanup_in_channel;
   256		}
   257		mctp_pcc_dev->pcc_comm_outbox_addr =
   258			devm_ioremap(dev, mctp_pcc_dev->out_chan->shmem_base_addr,
   259				     mctp_pcc_dev->out_chan->shmem_size);
   260		if (!mctp_pcc_dev->pcc_comm_outbox_addr) {
   261			rc = -EINVAL;
   262			goto cleanup_in_channel;
   263		}
   264		mctp_pcc_dev->acpi_device = acpi_dev;
   265		mctp_pcc_dev->inbox_client.dev = dev;
   266		mctp_pcc_dev->outbox_client.dev = dev;
   267		mctp_pcc_dev->mdev.dev = ndev;
   268		acpi_dev->driver_data = mctp_pcc_dev;
   269	
   270		/* There is no clean way to pass the MTU
   271		 * to the callback function used for registration,
   272		 * so set the values ahead of time.
   273		 */
   274		mctp_pcc_mtu = mctp_pcc_dev->out_chan->shmem_size -
   275			sizeof(struct mctp_pcc_hdr);
   276		ndev->mtu = MCTP_MIN_MTU;
   277		ndev->max_mtu = mctp_pcc_mtu;
   278		ndev->min_mtu = MCTP_MIN_MTU;
   279	
   280		rc = register_netdev(ndev);
   281		if (rc)
   282			goto cleanup_in_channel;
   283		return 0;
   284	
   285	cleanup_in_channel:
   286		pcc_mbox_free_channel(mctp_pcc_dev->in_chan);
   287	cleanup_out_channel:
   288		pcc_mbox_free_channel(mctp_pcc_dev->out_chan);
   289	free_netdev:
   290		unregister_netdev(ndev);
   291		free_netdev(ndev);
   292		return rc;
   293	}
   294	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki