Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330266
b: refs/heads/master
c: 752f521
h: refs/heads/master
v: v3
  • Loading branch information
Anton Blanchard authored and Benjamin Herrenschmidt committed Sep 7, 2012
1 parent 9b68852 commit d77984c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cf1a4cf8754afb248e498815c7957aeb4faca79f
refs/heads/master: 752f5216f1eaabb0cfa84eaecd0ce17d79c7d2cf
20 changes: 19 additions & 1 deletion trunk/arch/powerpc/platforms/pseries/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,13 @@ static int check_msix_entries(struct pci_dev *pdev)
return 0;
}

static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
{
struct pci_dn *pdn;
int hwirq, virq, i, rc;
struct msi_desc *entry;
struct msi_msg msg;
int nvec = nvec_in;

pdn = get_pdn(pdev);
if (!pdn)
Expand All @@ -401,11 +402,24 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
if (type == PCI_CAP_ID_MSIX && check_msix_entries(pdev))
return -EINVAL;

/*
* Firmware currently refuse any non power of two allocation
* so we round up if the quota will allow it.
*/
if (type == PCI_CAP_ID_MSIX) {
int m = roundup_pow_of_two(nvec);
int quota = msi_quota_for_device(pdev, m);

if (quota >= m)
nvec = m;
}

/*
* Try the new more explicit firmware interface, if that fails fall
* back to the old interface. The old interface is known to never
* return MSI-Xs.
*/
again:
if (type == PCI_CAP_ID_MSI) {
rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec);

Expand All @@ -417,6 +431,10 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec);

if (rc != nvec) {
if (nvec != nvec_in) {
nvec = nvec_in;
goto again;
}
pr_debug("rtas_msi: rtas_change_msi() failed\n");
return rc;
}
Expand Down

0 comments on commit d77984c

Please sign in to comment.