[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202305171458.bzUep6rL-lkp@intel.com>
Date: Wed, 17 May 2023 14:57:12 +0800
From: kernel test robot <lkp@...el.com>
To: zhenwei pi <pizhenwei@...edance.com>, stefanha@...hat.com,
mst@...hat.com, jasowang@...hat.com
Cc: oe-kbuild-all@...ts.linux.dev, xuanzhuo@...ux.alibaba.com,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org, zhenwei pi <pizhenwei@...edance.com>
Subject: Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods
Hi zhenwei,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mst-vhost/linux-next]
[also build test WARNING on linus/master v6.4-rc2 next-20230517]
[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/zhenwei-pi/virtio-abstract-virtqueue-related-methods/20230517-110311
base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
patch link: https://lore.kernel.org/r/20230517025424.601141-2-pizhenwei%40bytedance.com
patch subject: [PATCH v2 1/2] virtio: abstract virtqueue related methods
config: alpha-randconfig-r003-20230517
compiler: alpha-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/146086b281eebe5c5368c387f96a0395c6252d41
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review zhenwei-pi/virtio-abstract-virtqueue-related-methods/20230517-110311
git checkout 146086b281eebe5c5368c387f96a0395c6252d41
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash drivers/virtio/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305171458.bzUep6rL-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/virtio/virtio_ring.c:2310: warning: expecting prototype for virtqueue_detach_unused_buf(). Prototype was for vring_virtqueue_detach_unused_buf() instead
>> drivers/virtio/virtio_ring.c:2499: warning: expecting prototype for virtqueue_resize(). Prototype was for vring_virtqueue_resize() instead
>> drivers/virtio/virtio_ring.c:2673: warning: expecting prototype for virtqueue_get_vring_size(). Prototype was for vring_virtqueue_get_vring_size() instead
vim +2310 drivers/virtio/virtio_ring.c
e6f633e5beab65 Tiwei Bie 2018-11-21 2300
138fd25148638a Tiwei Bie 2018-11-21 2301 /**
138fd25148638a Tiwei Bie 2018-11-21 2302 * virtqueue_detach_unused_buf - detach first unused buffer
a5581206c565a7 Jiang Biao 2019-04-23 2303 * @_vq: the struct virtqueue we're talking about.
138fd25148638a Tiwei Bie 2018-11-21 2304 *
138fd25148638a Tiwei Bie 2018-11-21 2305 * Returns NULL or the "data" token handed to virtqueue_add_*().
a62eecb3a9c086 Xuan Zhuo 2022-08-01 2306 * This is not valid on an active queue; it is useful for device
a62eecb3a9c086 Xuan Zhuo 2022-08-01 2307 * shutdown or the reset queue.
138fd25148638a Tiwei Bie 2018-11-21 2308 */
146086b281eebe zhenwei pi 2023-05-17 2309 static void *vring_virtqueue_detach_unused_buf(struct virtqueue *_vq)
138fd25148638a Tiwei Bie 2018-11-21 @2310 {
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2311 struct vring_virtqueue *vq = to_vvq(_vq);
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2312
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2313 return vq->packed_ring ? virtqueue_detach_unused_buf_packed(_vq) :
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2314 virtqueue_detach_unused_buf_split(_vq);
138fd25148638a Tiwei Bie 2018-11-21 2315 }
c021eac4148c16 Shirley Ma 2010-01-18 2316
138fd25148638a Tiwei Bie 2018-11-21 2317 static inline bool more_used(const struct vring_virtqueue *vq)
138fd25148638a Tiwei Bie 2018-11-21 2318 {
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2319 return vq->packed_ring ? more_used_packed(vq) : more_used_split(vq);
138fd25148638a Tiwei Bie 2018-11-21 2320 }
138fd25148638a Tiwei Bie 2018-11-21 2321
5c669c4a4c6aa0 Ricardo Cañuelo 2022-08-10 2322 /**
5c669c4a4c6aa0 Ricardo Cañuelo 2022-08-10 2323 * vring_interrupt - notify a virtqueue on an interrupt
5c669c4a4c6aa0 Ricardo Cañuelo 2022-08-10 2324 * @irq: the IRQ number (ignored)
5c669c4a4c6aa0 Ricardo Cañuelo 2022-08-10 2325 * @_vq: the struct virtqueue to notify
5c669c4a4c6aa0 Ricardo Cañuelo 2022-08-10 2326 *
5c669c4a4c6aa0 Ricardo Cañuelo 2022-08-10 2327 * Calls the callback function of @_vq to process the virtqueue
5c669c4a4c6aa0 Ricardo Cañuelo 2022-08-10 2328 * notification.
5c669c4a4c6aa0 Ricardo Cañuelo 2022-08-10 2329 */
0a8a69dd77ddbd Rusty Russell 2007-10-22 2330 irqreturn_t vring_interrupt(int irq, void *_vq)
0a8a69dd77ddbd Rusty Russell 2007-10-22 2331 {
0a8a69dd77ddbd Rusty Russell 2007-10-22 2332 struct vring_virtqueue *vq = to_vvq(_vq);
0a8a69dd77ddbd Rusty Russell 2007-10-22 2333
0a8a69dd77ddbd Rusty Russell 2007-10-22 2334 if (!more_used(vq)) {
0a8a69dd77ddbd Rusty Russell 2007-10-22 2335 pr_debug("virtqueue interrupt with no work for %p\n", vq);
0a8a69dd77ddbd Rusty Russell 2007-10-22 2336 return IRQ_NONE;
0a8a69dd77ddbd Rusty Russell 2007-10-22 2337 }
0a8a69dd77ddbd Rusty Russell 2007-10-22 2338
8b4ec69d7e098a Jason Wang 2022-05-27 2339 if (unlikely(vq->broken)) {
c346dae4f3fbce Jason Wang 2022-06-22 2340 #ifdef CONFIG_VIRTIO_HARDEN_NOTIFICATION
8b4ec69d7e098a Jason Wang 2022-05-27 2341 dev_warn_once(&vq->vq.vdev->dev,
8b4ec69d7e098a Jason Wang 2022-05-27 2342 "virtio vring IRQ raised before DRIVER_OK");
8b4ec69d7e098a Jason Wang 2022-05-27 2343 return IRQ_NONE;
c346dae4f3fbce Jason Wang 2022-06-22 2344 #else
c346dae4f3fbce Jason Wang 2022-06-22 2345 return IRQ_HANDLED;
c346dae4f3fbce Jason Wang 2022-06-22 2346 #endif
8b4ec69d7e098a Jason Wang 2022-05-27 2347 }
0a8a69dd77ddbd Rusty Russell 2007-10-22 2348
8d622d21d24803 Michael S. Tsirkin 2021-04-13 2349 /* Just a hint for performance: so it's ok that this can be racy! */
8d622d21d24803 Michael S. Tsirkin 2021-04-13 2350 if (vq->event)
8d622d21d24803 Michael S. Tsirkin 2021-04-13 2351 vq->event_triggered = true;
8d622d21d24803 Michael S. Tsirkin 2021-04-13 2352
0a8a69dd77ddbd Rusty Russell 2007-10-22 2353 pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback);
18445c4d501b9a Rusty Russell 2008-02-04 2354 if (vq->vq.callback)
18445c4d501b9a Rusty Russell 2008-02-04 2355 vq->vq.callback(&vq->vq);
0a8a69dd77ddbd Rusty Russell 2007-10-22 2356
0a8a69dd77ddbd Rusty Russell 2007-10-22 2357 return IRQ_HANDLED;
0a8a69dd77ddbd Rusty Russell 2007-10-22 2358 }
c6fd47011b4bde Rusty Russell 2008-02-04 2359 EXPORT_SYMBOL_GPL(vring_interrupt);
0a8a69dd77ddbd Rusty Russell 2007-10-22 2360
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2361 /* Only available for split ring */
07d9629d49584b Xuan Zhuo 2022-08-01 2362 static struct virtqueue *__vring_new_virtqueue(unsigned int index,
cd4c812acb8390 Xuan Zhuo 2022-08-01 2363 struct vring_virtqueue_split *vring_split,
0a8a69dd77ddbd Rusty Russell 2007-10-22 2364 struct virtio_device *vdev,
7b21e34fd1c272 Rusty Russell 2012-01-12 2365 bool weak_barriers,
f94682dde5ed23 Michael S. Tsirkin 2017-03-06 2366 bool context,
46f9c2b925ac12 Heinz Graalfs 2013-10-29 2367 bool (*notify)(struct virtqueue *),
9499f5e7ed5224 Rusty Russell 2009-06-12 2368 void (*callback)(struct virtqueue *),
2713ea3c7d930a Jason Wang 2023-01-19 2369 const char *name,
2713ea3c7d930a Jason Wang 2023-01-19 2370 struct device *dma_dev)
0a8a69dd77ddbd Rusty Russell 2007-10-22 2371 {
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2372 struct vring_virtqueue *vq;
a2b36c8d7ddbaf Xuan Zhuo 2022-08-01 2373 int err;
0a8a69dd77ddbd Rusty Russell 2007-10-22 2374
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2375 if (virtio_has_feature(vdev, VIRTIO_F_RING_PACKED))
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2376 return NULL;
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2377
cbeedb72b97ad8 Tiwei Bie 2018-11-21 2378 vq = kmalloc(sizeof(*vq), GFP_KERNEL);
0a8a69dd77ddbd Rusty Russell 2007-10-22 2379 if (!vq)
0a8a69dd77ddbd Rusty Russell 2007-10-22 2380 return NULL;
0a8a69dd77ddbd Rusty Russell 2007-10-22 2381
146086b281eebe zhenwei pi 2023-05-17 2382 vring_virtqueue_set_ops(&vq->vq);
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2383 vq->packed_ring = false;
0a8a69dd77ddbd Rusty Russell 2007-10-22 2384 vq->vq.callback = callback;
0a8a69dd77ddbd Rusty Russell 2007-10-22 2385 vq->vq.vdev = vdev;
9499f5e7ed5224 Rusty Russell 2009-06-12 2386 vq->vq.name = name;
06ca287dbac9cc Rusty Russell 2012-10-16 2387 vq->vq.index = index;
4913e85441b403 Xuan Zhuo 2022-08-01 2388 vq->vq.reset = false;
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2389 vq->we_own_ring = false;
0a8a69dd77ddbd Rusty Russell 2007-10-22 2390 vq->notify = notify;
7b21e34fd1c272 Rusty Russell 2012-01-12 2391 vq->weak_barriers = weak_barriers;
c346dae4f3fbce Jason Wang 2022-06-22 2392 #ifdef CONFIG_VIRTIO_HARDEN_NOTIFICATION
8b4ec69d7e098a Jason Wang 2022-05-27 2393 vq->broken = true;
c346dae4f3fbce Jason Wang 2022-06-22 2394 #else
c346dae4f3fbce Jason Wang 2022-06-22 2395 vq->broken = false;
c346dae4f3fbce Jason Wang 2022-06-22 2396 #endif
2713ea3c7d930a Jason Wang 2023-01-19 2397 vq->dma_dev = dma_dev;
fb3fba6b162aaa Tiwei Bie 2018-11-21 2398 vq->use_dma_api = vring_use_dma_api(vdev);
0a8a69dd77ddbd Rusty Russell 2007-10-22 2399
5a08b04f637921 Michael S. Tsirkin 2017-02-07 2400 vq->indirect = virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC) &&
5a08b04f637921 Michael S. Tsirkin 2017-02-07 2401 !context;
a5c262c5fd83ec Michael S. Tsirkin 2011-05-20 2402 vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX);
9fa29b9df32ba4 Mark McLoughlin 2009-05-11 2403
45383fb0f42db3 Tiwei Bie 2019-01-23 2404 if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM))
45383fb0f42db3 Tiwei Bie 2019-01-23 2405 vq->weak_barriers = false;
45383fb0f42db3 Tiwei Bie 2019-01-23 2406
a2b36c8d7ddbaf Xuan Zhuo 2022-08-01 2407 err = vring_alloc_state_extra_split(vring_split);
a2b36c8d7ddbaf Xuan Zhuo 2022-08-01 2408 if (err) {
a2b36c8d7ddbaf Xuan Zhuo 2022-08-01 2409 kfree(vq);
a2b36c8d7ddbaf Xuan Zhuo 2022-08-01 2410 return NULL;
a2b36c8d7ddbaf Xuan Zhuo 2022-08-01 2411 }
72b5e8958738aa Jason Wang 2021-06-04 2412
198fa7be96e52b Xuan Zhuo 2022-08-01 2413 virtqueue_vring_init_split(vring_split, vq);
198fa7be96e52b Xuan Zhuo 2022-08-01 2414
cd4c812acb8390 Xuan Zhuo 2022-08-01 2415 virtqueue_init(vq, vring_split->vring.num);
e1d6a423ea1867 Xuan Zhuo 2022-08-01 2416 virtqueue_vring_attach_split(vq, vring_split);
3a897128d31934 Xuan Zhuo 2022-08-01 2417
0e566c8f0f2e83 Parav Pandit 2021-07-21 2418 spin_lock(&vdev->vqs_list_lock);
e152d8af4220a0 Dan Carpenter 2020-12-04 2419 list_add_tail(&vq->vq.list, &vdev->vqs);
0e566c8f0f2e83 Parav Pandit 2021-07-21 2420 spin_unlock(&vdev->vqs_list_lock);
0a8a69dd77ddbd Rusty Russell 2007-10-22 2421 return &vq->vq;
0a8a69dd77ddbd Rusty Russell 2007-10-22 2422 }
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2423
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2424 struct virtqueue *vring_create_virtqueue(
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2425 unsigned int index,
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2426 unsigned int num,
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2427 unsigned int vring_align,
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2428 struct virtio_device *vdev,
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2429 bool weak_barriers,
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2430 bool may_reduce_num,
f94682dde5ed23 Michael S. Tsirkin 2017-03-06 2431 bool context,
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2432 bool (*notify)(struct virtqueue *),
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2433 void (*callback)(struct virtqueue *),
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2434 const char *name)
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2435 {
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2436
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2437 if (virtio_has_feature(vdev, VIRTIO_F_RING_PACKED))
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2438 return vring_create_virtqueue_packed(index, num, vring_align,
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2439 vdev, weak_barriers, may_reduce_num,
2713ea3c7d930a Jason Wang 2023-01-19 2440 context, notify, callback, name, vdev->dev.parent);
1ce9e6055fa0a9 Tiwei Bie 2018-11-21 2441
d79dca75c79680 Tiwei Bie 2018-11-21 2442 return vring_create_virtqueue_split(index, num, vring_align,
d79dca75c79680 Tiwei Bie 2018-11-21 2443 vdev, weak_barriers, may_reduce_num,
2713ea3c7d930a Jason Wang 2023-01-19 2444 context, notify, callback, name, vdev->dev.parent);
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2445 }
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2446 EXPORT_SYMBOL_GPL(vring_create_virtqueue);
2a2d1382fe9dcc Andy Lutomirski 2016-02-02 2447
2713ea3c7d930a Jason Wang 2023-01-19 2448 struct virtqueue *vring_create_virtqueue_dma(
2713ea3c7d930a Jason Wang 2023-01-19 2449 unsigned int index,
2713ea3c7d930a Jason Wang 2023-01-19 2450 unsigned int num,
2713ea3c7d930a Jason Wang 2023-01-19 2451 unsigned int vring_align,
2713ea3c7d930a Jason Wang 2023-01-19 2452 struct virtio_device *vdev,
2713ea3c7d930a Jason Wang 2023-01-19 2453 bool weak_barriers,
2713ea3c7d930a Jason Wang 2023-01-19 2454 bool may_reduce_num,
2713ea3c7d930a Jason Wang 2023-01-19 2455 bool context,
2713ea3c7d930a Jason Wang 2023-01-19 2456 bool (*notify)(struct virtqueue *),
2713ea3c7d930a Jason Wang 2023-01-19 2457 void (*callback)(struct virtqueue *),
2713ea3c7d930a Jason Wang 2023-01-19 2458 const char *name,
2713ea3c7d930a Jason Wang 2023-01-19 2459 struct device *dma_dev)
2713ea3c7d930a Jason Wang 2023-01-19 2460 {
2713ea3c7d930a Jason Wang 2023-01-19 2461
2713ea3c7d930a Jason Wang 2023-01-19 2462 if (virtio_has_feature(vdev, VIRTIO_F_RING_PACKED))
2713ea3c7d930a Jason Wang 2023-01-19 2463 return vring_create_virtqueue_packed(index, num, vring_align,
2713ea3c7d930a Jason Wang 2023-01-19 2464 vdev, weak_barriers, may_reduce_num,
2713ea3c7d930a Jason Wang 2023-01-19 2465 context, notify, callback, name, dma_dev);
2713ea3c7d930a Jason Wang 2023-01-19 2466
2713ea3c7d930a Jason Wang 2023-01-19 2467 return vring_create_virtqueue_split(index, num, vring_align,
2713ea3c7d930a Jason Wang 2023-01-19 2468 vdev, weak_barriers, may_reduce_num,
2713ea3c7d930a Jason Wang 2023-01-19 2469 context, notify, callback, name, dma_dev);
2713ea3c7d930a Jason Wang 2023-01-19 2470 }
2713ea3c7d930a Jason Wang 2023-01-19 2471 EXPORT_SYMBOL_GPL(vring_create_virtqueue_dma);
2713ea3c7d930a Jason Wang 2023-01-19 2472
c790e8e1817f1a Xuan Zhuo 2022-08-01 2473 /**
c790e8e1817f1a Xuan Zhuo 2022-08-01 2474 * virtqueue_resize - resize the vring of vq
c790e8e1817f1a Xuan Zhuo 2022-08-01 2475 * @_vq: the struct virtqueue we're talking about.
c790e8e1817f1a Xuan Zhuo 2022-08-01 2476 * @num: new ring num
c790e8e1817f1a Xuan Zhuo 2022-08-01 2477 * @recycle: callback for recycle the useless buffer
c790e8e1817f1a Xuan Zhuo 2022-08-01 2478 *
c790e8e1817f1a Xuan Zhuo 2022-08-01 2479 * When it is really necessary to create a new vring, it will set the current vq
c790e8e1817f1a Xuan Zhuo 2022-08-01 2480 * into the reset state. Then call the passed callback to recycle the buffer
c790e8e1817f1a Xuan Zhuo 2022-08-01 2481 * that is no longer used. Only after the new vring is successfully created, the
c790e8e1817f1a Xuan Zhuo 2022-08-01 2482 * old vring will be released.
c790e8e1817f1a Xuan Zhuo 2022-08-01 2483 *
c790e8e1817f1a Xuan Zhuo 2022-08-01 2484 * Caller must ensure we don't call this with other virtqueue operations
c790e8e1817f1a Xuan Zhuo 2022-08-01 2485 * at the same time (except where noted).
c790e8e1817f1a Xuan Zhuo 2022-08-01 2486 *
c790e8e1817f1a Xuan Zhuo 2022-08-01 2487 * Returns zero or a negative error.
c790e8e1817f1a Xuan Zhuo 2022-08-01 2488 * 0: success.
c790e8e1817f1a Xuan Zhuo 2022-08-01 2489 * -ENOMEM: Failed to allocate a new ring, fall back to the original ring size.
c790e8e1817f1a Xuan Zhuo 2022-08-01 2490 * vq can still work normally
c790e8e1817f1a Xuan Zhuo 2022-08-01 2491 * -EBUSY: Failed to sync with device, vq may not work properly
c790e8e1817f1a Xuan Zhuo 2022-08-01 2492 * -ENOENT: Transport or device not supported
c790e8e1817f1a Xuan Zhuo 2022-08-01 2493 * -E2BIG/-EINVAL: num error
c790e8e1817f1a Xuan Zhuo 2022-08-01 2494 * -EPERM: Operation not permitted
c790e8e1817f1a Xuan Zhuo 2022-08-01 2495 *
c790e8e1817f1a Xuan Zhuo 2022-08-01 2496 */
146086b281eebe zhenwei pi 2023-05-17 2497 static int vring_virtqueue_resize(struct virtqueue *_vq, u32 num,
c790e8e1817f1a Xuan Zhuo 2022-08-01 2498 void (*recycle)(struct virtqueue *vq, void *buf))
c790e8e1817f1a Xuan Zhuo 2022-08-01 @2499 {
c790e8e1817f1a Xuan Zhuo 2022-08-01 2500 struct vring_virtqueue *vq = to_vvq(_vq);
c790e8e1817f1a Xuan Zhuo 2022-08-01 2501 struct virtio_device *vdev = vq->vq.vdev;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2502 void *buf;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2503 int err;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2504
c790e8e1817f1a Xuan Zhuo 2022-08-01 2505 if (!vq->we_own_ring)
c790e8e1817f1a Xuan Zhuo 2022-08-01 2506 return -EPERM;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2507
c790e8e1817f1a Xuan Zhuo 2022-08-01 2508 if (num > vq->vq.num_max)
c790e8e1817f1a Xuan Zhuo 2022-08-01 2509 return -E2BIG;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2510
c790e8e1817f1a Xuan Zhuo 2022-08-01 2511 if (!num)
c790e8e1817f1a Xuan Zhuo 2022-08-01 2512 return -EINVAL;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2513
c790e8e1817f1a Xuan Zhuo 2022-08-01 2514 if ((vq->packed_ring ? vq->packed.vring.num : vq->split.vring.num) == num)
c790e8e1817f1a Xuan Zhuo 2022-08-01 2515 return 0;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2516
c790e8e1817f1a Xuan Zhuo 2022-08-01 2517 if (!vdev->config->disable_vq_and_reset)
c790e8e1817f1a Xuan Zhuo 2022-08-01 2518 return -ENOENT;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2519
c790e8e1817f1a Xuan Zhuo 2022-08-01 2520 if (!vdev->config->enable_vq_after_reset)
c790e8e1817f1a Xuan Zhuo 2022-08-01 2521 return -ENOENT;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2522
c790e8e1817f1a Xuan Zhuo 2022-08-01 2523 err = vdev->config->disable_vq_and_reset(_vq);
c790e8e1817f1a Xuan Zhuo 2022-08-01 2524 if (err)
c790e8e1817f1a Xuan Zhuo 2022-08-01 2525 return err;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2526
c790e8e1817f1a Xuan Zhuo 2022-08-01 2527 while ((buf = virtqueue_detach_unused_buf(_vq)) != NULL)
c790e8e1817f1a Xuan Zhuo 2022-08-01 2528 recycle(_vq, buf);
c790e8e1817f1a Xuan Zhuo 2022-08-01 2529
c790e8e1817f1a Xuan Zhuo 2022-08-01 2530 if (vq->packed_ring)
c790e8e1817f1a Xuan Zhuo 2022-08-01 2531 err = virtqueue_resize_packed(_vq, num);
c790e8e1817f1a Xuan Zhuo 2022-08-01 2532 else
c790e8e1817f1a Xuan Zhuo 2022-08-01 2533 err = virtqueue_resize_split(_vq, num);
c790e8e1817f1a Xuan Zhuo 2022-08-01 2534
c790e8e1817f1a Xuan Zhuo 2022-08-01 2535 if (vdev->config->enable_vq_after_reset(_vq))
c790e8e1817f1a Xuan Zhuo 2022-08-01 2536 return -EBUSY;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2537
c790e8e1817f1a Xuan Zhuo 2022-08-01 2538 return err;
c790e8e1817f1a Xuan Zhuo 2022-08-01 2539 }
c790e8e1817f1a Xuan Zhuo 2022-08-01 2540
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
View attachment "config" of type "text/plain" (104618 bytes)
Powered by blists - more mailing lists