Skip to content

Commit

Permalink
PCI: hv: Rework MSI handling
Browse files Browse the repository at this point in the history
Replace the about to vanish iterators and make use of the filtering. Take
the descriptor lock around the iterators.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Michael Kelley <mikelley@microsoft.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20211206210748.629363944@linutronix.de
  • Loading branch information
Thomas Gleixner committed Dec 16, 2021
1 parent 706b585 commit dc2b453
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions drivers/pci/controller/pci-hyperv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3445,18 +3445,23 @@ static int hv_pci_suspend(struct hv_device *hdev)

static int hv_pci_restore_msi_msg(struct pci_dev *pdev, void *arg)
{
struct msi_desc *entry;
struct irq_data *irq_data;
struct msi_desc *entry;
int ret = 0;

for_each_pci_msi_entry(entry, pdev) {
msi_lock_descs(&pdev->dev);
msi_for_each_desc(entry, &pdev->dev, MSI_DESC_ASSOCIATED) {
irq_data = irq_get_irq_data(entry->irq);
if (WARN_ON_ONCE(!irq_data))
return -EINVAL;
if (WARN_ON_ONCE(!irq_data)) {
ret = -EINVAL;
break;
}

hv_compose_msi_msg(irq_data, &entry->msg);
}
msi_unlock_descs(&pdev->dev);

return 0;
return ret;
}

/*
Expand Down

0 comments on commit dc2b453

Please sign in to comment.