From 8d57d3ad0c4641bc6b720160215c907a3d1004a0 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 22 Oct 2007 02:16:45 -0700 Subject: [SPARC64]: Stop using __do_IRQ(). Invoke the desc->handle_irq directly in the top-level dispatch, just like other sophisticated ports. This will allow us to decrease the cost of the MSI queue dispatch. Signed-off-by: David S. Miller --- arch/sparc64/kernel/irq.c | 85 +++++++++++++++++++------------------------ arch/sparc64/kernel/pci_msi.c | 14 +++++-- 2 files changed, 49 insertions(+), 50 deletions(-) (limited to 'arch/sparc64/kernel') diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index 2c3bea228159..30431bd24e1e 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c @@ -257,8 +257,8 @@ struct irq_handler_data { unsigned long imap; void (*pre_handler)(unsigned int, void *, void *); - void *pre_handler_arg1; - void *pre_handler_arg2; + void *arg1; + void *arg2; }; #ifdef CONFIG_SMP @@ -346,7 +346,7 @@ static void sun4u_irq_disable(unsigned int virt_irq) } } -static void sun4u_irq_end(unsigned int virt_irq) +static void sun4u_irq_eoi(unsigned int virt_irq) { struct irq_handler_data *data = get_irq_chip_data(virt_irq); struct irq_desc *desc = irq_desc + virt_irq; @@ -401,7 +401,7 @@ static void sun4v_irq_disable(unsigned int virt_irq) "err(%d)\n", ino, err); } -static void sun4v_irq_end(unsigned int virt_irq) +static void sun4v_irq_eoi(unsigned int virt_irq) { unsigned int ino = virt_irq_table[virt_irq].dev_ino; struct irq_desc *desc = irq_desc + virt_irq; @@ -478,7 +478,7 @@ static void sun4v_virq_disable(unsigned int virt_irq) dev_handle, dev_ino, err); } -static void sun4v_virq_end(unsigned int virt_irq) +static void sun4v_virq_eoi(unsigned int virt_irq) { struct irq_desc *desc = irq_desc + virt_irq; unsigned long dev_handle, dev_ino; @@ -498,33 +498,11 @@ static void sun4v_virq_end(unsigned int virt_irq) dev_handle, dev_ino, err); } -static void run_pre_handler(unsigned int virt_irq) -{ - struct irq_handler_data *data = get_irq_chip_data(virt_irq); - unsigned int ino; - - ino = virt_irq_table[virt_irq].dev_ino; - if (likely(data->pre_handler)) { - data->pre_handler(ino, - data->pre_handler_arg1, - data->pre_handler_arg2); - } -} - static struct irq_chip sun4u_irq = { .typename = "sun4u", .enable = sun4u_irq_enable, .disable = sun4u_irq_disable, - .end = sun4u_irq_end, - .set_affinity = sun4u_set_affinity, -}; - -static struct irq_chip sun4u_irq_ack = { - .typename = "sun4u+ack", - .enable = sun4u_irq_enable, - .disable = sun4u_irq_disable, - .ack = run_pre_handler, - .end = sun4u_irq_end, + .eoi = sun4u_irq_eoi, .set_affinity = sun4u_set_affinity, }; @@ -532,7 +510,7 @@ static struct irq_chip sun4v_irq = { .typename = "sun4v", .enable = sun4v_irq_enable, .disable = sun4v_irq_disable, - .end = sun4v_irq_end, + .eoi = sun4v_irq_eoi, .set_affinity = sun4v_set_affinity, }; @@ -540,31 +518,33 @@ static struct irq_chip sun4v_virq = { .typename = "vsun4v", .enable = sun4v_virq_enable, .disable = sun4v_virq_disable, - .end = sun4v_virq_end, + .eoi = sun4v_virq_eoi, .set_affinity = sun4v_virt_set_affinity, }; +static void fastcall pre_flow_handler(unsigned int virt_irq, + struct irq_desc *desc) +{ + struct irq_handler_data *data = get_irq_chip_data(virt_irq); + unsigned int ino = virt_irq_table[virt_irq].dev_ino; + + data->pre_handler(ino, data->arg1, data->arg2); + + handle_fasteoi_irq(virt_irq, desc); +} + void irq_install_pre_handler(int virt_irq, void (*func)(unsigned int, void *, void *), void *arg1, void *arg2) { struct irq_handler_data *data = get_irq_chip_data(virt_irq); - struct irq_chip *chip = get_irq_chip(virt_irq); - - if (WARN_ON(chip == &sun4v_irq || chip == &sun4v_virq)) { - printk(KERN_ERR "IRQ: Trying to install pre-handler on " - "sun4v irq %u\n", virt_irq); - return; - } + struct irq_desc *desc = irq_desc + virt_irq; data->pre_handler = func; - data->pre_handler_arg1 = arg1; - data->pre_handler_arg2 = arg2; - - if (chip == &sun4u_irq_ack) - return; + data->arg1 = arg1; + data->arg2 = arg2; - set_irq_chip(virt_irq, &sun4u_irq_ack); + desc->handle_irq = pre_flow_handler; } unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap) @@ -582,7 +562,10 @@ unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap) if (!virt_irq) { virt_irq = virt_irq_alloc(0, ino); bucket_set_virt_irq(__pa(bucket), virt_irq); - set_irq_chip(virt_irq, &sun4u_irq); + set_irq_chip_and_handler_name(virt_irq, + &sun4u_irq, + handle_fasteoi_irq, + "IVEC"); } data = get_irq_chip_data(virt_irq); @@ -617,7 +600,9 @@ static unsigned int sun4v_build_common(unsigned long sysino, if (!virt_irq) { virt_irq = virt_irq_alloc(0, sysino); bucket_set_virt_irq(__pa(bucket), virt_irq); - set_irq_chip(virt_irq, chip); + set_irq_chip_and_handler_name(virt_irq, chip, + handle_fasteoi_irq, + "IVEC"); } data = get_irq_chip_data(virt_irq); @@ -665,7 +650,10 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino) virt_irq = virt_irq_alloc(devhandle, devino); bucket_set_virt_irq(__pa(bucket), virt_irq); - set_irq_chip(virt_irq, &sun4v_virq); + + set_irq_chip_and_handler_name(virt_irq, &sun4v_virq, + handle_fasteoi_irq, + "IVEC"); data = kzalloc(sizeof(struct irq_handler_data), GFP_ATOMIC); if (unlikely(!data)) @@ -724,6 +712,7 @@ void handler_irq(int irq, struct pt_regs *regs) : "memory"); while (bucket_pa) { + struct irq_desc *desc; unsigned long next_pa; unsigned int virt_irq; @@ -731,7 +720,9 @@ void handler_irq(int irq, struct pt_regs *regs) virt_irq = bucket_get_virt_irq(bucket_pa); bucket_clear_chain_pa(bucket_pa); - __do_IRQ(virt_irq); + desc = irq_desc + virt_irq; + + desc->handle_irq(virt_irq, desc); bucket_pa = next_pa; } diff --git a/arch/sparc64/kernel/pci_msi.c b/arch/sparc64/kernel/pci_msi.c index 31a165fd3e48..d6d64b44af63 100644 --- a/arch/sparc64/kernel/pci_msi.c +++ b/arch/sparc64/kernel/pci_msi.c @@ -28,8 +28,15 @@ static irqreturn_t sparc64_msiq_interrupt(int irq, void *cookie) unsigned long msi; err = ops->dequeue_msi(pbm, msiqid, &head, &msi); - if (likely(err > 0)) - __do_IRQ(pbm->msi_irq_table[msi - pbm->msi_first]); + if (likely(err > 0)) { + struct irq_desc *desc; + unsigned int virt_irq; + + virt_irq = pbm->msi_irq_table[msi - pbm->msi_first]; + desc = irq_desc + virt_irq; + + desc->handle_irq(virt_irq, desc); + } if (unlikely(err < 0)) goto err_dequeue; @@ -128,7 +135,8 @@ int sparc64_setup_msi_irq(unsigned int *virt_irq_p, if (!*virt_irq_p) goto out_err; - set_irq_chip(*virt_irq_p, &msi_irq); + set_irq_chip_and_handler_name(*virt_irq_p, &msi_irq, + handle_simple_irq, "MSI"); err = alloc_msi(pbm); if (unlikely(err < 0)) -- cgit v1.2.3-59-g8ed1b From 1d3e07f7d0f97321121849fc064fb293b83db9ef Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 22 Oct 2007 02:32:10 -0700 Subject: [SPARC64]: small Makefile cleanups A few trivial Makefile cleanups - dependencipes in head.o was all wrong - deleted - CMODEL_CFLAG was not used anywhere - NEW_GCC was then not used outside sparc64/Makefe - do not export it - FIXME seems not appropriate - all other put oprofile in drivers-y too - No reason to do -I. (and it still builds) Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc64/Makefile | 4 ---- arch/sparc64/kernel/Makefile | 9 --------- arch/sparc64/math-emu/Makefile | 2 +- 3 files changed, 1 insertion(+), 14 deletions(-) (limited to 'arch/sparc64/kernel') diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile index 6c92a42efe76..01159cb5f16d 100644 --- a/arch/sparc64/Makefile +++ b/arch/sparc64/Makefile @@ -18,8 +18,6 @@ NEW_GCC := $(call cc-option-yn, -m64 -mcmodel=medlow) NEW_GAS := $(shell if $(LD) -V 2>&1 | grep 'elf64_sparc' > /dev/null; then echo y; else echo n; fi) UNDECLARED_REGS := $(shell if $(CC) -c -x assembler /dev/null -Wa,--help | grep undeclared-regs > /dev/null; then echo y; else echo n; fi; ) -export NEW_GCC - ifneq ($(NEW_GAS),y) AS = sparc64-linux-as LD = sparc64-linux-ld @@ -58,8 +56,6 @@ core-y += arch/sparc64/kernel/ arch/sparc64/mm/ core-$(CONFIG_SOLARIS_EMUL) += arch/sparc64/solaris/ core-y += arch/sparc64/math-emu/ libs-y += arch/sparc64/prom/ arch/sparc64/lib/ - -# FIXME: is drivers- right? drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/ boot := arch/sparc64/boot diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile index 112c46e66578..ef50d217432f 100644 --- a/arch/sparc64/kernel/Makefile +++ b/arch/sparc64/kernel/Makefile @@ -39,12 +39,3 @@ else obj-y += sys_sunos32.o sunos_ioctl32.o endif endif - -ifneq ($(NEW_GCC),y) - CMODEL_CFLAG := -mmedlow -else - CMODEL_CFLAG := -m64 -mcmodel=medlow -endif - -head.o: head.S ttable.S itlb_miss.S dtlb_miss.S ktlb.S tsb.S \ - etrap.S rtrap.S winfixup.S entry.S diff --git a/arch/sparc64/math-emu/Makefile b/arch/sparc64/math-emu/Makefile index a0b06fd29467..cc5cb9baf6aa 100644 --- a/arch/sparc64/math-emu/Makefile +++ b/arch/sparc64/math-emu/Makefile @@ -4,4 +4,4 @@ obj-y := math.o -EXTRA_CFLAGS = -I. -Iinclude/math-emu -w +EXTRA_CFLAGS = -Iinclude/math-emu -w -- cgit v1.2.3-59-g8ed1b From 29f139ce27c7e64a3e8575afa8deb46cde09db0a Mon Sep 17 00:00:00 2001 From: Alejandro Martinez Ruiz Date: Mon, 22 Oct 2007 17:24:19 -0700 Subject: [SPARC64]: ARRAY_SIZE() cleanup Signed-off-by: Alejandro Martinez Ruiz Signed-off-by: David S. Miller --- arch/sparc64/kernel/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch/sparc64/kernel') diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index 9b808640a193..63b3ebc0c3c2 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c @@ -207,8 +207,7 @@ static struct { { "SUNW,sun4v-pci", sun4v_pci_init }, { "pciex108e,80f0", fire_pci_init }, }; -#define PCI_NUM_CONTROLLER_TYPES (sizeof(pci_controller_table) / \ - sizeof(pci_controller_table[0])) +#define PCI_NUM_CONTROLLER_TYPES ARRAY_SIZE(pci_controller_table) static int __init pci_controller_init(const char *model_name, int namelen, struct device_node *dp) { -- cgit v1.2.3-59-g8ed1b