Skip to content

Commit 2008c15

Browse files
committed
Revert "virtio_pci: don't duplicate the msix_enable flag in struct pci_dev"
This reverts commit 53a020c. The cleanup seems to be one of the changes that broke hybernation for some users. We are still not sure why but revert helps. Tested-by: Mike Galbraith <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent bf951b1 commit 2008c15

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

drivers/virtio/virtio_pci_common.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void vp_del_vqs(struct virtio_device *vdev)
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,
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)
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
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ struct virtio_pci_device {
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
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static void del_vq(struct virtqueue *vq)
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
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ static void del_vq(struct virtqueue *vq)
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
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
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

0 commit comments

Comments
 (0)