Skip to content

Commit 53a020c

Browse files
Christoph Hellwigmstsirkin
authored andcommitted
virtio_pci: don't duplicate the msix_enable flag in struct pci_dev
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 07ec514 commit 53a020c

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

drivers/virtio/virtio_pci_common.c

Lines changed: 2 additions & 3 deletions
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->msix_enabled) {
128+
if (vp_dev->pci_dev->msix_enabled) {
129129
for (i = 0; i < vp_dev->msix_vectors; i++)
130130
free_cpumask_var(vp_dev->msix_affinity_masks[i]);
131131

@@ -244,7 +244,6 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
244244
allocated_vectors++;
245245
}
246246

247-
vp_dev->msix_enabled = 1;
248247
return 0;
249248

250249
out_remove_vqs:
@@ -340,7 +339,7 @@ int vp_set_vq_affinity(struct virtqueue *vq, int cpu)
340339
if (!vq->callback)
341340
return -EINVAL;
342341

343-
if (vp_dev->msix_enabled) {
342+
if (vp_dev->pci_dev->msix_enabled) {
344343
int vec = vp_dev->msix_vector_map[vq->index];
345344
struct cpumask *mask = vp_dev->msix_affinity_masks[vec];
346345
unsigned int irq = pci_irq_vector(vp_dev->pci_dev, vec);

drivers/virtio/virtio_pci_common.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ 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;
6967
cpumask_var_t *msix_affinity_masks;
7068
/* Name strings for interrupts. This size should be enough,
7169
* and I'm too lazy to allocate each name separately. */

drivers/virtio/virtio_pci_legacy.c

Lines changed: 1 addition & 1 deletion
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->msix_enabled) {
168+
if (vp_dev->pci_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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static void del_vq(struct virtqueue *vq)
412412

413413
vp_iowrite16(vq->index, &vp_dev->common->queue_select);
414414

415-
if (vp_dev->msix_enabled) {
415+
if (vp_dev->pci_dev->msix_enabled) {
416416
vp_iowrite16(VIRTIO_MSI_NO_VECTOR,
417417
&vp_dev->common->queue_msix_vector);
418418
/* Flush the write out to device */

include/uapi/linux/virtio_pci.h

Lines changed: 1 addition & 1 deletion
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)->msix_enabled)
82+
#define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->pci_dev->msix_enabled)
8383

8484
/* Virtio ABI version, this must match exactly */
8585
#define VIRTIO_PCI_ABI_VERSION 0

0 commit comments

Comments
 (0)