aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/pci/vmd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c
index 0f77cc1dbb4e..fd582abfad91 100644
--- a/arch/x86/pci/vmd.c
+++ b/arch/x86/pci/vmd.c
@@ -169,11 +169,14 @@ static irq_hw_number_t vmd_get_hwirq(struct msi_domain_info *info,
169 * XXX: We can be even smarter selecting the best IRQ once we solve the 169 * XXX: We can be even smarter selecting the best IRQ once we solve the
170 * affinity problem. 170 * affinity problem.
171 */ 171 */
172static struct vmd_irq_list *vmd_next_irq(struct vmd_dev *vmd) 172static struct vmd_irq_list *vmd_next_irq(struct vmd_dev *vmd, struct msi_desc *desc)
173{ 173{
174 int i, best = 0; 174 int i, best = 1;
175 unsigned long flags; 175 unsigned long flags;
176 176
177 if (!desc->msi_attrib.is_msix || vmd->msix_count == 1)
178 return &vmd->irqs[0];
179
177 raw_spin_lock_irqsave(&list_lock, flags); 180 raw_spin_lock_irqsave(&list_lock, flags);
178 for (i = 1; i < vmd->msix_count; i++) 181 for (i = 1; i < vmd->msix_count; i++)
179 if (vmd->irqs[i].count < vmd->irqs[best].count) 182 if (vmd->irqs[i].count < vmd->irqs[best].count)
@@ -188,14 +191,15 @@ static int vmd_msi_init(struct irq_domain *domain, struct msi_domain_info *info,
188 unsigned int virq, irq_hw_number_t hwirq, 191 unsigned int virq, irq_hw_number_t hwirq,
189 msi_alloc_info_t *arg) 192 msi_alloc_info_t *arg)
190{ 193{
191 struct vmd_dev *vmd = vmd_from_bus(msi_desc_to_pci_dev(arg->desc)->bus); 194 struct msi_desc *desc = arg->desc;
195 struct vmd_dev *vmd = vmd_from_bus(msi_desc_to_pci_dev(desc)->bus);
192 struct vmd_irq *vmdirq = kzalloc(sizeof(*vmdirq), GFP_KERNEL); 196 struct vmd_irq *vmdirq = kzalloc(sizeof(*vmdirq), GFP_KERNEL);
193 197
194 if (!vmdirq) 198 if (!vmdirq)
195 return -ENOMEM; 199 return -ENOMEM;
196 200
197 INIT_LIST_HEAD(&vmdirq->node); 201 INIT_LIST_HEAD(&vmdirq->node);
198 vmdirq->irq = vmd_next_irq(vmd); 202 vmdirq->irq = vmd_next_irq(vmd, desc);
199 vmdirq->virq = virq; 203 vmdirq->virq = virq;
200 204
201 irq_domain_set_info(domain, virq, vmdirq->irq->vmd_vector, info->chip, 205 irq_domain_set_info(domain, virq, vmdirq->irq->vmd_vector, info->chip,