Re: [PATCH v1 14/15] nitro_enclaves: Add Makefile for the Nitro Enclaves driver

Paraschiv, Andra-Irina
2020-04-24T15:27:41Z

On 23/04/2020 11:43, kbuild test robot wrote:
>
> Hi Andra,
>
> Thank you for the patch! Perhaps something to improve:

Fixed in v2.

Andra

>
> [auto build test WARNING on linus/master]
> [also build test WARNING on linux/master v5.7-rc2 next-20200422]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
>
> url: https://github.com/0day-ci/linux/commits/Andra-Paraschiv/Add-support-for-Nitro-Enclaves/20200423-130814
> base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 18bf34080c4c3beb6699181986cc97dd712498fe
> config: i386-allmodconfig (attached as .config)
> compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> In file included from include/linux/device.h:15:0,
> from drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c:22:
> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c: In function 'ne_submit_request':
>>> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c:80:9: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
> "Invalid req size=%ld for cmd type=%d\n",
> ^
> include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
> #define dev_fmt(fmt) fmt
> ^~~
>>> include/linux/dev_printk.h:167:3: note: in expansion of macro 'dev_err'
> dev_level(dev, fmt, ##__VA_ARGS__); \
> ^~~~~~~~~
> include/linux/dev_printk.h:177:2: note: in expansion of macro 'dev_level_ratelimited'
> dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
> ^~~~~~~~~~~~~~~~~~~~~
>>> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c:79:3: note: in expansion of macro 'dev_err_ratelimited'
> dev_err_ratelimited(&pdev->dev,
> ^~~~~~~~~~~~~~~~~~~
> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c: In function 'ne_retrieve_reply':
> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c:121:35: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
> dev_err_ratelimited(&pdev->dev, "Invalid reply size=%ld\n",
> ^
> include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
> #define dev_fmt(fmt) fmt
> ^~~
>>> include/linux/dev_printk.h:167:3: note: in expansion of macro 'dev_err'
> dev_level(dev, fmt, ##__VA_ARGS__); \
> ^~~~~~~~~
> include/linux/dev_printk.h:177:2: note: in expansion of macro 'dev_level_ratelimited'
> dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
> ^~~~~~~~~~~~~~~~~~~~~
> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c:121:3: note: in expansion of macro 'dev_err_ratelimited'
> dev_err_ratelimited(&pdev->dev, "Invalid reply size=%ld\n",
> ^~~~~~~~~~~~~~~~~~~
> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c: In function 'ne_do_request':
> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c:193:9: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
> "Invalid req size=%ld for cmd type=%d\n",
> ^
> include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
> #define dev_fmt(fmt) fmt
> ^~~
>>> include/linux/dev_printk.h:167:3: note: in expansion of macro 'dev_err'
> dev_level(dev, fmt, ##__VA_ARGS__); \
> ^~~~~~~~~
> include/linux/dev_printk.h:177:2: note: in expansion of macro 'dev_level_ratelimited'
> dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
> ^~~~~~~~~~~~~~~~~~~~~
> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c:192:3: note: in expansion of macro 'dev_err_ratelimited'
> dev_err_ratelimited(&pdev->dev,
> ^~~~~~~~~~~~~~~~~~~
> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c:203:35: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
> dev_err_ratelimited(&pdev->dev, "Invalid reply size=%ld\n",
> ^
> include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
> #define dev_fmt(fmt) fmt
> ^~~
>>> include/linux/dev_printk.h:167:3: note: in expansion of macro 'dev_err'
> dev_level(dev, fmt, ##__VA_ARGS__); \
> ^~~~~~~~~
> include/linux/dev_printk.h:177:2: note: in expansion of macro 'dev_level_ratelimited'
> dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
> ^~~~~~~~~~~~~~~~~~~~~
> drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c:203:3: note: in expansion of macro 'dev_err_ratelimited'
> dev_err_ratelimited(&pdev->dev, "Invalid reply size=%ld\n",
> ^~~~~~~~~~~~~~~~~~~
>
> vim +80 drivers/virt/amazon/nitro_enclaves/ne_pci_dev.c
>
> 0ed609272739ee Andra Paraschiv 2020-04-21 42
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 43 /**
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 44 * ne_submit_request - Submit command request to the PCI device based on the
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 45 * command type.
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 46 *
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 47 * This function gets called with the ne_pci_dev mutex held.
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 48 *
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 49 * @pdev: PCI device to send the command to.
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 50 * @cmd_type: command type of the request sent to the PCI device.
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 51 * @cmd_request: command request payload.
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 52 * @cmd_request_size: size of the command request payload.
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 53 *
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 54 * @returns: 0 on success, negative return value on failure.
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 55 */
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 56 static int ne_submit_request(struct pci_dev *pdev,
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 57 enum ne_pci_dev_cmd_type cmd_type,
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 58 void *cmd_request, size_t cmd_request_size)
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 59 {
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 60 struct ne_pci_dev *ne_pci_dev = NULL;
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 61
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 62 BUG_ON(!pdev);
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 63
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 64 ne_pci_dev = pci_get_drvdata(pdev);
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 65 BUG_ON(!ne_pci_dev);
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 66 BUG_ON(!ne_pci_dev->iomem_base);
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 67
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 68 if (WARN_ON(cmd_type <= INVALID_CMD || cmd_type >= MAX_CMD)) {
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 69 dev_err_ratelimited(&pdev->dev, "Invalid cmd type=%d\n",
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 70 cmd_type);
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 71
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 72 return -EINVAL;
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 73 }
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 74
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 75 if (WARN_ON(!cmd_request))
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 76 return -EINVAL;
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 77
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 78 if (WARN_ON(cmd_request_size > NE_SEND_DATA_SIZE)) {
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 @79 dev_err_ratelimited(&pdev->dev,
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 @80 "Invalid req size=%ld for cmd type=%d\n",
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 81 cmd_request_size, cmd_type);
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 82
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 83 return -EINVAL;
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 84 }
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 85
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 86 memcpy_toio(ne_pci_dev->iomem_base + NE_SEND_DATA, cmd_request,
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 87 cmd_request_size);
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 88
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 89 iowrite32(cmd_type, ne_pci_dev->iomem_base + NE_COMMAND);
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 90
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 91 return 0;
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 92 }
> 08a5a524ab0b6c Andra Paraschiv 2020-04-21 93
>
> :::::: The code at line 80 was first introduced by commit
> :::::: 08a5a524ab0b6c939997c8d44b4d07e5ee97e91d nitro_enclaves: Handle PCI device command requests
>
> :::::: TO: Andra Paraschiv <andraprs@amazon.com>
> :::::: CC: 0day robot <lkp@intel.com>
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org