]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
s390/pci: improve irq number check for msix
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Wed, 29 Oct 2014 18:12:04 +0000 (19:12 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 3 Nov 2014 12:30:12 +0000 (13:30 +0100)
s390s arch_setup_msi_irqs function ensures that we don't return with
more irqs than the PCI architecture allows and that a single PCI
function doesn't consume more irqs than the kernel is configured for.

At least the last check doesn't help much and should take the sum of
all irqs into account. Since that's already done by irq_alloc_desc
we can remove this check.

As for the first check we should use the value provided by the
firmware which can be less than what the PCI architecture allows.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/pci.h
arch/s390/pci/pci.c
arch/s390/pci/pci_clp.c

index c030900320e0baf62a3e9eb0b879c300620ab4ae..ef803c202d42d5631c8a074e69148799096a4151 100644 (file)
@@ -50,10 +50,6 @@ struct zpci_fmb {
        atomic64_t unmapped_pages;
 } __packed __aligned(16);
 
-#define ZPCI_MSI_VEC_BITS      11
-#define ZPCI_MSI_VEC_MAX       (1 << ZPCI_MSI_VEC_BITS)
-#define ZPCI_MSI_VEC_MASK      (ZPCI_MSI_VEC_MAX - 1)
-
 enum zpci_state {
        ZPCI_FN_STATE_RESERVED,
        ZPCI_FN_STATE_STANDBY,
@@ -90,6 +86,7 @@ struct zpci_dev {
 
        /* IRQ stuff */
        u64             msi_addr;       /* MSI address */
+       unsigned int    max_msi;        /* maximum number of MSI's */
        struct airq_iv *aibv;           /* adapter interrupt bit vector */
        unsigned int    aisb;           /* number of the summary bit */
 
index 2fa7b14b9c08dee648afcdbe7ae75744ba73cb22..47a4568e141d2407d78c9090726e5fb5e35bd125 100644 (file)
@@ -369,8 +369,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 
        if (type == PCI_CAP_ID_MSI && nvec > 1)
                return 1;
-       msi_vecs = min(nvec, ZPCI_MSI_VEC_MAX);
-       msi_vecs = min_t(unsigned int, msi_vecs, CONFIG_PCI_NR_MSI);
+       msi_vecs = min_t(unsigned int, nvec, zdev->max_msi);
 
        /* Allocate adapter summary indicator bit */
        rc = -EIO;
index 6e22a247de9b302c768d6a4e6ff6dbca18b283b3..d6e411ed8b1f9017a62b68b6c3fbaab4ce4a0f18 100644 (file)
@@ -62,6 +62,7 @@ static void clp_store_query_pci_fngrp(struct zpci_dev *zdev,
        zdev->tlb_refresh = response->refresh;
        zdev->dma_mask = response->dasm;
        zdev->msi_addr = response->msia;
+       zdev->max_msi = response->noi;
        zdev->fmb_update = response->mui;
 
        switch (response->version) {