1. 04 9月, 2017 26 次提交
  2. 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
  3. 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
  4. 18 8月, 2017 1 次提交
  5. 18 7月, 2017 1 次提交
  6. 23 6月, 2017 1 次提交
  7. 22 6月, 2017 1 次提交
  8. 21 6月, 2017 1 次提交
  9. 20 4月, 2017 3 次提交
    • M
      irqchip/mips-gic: Replace static map with dynamic · 8ada00a6
      Matt Redfearn 提交于
      Commit 4cfffcfa ("irqchip/mips-gic: Fix local interrupts") fixed
      local interrupts by creating virq mappings for them all at startup.
      Unfortunately this change broke legacy IRQ controllers in the same
      system, such as the i8259 on the Malta platform, as it allocates virq
      numbers that were expected to be available for the legacy controller.
      
      Instead of creating the mappings statically when the GIC is probed,
      re-introduce the irq domain .map function, removed by commit e875bd66
      ("irqchip/mips-gic: Fix local interrupts") and use it to set up the irq
      handler and chip. Since a good deal of the required functionality is
      already implemented by gic_irq_domain_alloc, repurpose that function for
      gic_irq_domain_map and add a new gic_irq_domain_alloc which wraps
      gic_irq_domain_map with the necessary conversion.
      
      This change fixes the legacy interrupt controller of the Malta platform
      without breaking the perf interrupt fixed by commit e875bd66
      ("irqchip/mips-gic: Fix local interrupts").
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Link: http://lkml.kernel.org/r/1492679256-14513-4-git-send-email-matt.redfearn@imgtec.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      8ada00a6
    • P
      irqchip/mips-gic: Remove device IRQ domain · b87281e7
      Paul Burton 提交于
      In commit c98c1822 ("irqchip/mips-gic: Add device hierarchy domain")
      Qais indicates that he felt having a separate device IRQ domain was
      cleaner, but along with everyone else I'm aware of touching this driver
      I disagree.
      
      Remove the separate device IRQ domain so that we simply have the main
      GIC IRQ domain used for devices, and an IPI IRQ domain as a child. The
      logic for handling the device interrupts & IPIs is cleanly separated
      into the appropriate domain ops, making it much easier to reason about
      what the driver is doing than the previous approach where the 2 child
      domains had to call up to their parent, which had to handle both types
      of interrupt & had all sorts of weird & wonderful duplication or
      outright clobbering of setup performed by multiple domains.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Link: http://lkml.kernel.org/r/1492679256-14513-3-git-send-email-matt.redfearn@imgtec.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      b87281e7
    • P
      irqchip/mips-gic: Separate IPI reservation & usage tracking · f8dcd9e8
      Paul Burton 提交于
      Since commit 2af70a96 ("irqchip/mips-gic: Add a IPI hierarchy
      domain") introduced the GIC IPI IRQ domain we have tracked both
      reservation of interrupts & their use with a single bitmap - ipi_resrv.
      If an interrupt is reserved for use as an IPI but not actually in use
      then the appropriate bit is set in ipi_resrv. If an interrupt is either
      not reserved for use as an IPI or has been allocated as one then the
      appropriate bit is clear in ipi_resrv.
      
      Unfortunately this means that checking whether a bit is set in ipi_resrv
      to prevent IPI interrupts being allocated for use with a device is
      broken, because if the interrupt has been allocated as an IPI first then
      its bit will be clear.
      
      Fix this by separating the tracking of IPI reservation & usage,
      introducing a separate ipi_available bitmap for the latter. This means
      that ipi_resrv will now always have bits set corresponding to all
      interrupts reserved for use as IPIs, whether or not they have been
      allocated yet, and therefore that checking it when allocating device
      interrupts works as expected.
      
      Fixes: 2af70a96 ("irqchip/mips-gic: Add a IPI hierarchy domain")
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Link: http://lkml.kernel.org/r/1492679256-14513-2-git-send-email-matt.redfearn@imgtec.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      f8dcd9e8
  10. 31 3月, 2017 1 次提交
    • M
      irqchip/mips-gic: Fix Local compare interrupt · 42969893
      Matt Redfearn 提交于
      Commit 4cfffcfa ("irqchip/mips-gic: Fix local interrupts") added
      mapping of several local interrupts during initialisation of the gic
      driver. This associates virq numbers with these interrupts.
      Unfortunately, as not all of the interrupts are mapped in hardware
      order, when drivers subsequently request these interrupts they conflict
      with the mappings that have already been set up. For example, this
      manifests itself in the gic clocksource driver, which fails to probe
      with the message:
      
      clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0x7350c9738,
      max_idle_ns: 440795203769 ns
      GIC timer IRQ 25 setup failed: -22
      
      This is because virq 25 (the correct IRQ number specified via device
      tree) was allocated to the PERFCTR interrupt (and 24 to the timer, 26 to
      the FDC). To fix this, map all of these local interrupts in the hardware
      order so as to associate their virq numbers with the correct hw
      interrupts.
      
      Fixes: 4cfffcfa ("irqchip/mips-gic: Fix local interrupts")
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      42969893