Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull virtio updates from Michael Tsirkin:
"Just a bunch of fixes and cleanups, mostly very simple. Several
features were merged through net-next this time around"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
virtio_pci: drop kernel.h
vhost: switch to arrays of feature bits
vhost/test: add test specific macro for features
virtio: clean up features qword/dword terms
vduse: add WQ_PERCPU to alloc_workqueue users
virtio_balloon: add WQ_PERCPU to alloc_workqueue users
vdpa/pds: use %pe for ERR_PTR() in event handler registration
vhost: Fix kthread worker cgroup failure handling
virtio: vdpa: Fix reference count leak in octep_sriov_enable()
vdpa/mlx5: Fix incorrect error code reporting in query_virtqueues
virtio: fix map ops comment
virtio: fix virtqueue_set_affinity() docs
virtio: standardize Returns documentation style
virtio: fix grammar in virtio_map_ops docs
virtio: fix grammar in virtio_queue_info docs
virtio: fix whitespace in virtio_config_ops
virtio: fix typo in virtio_device_ready() comment
virtio: fix kernel-doc for mapping/free_coherent functions
virtio_vdpa: fix misleading return in void function

+131 -86
+1 -1
drivers/vdpa/mlx5/net/mlx5_vnet.c
··· 1256 1256 int vq_idx = start_vq + i; 1257 1257 1258 1258 if (cmd->err) { 1259 - mlx5_vdpa_err(mvdev, "query vq %d failed, err: %d\n", vq_idx, err); 1259 + mlx5_vdpa_err(mvdev, "query vq %d failed, err: %d\n", vq_idx, cmd->err); 1260 1260 if (!err) 1261 1261 err = cmd->err; 1262 1262 continue;
+1
drivers/vdpa/octeon_ep/octep_vdpa_main.c
··· 736 736 octep_vdpa_assign_barspace(vf_pdev, pdev, index); 737 737 if (++index == num_vfs) { 738 738 done = true; 739 + pci_dev_put(vf_pdev); 739 740 break; 740 741 } 741 742 }
+1 -1
drivers/vdpa/pds/vdpa_dev.c
··· 51 51 err = pdsc_register_notify(nb); 52 52 if (err) { 53 53 nb->notifier_call = NULL; 54 - dev_err(dev, "failed to register pds event handler: %ps\n", 54 + dev_err(dev, "failed to register pds event handler: %pe\n", 55 55 ERR_PTR(err)); 56 56 return -EINVAL; 57 57 }
+2 -1
drivers/vdpa/vdpa_user/vduse_dev.c
··· 2173 2173 if (!vduse_irq_wq) 2174 2174 goto err_wq; 2175 2175 2176 - vduse_irq_bound_wq = alloc_workqueue("vduse-irq-bound", WQ_HIGHPRI, 0); 2176 + vduse_irq_bound_wq = alloc_workqueue("vduse-irq-bound", 2177 + WQ_HIGHPRI | WQ_PERCPU, 0); 2177 2178 if (!vduse_irq_bound_wq) 2178 2179 goto err_bound_wq; 2179 2180
+15 -14
drivers/vhost/net.c
··· 69 69 70 70 #define VHOST_DMA_IS_DONE(len) ((__force u32)(len) >= (__force u32)VHOST_DMA_DONE_LEN) 71 71 72 - static const u64 vhost_net_features[VIRTIO_FEATURES_DWORDS] = { 73 - VHOST_FEATURES | 74 - (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) | 75 - (1ULL << VIRTIO_NET_F_MRG_RXBUF) | 76 - (1ULL << VIRTIO_F_ACCESS_PLATFORM) | 77 - (1ULL << VIRTIO_F_RING_RESET) | 78 - (1ULL << VIRTIO_F_IN_ORDER), 79 - VIRTIO_BIT(VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO) | 80 - VIRTIO_BIT(VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO), 72 + static const int vhost_net_bits[] = { 73 + VHOST_FEATURES, 74 + VHOST_NET_F_VIRTIO_NET_HDR, 75 + VIRTIO_NET_F_MRG_RXBUF, 76 + VIRTIO_F_ACCESS_PLATFORM, 77 + VIRTIO_F_RING_RESET, 78 + VIRTIO_F_IN_ORDER, 79 + VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO, 80 + VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO 81 81 }; 82 82 83 83 enum { ··· 1731 1731 static long vhost_net_ioctl(struct file *f, unsigned int ioctl, 1732 1732 unsigned long arg) 1733 1733 { 1734 - u64 all_features[VIRTIO_FEATURES_DWORDS]; 1734 + const DEFINE_VHOST_FEATURES_ARRAY(vhost_net_features, vhost_net_bits); 1735 + u64 all_features[VIRTIO_FEATURES_U64S]; 1735 1736 struct vhost_net *n = f->private_data; 1736 1737 void __user *argp = (void __user *)arg; 1737 1738 u64 __user *featurep = argp; ··· 1764 1763 1765 1764 /* Copy the net features, up to the user-provided buffer size */ 1766 1765 argp += sizeof(u64); 1767 - copied = min(count, VIRTIO_FEATURES_DWORDS); 1766 + copied = min(count, (u64)VIRTIO_FEATURES_U64S); 1768 1767 if (copy_to_user(argp, vhost_net_features, 1769 1768 copied * sizeof(u64))) 1770 1769 return -EFAULT; ··· 1779 1778 1780 1779 virtio_features_zero(all_features); 1781 1780 argp += sizeof(u64); 1782 - copied = min(count, VIRTIO_FEATURES_DWORDS); 1781 + copied = min(count, (u64)VIRTIO_FEATURES_U64S); 1783 1782 if (copy_from_user(all_features, argp, copied * sizeof(u64))) 1784 1783 return -EFAULT; 1785 1784 1786 1785 /* 1787 1786 * Any feature specified by user-space above 1788 - * VIRTIO_FEATURES_MAX is not supported by definition. 1787 + * VIRTIO_FEATURES_BITS is not supported by definition. 1789 1788 */ 1790 1789 for (i = copied; i < count; ++i) { 1791 1790 if (copy_from_user(&features, featurep + 1 + i, ··· 1795 1794 return -EOPNOTSUPP; 1796 1795 } 1797 1796 1798 - for (i = 0; i < VIRTIO_FEATURES_DWORDS; i++) 1797 + for (i = 0; i < VIRTIO_FEATURES_U64S; i++) 1799 1798 if (all_features[i] & ~vhost_net_features[i]) 1800 1799 return -EOPNOTSUPP; 1801 1800
+6 -3
drivers/vhost/scsi.c
··· 197 197 }; 198 198 199 199 /* Note: can't set VIRTIO_F_VERSION_1 yet, since that implies ANY_LAYOUT. */ 200 - enum { 201 - VHOST_SCSI_FEATURES = VHOST_FEATURES | (1ULL << VIRTIO_SCSI_F_HOTPLUG) | 202 - (1ULL << VIRTIO_SCSI_F_T10_PI) 200 + static const int vhost_scsi_bits[] = { 201 + VHOST_FEATURES, 202 + VIRTIO_SCSI_F_HOTPLUG, 203 + VIRTIO_SCSI_F_T10_PI 203 204 }; 205 + 206 + #define VHOST_SCSI_FEATURES VHOST_FEATURES_U64(vhost_scsi_bits, 0) 204 207 205 208 #define VHOST_SCSI_MAX_TARGET 256 206 209 #define VHOST_SCSI_MAX_IO_VQ 1024
+8 -2
drivers/vhost/test.c
··· 28 28 */ 29 29 #define VHOST_TEST_PKT_WEIGHT 256 30 30 31 + static const int vhost_test_bits[] = { 32 + VHOST_FEATURES 33 + }; 34 + 35 + #define VHOST_TEST_FEATURES VHOST_FEATURES_U64(vhost_test_bits, 0) 36 + 31 37 enum { 32 38 VHOST_TEST_VQ = 0, 33 39 VHOST_TEST_VQ_MAX = 1, ··· 334 328 return -EFAULT; 335 329 return vhost_test_set_backend(n, backend.index, backend.fd); 336 330 case VHOST_GET_FEATURES: 337 - features = VHOST_FEATURES; 331 + features = VHOST_TEST_FEATURES; 338 332 if (copy_to_user(featurep, &features, sizeof features)) 339 333 return -EFAULT; 340 334 return 0; 341 335 case VHOST_SET_FEATURES: 342 336 if (copy_from_user(&features, featurep, sizeof features)) 343 337 return -EFAULT; 344 - if (features & ~VHOST_FEATURES) 338 + if (features & ~VHOST_TEST_FEATURES) 345 339 return -EOPNOTSUPP; 346 340 return vhost_test_set_features(n, features); 347 341 case VHOST_RESET_OWNER:
+3 -1
drivers/vhost/vhost.c
··· 804 804 805 805 ret = vhost_attach_task_to_cgroups(worker); 806 806 if (ret) 807 - goto stop_worker; 807 + goto free_id; 808 808 809 809 worker->id = id; 810 810 return 0; 811 811 812 + free_id: 813 + xa_erase(&dev->worker_xa, id); 812 814 stop_worker: 813 815 vhost_kthread_do_stop(worker); 814 816 return ret;
+34 -8
drivers/vhost/vhost.h
··· 14 14 #include <linux/atomic.h> 15 15 #include <linux/vhost_iotlb.h> 16 16 #include <linux/irqbypass.h> 17 + #include <linux/unroll.h> 17 18 18 19 struct vhost_work; 19 20 struct vhost_task; ··· 288 287 eventfd_signal((vq)->error_ctx);\ 289 288 } while (0) 290 289 291 - enum { 292 - VHOST_FEATURES = (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | 293 - (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | 294 - (1ULL << VIRTIO_RING_F_EVENT_IDX) | 295 - (1ULL << VHOST_F_LOG_ALL) | 296 - (1ULL << VIRTIO_F_ANY_LAYOUT) | 297 - (1ULL << VIRTIO_F_VERSION_1) 298 - }; 290 + #define VHOST_FEATURES \ 291 + VIRTIO_F_NOTIFY_ON_EMPTY, \ 292 + VIRTIO_RING_F_INDIRECT_DESC, \ 293 + VIRTIO_RING_F_EVENT_IDX, \ 294 + VHOST_F_LOG_ALL, \ 295 + VIRTIO_F_ANY_LAYOUT, \ 296 + VIRTIO_F_VERSION_1 297 + 298 + static inline u64 vhost_features_u64(const int *features, int size, int idx) 299 + { 300 + u64 res = 0; 301 + 302 + unrolled_count(VIRTIO_FEATURES_BITS) 303 + for (int i = 0; i < size; ++i) { 304 + int bit = features[i]; 305 + 306 + if (virtio_features_chk_bit(bit) && VIRTIO_U64(bit) == idx) 307 + res |= VIRTIO_BIT(bit); 308 + } 309 + return res; 310 + } 311 + 312 + #define VHOST_FEATURES_U64(features, idx) \ 313 + vhost_features_u64(features, ARRAY_SIZE(features), idx) 314 + 315 + #define DEFINE_VHOST_FEATURES_ARRAY_ENTRY(idx, features) \ 316 + [idx] = VHOST_FEATURES_U64(features, idx), 317 + 318 + #define DEFINE_VHOST_FEATURES_ARRAY(array, features) \ 319 + u64 array[VIRTIO_FEATURES_U64S] = { \ 320 + UNROLL(VIRTIO_FEATURES_U64S, \ 321 + DEFINE_VHOST_FEATURES_ARRAY_ENTRY, features) \ 322 + } 299 323 300 324 /** 301 325 * vhost_vq_set_backend - Set backend.
+6 -4
drivers/vhost/vsock.c
··· 29 29 */ 30 30 #define VHOST_VSOCK_PKT_WEIGHT 256 31 31 32 - enum { 33 - VHOST_VSOCK_FEATURES = VHOST_FEATURES | 34 - (1ULL << VIRTIO_F_ACCESS_PLATFORM) | 35 - (1ULL << VIRTIO_VSOCK_F_SEQPACKET) 32 + static const int vhost_vsock_bits[] = { 33 + VHOST_FEATURES, 34 + VIRTIO_F_ACCESS_PLATFORM, 35 + VIRTIO_VSOCK_F_SEQPACKET 36 36 }; 37 + 38 + #define VHOST_VSOCK_FEATURES VHOST_FEATURES_U64(vhost_vsock_bits, 0) 37 39 38 40 enum { 39 41 VHOST_VSOCK_BACKEND_FEATURES = (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2)
+6 -6
drivers/virtio/virtio.c
··· 53 53 54 54 /* We actually represent this as a bitstring, as it could be 55 55 * arbitrary length in future. */ 56 - for (i = 0; i < VIRTIO_FEATURES_MAX; i++) 56 + for (i = 0; i < VIRTIO_FEATURES_BITS; i++) 57 57 len += sysfs_emit_at(buf, len, "%c", 58 58 __virtio_test_bit(dev, i) ? '1' : '0'); 59 59 len += sysfs_emit_at(buf, len, "\n"); ··· 272 272 int err, i; 273 273 struct virtio_device *dev = dev_to_virtio(_d); 274 274 struct virtio_driver *drv = drv_to_virtio(dev->dev.driver); 275 - u64 device_features[VIRTIO_FEATURES_DWORDS]; 276 - u64 driver_features[VIRTIO_FEATURES_DWORDS]; 275 + u64 device_features[VIRTIO_FEATURES_U64S]; 276 + u64 driver_features[VIRTIO_FEATURES_U64S]; 277 277 u64 driver_features_legacy; 278 278 279 279 /* We have a driver! */ ··· 286 286 virtio_features_zero(driver_features); 287 287 for (i = 0; i < drv->feature_table_size; i++) { 288 288 unsigned int f = drv->feature_table[i]; 289 - if (!WARN_ON_ONCE(f >= VIRTIO_FEATURES_MAX)) 289 + if (!WARN_ON_ONCE(f >= VIRTIO_FEATURES_BITS)) 290 290 virtio_features_set_bit(driver_features, f); 291 291 } 292 292 ··· 303 303 } 304 304 305 305 if (virtio_features_test_bit(device_features, VIRTIO_F_VERSION_1)) { 306 - for (i = 0; i < VIRTIO_FEATURES_DWORDS; ++i) 306 + for (i = 0; i < VIRTIO_FEATURES_U64S; ++i) 307 307 dev->features_array[i] = driver_features[i] & 308 308 device_features[i]; 309 309 } else { ··· 325 325 goto err; 326 326 327 327 if (drv->validate) { 328 - u64 features[VIRTIO_FEATURES_DWORDS]; 328 + u64 features[VIRTIO_FEATURES_U64S]; 329 329 330 330 virtio_features_copy(features, dev->features_array); 331 331 err = drv->validate(dev);
+2 -1
drivers/virtio/virtio_balloon.c
··· 983 983 goto out_del_vqs; 984 984 } 985 985 vb->balloon_wq = alloc_workqueue("balloon-wq", 986 - WQ_FREEZABLE | WQ_CPU_INTENSIVE, 0); 986 + WQ_FREEZABLE | WQ_CPU_INTENSIVE | WQ_PERCPU, 987 + 0); 987 988 if (!vb->balloon_wq) { 988 989 err = -ENOMEM; 989 990 goto out_del_vqs;
+5 -5
drivers/virtio/virtio_debug.c
··· 8 8 9 9 static int virtio_debug_device_features_show(struct seq_file *s, void *data) 10 10 { 11 - u64 device_features[VIRTIO_FEATURES_DWORDS]; 11 + u64 device_features[VIRTIO_FEATURES_U64S]; 12 12 struct virtio_device *dev = s->private; 13 13 unsigned int i; 14 14 15 15 virtio_get_features(dev, device_features); 16 - for (i = 0; i < VIRTIO_FEATURES_MAX; i++) { 16 + for (i = 0; i < VIRTIO_FEATURES_BITS; i++) { 17 17 if (virtio_features_test_bit(device_features, i)) 18 18 seq_printf(s, "%u\n", i); 19 19 } ··· 26 26 struct virtio_device *dev = s->private; 27 27 unsigned int i; 28 28 29 - for (i = 0; i < VIRTIO_FEATURES_MAX; i++) { 29 + for (i = 0; i < VIRTIO_FEATURES_BITS; i++) { 30 30 if (virtio_features_test_bit(dev->debugfs_filter_features, i)) 31 31 seq_printf(s, "%u\n", i); 32 32 } ··· 50 50 { 51 51 struct virtio_device *dev = data; 52 52 53 - if (val >= VIRTIO_FEATURES_MAX) 53 + if (val >= VIRTIO_FEATURES_BITS) 54 54 return -EINVAL; 55 55 56 56 virtio_features_set_bit(dev->debugfs_filter_features, val); ··· 64 64 { 65 65 struct virtio_device *dev = data; 66 66 67 - if (val >= VIRTIO_FEATURES_MAX) 67 + if (val >= VIRTIO_FEATURES_BITS) 68 68 return -EINVAL; 69 69 70 70 virtio_features_clear_bit(dev->debugfs_filter_features, val);
+3 -3
drivers/virtio/virtio_pci_modern_dev.c
··· 401 401 int i; 402 402 403 403 virtio_features_zero(features); 404 - for (i = 0; i < VIRTIO_FEATURES_WORDS; i++) { 404 + for (i = 0; i < VIRTIO_FEATURES_BITS / 32; i++) { 405 405 u64 cur; 406 406 407 407 vp_iowrite32(i, &cfg->device_feature_select); ··· 427 427 int i; 428 428 429 429 virtio_features_zero(features); 430 - for (i = 0; i < VIRTIO_FEATURES_WORDS; i++) { 430 + for (i = 0; i < VIRTIO_FEATURES_BITS / 32; i++) { 431 431 u64 cur; 432 432 433 433 vp_iowrite32(i, &cfg->guest_feature_select); ··· 448 448 struct virtio_pci_common_cfg __iomem *cfg = mdev->common; 449 449 int i; 450 450 451 - for (i = 0; i < VIRTIO_FEATURES_WORDS; i++) { 451 + for (i = 0; i < VIRTIO_FEATURES_BITS / 32; i++) { 452 452 u32 cur = features[i >> 1] >> (32 * (i & 1)); 453 453 454 454 vp_iowrite32(i, &cfg->guest_feature_select);
+4 -3
drivers/virtio/virtio_ring.c
··· 3166 3166 * @vdev: the virtio device we are talking to 3167 3167 * @map: metadata for performing mapping 3168 3168 * @size: the size of the buffer 3169 + * @vaddr: the virtual address that needs to be freed 3169 3170 * @map_handle: the mapped address that needs to be freed 3170 3171 * 3171 3172 */ ··· 3191 3190 * @dir: mapping direction 3192 3191 * @attrs: mapping attributes 3193 3192 * 3194 - * Returns mapped address. Caller should check that by virtqueue_mapping_error(). 3193 + * Returns mapped address. Caller should check that by virtqueue_map_mapping_error(). 3195 3194 */ 3196 3195 dma_addr_t virtqueue_map_page_attrs(const struct virtqueue *_vq, 3197 3196 struct page *page, ··· 3250 3249 * The caller calls this to do dma mapping in advance. The DMA address can be 3251 3250 * passed to this _vq when it is in pre-mapped mode. 3252 3251 * 3253 - * return mapped address. Caller should check that by virtqueue_mapping_error(). 3252 + * return mapped address. Caller should check that by virtqueue_map_mapping_error(). 3254 3253 */ 3255 3254 dma_addr_t virtqueue_map_single_attrs(const struct virtqueue *_vq, void *ptr, 3256 3255 size_t size, ··· 3300 3299 EXPORT_SYMBOL_GPL(virtqueue_unmap_single_attrs); 3301 3300 3302 3301 /** 3303 - * virtqueue_mapping_error - check dma address 3302 + * virtqueue_map_mapping_error - check dma address 3304 3303 * @_vq: the struct virtqueue we're talking about. 3305 3304 * @addr: DMA address 3306 3305 *
+1 -1
drivers/virtio/virtio_vdpa.c
··· 80 80 { 81 81 struct vdpa_device *vdpa = vd_get_vdpa(vdev); 82 82 83 - return vdpa_set_status(vdpa, status); 83 + vdpa_set_status(vdpa, status); 84 84 } 85 85 86 86 static void virtio_vdpa_reset(struct virtio_device *vdev)
+1 -1
include/linux/virtio.h
··· 177 177 union virtio_map vmap; 178 178 #ifdef CONFIG_VIRTIO_DEBUG 179 179 struct dentry *debugfs_dir; 180 - u64 debugfs_filter_features[VIRTIO_FEATURES_DWORDS]; 180 + u64 debugfs_filter_features[VIRTIO_FEATURES_U64S]; 181 181 #endif 182 182 }; 183 183
+12 -12
include/linux/virtio_config.h
··· 24 24 * a virtqueue unused by the driver. 25 25 * @callback: A callback to invoke on a used buffer notification. 26 26 * NULL for a virtqueue that does not need a callback. 27 - * @ctx: A flag to indicate to maintain an extra context per virtqueue. 27 + * @ctx: whether to maintain an extra context per virtqueue. 28 28 */ 29 29 struct virtqueue_info { 30 30 const char *name; ··· 80 80 * Returns the first 64 feature bits. 81 81 * @get_extended_features: 82 82 * vdev: the virtio_device 83 - * Returns the first VIRTIO_FEATURES_MAX feature bits (all we currently 83 + * Returns the first VIRTIO_FEATURES_BITS feature bits (all we currently 84 84 * need). 85 85 * @finalize_features: confirm what device features we'll be using. 86 86 * vdev: the virtio_device 87 87 * This sends the driver feature bits to the device: it can change 88 88 * the dev->feature bits if it wants. 89 - * Note that despite the name this can be called any number of 89 + * Note that despite the name this can be called any number of 90 90 * times. 91 91 * Returns 0 on success or error status 92 92 * @bus_name: return the bus name associated with the device (optional) ··· 141 141 142 142 /** 143 143 * struct virtio_map_ops - operations for mapping buffer for a virtio device 144 - * Note: For transport that has its own mapping logic it must 145 - * implements all of the operations 144 + * Note: For a transport that has its own mapping logic it must 145 + * implement all of the operations 146 146 * @map_page: map a buffer to the device 147 147 * map: metadata for performing mapping 148 148 * page: the page that will be mapped by the device ··· 150 150 * size: the buffer size 151 151 * dir: mapping direction 152 152 * attrs: mapping attributes 153 - * Returns: the mapped address 153 + * Returns the mapped address 154 154 * @unmap_page: unmap a buffer from the device 155 155 * map: device specific mapping map 156 156 * map_handle: the mapped address ··· 172 172 * size: the size of the buffer 173 173 * map_handle: the mapping address to sync 174 174 * gfp: allocation flag (GFP_XXX) 175 - * Returns: virtual address of the allocated buffer 175 + * Returns virtual address of the allocated buffer 176 176 * @free: free a coherent buffer mapping 177 177 * map: metadata for performing mapping 178 178 * size: the size of the buffer 179 179 * vaddr: virtual address of the buffer 180 - * map_handle: the mapping address to sync 180 + * map_handle: the mapping address that needs to be freed 181 181 * attrs: unmapping attributes 182 182 * @need_sync: if the buffer needs synchronization 183 183 * map: metadata for performing mapping 184 184 * map_handle: the mapped address 185 - * Returns: whether the buffer needs synchronization 185 + * Returns whether the buffer needs synchronization 186 186 * @mapping_error: if the mapping address is error 187 187 * map: metadata for performing mapping 188 188 * map_handle: the mapped address 189 189 * @max_mapping_size: get the maximum buffer size that can be mapped 190 190 * map: metadata for performing mapping 191 - * Returns: the maximum buffer size that can be mapped 191 + * Returns the maximum buffer size that can be mapped 192 192 */ 193 193 struct virtio_map_ops { 194 194 dma_addr_t (*map_page)(union virtio_map map, struct page *page, ··· 362 362 * specific set_status() method. 363 363 * 364 364 * A well behaved device will only notify a virtqueue after 365 - * DRIVER_OK, this means the device should "see" the coherenct 365 + * DRIVER_OK, this means the device should "see" the coherent 366 366 * memory write that set vq->broken as false which is done by 367 367 * the driver when it sees DRIVER_OK, then the following 368 368 * driver's vring_interrupt() will see vq->broken as false so ··· 384 384 * @vq: the virtqueue 385 385 * @cpu_mask: the cpu mask 386 386 * 387 - * Pay attention the function are best-effort: the affinity hint may not be set 387 + * Note that this function is best-effort: the affinity hint may not be set 388 388 * due to config support, irq type and sharing. 389 389 * 390 390 */
+15 -14
include/linux/virtio_features.h
··· 4 4 5 5 #include <linux/bits.h> 6 6 7 - #define VIRTIO_FEATURES_DWORDS 2 8 - #define VIRTIO_FEATURES_MAX (VIRTIO_FEATURES_DWORDS * 64) 9 - #define VIRTIO_FEATURES_WORDS (VIRTIO_FEATURES_DWORDS * 2) 7 + #define VIRTIO_FEATURES_U64S 2 8 + #define VIRTIO_FEATURES_BITS (VIRTIO_FEATURES_U64S * 64) 9 + 10 10 #define VIRTIO_BIT(b) BIT_ULL((b) & 0x3f) 11 - #define VIRTIO_DWORD(b) ((b) >> 6) 11 + #define VIRTIO_U64(b) ((b) >> 6) 12 + 12 13 #define VIRTIO_DECLARE_FEATURES(name) \ 13 14 union { \ 14 15 u64 name; \ 15 - u64 name##_array[VIRTIO_FEATURES_DWORDS];\ 16 + u64 name##_array[VIRTIO_FEATURES_U64S];\ 16 17 } 17 18 18 19 static inline bool virtio_features_chk_bit(unsigned int bit) ··· 23 22 * Don't care returning the correct value: the build 24 23 * will fail before any bad features access 25 24 */ 26 - BUILD_BUG_ON(bit >= VIRTIO_FEATURES_MAX); 25 + BUILD_BUG_ON(bit >= VIRTIO_FEATURES_BITS); 27 26 } else { 28 - if (WARN_ON_ONCE(bit >= VIRTIO_FEATURES_MAX)) 27 + if (WARN_ON_ONCE(bit >= VIRTIO_FEATURES_BITS)) 29 28 return false; 30 29 } 31 30 return true; ··· 35 34 unsigned int bit) 36 35 { 37 36 return virtio_features_chk_bit(bit) && 38 - !!(features[VIRTIO_DWORD(bit)] & VIRTIO_BIT(bit)); 37 + !!(features[VIRTIO_U64(bit)] & VIRTIO_BIT(bit)); 39 38 } 40 39 41 40 static inline void virtio_features_set_bit(u64 *features, 42 41 unsigned int bit) 43 42 { 44 43 if (virtio_features_chk_bit(bit)) 45 - features[VIRTIO_DWORD(bit)] |= VIRTIO_BIT(bit); 44 + features[VIRTIO_U64(bit)] |= VIRTIO_BIT(bit); 46 45 } 47 46 48 47 static inline void virtio_features_clear_bit(u64 *features, 49 48 unsigned int bit) 50 49 { 51 50 if (virtio_features_chk_bit(bit)) 52 - features[VIRTIO_DWORD(bit)] &= ~VIRTIO_BIT(bit); 51 + features[VIRTIO_U64(bit)] &= ~VIRTIO_BIT(bit); 53 52 } 54 53 55 54 static inline void virtio_features_zero(u64 *features) 56 55 { 57 - memset(features, 0, sizeof(features[0]) * VIRTIO_FEATURES_DWORDS); 56 + memset(features, 0, sizeof(features[0]) * VIRTIO_FEATURES_U64S); 58 57 } 59 58 60 59 static inline void virtio_features_from_u64(u64 *features, u64 from) ··· 67 66 { 68 67 int i; 69 68 70 - for (i = 0; i < VIRTIO_FEATURES_DWORDS; ++i) 69 + for (i = 0; i < VIRTIO_FEATURES_U64S; ++i) 71 70 if (f1[i] != f2[i]) 72 71 return false; 73 72 return true; ··· 75 74 76 75 static inline void virtio_features_copy(u64 *to, const u64 *from) 77 76 { 78 - memcpy(to, from, sizeof(to[0]) * VIRTIO_FEATURES_DWORDS); 77 + memcpy(to, from, sizeof(to[0]) * VIRTIO_FEATURES_U64S); 79 78 } 80 79 81 80 static inline void virtio_features_andnot(u64 *to, const u64 *f1, const u64 *f2) 82 81 { 83 82 int i; 84 83 85 - for (i = 0; i < VIRTIO_FEATURES_DWORDS; i++) 84 + for (i = 0; i < VIRTIO_FEATURES_U64S; i++) 86 85 to[i] = f1[i] & ~f2[i]; 87 86 } 88 87
+4 -4
include/linux/virtio_pci_modern.h
··· 107 107 static inline u64 108 108 vp_modern_get_features(struct virtio_pci_modern_device *mdev) 109 109 { 110 - u64 features_array[VIRTIO_FEATURES_DWORDS]; 110 + u64 features_array[VIRTIO_FEATURES_U64S]; 111 111 112 112 vp_modern_get_extended_features(mdev, features_array); 113 113 return features_array[0]; ··· 116 116 static inline u64 117 117 vp_modern_get_driver_features(struct virtio_pci_modern_device *mdev) 118 118 { 119 - u64 features_array[VIRTIO_FEATURES_DWORDS]; 119 + u64 features_array[VIRTIO_FEATURES_U64S]; 120 120 int i; 121 121 122 122 vp_modern_get_driver_extended_features(mdev, features_array); 123 - for (i = 1; i < VIRTIO_FEATURES_DWORDS; ++i) 123 + for (i = 1; i < VIRTIO_FEATURES_U64S; ++i) 124 124 WARN_ON_ONCE(features_array[i]); 125 125 return features_array[0]; 126 126 } ··· 128 128 static inline void 129 129 vp_modern_set_features(struct virtio_pci_modern_device *mdev, u64 features) 130 130 { 131 - u64 features_array[VIRTIO_FEATURES_DWORDS]; 131 + u64 features_array[VIRTIO_FEATURES_U64S]; 132 132 133 133 virtio_features_from_u64(features_array, features); 134 134 vp_modern_set_extended_features(mdev, features_array);
+1 -1
include/uapi/linux/virtio_pci.h
··· 40 40 #define _LINUX_VIRTIO_PCI_H 41 41 42 42 #include <linux/types.h> 43 - #include <linux/kernel.h> 43 + #include <linux/const.h> 44 44 45 45 #ifndef VIRTIO_PCI_NO_LEGACY 46 46