mm: remove swap token code

The swap token code no longer fits in with the current VM model.  It
does not play well with cgroups or the better NUMA placement code in
development, since we have only one swap token globally.

It also has the potential to mess with scalability of the system, by
increasing the number of non-reclaimable pages on the active and
inactive anon LRU lists.

Last but not least, the swap token code has been broken for a year
without complaints, as reported by Konstantin Khlebnikov.  This suggests
we no longer have much use for it.

The days of sub-1G memory systems with heavy use of swap are over.  If
we ever need thrashing reducing code in the future, we will have to
implement something that does scale.

Signed-off-by: Rik van Riel <riel@redhat.com>
Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Hugh Dickins <hughd@google.com>
Acked-by: Bob Picco <bpicco@meloft.net>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
msm: remove fmem support

This functionality is deprecated and no longer supported.
ARM: removed VCM framework

This framework wasn't accepted upstream and is not used.
drivers/cpufreq: conservative: simplified SAMPLING_TIME determination

...because simple things can be good things, too.

This commit introduces MIN_SAMPLING_RATE & DEF_SAMPLING_RATE
which are used to directly set the driver's minimum and default
sampling rate rather than doing any calculation before.

DEF_FREQUENCY_DOWN_THRESHOLD gets increased to a more reasonable value.
refactoring -> drivers: power: Detect device suspend/resume lockup and log event in pstore

    Rather than hard-lock the kernel, dump the suspend/resume thread stack and
    panic() to capture a message in pstore when a driver takes too long to
    suspend/resume. Default suspend/resume watchdog timeout is set to 12
    seconds to be longer than the usbhid 10 second timeout, but could be
    changed at compile time.

    Exclude from the watchdog the time spent waiting for children that
    are resumed asynchronously and time every device, whether or not they
    resumed synchronously.

    This patch is targeted for mobile devices where a suspend/resume lockup
    could cause a system reboot. Information about failing device can be
    retrieved in subsequent boot session by mounting pstore and inspecting
    the log. Laptops with EFI-enabled pstore could also benefit from
    this feature.

    The hardware watchdog timer is likely suspended during this time and
    couldn't be relied upon. The soft-lockup detector would eventually tell
    that tasks are not scheduled, but would provide little context as to why.
    The patch hence uses system timer and assumes it is still active while the
    devices are suspended/resumed.

    This feature can be enabled/disabled during kernel configuration.

    Cc: Android Kernel Team <kernel-team@android.com>
    Cc: Colin Cross <ccross@android.com>
    Cc: Todd Poynor <toddpoynor@google.com>
    Cc: San Mehat <san@google.com>
    Original-author: San Mehat <san@google.com>
    Signed-off-by: Benoit Goby <benoit@android.com>
    [zoran.markovic@linaro.org: Changed printk(KERN_EMERG,...) to pr_emerg(...),
    tweaked commit message. Moved call to dpm_wd_set() before device_lock() in
    device_resume(). Minor changes to add compile-time inclusion of the feature.
    Renamed 'dpm_wd...' to 'dpm_watchdog...'.]
    Signed-off-by: Zoran Markovic <zoran.markovic@linaro.org>
touchscreen: adding fuzz to improve ovation sensitivity

Adding a fuzz factor to improve X/Y touch registration.
USB: OTG: Vote against APP's idle PC in USB Host Mode

In USB Host mode, When the target is going to APP's
idle PC and coming out with any peripheral device
connected, target is crashing. Fix this issue by
not allowing Idle PC in USB Host Mode.

Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
(cherry picked from commit 9d672c8f341fc2bbee2c6ee0108d7d8eedbe999f)

Change-Id: If590888fdc4dd52b4a3014c77f2d14ad7a30b4da
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
USB: OTG: Restore autodection in OTG peripheral mode
SOUND: *updating to MSM-3.4 drivers*
ADSP: QDSP5: *squashing updates*

msm: adsp: qdsp5: Allow MOD_READY event in ENABLING state

      JPEGTASK is receiving MOD_READY event after it is disabled
      which is not expected. When JPEGTASK enable fails with
      ETIMEDOUT error, this module is disabled immediately.
      But MOD_READY event for this module is sent by RPC to
      Apps ADSP Driver even after it is disabled. Ignore this
      event incase module state is not in ENABLING state.

      CRs-Fixed: 395420
      Change-Id: I0bd637f8bee84e811a400ac107f81d3df7a64a07
      Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>

qdsp5: audio: Add support for adsp dump mechanism

      Whenever timeout happens at apps while waiting for response
      from ADSP services, dsp or audmgr apps initiates command to
      collect cache coherent dumps to modem ADSP services to collect
      dump. This will help in debugging the timeout issue.

      Change-Id: Ic48d2815611afea8fed38c2c235e539619bed0ea
      Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>

msm: audio: qdsp5: Add support for MIDI method

      Currenly CAD driver only supports VOICE method when setting volume.
      For applying dynamic PMIC gain MIDI method is used. Changes are made
      to support MIDI method also.

      Change-Id: Id2d4868c88ef1fc08bbdbd3757905edc5435923c
      Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>

qdsp5: mvs: Allow only single instance of mvs session

      During MVS open, mvs driver calls msm_rpc_connect to establish
      rpc connection with modem mvs server without checking for
      current state of mvs driver. This causes modem oncrpc memory
      pool to exhaust if back to back open is called without closing
      the mvs driver.

      Added check to call rpc connect only if mvs driver is in
      closed state.

      CRs-Fixed: 433208
      Change-Id: Id8274318096ba3e774925451999670eebe0a66c1
      Signed-off-by: Manish Dewangan <manish@codeaurora.org>

msm: audio: qdsp5: Fix for wrong device values sent to acdb

      Wrong device values are being sent acdb driver callback function.
      This is because for a new audio manager session which gets registered,
      device info is sent only when there is change in device configuration
      or sample rate configuration. Due to this, not all sessions are updated
      with the current device info and wrong values are sent to acdb.
      Avoid this by maintaining a common device info across all sessions
      to send correct device values.

      CRs-Fixed: 420467
      Change-Id: I1d5555252aa56fddf28f06df5b60df6579f1ed7d
      Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>

qdsp5: audio: Allow audio preprocessing only from acdb driver

      audio pp(preprocessing) features enabled via acdb (Audio calibration
      database) driver gets disabled by audio pcm encoder driver if audio
      record enable acknowledgement comes after applying pp parameter
      via acdb.

      Fix this by allowing audio pp enable from pcm driver only
      if acdb support is not available.

      CRs-Fixed: 436891
      Change-Id: I2882752f55ac1c3ac3160d28c081dd9940b9f83e
      Signed-off-by: Manish Dewangan <manish@codeaurora.org>

msm: audio: qdsp5: Allow postprocessing only from acdb if present

      Audio postprocessing(audio pp) features enabled via acdb (Audio calibration
      database) driver gets disabled by audio postprocessing driver during
      open.
      Fix this by allowing legacy audio pp feature enable from postprocessing
      driver only if acdb support is not available. Acdb driver maintains wrong
      state due to improper update of stream id which is used to maintain
      number of active sessions. Due to this postprocessing features are
      enabled even before audpp task is enabled in adsp.

      Change-Id: I817263b0134f0302e64093148bafbe559cbc100a
      CRs-Fixed: 409488
      Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>

msm: audio: qdsp5: Add wake up in audio manager callback

      Audio manager enable is failing on timeout in few cases.
      In audio manager callback for codec config, wake up is missing
      in cases where CAD(Common Application Device) is not present.
      Due to this timeout happens in enable call while waiting on
      above condition. Add wake up in such case to avoid issues.

      CRs-Fixed: 439047
      Change-Id: I2c176513dd2aadf17190228e60bf042a794d8daf
      Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>

qdsp5: audio: Avoid race condition by using mutex lock

      There is chance of race condtion if audpp(audio postprocessing)
      callback registration function is called concurrently
      by more than one clients.

      Avoid this by serializing audpp callback function using
      mutex lock.

      CRs-Fixed: 441525
      Change-Id: Ic7524d83b32d54b09ba77648a266585957f49648
      Signed-off-by: Manish Dewangan <manish@codeaurora.org>

qdsp5: mvs: Fix kernel panic due to early closure of endpont

      MVS driver closes the RPC endpoint while it sends reply to the
      RPC read sometimes. The RPC write for this reply results in
      crash as endpoint is already closed.
      Wait for RPC read and reply to complete before closing the
      endpoint.

      CRs-Fixed: 443706
      Change-Id: Ia1918082118f23ab9aefec1c3a04908d8d8c1199
      Signed-off-by: Sriranjan Srikantam <cssrika@codeaurora.org>

msm: audio: qdsp5: Add support of dynamic re-enable of post proc

      DSP can disable the post processing features due to unavailability
      of MIPS during video playback. As a result difference in audio
      quality is observed after video playback. Add support to re-enable
      the post processing features once video playback ends and MIPS are
      available.
      DSP sends a message whenever post processing features are disabled
      due to unavailability of MIPS and sends another message once the
      MIPS are available. AUDPP driver broadcasts these messages to all
      the relavant clients which keeps track of disabled features and
      re-enables them when re-enable message is received from DSP.

      Change-Id: Ic4cad4e7b0afe4377006055417ba193b01cce930
      Signed-off-by: Sriranjan Srikantam <cssrika@codeaurora.org>

qdsp5: audio: Release wake_lock resources at exit

      Wake_lock resources acquired during module init are not
      released during exit. This leads to corruption in list
      maintained by wake_lock driver and cause crash.
      Release the resources before exiting the module.

      CRs-Fixed: 405797
      Change-Id: I6340fff390af677c47c59264e01f6cd723fea357
      Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>

qdsp5: audio: Check for earlysuspend support.

      Declaration of audac3_post_event is not currently
      guarded by an ifdef check for CONFIG_HAS_EARLYSUSPEND
      (the function's definition is), causing builds without
      early suspend to fail. Use the ifdef check for the
      declaration to avoid this.

      Change-Id: I5a5758df6b543d100351644b20795b30f74e556b
      Signed-off-by: Anurag Singh <anursing@codeaurora.org>

msm: Remove all references to pmem from audio files

      PMEM is no longer supported. Remove all references to it.

      Change-Id: If68c41901b8fb0b9382650c3123a68958f769761
      Signed-off-by: Laura Abbott <lauraa@codeaurora.org>

qdsp5: memset stack buffer allocation.

      This is needed to avoid garbage data in uninitialized variables.

      Change-Id: I3a043a4ce4e14d8e0c24b434181dff484eddac72
      Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
drivers/radio-tavarua: *syncing with CodeAurora*
ZRAM / ZSMALLOC: *squashing updates*

backported for kernel 3.4.y

currently following patches are missing due of missing compatibility:
(they don't improve functionality though)

  -> "block: Abstract out bvec iterator"
  -> "block: Convert bio_for_each_segment() to bvec_iter"

-----------------------------------------------------------------------------

zram: drop `init_done' struct zram member

      Introduce init_done() helper function which allows us to drop `init_done'
      struct zram member.  init_done() uses the fact that ->init_done == 1
      equals to ->meta != NULL.

      Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: Minchan Kim <minchan@kernel.org>
      Acked-by: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

zram: use atomic64_t for all zram stats

      This is a preparation patch for stats code duplication removal.

      1) use atomic64_t for `pages_zero' and `pages_stored' zram stats.

      2) `compr_size' and `pages_zero' struct zram_stats members did not

	follow the existing device attr naming scheme: zram_stats.ATTR has
	ATTR_show() function.  rename them:

	-- compr_size -> compr_data_size
	-- pages_zero -> zero_pages

      Minchan Kim's note:
      If we really have trouble with atomic stat operation, we could
      change it with percpu_counter so that it could solve atomic overhead and
      unnecessary memory space by introducing unsigned long instead of 64bit
      atomic_t.

      Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: Minchan Kim <minchan@kernel.org>
      Acked-by: Jerome Marchand <jmarchan@redhat.com>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

zram: remove good and bad compress stats

      Remove `good' and `bad' compressed sub-requests stats.  RW request may
      cause a number of RW sub-requests.  zram used to account `good' compressed
      sub-queries (with compressed size less than 50% of original size), `bad'
      compressed sub-queries (with compressed size greater that 75% of original
      size), leaving sub-requests with compression size between 50% and 75% of
      original size not accounted and not reported.  zram already accounts each
      sub-request's compression size so we can calculate real device compression
      ratio.

      Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: Minchan Kim <minchan@kernel.org>
      Acked-by: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

zram: remove zram stats code duplication

      Introduce ZRAM_ATTR_RO macro that generates device_attribute and default
      ATTR show() function for existing atomic64_t zram stats.

      Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: Minchan Kim <minchan@kernel.org>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

zram: report failed read and write stats

      zram accounted but did not report numbers of failed read and write
      queries.  make these stats available as failed_reads and failed_writes
      attrs.

      Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: Minchan Kim <minchan@kernel.org>
      Acked-by: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

zram: drop not used table `count' member

      struct table `count' member is not used.

      Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Acked-by: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

zram: move zram size warning to documentation

      Move zram warning about disksize and size of memory correlation to zram
      documentation.

      Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: Minchan Kim <minchan@kernel.org>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

zram: delete zram_init_device()

      allocate new `zram_meta' in disksize_store() only for uninitialised zram
      device, saving a number of allocations and deallocations in case if
      disksize_store() was called on currently used device.  at the same time
      zram_meta stack variable is not necessary, because we can set ->meta
      directly.  there is also no need in setting QUEUE_FLAG_NONROT queue on
      every disksize_store(), set it once during device creation.

      [minchan@kernel.org: handle zram->meta alloc fail case]
      [minchan@kernel.org: prevent lockdep spew of init_lock]
      Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Signed-off-by: Minchan Kim <minchan@kernel.org>
      Acked-by: Jerome Marchand <jmarchan@redhat.com>
      Cc: Sasha Levin <sasha.levin@oracle.com>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

zram: support REQ_DISCARD (modified!)

  Changes in function: static void zram_bio_discard
  From: size_t n = bio->bi_iter.bi_size;
  To: size_t n = bio->bi_size;

      zram is ram based block device and can be used by backend of filesystem.
      When filesystem deletes a file, it normally doesn't do anything on data
      block of that file.  It just marks on metadata of that file.  This
      behavior has no problem on disk based block device, but has problems on
      ram based block device, since we can't free memory used for data block.
      To overcome this disadvantage, there is REQ_DISCARD functionality.  If
      block device support REQ_DISCARD and filesystem is mounted with discard
      option, filesystem sends REQ_DISCARD to block device whenever some data
      blocks are discarded.  All we have to do is to handle this request.

      This patch implements to flag up QUEUE_FLAG_DISCARD and handle this
      REQ_DISCARD request.  With it, we can free memory used by zram if it isn't
      used.

      [akpm@linux-foundation.org: tweak comments]
      Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

zram: do not pass rw argument to __zram_make_request()

      Do not pass rw argument down the __zram_make_request() -> zram_bvec_rw()
      chain, decode it in zram_bvec_rw() instead.  Besides, this is the place
      where we distinguish READ and WRITE bio data directions, so account zram
      RW stats here, instead of __zram_make_request().  This also allows to
      account a real number of zram READ/WRITE operations, not just requests
      (single RW request may cause a number of zram RW ops with separate
      locking, compression/decompression, etc).

      Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: Minchan Kim <minchan@kernel.org>
      Acked-by: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: moddingg33k <moddingg33k@t-online.de>
staging/android: *squashing updates*

Signed-off-by: moddingg33k <moddingg33k@t-online.de>
lib/lzo: Update LZO compression to current upstream version

This commit updates the kernel LZO code to the current upsteam version
which features a significant speed improvement - benchmarking the Calgary
and Silesia test corpora typically shows a doubled performance in
both compression and decompression on modern i386/x86_64/powerpc machines.

Signed-off-by: Markus F.X.J. Oberhumer <markus@oberhumer.com>
drivers: msm/rmnet: *squashed patches from CAF*

msm: rmnet: do not close the SMD port during close IOCTL

When the close IOCTL is called, the driver currently closes the
underlying SMD port. This results in sending DTR drop to the modem thus
closing all QMI clients open on that port.

Change the close behavior to be localized within RMNET driver.

CRs-Fixed: 393562
Change-Id: Ib7f25b35acfb4058018a82337c482dcdd333bf41
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>

msm: rmnet: Use separate tasklet for each rmnet instance

If multiple RMNET devices are active at the same time, there is a data
collision issue for the single tasklet structure that could result in
losing SMD receive events.

Add a dedicated receive tasklet structure for each RMNET instance.

CRs-Fixed: 425114
Change-Id: I160195fd2a002b9c6f47b4b29fd0af355482a3b5
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
FREEZER: *squashing updates by Colin Cross (05/2013)*

freezer: add unsafe versions of freezable helpers for NFS

      NFS calls the freezable helpers with locks held, which is unsafe
      and will cause lockdep warnings when 6aa9707 "lockdep: check
      that no locks held at freeze time" is reapplied (it was reverted
      in dbf520a).  NFS shouldn't be doing this, but it has
      long-running syscalls that must hold a lock but also shouldn't
      block suspend.  Until NFS freeze handling is rewritten to use a
      signal to exit out of the critical section, add new *_unsafe
      versions of the helpers that will not run the lockdep test when
      6aa9707 is reapplied, and call them from NFS.

      In practice the likley result of holding the lock while freezing
      is that a second task blocked on the lock will never freeze,
      aborting suspend, but it is possible to manufacture a case using
      the cgroup freezer, the lock, and the suspend freezer to create
      a deadlock.  Silencing the lockdep warning here will allow
      problems to be found in other drivers that may have a more
      serious deadlock risk, and prevent new problems from being added.

      Signed-off-by: Colin Cross <ccross@android.com>
      Acked-by: Pavel Machek <pavel@ucw.cz>
      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

freezer: add unsafe versions of freezable helpers for CIFS

      CIFS calls wait_event_freezekillable_unsafe with a VFS lock held,
      which is unsafe and will cause lockdep warnings when 6aa9707
      "lockdep: check that no locks held at freeze time" is reapplied
      (it was reverted in dbf520a).  CIFS shouldn't be doing this, but
      it has long-running syscalls that must hold a lock but also
      shouldn't block suspend.  Until CIFS freeze handling is rewritten
      to use a signal to exit out of the critical section, add a new
      wait_event_freezekillable_unsafe helper that will not run the
      lockdep test when 6aa9707 is reapplied, and call it from CIFS.

      In practice the likley result of holding the lock while freezing
      is that a second task blocked on the lock will never freeze,
      aborting suspend, but it is possible to manufacture a case using
      the cgroup freezer, the lock, and the suspend freezer to create
      a deadlock.  Silencing the lockdep warning here will allow
      problems to be found in other drivers that may have a more
      serious deadlock risk, and prevent new problems from being added.

      Acked-by: Pavel Machek <pavel@ucw.cz>
      Acked-by: Tejun Heo <tj@kernel.org>
      Reviewed-by: Jeff Layton <jlayton@redhat.com>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

lockdep: remove task argument from debug_check_no_locks_held

      The only existing caller to debug_check_no_locks_held calls it
      with 'current' as the task, and the freezer needs to call
      debug_check_no_locks_held but doesn't already have a current
      task pointer, so remove the argument.  It is already assuming
      that the current task is relevant by dumping the current stack
      trace as part of the warning.

      This was originally part of 6aa9707099c (lockdep: check that
      no locks held at freeze time) which was reverted in
      dbf520a9d7d4.

      Original-author: Mandeep Singh Baines <msb@chromium.org>
      Acked-by: Pavel Machek <pavel@ucw.cz>
      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

freezer: shorten freezer sleep time using exponential backoff

      All tasks can easily be frozen in under 10 ms, switch to using
      an initial 1 ms sleep followed by exponential backoff until
      8 ms.  Also convert the printed time to ms instead of centiseconds.

      Acked-by: Pavel Machek <pavel@ucw.cz>
      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

freezer: skip waking up tasks with PF_FREEZER_SKIP set

      Android goes through suspend/resume very often (every few seconds when
      on a busy wifi network with the screen off), and a significant portion
      of the energy used to go in and out of suspend is spent in the
      freezer.  If a task has called freezer_do_not_count(), don't bother
      waking it up.  If it happens to wake up later it will call
      freezer_count() and immediately enter the refrigerator.

      Combined with patches to convert freezable helpers to use
      freezer_do_not_count() and convert common sites where idle userspace
      tasks are blocked to use the freezable helpers, this reduces the
      time and energy required to suspend and resume.

      Acked-by: Tejun Heo <tj@kernel.org>
      Acked-by: Pavel Machek <pavel@ucw.cz>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

freezer: convert freezable helpers to freezer_do_not_count()

      Freezing tasks will wake up almost every userspace task from
      where it is blocking and force it to run until it hits a
      call to try_to_sleep(), generally on the exit path from the syscall
      it is blocking in.  On resume each task will run again, usually
      restarting the syscall and running until it hits the same
      blocking call as it was originally blocked in.

      Convert the existing wait_event_freezable* wrappers to use
      freezer_do_not_count().  Combined with a previous patch,
      these tasks will not run during suspend or resume unless they wake
      up for another reason, in which case they will run until they hit
      the try_to_freeze() in freezer_count(), and then continue processing
      the wakeup after tasks are thawed.

      This results in a small change in behavior, previously a race
      between freezing and a normal wakeup would be won by the wakeup,
      now the task will freeze and then handle the wakeup after thawing.

      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

freezer: convert freezable helpers to static inline where possible

      Some of the freezable helpers have to be macros because their
      condition argument needs to get evaluated every time through
      the wait loop.  Convert the others to static inline to make
      future changes easier.

      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

freezer: add new freezable helpers using freezer_do_not_count()

      Freezing tasks will wake up almost every userspace task from
      where it is blocking and force it to run until it hits a
      call to try_to_sleep(), generally on the exit path from the syscall
      it is blocking in.  On resume each task will run again, usually
      restarting the syscall and running until it hits the same
      blocking call as it was originally blocked in.

      To allow tasks to avoid running on every suspend/resume cycle,
      this patch adds additional freezable wrappers around blocking calls
      that call freezer_do_not_count().  Combined with the previous patch,
      these tasks will not run during suspend or resume unless they wake
      up for another reason, in which case they will run until they hit
      the try_to_freeze() in freezer_count(), and then continue processing
      the wakeup after tasks are thawed.

      Additional patches will convert the most common locations that
      userspace blocks in to use freezable helpers.

      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

binder: use freezable blocking calls

      Avoid waking up every thread sleeping in a binder call during
      suspend and resume by calling a freezable blocking call.  Previous
      patches modified the freezer to avoid sending wakeups to threads
      that are blocked in freezable blocking calls.

      This call was selected to be converted to a freezable call because
      it doesn't hold any locks or release any resources when interrupted
      that might be needed by another freezing task or a kernel driver
      during suspend, and is a common site where idle userspace tasks are
      blocked.

      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

epoll: use freezable blocking call

      Avoid waking up every thread sleeping in an epoll_wait call during
      suspend and resume by calling a freezable blocking call.  Previous
      patches modified the freezer to avoid sending wakeups to threads
      that are blocked in freezable blocking calls.

      This call was selected to be converted to a freezable call because
      it doesn't hold any locks or release any resources when interrupted
      that might be needed by another freezing task or a kernel driver
      during suspend, and is a common site where idle userspace tasks are
      blocked.

      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

select: use freezable blocking call

      Avoid waking up every thread sleeping in a select call during
      suspend and resume by calling a freezable blocking call.  Previous
      patches modified the freezer to avoid sending wakeups to threads
      that are blocked in freezable blocking calls.

      This call was selected to be converted to a freezable call because
      it doesn't hold any locks or release any resources when interrupted
      that might be needed by another freezing task or a kernel driver
      during suspend, and is a common site where idle userspace tasks are
      blocked.

      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

futex: use freezable blocking call

      Avoid waking up every thread sleeping in a futex_wait call during
      suspend and resume by calling a freezable blocking call.  Previous
      patches modified the freezer to avoid sending wakeups to threads
      that are blocked in freezable blocking calls.

      This call was selected to be converted to a freezable call because
      it doesn't hold any locks or release any resources when interrupted
      that might be needed by another freezing task or a kernel driver
      during suspend, and is a common site where idle userspace tasks are
      blocked.

      Acked-by: Tejun Heo <tj@kernel.org>
      Acked-by: Thomas Gleixner <tglx@linutronix.de>
      Acked-by: Darren Hart <dvhart@linux.intel.com>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

nanosleep: use freezable blocking call

      Avoid waking up every thread sleeping in a nanosleep call during
      suspend and resume by calling a freezable blocking call.  Previous
      patches modified the freezer to avoid sending wakeups to threads
      that are blocked in freezable blocking calls.

      This call was selected to be converted to a freezable call because
      it doesn't hold any locks or release any resources when interrupted
      that might be needed by another freezing task or a kernel driver
      during suspend, and is a common site where idle userspace tasks are
      blocked.

      Acked-by: Tejun Heo <tj@kernel.org>
      Acked-by: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

sigtimedwait: use freezable blocking call

      Avoid waking up every thread sleeping in a sigtimedwait call during
      suspend and resume by calling a freezable blocking call.  Previous
      patches modified the freezer to avoid sending wakeups to threads
      that are blocked in freezable blocking calls.

      This call was selected to be converted to a freezable call because
      it doesn't hold any locks or release any resources when interrupted
      that might be needed by another freezing task or a kernel driver
      during suspend, and is a common site where idle userspace tasks are
      blocked.

      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

af_unix: use freezable blocking calls in read

      Avoid waking up every thread sleeping in read call on an AF_UNIX
      socket during suspend and resume by calling a freezable blocking
      call.  Previous patches modified the freezer to avoid sending
      wakeups to threads that are blocked in freezable blocking calls.

      This call was selected to be converted to a freezable call because
      it doesn't hold any locks or release any resources when interrupted
      that might be needed by another freezing task or a kernel driver
      during suspend, and is a common site where idle userspace tasks are
      blocked.

      Acked-by: Tejun Heo <tj@kernel.org>
      Signed-off-by: Colin Cross <ccross@android.com>
      Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

HACK: ARM: disable sleeping while atomic warning in do_signal

      ARM disables interrupts in do_signal, which triggers a warning in
      try_to_freeze, see details at https://lkml.org/lkml/2011/8/23/221.
      To prevent the warnings, add try_to_freeze_nowarn and call it from
      do_signal.

      Change-Id: If7482de21c386adc705fa1ac4ecb8c7ece5bb356
      Signed-off-by: Colin Cross <ccross@android.com>

Signed-off-by: moddingg33k <moddingg33k@t-online.de>
HID: uhid: introduce user-space I/O driver support for HID

(this is a combination of 15 commits)

This adds a dummy driver that will support user-space I/O drivers for the
HID subsystem. This allows to write transport-level drivers like USB-HID
and Bluetooth-HID in user-space.

Low-Energy Bluetooth needs this to feed HID data that is parsed in
user-space back into the kernel.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: add internal message buffer

When receiving messages from the HID subsystem, we need to process them
and store them in an internal buffer so user-space can read() on the char
device to retrieve the messages.

This adds a static buffer for 32 messages to each uhid device. Each
message is dynamically allocated so the uhid_device structure does not get
too big.

uhid_queue() adds a message to the buffer. If the buffer is full, the
message is discarded. uhid_queue_event() is an helper for messages without
payload.

This also adds a public header: uhid.h. It contains the declarations for
the user-space API. It is built around "struct uhid_event" which contains
a type field which specifies the event type and each event can then add a
variable-length payload. For now, there is only a dummy event but later
patches will add new event types and payloads.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: allow poll()'ing on uhid devices

As long as the internal buffer is not empty, we return POLLIN to
user-space.

uhid->head and uhid->tail are no atomics so the comparison may return
inexact results. However, this doesn't matter here as user-space would
need to poll() in two threads simultaneously to trigger this. And in this
case it doesn't matter if a cached result is returned or the exact new
result as user-space does not know which thread returns first from poll()
and the following read(). So it is safe to compare the values without
locking.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: implement read() on uhid devices

User-space can use read() to get a single event from uhid devices. read()
does never return multiple events. This allows us to extend the event
structure and still keep backwards compatibility.

If user-space wants to get multiple events in one syscall, they should use
the readv()/writev() syscalls which are supported by uhid.

This introduces a new lock which helps us synchronizing simultaneous reads
from user-space. We also correctly return -EINVAL/-EFAULT only on errors
and retry the read() when some other thread captured the event faster than
we did.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: implement write() on uhid devices

Similar to read() you can only write() a single event with one call to an
uhid device. To write multiple events use writev() which is supported by
uhid.

We currently always return -EOPNOTSUPP but other events will be added in
later patches.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: add UHID_CREATE and UHID_DESTROY events

UHID_CREATE and UHID_DESTROY are used to create and destroy a device on an
open uhid char-device. Internally, we allocate and register an HID device
with the HID core and immediately start the device. From now on events may
be received or sent to the device.

The UHID_CREATE event has a payload similar to the data used by
Bluetooth-HIDP when creating a new connection.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: allow feeding input data into uhid devices

This adds a new event type UHID_INPUT which allows user-space to feed raw
HID reports into the HID subsystem. We copy the data into kernel memory
and directly feed it into the HID core.

There is no error handling of the events couldn't be parsed so user-space
should consider all events successfull unless read() returns an error.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: forward hid report-descriptor to hid core

When the uhid_hid_parse callback is called we simply forward it to
hid_parse_report() with the data that we got in the UHID_CREATE event.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: add UHID_START and UHID_STOP events

We send UHID_START and UHID_STOP events to user-space when the HID core
starts/stops the device. This notifies user-space about driver readiness
and data-I/O can start now.

This directly forwards the callbacks from hid-core to user-space.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: forward open/close events to user-space

HID core notifies us with *_open/*_close callbacks when there is an actual
user of our device. We forward these to user-space so they can react on
this. This allows user-space to skip I/O unless they receive an OPEN
event. When they receive a CLOSE event they can stop I/O again to save
energy.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: forward output request to user-space

If the hid-driver wants to send standardized data to the device it uses a
linux input_event. We forward this to the user-space transport-level
driver so they can perform the requested action on the device.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: forward raw output reports to user-space

Some drivers that use non-standard HID features require raw output reports
sent to the device. We now forward these requests directly to user-space
so the transport-level driver can correctly send it to the device or
handle it correspondingly.

There is no way to signal back whether the transmission was successful,
moreover, there might be lots of messages coming out from the driver
flushing the output-queue. However, there is currently no driver that
causes this so we are safe. If some drivers need to transmit lots of data
this way, we need a method to synchronize this and can implement another
UHID_OUTPUT_SYNC event.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: implement feature requests

HID standard allows sending a feature request to the device which is
answered by an HID report. uhid implements this by sending a UHID_FEATURE
event to user-space which then must answer with UHID_FEATURE_ANSWER. If it
doesn't do this in a timely manner, the request is discarded silently.

We serialize the feature requests, that is, there is always only a single
active feature-request sent to user-space, other requests have to wait.
HIDP and USB-HID do it the same way.

Because we discard feature-requests silently, we must make sure to match
a response to the corresponding request. We use sequence-IDs for this so
user-space must copy the ID from the request into the answer.
Feature-answers are ignored if they do not contain the same ID as the
currently pending feature request.

Internally, we must make sure that feature-requests are synchronized with
UHID_DESTROY and close() events. We must not dead-lock when closing the
HID device, either, so we have to use separate locks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: silence gcc warning

gcc is giving me:

drivers/hid/uhid.c: In function ‘uhid_hid_get_raw’:
drivers/hid/uhid.c:157: warning: ‘len’ may be used uninitialized in this function

which is clearly bogus, as

- when used as memcpy() argument, it's initialized properly
- the code is structured in a way that either 'ret' or 'len'
  is always initialized, so the return statement always has
  an initialized value.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>

HID: uhid: Fix sending events with invalid data

This was detected because events with invalid types were arriving
to userspace.

The code before this patch would only work for the first event in the
queue (when uhid->tail is 0).

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Reviewed-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Satish kumar sugasi <ssugas@codeaurora.org>
Frandom: adding FRANDOM v1.1 (Credits to: Eli billauer)

http://billauer.co.il/frandom.html
ARM: add support for kernel mode NEON

ARM: be strict about FP exceptions in kernel mode

      The support code in vfp_support_entry does not care whether the
      exception that caused it to be invoked occurred in kernel mode or
      in user mode. However, neither condition that could trigger this
      exception (lazy restore and VFP bounce to support code) is
      currently allowable in kernel mode.

      In either case, print a message describing the condition before
      letting the undefined instruction handler run its course and trigger
      an oops.

      Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: Nicolas Pitre <nico@linaro.org>

ARM: add support for kernel mode NEON

      In order to safely support the use of NEON instructions in
      kernel mode, some precautions need to be taken:
      - the userland context that may be present in the registers (even
	if the NEON/VFP is currently disabled) must be stored under the
	correct task (which may not be 'current' in the UP case),
      - to avoid having to keep track of additional vfpstates for the
	kernel side, disallow the use of NEON in interrupt context
	and run with preemption disabled,
      - after use, re-enable preemption and re-enable the lazy restore
	machinery by disabling the NEON/VFP unit.

      This patch adds the functions kernel_neon_begin() and
      kernel_neon_end() which take care of the above. It also adds
      the Kconfig symbol KERNEL_MODE_NEON to enable it.

      Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: Nicolas Pitre <nico@linaro.org>
optimized AES and SHA1 routines & NEON accelerated XOR

arm/crypto: Add optimized AES and SHA1 routines

      Add assembler versions of AES and SHA1 for ARM platforms.  This has provided
      up to a 50% improvement in IPsec/TCP throughout for tunnels using AES128/SHA1.

      Platform   CPU SPeed    Endian   Before (bps)   After (bps)   Improvement

      IXP425      533 MHz      big     11217042        15566294        ~38%
      KS8695      166 MHz     little    3828549         5795373        ~51%

      Signed-off-by: David McCullough <ucdevel@gmail.com>
      Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

ARM: 7626/1: arm/crypto: Make asm SHA-1 and AES code Thumb-2 compatible

      This patch fixes aes-armv4.S and sha1-armv4-large.S to work
      natively in Thumb.  This allows ARM/Thumb interworking workarounds
      to be removed.

      I also take the opportunity to convert some explicit assembler
      directives for exported functions to the standard
      ENTRY()/ENDPROC().

      For the code itself:

	* In sha1_block_data_order, use of TEQ with sp is deprecated in
	  ARMv7 and not supported in Thumb.  For the branches back to
	  .L_00_15 and .L_40_59, the TEQ is converted to a CMP, under the
	  assumption that clobbering the C flag here will not cause
	  incorrect behaviour.

	  For the first branch back to .L_20_39_or_60_79 the C flag is
	  important, so sp is moved temporarily into another register so
	  that TEQ can be used for the comparison.

	* In the AES code, most forms of register-indexed addressing with
	  shifts and rotates are not permitted for loads and stores in
	  Thumb, so the address calculation is done using a separate
	  instruction for the Thumb case.

      The resulting code is unlikely to be optimally scheduled, but it
      should not have a large impact given the overall size of the code.
      I haven't run any benchmarks.

      Signed-off-by: Dave Martin <dave.martin@linaro.org>
      Tested-by: David McCullough <ucdevel@gmail.com> (ARM only)
      Acked-by: David McCullough <ucdevel@gmail.com>
      Acked-by: Nicolas Pitre <nico@linaro.org>
      Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

ARM: 7723/1: crypto: sha1-armv4-large.S: fix SP handling

      Make the SHA1 asm code ABI conformant by making sure all stack
      accesses occur above the stack pointer.

      Origin:
      http://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=1a9d60d2

      Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: Nicolas Pitre <nico@linaro.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

ARM: 7837/3: fix Thumb-2 bug in AES assembler code

      Patch 638591c enabled building the AES assembler code in Thumb2 mode.
      However, this code used arithmetic involving PC rather than adr{l}
      instructions to generate PC-relative references to the lookup tables,
      and this needs to take into account the different PC offset when
      running in Thumb mode.

      Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: Nicolas Pitre <nico@linaro.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

      ARM: move AES typedefs and function prototypes to separate header

      Put the struct definitions for AES keys and the asm function prototypes in a
      separate header and export the asm functions from the module.
      This allows other drivers to use them directly.

      Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

      ARM: add support for bit sliced AES using NEON instructions

      Bit sliced AES gives around 45% speedup on Cortex-A15 for encryption
      and around 25% for decryption. This implementation of the AES algorithm
      does not rely on any lookup tables so it is believed to be invulnerable
      to cache timing attacks.

      This algorithm processes up to 8 blocks in parallel in constant time. This
      means that it is not usable by chaining modes that are strictly sequential
      in nature, such as CBC encryption. CBC decryption, however, can benefit from
      this implementation and runs about 25% faster. The other chaining modes
      implemented in this module, XTS and CTR, can execute fully in parallel in
      both directions.

      The core code has been adopted from the OpenSSL project (in collaboration
      with the original author, on cc). For ease of maintenance, this version is
      identical to the upstream OpenSSL code, i.e., all modifications that were
      required to make it suitable for inclusion into the kernel have been made
      upstream. The original can be found here:

	  http://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=6f6a6130

      Note to integrators:
      While this implementation is significantly faster than the existing table
      based ones (generic or ARM asm), especially in CTR mode, the effects on
      power efficiency are unclear as of yet. This code does fundamentally more
      work, by calculating values that the table based code obtains by a simple
      lookup; only by doing all of that work in a SIMD fashion, it manages to
      perform better.

      Cc: Andy Polyakov <appro@openssl.org>
      Acked-by: Nicolas Pitre <nico@linaro.org>
      Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

ARM: add .gitignore entry for aesbs-core.S

      This avoids this file being incorrectly added to git.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

CRYPTO: Fix more AES build errors

      Building a multi-arch kernel results in:

      arch/arm/crypto/built-in.o: In function `aesbs_xts_decrypt':
      sha1_glue.c:(.text+0x15c8): undefined reference to `bsaes_xts_decrypt'
      arch/arm/crypto/built-in.o: In function `aesbs_xts_encrypt':
      sha1_glue.c:(.text+0x1664): undefined reference to `bsaes_xts_encrypt'
      arch/arm/crypto/built-in.o: In function `aesbs_ctr_encrypt':
      sha1_glue.c:(.text+0x184c): undefined reference to `bsaes_ctr32_encrypt_blocks'
      arch/arm/crypto/built-in.o: In function `aesbs_cbc_decrypt':
      sha1_glue.c:(.text+0x19b4): undefined reference to `bsaes_cbc_encrypt'

      This code is already runtime-conditional on NEON being supported, so
      there's no point compiling it out depending on the minimum build
      architecture.

      Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

crypto: create generic version of ablk_helper

      Create a generic version of ablk_helper so it can be reused
      by other architectures.

      Acked-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
      Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

---------------------------------------------------------------------------------------------------

ARM: crypto: add NEON accelerated XOR implementation

      Add a source file xor-neon.c (which is really just the reference
      C implementation passed through the GCC vectorizer) and hook it
      up to the XOR framework.

      Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: Nicolas Pitre <nico@linaro.org>

ARM: 7835/2: fix modular build of xor_blocks() with NEON enabled

      Commit 0195659 introduced a NEON accelerated version of the xor_blocks()
      function, but it needs the changes in this patch to allow it to be built
      as a module rather than statically into the kernel.

      This patch creates a separate module xor-neon.ko which exports the NEON
      inner xor_blocks() functions depended upon by the regular xor.ko if it
      is built with CONFIG_KERNEL_MODE_NEON=y

      Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
      Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Optimized ARM RWSEM algorithm

      RWSEM implementation for ARM using atomic functions.
      Heavily based on arch/sh/include/asm/rwsem.h

      Signed-off-by: Ashwin Chaugule <ashwinc@codeaurora.org>