Re: [PATCH v2 1/4] fw_cfg: add DMA register

From: kbuild test robot
Date: Fri Sep 22 2017 - 07:46:11 EST


Hi Marc-André,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.14-rc1 next-20170922]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/marcandre-lureau-redhat-com/fw_cfg-add-DMA-operations-etc-vmcoreinfo-support/20170922-182716
config: i386-randconfig-x075-201738 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from drivers//firmware/qemu_fw_cfg.c:30:
drivers//firmware/qemu_fw_cfg.c: In function 'fw_cfg_cmdline_set':
drivers//firmware/qemu_fw_cfg.c:690:43: error: 'process' undeclared (first use in this function)
(processed != 1 && processed != 3 && process != 4))
^
include/linux/compiler.h:156:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> drivers//firmware/qemu_fw_cfg.c:689:2: note: in expansion of macro 'if'
if (str[consumed] ||
^~
drivers//firmware/qemu_fw_cfg.c:690:43: note: each undeclared identifier is reported only once for each function it appears in
(processed != 1 && processed != 3 && process != 4))
^
include/linux/compiler.h:156:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> drivers//firmware/qemu_fw_cfg.c:689:2: note: in expansion of macro 'if'
if (str[consumed] ||
^~

vim +/if +689 drivers//firmware/qemu_fw_cfg.c

75f3e8e4 Gabriel Somlo 2016-01-28 639
75f3e8e4 Gabriel Somlo 2016-01-28 640 /* use special scanf/printf modifier for phys_addr_t, resource_size_t */
75f3e8e4 Gabriel Somlo 2016-01-28 641 #define PH_ADDR_SCAN_FMT "@%" __PHYS_ADDR_PREFIX "i%n" \
75f3e8e4 Gabriel Somlo 2016-01-28 642 ":%" __PHYS_ADDR_PREFIX "i" \
46ebd6f8 Marc-André Lureau 2017-09-19 643 ":%" __PHYS_ADDR_PREFIX "i%n" \
75f3e8e4 Gabriel Somlo 2016-01-28 644 ":%" __PHYS_ADDR_PREFIX "i%n"
75f3e8e4 Gabriel Somlo 2016-01-28 645
75f3e8e4 Gabriel Somlo 2016-01-28 646 #define PH_ADDR_PR_1_FMT "0x%" __PHYS_ADDR_PREFIX "x@" \
75f3e8e4 Gabriel Somlo 2016-01-28 647 "0x%" __PHYS_ADDR_PREFIX "x"
75f3e8e4 Gabriel Somlo 2016-01-28 648
75f3e8e4 Gabriel Somlo 2016-01-28 649 #define PH_ADDR_PR_3_FMT PH_ADDR_PR_1_FMT \
75f3e8e4 Gabriel Somlo 2016-01-28 650 ":%" __PHYS_ADDR_PREFIX "u" \
75f3e8e4 Gabriel Somlo 2016-01-28 651 ":%" __PHYS_ADDR_PREFIX "u"
75f3e8e4 Gabriel Somlo 2016-01-28 652
46ebd6f8 Marc-André Lureau 2017-09-19 653 #define PH_ADDR_PR_4_FMT PH_ADDR_PR_3_FMT \
46ebd6f8 Marc-André Lureau 2017-09-19 654 ":%" __PHYS_ADDR_PREFIX "u"
46ebd6f8 Marc-André Lureau 2017-09-19 655
75f3e8e4 Gabriel Somlo 2016-01-28 656 static int fw_cfg_cmdline_set(const char *arg, const struct kernel_param *kp)
75f3e8e4 Gabriel Somlo 2016-01-28 657 {
46ebd6f8 Marc-André Lureau 2017-09-19 658 struct resource res[4] = {};
75f3e8e4 Gabriel Somlo 2016-01-28 659 char *str;
75f3e8e4 Gabriel Somlo 2016-01-28 660 phys_addr_t base;
46ebd6f8 Marc-André Lureau 2017-09-19 661 resource_size_t size, ctrl_off, data_off, dma_off;
75f3e8e4 Gabriel Somlo 2016-01-28 662 int processed, consumed = 0;
75f3e8e4 Gabriel Somlo 2016-01-28 663
75f3e8e4 Gabriel Somlo 2016-01-28 664 /* only one fw_cfg device can exist system-wide, so if one
75f3e8e4 Gabriel Somlo 2016-01-28 665 * was processed on the command line already, we might as
75f3e8e4 Gabriel Somlo 2016-01-28 666 * well stop here.
75f3e8e4 Gabriel Somlo 2016-01-28 667 */
75f3e8e4 Gabriel Somlo 2016-01-28 668 if (fw_cfg_cmdline_dev) {
75f3e8e4 Gabriel Somlo 2016-01-28 669 /* avoid leaking previously registered device */
75f3e8e4 Gabriel Somlo 2016-01-28 670 platform_device_unregister(fw_cfg_cmdline_dev);
75f3e8e4 Gabriel Somlo 2016-01-28 671 return -EINVAL;
75f3e8e4 Gabriel Somlo 2016-01-28 672 }
75f3e8e4 Gabriel Somlo 2016-01-28 673
75f3e8e4 Gabriel Somlo 2016-01-28 674 /* consume "<size>" portion of command line argument */
75f3e8e4 Gabriel Somlo 2016-01-28 675 size = memparse(arg, &str);
75f3e8e4 Gabriel Somlo 2016-01-28 676
46ebd6f8 Marc-André Lureau 2017-09-19 677 /* get "@<base>[:<ctrl_off>:<data_off>[:<dma_off>]]" chunks */
75f3e8e4 Gabriel Somlo 2016-01-28 678 processed = sscanf(str, PH_ADDR_SCAN_FMT,
75f3e8e4 Gabriel Somlo 2016-01-28 679 &base, &consumed,
46ebd6f8 Marc-André Lureau 2017-09-19 680 &ctrl_off, &data_off, &consumed,
46ebd6f8 Marc-André Lureau 2017-09-19 681 &dma_off, &consumed);
75f3e8e4 Gabriel Somlo 2016-01-28 682
46ebd6f8 Marc-André Lureau 2017-09-19 683 /* sscanf() must process precisely 1, 3 or 4 chunks:
75f3e8e4 Gabriel Somlo 2016-01-28 684 * <base> is mandatory, optionally followed by <ctrl_off>
46ebd6f8 Marc-André Lureau 2017-09-19 685 * and <data_off>, and <dma_off>;
75f3e8e4 Gabriel Somlo 2016-01-28 686 * there must be no extra characters after the last chunk,
75f3e8e4 Gabriel Somlo 2016-01-28 687 * so str[consumed] must be '\0'.
75f3e8e4 Gabriel Somlo 2016-01-28 688 */
75f3e8e4 Gabriel Somlo 2016-01-28 @689 if (str[consumed] ||
46ebd6f8 Marc-André Lureau 2017-09-19 690 (processed != 1 && processed != 3 && process != 4))
75f3e8e4 Gabriel Somlo 2016-01-28 691 return -EINVAL;
75f3e8e4 Gabriel Somlo 2016-01-28 692
75f3e8e4 Gabriel Somlo 2016-01-28 693 res[0].start = base;
75f3e8e4 Gabriel Somlo 2016-01-28 694 res[0].end = base + size - 1;
75f3e8e4 Gabriel Somlo 2016-01-28 695 res[0].flags = !strcmp(kp->name, "mmio") ? IORESOURCE_MEM :
75f3e8e4 Gabriel Somlo 2016-01-28 696 IORESOURCE_IO;
75f3e8e4 Gabriel Somlo 2016-01-28 697
75f3e8e4 Gabriel Somlo 2016-01-28 698 /* insert register offsets, if provided */
75f3e8e4 Gabriel Somlo 2016-01-28 699 if (processed > 1) {
75f3e8e4 Gabriel Somlo 2016-01-28 700 res[1].name = "ctrl";
75f3e8e4 Gabriel Somlo 2016-01-28 701 res[1].start = ctrl_off;
75f3e8e4 Gabriel Somlo 2016-01-28 702 res[1].flags = IORESOURCE_REG;
75f3e8e4 Gabriel Somlo 2016-01-28 703 res[2].name = "data";
75f3e8e4 Gabriel Somlo 2016-01-28 704 res[2].start = data_off;
75f3e8e4 Gabriel Somlo 2016-01-28 705 res[2].flags = IORESOURCE_REG;
75f3e8e4 Gabriel Somlo 2016-01-28 706 }
46ebd6f8 Marc-André Lureau 2017-09-19 707 if (processed > 3) {
46ebd6f8 Marc-André Lureau 2017-09-19 708 res[3].name = "dma";
46ebd6f8 Marc-André Lureau 2017-09-19 709 res[3].start = dma_off;
46ebd6f8 Marc-André Lureau 2017-09-19 710 res[3].flags = IORESOURCE_REG;
46ebd6f8 Marc-André Lureau 2017-09-19 711 }
75f3e8e4 Gabriel Somlo 2016-01-28 712
75f3e8e4 Gabriel Somlo 2016-01-28 713 /* "processed" happens to nicely match the number of resources
75f3e8e4 Gabriel Somlo 2016-01-28 714 * we need to pass in to this platform device.
75f3e8e4 Gabriel Somlo 2016-01-28 715 */
75f3e8e4 Gabriel Somlo 2016-01-28 716 fw_cfg_cmdline_dev = platform_device_register_simple("fw_cfg",
75f3e8e4 Gabriel Somlo 2016-01-28 717 PLATFORM_DEVID_NONE, res, processed);
75f3e8e4 Gabriel Somlo 2016-01-28 718 if (IS_ERR(fw_cfg_cmdline_dev))
75f3e8e4 Gabriel Somlo 2016-01-28 719 return PTR_ERR(fw_cfg_cmdline_dev);
75f3e8e4 Gabriel Somlo 2016-01-28 720
75f3e8e4 Gabriel Somlo 2016-01-28 721 return 0;
75f3e8e4 Gabriel Somlo 2016-01-28 722 }
75f3e8e4 Gabriel Somlo 2016-01-28 723

:::::: The code at line 689 was first introduced by commit
:::::: 75f3e8e47f381074801d0034874d20c638d9e3d9 firmware: introduce sysfs driver for QEMU's fw_cfg device

:::::: TO: Gabriel Somlo <somlo@xxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip