1. 18 12月, 2013 1 次提交
  2. 14 11月, 2013 2 次提交
  3. 30 9月, 2013 1 次提交
    • C
      tile: use a more conservative __my_cpu_offset in CONFIG_PREEMPT · f862eefe
      Chris Metcalf 提交于
      It turns out the kernel relies on barrier() to force a reload of the
      percpu offset value.  Since we can't easily modify the definition of
      barrier() to include "tp" as an output register, we instead provide a
      definition of __my_cpu_offset as extended assembly that includes a fake
      stack read to hazard against barrier(), forcing gcc to know that it
      must reread "tp" and recompute anything based on "tp" after a barrier.
      
      This fixes observed hangs in the slub allocator when we are looping
      on a percpu cmpxchg_double.
      
      A similar fix for ARMv7 was made in June in change 509eb76e.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      f862eefe
  4. 28 9月, 2013 1 次提交
    • C
      tile: include: asm: use 'long long' instead of 'u64' for atomic64_t and its related functions · b924a690
      Chen Gang 提交于
      atomic* value is signed value, and atomic* functions need also process
      signed value (parameter value, and return value), so use 'long long'
      instead of 'u64'.
      
      After replacement, it will also fix a bug for atomic64_add_negative():
      "u64 is never less than 0".
      
      The modifications are:
      
        in vim, use "1,% s/\<u64\>/long long/g" command.
        remove redundant '__aligned(8)'.
        be sure of 80 (and macro '\') columns limitation after replacement.
      Signed-off-by: NChen Gang <gang.chen@asianux.com>
      Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> [re-instated const cast]
      b924a690
  5. 25 9月, 2013 1 次提交
  6. 13 9月, 2013 1 次提交
    • C
      tile: remove HUGE_VMAP dead code · 4b12909f
      Chris Metcalf 提交于
      A config option to allow a variant vmap() using huge pages that was never
      upstreamed had some bits of code related to it scattered around the tile
      architecture; the config option was removed downstream and this commit
      cleans up the scattered evidence of it from the upstream as well.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      4b12909f
  7. 07 9月, 2013 1 次提交
    • C
      tile: rework <asm/cmpxchg.h> · 6dc9658f
      Chris Metcalf 提交于
      The macrology in cmpxchg.h was designed to allow arbitrary pointer
      and integer values to be passed through the routines.  To support
      cmpxchg() on 64-bit values on the 32-bit tilepro architecture, we
      used the idiom "(typeof(val))(typeof(val-val))".  This way, in the
      "size 8" branch of the switch, when the underlying cmpxchg routine
      returns a 64-bit quantity, we cast it first to a typeof(val-val)
      quantity (i.e. size_t if "val" is a pointer) with no warnings about
      casting between pointers and integers of different sizes, then cast
      onwards to typeof(val), again with no warnings.  If val is not a
      pointer type, the additional cast is a no-op.  We can't replace the
      typeof(val-val) cast with (for example) unsigned long, since then if
      "val" is really a 64-bit type, we cast away the high bits.
      
      HOWEVER, this fails with current gcc (through 4.7 at least) if "val"
      is a pointer to an incomplete type.  Unfortunately gcc isn't smart
      enough to realize that "val - val" will always be a size_t type
      even if it's an incomplete type pointer.
      
      Accordingly, I've reworked the way we handle the casting.  We have
      given up the ability to use cmpxchg() on 64-bit values on tilepro,
      which is OK in the kernel since we should use cmpxchg64() explicitly
      on such values anyway.  As a result, I can just use simple "unsigned
      long" casts internally.
      
      As I reworked it, I realized it would be cleaner to move the
      architecture-specific conditionals for cmpxchg and xchg out of the
      atomic.h headers and into cmpxchg, and then use the cmpxchg() and
      xchg() primitives directly in atomic.h and elsewhere.  This allowed
      the cmpxchg.h header to stand on its own without relying on the
      implicit include of it that is performed by <asm/atomic.h>.
      It also allowed collapsing the atomic_xchg/atomic_cmpxchg routines
      from atomic_{32,64}.h into atomic.h.
      
      I improved the tests that guard the allowed size of the arguments
      to the routines to use a __compiletime_error() test.  (By avoiding
      the use of BUILD_BUG, I could include cmpxchg.h into bitops.h as
      well and use the macros there, which is otherwise impossible due
      to include order dependency issues.)
      
      The tilepro _atomic_xxx internal methods were previously set up to
      take atomic_t and atomic64_t arguments, which isn't as convenient
      with the new model, so I modified them to take int or u64 arguments,
      which is consistent with how they used the arguments internally
      anyway, so provided some nice simplification there too.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      6dc9658f
  8. 04 9月, 2013 11 次提交
    • C
      tile PCI RC: make default consistent DMA mask 32-bit · b40f451d
      Chris Metcalf 提交于
      This change sets the PCI devices' initial DMA capabilities
      conservatively and promotes them at the request of the driver,
      as opposed to assuming advanced DMA capabilities. The old design
      runs the risk of breaking drivers that assume default capabilities.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      b40f451d
    • C
      tile: make __write_once a synonym for __read_mostly · ce61cdc2
      Chris Metcalf 提交于
      This was really only useful for TILE64 when we mapped the
      kernel data with small pages. Now we use a huge page and we
      really don't want to map different parts of the kernel
      data in different ways.
      
      We retain the __write_once name in case we want to bring
      it back to life at some point in the future.
      
      Note that this change uncovered a latent bug where the
      "smp_topology" variable happened to always be aligned mod 8
      so we could store two "int" values at once, but when we
      eliminated __write_once it ended up only aligned mod 4.
      Fix with an explicit annotation.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      ce61cdc2
    • C
      tile: remove support for TILE64 · d7c96611
      Chris Metcalf 提交于
      This chip is no longer being actively developed for (it was superceded
      by the TILEPro64 in 2008), and in any case the existing compiler and
      toolchain in the community do not support it.  It's unlikely that the
      kernel works with TILE64 at this point as the configuration has not been
      tested in years.  The support is also awkward as it requires maintaining
      a significant number of ifdefs.  So, just remove it altogether.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      d7c96611
    • A
      tile: use asm-generic/bitops/builtin-*.h · d6a0aa31
      Akinobu Mita 提交于
      The definisions of __ffs(), __fls(), and ffs() for tile are almost same
      as asm-generic/bitops-*.h.  The only difference is that it is defined
      as __always_inline or inline.  So this switches to use those headers.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> [moved #includes to end]
      d6a0aa31
    • C
      729b25a4
    • C
      4c63de8d
    • C
      tile PCI RC: add comment about "PCI hole" problem · 5e7705df
      Chris Metcalf 提交于
      Explain the rationale of not overlapping the 64-bit DMA window
      with the PA range.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      5e7705df
    • C
      tile: add virt_to_kpte() API and clean up and document behavior · 640710a3
      Chris Metcalf 提交于
      We use virt_to_pte(NULL, va) a lot, which isn't very obvious.
      I added virt_to_kpte(va) as a more obvious wrapper function,
      that also validates the va as being a kernel adddress.
      
      And, I fixed the semantics of virt_to_pte() so that we handle
      the pud and pmd the same way, and we now document the fact that
      we handle the final pte level differently.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      640710a3
    • C
      tilegx: support KGDB · 8157107b
      Chris Metcalf 提交于
      Enter kernel debugger at boot with:
        --hvd UART_1=1 --hvx kgdbwait --hvx kgdboc=ttyS1,115200
      or at runtime with:
        echo ttyS1,115200 > /sys/module/kgdboc/parameters/kgdboc
        echo g > /proc/sysrq-trigger
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      8157107b
    • C
      tile: parameterize VA and PA space more cleanly · acbde1db
      Chris Metcalf 提交于
      The existing code relied on the hardware definition (<arch/chip.h>)
      to specify how much VA and PA space was available.  It's convenient
      to allow customizing this for some configurations, so provide symbols
      MAX_PA_WIDTH and MAX_VA_WIDTH in <asm/page.h> that can be modified
      if desired.
      
      Additionally, move away from the MEM_XX_INTRPT nomenclature to
      define the start of various regions within the VA space.  In fact
      the cleaner symbol is, for example, MEM_SV_START, to indicate the
      start of the area used for supervisor code; the actual address of the
      interrupt vectors is not as important, and can be changed if desired.
      As part of this change, convert from "intrpt1" nomenclature (which
      built in the old privilege-level 1 model) to a simple "intrpt".
      
      Also strip out some tilepro-specific code supporting modifying the
      PL the kernel could run at, since we don't actually support using
      different PLs in tilepro, only tilegx.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      acbde1db
    • C
      tile: don't assume user privilege is zero · 051168df
      Chris Metcalf 提交于
      Technically, user privilege is anything less than kernel
      privilege.  We modify the existing user_mode() macro to have
      this semantic (and use it in a couple of places it wasn't being
      used before), and add an IS_KERNEL_EX1() macro to the assembly
      code as well.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      051168df
  9. 30 8月, 2013 8 次提交
  10. 14 8月, 2013 5 次提交
    • C
      tile: implement gettimeofday() via vDSO · 4a556f4f
      Chris Metcalf 提交于
      This change creates the framework for vDSO calls, makes the existing
      rt_sigreturn() mechanism use it, and adds a fast gettimeofday().
      Now that we need to expose the vDSO address to userspace, we add
      AT_SYSINFO_EHDR to the set of aux entries provided to userspace.
      (You can disable any extra vDSO support by booting with vdso=0,
      but the rt_sigreturn vDSO page will still be provided.)
      
      Note that glibc has supported the tile vDSO since release 2.17.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      4a556f4f
    • C
      tile: improve big-endian support · ba02f0eb
      Chris Metcalf 提交于
      First, fix a bug in asm/unaligned.h; we need to just use the asm-generic
      unaligned.h so we properly choose endian-correct flavors.
      
      Second, keep the hv/hypervisor.h ABI fully "native" in the sense that
      we don't have __BIG_ENDIAN__ ifdefs there.  Instead, we use macros in
      the head_NN.S assembly code to properly extract two 32-bit structure
      members from a 64-bit register holding the structure.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      ba02f0eb
    • C
      tile: support CONFIG_PREEMPT · bc1a298f
      Chris Metcalf 提交于
      This change adds support for CONFIG_PREEMPT (full kernel preemption).
      In addition to the core support, this change includes a number
      of places where we fix up uses of smp_processor_id() and per-cpu
      variables.  I also eliminate the PAGE_HOME_HERE and PAGE_HOME_UNKNOWN
      values for page homing, as it turns out they weren't being used.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      bc1a298f
    • C
      tile: avoid recursive backtrace faults · 3ef23111
      Chris Metcalf 提交于
      This change adds support for avoiding recursive backtracer crashes;
      we haven't seen this in practice other than when things are seriously
      corrupt, but it may help avoid losing the root cause of a crash.
      
      Also, don't abort kernel backtracers for invalid userspace PC's.
      If we do, we lose the ability to backtrace through a userspace
      call to a bad address above PAGE_OFFSET, even though that it can
      be perfectly reasonable to continue the backtrace in such a case.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      3ef23111
    • C
      tile: fast-path unaligned memory access for tilegx · 2f9ac29e
      Chris Metcalf 提交于
      This change enables unaligned userspace memory access via a kernel
      fast path on tilegx.  The kernel tracks user PC/instruction pairs
      per-thread using a direct-mapped cache in userspace.  The cache
      maps those PC/instruction pairs to JIT'ed instruction sequences that
      load or store using byte-wide load store intructions and then
      synthesize 2-, 4- or 8-byte load or store results.  Once an
      instruction has been seen to generate an unaligned access once,
      subsequent hits on that instruction typically require overhead
      of only around 50 cycles if cache and TLB is hot.
      
      We support the prctl() PR_GET_UNALIGN / PR_SET_UNALIGN sys call to
      enable or disable unaligned fixups on a per-process basis.
      
      To do this we pull some of the tilepro unaligned support out of the
      single_step.c file; tilepro uses instruction disassembly for both
      single-step and unaligned access support.  Since tilegx actually has
      hardware singlestep support, though, it's cleaner to keep the tilegx
      unaligned access code in a separate file.  While we're at it,
      properly rename the tilepro-specific types, etc., to have tilepro
      suffixes instead of generic tile suffixes.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      2f9ac29e
  11. 13 8月, 2013 1 次提交
    • C
      tile: various console improvements · bda0f5ba
      Chris Metcalf 提交于
      This change improves and cleans up the tile console.
      
      - We enable HVC_IRQ support on tilegx, with the addition of a new
        Tilera hypervisor API for tilegx to allow a console IPI.  If IPI
        support is not available we fall back to the previous polling mode.
      
      - We simplify the earlyprintk code to use CON_BOOT and eliminate some
        of the other supporting earlyprintk code.
      
      - A new tile_console_write() primitive is used to send output to
        the console and is factored out of the hvc_tile driver.
        This lets us support a "sim_console" boot argument to allow using
        simulator hooks to send output to the "console" as a slightly
        faster alternative to emulating the hardware more directly.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bda0f5ba
  12. 07 8月, 2013 6 次提交
    • C
      7c29b78a
    • C
      tile PCI RC: add dma_get_required_mask() · dc7d5cf2
      Chris Metcalf 提交于
      The standard kernel function dma_get_required_mask() uses the
      highest DRAM address to determine if 32-bit or 64-bit DMA addressing
      is needed.  This only works on architectures that have direct mapping
      between the PA and the PCI address space, i.e. those that don't have
      I/O TLBs or have I/O TLB but choose to use direct mapping.  Neither
      of these are true for tilegx.  Whether to use 64-bit DMA should depend
      on the PCI device's capability only, not on the amount of DRAM
      installeds, so we now advertise a 64-bit DMA mask unconditionally.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      dc7d5cf2
    • C
      tile PCI RC: eliminate pci_controller.mem_resources field · 11981687
      Chris Metcalf 提交于
      The .mem_resources[] field in the pci_controller struct
      is now obsoleted by the .mem_space and .io_space fields.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      11981687
    • C
      tile PCI RC: restructure TRIO initialization · 1c43649a
      Chris Metcalf 提交于
      The TRIO shim initialization is shared with other kernel drivers
      such as the endpoint and StreamIO drivers, so reorganize the
      initialization flow to ensure that the root complex driver properly
      initializes TRIO state regardless of what kind of TRIO driver will
      end up using the shim.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      1c43649a
    • C
      tile PCI RC: support I/O space access · cf89c426
      Chris Metcalf 提交于
      To enable this functionality, configure CONFIG_TILE_PCI_IO.  Without
      this flag, the kernel still assigns I/O address ranges to the
      devices, but no TRIO resource and mapping support is provided.
      
      We assign disjoint I/O address ranges to separate PCIe domains.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      cf89c426
    • C
      tile: support LSI MEGARAID SAS HBA hybrid dma_ops · 803c874a
      Chris Metcalf 提交于
      The LSI MEGARAID SAS HBA suffers from the problem where it can do
      64-bit DMA to streaming buffers but not to consistent buffers.
      In other words, 64-bit DMA is used for disk data transfers and 32-bit
      DMA must be used for control message transfers. According to LSI,
      the firmware is not fully functional yet. This change implements a
      kind of hybrid dma_ops to support this.
      
      Note that on most other platforms, the 64-bit DMA addressing space is the
      same as the 32-bit DMA space and they overlap the physical memory space.
      No special arrangement is needed to support this kind of mixed DMA
      capability.  On TILE-Gx, the 64-bit DMA space is completely separate
      from the 32-bit DMA space.  Due to the use of the IOMMU, the 64-bit DMA
      space doesn't overlap the physical memory space.  On the other hand,
      the 32-bit DMA space overlaps the physical memory space under 4GB.
      The separate address spaces make it necessary to have separate dma_ops.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      803c874a
  13. 06 8月, 2013 1 次提交