1. 11 5月, 2016 7 次提交
    • J
      irqchip/gic: Add helper functions for GIC setup and teardown · d6490461
      Jon Hunter 提交于
      Move the code that sets-up a GIC via device-tree into it's own
      function and add a generic function for GIC teardown that can be used
      for both device-tree and ACPI to unmap the GIC memory.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      d6490461
    • J
      irqchip/gic: Store GIC configuration parameters · f673b9b5
      Jon Hunter 提交于
      Store the GIC configuration parameters in the GIC chip data structure.
      This will allow us to simplify the code by reducing the number of
      parameters passed between functions.
      
      Update the __gic_init_bases() function so that we only need to pass a
      pointer to the GIC chip data structure and no longer need to pass the
      GIC index in order to look-up the chip data.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      f673b9b5
    • J
      irqchip/gic: Pass GIC pointer to save/restore functions · 6e5b5924
      Jon Hunter 提交于
      Instead of passing the GIC index to the save/restore functions pass a
      pointer to the GIC chip data. This will allow these save/restore
      functions to be re-used by a platform driver where the GIC chip data
      structure is allocated dynamically and so there is no applicable index
      for identifying the GIC.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      6e5b5924
    • J
      irqchip/gic: Return an error if GIC initialisation fails · dc9722cc
      Jon Hunter 提交于
      If the GIC initialisation fails, then currently we do not return an error
      or clean-up afterwards. Although for root controllers, this failure may be
      fatal anyway, for secondary controllers, it may not be fatal and so return
      an error on failure and clean-up.
      
      Update the functions gic_cpu_init() and gic_pm_init() to return an error
      instead of calling BUG() and perform any necessary clean-up.
      
      For non-banked GIC controllers, make sure that we free any memory
      allocated if we fail to initialise the IRQ domain. Please note that
      free_percpu() only frees memory if the pointer passed to it is not NULL
      and so it is unnecessary to check if both pointers are valid or not.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      dc9722cc
    • J
      irqchip/gic: Remove static irq_chip definition for eoimode1 · c2baa2f3
      Jon Hunter 提交于
      There are only 3 differences (not including the name) in the definitions
      of the gic_chip and gic_eoimode1_chip structures. Instead of statically
      defining the gic_eoimode1_chip structure, remove it and populate the
      eoimode1 functions dynamically for the appropriate GIC irqchips.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      c2baa2f3
    • J
      irqchip/gic: Don't initialise chip if mapping IO space fails · 26acfe74
      Jon Hunter 提交于
      If we fail to map the address space for the GIC distributor or CPU
      interface, then don't attempt to initialise the chip, just WARN and
      return.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      26acfe74
    • W
      irqchip/gic: Ensure ordering between read of INTACK and shared data · f86c4fbd
      Will Deacon 提交于
      When an IPI is generated by a CPU, the pattern looks roughly like:
      
        <write shared data>
        smp_wmb();
        <write to GIC to signal SGI>
      
      On the receiving CPU we rely on the fact that, once we've taken the
      interrupt, then the freshly written shared data must be visible to us.
      Put another way, the CPU isn't going to speculate taking an interrupt.
      
      Unfortunately, this assumption turns out to be broken.
      
      Consider that CPUx wants to send an IPI to CPUy, which will cause CPUy
      to read some shared_data. Before CPUx has done anything, a random
      peripheral raises an IRQ to the GIC and the IRQ line on CPUy is raised.
      CPUy then takes the IRQ and starts executing the entry code, heading
      towards gic_handle_irq. Furthermore, let's assume that a bunch of the
      previous interrupts handled by CPUy were SGIs, so the branch predictor
      kicks in and speculates that irqnr will be <16 and we're likely to
      head into handle_IPI. The prefetcher then grabs a speculative copy of
      shared_data which contains a stale value.
      
      Meanwhile, CPUx gets round to updating shared_data and asking the GIC
      to send an SGI to CPUy. Internally, the GIC decides that the SGI is
      more important than the peripheral interrupt (which hasn't yet been
      ACKed) but doesn't need to do anything to CPUy, because the IRQ line
      is already raised.
      
      CPUy then reads the ACK register on the GIC, sees the SGI value which
      confirms the branch prediction and we end up with a stale shared_data
      value.
      
      This patch fixes the problem by adding an smp_rmb() to the IPI entry
      code in gic_handle_irq. As it turns out, the combination of a control
      dependency and an ISB instruction from the EOI in the GICv3 driver is
      enough to provide the ordering we need, so we add a comment there
      justifying the absence of an explicit smp_rmb().
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      f86c4fbd
  2. 03 5月, 2016 2 次提交
  3. 25 4月, 2016 1 次提交
  4. 19 2月, 2016 1 次提交
  5. 11 2月, 2016 2 次提交
  6. 21 12月, 2015 2 次提交
  7. 18 12月, 2015 1 次提交
    • L
      irqchip/gic: Kconfig the number of instances · a27d21e0
      Linus Walleij 提交于
      There is currently a hack in the GIC driver making it possible
      to pass the number of GIC instances from the platform-specific
      include files and thus override the variable MAX_GIC_NR.
      
      With multiplatform deployments, this will not work as we need
      to get rid of the platform-specific include files.
      
      It turns out that this feature is only used by the RealView
      platform which has a cascaded GIC. So move the configuration
      to Kconfig and bump to 2 instances if we're building for the
      RealView. The include file hacks can then be removed.
      
      Tested on the ARM PB11MPCore with its cascaded GIC.
      Suggested-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      a27d21e0
  8. 16 12月, 2015 3 次提交
    • M
      irqchip/gic: Make interrupt ID 1020 invalid · 327ebe1f
      Marc Zyngier 提交于
      The GIC has no such thing as interrupt 1020: the last valid ID is
      1019, and the range 1020-1023 is reserved - 1023 indicating that
      no interrupt is pending. So let's make sure we don't try to handle
      this ID.
      
      This bug has been in since the initial GIC code was introduced in
      8ad68bbf ("[ARM] Add support for ARM RealView board").
      Reported-by: NEric Auger <eric.auger@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      327ebe1f
    • L
      irqchip/gic: Assign irqchip dynamically · 58b89649
      Linus Walleij 提交于
      Instead of having the irqchip being a static struct, make it part
      of the per-instance data so we can assign it a dynamic name. This
      has the usable side effect of displaying the GIC with an instance
      number as GIC0, GIC1 ... GICn in /proc/interrupts, which is helpful
      when debugging cascaded GICs, such as on the ARM PB11MPCore.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      58b89649
    • L
      irqchip/gic: Support RealView variant setup · 8673c1d7
      Linus Walleij 提交于
      The ARM RealView PB11MPCore reference design has some special
      bits in a system controller register to set up the GIC in one
      of three modes: legacy, new with DCC, new without DCC. The
      register is also used to enable FIQ.
      
      Since the platform will not boot unless this register is set
      up to "new with DCC" mode, we need a special quirk to be
      compiled-in for the RealView platforms.
      
      If we find the right compatible string on the GIC TestChip,
      we enable this quirk by looking up the system controller and
      enabling the special bits.
      
      We depend on the CONFIG_REALVIEW_DT Kconfig symbol as the old
      boardfile code has the same fix hardcoded, and this is only
      needed for the attempts to modernize the RealView code using
      device tree.
      
      After fixing this, the PB11MPCore boots with device tree
      only.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      8673c1d7
  9. 17 11月, 2015 2 次提交
  10. 14 10月, 2015 5 次提交
  11. 10 10月, 2015 1 次提交
  12. 01 10月, 2015 1 次提交
  13. 22 9月, 2015 1 次提交
  14. 16 9月, 2015 3 次提交
    • R
      irqchip: Kill off set_irq_flags usage · d17cab44
      Rob Herring 提交于
      set_irq_flags is ARM specific with custom flags which have genirq
      equivalents. Convert drivers to use the genirq interfaces directly, so we
      can kill off set_irq_flags. The translation of flags is as follows:
      
      IRQF_VALID -> !IRQ_NOREQUEST
      IRQF_PROBE -> !IRQ_NOPROBE
      IRQF_NOAUTOEN -> IRQ_NOAUTOEN
      
      For IRQs managed by an irqdomain, the irqdomain core code handles clearing
      and setting IRQ_NOREQUEST already, so there is no need to do this in
      .map() functions and we can simply remove the set_irq_flags calls. Some
      users also modify IRQ_NOPROBE and this has been maintained although it
      is not clear that is really needed. There appears to be a great deal of
      blind copy and paste of this code.
      Signed-off-by: NRob Herring <robh@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Kukjin Kim <kgene@kernel.org>
      Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
      Cc: Stephen Warren <swarren@wwwdotorg.org>
      Cc: Lee Jones <lee@kernel.org>
      Cc: Alexander Shiyan <shc_work@mail.ru>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: linux-rpi-kernel@lists.infradead.org
      Cc: linux-samsung-soc@vger.kernel.org
      Link: http://lkml.kernel.org/r/1440889285-5637-3-git-send-email-robh@kernel.orgSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      d17cab44
    • T
      genirq: Remove irq argument from irq flow handlers · bd0b9ac4
      Thomas Gleixner 提交于
      Most interrupt flow handlers do not use the irq argument. Those few
      which use it can retrieve the irq number from the irq descriptor.
      
      Remove the argument.
      
      Search and replace was done with coccinelle and some extra helper
      scripts around it. Thanks to Julia for her help!
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Julia Lawall <Julia.Lawall@lip6.fr>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      bd0b9ac4
    • T
      irqchip/gic: Use IRQD_FORWARDED_TO_VCPU flag · 71466535
      Thomas Gleixner 提交于
      Get rid of the handler_data abuse.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      71466535
  15. 15 9月, 2015 1 次提交
    • M
      irqchip/GIC: Add workaround for aliased GIC400 · 12e14066
      Marc Zyngier 提交于
      The GICv2 architecture mandates that the two 4kB GIC regions are
      contiguous, and on two separate physical pages (so that access to
      the second page can be trapped by a hypervisor). This doesn't work
      very well when PAGE_SIZE is 64kB.
      
      A relatively common hack^Wway to work around this is to alias each
      4kB region over its own 64kB page. Of course in this case, the base
      address you want to use is not really the begining of the region,
      but base + 60kB (so that you get a contiguous 8kB region over two
      distinct pages).
      
      Normally, this would be described in DT with a new property, but
      some HW is already out there, and the firmware makes sure that
      it will override whatever you put in the GIC node. Duh. And of course,
      said firmware source code is not available, despite being based
      on u-boot.
      
      The workaround is to detect the case where the CPU interface size
      is set to 128kB, and verify the aliasing by checking that the ID
      register for GIC400 (which is the only GIC wired this way so far)
      is the same at base and base + 0xF000. In this case, we update
      the GIC base address and let it roll.
      
      And if you feel slightly sick by looking at this, rest assured that
      I do too...
      Reported-by: NJulien Grall <julien.grall@citrix.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: Stuart Yoder <stuart.yoder@freescale.com>
      Cc: Pavel Fedin <p.fedin@samsung.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Link: http://lkml.kernel.org/r/1442142873-20213-2-git-send-email-marc.zyngier@arm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      12e14066
  16. 02 9月, 2015 1 次提交
  17. 27 8月, 2015 2 次提交
  18. 04 8月, 2015 2 次提交
    • J
      irqchip/gic: Ensure gic_cpu_if_up/down() programs correct GIC instance · 4c2880b3
      Jon Hunter 提交于
      Commit 32289506 ("irqchip: gic: Preserve gic V2 bypass bits in cpu
      ctrl register") added a new function, gic_cpu_if_up(), to program the
      GIC CPU_CTRL register. This function assumes that there is only one GIC
      instance present and hence always uses the chip data for the primary GIC
      controller. Although it is not common for there to be a secondary, some
      devices do support a secondary. Therefore, fix this by passing
      gic_cpu_if_up() a pointer to the appropriate chip data structure.
      
      Similarly, the function gic_cpu_if_down() only assumes that there is a
      single GIC instance present. Update this function so that an instance
      number is passed for the appropriate GIC and return an error code on
      failure. The vexpress TC2 (which has a single GIC) is currently the only
      user of this function and so update it accordingly. Note that because the
      TC2 only has a single GIC, the call to gic_cpu_if_down() should always
      be successful.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Reviewed-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: <linux-arm-kernel@lists.infradead.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Link: http://lkml.kernel.org/r/1438332252-25248-2-git-send-email-jonathanh@nvidia.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      4c2880b3
    • J
      irqchip/gic: Only allow the primary GIC to set the CPU map · 567e5a01
      Jon Hunter 提交于
      The gic_init_bases() function initialises an array that stores the mapping
      between the GIC and CPUs. This array is a global array that is
      unconditionally initialised on every call to gic_init_bases(). Although,
      it is not common for there to be more than one GIC instance, there are
      some devices that do support nested GIC controllers and gic_init_bases()
      can be called more than once.
      
      A 2nd call to gic_init_bases() will clear the previous CPU mapping and
      will only setup the mapping again for the CPU calling gic_init_bases().
      Fix this by only allowing the CPU map to be configured for the primary GIC.
      
      For secondary GICs the CPU map is not relevant because these GICs do not
      directly route the interrupts to the main CPU(s) but to other GICs or
      devices.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Reviewed-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: <linux-arm-kernel@lists.infradead.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Link: http://lkml.kernel.org/r/1438332252-25248-1-git-send-email-jonathanh@nvidia.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      567e5a01
  19. 27 7月, 2015 2 次提交
    • S
      irqchip/gic: Remove redundant gic_set_irqchip_flags · 0d3f2c92
      Sudeep Holla 提交于
      Now that the GIC chip implementation enables IRQCHIP_SKIP_SET_WAKE and
      IRQCHIP_MASK_ON_SUSPEND by default, the platforms requiring them need
      not override the irqchip flags as before.
      
      This patch removes all the users of gic_set_irqchip_flags and the
      function itself.
      Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Simon Horman <horms@verge.net.au>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Michal Simek <michal.simek@xilinx.com>
      Cc: Magnus Damm <magnus.damm@gmail.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/1436971109-20189-2-git-send-email-sudeep.holla@arm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      0d3f2c92
    • S
      irqchip/gic: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND · aec89ef7
      Sudeep Holla 提交于
      The GIC controller doesn't provides any facility to configure the wakeup
      sources. For the same reason, GIC chip implementation can't provide
      irq_set_wake functionality, but that results in the irqchip core
      preventing the systems from entering sleep states like "suspend to RAM".
      
      The GICv1/v2 controllers support wakeup events. They signal these wakeup
      events even when CPU interface is disabled which means the wakeup
      outputs are always enabled with the required logic in always-on domain.
      An implementation can powerdown the GIC completely, but then the wake-up
      must be relayed to some control logic within the power controller that
      acts as wake-up interrupt controller.
      
      Setting the IRQCHIP_SKIP_SET_WAKE flags will ensure that the interrupts
      from GIC can work as wakeup interrupts and resume from suspend-to-{idle,
      ram}. The wakeup interrupt sources need to use enable_irq_wake() and the
      irqchip core will then set the IRQD_WAKEUP_STATE flag.
      
      Also it's always safer to mask all the non wakeup interrupts are masked
      at the chip level when suspending. The irqchip infrastructure can handle
      masking of those interrupts at the chip level. The chip implementation
      just have to indicate that with IRQCHIP_MASK_ON_SUSPEND.
      
      This patch enables IRQCHIP_SKIP_SET_WAKE and IRQCHIP_MASK_ON_SUSPEND so
      that the irqchip core allows and handles the power managemant wake up
      modes.
      Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Simon Horman <horms@verge.net.au>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Michal Simek <michal.simek@xilinx.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Magnus Damm <magnus.damm@gmail.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/1436971109-20189-1-git-send-email-sudeep.holla@arm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      aec89ef7