Commit 53a020c6 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Michael S. Tsirkin

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

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 07ec5148
...@@ -125,7 +125,7 @@ void vp_del_vqs(struct virtio_device *vdev) ...@@ -125,7 +125,7 @@ void vp_del_vqs(struct virtio_device *vdev)
vp_remove_vqs(vdev); vp_remove_vqs(vdev);
if (vp_dev->msix_enabled) { if (vp_dev->pci_dev->msix_enabled) {
for (i = 0; i < vp_dev->msix_vectors; i++) for (i = 0; i < vp_dev->msix_vectors; i++)
free_cpumask_var(vp_dev->msix_affinity_masks[i]); free_cpumask_var(vp_dev->msix_affinity_masks[i]);
...@@ -244,7 +244,6 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs, ...@@ -244,7 +244,6 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
allocated_vectors++; allocated_vectors++;
} }
vp_dev->msix_enabled = 1;
return 0; return 0;
out_remove_vqs: out_remove_vqs:
...@@ -340,7 +339,7 @@ int vp_set_vq_affinity(struct virtqueue *vq, int cpu) ...@@ -340,7 +339,7 @@ int vp_set_vq_affinity(struct virtqueue *vq, int cpu)
if (!vq->callback) if (!vq->callback)
return -EINVAL; return -EINVAL;
if (vp_dev->msix_enabled) { if (vp_dev->pci_dev->msix_enabled) {
int vec = vp_dev->msix_vector_map[vq->index]; int vec = vp_dev->msix_vector_map[vq->index];
struct cpumask *mask = vp_dev->msix_affinity_masks[vec]; struct cpumask *mask = vp_dev->msix_affinity_masks[vec];
unsigned int irq = pci_irq_vector(vp_dev->pci_dev, vec); unsigned int irq = pci_irq_vector(vp_dev->pci_dev, vec);
......
...@@ -64,8 +64,6 @@ struct virtio_pci_device { ...@@ -64,8 +64,6 @@ struct virtio_pci_device {
/* the IO mapping for the PCI config space */ /* the IO mapping for the PCI config space */
void __iomem *ioaddr; void __iomem *ioaddr;
/* MSI-X support */
int msix_enabled;
cpumask_var_t *msix_affinity_masks; cpumask_var_t *msix_affinity_masks;
/* Name strings for interrupts. This size should be enough, /* Name strings for interrupts. This size should be enough,
* and I'm too lazy to allocate each name separately. */ * and I'm too lazy to allocate each name separately. */
......
...@@ -165,7 +165,7 @@ static void del_vq(struct virtqueue *vq) ...@@ -165,7 +165,7 @@ static void del_vq(struct virtqueue *vq)
iowrite16(vq->index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL); iowrite16(vq->index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);
if (vp_dev->msix_enabled) { if (vp_dev->pci_dev->msix_enabled) {
iowrite16(VIRTIO_MSI_NO_VECTOR, iowrite16(VIRTIO_MSI_NO_VECTOR,
vp_dev->ioaddr + VIRTIO_MSI_QUEUE_VECTOR); vp_dev->ioaddr + VIRTIO_MSI_QUEUE_VECTOR);
/* Flush the write out to device */ /* Flush the write out to device */
......
...@@ -412,7 +412,7 @@ static void del_vq(struct virtqueue *vq) ...@@ -412,7 +412,7 @@ static void del_vq(struct virtqueue *vq)
vp_iowrite16(vq->index, &vp_dev->common->queue_select); vp_iowrite16(vq->index, &vp_dev->common->queue_select);
if (vp_dev->msix_enabled) { if (vp_dev->pci_dev->msix_enabled) {
vp_iowrite16(VIRTIO_MSI_NO_VECTOR, vp_iowrite16(VIRTIO_MSI_NO_VECTOR,
&vp_dev->common->queue_msix_vector); &vp_dev->common->queue_msix_vector);
/* Flush the write out to device */ /* Flush the write out to device */
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
* configuration space */ * configuration space */
#define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20) #define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20)
/* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */ /* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */
#define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled) #define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->pci_dev->msix_enabled)
/* Virtio ABI version, this must match exactly */ /* Virtio ABI version, this must match exactly */
#define VIRTIO_PCI_ABI_VERSION 0 #define VIRTIO_PCI_ABI_VERSION 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment