[tip:irq/core] powerpc: Irq: Use generic_handle_irq

2014-03-04 Thread tip-bot for Thomas Gleixner
Commit-ID:  a4e04c9f219d2c00764ffa7ba45500411815879d
Gitweb: http://git.kernel.org/tip/a4e04c9f219d2c00764ffa7ba45500411815879d
Author: Thomas Gleixner t...@linutronix.de
AuthorDate: Sun, 23 Feb 2014 21:40:08 +
Committer:  Thomas Gleixner t...@linutronix.de
CommitDate: Tue, 4 Mar 2014 17:37:52 +0100

powerpc: Irq: Use generic_handle_irq

No functional change

Signed-off-by: Thomas Gleixner t...@linutronix.de
Cc: Peter Zijlstra pet...@infradead.org
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: ppc linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/20140223212736.333718...@linutronix.de
Signed-off-by: Thomas Gleixner t...@linutronix.de
---
 arch/powerpc/kernel/irq.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 1d0848b..ca1cd74 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -465,7 +465,6 @@ static inline void check_stack_overflow(void)
 
 void __do_irq(struct pt_regs *regs)
 {
-   struct irq_desc *desc;
unsigned int irq;
 
irq_enter();
@@ -487,11 +486,8 @@ void __do_irq(struct pt_regs *regs)
/* And finally process it */
if (unlikely(irq == NO_IRQ))
__get_cpu_var(irq_stat).spurious_irqs++;
-   else {
-   desc = irq_to_desc(irq);
-   if (likely(desc))
-   desc-handle_irq(irq, desc);
-   }
+   else
+   generic_handle_irq(irq);
 
trace_irq_exit(regs);
 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[tip:irq/core] powerpc:eVh_pic: Kill irq_desc abuse

2014-03-04 Thread tip-bot for Thomas Gleixner
Commit-ID:  c866cda47f2c6c8abb929933b7794e9a92d7c924
Gitweb: http://git.kernel.org/tip/c866cda47f2c6c8abb929933b7794e9a92d7c924
Author: Thomas Gleixner t...@linutronix.de
AuthorDate: Sun, 23 Feb 2014 21:40:08 +
Committer:  Thomas Gleixner t...@linutronix.de
CommitDate: Tue, 4 Mar 2014 17:37:51 +0100

powerpc:eVh_pic: Kill irq_desc abuse

I'm really grumpy about this one. The line:

#include ../../../kernel/irq/settings.h

should have been an alarm sign for all people who added their SOB to
this trainwreck.

When I cleaned up the mess people made with interrupt descriptors a
few years ago, I warned that I'm going to hunt down new offenders and
treat them with stinking trouts. In this case I'll use frozen shark
for a better educational value.

The whole idiocy which was done there could have been avoided with two
lines of perfectly fine code. And do not complain about the lack of
correct examples in tree.

The solution is simple:

  Remove the brainfart and use the proper functions, which should
  have been used in the first place

Signed-off-by: Thomas Gleixner t...@linutronix.de
Cc: Peter Zijlstra pet...@infradead.org
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: Ashish Kalra ashish.ka...@freescale.com
Cc: Timur Tabi ti...@freescale.com
Cc: Kumar Gala ga...@kernel.crashing.org
Cc: ppc linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/20140223212736.451970...@linutronix.de
Signed-off-by: Thomas Gleixner t...@linutronix.de
---
 arch/powerpc/sysdev/ehv_pic.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c
index b74085c..2d20f10 100644
--- a/arch/powerpc/sysdev/ehv_pic.c
+++ b/arch/powerpc/sysdev/ehv_pic.c
@@ -28,8 +28,6 @@
 #include asm/ehv_pic.h
 #include asm/fsl_hcalls.h
 
-#include ../../../kernel/irq/settings.h
-
 static struct ehv_pic *global_ehv_pic;
 static DEFINE_SPINLOCK(ehv_pic_lock);
 
@@ -113,17 +111,13 @@ static unsigned int ehv_pic_type_to_vecpri(unsigned int 
type)
 int ehv_pic_set_irq_type(struct irq_data *d, unsigned int flow_type)
 {
unsigned int src = virq_to_hw(d-irq);
-   struct irq_desc *desc = irq_to_desc(d-irq);
unsigned int vecpri, vold, vnew, prio, cpu_dest;
unsigned long flags;
 
if (flow_type == IRQ_TYPE_NONE)
flow_type = IRQ_TYPE_LEVEL_LOW;
 
-   irq_settings_clr_level(desc);
-   irq_settings_set_trigger_mask(desc, flow_type);
-   if (flow_type  (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW))
-   irq_settings_set_level(desc);
+   irqd_set_trigger_type(d, flow_type);
 
vecpri = ehv_pic_type_to_vecpri(flow_type);
 
@@ -144,7 +138,7 @@ int ehv_pic_set_irq_type(struct irq_data *d, unsigned int 
flow_type)
ev_int_set_config(src, vecpri, prio, cpu_dest);
 
spin_unlock_irqrestore(ehv_pic_lock, flags);
-   return 0;
+   return IRQ_SET_MASK_OK_NOCOPY;
 }
 
 static struct irq_chip ehv_pic_irq_chip = {
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[tip:irq/core] powerpc: Eeh: Kill another abuse of irq_desc

2014-03-04 Thread tip-bot for Thomas Gleixner
Commit-ID:  b8a9a11b976810ba12a43c4fe699a14892c97e52
Gitweb: http://git.kernel.org/tip/b8a9a11b976810ba12a43c4fe699a14892c97e52
Author: Thomas Gleixner t...@linutronix.de
AuthorDate: Sun, 23 Feb 2014 21:40:09 +
Committer:  Thomas Gleixner t...@linutronix.de
CommitDate: Tue, 4 Mar 2014 17:37:52 +0100

powerpc: Eeh: Kill another abuse of irq_desc

commit 91150af3a (powerpc/eeh: Fix unbalanced enable for IRQ) is
another brilliant example of trainwreck engineering.

The patch fixes the issue of an unbalanced call to irq_enable()
which causes a prominent warning by checking the disabled state of the
interrupt line and call conditionally into the core code.

This is wrong in two aspects:

1) The warning is there to tell users, that they need to fix their
   asymetric enable/disable patterns by finding the root cause and
   solving it there.

   It's definitely not meant to work around it by conditionally
   calling into the core code depending on the random state of the irq
   line.

   Asymetric irq_disable/enable calls are a clear sign of wrong usage
   of the interfaces which have to be cured at the root and not by
   somehow hacking around it.

2) The abuse of core internal data structure instead of using the
   proper interfaces for retrieving the information for the 'hack
   around'

   irq_desc is core internal and it's clear enough stated.

Replace at least the irq_desc abuse with the proper functions and add
a big fat comment why this is absurd and completely wrong.

Signed-off-by: Thomas Gleixner t...@linutronix.de
Cc: Peter Zijlstra pet...@infradead.org
Cc: Gavin Shan sha...@linux.vnet.ibm.com
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: ppc linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/20140223212736.562906...@linutronix.de
Signed-off-by: Thomas Gleixner t...@linutronix.de
---
 arch/powerpc/kernel/eeh_driver.c | 26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index fdc679d..3e1d7de 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -143,15 +143,31 @@ static void eeh_disable_irq(struct pci_dev *dev)
 static void eeh_enable_irq(struct pci_dev *dev)
 {
struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
-   struct irq_desc *desc;
 
if ((edev-mode)  EEH_DEV_IRQ_DISABLED) {
edev-mode = ~EEH_DEV_IRQ_DISABLED;
-
-   desc = irq_to_desc(dev-irq);
-   if (desc  desc-depth  0)
+   /*
+* FIXME !
+*
+* This is just ass backwards. This maze has
+* unbalanced irq_enable/disable calls. So instead of
+* finding the root cause it works around the warning
+* in the irq_enable code by conditionally calling
+* into it.
+*
+* That's just wrong.The warning in the core code is
+* there to tell people to fix their assymetries in
+* their own code, not by abusing the core information
+* to avoid it.
+*
+* I so wish that the assymetry would be the other way
+* round and a few more irq_disable calls render that
+* shit unusable forever.
+*
+*  tglx
+*/
+   if (irqd_irq_disabled(irq_get_irq_data(dev-irq))
enable_irq(dev-irq);
-   }
 }
 
 /**
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[tip:irq/core] powerpc: eeh: Fixup the brown paperbag fallout of the cleanup

2014-03-04 Thread tip-bot for Thomas Gleixner
Commit-ID:  57310c3c99eb6fab2ecbd63aa3f7c323341ca77e
Gitweb: http://git.kernel.org/tip/57310c3c99eb6fab2ecbd63aa3f7c323341ca77e
Author: Thomas Gleixner t...@linutronix.de
AuthorDate: Wed, 5 Mar 2014 00:06:11 +0100
Committer:  Thomas Gleixner t...@linutronix.de
CommitDate: Wed, 5 Mar 2014 00:13:33 +0100

powerpc: eeh: Fixup the brown paperbag fallout of the cleanup

Commit b8a9a11b9 (powerpc: eeh: Kill another abuse of irq_desc) is
missing some brackets .

It's not a good idea to write patches in grumpy mode and then forget
to at least compile test them or rely on the few eyeballs discussing
that patch to spot it.

Reported-by: fengguang...@intel.com
Signed-off-by: Thomas Gleixner t...@linutronix.de
Cc: Peter Zijlstra pet...@infradead.org
Cc: Gavin Shan sha...@linux.vnet.ibm.com
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: ppc linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/kernel/eeh_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index 3e1d7de..bb61ca5 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -166,8 +166,9 @@ static void eeh_enable_irq(struct pci_dev *dev)
 *
 *  tglx
 */
-   if (irqd_irq_disabled(irq_get_irq_data(dev-irq))
+   if (irqd_irq_disabled(irq_get_irq_data(dev-irq)))
enable_irq(dev-irq);
+   }
 }
 
 /**
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[tip:irq/urgent] genirq: Deal with desc-set_type() changing desc-chip

2010-06-09 Thread tip-bot for Thomas Gleixner
Commit-ID:  4673247562e39a17e09440fa1400819522ccd446
Gitweb: http://git.kernel.org/tip/4673247562e39a17e09440fa1400819522ccd446
Author: Thomas Gleixner t...@linutronix.de
AuthorDate: Mon, 7 Jun 2010 17:53:51 +0200
Committer:  Thomas Gleixner t...@linutronix.de
CommitDate: Wed, 9 Jun 2010 17:05:08 +0200

genirq: Deal with desc-set_type() changing desc-chip

The set_type() function can change the chip implementation when the
trigger mode changes. That might result in using an non-initialized
irq chip when called from __setup_irq() or when called via
set_irq_type() on an already enabled irq. 

The set_irq_type() function should not be called on an enabled irq,
but because we forgot to put a check into it, we have a bunch of users
which grew the habit of doing that and it never blew up as the
function is serialized via desc-lock against all users of desc-chip
and they never hit the non-initialized irq chip issue.

The easy fix for the __setup_irq() issue would be to move the
irq_chip_set_defaults(desc-chip) call after the trigger setting to
make sure that a chip change is covered.

But as we have already users, which do the type setting after
request_irq(), the safe fix for now is to call irq_chip_set_defaults()
from __irq_set_trigger() when desc-set_type() changed the irq chip.

It needs a deeper analysis whether we should refuse to change the chip
on an already enabled irq, but that'd be a large scale change to fix
all the existing users. So that's neither stable nor 2.6.35 material.

Reported-by: Esben Haabendal e...@doredevelopment.dk
Signed-off-by: Thomas Gleixner t...@linutronix.de
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: linuxppc-dev linuxppc-...@ozlabs.org
Cc: sta...@kernel.org
---
 kernel/irq/manage.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 3164ba7..e149748 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -456,6 +456,9 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int 
irq,
/* note that IRQF_TRIGGER_MASK == IRQ_TYPE_SENSE_MASK */
desc-status = ~(IRQ_LEVEL | IRQ_TYPE_SENSE_MASK);
desc-status |= flags;
+
+   if (chip != desc-chip)
+   irq_chip_set_defaults(desc-chip);
}
 
return ret;
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev