Re: [PATCH v2 2/4] fw_cfg: do DMA read operation

From: kbuild test robot
Date: Fri Sep 22 2017 - 07:26:05 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-x000-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 >>):

drivers//firmware/qemu_fw_cfg.c: In function 'fw_cfg_dma_transfer':
>> drivers//firmware/qemu_fw_cfg.c:139:18: warning: right shift count >= width of type [-Wshift-count-overflow]
iowrite32be(dma >> 32, fw_cfg_reg_dma);
^~
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: At top level:
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:421:2: note: in expansion of macro 'if'
if (p_size == (size_t)-1 && q_size == (size_t)-1)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:411:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:409:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:400:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:398:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:389:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:387:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:379:2: note: in expansion of macro 'if'
if (p_size < size || q_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:376:3: note: in expansion of macro 'if'
if (q_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:374:3: note: in expansion of macro 'if'
if (p_size < size)

vim +139 drivers//firmware/qemu_fw_cfg.c

102
103 static ssize_t fw_cfg_dma_transfer(void *address, u32 length, u32 control)
104 {
105 dma_addr_t dma_addr = 0;
106 struct fw_cfg_dma *d;
107 dma_addr_t dma;
108 ssize_t ret = length;
109 enum dma_data_direction dir =
110 (control & FW_CFG_DMA_CTL_READ ? DMA_FROM_DEVICE : 0);
111
112 if (address && length) {
113 dma_addr = dma_map_single(dev, address, length, dir);
114 if (dma_mapping_error(NULL, dma_addr)) {
115 WARN(1, "%s: failed to map address\n", __func__);
116 return -EFAULT;
117 }
118 }
119
120 d = kmalloc(sizeof(*d), GFP_KERNEL | GFP_DMA);
121 if (!d) {
122 ret = -ENOMEM;
123 goto end;
124 }
125
126 dma = dma_map_single(dev, d, sizeof(*d), DMA_BIDIRECTIONAL);
127 if (dma_mapping_error(NULL, dma)) {
128 WARN(1, "%s: failed to map fw_cfg_dma\n", __func__);
129 ret = -EFAULT;
130 goto end;
131 }
132
133 *d = (struct fw_cfg_dma) {
134 .address = cpu_to_be64(dma_addr),
135 .length = cpu_to_be32(length),
136 .control = cpu_to_be32(control)
137 };
138
> 139 iowrite32be(dma >> 32, fw_cfg_reg_dma);
140 iowrite32be(dma, fw_cfg_reg_dma + 4);
141 while (be32_to_cpu(d->control) & ~FW_CFG_DMA_CTL_ERROR)
142 yield(); /* FIXME: wait_event? */
143
144 if (be32_to_cpu(d->control) & FW_CFG_DMA_CTL_ERROR)
145 ret = -EIO;
146
147 dma_unmap_single(dev, dma, sizeof(*d), DMA_BIDIRECTIONAL);
148
149 end:
150 kfree(d);
151 if (dma_addr)
152 dma_unmap_single(dev, dma_addr, length, dir);
153
154 return ret;
155 }
156

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

Attachment: .config.gz
Description: application/gzip