1. 02 Mar, 2013 26 commits
    • James Hogan's avatar
      metag: move kick.c exports out of metag_ksyms.c · aa29ec5f
      James Hogan authored
      
      
      It's less error prone to have function symbols exported immediately
      after the function rather than in metag_ksyms.c. Move each EXPORT_SYMBOL
      in metag_ksyms.c for symbols defined in kick.c into kick.c
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      aa29ec5f
    • James Hogan's avatar
      metag: move traps.c exports out of metag_ksyms.c · 9fb4aa87
      James Hogan authored
      
      
      It's less error prone to have function symbols exported immediately
      after the function rather than in metag_ksyms.c. Move each EXPORT_SYMBOL
      in metag_ksyms.c for symbols defined in traps.c into traps.c
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      9fb4aa87
    • James Hogan's avatar
      metag: move irq enable out of irqflags.h on SMP · fa771d02
      James Hogan authored
      
      
      The SMP version of arch_local_irq_enable() uses preempt_disable(), but
      <asm/irqflags.h> doesn't include <linux/preempt.h> causing the following
      errors on SMP when pstore/ftrace is enabled (caught by buildbot smp
      allyesconfig):
      
      In file included from include/linux/irqflags.h:15,
                       from fs/pstore/ftrace.c:16:
      arch/metag/include/asm/irqflags.h: In function 'arch_local_irq_enable':
      arch/metag/include/asm/irqflags.h:84: error: implicit declaration of function 'preempt_disable'
      arch/metag/include/asm/irqflags.h:86: error: implicit declaration of function 'preempt_enable_no_resched'
      
      However <linux/preempt.h> cannot be easily included from
      <asm/irqflags.h> as it can cause circular include dependencies in the
      !SMP case, and potentially in the SMP case in the future. Therefore move
      the SMP implementation of arch_local_irq_enable() into traps.c and use
      an inline version of get_trigger_mask() which is also defined in traps.c
      for SMP.
      
      This adds an extra layer of function call / stack push when
      preempt_disable needs to call other functions, however in the
      non-preemptive SMP case it should be about as fast, as it was already
      calling the get_trigger_mask() function which is now used inline.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      fa771d02
    • James Hogan's avatar
      metag: export clear_page and copy_page · c838e72a
      James Hogan authored
      
      
      Various file systems use clear_page() and copy_page(), so when they're
      built as modules we get build errors like the following:
      
      ERROR: "clear_page" [fs/ntfs/ntfs.ko] undefined!
      ERROR: "copy_page" [fs/nilfs2/nilfs2.ko] undefined!
      
      Therefore export these functions to modules from metag_ksyms.c to fix
      the errors. This was hit by a randconfig build.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      c838e72a
    • James Hogan's avatar
      metag: protect more non-MMU memory regions · 3d6b7bb0
      James Hogan authored
      
      
      Rename setup_txprivext() to setup_priv() and add initialisation of some
      more per-thread privilege protection registers:
      
       - TxPRIVSYSR: 0x04400000-0x047fffff
                     0x05000000-0x07ffffff
                     0x84000000-0x87ffffff
       - TxPIOREG:   0x02000000-0x02ffffff
                     0x04800000-0x048fffff
       - TxSYREG:    0x04000000-0x04000fff (except write fetch system event)
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      3d6b7bb0
    • James Hogan's avatar
      metag: make TXPRIVEXT bits explicit · c787c2d6
      James Hogan authored
      
      
      Define PRIV_BITS using explicit constants from <asm/metag_regs.h> rather
      than with a hard coded value. This also adds a couple of missing
      definitions for the TXPRIVEXT priv bits for protecting writes to TXTIMER
      and the trace registers.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      c787c2d6
    • James Hogan's avatar
      metag: kernel/setup.c: sort includes · 82f0167a
      James Hogan authored
      
      
      Sort includes in kernel/setup.c.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      82f0167a
    • James Hogan's avatar
      metag: Add JTAG Debug Adapter (DA) support · ae85ac71
      James Hogan authored
      
      
      Add basic JTAG Debug Adapter (DA) support so that drivers which
      communicate with the DA can detect whether one is actually present
      (otherwise the target will halt indefinitely).
      
      This allows the metag_da TTY driver and imgdafs filesystem driver to be
      built, updates defconfigs, and sets up the metag_da console early if
      it's configured in.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      ae85ac71
    • James Hogan's avatar
      metag: ftrace support · 00512bdd
      James Hogan authored
      
      
      Add ftrace support for metag.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Reviewed-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      00512bdd
    • James Hogan's avatar
      metag: Perf · 903b20ad
      James Hogan authored
      
      
      Add Perf support for metag.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
      903b20ad
    • James Hogan's avatar
      metag: Build infrastructure · 5633004c
      James Hogan authored
      
      
      Add metag build infrastructure.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      5633004c
    • James Hogan's avatar
      metag: Stack unwinding · e8de3486
      James Hogan authored
      
      
      Add stack unwinding support for metag.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      e8de3486
    • James Hogan's avatar
      metag: DMA · f507758c
      James Hogan authored
      
      
      Add DMA mapping code.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      f507758c
    • James Hogan's avatar
      metag: SMP support · 42682c6c
      James Hogan authored
      
      
      Add SMP support for metag. This allows Linux to take control of multiple
      hardware threads on a single Meta core, treating them as separate Linux
      CPUs.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      42682c6c
    • James Hogan's avatar
      metag: Module support · 9b802d1f
      James Hogan authored
      
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      9b802d1f
    • James Hogan's avatar
      metag: Scheduling/Process management · 44dea393
      James Hogan authored
      
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      44dea393
    • James Hogan's avatar
      metag: System Calls · 26025bbf
      James Hogan authored
      
      
      Add metag system call and gateway page interfaces. The metag
      architecture port uses the generic system call numbers from
      asm-generic/unistd.h, as well as a user gateway page mapped at
      0x6ffff000 which contains fast atomic primitives (depending on SMP) and
      a fast method of accessing TLS data.
      
      System calls use the SWITCH instruction with the immediate 0x440001 to
      signal a system call.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      26025bbf
    • James Hogan's avatar
      metag: Internal and external irqchips · 5698c50d
      James Hogan authored
      
      
      Meta core internal interrupts (from HWSTATMETA and friends) are vectored
      onto the TR1 core trigger for the current thread. This is demultiplexed
      in irq-metag.c to individual Linux IRQs for each internal interrupt.
      
      External SoC interrupts (from HWSTATEXT and friends) are vectored onto
      the TR2 core trigger for the current thread. This is demultiplexed in
      irq-metag-ext.c to individual Linux IRQs for each external SoC interrupt.
      The external irqchip has devicetree bindings for configuring the number
      of irq banks and the type of masking available.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Rob Landley <rob@landley.net>
      Cc: Dom Cobley <popcornmix@gmail.com>
      Cc: Simon Arlott <simon@fire.lp0.eu>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: devicetree-discuss@lists.ozlabs.org
      Cc: linux-doc@vger.kernel.org
      5698c50d
    • James Hogan's avatar
      metag: IRQ handling · 63047ea3
      James Hogan authored
      
      
      Add core IRQ handling for metag. The code in irq.c exposes the TBX
      signal numbers as Linux IRQs.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      63047ea3
    • James Hogan's avatar
      metag: Traps · ac919f08
      James Hogan authored
      
      
      Add trap code for metag. At the lowest level Meta traps (and return from
      interrupt instruction - RTI) simply swap the PC and PCX registers and
      optionally toggle the interrupt status bit (ISTAT). Low level TBX code
      in tbipcx.S handles the core context save, determine the TBX signal
      number based on the core trigger that fired (using the TXSTATI status
      register), and call TBX signal handlers (mostly in traps.c) via a vector
      table.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      ac919f08
    • James Hogan's avatar
      metag: Time keeping · a2c5d4ed
      James Hogan authored
      
      
      Add time keeping code for metag. Meta hardware threads have 2 timers.
      The background timer (TXTIMER) is used as a free-running time base, and
      the interrupt timer (TXTIMERI) is used for the timer interrupt. Both
      counters traditionally count at approximately 1MHz.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: John Stultz <johnstul@us.ibm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      a2c5d4ed
    • James Hogan's avatar
      metag: ptrace · bc3966bf
      James Hogan authored
      
      
      The ptrace interface for metag provides access to some core register
      sets using the PTRACE_GETREGSET and PTRACE_SETREGSET operations. The
      details of the internal context structures is abstracted into user API
      structures to both ease use and allow flexibility to change the internal
      context layouts. Copyin and copyout functions for these register sets
      are exposed to allow signal handling code to use them to copy to and
      from the signal context.
      
      struct user_gp_regs (NT_PRSTATUS) provides access to the core general
      purpose register context.
      
      struct user_cb_regs (NT_METAG_CBUF) provides access to the TXCATCH*
      registers which contains information abuot a memory fault, unaligned
      access error or watchpoint. This can be modified to alter the way the
      fault is replayed on resume ("catch replay"), or to prevent the replay
      taking place.
      
      struct user_rp_state (NT_METAG_RPIPE) provides access to the state of
      the Meta read pipeline which can be used to hide memory latencies in
      hand optimised data loops.
      
      Extended DSP register state, DSP RAM, and hardware breakpoint registers
      aren't yet exposed through ptrace.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Denys Vlasenko <vda.linux@googlemail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      bc3966bf
    • James Hogan's avatar
      metag: Device tree · 29dd78cf
      James Hogan authored
      
      
      Add device tree files to arch/metag.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Reviewed-by: default avatarVineet Gupta <vgupta@synopsys.com>
      29dd78cf
    • James Hogan's avatar
      metag: Signal handling · 262d96b0
      James Hogan authored
      
      
      Add signal handling code for metag.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      262d96b0
    • James Hogan's avatar
      metag: TCM support · c438b58e
      James Hogan authored
      
      
      Add some TCM support
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      c438b58e
    • James Hogan's avatar
      metag: Boot · 85d9d7a9
      James Hogan authored
      
      
      Add boot code for metag. Due to the multi-threaded nature of Meta it is
      not uncommon for an RTOS or bare metal application to be started on
      other hardware threads by the bootloader. Since there is a single MMU
      switch which affects all threads, the MMU is traditionally configured by
      the bootloader prior to starting Linux. The bootloader passes a
      structure to Linux which among other things contains information about
      memory regions which have been mapped. Linux then assumes control of the
      local heap memory region.
      
      A kernel arguments string pointer or a flattened device tree pointer can
      be provided in the third argument.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      85d9d7a9