From c442ef96bfe1a981d44dd09d49a1eed93b94e82a Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Tue, 28 Sep 2010 12:19:24 -0400 Subject: [PATCH 01/16] parisc: squelch warning when using dev_get_stats And switch to struct rtnl_link_stats64... Signed-off-by: Kyle McMartin --- drivers/parisc/led.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index c5c14dd3734f..2350e8a86eef 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c @@ -346,8 +346,8 @@ static __inline__ int led_get_net_activity(void) #ifndef CONFIG_NET return 0; #else - static unsigned long rx_total_last, tx_total_last; - unsigned long rx_total, tx_total; + static u64 rx_total_last, tx_total_last; + u64 rx_total, tx_total; struct net_device *dev; int retval; @@ -356,7 +356,7 @@ static __inline__ int led_get_net_activity(void) /* we are running as a workqueue task, so we can use an RCU lookup */ rcu_read_lock(); for_each_netdev_rcu(&init_net, dev) { - const struct net_device_stats *stats; + const struct rtnl_link_stats64 *stats; struct rtnl_link_stats64 temp; struct in_device *in_dev = __in_dev_get_rcu(dev); if (!in_dev || !in_dev->ifa_list) From caf96194c05cd97ce96546fbcb1f35ec06aaaac7 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Wed, 13 Oct 2010 20:35:56 -0400 Subject: [PATCH 02/16] parisc: add prlimit64 syscall Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/unistd.h | 3 ++- arch/parisc/kernel/syscall_table.S | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h index 1ce7d2851d90..3eb82c2a5ec3 100644 --- a/arch/parisc/include/asm/unistd.h +++ b/arch/parisc/include/asm/unistd.h @@ -813,8 +813,9 @@ #define __NR_perf_event_open (__NR_Linux + 318) #define __NR_recvmmsg (__NR_Linux + 319) #define __NR_accept4 (__NR_Linux + 320) +#define __NR_prlimit64 (__NR_Linux + 321) -#define __NR_Linux_syscalls (__NR_accept4 + 1) +#define __NR_Linux_syscalls (__NR_prlimit64 + 1) #define __IGNORE_select /* newselect */ diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 3d52c978738f..74867dfdabe5 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S @@ -419,6 +419,7 @@ ENTRY_SAME(perf_event_open) ENTRY_COMP(recvmmsg) ENTRY_SAME(accept4) /* 320 */ + ENTRY_SAME(prlimit64) /* Nothing yet */ From ba20085c20f1c9e8af546dea6ad0efa421bdef32 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Wed, 13 Oct 2010 21:00:55 -0400 Subject: [PATCH 03/16] parisc: lay groundwork for killing __do_IRQ Use proper accessors and handlers for generic irq cleanups. We just call back into __do_IRQ through desc->handler now, and remove the explicit calls. Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/irq.h | 3 +++ arch/parisc/kernel/irq.c | 26 ++++++++++++++++---------- drivers/parisc/dino.c | 8 +++----- drivers/parisc/eisa.c | 8 ++++---- drivers/parisc/gsc.c | 15 ++++++--------- drivers/parisc/iosapic.c | 15 ++++----------- drivers/parisc/superio.c | 6 ++---- 7 files changed, 38 insertions(+), 43 deletions(-) diff --git a/arch/parisc/include/asm/irq.h b/arch/parisc/include/asm/irq.h index dfa26b67f919..47041d448d32 100644 --- a/arch/parisc/include/asm/irq.h +++ b/arch/parisc/include/asm/irq.h @@ -32,6 +32,9 @@ static __inline__ int irq_canonicalize(int irq) } struct irq_chip; +struct irq_desc; + +extern void parisc_do_IRQ(unsigned int irq, struct irq_desc *desc); /* * Some useful "we don't have to do anything here" handlers. Should diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c index efbcee5d2220..272c29a44f2a 100644 --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c @@ -151,7 +151,7 @@ static struct irq_chip cpu_interrupt_type = { .enable = cpu_enable_irq, .disable = cpu_disable_irq, .ack = cpu_ack_irq, - .end = cpu_end_irq, + .eoi = cpu_end_irq, #ifdef CONFIG_SMP .set_affinity = cpu_set_affinity_irq, #endif @@ -247,10 +247,11 @@ int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data) if (irq_desc[irq].chip != &cpu_interrupt_type) return -EBUSY; + /* for iosapic interrupts */ if (type) { - irq_desc[irq].chip = type; - irq_desc[irq].chip_data = data; - cpu_interrupt_type.enable(irq); + set_irq_chip_and_handler(irq, type, parisc_do_IRQ); + set_irq_chip_data(irq, data); + cpu_enable_irq(irq); } return 0; } @@ -368,7 +369,7 @@ void do_cpu_irq_mask(struct pt_regs *regs) goto set_out; } #endif - __do_IRQ(irq); + generic_handle_irq(irq); out: irq_exit(); @@ -398,14 +399,14 @@ static void claim_cpu_irqs(void) { int i; for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) { - irq_desc[i].chip = &cpu_interrupt_type; + set_irq_chip_and_handler(i, &cpu_interrupt_type, parisc_do_IRQ); } - irq_desc[TIMER_IRQ].action = &timer_action; - irq_desc[TIMER_IRQ].status = IRQ_PER_CPU; + set_irq_handler(TIMER_IRQ, handle_percpu_irq); + setup_irq(TIMER_IRQ, &timer_action); #ifdef CONFIG_SMP - irq_desc[IPI_IRQ].action = &ipi_action; - irq_desc[IPI_IRQ].status = IRQ_PER_CPU; + set_irq_handler(IPI_IRQ, handle_percpu_irq); + setup_irq(IPI_IRQ, &ipi_action); #endif } @@ -423,3 +424,8 @@ void __init init_IRQ(void) set_eiem(cpu_eiem); /* EIEM : enable all external intr */ } + +void parisc_do_IRQ(unsigned int irq, struct irq_desc *desc) +{ + __do_IRQ(irq); +} diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index c542c7bb7454..3013c57f1217 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c @@ -298,8 +298,7 @@ static struct pci_port_ops dino_port_ops = { static void dino_disable_irq(unsigned int irq) { - struct irq_desc *desc = irq_to_desc(irq); - struct dino_device *dino_dev = desc->chip_data; + struct dino_device *dino_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq); @@ -311,8 +310,7 @@ static void dino_disable_irq(unsigned int irq) static void dino_enable_irq(unsigned int irq) { - struct irq_desc *desc = irq_to_desc(irq); - struct dino_device *dino_dev = desc->chip_data; + struct dino_device *dino_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); u32 tmp; @@ -391,7 +389,7 @@ ilr_again: int irq = dino_dev->global_irq[local_irq]; DBG(KERN_DEBUG "%s(%d, %p) mask 0x%x\n", __func__, irq, intr_dev, mask); - __do_IRQ(irq); + generic_handle_irq(irq); mask &= ~(1 << local_irq); } while (mask); diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c index 46f503fb7fc5..585417702211 100644 --- a/drivers/parisc/eisa.c +++ b/drivers/parisc/eisa.c @@ -233,7 +233,7 @@ static irqreturn_t eisa_irq(int wax_irq, void *intr_dev) } spin_unlock_irqrestore(&eisa_irq_lock, flags); - __do_IRQ(irq); + generic_handle_irq(irq); spin_lock_irqsave(&eisa_irq_lock, flags); /* unmask */ @@ -346,10 +346,10 @@ static int __init eisa_probe(struct parisc_device *dev) } /* Reserve IRQ2 */ - irq_to_desc(2)->action = &irq2_action; - + setup_irq(2, &irq2_action); for (i = 0; i < 16; i++) { - irq_to_desc(i)->chip = &eisa_interrupt_type; + set_irq_chip_and_handler(i, &eisa_interrupt_type, + parisc_do_IRQ); } EISA_bus = 1; diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c index 20a1bce1a031..68bccdafa897 100644 --- a/drivers/parisc/gsc.c +++ b/drivers/parisc/gsc.c @@ -86,7 +86,7 @@ irqreturn_t gsc_asic_intr(int gsc_asic_irq, void *dev) do { int local_irq = __ffs(irr); unsigned int irq = gsc_asic->global_irq[local_irq]; - __do_IRQ(irq); + generic_handle_irq(irq); irr &= ~(1 << local_irq); } while (irr); @@ -107,8 +107,7 @@ int gsc_find_local_irq(unsigned int irq, int *global_irqs, int limit) static void gsc_asic_disable_irq(unsigned int irq) { - struct irq_desc *desc = irq_to_desc(irq); - struct gsc_asic *irq_dev = desc->chip_data; + struct gsc_asic *irq_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); u32 imr; @@ -123,8 +122,7 @@ static void gsc_asic_disable_irq(unsigned int irq) static void gsc_asic_enable_irq(unsigned int irq) { - struct irq_desc *desc = irq_to_desc(irq); - struct gsc_asic *irq_dev = desc->chip_data; + struct gsc_asic *irq_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); u32 imr; @@ -160,14 +158,13 @@ static struct irq_chip gsc_asic_interrupt_type = { int gsc_assign_irq(struct irq_chip *type, void *data) { static int irq = GSC_IRQ_BASE; - struct irq_desc *desc; if (irq > GSC_IRQ_MAX) return NO_IRQ; - desc = irq_to_desc(irq); - desc->chip = type; - desc->chip_data = data; + set_irq_chip_and_handler(irq, type, parisc_do_IRQ); + set_irq_chip_data(irq, data); + return irq++; } diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index c76836727cae..10348c9a22c9 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -615,17 +615,10 @@ iosapic_set_irt_data( struct vector_info *vi, u32 *dp0, u32 *dp1) } -static struct vector_info *iosapic_get_vector(unsigned int irq) -{ - struct irq_desc *desc = irq_to_desc(irq); - - return desc->chip_data; -} - static void iosapic_disable_irq(unsigned int irq) { unsigned long flags; - struct vector_info *vi = iosapic_get_vector(irq); + struct vector_info *vi = get_irq_chip_data(irq); u32 d0, d1; spin_lock_irqsave(&iosapic_lock, flags); @@ -637,7 +630,7 @@ static void iosapic_disable_irq(unsigned int irq) static void iosapic_enable_irq(unsigned int irq) { - struct vector_info *vi = iosapic_get_vector(irq); + struct vector_info *vi = get_irq_chip_data(irq); u32 d0, d1; /* data is initialized by fixup_irq */ @@ -688,7 +681,7 @@ printk("\n"); */ static void iosapic_end_irq(unsigned int irq) { - struct vector_info *vi = iosapic_get_vector(irq); + struct vector_info *vi = get_irq_chip_data(irq); DBG(KERN_DEBUG "end_irq(%d): eoi(%p, 0x%x)\n", irq, vi->eoi_addr, vi->eoi_data); iosapic_eoi(vi->eoi_addr, vi->eoi_data); @@ -705,7 +698,7 @@ static unsigned int iosapic_startup_irq(unsigned int irq) static int iosapic_set_affinity_irq(unsigned int irq, const struct cpumask *dest) { - struct vector_info *vi = iosapic_get_vector(irq); + struct vector_info *vi = get_irq_chip_data(irq); u32 d0, d1, dummy_d0; unsigned long flags; int dest_cpu; diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index f7806d81f1e0..aceec6ed5116 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c @@ -139,7 +139,7 @@ superio_interrupt(int parent_irq, void *devp) } /* Call the appropriate device's interrupt */ - __do_IRQ(local_irq); + generic_handle_irq(local_irq); /* set EOI - forces a new interrupt if a lower priority device * still needs service. @@ -363,9 +363,7 @@ int superio_fixup_irq(struct pci_dev *pcidev) #endif for (i = 0; i < 16; i++) { - struct irq_desc *desc = irq_to_desc(i); - - desc->chip = &superio_interrupt_type; + set_irq_chip_and_handler(i, &superio_interrupt_type, parisc_do_IRQ); } /* From 4d4f681dc43a06167763ec698f5de4f2b3119ad6 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 14 Oct 2010 00:12:23 -0400 Subject: [PATCH 04/16] parisc: convert cpu interrupts to proper flow handlers Only major change is renaming functions to match the conventions expected by the generic irq code. Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/irq.h | 2 +- arch/parisc/kernel/irq.c | 25 +++++++++---------------- drivers/parisc/iosapic.c | 2 +- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/arch/parisc/include/asm/irq.h b/arch/parisc/include/asm/irq.h index 47041d448d32..3a9b2498fd1c 100644 --- a/arch/parisc/include/asm/irq.h +++ b/arch/parisc/include/asm/irq.h @@ -43,7 +43,7 @@ extern void parisc_do_IRQ(unsigned int irq, struct irq_desc *desc); void no_ack_irq(unsigned int irq); void no_end_irq(unsigned int irq); void cpu_ack_irq(unsigned int irq); -void cpu_end_irq(unsigned int irq); +void cpu_eoi_irq(unsigned int irq); extern int txn_alloc_irq(unsigned int nbits); extern int txn_claim_irq(int); diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c index 272c29a44f2a..13bfa9702fd3 100644 --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c @@ -52,7 +52,7 @@ static volatile unsigned long cpu_eiem = 0; */ static DEFINE_PER_CPU(unsigned long, local_ack_eiem) = ~0UL; -static void cpu_disable_irq(unsigned int irq) +static void cpu_mask_irq(unsigned int irq) { unsigned long eirr_bit = EIEM_MASK(irq); @@ -63,7 +63,7 @@ static void cpu_disable_irq(unsigned int irq) * then gets disabled */ } -static void cpu_enable_irq(unsigned int irq) +static void cpu_unmask_irq(unsigned int irq) { unsigned long eirr_bit = EIEM_MASK(irq); @@ -75,12 +75,6 @@ static void cpu_enable_irq(unsigned int irq) smp_send_all_nop(); } -static unsigned int cpu_startup_irq(unsigned int irq) -{ - cpu_enable_irq(irq); - return 0; -} - void no_ack_irq(unsigned int irq) { } void no_end_irq(unsigned int irq) { } @@ -99,7 +93,7 @@ void cpu_ack_irq(unsigned int irq) mtctl(mask, 23); } -void cpu_end_irq(unsigned int irq) +void cpu_eoi_irq(unsigned int irq) { unsigned long mask = EIEM_MASK(irq); int cpu = smp_processor_id(); @@ -146,12 +140,10 @@ static int cpu_set_affinity_irq(unsigned int irq, const struct cpumask *dest) static struct irq_chip cpu_interrupt_type = { .name = "CPU", - .startup = cpu_startup_irq, - .shutdown = cpu_disable_irq, - .enable = cpu_enable_irq, - .disable = cpu_disable_irq, + .mask = cpu_mask_irq, + .unmask = cpu_unmask_irq, .ack = cpu_ack_irq, - .eoi = cpu_end_irq, + .eoi = cpu_eoi_irq, #ifdef CONFIG_SMP .set_affinity = cpu_set_affinity_irq, #endif @@ -251,7 +243,7 @@ int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data) if (type) { set_irq_chip_and_handler(irq, type, parisc_do_IRQ); set_irq_chip_data(irq, data); - cpu_enable_irq(irq); + cpu_unmask_irq(irq); } return 0; } @@ -399,7 +391,8 @@ static void claim_cpu_irqs(void) { int i; for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) { - set_irq_chip_and_handler(i, &cpu_interrupt_type, parisc_do_IRQ); + set_irq_chip_and_handler(i, &cpu_interrupt_type, + handle_level_irq); } set_irq_handler(TIMER_IRQ, handle_percpu_irq); diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 10348c9a22c9..13020881d08a 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -685,7 +685,7 @@ static void iosapic_end_irq(unsigned int irq) DBG(KERN_DEBUG "end_irq(%d): eoi(%p, 0x%x)\n", irq, vi->eoi_addr, vi->eoi_data); iosapic_eoi(vi->eoi_addr, vi->eoi_data); - cpu_end_irq(irq); + cpu_eoi_irq(irq); } static unsigned int iosapic_startup_irq(unsigned int irq) From f3d4605977f9f30993c670a85f75d8f3853144c5 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 14 Oct 2010 00:38:27 -0400 Subject: [PATCH 05/16] parisc: convert iosapic interrupts to proper flow handlers Shift the ->end call (cpu eoi) from __do_IRQ into our unmask handler. Also nuke some redundant code. Signed-off-by: Kyle McMartin --- arch/parisc/kernel/irq.c | 2 +- drivers/parisc/iosapic.c | 37 ++++++------------------------------- 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c index 13bfa9702fd3..e873edaf2747 100644 --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c @@ -241,7 +241,7 @@ int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data) /* for iosapic interrupts */ if (type) { - set_irq_chip_and_handler(irq, type, parisc_do_IRQ); + set_irq_chip_and_handler(irq, type, handle_level_irq); set_irq_chip_data(irq, data); cpu_unmask_irq(irq); } diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 13020881d08a..edab2941e1d5 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -615,7 +615,7 @@ iosapic_set_irt_data( struct vector_info *vi, u32 *dp0, u32 *dp1) } -static void iosapic_disable_irq(unsigned int irq) +static void iosapic_mask_irq(unsigned int irq) { unsigned long flags; struct vector_info *vi = get_irq_chip_data(irq); @@ -628,7 +628,7 @@ static void iosapic_disable_irq(unsigned int irq) spin_unlock_irqrestore(&iosapic_lock, flags); } -static void iosapic_enable_irq(unsigned int irq) +static void iosapic_unmask_irq(unsigned int irq) { struct vector_info *vi = get_irq_chip_data(irq); u32 d0, d1; @@ -669,31 +669,9 @@ printk("\n"); DBG(KERN_DEBUG "enable_irq(%d): eoi(%p, 0x%x)\n", irq, vi->eoi_addr, vi->eoi_data); iosapic_eoi(vi->eoi_addr, vi->eoi_data); -} - -/* - * PARISC only supports PCI devices below I/O SAPIC. - * PCI only supports level triggered in order to share IRQ lines. - * ergo I/O SAPIC must always issue EOI on parisc. - * - * i386/ia64 support ISA devices and have to deal with - * edge-triggered interrupts too. - */ -static void iosapic_end_irq(unsigned int irq) -{ - struct vector_info *vi = get_irq_chip_data(irq); - DBG(KERN_DEBUG "end_irq(%d): eoi(%p, 0x%x)\n", irq, - vi->eoi_addr, vi->eoi_data); - iosapic_eoi(vi->eoi_addr, vi->eoi_data); cpu_eoi_irq(irq); } -static unsigned int iosapic_startup_irq(unsigned int irq) -{ - iosapic_enable_irq(irq); - return 0; -} - #ifdef CONFIG_SMP static int iosapic_set_affinity_irq(unsigned int irq, const struct cpumask *dest) @@ -723,13 +701,10 @@ static int iosapic_set_affinity_irq(unsigned int irq, #endif static struct irq_chip iosapic_interrupt_type = { - .name = "IO-SAPIC-level", - .startup = iosapic_startup_irq, - .shutdown = iosapic_disable_irq, - .enable = iosapic_enable_irq, - .disable = iosapic_disable_irq, - .ack = cpu_ack_irq, - .end = iosapic_end_irq, + .name = "IO-SAPIC-level", + .unmask = iosapic_unmask_irq, + .mask = iosapic_mask_irq, + .ack = cpu_ack_irq, #ifdef CONFIG_SMP .set_affinity = iosapic_set_affinity_irq, #endif From 14ff626a64f1c6848b303254be00b1b2ff33a655 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 14 Oct 2010 00:53:17 -0400 Subject: [PATCH 06/16] parisc: convert suckyio interrupts to flow handlers No big deal, just need to convert the suckyio interrupts to be a nested handler instead of request_irq the suckyio device in the future. Signed-off-by: Kyle McMartin --- drivers/parisc/superio.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index aceec6ed5116..0846dafdfff1 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c @@ -286,7 +286,7 @@ superio_init(struct pci_dev *pcidev) } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO, superio_init); -static void superio_disable_irq(unsigned int irq) +static void superio_mask_irq(unsigned int irq) { u8 r8; @@ -303,7 +303,7 @@ static void superio_disable_irq(unsigned int irq) outb (r8,IC_PIC1+1); } -static void superio_enable_irq(unsigned int irq) +static void superio_unmask_irq(unsigned int irq) { u8 r8; @@ -319,20 +319,11 @@ static void superio_enable_irq(unsigned int irq) outb (r8,IC_PIC1+1); } -static unsigned int superio_startup_irq(unsigned int irq) -{ - superio_enable_irq(irq); - return 0; -} - static struct irq_chip superio_interrupt_type = { - .name = SUPERIO, - .startup = superio_startup_irq, - .shutdown = superio_disable_irq, - .enable = superio_enable_irq, - .disable = superio_disable_irq, + .name = SUPERIO, + .unmask = superio_unmask_irq, + .mask = superio_mask_irq, .ack = no_ack_irq, - .end = no_end_irq, }; #ifdef DEBUG_SUPERIO_INIT @@ -363,7 +354,7 @@ int superio_fixup_irq(struct pci_dev *pcidev) #endif for (i = 0; i < 16; i++) { - set_irq_chip_and_handler(i, &superio_interrupt_type, parisc_do_IRQ); + set_irq_chip_and_handler(i, &superio_interrupt_type, handle_level_irq); } /* From 7998b3bd156478c35de685f90d4d0dda57916c60 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 14 Oct 2010 00:58:53 -0400 Subject: [PATCH 07/16] parisc: convert gsc and dino pci interrupts to flow handlers Signed-off-by: Kyle McMartin --- drivers/parisc/dino.c | 21 ++++++--------------- drivers/parisc/gsc.c | 23 +++++++---------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index 3013c57f1217..d9f51485beee 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c @@ -296,7 +296,7 @@ static struct pci_port_ops dino_port_ops = { .outl = dino_out32 }; -static void dino_disable_irq(unsigned int irq) +static void dino_mask_irq(unsigned int irq) { struct dino_device *dino_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); @@ -308,7 +308,7 @@ static void dino_disable_irq(unsigned int irq) __raw_writel(dino_dev->imr, dino_dev->hba.base_addr+DINO_IMR); } -static void dino_enable_irq(unsigned int irq) +static void dino_unmask_irq(unsigned int irq) { struct dino_device *dino_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); @@ -345,20 +345,11 @@ static void dino_enable_irq(unsigned int irq) } } -static unsigned int dino_startup_irq(unsigned int irq) -{ - dino_enable_irq(irq); - return 0; -} - static struct irq_chip dino_interrupt_type = { - .name = "GSC-PCI", - .startup = dino_startup_irq, - .shutdown = dino_disable_irq, - .enable = dino_enable_irq, - .disable = dino_disable_irq, - .ack = no_ack_irq, - .end = no_end_irq, + .name = "GSC-PCI", + .unmask = dino_unmask_irq, + .mask = dino_mask_irq, + .ack = no_ack_irq, }; diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c index 68bccdafa897..e605298e3aee 100644 --- a/drivers/parisc/gsc.c +++ b/drivers/parisc/gsc.c @@ -105,7 +105,7 @@ int gsc_find_local_irq(unsigned int irq, int *global_irqs, int limit) return NO_IRQ; } -static void gsc_asic_disable_irq(unsigned int irq) +static void gsc_asic_mask_irq(unsigned int irq) { struct gsc_asic *irq_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); @@ -120,7 +120,7 @@ static void gsc_asic_disable_irq(unsigned int irq) gsc_writel(imr, irq_dev->hpa + OFFSET_IMR); } -static void gsc_asic_enable_irq(unsigned int irq) +static void gsc_asic_unmask_irq(unsigned int irq) { struct gsc_asic *irq_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); @@ -139,20 +139,11 @@ static void gsc_asic_enable_irq(unsigned int irq) */ } -static unsigned int gsc_asic_startup_irq(unsigned int irq) -{ - gsc_asic_enable_irq(irq); - return 0; -} - static struct irq_chip gsc_asic_interrupt_type = { - .name = "GSC-ASIC", - .startup = gsc_asic_startup_irq, - .shutdown = gsc_asic_disable_irq, - .enable = gsc_asic_enable_irq, - .disable = gsc_asic_disable_irq, - .ack = no_ack_irq, - .end = no_end_irq, + .name = "GSC-ASIC", + .unmask = gsc_asic_unmask_irq, + .mask = gsc_asic_mask_irq, + .ack = no_ack_irq, }; int gsc_assign_irq(struct irq_chip *type, void *data) @@ -162,7 +153,7 @@ int gsc_assign_irq(struct irq_chip *type, void *data) if (irq > GSC_IRQ_MAX) return NO_IRQ; - set_irq_chip_and_handler(irq, type, parisc_do_IRQ); + set_irq_chip_and_handler(irq, type, handle_level_irq); set_irq_chip_data(irq, data); return irq++; From 8ed5c00d7c166f505eb2e8ff47748bfa73824130 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 14 Oct 2010 01:00:51 -0400 Subject: [PATCH 08/16] parisc: convert eisa interrupts to flow handlers Signed-off-by: Kyle McMartin --- drivers/parisc/eisa.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c index 585417702211..1211974f55aa 100644 --- a/drivers/parisc/eisa.c +++ b/drivers/parisc/eisa.c @@ -144,7 +144,7 @@ static unsigned int eisa_irq_level __read_mostly; /* default to edge triggered * /* called by free irq */ -static void eisa_disable_irq(unsigned int irq) +static void eisa_mask_irq(unsigned int irq) { unsigned long flags; @@ -164,7 +164,7 @@ static void eisa_disable_irq(unsigned int irq) } /* called by request irq */ -static void eisa_enable_irq(unsigned int irq) +static void eisa_unmask_irq(unsigned int irq) { unsigned long flags; EISA_DBG("enable irq %d\n", irq); @@ -182,20 +182,11 @@ static void eisa_enable_irq(unsigned int irq) EISA_DBG("pic1 mask %02x\n", eisa_in8(0xa1)); } -static unsigned int eisa_startup_irq(unsigned int irq) -{ - eisa_enable_irq(irq); - return 0; -} - static struct irq_chip eisa_interrupt_type = { - .name = "EISA", - .startup = eisa_startup_irq, - .shutdown = eisa_disable_irq, - .enable = eisa_enable_irq, - .disable = eisa_disable_irq, - .ack = no_ack_irq, - .end = no_end_irq, + .name = "EISA", + .unmask = eisa_unmask_irq, + .mask = eisa_mask_irq, + .ack = no_ack_irq, }; static irqreturn_t eisa_irq(int wax_irq, void *intr_dev) @@ -349,7 +340,7 @@ static int __init eisa_probe(struct parisc_device *dev) setup_irq(2, &irq2_action); for (i = 0; i < 16; i++) { set_irq_chip_and_handler(i, &eisa_interrupt_type, - parisc_do_IRQ); + handle_level_irq); } EISA_bus = 1; From 7da1272547ebe96982a42292dfc833457708f4da Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 14 Oct 2010 01:02:23 -0400 Subject: [PATCH 09/16] parisc: kill __do_IRQ Signed-off-by: Kyle McMartin --- arch/parisc/Kconfig | 4 ++++ arch/parisc/include/asm/irq.h | 3 --- arch/parisc/kernel/irq.c | 4 ---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 907417d187e1..2cb6401fc8a2 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -18,6 +18,7 @@ config PARISC select BUG select HAVE_PERF_EVENTS select GENERIC_ATOMIC64 if !64BIT + select GENERIC_HARDIRQS_NO__DO_IRQ help The PA-RISC microprocessor is designed by Hewlett-Packard and used in many of their workstations & servers (HP9000 700 and 800 series, @@ -84,6 +85,9 @@ config IRQ_PER_CPU bool default y +config GENERIC_HARDIRQS_NO__DO_IRQ + def_bool y + # unless you want to implement ACPI on PA-RISC ... ;-) config PM bool diff --git a/arch/parisc/include/asm/irq.h b/arch/parisc/include/asm/irq.h index 3a9b2498fd1c..c67dccf2e31f 100644 --- a/arch/parisc/include/asm/irq.h +++ b/arch/parisc/include/asm/irq.h @@ -32,9 +32,6 @@ static __inline__ int irq_canonicalize(int irq) } struct irq_chip; -struct irq_desc; - -extern void parisc_do_IRQ(unsigned int irq, struct irq_desc *desc); /* * Some useful "we don't have to do anything here" handlers. Should diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c index e873edaf2747..5024f643b3b1 100644 --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c @@ -418,7 +418,3 @@ void __init init_IRQ(void) } -void parisc_do_IRQ(unsigned int irq, struct irq_desc *desc) -{ - __do_IRQ(irq); -} From 338e4fab3d41aa14264e10ce505a7c908633cdad Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Wed, 20 Oct 2010 15:55:45 -0700 Subject: [PATCH 10/16] drivers/char/agp/parisc-agp.c: eliminate memory leak alloc_pci_dev allocates some memory, so that memory should be freed before leaving the function in an error case. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @r exists@ local idexpression x; expression E; identifier f1; iterator I; @@ x = alloc_pci_dev(...); <... when != x when != true (x == NULL || ...) when != if (...) { <+...x...+> } when != I (...) { <+...x...+> } ( x == NULL | x == E | x->f1 ) ...> * return ...; // Signed-off-by: Julia Lawall Dan Carpenter Dave Airlie Cc: Helge Deller Cc: "James E.J. Bottomley" Signed-off-by: Andrew Morton Signed-off-by: Kyle McMartin --- drivers/char/agp/parisc-agp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index 1c129211302d..17e380f5f818 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -358,8 +358,12 @@ parisc_agp_setup(void __iomem *ioc_hpa, void __iomem *lba_hpa) bridge->dev = fake_bridge_dev; error = agp_add_bridge(bridge); + if (error) + goto fail; + return 0; fail: + kfree(fake_bridge_dev); return error; } From f720817700de48a57f54535a5dd9783cca2d2d6b Mon Sep 17 00:00:00 2001 From: matt mooney Date: Wed, 22 Sep 2010 23:51:05 -0700 Subject: [PATCH 11/16] parisc: change to new flag variable Replace EXTRA_CFLAGS with ccflags-y. Signed-off-by: matt mooney Signed-off-by: Kyle McMartin --- arch/parisc/math-emu/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/parisc/math-emu/Makefile b/arch/parisc/math-emu/Makefile index 1f3f225897f5..0bd63b08a79a 100644 --- a/arch/parisc/math-emu/Makefile +++ b/arch/parisc/math-emu/Makefile @@ -3,7 +3,7 @@ # # See arch/parisc/math-emu/README -EXTRA_CFLAGS += -Wno-parentheses -Wno-implicit-function-declaration \ +ccflags-y := -Wno-parentheses -Wno-implicit-function-declaration \ -Wno-uninitialized -Wno-strict-prototypes -Wno-return-type \ -Wno-implicit-int From b1b1d4a6f244eb9513f006a188f7ed30d5014de5 Mon Sep 17 00:00:00 2001 From: Phil Carmody Date: Fri, 10 Sep 2010 13:47:59 +0300 Subject: [PATCH 12/16] parisc: unwind - optimise linked-list searches for modules Having many dozens of modules, the searches down the linked list of sections would dominate the lookup time, dwarfing any savings from the binary search within the section. A simple move-to-front optimisation exploits the commonality of the code paths taken, and in simple real-world tests on other architectures reduced the number of steps in the search to barely more than 1. Signed-off-by: Phil Carmody Signed-off-by: Kyle McMartin --- arch/parisc/kernel/unwind.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c index d58eac1a8288..76ed62ed785b 100644 --- a/arch/parisc/kernel/unwind.c +++ b/arch/parisc/kernel/unwind.c @@ -80,8 +80,11 @@ find_unwind_entry(unsigned long addr) if (addr >= table->start && addr <= table->end) e = find_unwind_entry_in_table(table, addr); - if (e) + if (e) { + /* Move-to-front to exploit common traces */ + list_move(&table->list, &unwind_tables); break; + } } return e; From 2da83b90bbbac586fca2735f7da21966a31ec33f Mon Sep 17 00:00:00 2001 From: Christian Dietrich Date: Mon, 6 Sep 2010 16:36:06 +0200 Subject: [PATCH 13/16] arch/parisc: Removing undead ifdef CONFIG_PA20 The CONFIG_PA20 ifdef isn't necessary at this point, because it is checked in an outer ifdef level already and has no effect here. Signed-off-by: Christian Dietrich Signed-off-by: Kyle McMartin --- arch/parisc/kernel/unaligned.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c index 92d977bb5ea8..234e3682cf09 100644 --- a/arch/parisc/kernel/unaligned.c +++ b/arch/parisc/kernel/unaligned.c @@ -619,15 +619,12 @@ void handle_unaligned(struct pt_regs *regs) flop=1; ret = emulate_std(regs, R2(regs->iir),1); break; - -#ifdef CONFIG_PA20 case OPCODE_LDD_L: ret = emulate_ldd(regs, R2(regs->iir),0); break; case OPCODE_STD_L: ret = emulate_std(regs, R2(regs->iir),0); break; -#endif } #endif switch (regs->iir & OPCODE3_MASK) From b97680c419b75b0c2cf6837a9f268e2ecbaf50f6 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 29 Jun 2010 16:29:04 +0900 Subject: [PATCH 14/16] parisc: remove homegrown L1_CACHE_ALIGN macro Let's use the standard L1_CACHE_ALIGN macro instead. Signed-off-by: FUJITA Tomonori Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/cache.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/parisc/include/asm/cache.h b/arch/parisc/include/asm/cache.h index 039880e7d2c9..47f11c707b65 100644 --- a/arch/parisc/include/asm/cache.h +++ b/arch/parisc/include/asm/cache.h @@ -24,8 +24,6 @@ #ifndef __ASSEMBLY__ -#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) - #define SMP_CACHE_BYTES L1_CACHE_BYTES #define ARCH_DMA_MINALIGN L1_CACHE_BYTES From f8301041d7bdca3197d718518242eeba0c75352f Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 31 May 2010 20:23:16 -0700 Subject: [PATCH 15/16] drivers/parisc/iosapic.c: Remove unnecessary kzalloc cast Convert kzalloc to kcalloc Signed-off-by: Joe Perches Reviewed-by: Grant Grundler Signed-off-by: Kyle McMartin --- drivers/parisc/iosapic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index edab2941e1d5..a3120a09c43d 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -859,8 +859,8 @@ void *iosapic_register(unsigned long hpa) isi->isi_version = iosapic_rd_version(isi); isi->isi_num_vectors = IOSAPIC_IRDT_MAX_ENTRY(isi->isi_version) + 1; - vip = isi->isi_vector = (struct vector_info *) - kzalloc(sizeof(struct vector_info) * isi->isi_num_vectors, GFP_KERNEL); + vip = isi->isi_vector = kcalloc(isi->isi_num_vectors, + sizeof(struct vector_info), GFP_KERNEL); if (vip == NULL) { kfree(isi); return NULL; From 650a35f868f809aade56ef960d8a465f57ac74e2 Mon Sep 17 00:00:00 2001 From: Guy Martin Date: Mon, 14 Jun 2010 19:24:41 +0200 Subject: [PATCH 16/16] parisc: add tty driver to PDC console This patch adds a tty driver to the PDC console. It allows the use of ports not supported by linux as a console (e.g. serial port on C8000.) The tty driver will not register the ttyB device if PDC console driver has been unregistered. This happens when the early printk console is disabled as it has not been selected as the primary console. Signed-off-by: Guy Martin Signed-off-by: Kyle McMartin --- arch/parisc/kernel/pdc_cons.c | 141 ++++++++++++++++++++++++++++++++-- 1 file changed, 134 insertions(+), 7 deletions(-) diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c index 1ff366cb9685..66d1f17fdb94 100644 --- a/arch/parisc/kernel/pdc_cons.c +++ b/arch/parisc/kernel/pdc_cons.c @@ -12,6 +12,7 @@ * Copyright (C) 2001 Helge Deller * Copyright (C) 2001 Thomas Bogendoerfer * Copyright (C) 2002 Randolph Chung + * Copyright (C) 2010 Guy Martin * * * This program is free software; you can redistribute it and/or modify @@ -31,12 +32,11 @@ /* * The PDC console is a simple console, which can be used for debugging - * boot related problems on HP PA-RISC machines. + * boot related problems on HP PA-RISC machines. It is also useful when no + * other console works. * * This code uses the ROM (=PDC) based functions to read and write characters * from and to PDC's boot path. - * Since all character read from that path must be polled, this code never - * can or will be a fully functional linux console. */ /* Define EARLY_BOOTUP_DEBUG to debug kernel related boot problems. @@ -53,6 +53,7 @@ #include /* for iodc_call() proto and friends */ static DEFINE_SPINLOCK(pdc_console_lock); +static struct console pdc_cons; static void pdc_console_write(struct console *co, const char *s, unsigned count) { @@ -85,12 +86,138 @@ static int pdc_console_setup(struct console *co, char *options) #if defined(CONFIG_PDC_CONSOLE) #include +#include + +#define PDC_CONS_POLL_DELAY (30 * HZ / 1000) + +static struct timer_list pdc_console_timer; + +extern struct console * console_drivers; + +static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp) +{ + + mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY); + + return 0; +} + +static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp) +{ + if (!tty->count) + del_timer(&pdc_console_timer); +} + +static int pdc_console_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) +{ + pdc_console_write(NULL, buf, count); + return count; +} + +static int pdc_console_tty_write_room(struct tty_struct *tty) +{ + return 32768; /* no limit, no buffer used */ +} + +static int pdc_console_tty_chars_in_buffer(struct tty_struct *tty) +{ + return 0; /* no buffer */ +} + +static struct tty_driver *pdc_console_tty_driver; + +static const struct tty_operations pdc_console_tty_ops = { + .open = pdc_console_tty_open, + .close = pdc_console_tty_close, + .write = pdc_console_tty_write, + .write_room = pdc_console_tty_write_room, + .chars_in_buffer = pdc_console_tty_chars_in_buffer, +}; + +static void pdc_console_poll(unsigned long unused) +{ + + int data, count = 0; + + struct tty_struct *tty = pdc_console_tty_driver->ttys[0]; + + if (!tty) + return; + + while (1) { + data = pdc_console_poll_key(NULL); + if (data == -1) + break; + tty_insert_flip_char(tty, data & 0xFF, TTY_NORMAL); + count ++; + } + + if (count) + tty_flip_buffer_push(tty); + + if (tty->count && (pdc_cons.flags & CON_ENABLED)) + mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY); +} + +static int __init pdc_console_tty_driver_init(void) +{ + + int err; + struct tty_driver *drv; + + /* Check if the console driver is still registered. + * It is unregistered if the pdc console was not selected as the + * primary console. */ + + struct console *tmp = console_drivers; + + for (tmp = console_drivers; tmp; tmp = tmp->next) + if (tmp == &pdc_cons) + break; + + if (!tmp) { + printk(KERN_INFO "PDC console driver not registered anymore, not creating %s\n", pdc_cons.name); + return -ENODEV; + } + + printk(KERN_INFO "The PDC console driver is still registered, removing CON_BOOT flag\n"); + pdc_cons.flags &= ~CON_BOOT; + + drv = alloc_tty_driver(1); + + if (!drv) + return -ENOMEM; + + drv->driver_name = "pdc_cons"; + drv->name = "ttyB"; + drv->major = MUX_MAJOR; + drv->minor_start = 0; + drv->type = TTY_DRIVER_TYPE_SYSTEM; + drv->init_termios = tty_std_termios; + drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS; + tty_set_operations(drv, &pdc_console_tty_ops); + + err = tty_register_driver(drv); + if (err) { + printk(KERN_ERR "Unable to register the PDC console TTY driver\n"); + return err; + } + + pdc_console_tty_driver = drv; + + /* No need to initialize the pdc_console_timer if tty isn't allocated */ + init_timer(&pdc_console_timer); + pdc_console_timer.function = pdc_console_poll; + + return 0; +} + +module_init(pdc_console_tty_driver_init); static struct tty_driver * pdc_console_device (struct console *c, int *index) { - extern struct tty_driver console_driver; - *index = c->index ? c->index-1 : fg_console; - return &console_driver; + *index = c->index; + return pdc_console_tty_driver; } #else #define pdc_console_device NULL @@ -101,7 +228,7 @@ static struct console pdc_cons = { .write = pdc_console_write, .device = pdc_console_device, .setup = pdc_console_setup, - .flags = CON_BOOT | CON_PRINTBUFFER | CON_ENABLED, + .flags = CON_BOOT | CON_PRINTBUFFER, .index = -1, };