Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17e34c4f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull virtio fixes from Michael Tsirkin:
 "Fixes two obvious bugs in virtio pci"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  virtio_pci: fix cpu affinity support
  virtio_blk: fix incorrect message when disk is resized
parents 42e6d5e5 ba74b6f7
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -381,6 +381,7 @@ static void virtblk_config_changed_work(struct work_struct *work)
	struct request_queue *q = vblk->disk->queue;
	char cap_str_2[10], cap_str_10[10];
	char *envp[] = { "RESIZE=1", NULL };
	unsigned long long nblocks;
	u64 capacity;

	/* Host must always specify the capacity. */
@@ -393,16 +394,19 @@ static void virtblk_config_changed_work(struct work_struct *work)
		capacity = (sector_t)-1;
	}

	string_get_size(capacity, queue_logical_block_size(q),
	nblocks = DIV_ROUND_UP_ULL(capacity, queue_logical_block_size(q) >> 9);

	string_get_size(nblocks, queue_logical_block_size(q),
			STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
	string_get_size(capacity, queue_logical_block_size(q),
	string_get_size(nblocks, queue_logical_block_size(q),
			STRING_UNITS_10, cap_str_10, sizeof(cap_str_10));

	dev_notice(&vdev->dev,
		   "new size: %llu %d-byte logical blocks (%s/%s)\n",
		  (unsigned long long)capacity,
		   nblocks,
		   queue_logical_block_size(q),
		  cap_str_10, cap_str_2);
		   cap_str_10,
		   cap_str_2);

	set_capacity(vblk->disk, capacity);
	revalidate_disk(vblk->disk);
+7 −3
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
{
	struct virtio_pci_device *vp_dev = to_vp_device(vdev);
	const char *name = dev_name(&vp_dev->vdev.dev);
	unsigned flags = PCI_IRQ_MSIX;
	unsigned i, v;
	int err = -ENOMEM;

@@ -126,10 +127,13 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
					GFP_KERNEL))
			goto error;

	if (desc) {
		flags |= PCI_IRQ_AFFINITY;
		desc->pre_vectors++; /* virtio config vector */
	}

	err = pci_alloc_irq_vectors_affinity(vp_dev->pci_dev, nvectors,
					     nvectors, PCI_IRQ_MSIX |
					     (desc ? PCI_IRQ_AFFINITY : 0),
					     desc);
					     nvectors, flags, desc);
	if (err < 0)
		goto error;
	vp_dev->msix_enabled = 1;