1. 15 Feb, 2013 31 commits
    • Vineet Gupta's avatar
      ARC: Unaligned access emulation · 2e651ea1
      Vineet Gupta authored
      ARC700 doesn't natively support unaligned access, but can be emulated
      -Unaligned Access Exception
      -Disassembly at the Fault address to find the exact insn (long/short)
      
      Also per Arnd's comment, we runtime control it using 2 sysctl knobs:
      * SYSCTL_ARCH_UNALIGN_ALLOW: Runtime enable/disble
      * SYSCTL_ARCH_UNALIGN_NO_WARN: Warn on each emulation attempt
      
      Originally contributed by Tim Yao <tim.yao@amlogic.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Tim Yao <tim.yao@amlogic.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      2e651ea1
    • Vineet Gupta's avatar
      sysctl: Enable PARISC "unaligned-trap" to be used cross-arch · bf14e3b9
      Vineet Gupta authored
      PARISC defines /proc/sys/kernel/unaligned-trap to runtime toggle
      unaligned access emulation.
      
      The exact mechanics of enablig/disabling are still arch specific, we can
      make the sysctl usable by other arches.
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Acked-by: default avatarHelge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Serge Hallyn <serge.hallyn@canonical.com>
      bf14e3b9
    • Vineet Gupta's avatar
      ARC: kprobes support · 4d86dfbb
      Vineet Gupta authored
      Origin port done by Rajeshwar Ranga
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Rajeshwar Ranga <rajeshwar.ranga@gmail.com>
      4d86dfbb
    • Vineet Gupta's avatar
      ARC: disassembly (needed by kprobes/kgdb/unaligned-access-emul) · e65ab5a8
      Vineet Gupta authored
      In-kernel disassembler
      
      Due Credits
      * Orig written by Rajeshwar Ranga
      * Consolidation/cleanups by Mischa Jonker
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Rajeshwar Ranga <rajeshwar.ranga@gmail.com>
      Cc: Mischa Jonker <mjonker@synopsys.com>
      e65ab5a8
    • Vineet Gupta's avatar
      44c8bb91
    • Vineet Gupta's avatar
      ARC: DWARF2 .debug_frame based stack unwinder · 854a0d95
      Vineet Gupta authored
      -Originally written by Rajeshwar Ranga
      -Derived off of generic unwinder in 2.6.19 and adapted to ARC
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Rajeshwar Ranga <rajeshwar.ranga@gmail.com>
      854a0d95
    • Vineet Gupta's avatar
      ARC: SMP support · 41195d23
      Vineet Gupta authored
      ARC common code to enable a SMP system + ISS provided SMP extensions.
      
      ARC700 natively lacks SMP support, hence some of the core features are
      are only enabled if SoCs have the necessary h/w pixie-dust. This
      includes:
      -Inter Processor Interrupts (IPI)
      -Cache coherency
      -load-locked/store-conditional
      ...
      
      The low level exception handling would be completely broken in SMP
      because we don't have hardware assisted stack switching. Thus a fair bit
      of this code is repurposing the MMU_SCRATCH reg for event handler
      prologues to keep them re-entrant.
      
      Many thanks to Rajeshwar Ranga for his initial "major" contributions to
      SMP Port (back in 2008), and to Noam Camus and Gilad Ben-Yossef for help
      with resurrecting that in 3.2 kernel (2012).
      
      Note that this platform code is again singleton design pattern - so
      multiple SMP platforms won't build at the moment - this deficiency is
      addressed in subsequent patches within this series.
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Rajeshwar Ranga <rajeshwar.ranga@gmail.com>
      Cc: Noam Camus <noamc@ezchip.com>
      Cc: Gilad Ben-Yossef <gilad@benyossef.com>
      41195d23
    • Vineet Gupta's avatar
      ARC: Diagnostics: show_regs() etc · 0ef88a54
      Vineet Gupta authored
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      0ef88a54
    • Vineet Gupta's avatar
      ARC: Module support · fa1c3ff9
      Vineet Gupta authored
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      fa1c3ff9
    • Vineet Gupta's avatar
      ARC: Support for high priority interrupts in the in-core intc · 4788a594
      Vineet Gupta authored
      There is a bit of hack/kludge right now where we disable preemption if a
      L2 (High prio) IRQ is taken while L1 (Low prio) is active.
      
      Need to revisit this
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      4788a594
    • Vineet Gupta's avatar
      ARC: OProfile support · 769bc1fd
      Vineet Gupta authored
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Robert Richter <rric@kernel.org>
      Cc: oprofile-list@lists.sf.net
      Reviewed-by: default avatarJames Hogan <james.hogan@imgtec.com>
      769bc1fd
    • Vineet Gupta's avatar
      ARC: Futex support · 01b812bc
      Vineet Gupta authored
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      01b812bc
    • Vineet Gupta's avatar
      ARC: ptrace support · 547f1125
      Vineet Gupta authored
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      547f1125
    • Vineet Gupta's avatar
      080c3747
    • Vineet Gupta's avatar
      ARC: [plat-arcfpga] defconfig · 8872e9e5
      Vineet Gupta authored
      With this we get to a running kernel on ISS
      
      ---------------------------------->8-----------------------------------
      Linux version 3.8.0-rc3+ (vineetg@vineetg-Latitude) (gcc version 4.4.7
      (ARCompact elf32 toolchain (built 20121213)) ) #3 Thu Jan 17 14:22:05
      IST 2013
      Board "arc-angel4" from snps (Manufacturer)
      Memory size set via devicetree 256M
      [plat-arcfpga]: registering early dev resources
      bootconsole [early_ARCuart0] enabled
      pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
      pcpu-alloc: [0] 0
      Built 1 zonelists in Zone order, mobility grouping on.  Total pages:
      32624
      Kernel command line: console=ttyARC0,115200n8
      PID hash table entries: 1024 (order: -1, 4096 bytes)
      Dentry cache hash table entries: 32768 (order: 4, 131072 bytes)
      Inode-cache hash table entries: 16384 (order: 3, 65536 bytes)
      Memory Available: 248M / 256M (1312K code, 463K data, 4184K init, 1400K
      reserv)
      SLUB: Genslabs=12, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
      NR_IRQS:16
      Console: colour dummy device 80x25
      Calibrating delay loop... 39.73 BogoMIPS (lpj=198656)
      pid_max: default: 32768 minimum: 301
      Mount-cache hash table entries: 1024
      devtmpfs: initialized
      [plat-arcfpga]: registering device resources
      bio: create slab <bio-0> at 0
      Switching to clocksource ARC RTSC
      io scheduler noop registered (default)
      arc-uart: ttyARC0 at MMIO 0xc0fc1000 (irq = 5) is a arc-uart
      console [ttyARC0] enabled, bootconsole disabled
      console [ttyARC0] enabled, bootconsole disabled
      mousedev: PS/2 mouse device common for all mice
      Warning: unable to open an initial console.
      Freeing unused kernel memory: 4184k [80002000] to [80418000]
      Mounting proc
      Mounting sysfs
      Mounting devpts
      Setting hostname to ARCLinux
      Starting System logger (syslogd)
      Bringing up loopback device
      ifconfig: socket: Function not implemented
      route: socket: Function not implemented
      Disk not detected !
      Mounting tmpfs
      mount: mounting tmpfs on /dev/shm failed: Invalid argument
      /etc/init.d/rcS: line 76: can't create /proc/sys/kernel/msgmni:
      nonexistent directory
      
      Please press Enter to activate this console.
      ***********************************************************************
                              Welcome to ARCLinux
      ***********************************************************************
      [ARCLinux]$
      
      ---------------------------------->8-----------------------------------
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      8872e9e5
    • Vineet Gupta's avatar
      ARC: Last bits (stubs) to get to a running kernel with UART · c08098f2
      Vineet Gupta authored
      This was part of port buildup strategy from Arnd to have a minimal kernel
      at first and then add optional features (stacktracing, ptrace, smp,
      kprobes, oprofile....)
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      c08098f2
    • Vineet Gupta's avatar
      ARC: [plat-arcfpga]: Enabling DeviceTree for Angel4 board · abe11dde
      Vineet Gupta authored
      * arc-uart platform device now populated dynamically, using
        of_platform_populate() - applies to any other device whatsoever.
      
      * uart in turn requires incore arc-intc to be also present in DT
      
      * A irq-domain needs to be instantiated for IRQ requests by DT probed
        device (e.g. arc-uart)
      
      TODO: switch over to linear irq domain once all devs have been
            transitioned to DT
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Arnd Bergmann <arnd@arndb.de>
      abe11dde
    • Vineet Gupta's avatar
      ARC: [DeviceTree] Convert some Kconfig items to runtime values · 450dd430
      Vineet Gupta authored
      * mem size now runtime configured (prev CONFIG_ARC_PLAT_SDRAM_SIZE)
      * core cpu clk runtime configured (prev CONFIG_ARC_PLAT_CLK)
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      450dd430
    • Vineet Gupta's avatar
      ARC: [DeviceTree] Basic support · 999159a5
      Vineet Gupta authored
      This is minimal infrastructure needed for devicetree work.
      It uses an a sample "skeleton" devicetree - embedded in kernel image -
      to print the board, manufacturer by parsing the top-level "compatible"
      string.
      
      As of now we don't need any additional "board" specific "machine_desc".
      
      TODO: support interpreting the command line as boot-loader passed dtb
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: devicetree-discuss@lists.ozlabs.org
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Reviewed-by: default avatarRob Herring <rob.herring@calxeda.com>
      Reviewed-by: default avatarJames Hogan <james.hogan@imgtec.com>
      999159a5
    • Vineet Gupta's avatar
      ARC: [plat-arcfpga] Static platform device for CONFIG_SERIAL_ARC · ee36d172
      Vineet Gupta authored
      N.B. This is old style of hardcoding platform device specific info
      in code and it's instantiation thererof using platform_add_devices().
      Subsequent patches replace this with DeviceTree based runtime probe.
      
      This patch has been retained just as an example of "don't-do-this" for
      newer kernel ports.
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      ee36d172
    • Vineet Gupta's avatar
    • Vineet Gupta's avatar
      ARC: I/O and DMA Mappings · 1162b070
      Vineet Gupta authored
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      1162b070
    • Vineet Gupta's avatar
      ARC: Page Fault handling · fbd7053a
      Vineet Gupta authored
      This includes recent changes to make handler "retry" and/or "killable"
      
      The killable (early exit) logic is loosely based on how SH implements it
      	return if SIGKILL + either of VM_FAULT_OOM or VM_FAULT_RETRY
      which is different from Hexagon implementation which would NOT early
      exit for
      	SIGKILL + VM_FAULT_OOM + !VM_FAULT_RETRY
      
      credits: Non executable stack support from Simon Spooner
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      fbd7053a
    • Vineet Gupta's avatar
      ARC: TLB flush Handling · d79e678d
      Vineet Gupta authored
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      d79e678d
    • Vineet Gupta's avatar
      ARC: MMU Exception Handling · cc562d2e
      Vineet Gupta authored
      * MMU I-TLB / D-TLB Miss Exceptions
        - Fast Path TLB Refill Handler
        - slowpath TLB creation via do_page_fault() -> update_mmu_cache()
      * Duplicate PD Exception Handler
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      cc562d2e
    • Vineet Gupta's avatar
      ARC: MMU Context Management · f1f3347d
      Vineet Gupta authored
      ARC700 MMU provides for tagging TLB entries with a 8-bit ASID to avoid
      having to flush the TLB every task switch.
      
      It also allows for a quick way to invalidate all the TLB entries for
      task useful for:
      * COW sementics during fork()
      * task exit()ing
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      f1f3347d
    • Vineet Gupta's avatar
      ARC: Page Table Management · 5dda4dc5
      Vineet Gupta authored
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      5dda4dc5
    • Vineet Gupta's avatar
      ARC: Cache Flush Management · 95d6976d
      Vineet Gupta authored
      * ARC700 has VIPT L1 Caches
      * Caches don't snoop and are not coherent
      * Given the PAGE_SIZE and Cache associativity, we don't support aliasing
        D$ configurations (yet), but do allow aliasing I$ configs
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      95d6976d
    • Vineet Gupta's avatar
      ARC: [Review] Prevent incorrect syscall restarts · 55bb9480
      Vineet Gupta authored
      Per Al Viro's "signals for dummies" https://lkml.org/lkml/2012/12/6/366
      there are 3 golden rules for (not) restarting syscalls:
      
      "	What we need to guarantee is
      * restarts do not happen on signals caught in interrupts or exceptions
      * restarts do not happen on signals caught in sigreturn()
      * restart should happen only once, even if we get through do_signal()
        many times."
      
      ARC Port already handled #1, this patch fixes #2 and #3.
      
      We use the additional state in pt_regs->orig_r8 to ckh if restarting
      has already been done once.
      
      Thanks to Al Viro for spotting this.
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      55bb9480
    • Vineet Gupta's avatar
      ARC: [Review] Preparing to fix incorrect syscall restarts due to signals · 5c39c0ab
      Vineet Gupta authored
      To avoid multiple syscall restarts (multiple signals) or no restart at
      all (sigreturn), we need just an extra bit of state "literally 1 bit" in
      struct pt_regs. orig_r8 is the best place to do this, however given the
      way it is encoded currently, we can't add anything simplistically.
      
      Current orig_r8:
      * syscalls   -> 1 to NR_SYSCALLS
      * Exceptions -> NR_SYSCALLS + 1
      * Break-point-> NR_SYSCALLS + 2
      
      In new scheme it is a bit-field
      * lower short word contains the  exact event type (and a new bit to represent
         restart semantics : if syscall was already / can't be restarted)
      * upper short word optionally containing the syscall num - needed by
        likes of tracehooks etc
      
      This patch only changes how orig_r8 is organised and nothing should
      change behaviourily.
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      5c39c0ab
    • Vineet Gupta's avatar
      ARC: Signal handling · c3581039
      Vineet Gupta authored
      Includes following fixes courtesy review by Al-Viro
      
      * Tracer poke to Callee-regs were lost
      
        Before going off into do_signal( ) we save the user-mode callee regs
        (as they are not saved by default as part of pt_regs). This is to make
        sure that that a Tracer (if tracing related signal) is able to do likes
        of PEEKUSR(callee-reg).
      
        However in return path we were simply discarding the user-mode callee
        regs, which would break a POKEUSR(callee-reg) from a tracer.
      
      * Issue related to multiple syscall restarts are addressed in next patch
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Acked-by: default avatarJonas Bonn <jonas@southpole.se>
      c3581039
  2. 11 Feb, 2013 9 commits