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
125125
126126 vp_remove_vqs(vdev);
127127
128− if (vp_dev->pci_dev->msix_enabled) {
128+ if (vp_dev->msix_enabled) {
129129 for (i = 0; i < vp_dev->msix_vectors; i++)
130130 free_cpumask_var(vp_dev->msix_affinity_masks[i]);
131131
@@ -249,6 +249,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs, · 117 unmodified lines
249249 allocated_vectors++;
250250 }
251251
252+ vp_dev->msix_enabled = 1;
252253 return 0;
253254
254255 out_remove_vqs:
@@ -343,7 +344,7 @@ int vp_set_vq_affinity(struct virtqueue *vq, int cpu) · 88 unmodified lines
343344 if (!vq->callback)
344345 return -EINVAL;
345346
346− if (vp_dev->pci_dev->msix_enabled) {
347+ if (vp_dev->msix_enabled) {
347348 int vec = vp_dev->msix_vector_map[vq->index];
348349 struct cpumask *mask = vp_dev->msix_affinity_masks[vec];
349350 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
6464 /* the IO mapping for the PCI config space */
6565 void __iomem *ioaddr;
6666
67+ /* MSI-X support */
68+ int msix_enabled;
6769 cpumask_var_t *msix_affinity_masks;
6870 /* Name strings for interrupts. This size should be enough,
6971 * 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
165165
166166 iowrite16(vq->index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);
167167
168− if (vp_dev->pci_dev->msix_enabled) {
168+ if (vp_dev->msix_enabled) {
169169 iowrite16(VIRTIO_MSI_NO_VECTOR,
170170 vp_dev->ioaddr + VIRTIO_MSI_QUEUE_VECTOR);
171171 /* 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
411411
412412 vp_iowrite16(vq->index, &vp_dev->common->queue_select);
413413
414− if (vp_dev->pci_dev->msix_enabled) {
414+ if (vp_dev->msix_enabled) {
415415 vp_iowrite16(VIRTIO_MSI_NO_VECTOR,
416416 &vp_dev->common->queue_msix_vector);
417417 /* Flush the write out to device */
include/uapi/linux/virtio_pci.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
7979 * configuration space */
8080 #define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20)
8181 /* 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)
8383
8484 /* Virtio ABI version, this must match exactly */
8585 #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