1. 02 11月, 2017 1 次提交
    • P
      irqchip: mips-gic: Inline gic_local_irq_domain_map() · 63b746b1
      Paul Burton 提交于
      The gic_local_irq_domain_map() function has only one callsite in
      gic_irq_domain_map(), and the split between the two functions makes it
      unclear that they duplicate calculations & checks.
      
      Inline gic_local_irq_domain_map() into gic_irq_domain_map() in order to
      clean this up. Doing this makes the following small issues obvious, and
      the patch tidies them up:
      
       - Both functions used GIC_HWIRQ_TO_LOCAL() to convert a hwirq number to
         a local IRQ number. We now only do this once. Although the compiler
         ought to have optimised this away before anyway, the change leaves us
         with less duplicate code.
      
       - gic_local_irq_domain_map() had a check for invalid local interrupt
         numbers (intr > GIC_LOCAL_INT_FDC). This condition can never occur
         because any hwirq higher than those used for local interrupts is a
         shared interrupt, which gic_irq_domain_map() already handles
         separately. We therefore remove this check.
      
       - The decision of whether to map the interrupt to gic_cpu_pin or
         timer_cpu_pin can be handled within the existing switch statement in
         gic_irq_domain_map(), shortening the code a little.
      
      The change additionally prepares us nicely for the following patch of
      the series which would otherwise need to duplicate the check for whether
      a local interrupt should be percpu_devid or just percpu (ie. the switch
      statement from gic_irq_domain_map()) in gic_local_irq_domain_map().
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      63b746b1
  2. 26 9月, 2017 2 次提交
    • P
      irqchip/mips-gic: Use effective affinity to unmask · d9f82930
      Paul Burton 提交于
      Commit 7778c4b2 ("irqchip: mips-gic: Use pcpu_masks to avoid reading
      GIC_SH_MASK*") adjusted the way we handle masking interrupts to set &
      clear the interrupt's bit in each pcpu_mask. This allows us to avoid
      needing to read the GIC mask registers and perform a bitwise and of
      their values with the pending & pcpu_masks.
      
      Unfortunately this didn't quite work for IPIs, which were mapped to a
      particular CPU/VP during initialisation but never set the affinity or
      effective_affinity fields of their struct irq_desc. This led to them
      losing their affinity when gic_unmask_irq() was called for them, and
      they'd all become affine to cpu0.
      
      Fix this by:
      
       1) Setting the effective affinity of interrupts in
          gic_shared_irq_domain_map(), which is where we actually map an
          interrupt to a CPU/VP. This ensures that the effective affinity mask
          is always valid, not just after explicitly setting affinity.
      
       2) Using an interrupt's effective affinity when unmasking it, which
          prevents gic_unmask_irq() from unintentionally changing which
          pcpu_mask includes an interrupt.
      
      
      Fixes: 7778c4b2 ("irqchip: mips-gic: Use pcpu_masks to avoid reading GIC_SH_MASK*")
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Link: https://lkml.kernel.org/r/20170922062440.23701-3-paul.burton@imgtec.com
      d9f82930
    • P
      irqchip/mips-gic: Fix shifts to extract register fields · a08588ea
      Paul Burton 提交于
      The MIPS GIC driver is incorrectly using __fls to shift registers,
      intending to shift to the least significant bit of a value based upon
      its mask but instead shifting off all but the value's top bit. It should
      actually be using __ffs to shift to the first, not last, bit of the
      value.
      
      Apparently the system I used when testing commit 3680746a
      ("irqchip: mips-gic: Convert remaining shared reg access to new
      accessors") and commit b2b2e584 ("irqchip: mips-gic: Clean up mti,
      reserved-cpu-vectors handling") managed to work correctly despite this
      issue, but not all systems do...
      
      Fixes: 3680746a ("irqchip: mips-gic: Convert remaining shared reg access to new accessors")
      Fixes: b2b2e584 ("irqchip: mips-gic: Clean up mti, reserved-cpu-vectors handling")
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Link: https://lkml.kernel.org/r/20170922062440.23701-2-paul.burton@imgtec.com
      a08588ea
  3. 20 9月, 2017 1 次提交
    • P
      irqchip.mips-gic: Fix shared interrupt mask writes · 90019f8f
      Paul Burton 提交于
      The write_gic_smask() & write_gic_rmask() functions take a shared
      interrupt number as a parameter, but we're incorrectly providing them a
      bitmask with the shared interrupt's bit set. This effectively means that
      we mask or unmask the shared interrupt 1<<n rather than shared interrupt
      n, and as a result likely drop interrupts.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Fixes: 68898c8765f4 ("irqchip: mips-gic: Drop gic_(re)set_mask() functions")
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      90019f8f
  4. 04 9月, 2017 26 次提交
  5. 30 8月, 2017 4 次提交
    • P
      MIPS: GIC: Introduce asm/mips-gic.h with accessor functions · 582e2b4a
      Paul Burton 提交于
      This patch introduces a new header providing accessor functions for the
      MIPS Global Interrupt Controller (GIC) mirroring those provided for the
      other 2 components of the MIPS Coherent Processing System (CPS) - the
      Coherence Manager (CM) & Cluster Power Controller (CPC).
      
      This header makes use of the new standardised CPS accessor macros where
      possible, but does require some custom accessors for cases where we have
      either a bit or a register per interrupt.
      
      A major advantage of this over the existing
      include/linux/irqchip/mips-gic.h definitions is that code performing
      accesses can become much simpler, for example this:
      
        gic_update_bits(GIC_REG(SHARED, GIC_SH_SET_TRIGGER) +
                        GIC_INTR_OFS(intr), 1ul << GIC_INTR_BIT(intr),
                        (unsigned long)trig << GIC_INTR_BIT(intr));
      
      ...can become simply:
      
        change_gic_trig(intr, trig);
      
      The accessors handle 32 vs 64 bit in the same way as for CM & CPC code,
      which means that GIC code will also not need to worry about the access
      size in most cases. They are also accessible outside of
      drivers/irqchip/irq-mips-gic.c which will allow for simplification in
      the use of the non-interrupt portions of the GIC (eg. counters) which
      currently require the interrupt controller driver to expose helper
      functions for access.
      
      This patch doesn't change any existing code over to use the new
      accessors yet, since a wholesale change would be invasive & difficult to
      review. Instead follow-on patches will convert code piecemeal to use
      this new header. The one change to existing code is to rename gic_base
      to mips_gic_base & make it global, in order to fit in with the naming
      expected by the standardised CPS accessor macros.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17020/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      582e2b4a
    • J
      irqchip: mips-gic: SYNC after enabling GIC region · a0ffec3d
      James Hogan 提交于
      A SYNC is required between enabling the GIC region and actually trying
      to use it, even if the first access is a read, otherwise its possible
      depending on the timing (and in my case depending on the precise
      alignment of certain kernel code) to hit CM bus errors on that first
      access.
      
      Add the SYNC straight after setting the GIC base.
      
      [paul.burton@imgtec.com:
        Changes later in this series increase our likelihood of hitting this
        by reducing the amount of code that runs between enabling the GIC &
        accessing it.]
      
      Fixes: a7057270 ("irqchip: mips-gic: Add device-tree support")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17019/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a0ffec3d
    • J
      irqchip: mips-gic: SYNC after enabling GIC region · 2c0e8382
      James Hogan 提交于
      A SYNC is required between enabling the GIC region and actually trying
      to use it, even if the first access is a read, otherwise its possible
      depending on the timing (and in my case depending on the precise
      alignment of certain kernel code) to hit CM bus errors on that first
      access.
      
      Add the SYNC straight after setting the GIC base.
      
      [paul.burton@imgtec.com:
        Changes later in this series increase our likelihood of hitting this
        by reducing the amount of code that runs between enabling the GIC &
        accessing it.]
      
      Fixes: a7057270 ("irqchip: mips-gic: Add device-tree support")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 3.19.x-
      Patchwork: https://patchwork.linux-mips.org/patch/17019/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      2c0e8382
    • P
      MIPS: CPS: Have asm/mips-cps.h include CM & CPC headers · e83f7e02
      Paul Burton 提交于
      With Coherence Manager (CM) 3.5 information about the topology of the
      system, which has previously only been available through & accessed from
      the CM, is now also provided by the Cluster Power Controller (CPC). This
      includes a new CPC_CONFIG register mirroring GCR_CONFIG, and similarly a
      new CPC_Cx_CONFIG register mirroring GCR_Cx_CONFIG.
      
      In preparation for adjusting functions such as mips_cm_numcores(), which
      have previously only needed to access the CM, to also access the CPC
      this patch modifies the way we use the various CPS headers. Rather than
      having users include asm/mips-cm.h or asm/mips-cpc.h individually we
      instead have users include asm/mips-cps.h which in turn includes
      asm/mips-cm.h & asm/mips-cpc.h. This means that users will gain access
      to both CM & CPC registers by including one header, and most importantly
      it makes asm/mips-cps.h an ideal location for helper functions which
      need to access the various components of the CPS.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17015/
      Patchwork: https://patchwork.linux-mips.org/patch/17217/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e83f7e02
  6. 29 8月, 2017 1 次提交
    • P
      MIPS: CM: Use BIT/GENMASK for register fields, order & drop shifts · 93c5bba5
      Paul Burton 提交于
      There's no reason for us not to use BIT() & GENMASK() in asm/mips-cm.h
      when declaring macros corresponding to register fields. This patch
      modifies our definitions to do so.
      
      The *_SHF definitions are removed entirely - they duplicate information
      found in the masks, are infrequently used & can be replaced with use of
      __ffs() where needed.
      
      The *_MSK definitions then lose their _MSK suffix which is now somewhat
      redundant, and users are modified to match.
      
      The field definitions are moved to follow the appropriate register's
      accessor functions, which helps to keep the field definitions in order &
      to find the appropriate fields for a given register. Whilst here a
      comment is added describing each register & including its name, which is
      helpful both for linking the register back to hardware documentation &
      for grepping purposes.
      
      This also cleans up a couple of issues that became obvious as a result
      of making the changes described above:
      
        - We previously had definitions for GCR_Cx_RESET_EXT_BASE & a phony
          copy of that named GCR_RESET_EXT_BASE - a register which does not
          exist. The bad definitions were added by commit 497e803e ("MIPS:
          smp-cps: Ensure secondary cores start with EVA disabled") and made
          use of from boot_core(), which is now modified to use the
          GCR_Cx_RESET_EXT_BASE definitions.
      
        - We had a typo in CM_GCR_ERROR_CAUSE_ERRINGO_MSK - we now correctly
          define this as inFo rather than inGo.
      
      Now that we don't duplicate field information between _SHF & _MSK
      definitions, and keep the fields next to the register accessors, it will
      be much easier to spot & prevent any similar oddities being introduced
      in the future.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Acked-by: Thomas Gleixner <tglx@linutronix.de
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17001/
      Patchwork: https://patchwork.linux-mips.org/patch/17216/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      93c5bba5
  7. 18 8月, 2017 1 次提交
  8. 18 7月, 2017 1 次提交
  9. 23 6月, 2017 1 次提交
  10. 22 6月, 2017 1 次提交
  11. 21 6月, 2017 1 次提交