History

Revert "virtio_pci: don't duplicate the msix_enable flag in struct pci_dev"

This reverts commit 53a020c661741f3b87ad3ac6fa545088aaebac9b. The cleanup seems to be one of the changes that broke hybernation for some users. We are still not sure why but revert helps.

Michael S. Tsirkin committed 9 years ago

Commit 2008c151 parent bf951b15 files · +8 −5Browse files

Unified · Split

5 files
  1. drivers/virtio/virtio_pci_common.c +3 −2
  2. drivers/virtio/virtio_pci_common.h +2 −0
  3. drivers/virtio/virtio_pci_legacy.c +1 −1
  4. drivers/virtio/virtio_pci_modern.c +1 −1
  5. include/uapi/linux/virtio_pci.h +1 −1
drivers/virtio/virtio_pci_common.c+3−2
@@ -125,7 +125,7 @@ void vp_del_vqs(struct virtio_device *vdev) · 124 unmodified lines
125 125
126 vp_remove_vqs(vdev);126 vp_remove_vqs(vdev);
127 127
128 if (vp_dev->pci_dev->msix_enabled) {128 if (vp_dev->msix_enabled) {
129 for (i = 0; i < vp_dev->msix_vectors; i++)129 for (i = 0; i < vp_dev->msix_vectors; i++)
130 free_cpumask_var(vp_dev->msix_affinity_masks[i]);130 free_cpumask_var(vp_dev->msix_affinity_masks[i]);
131 131
@@ -249,6 +249,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs, · 117 unmodified lines
249 allocated_vectors++;249 allocated_vectors++;
250 }250 }
251 251
252 vp_dev->msix_enabled = 1;
252 return 0;253 return 0;
253 254
254out_remove_vqs:255out_remove_vqs:
@@ -343,7 +344,7 @@ int vp_set_vq_affinity(struct virtqueue *vq, int cpu) · 88 unmodified lines
343 if (!vq->callback)344 if (!vq->callback)
344 return -EINVAL;345 return -EINVAL;
345 346
346 if (vp_dev->pci_dev->msix_enabled) {347 if (vp_dev->msix_enabled) {
347 int vec = vp_dev->msix_vector_map[vq->index];348 int vec = vp_dev->msix_vector_map[vq->index];
348 struct cpumask *mask = vp_dev->msix_affinity_masks[vec];349 struct cpumask *mask = vp_dev->msix_affinity_masks[vec];
349 unsigned int irq = pci_irq_vector(vp_dev->pci_dev, vec);350 unsigned int irq = pci_irq_vector(vp_dev->pci_dev, vec);
drivers/virtio/virtio_pci_common.h+2−0
@@ -64,6 +64,8 @@ struct virtio_pci_device { · 63 unmodified lines
64 /* the IO mapping for the PCI config space */64 /* the IO mapping for the PCI config space */
65 void __iomem *ioaddr;65 void __iomem *ioaddr;
66 66
67 /* MSI-X support */
68 int msix_enabled;
67 cpumask_var_t *msix_affinity_masks;69 cpumask_var_t *msix_affinity_masks;
68 /* Name strings for interrupts. This size should be enough,70 /* Name strings for interrupts. This size should be enough,
69 * and I'm too lazy to allocate each name separately. */71 * and I'm too lazy to allocate each name separately. */
drivers/virtio/virtio_pci_legacy.c+1−1
@@ -165,7 +165,7 @@ static void del_vq(struct virtqueue *vq) · 164 unmodified lines
165 165
166 iowrite16(vq->index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);166 iowrite16(vq->index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);
167 167
168 if (vp_dev->pci_dev->msix_enabled) {168 if (vp_dev->msix_enabled) {
169 iowrite16(VIRTIO_MSI_NO_VECTOR,169 iowrite16(VIRTIO_MSI_NO_VECTOR,
170 vp_dev->ioaddr + VIRTIO_MSI_QUEUE_VECTOR);170 vp_dev->ioaddr + VIRTIO_MSI_QUEUE_VECTOR);
171 /* Flush the write out to device */171 /* Flush the write out to device */
drivers/virtio/virtio_pci_modern.c+1−1
@@ -411,7 +411,7 @@ static void del_vq(struct virtqueue *vq) · 410 unmodified lines
411 411
412 vp_iowrite16(vq->index, &vp_dev->common->queue_select);412 vp_iowrite16(vq->index, &vp_dev->common->queue_select);
413 413
414 if (vp_dev->pci_dev->msix_enabled) {414 if (vp_dev->msix_enabled) {
415 vp_iowrite16(VIRTIO_MSI_NO_VECTOR,415 vp_iowrite16(VIRTIO_MSI_NO_VECTOR,
416 &vp_dev->common->queue_msix_vector);416 &vp_dev->common->queue_msix_vector);
417 /* Flush the write out to device */417 /* Flush the write out to device */
include/uapi/linux/virtio_pci.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
79 * configuration space */79 * configuration space */
80#define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20)80#define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20)
81/* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */81/* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */
82#define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->pci_dev->msix_enabled)82#define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled)
83 83
84/* Virtio ABI version, this must match exactly */84/* Virtio ABI version, this must match exactly */
85#define VIRTIO_PCI_ABI_VERSION 085#define VIRTIO_PCI_ABI_VERSION 0

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t