Commit b1f54864 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/pci: clarify interrupt vector usage

Rename and clarify the usage of the interrupt bit vectors. Also change
the array of the per-function bit vectors to be dynamically allocated.
Signed-off-by: default avatarSebastian Ott <sebott@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 30e63ef2
...@@ -14,8 +14,15 @@ ...@@ -14,8 +14,15 @@
#define SIC_IRQ_MODE_ALL 0 #define SIC_IRQ_MODE_ALL 0
#define SIC_IRQ_MODE_SINGLE 1 #define SIC_IRQ_MODE_SINGLE 1
static struct airq_iv *zpci_aisb_iv; /*
static struct airq_iv *zpci_aibv[ZPCI_NR_DEVICES]; * summary bit vector - one summary bit per function
*/
static struct airq_iv *zpci_sbv;
/*
* interrupt bit vectors - one vector per function
*/
static struct airq_iv **zpci_ibv;
/* Modify PCI: Register adapter interruptions */ /* Modify PCI: Register adapter interruptions */
static int zpci_set_airq(struct zpci_dev *zdev) static int zpci_set_airq(struct zpci_dev *zdev)
...@@ -29,7 +36,7 @@ static int zpci_set_airq(struct zpci_dev *zdev) ...@@ -29,7 +36,7 @@ static int zpci_set_airq(struct zpci_dev *zdev)
fib.noi = airq_iv_end(zdev->aibv); fib.noi = airq_iv_end(zdev->aibv);
fib.aibv = (unsigned long) zdev->aibv->vector; fib.aibv = (unsigned long) zdev->aibv->vector;
fib.aibvo = 0; /* each zdev has its own interrupt vector */ fib.aibvo = 0; /* each zdev has its own interrupt vector */
fib.aisb = (unsigned long) zpci_aisb_iv->vector + (zdev->aisb/64)*8; fib.aisb = (unsigned long) zpci_sbv->vector + (zdev->aisb/64)*8;
fib.aisbo = zdev->aisb & 63; fib.aisbo = zdev->aisb & 63;
return zpci_mod_fc(req, &fib, &status) ? -EIO : 0; return zpci_mod_fc(req, &fib, &status) ? -EIO : 0;
...@@ -65,7 +72,7 @@ static void zpci_irq_handler(struct airq_struct *airq, bool floating) ...@@ -65,7 +72,7 @@ static void zpci_irq_handler(struct airq_struct *airq, bool floating)
inc_irq_stat(IRQIO_PCI); inc_irq_stat(IRQIO_PCI);
for (si = 0;;) { for (si = 0;;) {
/* Scan adapter summary indicator bit vector */ /* Scan adapter summary indicator bit vector */
si = airq_iv_scan(zpci_aisb_iv, si, airq_iv_end(zpci_aisb_iv)); si = airq_iv_scan(zpci_sbv, si, airq_iv_end(zpci_sbv));
if (si == -1UL) { if (si == -1UL) {
if (irqs_on++) if (irqs_on++)
/* End of second scan with interrupts on. */ /* End of second scan with interrupts on. */
...@@ -78,7 +85,7 @@ static void zpci_irq_handler(struct airq_struct *airq, bool floating) ...@@ -78,7 +85,7 @@ static void zpci_irq_handler(struct airq_struct *airq, bool floating)
} }
/* Scan the adapter interrupt vector for this device. */ /* Scan the adapter interrupt vector for this device. */
aibv = zpci_aibv[si]; aibv = zpci_ibv[si];
for (ai = 0;;) { for (ai = 0;;) {
ai = airq_iv_scan(aibv, ai, airq_iv_end(aibv)); ai = airq_iv_scan(aibv, ai, airq_iv_end(aibv));
if (ai == -1UL) if (ai == -1UL)
...@@ -106,7 +113,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) ...@@ -106,7 +113,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
msi_vecs = min_t(unsigned int, nvec, zdev->max_msi); msi_vecs = min_t(unsigned int, nvec, zdev->max_msi);
/* Allocate adapter summary indicator bit */ /* Allocate adapter summary indicator bit */
aisb = airq_iv_alloc_bit(zpci_aisb_iv); aisb = airq_iv_alloc_bit(zpci_sbv);
if (aisb == -1UL) if (aisb == -1UL)
return -EIO; return -EIO;
zdev->aisb = aisb; zdev->aisb = aisb;
...@@ -117,7 +124,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) ...@@ -117,7 +124,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
return -ENOMEM; return -ENOMEM;
/* Wire up shortcut pointer */ /* Wire up shortcut pointer */
zpci_aibv[aisb] = zdev->aibv; zpci_ibv[aisb] = zdev->aibv;
/* Request MSI interrupts */ /* Request MSI interrupts */
hwirq = 0; hwirq = 0;
...@@ -176,8 +183,8 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev) ...@@ -176,8 +183,8 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev)
} }
if (zdev->aisb != -1UL) { if (zdev->aisb != -1UL) {
zpci_aibv[zdev->aisb] = NULL; zpci_ibv[zdev->aisb] = NULL;
airq_iv_free_bit(zpci_aisb_iv, zdev->aisb); airq_iv_free_bit(zpci_sbv, zdev->aisb);
zdev->aisb = -1UL; zdev->aisb = -1UL;
} }
if (zdev->aibv) { if (zdev->aibv) {
...@@ -202,13 +209,19 @@ int __init zpci_irq_init(void) ...@@ -202,13 +209,19 @@ int __init zpci_irq_init(void)
*zpci_airq.lsi_ptr = 1; *zpci_airq.lsi_ptr = 1;
rc = -ENOMEM; rc = -ENOMEM;
zpci_aisb_iv = airq_iv_create(ZPCI_NR_DEVICES, AIRQ_IV_ALLOC); zpci_ibv = kcalloc(ZPCI_NR_DEVICES, sizeof(*zpci_ibv), GFP_KERNEL);
if (!zpci_aisb_iv) if (!zpci_ibv)
goto out_airq; goto out_airq;
zpci_sbv = airq_iv_create(ZPCI_NR_DEVICES, AIRQ_IV_ALLOC);
if (!zpci_sbv)
goto out_free;
zpci_set_irq_ctrl(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC); zpci_set_irq_ctrl(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC);
return 0; return 0;
out_free:
kfree(zpci_ibv);
out_airq: out_airq:
unregister_adapter_interrupt(&zpci_airq); unregister_adapter_interrupt(&zpci_airq);
out: out:
...@@ -217,6 +230,7 @@ int __init zpci_irq_init(void) ...@@ -217,6 +230,7 @@ int __init zpci_irq_init(void)
void __init zpci_irq_exit(void) void __init zpci_irq_exit(void)
{ {
airq_iv_release(zpci_aisb_iv); airq_iv_release(zpci_sbv);
kfree(zpci_ibv);
unregister_adapter_interrupt(&zpci_airq); unregister_adapter_interrupt(&zpci_airq);
} }
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