diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2007-04-18 05:39:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-05-02 22:02:38 -0400 |
commit | 7fe3730de729b758e9f69b862b9255d998671b5f (patch) | |
tree | 2fc0cf3a003aaf6e8c257a32b748941e3eec93b2 /arch | |
parent | f282b97021ddc95c6092b9016f667c0963858fb1 (diff) |
MSI: arch must connect the irq and the msi_desc
set_irq_msi() currently connects an irq_desc to an msi_desc. The archs call
it at some point in their setup routine, and then the generic code sets up the
reverse mapping from the msi_desc back to the irq.
set_irq_msi() should do both connections, making it the one and only call
required to connect an irq with it's MSI desc and vice versa.
The arch code MUST call set_irq_msi(), and it must do so only once it's sure
it's not going to fail the irq allocation.
Given that there's no need for the arch to return the irq anymore, the return
value from the arch setup routine just becomes 0 for success and anything else
for failure.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/io_apic.c | 4 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/msi_sn.c | 4 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci.c | 4 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_sun4v.c | 4 | ||||
-rw-r--r-- | arch/x86_64/kernel/io_apic.c | 4 |
5 files changed, 10 insertions, 10 deletions
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index b3ab8ffebd27..89d85d244926 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c | |||
@@ -2611,19 +2611,19 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) | |||
2611 | if (irq < 0) | 2611 | if (irq < 0) |
2612 | return irq; | 2612 | return irq; |
2613 | 2613 | ||
2614 | set_irq_msi(irq, desc); | ||
2615 | ret = msi_compose_msg(dev, irq, &msg); | 2614 | ret = msi_compose_msg(dev, irq, &msg); |
2616 | if (ret < 0) { | 2615 | if (ret < 0) { |
2617 | destroy_irq(irq); | 2616 | destroy_irq(irq); |
2618 | return ret; | 2617 | return ret; |
2619 | } | 2618 | } |
2620 | 2619 | ||
2620 | set_irq_msi(irq, desc); | ||
2621 | write_msi_msg(irq, &msg); | 2621 | write_msi_msg(irq, &msg); |
2622 | 2622 | ||
2623 | set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, | 2623 | set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, |
2624 | "edge"); | 2624 | "edge"); |
2625 | 2625 | ||
2626 | return irq; | 2626 | return 0; |
2627 | } | 2627 | } |
2628 | 2628 | ||
2629 | void arch_teardown_msi_irq(unsigned int irq) | 2629 | void arch_teardown_msi_irq(unsigned int irq) |
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c index 49873aa4a37d..83f190ffe350 100644 --- a/arch/ia64/sn/kernel/msi_sn.c +++ b/arch/ia64/sn/kernel/msi_sn.c | |||
@@ -87,7 +87,6 @@ int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry) | |||
87 | if (irq < 0) | 87 | if (irq < 0) |
88 | return irq; | 88 | return irq; |
89 | 89 | ||
90 | set_irq_msi(irq, entry); | ||
91 | /* | 90 | /* |
92 | * Set up the vector plumbing. Let the prom (via sn_intr_alloc) | 91 | * Set up the vector plumbing. Let the prom (via sn_intr_alloc) |
93 | * decide which cpu to direct this msi at by default. | 92 | * decide which cpu to direct this msi at by default. |
@@ -144,10 +143,11 @@ int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry) | |||
144 | */ | 143 | */ |
145 | msg.data = 0x100 + irq; | 144 | msg.data = 0x100 + irq; |
146 | 145 | ||
146 | set_irq_msi(irq, entry); | ||
147 | write_msi_msg(irq, &msg); | 147 | write_msi_msg(irq, &msg); |
148 | set_irq_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq); | 148 | set_irq_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq); |
149 | 149 | ||
150 | return irq; | 150 | return 0; |
151 | } | 151 | } |
152 | 152 | ||
153 | #ifdef CONFIG_SMP | 153 | #ifdef CONFIG_SMP |
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index 023af41ad68d..9a549547cb2b 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c | |||
@@ -1092,10 +1092,10 @@ int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) | |||
1092 | return -EINVAL; | 1092 | return -EINVAL; |
1093 | 1093 | ||
1094 | err = p->setup_msi_irq(&virt_irq, pdev, desc); | 1094 | err = p->setup_msi_irq(&virt_irq, pdev, desc); |
1095 | if (err < 0) | 1095 | if (err) |
1096 | return err; | 1096 | return err; |
1097 | 1097 | ||
1098 | return virt_irq; | 1098 | return 0; |
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | void arch_teardown_msi_irq(unsigned int virt_irq) | 1101 | void arch_teardown_msi_irq(unsigned int virt_irq) |
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 94295c219329..1ccf4c9a9a43 100644 --- a/arch/sparc64/kernel/pci_sun4v.c +++ b/arch/sparc64/kernel/pci_sun4v.c | |||
@@ -1169,8 +1169,6 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p, | |||
1169 | if (!devino) | 1169 | if (!devino) |
1170 | goto out_err; | 1170 | goto out_err; |
1171 | 1171 | ||
1172 | set_irq_msi(*virt_irq_p, entry); | ||
1173 | |||
1174 | msiqid = ((devino - pbm->msiq_first_devino) + | 1172 | msiqid = ((devino - pbm->msiq_first_devino) + |
1175 | pbm->msiq_first); | 1173 | pbm->msiq_first); |
1176 | 1174 | ||
@@ -1204,6 +1202,8 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p, | |||
1204 | msg.address_lo = pbm->msi32_start; | 1202 | msg.address_lo = pbm->msi32_start; |
1205 | } | 1203 | } |
1206 | msg.data = msi_num; | 1204 | msg.data = msi_num; |
1205 | |||
1206 | set_irq_msi(*virt_irq_p, entry); | ||
1207 | write_msi_msg(*virt_irq_p, &msg); | 1207 | write_msi_msg(*virt_irq_p, &msg); |
1208 | 1208 | ||
1209 | irq_install_pre_handler(*virt_irq_p, | 1209 | irq_install_pre_handler(*virt_irq_p, |
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index c6a5bc7e8118..b7d2b76b92d4 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c | |||
@@ -1983,18 +1983,18 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) | |||
1983 | if (irq < 0) | 1983 | if (irq < 0) |
1984 | return irq; | 1984 | return irq; |
1985 | 1985 | ||
1986 | set_irq_msi(irq, desc); | ||
1987 | ret = msi_compose_msg(dev, irq, &msg); | 1986 | ret = msi_compose_msg(dev, irq, &msg); |
1988 | if (ret < 0) { | 1987 | if (ret < 0) { |
1989 | destroy_irq(irq); | 1988 | destroy_irq(irq); |
1990 | return ret; | 1989 | return ret; |
1991 | } | 1990 | } |
1992 | 1991 | ||
1992 | set_irq_msi(irq, desc); | ||
1993 | write_msi_msg(irq, &msg); | 1993 | write_msi_msg(irq, &msg); |
1994 | 1994 | ||
1995 | set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge"); | 1995 | set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge"); |
1996 | 1996 | ||
1997 | return irq; | 1997 | return 0; |
1998 | } | 1998 | } |
1999 | 1999 | ||
2000 | void arch_teardown_msi_irq(unsigned int irq) | 2000 | void arch_teardown_msi_irq(unsigned int irq) |