* Re: [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver
[not found] <20200420162809.17529-7-scott.branden@broadcom.com>
@ 2020-04-22 11:17 ` kbuild test robot
2020-04-22 11:35 ` Dan Carpenter
2020-05-05 23:58 ` Scott Branden
2020-04-22 17:03 ` kbuild test robot
2020-04-22 17:19 ` kbuild test robot
2 siblings, 2 replies; 8+ messages in thread
From: kbuild test robot @ 2020-04-22 11:17 UTC (permalink / raw)
To: Scott Branden, Luis Chamberlain, Greg Kroah-Hartman, David Brown,
Alexander Viro, Shuah Khan, bjorn.andersson, Arnd Bergmann
Cc: kbuild-all, Rafael J . Wysocki, linux-kernel, linux-arm-msm,
linux-fsdevel, BCM Kernel Feedback, Olof Johansson,
Andrew Morton, Linux Memory Management List, Dan Carpenter
Hi Scott,
I love your patch! Perhaps something to improve:
[auto build test WARNING on driver-core/driver-core-testing]
[also build test WARNING on next-20200421]
[cannot apply to char-misc/char-misc-testing kselftest/next linus/master v5.7-rc2]
[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/Scott-Branden/firmware-add-partial-read-support-in-request_firmware_into_buf/20200422-114528
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 55623260bb33e2ab849af76edf2253bc04cb241f
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-191-gc51a0382-dirty
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/misc/bcm-vk/bcm_vk_dev.c:189:15: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bcm_vk_peer_log *p_ctl @@ got struct bcm_vk_peer_log *p_ctl @@
>> drivers/misc/bcm-vk/bcm_vk_dev.c:189:15: sparse: expected struct bcm_vk_peer_log *p_ctl
>> drivers/misc/bcm-vk/bcm_vk_dev.c:189:15: sparse: got void [noderef] <asn:2> *
>> drivers/misc/bcm-vk/bcm_vk_dev.c:685:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] <asn:1> *from @@ got oderef] <asn:1> *from @@
>> drivers/misc/bcm-vk/bcm_vk_dev.c:685:36: sparse: expected void const [noderef] <asn:1> *from
>> drivers/misc/bcm-vk/bcm_vk_dev.c:685:36: sparse: got struct vk_image *arg
drivers/misc/bcm-vk/bcm_vk_dev.c:780:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] <asn:1> *from @@ got oderef] <asn:1> *from @@
drivers/misc/bcm-vk/bcm_vk_dev.c:780:36: sparse: expected void const [noderef] <asn:1> *from
>> drivers/misc/bcm-vk/bcm_vk_dev.c:780:36: sparse: got struct vk_reset *arg
>> drivers/misc/bcm-vk/bcm_vk_dev.c:858:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct vk_image *arg @@ got void [nstruct vk_image *arg @@
>> drivers/misc/bcm-vk/bcm_vk_dev.c:858:45: sparse: expected struct vk_image *arg
>> drivers/misc/bcm-vk/bcm_vk_dev.c:858:45: sparse: got void [noderef] <asn:1> *argp
>> drivers/misc/bcm-vk/bcm_vk_dev.c:862:40: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct vk_reset *arg @@ got void [nstruct vk_reset *arg @@
>> drivers/misc/bcm-vk/bcm_vk_dev.c:862:40: sparse: expected struct vk_reset *arg
drivers/misc/bcm-vk/bcm_vk_dev.c:862:40: sparse: got void [noderef] <asn:1> *argp
--
>> drivers/misc/bcm-vk/bcm_vk_msg.c:507:17: sparse: sparse: cast removes address space '<asn:2>' of expression
drivers/misc/bcm-vk/bcm_vk_msg.c:707:15: sparse: sparse: cast removes address space '<asn:2>' of expression
drivers/misc/bcm-vk/bcm_vk_msg.c:715:23: sparse: sparse: cast removes address space '<asn:2>' of expression
drivers/misc/bcm-vk/bcm_vk_msg.c:871:31: sparse: sparse: cast removes address space '<asn:2>' of expression
drivers/misc/bcm-vk/bcm_vk_msg.c:899:47: sparse: sparse: cast removes address space '<asn:2>' of expression
vim +189 drivers/misc/bcm-vk/bcm_vk_dev.c
180
181 static void bcm_vk_dump_peer_log(struct bcm_vk *vk)
182 {
183 struct bcm_vk_peer_log log, *p_ctl;
184 char loc_buf[BCM_VK_PEER_LOG_LINE_MAX];
185 int cnt;
186 struct device *dev = &vk->pdev->dev;
187 uint data_offset;
188
> 189 p_ctl = vk->bar[BAR_2] + vk->peerlog_off;
190 log = *p_ctl;
191 /* do a rmb() to make sure log is updated */
192 rmb();
193
194 dev_dbg(dev, "Peer PANIC: Size 0x%x(0x%x), [Rd Wr] = [%d %d]\n",
195 log.buf_size, log.mask, log.rd_idx, log.wr_idx);
196
197 cnt = 0;
198 data_offset = vk->peerlog_off + sizeof(struct bcm_vk_peer_log);
199 while (log.rd_idx != log.wr_idx) {
200 loc_buf[cnt] = vkread8(vk, BAR_2, data_offset + log.rd_idx);
201
202 if ((loc_buf[cnt] == '\0') ||
203 (cnt == (BCM_VK_PEER_LOG_LINE_MAX - 1))) {
204 dev_err(dev, "%s", loc_buf);
205 cnt = 0;
206 } else {
207 cnt++;
208 }
209 log.rd_idx = (log.rd_idx + 1) & log.mask;
210 }
211 /* update rd idx at the end */
212 vkwrite32(vk, log.rd_idx, BAR_2, vk->peerlog_off);
213 }
214
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver
2020-04-22 11:17 ` [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver kbuild test robot
@ 2020-04-22 11:35 ` Dan Carpenter
2020-04-22 14:59 ` Christoph Hellwig
2020-04-22 16:13 ` Scott Branden
2020-05-05 23:58 ` Scott Branden
1 sibling, 2 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-04-22 11:35 UTC (permalink / raw)
To: kbuild test robot
Cc: Scott Branden, Luis Chamberlain, Greg Kroah-Hartman, David Brown,
Alexander Viro, Shuah Khan, bjorn.andersson, Arnd Bergmann,
kbuild-all, Rafael J . Wysocki, linux-kernel, linux-arm-msm,
linux-fsdevel, BCM Kernel Feedback, Olof Johansson,
Andrew Morton, Linux Memory Management List, Dan Carpenter
On Wed, Apr 22, 2020 at 07:17:34PM +0800, kbuild test robot wrote:
> Hi Scott,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on driver-core/driver-core-testing]
> [also build test WARNING on next-20200421]
> [cannot apply to char-misc/char-misc-testing kselftest/next linus/master v5.7-rc2]
> [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/Scott-Branden/firmware-add-partial-read-support-in-request_firmware_into_buf/20200422-114528
> base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 55623260bb33e2ab849af76edf2253bc04cb241f
> reproduce:
> # apt-get install sparse
> # sparse version: v0.6.1-191-gc51a0382-dirty
> make ARCH=x86_64 allmodconfig
> make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
^^^^^^^^^^^^^^^^^^^
Sorry, you asked me about this earlier. You will need to add
-D__CHECK_ENDIAN__ to enable these Sparse warnings.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver
2020-04-22 11:35 ` Dan Carpenter
@ 2020-04-22 14:59 ` Christoph Hellwig
2020-04-22 16:13 ` Scott Branden
1 sibling, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2020-04-22 14:59 UTC (permalink / raw)
To: Dan Carpenter
Cc: kbuild test robot, Scott Branden, Luis Chamberlain,
Greg Kroah-Hartman, David Brown, Alexander Viro, Shuah Khan,
bjorn.andersson, Arnd Bergmann, kbuild-all, Rafael J . Wysocki,
linux-kernel, linux-arm-msm, linux-fsdevel, BCM Kernel Feedback,
Olof Johansson, Andrew Morton, Linux Memory Management List,
Dan Carpenter
On Wed, Apr 22, 2020 at 02:35:58PM +0300, Dan Carpenter wrote:
> Sorry, you asked me about this earlier. You will need to add
> -D__CHECK_ENDIAN__ to enable these Sparse warnings.
Endian checking has been enabled by default for quite a while.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver
2020-04-22 11:35 ` Dan Carpenter
2020-04-22 14:59 ` Christoph Hellwig
@ 2020-04-22 16:13 ` Scott Branden
2020-04-22 22:01 ` Scott Branden
1 sibling, 1 reply; 8+ messages in thread
From: Scott Branden @ 2020-04-22 16:13 UTC (permalink / raw)
To: Dan Carpenter, kbuild test robot
Cc: Luis Chamberlain, Greg Kroah-Hartman, David Brown,
Alexander Viro, Shuah Khan, bjorn.andersson, Arnd Bergmann,
kbuild-all, Rafael J . Wysocki, linux-kernel, linux-arm-msm,
linux-fsdevel, BCM Kernel Feedback, Olof Johansson,
Andrew Morton, Linux Memory Management List, Dan Carpenter
On 2020-04-22 4:35 a.m., Dan Carpenter wrote:
> On Wed, Apr 22, 2020 at 07:17:34PM +0800, kbuild test robot wrote:
>> Hi Scott,
>>
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on driver-core/driver-core-testing]
>> [also build test WARNING on next-20200421]
>> [cannot apply to char-misc/char-misc-testing kselftest/next linus/master v5.7-rc2]
>> [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/Scott-Branden/firmware-add-partial-read-support-in-request_firmware_into_buf/20200422-114528
>> base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 55623260bb33e2ab849af76edf2253bc04cb241f
>> reproduce:
>> # apt-get install sparse
>> # sparse version: v0.6.1-191-gc51a0382-dirty
>> make ARCH=x86_64 allmodconfig
>> make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> ^^^^^^^^^^^^^^^^^^^
>
> Sorry, you asked me about this earlier. You will need to add
> -D__CHECK_ENDIAN__ to enable these Sparse warnings.
This is strange. I ran the sparse build and thought I had fixed all the
issues.
I'll have to try again.
One other question with the sparse build. I get many of the messages
printed but the build seems to go to the end (even without my patches
applied):
./arch/x86/include/asm/paravirt.h:333:9: error: got __inline
./arch/x86/include/asm/paravirt.h:338:9: error: Expected ( after asm
./arch/x86/include/asm/paravirt.h:338:9: error: got __inline
./arch/x86/include/asm/paravirt.h:343:9: error: Expected ( after asm
./arch/x86/include/asm/paravirt.h:343:9: error: got __inline
./arch/x86/include/asm/paravirt.h:348:9: error: Expected ( after asm
./arch/x86/include/asm/paravirt.h:348:9: error: too many errors
Any way to suppress or I am doing something wrong? I just run the 2
make commands:
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> regards,
> dan carpenter
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver
[not found] <20200420162809.17529-7-scott.branden@broadcom.com>
2020-04-22 11:17 ` [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver kbuild test robot
@ 2020-04-22 17:03 ` kbuild test robot
2020-04-22 17:19 ` kbuild test robot
2 siblings, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2020-04-22 17:03 UTC (permalink / raw)
To: Scott Branden, Luis Chamberlain, Greg Kroah-Hartman, David Brown,
Alexander Viro, Shuah Khan, bjorn.andersson, Arnd Bergmann
Cc: kbuild-all, Rafael J . Wysocki, linux-kernel, linux-arm-msm,
linux-fsdevel, BCM Kernel Feedback, Olof Johansson,
Andrew Morton, Linux Memory Management List, Dan Carpenter
[-- Attachment #1: Type: text/plain, Size: 14791 bytes --]
Hi Scott,
I love your patch! Perhaps something to improve:
[auto build test WARNING on driver-core/driver-core-testing]
[also build test WARNING on next-20200421]
[cannot apply to char-misc/char-misc-testing kselftest/next linus/master v5.7-rc2]
[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/Scott-Branden/firmware-add-partial-read-support-in-request_firmware_into_buf/20200422-114528
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 55623260bb33e2ab849af76edf2253bc04cb241f
config: arc-allyesconfig (attached as .config)
compiler: arc-elf-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arc
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/printk.h:326,
from include/linux/kernel.h:15,
from include/linux/delay.h:22,
from drivers/misc/bcm-vk/bcm_vk_msg.c:6:
drivers/misc/bcm-vk/bcm_vk_msg.c: In function 'bcm_vk_read':
>> drivers/misc/bcm-vk/bcm_vk_msg.c:1096:15: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
1096 | dev_dbg(dev, "Buf count %ld\n", count);
| ^~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
157 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:114:2: note: in expansion of macro 'dynamic_dev_dbg'
114 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:114:23: note: in expansion of macro 'dev_fmt'
114 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
>> drivers/misc/bcm-vk/bcm_vk_msg.c:1096:2: note: in expansion of macro 'dev_dbg'
1096 | dev_dbg(dev, "Buf count %ld\n", count);
| ^~~~~~~
drivers/misc/bcm-vk/bcm_vk_msg.c:1096:28: note: format string is defined here
1096 | dev_dbg(dev, "Buf count %ld\n", count);
| ~~^
| |
| long int
| %d
In file included from include/linux/printk.h:326,
from include/linux/kernel.h:15,
from include/linux/delay.h:22,
from drivers/misc/bcm-vk/bcm_vk_msg.c:6:
drivers/misc/bcm-vk/bcm_vk_msg.c: In function 'bcm_vk_write':
drivers/misc/bcm-vk/bcm_vk_msg.c:1168:15: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
1168 | dev_dbg(dev, "Msg count %ld\n", count);
| ^~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
157 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:114:2: note: in expansion of macro 'dynamic_dev_dbg'
114 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:114:23: note: in expansion of macro 'dev_fmt'
114 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/misc/bcm-vk/bcm_vk_msg.c:1168:2: note: in expansion of macro 'dev_dbg'
1168 | dev_dbg(dev, "Msg count %ld\n", count);
| ^~~~~~~
drivers/misc/bcm-vk/bcm_vk_msg.c:1168:28: note: format string is defined here
1168 | dev_dbg(dev, "Msg count %ld\n", count);
| ~~^
| |
| long int
| %d
In file included from include/linux/device.h:15,
from include/linux/pci.h:37,
from drivers/misc/bcm-vk/bcm_vk.h:11,
from drivers/misc/bcm-vk/bcm_vk_msg.c:15:
drivers/misc/bcm-vk/bcm_vk_msg.c:1172:16: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
>> drivers/misc/bcm-vk/bcm_vk_msg.c:1172:3: note: in expansion of macro 'dev_err'
1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n",
| ^~~~~~~
drivers/misc/bcm-vk/bcm_vk_msg.c:1172:37: note: format string is defined here
1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n",
| ~~^
| |
| long int
| %d
In file included from include/linux/device.h:15,
from include/linux/pci.h:37,
from drivers/misc/bcm-vk/bcm_vk.h:11,
from drivers/misc/bcm-vk/bcm_vk_msg.c:15:
>> drivers/misc/bcm-vk/bcm_vk_msg.c:1172:16: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]
1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
>> drivers/misc/bcm-vk/bcm_vk_msg.c:1172:3: note: in expansion of macro 'dev_err'
1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n",
| ^~~~~~~
drivers/misc/bcm-vk/bcm_vk_msg.c:1172:57: note: format string is defined here
1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n",
| ~~^
| |
| long int
| %d
vim +1096 drivers/misc/bcm-vk/bcm_vk_msg.c
1076
1077 ssize_t bcm_vk_read(struct file *p_file,
1078 char __user *buf,
1079 size_t count,
1080 loff_t *f_pos)
1081 {
1082 ssize_t rc = -ENOMSG;
1083 struct bcm_vk_ctx *ctx = p_file->private_data;
1084 struct bcm_vk *vk = container_of(ctx->miscdev, struct bcm_vk,
1085 miscdev);
1086 struct device *dev = &vk->pdev->dev;
1087 struct bcm_vk_msg_chan *chan = &vk->to_h_msg_chan;
1088 struct bcm_vk_wkent *entry = NULL;
1089 uint32_t q_num;
1090 uint32_t rsp_length;
1091 bool found = false;
1092
1093 if (!bcm_vk_drv_access_ok(vk))
1094 return -EPERM;
1095
> 1096 dev_dbg(dev, "Buf count %ld\n", count);
1097 found = false;
1098
1099 /*
1100 * search through the pendq on the to_h chan, and return only those
1101 * that belongs to the same context. Search is always from the high to
1102 * the low priority queues
1103 */
1104 spin_lock(&chan->pendq_lock);
1105 for (q_num = 0; q_num < chan->q_nr; q_num++) {
1106 list_for_each_entry(entry, &chan->pendq[q_num], node) {
1107 if (entry->ctx->idx == ctx->idx) {
1108 if (count >=
1109 (entry->to_h_blks * VK_MSGQ_BLK_SIZE)) {
1110 list_del(&entry->node);
1111 ctx->pend_cnt--;
1112 found = true;
1113 } else {
1114 /* buffer not big enough */
1115 rc = -EMSGSIZE;
1116 }
1117 goto read_loop_exit;
1118 }
1119 }
1120 }
1121 read_loop_exit:
1122 spin_unlock(&chan->pendq_lock);
1123
1124 if (found) {
1125 /* retrieve the passed down msg_id */
1126 BCM_VK_SET_MSG_ID(&entry->to_h_msg[0], entry->usr_msg_id);
1127 rsp_length = entry->to_h_blks * VK_MSGQ_BLK_SIZE;
1128 if (copy_to_user(buf, entry->to_h_msg, rsp_length) == 0)
1129 rc = rsp_length;
1130
1131 bcm_vk_free_wkent(dev, entry);
1132 } else if (rc == -EMSGSIZE) {
1133 struct vk_msg_blk tmp_msg = entry->to_h_msg[0];
1134
1135 /*
1136 * in this case, return just the first block, so
1137 * that app knows what size it is looking for.
1138 */
1139 BCM_VK_SET_MSG_ID(&tmp_msg, entry->usr_msg_id);
1140 tmp_msg.size = entry->to_h_blks - 1;
1141 if (copy_to_user(buf, &tmp_msg, VK_MSGQ_BLK_SIZE) != 0) {
1142 dev_err(dev, "Error return 1st block in -EMSGSIZE\n");
1143 rc = -EFAULT;
1144 }
1145 }
1146 return rc;
1147 }
1148
1149 ssize_t bcm_vk_write(struct file *p_file,
1150 const char __user *buf,
1151 size_t count,
1152 loff_t *f_pos)
1153 {
1154 ssize_t rc;
1155 struct bcm_vk_ctx *ctx = p_file->private_data;
1156 struct bcm_vk *vk = container_of(ctx->miscdev, struct bcm_vk,
1157 miscdev);
1158 struct bcm_vk_msgq *msgq;
1159 struct device *dev = &vk->pdev->dev;
1160 struct bcm_vk_wkent *entry;
1161 uint32_t sgl_extra_blks;
1162 uint32_t q_num;
1163 uint32_t msg_size;
1164
1165 if (!bcm_vk_drv_access_ok(vk))
1166 return -EPERM;
1167
1168 dev_dbg(dev, "Msg count %ld\n", count);
1169
1170 /* first, do sanity check where count should be multiple of basic blk */
1171 if (count & (VK_MSGQ_BLK_SIZE - 1)) {
> 1172 dev_err(dev, "Failure with size %ld not multiple of %ld\n",
1173 count, VK_MSGQ_BLK_SIZE);
1174 rc = -EINVAL;
1175 goto write_err;
1176 }
1177
1178 /* allocate the work entry + buffer for size count and inband sgl */
1179 entry = kzalloc(sizeof(*entry) + count + vk->ib_sgl_size,
1180 GFP_KERNEL);
1181 if (!entry) {
1182 rc = -ENOMEM;
1183 goto write_err;
1184 }
1185
1186 /* now copy msg from user space, and then formulate the work entry */
1187 if (copy_from_user(&entry->to_v_msg[0], buf, count)) {
1188 rc = -EFAULT;
1189 goto write_free_ent;
1190 }
1191
1192 entry->to_v_blks = count >> VK_MSGQ_BLK_SZ_SHIFT;
1193 entry->ctx = ctx;
1194
1195 /* do a check on the blk size which could not exceed queue space */
1196 q_num = BCM_VK_GET_Q(&entry->to_v_msg[0]);
1197 msgq = vk->to_v_msg_chan.msgq[q_num];
1198 if (entry->to_v_blks + (vk->ib_sgl_size >> VK_MSGQ_BLK_SZ_SHIFT)
1199 > (msgq->size - 1)) {
1200 dev_err(dev, "Blk size %d exceed max queue size allowed %d\n",
1201 entry->to_v_blks, msgq->size - 1);
1202 rc = -EINVAL;
1203 goto write_free_ent;
1204 }
1205
1206 /* Use internal message id */
1207 entry->usr_msg_id = BCM_VK_GET_MSG_ID(&entry->to_v_msg[0]);
1208 rc = bcm_vk_get_msg_id(vk);
1209 if (rc == VK_MSG_ID_OVERFLOW) {
1210 dev_err(dev, "msg_id overflow\n");
1211 rc = -EOVERFLOW;
1212 goto write_free_ent;
1213 }
1214 BCM_VK_SET_MSG_ID(&entry->to_v_msg[0], rc);
1215
1216 dev_dbg(dev,
1217 "Message ctx id %d, usr_msg_id 0x%x sent msg_id 0x%x\n",
1218 ctx->idx, entry->usr_msg_id,
1219 BCM_VK_GET_MSG_ID(&entry->to_v_msg[0]));
1220
1221 /* Convert any pointers to sg list */
1222 if (entry->to_v_msg[0].function_id == VK_FID_TRANS_BUF) {
1223 unsigned int num_planes;
1224 int dir;
1225 struct _vk_data *data;
1226
1227 /*
1228 * check if we are in reset, if so, no buffer transfer is
1229 * allowed and return error.
1230 */
1231 if (vk->reset_pid) {
1232 dev_dbg(dev, "No Transfer allowed during reset, pid %d.\n",
1233 ctx->pid);
1234 rc = -EACCES;
1235 goto write_free_msgid;
1236 }
1237
1238 num_planes = entry->to_v_msg[0].args[0] & VK_CMD_PLANES_MASK;
1239 if ((entry->to_v_msg[0].args[0] & VK_CMD_MASK)
1240 == VK_CMD_DOWNLOAD) {
1241 dir = DMA_FROM_DEVICE;
1242 } else {
1243 dir = DMA_TO_DEVICE;
1244 }
1245
1246 /* Calculate vk_data location */
1247 /* Go to end of the message */
1248 msg_size = entry->to_v_msg[0].size;
1249 if (msg_size > entry->to_v_blks) {
1250 rc = -EMSGSIZE;
1251 goto write_free_msgid;
1252 }
1253
1254 data = (struct _vk_data *)&entry->to_v_msg[msg_size + 1];
1255
1256 /* Now back up to the start of the pointers */
1257 data -= num_planes;
1258
1259 /* Convert user addresses to DMA SG List */
1260 rc = bcm_vk_sg_alloc(dev, entry->dma, dir, data, num_planes);
1261 if (rc)
1262 goto write_free_msgid;
1263
1264 /* try to embed inband sgl */
1265 sgl_extra_blks = bcm_vk_append_ib_sgl(vk, entry, data,
1266 num_planes);
1267 entry->to_v_blks += sgl_extra_blks;
1268 entry->to_v_msg[0].size += sgl_extra_blks;
1269 }
1270
1271 /*
1272 * store work entry to pending queue until a response is received.
1273 * This needs to be done before enqueuing the message
1274 */
1275 bcm_vk_append_pendq(&vk->to_v_msg_chan, q_num, entry);
1276
1277 rc = bcm_to_v_msg_enqueue(vk, entry);
1278 if (rc) {
1279 dev_err(dev, "Fail to enqueue msg to to_v queue\n");
1280
1281 /* remove message from pending list */
1282 entry = bcm_vk_dequeue_pending
1283 (vk,
1284 &vk->to_v_msg_chan,
1285 q_num,
1286 BCM_VK_GET_MSG_ID(&entry->to_v_msg[0]));
1287 goto write_free_ent;
1288 }
1289
1290 return count;
1291
1292 write_free_msgid:
1293 bcm_vk_msgid_bitmap_clear(vk,
1294 BCM_VK_GET_MSG_ID(&entry->to_v_msg[0]), 1);
1295 write_free_ent:
1296 kfree(entry);
1297 write_err:
1298 return rc;
1299 }
1300
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 63036 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver
[not found] <20200420162809.17529-7-scott.branden@broadcom.com>
2020-04-22 11:17 ` [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver kbuild test robot
2020-04-22 17:03 ` kbuild test robot
@ 2020-04-22 17:19 ` kbuild test robot
2 siblings, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2020-04-22 17:19 UTC (permalink / raw)
To: Scott Branden, Luis Chamberlain, Greg Kroah-Hartman, David Brown,
Alexander Viro, Shuah Khan, bjorn.andersson, Arnd Bergmann
Cc: kbuild-all, Rafael J . Wysocki, linux-kernel, linux-arm-msm,
linux-fsdevel, BCM Kernel Feedback, Olof Johansson,
Andrew Morton, Linux Memory Management List, Dan Carpenter
[-- Attachment #1: Type: text/plain, Size: 2756 bytes --]
Hi Scott,
I love your patch! Perhaps something to improve:
[auto build test WARNING on driver-core/driver-core-testing]
[also build test WARNING on next-20200421]
[cannot apply to char-misc/char-misc-testing kselftest/next linus/master v5.7-rc2]
[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/Scott-Branden/firmware-add-partial-read-support-in-request_firmware_into_buf/20200422-114528
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 55623260bb33e2ab849af76edf2253bc04cb241f
config: i386-allyesconfig (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 >>):
drivers/misc/bcm-vk/bcm_vk_dev.c: In function 'bcm_vk_sync_card_info':
>> drivers/misc/bcm-vk/bcm_vk_dev.c:329:31: warning: right shift count >= width of type [-Wshift-count-overflow]
vkwrite32(vk, vk->tdma_addr >> 32, BAR_1,
^~
drivers/misc/bcm-vk/bcm_vk_dev.c: In function 'bcm_vk_buf_notify':
drivers/misc/bcm-vk/bcm_vk_dev.c:377:30: warning: right shift count >= width of type [-Wshift-count-overflow]
vkwrite32(vk, host_buf_addr >> 32, BAR_1,
^~
vim +329 drivers/misc/bcm-vk/bcm_vk_dev.c
314
315 static int bcm_vk_sync_card_info(struct bcm_vk *vk)
316 {
317 uint32_t rdy_marker = vkread32(vk, BAR_1, VK_BAR1_MSGQ_DEF_RDY);
318
319 /* check for marker, but allow diags mode to skip sync */
320 if (!bcm_vk_msgq_marker_valid(vk))
321 return (rdy_marker == VK_BAR1_DIAG_RDY_MARKER ? 0 : -EINVAL);
322
323 /*
324 * Write down scratch addr which is used for DMA. For
325 * signed part, BAR1 is accessible only after boot2 has come
326 * up
327 */
328 if (vk->tdma_addr) {
> 329 vkwrite32(vk, vk->tdma_addr >> 32, BAR_1,
330 VK_BAR1_SCRATCH_OFF_LO);
331 vkwrite32(vk, (uint32_t)vk->tdma_addr, BAR_1,
332 VK_BAR1_SCRATCH_OFF_HI);
333 vkwrite32(vk, nr_scratch_pages * PAGE_SIZE, BAR_1,
334 VK_BAR1_SCRATCH_SZ_ADDR);
335 }
336
337 /* get static card info, only need to read once */
338 bcm_vk_get_card_info(vk);
339
340 return 0;
341 }
342
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 72288 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver
2020-04-22 16:13 ` Scott Branden
@ 2020-04-22 22:01 ` Scott Branden
0 siblings, 0 replies; 8+ messages in thread
From: Scott Branden @ 2020-04-22 22:01 UTC (permalink / raw)
To: Dan Carpenter, kbuild test robot
Cc: Luis Chamberlain, Greg Kroah-Hartman, David Brown,
Alexander Viro, Shuah Khan, bjorn.andersson, Arnd Bergmann,
kbuild-all, Rafael J . Wysocki, linux-kernel, linux-arm-msm,
linux-fsdevel, BCM Kernel Feedback, Olof Johansson,
Andrew Morton, Linux Memory Management List, Dan Carpenter
On 2020-04-22 9:13 a.m., Scott Branden wrote:
>
>
> On 2020-04-22 4:35 a.m., Dan Carpenter wrote:
>> On Wed, Apr 22, 2020 at 07:17:34PM +0800, kbuild test robot wrote:
>>> Hi Scott,
>>>
>>> I love your patch! Perhaps something to improve:
>>>
>>> [auto build test WARNING on driver-core/driver-core-testing]
>>> [also build test WARNING on next-20200421]
>>> [cannot apply to char-misc/char-misc-testing kselftest/next
>>> linus/master v5.7-rc2]
>>> [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/Scott-Branden/firmware-add-partial-read-support-in-request_firmware_into_buf/20200422-114528
>>> base:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
>>> 55623260bb33e2ab849af76edf2253bc04cb241f
>>> reproduce:
>>> # apt-get install sparse
>>> # sparse version: v0.6.1-191-gc51a0382-dirty
>>> make ARCH=x86_64 allmodconfig
>>> make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
>> ^^^^^^^^^^^^^^^^^^^
>>
>> Sorry, you asked me about this earlier. You will need to add
>> -D__CHECK_ENDIAN__ to enable these Sparse warnings.
> This is strange. I ran the sparse build and thought I had fixed all
> the issues.
> I'll have to try again.
>
> One other question with the sparse build. I get many of the messages
> printed but the build seems to go to the end (even without my patches
> applied):
> ./arch/x86/include/asm/paravirt.h:333:9: error: got __inline
> ./arch/x86/include/asm/paravirt.h:338:9: error: Expected ( after asm
> ./arch/x86/include/asm/paravirt.h:338:9: error: got __inline
> ./arch/x86/include/asm/paravirt.h:343:9: error: Expected ( after asm
> ./arch/x86/include/asm/paravirt.h:343:9: error: got __inline
> ./arch/x86/include/asm/paravirt.h:348:9: error: Expected ( after asm
> ./arch/x86/include/asm/paravirt.h:348:9: error: too many errors
>
> Any way to suppress or I am doing something wrong? I just run the 2
> make commands:
>
> make ARCH=x86_64 allmodconfig
> make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
I figured out the sparse utility on ubuntu 18.04 is out of date causing
the issue.
>
>> regards,
>> dan carpenter
>>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver
2020-04-22 11:17 ` [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver kbuild test robot
2020-04-22 11:35 ` Dan Carpenter
@ 2020-05-05 23:58 ` Scott Branden
1 sibling, 0 replies; 8+ messages in thread
From: Scott Branden @ 2020-05-05 23:58 UTC (permalink / raw)
To: kbuild test robot, Luis Chamberlain, Greg Kroah-Hartman,
David Brown, Alexander Viro, Shuah Khan, bjorn.andersson,
Arnd Bergmann
Cc: kbuild-all, Rafael J . Wysocki, linux-kernel, linux-arm-msm,
linux-fsdevel, BCM Kernel Feedback, Olof Johansson,
Andrew Morton, Linux Memory Management List, Dan Carpenter
All the kbuild and sparse issues should be resolved in PATCH v4.
On 2020-04-22 4:17 a.m., kbuild test robot wrote:
> Hi Scott,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on driver-core/driver-core-testing]
> [also build test WARNING on next-20200421]
> [cannot apply to char-misc/char-misc-testing kselftest/next linus/master v5.7-rc2]
> [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/Scott-Branden/firmware-add-partial-read-support-in-request_firmware_into_buf/20200422-114528
> base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 55623260bb33e2ab849af76edf2253bc04cb241f
> reproduce:
> # apt-get install sparse
> # sparse version: v0.6.1-191-gc51a0382-dirty
> 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/misc/bcm-vk/bcm_vk_dev.c:189:15: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bcm_vk_peer_log *p_ctl @@ got struct bcm_vk_peer_log *p_ctl @@
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:189:15: sparse: expected struct bcm_vk_peer_log *p_ctl
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:189:15: sparse: got void [noderef] <asn:2> *
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:685:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] <asn:1> *from @@ got oderef] <asn:1> *from @@
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:685:36: sparse: expected void const [noderef] <asn:1> *from
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:685:36: sparse: got struct vk_image *arg
> drivers/misc/bcm-vk/bcm_vk_dev.c:780:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] <asn:1> *from @@ got oderef] <asn:1> *from @@
> drivers/misc/bcm-vk/bcm_vk_dev.c:780:36: sparse: expected void const [noderef] <asn:1> *from
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:780:36: sparse: got struct vk_reset *arg
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:858:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct vk_image *arg @@ got void [nstruct vk_image *arg @@
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:858:45: sparse: expected struct vk_image *arg
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:858:45: sparse: got void [noderef] <asn:1> *argp
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:862:40: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct vk_reset *arg @@ got void [nstruct vk_reset *arg @@
>>> drivers/misc/bcm-vk/bcm_vk_dev.c:862:40: sparse: expected struct vk_reset *arg
> drivers/misc/bcm-vk/bcm_vk_dev.c:862:40: sparse: got void [noderef] <asn:1> *argp
> --
>>> drivers/misc/bcm-vk/bcm_vk_msg.c:507:17: sparse: sparse: cast removes address space '<asn:2>' of expression
> drivers/misc/bcm-vk/bcm_vk_msg.c:707:15: sparse: sparse: cast removes address space '<asn:2>' of expression
> drivers/misc/bcm-vk/bcm_vk_msg.c:715:23: sparse: sparse: cast removes address space '<asn:2>' of expression
> drivers/misc/bcm-vk/bcm_vk_msg.c:871:31: sparse: sparse: cast removes address space '<asn:2>' of expression
> drivers/misc/bcm-vk/bcm_vk_msg.c:899:47: sparse: sparse: cast removes address space '<asn:2>' of expression
>
> vim +189 drivers/misc/bcm-vk/bcm_vk_dev.c
>
> 180
> 181 static void bcm_vk_dump_peer_log(struct bcm_vk *vk)
> 182 {
> 183 struct bcm_vk_peer_log log, *p_ctl;
> 184 char loc_buf[BCM_VK_PEER_LOG_LINE_MAX];
> 185 int cnt;
> 186 struct device *dev = &vk->pdev->dev;
> 187 uint data_offset;
> 188
> > 189 p_ctl = vk->bar[BAR_2] + vk->peerlog_off;
> 190 log = *p_ctl;
> 191 /* do a rmb() to make sure log is updated */
> 192 rmb();
> 193
> 194 dev_dbg(dev, "Peer PANIC: Size 0x%x(0x%x), [Rd Wr] = [%d %d]\n",
> 195 log.buf_size, log.mask, log.rd_idx, log.wr_idx);
> 196
> 197 cnt = 0;
> 198 data_offset = vk->peerlog_off + sizeof(struct bcm_vk_peer_log);
> 199 while (log.rd_idx != log.wr_idx) {
> 200 loc_buf[cnt] = vkread8(vk, BAR_2, data_offset + log.rd_idx);
> 201
> 202 if ((loc_buf[cnt] == '\0') ||
> 203 (cnt == (BCM_VK_PEER_LOG_LINE_MAX - 1))) {
> 204 dev_err(dev, "%s", loc_buf);
> 205 cnt = 0;
> 206 } else {
> 207 cnt++;
> 208 }
> 209 log.rd_idx = (log.rd_idx + 1) & log.mask;
> 210 }
> 211 /* update rd idx at the end */
> 212 vkwrite32(vk, log.rd_idx, BAR_2, vk->peerlog_off);
> 213 }
> 214
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-05-05 23:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20200420162809.17529-7-scott.branden@broadcom.com>
2020-04-22 11:17 ` [PATCH v3 6/7] misc: bcm-vk: add Broadcom VK driver kbuild test robot
2020-04-22 11:35 ` Dan Carpenter
2020-04-22 14:59 ` Christoph Hellwig
2020-04-22 16:13 ` Scott Branden
2020-04-22 22:01 ` Scott Branden
2020-05-05 23:58 ` Scott Branden
2020-04-22 17:03 ` kbuild test robot
2020-04-22 17:19 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).