1. 30 3月, 2012 1 次提交
  2. 16 3月, 2012 1 次提交
  3. 14 3月, 2012 1 次提交
    • I
      genirq: Flush the irq thread on synchronization · 7140ea19
      Ido Yariv 提交于
      The current implementation does not always flush the threaded handler
      when disabling the irq. In case the irq handler was called, but the
      threaded handler hasn't started running yet, the interrupt will be
      flagged as pending, and the handler will not run. This implementation
      has some issues:
      
      First, if the interrupt is a wake source and flagged as pending, the
      system will not be able to suspend.
      
      Second, when quickly disabling and re-enabling the irq, the threaded
      handler might continue to run after the irq is re-enabled without the
      irq handler being called first. This might be an unexpected behavior.
      
      In addition, it might be counter-intuitive that the threaded handler
      will not be called even though the irq handler was called and returned
      IRQ_WAKE_THREAD.
      
      Fix this by always waiting for the threaded handler to complete in
      synchronize_irq().
      
      [ tglx: Massaged comments, added WARN_ONs and the missing
        	IRQTF_RUNTHREAD check in exit_irq_thread() ]
      Signed-off-by: NIdo Yariv <ido@wizery.com>
      Link: http://lkml.kernel.org/r/1322843052-7166-1-git-send-email-ido@wizery.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      7140ea19
  4. 10 3月, 2012 4 次提交
  5. 07 3月, 2012 1 次提交
  6. 06 3月, 2012 1 次提交
    • R
      genirq: Fix long-term regression in genirq irq_set_irq_type() handling · a09b659c
      Russell King 提交于
      In 2008, commit 0c5d1eb7 ("genirq: record trigger type") modified the
      way set_irq_type() handles the 'no trigger' condition.  However, this has
      an adverse effect on PCMCIA support on Intel StrongARM and probably PXA
      platforms.
      
      PCMCIA has several status signals on the socket which can trigger
      interrupts; some of these status signals depend on the card's mode
      (whether it is configured in memory or IO mode).  For example, cards have
      a 'Ready/IRQ' signal: in memory mode, this provides an indication to
      PCMCIA that the card has finished its power up initialization.  In IO
      mode, it provides the device interrupt signal.  Other status signals
      switch between on-board battery status and loud speaker output.
      
      In classical PCMCIA implementations, where you have a specific socket
      controller, the controller provides a method to mask interrupts from the
      socket, and importantly ignore any state transitions on the pins which
      correspond with interrupts once masked.  This masking prevents unwanted
      events caused by the removal and application of socket power being
      forwarded.
      
      However, on platforms where there is no socket controller, the PCMCIA
      status and interrupt signals are routed to standard edge-triggered GPIOs. 
      These GPIOs can be configured to interrupt on rising edge, falling edge,
      or never.  This is where the problems start.
      
      Edge triggered interrupts are required to record events while disabled via
      the usual methods of {free,request,disable,enable}_irq() to prevent
      problems with dropped interrupts (eg, the 8390 driver uses disable_irq()
      to defer the delivery of interrupts).  As a result, these interfaces can
      not be used to implement the desired behaviour.
      
      The side effect of this is that if the 'Ready/IRQ' GPIO is disabled via
      disable_irq() on suspend, and enabled via enable_irq() after resume, we
      will record the state transitions caused by powering events as valid
      interrupts, and foward them to the card driver, which may attempt to
      access a card which is not powered up.
      
      This leads delays resume while drivers spin in their interrupt handlers,
      and complaints from drivers before they realize what's happened.
      
      Moreover, in the case of the 'Ready/IRQ' signal, this is requested and
      freed by the card driver itself; the PCMCIA core has no idea whether the
      interrupt is requested, and, therefore, whether a call to disable_irq()
      would be valid.  (We tried this around 2.4.17 / 2.5.1 kernel era, and
      ended up throwing it out because of this problem.)
      
      Therefore, it was decided back in around 2002 to disable the edge
      triggering instead, resulting in all state transitions on the GPIO being
      ignored.  That's what we actually need the hardware to do.
      
      The commit above changes this behaviour; it explicitly prevents the 'no
      trigger' state being selected.
      
      The reason that request_irq() does not accept the 'no trigger' state is
      for compatibility with existing drivers which do not provide their desired
      triggering configuration.  The set_irq_type() function is 'new' and not
      used by non-trigger aware drivers.
      
      Therefore, revert this change, and restore previously working platforms
      back to their former state.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Cc: linux@arm.linux.org.uk
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: stable@vger.kernel.org
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      a09b659c
  7. 25 2月, 2012 1 次提交
    • G
      irq_domain/mips: Allow irq_domain on MIPS · abd2363f
      Grant Likely 提交于
      This patch makes IRQ_DOMAIN usable on MIPS.  It uses an ugly workaround
      to preserve current behaviour so that MIPS has time to add irq_domain
      registration to the irq controller drivers.  The workaround will be
      removed in Linux v3.6
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-mips@linux-mips.org
      abd2363f
  8. 16 2月, 2012 9 次提交
    • G
      irq_domain: constify irq_domain_ops · a18dc81b
      Grant Likely 提交于
      Make irq_domain_ops pointer a constant to make it safer for multiple
      instances to share the same ops pointer and change the irq_domain code
      so that it does not modify the ops.
      
      v4: Fix mismatched type reference in powerpc code
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Milton Miller <miltonm@bga.com>
      Tested-by: NOlof Johansson <olof@lixom.net>
      a18dc81b
    • G
      irq_domain: Create common xlate functions that device drivers can use · 16b2e6e2
      Grant Likely 提交于
      Rather than having each interrupt controller driver creating its own barely
      unique .xlate function for irq_domain, create a library of translators which
      any driver can use directly.
      
      v5: - Remove irq_domain_xlate_pci().  It was incorrect.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Milton Miller <miltonm@bga.com>
      Tested-by: NOlof Johansson <olof@lixom.net>
      16b2e6e2
    • G
      irq_domain: Remove irq_domain_add_simple() · 6b783f7c
      Grant Likely 提交于
      irq_domain_add_simple() was a stop-gap measure until complete irq_domain
      support was complete.  This patch removes the irq_domain_add_simple()
      interface.
      
      This patch also drops the explicit irq_domain initialization performed
      by the mach-versatile code because the versatile interrupt controller
      already has irq_domain support built into it.  This was a bug that was
      hanging around quietly for a while, but with the full irq_domain which
      actually verifies that irq_domain ranges are available it would cause
      the registration to fail and the system wouldn't boot.
      
      v4: Fixed number of irqs in mx5 gpio code
      v2: Updated to pass in host_data pointer on irq_domain allocation.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Milton Miller <miltonm@bga.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Tested-by: NOlof Johansson <olof@lixom.net>
      6b783f7c
    • G
      irq_domain: Remove 'new' irq_domain in favour of the ppc one · 75294957
      Grant Likely 提交于
      This patch removes the simplistic implementation of irq_domains and enables
      the powerpc infrastructure for all irq_domain users.  The powerpc
      infrastructure includes support for complex mappings between Linux and
      hardware irq numbers, and can manage allocation of irq_descs.
      
      This patch also converts the few users of irq_domain_add()/irq_domain_del()
      to call irq_domain_add_legacy() instead.
      
      v3: Fix bug that set up too many irqs in translation range.
      v2: Fix removal of irq_alloc_descs() call in gic driver
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Milton Miller <miltonm@bga.com>
      Tested-by: NOlof Johansson <olof@lixom.net>
      75294957
    • G
      irq_domain: Add support for base irq and hwirq in legacy mappings · 1bc04f2c
      Grant Likely 提交于
      Add support for a legacy mapping where irq = (hwirq - first_hwirq + first_irq)
      so that a controller driver can allocate a fixed range of irq_descs and use
      a simple calculation to translate back and forth between linux and hw irq
      numbers.  This is needed to use an irq_domain with many of the ARM interrupt
      controller drivers that manage their own irq_desc allocations.  Ultimately
      the goal is to migrate those drivers to use the linear revmap, but doing it
      this way allows each driver to be converted separately which makes the
      migration path easier.
      
      This patch generalizes the IRQ_DOMAIN_MAP_LEGACY method to use
      (first_irq-first_hwirq) as the offset between hwirq and linux irq number,
      and adds checks to make sure that the hwirq number does not exceed range
      assigned to the controller.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Milton Miller <miltonm@bga.com>
      Tested-by: NOlof Johansson <olof@lixom.net>
      1bc04f2c
    • G
      irq_domain: Replace irq_alloc_host() with revmap-specific initializers · a8db8cf0
      Grant Likely 提交于
      Each revmap type has different arguments for setting up the revmap.
      This patch splits up the generator functions so that each revmap type
      can do its own setup and the user doesn't need to keep track of how
      each revmap type handles the arguments.
      
      This patch also adds a host_data argument to the generators.  There are
      cases where the host_data pointer will be needed before the function returns.
      ie. the legacy map calls the .map callback for each irq before returning.
      
      v2: - Add void *host_data argument to irq_domain_add_*() functions
          - fixed failure to compile
          - Moved IRQ_DOMAIN_MAP_* defines into irqdomain.c
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Milton Miller <miltonm@bga.com>
      Tested-by: NOlof Johansson <olof@lixom.net>
      a8db8cf0
    • G
      irq_domain: Remove references to old irq_host names · 68700650
      Grant Likely 提交于
      No functional changes.  Replaces non-exported references to 'host' with domain.
      Does not change any symbol names referenced by other .c files.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Milton Miller <miltonm@bga.com>
      Tested-by: NOlof Johansson <olof@lixom.net>
      68700650
    • G
      irq_domain: remove NO_IRQ from irq domain code · 03848373
      Grant Likely 提交于
      zero always means no irq when using irq domains.  Get rid of the NO_IRQ
      references.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Milton Miller <miltonm@bga.com>
      Tested-by: NOlof Johansson <olof@lixom.net>
      03848373
    • G
      irq_domain: Move irq_domain code from powerpc to kernel/irq · cc79ca69
      Grant Likely 提交于
      This patch only moves the code.  It doesn't make any changes, and the
      code is still only compiled for powerpc.  Follow-on patches will generalize
      the code for other architectures.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Milton Miller <miltonm@bga.com>
      Tested-by: NOlof Johansson <olof@lixom.net>
      cc79ca69
  9. 15 2月, 2012 4 次提交
  10. 03 2月, 2012 1 次提交
  11. 13 1月, 2012 1 次提交
  12. 28 12月, 2011 1 次提交
  13. 24 12月, 2011 1 次提交
  14. 02 12月, 2011 1 次提交
    • I
      genirq: Fix race condition when stopping the irq thread · 550acb19
      Ido Yariv 提交于
      In irq_wait_for_interrupt(), the should_stop member is verified before
      setting the task's state to TASK_INTERRUPTIBLE and calling schedule().
      In case kthread_stop sets should_stop and wakes up the process after
      should_stop is checked by the irq thread but before the task's state
      is changed, the irq thread might never exit:
      
      kthread_stop                    irq_wait_for_interrupt
      ------------                    ----------------------
      
                                       ...
      ...                              while (!kthread_should_stop()) {
      kthread->should_stop = 1;
      wake_up_process(k);
      wait_for_completion(&kthread->exited);
      ...
                                           set_current_state(TASK_INTERRUPTIBLE);
      
                                           ...
      
                                           schedule();
                                       }
      
      Fix this by checking if the thread should stop after modifying the
      task's state.
      
      [ tglx: Simplified it a bit ]
      Signed-off-by: NIdo Yariv <ido@wizery.com>
      Link: http://lkml.kernel.org/r/1322740508-22640-1-git-send-email-ido@wizery.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: stable@kernel.org
      550acb19
  15. 29 11月, 2011 1 次提交
  16. 18 11月, 2011 1 次提交
  17. 03 11月, 2011 1 次提交
  18. 01 11月, 2011 2 次提交
    • P
      irq: don't put module.h into irq.h for tracking irqgen modules. · ec53cf23
      Paul Gortmaker 提交于
      Recent commit "irq: Track the  owner of irq descriptor" in
      commit ID b6873807 placed module.h into linux/irq.h
      but we are trying to limit module.h inclusion to just C files
      that really need it, due to its size and number of children
      includes.  This targets just reversing that include.
      
      Add in the basic "struct module" since that is all we really need
      to ensure things compile.  In theory, b6873807 should have added the
      module.h include to the irqdesc.h header as well, but the implicit
      module.h everywhere presence masked this from showing up.  So give
      it the "struct module" as well.
      
      As for the C files, irqdesc.c is only using THIS_MODULE, so it
      does not need module.h - give it export.h instead.  The C file
      irq/manage.c is now (as of b6873807) using try_module_get and
      module_put and so it needs module.h (which it already has).
      
      Also convert the irq_alloc_descs variants to macros, since all
      they really do is is call the __irq_alloc_descs primitive.
      This avoids including export.h and no debug info is lost.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      ec53cf23
    • P
      kernel: Fix files explicitly needing EXPORT_SYMBOL infrastructure · 6e5fdeed
      Paul Gortmaker 提交于
      These files were getting <linux/module.h> via an implicit non-obvious
      path, but we want to crush those out of existence since they cost
      time during compiles of processing thousands of lines of headers
      for no reason.  Give them the lightweight header that just contains
      the EXPORT_SYMBOL infrastructure.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      6e5fdeed
  19. 31 10月, 2011 1 次提交
  20. 30 10月, 2011 1 次提交
  21. 24 10月, 2011 1 次提交
  22. 17 10月, 2011 1 次提交
  23. 05 10月, 2011 1 次提交
  24. 03 10月, 2011 2 次提交
    • M
      genirq: percpu: allow interrupt type to be set at enable time · 1e7c5fd2
      Marc Zyngier 提交于
      As request_percpu_irq() doesn't allow for a percpu interrupt to have
      its type configured (it is generally impossible to configure it on all
      CPUs at once), add a 'type' argument to enable_percpu_irq().
      
      This allows some low-level, board specific init code to be switched to
      a generic API.
      
      [ tglx: Added WARN_ON argument ]
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      1e7c5fd2
    • M
      genirq: Add support for per-cpu dev_id interrupts · 31d9d9b6
      Marc Zyngier 提交于
      The ARM GIC interrupt controller offers per CPU interrupts (PPIs),
      which are usually used to connect local timers to each core. Each CPU
      has its own private interface to the GIC, and only sees the PPIs that
      are directly connect to it.
      
      While these timers are separate devices and have a separate interrupt
      line to a core, they all use the same IRQ number.
      
      For these devices, request_irq() is not the right API as it assumes
      that an IRQ number is visible by a number of CPUs (through the
      affinity setting), but makes it very awkward to express that an IRQ
      number can be handled by all CPUs, and yet be a different interrupt
      line on each CPU, requiring a different dev_id cookie to be passed
      back to the handler.
      
      The *_percpu_irq() functions is designed to overcome these
      limitations, by providing a per-cpu dev_id vector:
      
      int request_percpu_irq(unsigned int irq, irq_handler_t handler,
      		   const char *devname, void __percpu *percpu_dev_id);
      void free_percpu_irq(unsigned int, void __percpu *);
      int setup_percpu_irq(unsigned int irq, struct irqaction *new);
      void remove_percpu_irq(unsigned int irq, struct irqaction *act);
      void enable_percpu_irq(unsigned int irq);
      void disable_percpu_irq(unsigned int irq);
      
      The API has a number of limitations:
      - no interrupt sharing
      - no threading
      - common handler across all the CPUs
      
      Once the interrupt is requested using setup_percpu_irq() or
      request_percpu_irq(), it must be enabled by each core that wishes its
      local interrupt to be delivered.
      
      Based on an initial patch by Thomas Gleixner.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/1316793788-14500-2-git-send-email-marc.zyngier@arm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      31d9d9b6