OSDN Git Service

sagit-ice-cold/kernel_xiaomi_msm8998.git
8 years agopower: move QTI charger drivers to a new sub-directory qcom-charger
Nicholas Troast [Fri, 12 Feb 2016 23:34:57 +0000 (15:34 -0800)]
power: move QTI charger drivers to a new sub-directory qcom-charger

QTI charger drivers have outgrown thier home in power and deserve their
own sub-directory. Move all QTI charger drivers and their depedencies to
a new sub-directory of power called qcom-charger.

Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
8 years agopower: pmic-voter: fix compilation issue
Nicholas Troast [Wed, 17 Feb 2016 22:21:07 +0000 (14:21 -0800)]
power: pmic-voter: fix compilation issue

Compilation fails when required by more than one goal due to a missing
header guard. Add it.

Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
8 years agopower: cleanup and remove duplicates from Kconfig
Nicholas Troast [Wed, 17 Feb 2016 22:07:43 +0000 (14:07 -0800)]
power: cleanup and remove duplicates from Kconfig

Many of the older SMB charger drivers are no longer present therefore
remove the config entries for them.

Duplicate config entries are present. Remove them.

Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
8 years agodefconfig: msm: Enable EPM
Siddartha Mohanadoss [Sat, 20 Feb 2016 01:43:45 +0000 (17:43 -0800)]
defconfig: msm: Enable EPM

Embedded power measurement (EPM) driver allows
clients to read supported current and voltage
channels for power measurements.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
8 years agohwmon: Enable EPM driver
Siddartha Mohanadoss [Thu, 18 Feb 2016 22:19:26 +0000 (14:19 -0800)]
hwmon: Enable EPM driver

This snapshot is taken as of msm-3.18 commit dbdb6776f
(Merge "msm: camera: Add dummy sub module in sensor pipeline")

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
8 years agodefconfig: arm64: msm: Enable qseecom driver
Zhen Kong [Fri, 19 Feb 2016 19:04:01 +0000 (11:04 -0800)]
defconfig: arm64: msm: Enable qseecom driver

This is necessary to support qseecom functionality

Signed-off-by: Zhen Kong <zkong@codeaurora.org>
8 years agoqseecom: add snapshot of qseecom driver
Zhen Kong [Mon, 22 Feb 2016 18:41:23 +0000 (10:41 -0800)]
qseecom: add snapshot of qseecom driver

This snapshot is taken as of msm-3.18 commit e70ad0cd
(Promotion of kernel.lnx.3.18-151201.)

Signed-off-by: Zhen Kong <zkong@codeaurora.org>
8 years agoarm64: smp: Update the topology masks before calling CPU_STARTING notifiers
Rohit Vaswani [Fri, 8 Aug 2014 00:38:41 +0000 (17:38 -0700)]
arm64: smp: Update the topology masks before calling CPU_STARTING notifiers

Currently, the CPU_STARTING notifiers would observe an incorrect sibling
mask since the notifier chain is called before the topology masks are
updated for the new cpu.
Update the topology masks before calling the notifier chain to fix this
problem.

Change-Id: I3f698d777af3bb8e324019619b4c1c4de85e7b2c
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
8 years agoARM64: Flush the caches for non panicking CPUs in case of a kernel panic
Abhimanyu Kapur [Thu, 3 Apr 2014 03:32:59 +0000 (20:32 -0700)]
ARM64: Flush the caches for non panicking CPUs in case of a kernel panic

In case of a kernel panic, only the panicking CPU does an entire
cache flush. This means that certain dirty cache lines in the
caches of the other CPUs may never get flushed. This gives us
improper RAM dumps. Add cache flushing for all the online CPUs.
The outer domain is not flushed since it is already being done by
the panicking CPU.

Change-Id: I03cf14f49334e45c145a17b06d0c623575b653e8
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
[satyap: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
8 years agoarm64: smp: Jump back to secondary start kernel for onlined CPUs
Abhimanyu Kapur [Mon, 10 Feb 2014 08:00:52 +0000 (00:00 -0800)]
arm64: smp: Jump back to secondary start kernel for onlined CPUs

Add a call to secondary start kernel for cpus which have been
onlined via the hotplug path for wfi based hotplug solution
where the return path from cpu_die should not return to the
idle thread. Update the cpu_die definition with a __ref to
allow referencing a __cpuinit call (secondary_start_kernel)
from it.

Change-Id: I7c083effda3928b562ea0d601833ceb8d5178d43
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
8 years agoarch: convert smp_mb__*()
Joonwoo Park [Fri, 25 Jul 2014 04:10:04 +0000 (21:10 -0700)]
arch: convert smp_mb__*()

Convert deprecated smp_mb__*() barriers.

Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
[joshc: fixup other uses around the kernel during the 3.14 upgrade]
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
8 years agoARM64: smp: implement arch_trigger_all_cpus_backtrace using IPI
Rohit Vaswani [Fri, 27 Jun 2014 06:35:09 +0000 (23:35 -0700)]
ARM64: smp: implement arch_trigger_all_cpus_backtrace using IPI

Since ARM64 doesn't have an NMI, send an IPI to all other CPUs
(current cpu prints the stack directly) to capture a backtrace.

Change-Id: Ib90494123205b3bbaa0b244ccde6c7e40a560199
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
[satyap: trivial merge conflict resolution & compilation fixes]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
8 years agohwmon: qpnp-adc: Update regulator api
Siddartha Mohanadoss [Wed, 17 Feb 2016 02:38:07 +0000 (18:38 -0800)]
hwmon: qpnp-adc: Update regulator api

"This snapshot is taken as of msm-3.18 commit dbdb6776f
(Merge "msm: camera: Add dummy sub module in sensor pipeline")

Use regulator_set_load() to specify the load required
while issuing VADC requests on the VADC LDO and fixup
compilation for qpnp_vadc_read() from thermal sysfs.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
8 years agoarm64: smp: Add wakeup IPI support
Abhimanyu Kapur [Sat, 8 Feb 2014 08:45:00 +0000 (00:45 -0800)]
arm64: smp: Add wakeup IPI support

Add support for IPI_WAKEUP which is used by hotplug code
path to wake up CPU from low power states.

Change-Id: I258d05e109a377613064624a5bfda21ab8ea9869
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
[satyap@codeaurora.org: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
8 years agousb: gadget: Add snapshot of changes with u_serial
Mayank Rana [Thu, 4 Feb 2016 00:45:41 +0000 (16:45 -0800)]
usb: gadget: Add snapshot of changes with u_serial

Squash and apply following u_serial driver changes taken from
msm-3.10 kernel as of commit
ec18e1c5aed (Merge "mmc: card: set dma_mask as the queue bounce limit")

feb56a3 usb: gadget: Fix bug in serial driver RX path
2ff1b9a USB: Gadget: u_serial: Debugfs for endpoint buffer monitoring
272d2fd USB: gadget: u_serial: free read/write requests upon queue failure
950a3a3 USB: Gadget: u_serial: Freeing usb requests as a part of gs_close
e4e6bc4 USB: u_serial: Don't allow UDC to append and send a zero length
packet
4bd2646 usb: gadget: serial: Limit write permissions to root
13e7219 USB: Fix multiple issues found by static analysis tool
505294c USB: Debugfs: Fix compilation issues when debugfs is disabled
0e7633e usb: gadget: Fix code quality issues when accessing port
607dbeb USB: u_serial: Don't free usb_requests in gs_close and reuse them
4aebedc usb: u_serial: Fix NULL pointer dereference in u_serial tty
callbacks

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agousb: gadget: serial: Add snapshot of changes with f_serial
Mayank Rana [Wed, 3 Feb 2016 02:28:57 +0000 (18:28 -0800)]
usb: gadget: serial: Add snapshot of changes with f_serial

Squash and apply following f_serial driver changes taken
from msm-3.10 kernel as of commit
ec18e1c5aed (Merge "mmc: card: set dma_mask as the queue bounce limit")

d98217e USB: android gadget: queue the request only when serial is online
b8bd483 USB: android gadget: Add interrupt ep and modem support in f_serial
7b56862 USB: Add super speed descriptors for android functions
c5a7f7f gadget: u_serial: Add tiocmset/tiocmget functionality
2a821c8 usb: gadget: Add debug message to print the control line state
information

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoarm64: fix sparse errors from msm-rtb
Jeremy Gebben [Fri, 6 Nov 2015 15:03:51 +0000 (08:03 -0700)]
arm64: fix sparse errors from msm-rtb

Correct the the __iomem decorations in __raw_write_logged()
and __raw_read_logged().

Change-Id: If4a4f7aff09537772a5f9e386c3c6ada95512457
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
8 years agoUSB: f_fs: Allow epfile to be opened only once
Mayank Rana [Fri, 31 Jul 2015 22:55:31 +0000 (15:55 -0700)]
USB: f_fs: Allow epfile to be opened only once

Due to USB cable disconnect, ADBD closes its epfiles and re-opens the same.
In normal operation the sequence is:
ffs_func_eps_disable() setting epfile->error to 1
ffs_epfile_release() setting epfile->error to 1
ffs_epfile_open() setting epfile->error to 0

In some cases when above sequeunce gets changed, epfile->error is set to 1.
Hence there is no data transfer happening on ep-IN endpoint. Fix this by
not allowing opening of epfiles until it has being successfully released.

Change-Id: I26b9ec1b6218d00cc0965ce3e71fcea49f9bf567
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoUSB: f_fs: Use config_ep_by_speed() for ADB endpoints
Mayank Rana [Thu, 28 Jan 2016 20:12:43 +0000 (12:12 -0800)]
USB: f_fs: Use config_ep_by_speed() for ADB endpoints

config_ep_by_speed() configures endpoint based on speed and
uses already available endpoint descriptors. Here it overrides
maxpacket field based on selected descriptor for endpoint. maxpacket
field is used by some of UDC driver to resize TXFIFO for IN endpoint.
Due to maxpacket is not being configured with selected endpoint
descriptor, UDC driver uses previously stale maxpacket value which
results into wrong TXFIFO calculated for used IN endpoint. Fix this
issue by calling config_ep_by_speed() for ADB endpoints to make sure
that proper value is updated with maxpacket field based on descriptor.

Change-Id: I9121f4df898de1455f9be4333ca8d0e744f4eb9e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoUSB: f_fs: Don't queue already queued request again
Tarun Gupta [Thu, 28 Jan 2016 20:09:09 +0000 (12:09 -0800)]
USB: f_fs: Don't queue already queued request again

f_fs uses only one request per ep and driver is trying to queue
same request again before it completed. This is seen in following
scenario, as part of system suspend wait_for_completion was
interrupted by -ERESTARTSYS, and driver tried to dequeue this
request, as USB was in LPM it was unable to dequeue this and
later on system resume ffs_epfile_read tried to queue same
request again which was never dequeued or completed. ep_queue
will return error if same request is queued again while it is in
progress. User space considers this ep_queue failure as halt and
try to clear halt condition that never happened. When User space
is trying to clear halt by that time USB has entered LPM again
leading to crash.

Avoid this by making sure same request is not queued again until
it is completed.

Change-Id: I6e9f357b9b8a47753b1323b4308e60844d7dec94
Signed-off-by: Tarun Gupta <tarung@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoUSB: f_fs: Add memory barrier before atomic operations
Mayank Rana [Thu, 28 Jan 2016 20:02:14 +0000 (12:02 -0800)]
USB: f_fs: Add memory barrier before atomic operations

In few instances, it is observed that multiple adbd instances are
running on device causing condition BUG_ON(ffs->gadget) to be true.
ffs->opened and ffs->ref atomic variables are used here to make
decision for checking ffs->gadget. These atomic variable operations
requires expilict memory barrier to make sure that update to
ffs->gadget is visible to other CPUs before updated atomic variable
based value is seen. This change also adds explicit memory barriers
before reading or modified any atomic varaiables.

Change-Id: I3c846eb6bbb53663892e05d51ebac8439aac957a
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agousb: gadget: f_fs: Allow only one adb daemon perform device open
Saket Saurabh [Thu, 28 Jan 2016 19:56:10 +0000 (11:56 -0800)]
usb: gadget: f_fs: Allow only one adb daemon perform device open

As part of ffs_ep0_open(), atomic variable ffs.opened is set and as part
of ffs_ep0_release() it is cleared. Also as part of release operation, in
ffs_data_clear() ffs->gadget is set to NULL.
If two adb daemons are running in parallel, then BUG ON is observed as part
of release operation as ffs->gadget is not set to NULL.

To fix the issue add check for ffs->opened to allow only one adb daemon
perform device open. This ensures open and release operation are performed
in serialized way and avoids any race.
Also add debug print for dumping the ffs gadget.

Change-Id: Ifccdfa6068f506bb7dfdc9945b60591da530df8f
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoUSB: f_fs: Add print message in case of error scenario
Vijayavardhan Vennapusa [Thu, 28 Jan 2016 19:48:44 +0000 (11:48 -0800)]
USB: f_fs: Add print message in case of error scenario

Add print message in case of error scenarios which will
be useful for debugging adb offline issues.

Change-Id: I75bc136eab05151abb187c1fa1e5956b6f507297
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoUSB: f_fs: Avoid using completion variable on stack
Sujeet Kumar [Thu, 28 Jan 2016 19:18:13 +0000 (11:18 -0800)]
USB: f_fs: Avoid using completion variable on stack

done completion variable is local stack variable to ffs_epfile_io().
It is being used to unblock ffs_epfile_io() from USB request
completion context where done is accessed through req->context. If
ffs_epfile_io() is unblocked or interrupted due to epfile close or
any signal before USB request completion is handled, req->context is
having stale "done" reference causing invalid access. Fix this issue
by storing done completion reference with epfile structure instead of
having it on stack to have valid req->context in completion handler.

Change-Id: I15102538d1b5bee14dfa3c7b3fa1f8e3f767cf71
Signed-off-by: Sujeet Kumar <ksujeet@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoUSB: f_fs: Fix disconnect check during ongoing IO
Manu Gautam [Thu, 28 Jan 2016 19:09:27 +0000 (11:09 -0800)]
USB: f_fs: Fix disconnect check during ongoing IO

F_FS function driver allocated ffs_eps and updates ffs_ep->ep
to corresponding usb_ep during func->bind and never clears it.
On bind it also saves ffs_ep context in epfile->ep.
During func->disable, it clears only ffs_ep context in epfile->ep
and on func->unbind it frees ffs_eps memory.
ffs_epfile_io routine currently relies on ffs_ep->ep (which is
never cleared and ffs_ep could be freed on unbind) to detect any
disconnect during active IO. This can result in various issues e.g.
use after free use of ffs_ep if unbind finished before epfile_io
could resume or "stop adbd" trying to dequeue a freed USB request
when epfile_io could execute only after F_FS got disabled as
'if (ep->ep)' check would be TRUE.
Fix this by checking stored ffs_ep context against latest epfile->ep
to figure out if endpoint got disabled or changed before acquiring
spin_lock.

Change-Id: I6bdcdf0dff0813ed7b2af8c24f544a22796b0369
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoUSB: f_fs: Check error status before doing epfile I/O
Vijayavardhan Vennapusa [Thu, 28 Jan 2016 18:58:39 +0000 (10:58 -0800)]
USB: f_fs: Check error status before doing epfile I/O

Set error status before disabling endpoint during function
disable and also check error status before handling I/O. If error
status is set, return error status to read/write calls made by
userspace. Also set file's private data to NULL during epfile
release.

Change-Id: I14b5ee541dfc18a7802ef4a8033878a7729d9adb
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoUSB: f_fs: Fail stale read IOs after disconnect
Sujeet Kumar [Thu, 28 Jan 2016 18:42:06 +0000 (10:42 -0800)]
USB: f_fs: Fail stale read IOs after disconnect

After a USB disconnect, endpoints for adb are disabled.
After this no IO is allowed on the endpoints.
Since, adbd is not aware of this disconnect, it may
still perform read/writes IO. For adb writes, IOs are
failed, but for adb reads kernel waits untill endpoints
are enabled.

When a USB disconnect and adb read still queued
a buffer to kernel, ffs_epfile_io simply waits for
endpoint to be enabled. A next connect happens
and endpoints are enabled after set_alt, the adb
read stale buffer from previous session continues
and queues to endpoint.

All this time, adb did not close the epfile because
it did not get return status on the IOs which it
queued. This is an issue, because a new session
is not established and both userspace and kernel
goes out of sync.

To fix this issue, when endpoints are disbled
set epfile error. This epfile error is only cleared
in epfile open. This will ensure that after a USB
disconnect and connect, new session is established.

Also, return ENODEV if endpoints not enabled rather
than EINTR as EINTR case, and simply retries the
request. Incase usb_ep_queue failed, return -EIO
inspite of depend on return status from usb_ep_queue.

Change-Id: I6e677e98ec28e5462b372ed290acdde251286f48
Signed-off-by: Sujeet Kumar <ksujeet@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoUSB: f_fs: Fix epfile crash during composition switch
Sujeet Kumar [Thu, 28 Jan 2016 18:27:44 +0000 (10:27 -0800)]
USB: f_fs: Fix epfile crash during composition switch

epfile's ep pointer may be NULL during adb transfer
and composition switch happening in parallel. As part
of composition switch, first it is set to NONE. Setting
sys.usb.config to NONE stops adb and disables the composition.
stop adb is not blocking call and adb still might be doing
epfile read/write for some time when function unbind is
ongoing making the data structures NULL.

To fix this crash, call usb_ep_dequeue only if ep->ep is
valid. Similarly in success case, return ep->status only
if ep->ep is valid otherwise return -ENODEV.

Change-Id: Ic152fc1db31cad6f97b8d16d91350dad857a4bf9
Signed-off-by: Sujeet Kumar <ksujeet@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoUSB: f_fs: Set ffs->func to NULL after disabling endpoint in set_alt()
Vijayavardhan Vennapusa [Thu, 28 Jan 2016 18:16:56 +0000 (10:16 -0800)]
USB: f_fs: Set ffs->func to NULL after disabling endpoint in set_alt()

When adb root is performed, userspace will close and open ffs_epsfile.
Closing this file will call ffs_functionfs_callback() which does call
remove_config(). This will call ffs_function_eps_disable to disable
endpoints and then calls ffs_func_unbind(). Unbind() will also call
endpoint disable which might lead to disabling endpoint which is already
disabled. Some of UDC driver throws WARN_ON() if same endpoint is being
disabled multiple time. Hence set ffs->func to NULL after disabling
endpoints in set_alt() to overcome WARN_ON().

Change-Id: I3052bdee74a1793d4e003de4b991d353e5d699b0
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agoarch: arm64: Enable UBSAN support for arm64
Trilok Soni [Wed, 27 Jan 2016 03:01:59 +0000 (19:01 -0800)]
arch: arm64: Enable UBSAN support for arm64

Enable UBSAN support for arm64.

CRs-Fixed: 969533
Change-Id: I03689e902195b901712ff5922af10fc127e96418
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
8 years agoUBSAN: run-time undefined behavior sanity checker
Andrey Ryabinin [Wed, 20 Jan 2016 23:00:55 +0000 (15:00 -0800)]
UBSAN: run-time undefined behavior sanity checker

UBSAN uses compile-time instrumentation to catch undefined behavior
(UB).  Compiler inserts code that perform certain kinds of checks before
operations that could cause UB.  If check fails (i.e.  UB detected)
__ubsan_handle_* function called to print error message.

So the most of the work is done by compiler.  This patch just implements
ubsan handlers printing errors.

GCC has this capability since 4.9.x [1] (see -fsanitize=undefined
option and its suboptions).
However GCC 5.x has more checkers implemented [2].
Article [3] has a bit more details about UBSAN in the GCC.

[1] - https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html
[2] - https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
[3] - http://developerblog.redhat.com/2014/10/16/gcc-undefined-behavior-sanitizer-ubsan/

Issues which UBSAN has found thus far are:

Found bugs:

 * out-of-bounds access - 97840cb67ff5 ("netfilter: nfnetlink: fix
   insufficient validation in nfnetlink_bind")

undefined shifts:

 * d48458d4a768 ("jbd2: use a better hash function for the revoke
   table")

 * 10632008b9e1 ("clockevents: Prevent shift out of bounds")

 * 'x << -1' shift in ext4 -
   http://lkml.kernel.org/r/<5444EF21.8020501@samsung.com>

 * undefined rol32(0) -
   http://lkml.kernel.org/r/<1449198241-20654-1-git-send-email-sasha.levin@oracle.com>

 * undefined dirty_ratelimit calculation -
   http://lkml.kernel.org/r/<566594E2.3050306@odin.com>

 * undefined roundown_pow_of_two(0) -
   http://lkml.kernel.org/r/<1449156616-11474-1-git-send-email-sasha.levin@oracle.com>

 * [WONTFIX] undefined shift in __bpf_prog_run -
   http://lkml.kernel.org/r/<CACT4Y+ZxoR3UjLgcNdUm4fECLMx2VdtfrENMtRRCdgHB2n0bJA@mail.gmail.com>

   WONTFIX here because it should be fixed in bpf program, not in kernel.

signed overflows:

 * 32a8df4e0b33f ("sched: Fix odd values in effective_load()
   calculations")

 * mul overflow in ntp -
   http://lkml.kernel.org/r/<1449175608-1146-1-git-send-email-sasha.levin@oracle.com>

 * incorrect conversion into rtc_time in rtc_time64_to_tm() -
   http://lkml.kernel.org/r/<1449187944-11730-1-git-send-email-sasha.levin@oracle.com>

 * unvalidated timespec in io_getevents() -
   http://lkml.kernel.org/r/<CACT4Y+bBxVYLQ6LtOKrKtnLthqLHcw-BMp3aqP3mjdAvr9FULQ@mail.gmail.com>

 * [NOTABUG] signed overflow in ktime_add_safe() -
   http://lkml.kernel.org/r/<CACT4Y+aJ4muRnWxsUe1CMnA6P8nooO33kwG-c8YZg=0Xc8rJqw@mail.gmail.com>

[akpm@linux-foundation.org: fix unused local warning]
[akpm@linux-foundation.org: fix __int128 build woes]
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Yury Gribov <y.gribov@samsung.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Kostya Serebryany <kcc@google.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
Git-commit: c6d308534aef6c99904bf5862066360ae067abc4
[tsoni@codeaurora.org: trivial merge conflict resolution]
CRs-Fixed: 969533
Change-Id: I048b9936b1120e0d375b7932c59de78d8ef8f411
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
[satyap@codeaurora.org: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
8 years agokernel: printk: specify alignment for struct printk_log
Andrey Ryabinin [Wed, 20 Jan 2016 23:00:48 +0000 (15:00 -0800)]
kernel: printk: specify alignment for struct printk_log

On architectures that have support for efficient unaligned access struct
printk_log has 4-byte alignment.  Specify alignment attribute in type
declaration.

The whole point of this patch is to fix deadlock which happening when
UBSAN detects unaligned access in printk() thus UBSAN recursively calls
printk() with logbuf_lock held by top printk() call.

CRs-Fixed: 969533
Change-Id: Iee822667b9104a69c3d717caeded0fcde3f6d560
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Yury Gribov <y.gribov@samsung.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Kostya Serebryany <kcc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
Git-commit: 5c9cf8af2e77388f1da81c39237fb4f20c2f85d5
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
[satyap@codeaurora.org: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
8 years agousb: dwc3-msm: Update timeout value for EP command
Dov Levenglick [Wed, 11 Dec 2013 18:43:34 +0000 (20:43 +0200)]
usb: dwc3-msm: Update timeout value for EP command

The previous timeout value was explained as being
based on trial and error. We saw a timeout
as high as 800[us]. In order to be on the safe-side,
the new timeout value is increased to allow such a
delay with room for error

Change-Id: I7bc953d9bd494b57dd5492b492d48b18994e6b8f
Signed-off-by: Dov Levenglick <dovl@codeaurora.org>
8 years agoRevert "usb: dwc3: Allocate TRB pool upon enabling endpoint"
Mayank Rana [Tue, 16 Feb 2016 19:38:23 +0000 (11:38 -0800)]
Revert "usb: dwc3: Allocate TRB pool upon enabling endpoint"

This reverts commit 55312d5442f147aa1a366e8ecb483b07e38961b3.
WARN_ON() is seen from dma mapping API while freeing TRBs on USB
cable disconnect (i.e usb endpoint disable  context) due interrupts
are disabled.

Change-Id: Ib5689cbd5a379a8d1dc1a734026174779202386b
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agonet/ipv6/addrconf: IPv6 tethering enhancement
Tianyi Gou [Tue, 14 Jul 2015 21:42:08 +0000 (15:42 -0600)]
net/ipv6/addrconf: IPv6 tethering enhancement

Added new procfs flag to toggle the automatic addition of prefix
routes on a per device basis. The new flag is accept_ra_prefix_route.
Defaults to 1 as to not break existing behavior.

CRs-Fixed: 435320
Change-Id: If25493890c7531c27f5b2c4855afebbbbf5d072a
Acked-by: Harout S. Hedeshian <harouth@qti.qualcomm.com>
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agodefconfig: arm64: msm: Enable Data features
Subash Abhinov Kasiviswanathan [Fri, 12 Feb 2016 03:31:22 +0000 (20:31 -0700)]
defconfig: arm64: msm: Enable Data features

Enable configurations needed for data functionality

Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agotun: Use IFF_NO_PI instead of TUN_NO_PI
Subash Abhinov Kasiviswanathan [Fri, 12 Feb 2016 02:57:22 +0000 (19:57 -0700)]
tun: Use IFF_NO_PI instead of TUN_NO_PI

Commit 40630b82c20b7d8 ("tun: drop most type defines") removes the
definition of TUN_NO_PI. Remove users of this flag.

Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonetfilter: xt_HARDIDLETIMER: Fix null de-reference
Susheel Yadagiri [Mon, 27 Jul 2015 19:12:10 +0000 (12:12 -0700)]
netfilter: xt_HARDIDLETIMER: Fix null de-reference

added a null check to prevent a null pointer derefence of hard idle
timer

Change-Id: Id1e49d5b109d8c71947723b252f4d2b6f3ebc35f
CRs-Fixed: 880124
Signed-off-by: Susheel Yadav Yadagiri <syadagir@codeaurora.org>
8 years agonf: IDLETIMER: Fix possible use before initialization in idletimer_resume
Patrick Daly [Fri, 24 Oct 2014 01:01:33 +0000 (18:01 -0700)]
nf: IDLETIMER: Fix possible use before initialization in idletimer_resume

idletimer_resume() assumes that the PM_SUSPEND_PREPARE notifier is sent
before PM_POST_SUSPEND so that timer->last_suspend_time is initialized.
However, it is possible for PM_POST_SUSPEND to be sent first if there is an
error returned from another driver's PM_SUSPEND_PREPARE notifier.

Add a flag indicating whether the current value of timer->last_suspend is
valid.

Detected with CONFIG_SLUB_DEBUG & CONFIG_DEBUG_SPINLOCK in arm64. The
timestamp lock is held for more than a minute while
set_normalized_timespec() proceses the poisoned timer->last_suspend_time
argument.

Change-Id: I95328b0ac85dba819ff9cef751c3d07300c232f1
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
8 years agonetfilter: xt_HARDIDLETIMER: Fix use after free condition
Patrick Daly [Sat, 28 Mar 2015 01:56:44 +0000 (18:56 -0700)]
netfilter: xt_HARDIDLETIMER: Fix use after free condition

Force any pending hardidletimer_tg_work() to complete before freeing
the associated work struct.

CRs-Fixed: 814707
Change-Id: I57b2f0dcd24f05ddb472d6007525d1722f9fe0b0
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
8 years agonetfilter: xtables: hardidletimer target implementation
Bhavya Sokke Mallikarjunappa [Sat, 21 Jun 2014 00:17:17 +0000 (17:17 -0700)]
netfilter: xtables: hardidletimer target implementation

This patch implements a hardidletimer Xtables target that can be used to
identify when interfaces have been idle for a certain period of time.

Timers are identified by labels and are created when a rule is set with a
new label. The rules also take a timeout value (in seconds) as an option.
If more than one rule uses the same timer label, the timer will be
restarted whenever any of the rules get a hit.

One entry for each timer is created in sysfs. This attribute contains the
timer remaining for the timer to expire. The attributes are located under
the xt_idletimer class:

/sys/class/xt_hardidletimer/timers/<label>

When the timer expires, the target module sends a sysfs notification to the
userspace, which can then decide what to do (eg. disconnect to save power)

Compared to xt_IDLETIMER, xt_HARDIDLETIMER can send notifications when CPU
is in suspend too, to notify the timer expiry

Change-Id: I1723d44e02df864d63da7550766ea7d763076de2
Signed-off-by: Bhavya Sokke Mallikarjunappa <bsokke@codeaurora.org>
8 years agonet: sched: gracefully handle qdisc which don't support change()
Harout Hedeshian [Sun, 6 Dec 2015 19:52:20 +0000 (12:52 -0700)]
net: sched: gracefully handle qdisc which don't support change()

tc_qdisc_flow_control() incorrectly assumes that all queue disciplines
implement the change() callback in Qdisc_ops. If the flow control function
is called a queue that does not implement change(), we try to jump to a
null function pointer resulting in a panic. The flow control function
does require that the queue discipline support change() in order to
enable/disable the queue. Now we will check if the queue to do flow
control on supports the required funcionality and will WARN_ONCE and
return if the requirements are not met.

[<ffffffc000c5c028>] panic+0x28c
[<ffffffc0000889f4>] die+0x238
[<ffffffc000088a6c>] arm64_notify_die+0x4c
[<ffffffc000088d00>] bad_mode+0xa8
[<ffffffc000ab9ab8>] tc_qdisc_flow_control+0x98
[<ffffffc000c506e8>] rmnet_vnd_ioctl+0x230
[<ffffffc000aac6fc>] dev_ifsioc+0x2a0
[<ffffffc000aacde8>] dev_ioctl+0x644
[<ffffffc000a7db4c>] sock_ioctl+0x4c
[<ffffffc0001af548>] do_vfs_ioctl+0x4b4
[<ffffffc0001af684>] SyS_ioctl+0x60
[<ffffffc0000854b0>] el0_svc_naked+0x24

Change-Id: I85ca324e57814b6c0eac48d2e076e861ab32c260
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agotun: Set CHECKSUM_UNNECESSARY if userspace passes this indication
Subash Abhinov Kasiviswanathan [Mon, 26 Oct 2015 23:32:26 +0000 (17:32 -0600)]
tun: Set CHECKSUM_UNNECESSARY if userspace passes this indication

Userspace may already know that the checksum validation is already
completed prior to being passed to the TUN interface. As a result,
computing checksum again in network stack may be a redundant
operation.

Add support to read this information from the TUN header flags
to skip checksum validation for these packets only.

This is useful in cases where the packet checksum was computed by
hardware for IPv4 / IPv6 TCP / UDP packets. Since the packet
intergrity was already verified for packets over the wire, subsequent
validation within the network stack is redundant work.

Change-Id: I18ee3408c05910207b205d6205f282e6f3599156
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: add a per-cpu counter for the number of frames coalesced in GRO
Harout Hedeshian [Mon, 27 Jul 2015 16:32:01 +0000 (10:32 -0600)]
net: add a per-cpu counter for the number of frames coalesced in GRO

A low cost method of determining GRO statistics is required. This
change introduces a new counter which tracks whenever GRO coalesces
ingress packets. The counter is per-CPU and exposed in
/proc/net/softnet_stat as the last column of data. No user space
impact is expected as a result of this change. However, this change
should be reverted if legacy tools have problems with the new column
in softnet_stat.

Change-Id: I05965c0cb150947935d5977884cc4d583b37131d
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: Fail explicit bind to local reserved ports
Subash Abhinov Kasiviswanathan [Tue, 8 Sep 2015 22:06:41 +0000 (16:06 -0600)]
net: Fail explicit bind to local reserved ports

Reserved ports may have some special use cases which are not suitable
for use by general userspace applications. Currently, ports specified
in ip_local_reserved_ports will not be returned only in case of
automatic port assignment.

Add a boolean sysctl flag 'reserved_port_bind'. Default value is 1
which preserves the existing behavior. Setting the value to 0 will
prevent userspace applications from binding to these ports even when
they are explicitly requested.

BUG=20663075
Change-Id: Ib1071ca5bd437cd3c4f71b56147e4858f3b9ebec
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: Indicate whether a socket is a transparent socket
Harout Hedeshian [Fri, 5 Jun 2015 19:23:01 +0000 (13:23 -0600)]
net: Indicate whether a socket is a transparent socket

Modify the printout functions for IPv4-TCP, IPv4-UDP, IPv6-TCP, IPv6-UDP,
such that the state for the socket is printed as state = state | 0x80.
The actual socket state is unmodified. This change is required for the
user space to determine whether a socket is a transparent socket, and
to determine if the socket holder intends to consume packets locally
or to forward them to an external processor.

Change-Id: I2ca403b4c2c74e7ddcdbda53e4ba43613bae9c42
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: sockev: corrected sk_family filter logic
Harout Hedeshian [Tue, 19 May 2015 23:44:29 +0000 (16:44 -0700)]
net: sockev: corrected sk_family filter logic

Commit 43e0e31e2d6e ("net: sockev: filtering non INET socket events")
from Krishnan introduced incorrect conditional logic which caused
the socket address families to be incorrectly filtered. This
patch corrects the logic.

CRs-Fixed: 830947
Cc: Krishnan Ramachandran <kramacha@qti.qualcomm.com>
Acked-by: Devesh Bisht <dbisht@qti.qualcomm.com>
Change-Id: I40a001a69d5aab25f7f97a7378aceae301fd762a
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: Warn for cloned packets in ingress path
Subash Abhinov Kasiviswanathan [Tue, 28 Apr 2015 20:31:40 +0000 (14:31 -0600)]
net: Warn for cloned packets in ingress path

Cloned packets arriving in ingress path can cause issues with GRO
since the skb shared info is garbled.

Warn once if a cloned packet is queued up to the network stack.

CRs-Fixed: 823275
Change-Id: I049f04f39b3d1338838560e08c93a973de427fc0
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: udp: Adjust UDP socket state for encapsulation sockets
Harout Hedeshian [Wed, 15 Apr 2015 20:59:27 +0000 (14:59 -0600)]
net: udp: Adjust UDP socket state for encapsulation sockets

UDP IPv4 encapsulation sockets will have their state printed as 0xF0
binary ORed with the actual state such that they can be distinguished
from regular UDP sockets in /proc/net/udp.

CRs-Fixed: 821341
Change-Id: I240ab1526a4280e5e996d9577a904581684fc84a
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: sockev: filtering non INET socket events
Harout Hedeshian [Fri, 6 Mar 2015 23:29:18 +0000 (15:29 -0800)]
net: sockev: filtering non INET socket events

Too many socket events are generated by netlink socket. Filtering out
unwanted socket events.

Change-Id: I3a4d7e14843cf72d6af2d948113b27928ed01adb
Acked-by: Krishnan Ramachandran <kramacha@qti.qualcomm.com>
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: socket: make sure refs are not released on fd before calling sockev
Harout Hedeshian [Tue, 27 Jan 2015 16:26:30 +0000 (09:26 -0700)]
net: socket: make sure refs are not released on fd before calling sockev

Ensure that BIND and LISTEN syscalls do fput_light AFTER sockev notifier
callback has returned. Also, increase refcount on sock->sk (if available)
before invoking the notifier callback. Prevent crash due to use-after-free.

[<c0891d5c>] (sockev_client_cb+0xfc/0x1e4) from [<c0a273a4>] (notifier_cal
[<c0a273a4>] (notifier_call_chain+0x44/0x84) from [<c01422cc>] (__blocking
[<c01422cc>] (__blocking_notifier_call_chain+0x48/0x60) from [<c01422fc>]
[<c01422fc>] (blocking_notifier_call_chain+0x18/0x20) from [<c0865968>] (S
[<c0865968>] (SyS_bind+0xb0/0xe8) from [<c0105ba0>] (ret_fast_syscall+0x0/

CRs-Fixed: 787283
Change-Id: I2de65929b22c58637692cf582b6b46b11713494e
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: sockev: Initial Commit
Harout Hedeshian [Tue, 4 Mar 2014 16:16:53 +0000 (09:16 -0700)]
net: sockev: Initial Commit

Added module which subscribes to socket notifier events. Notifier events
are then converted to a multicast netlink message for user space
applications to consume.

CRs-Fixed:  626021
Change-Id: Id5c6808d972b69f5f065d7fba9094e75c6ad0b2c
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: socket: Added notifier chains for socket administrative functions
Harout Hedeshian [Tue, 4 Mar 2014 14:31:47 +0000 (07:31 -0700)]
net: socket: Added notifier chains for socket administrative functions

Allows other areas in the kernel to register notifier callbacks which
get invoked whenever something performs an administrative action on a
socket. This patch adds hooks in socket(), bind(), listen(), accept(),
shutdown().

CRs-Fixed:  626021
Change-Id: I4ae99cb2206d7c4eddba69757335c18d10143045
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: core: add MAP support to RPS flow dissector
Harout Hedeshian [Mon, 16 Jun 2014 15:26:42 +0000 (09:26 -0600)]
net: core: add MAP support to RPS flow dissector

More efficiently utilize multiple cores when using MAP encoded frames.
RPS flow dissector now appropriately decodes IPv4 and IPv6 frames with
MAP headers prepended.

CRs-Fixed: 681280
Change-Id: Ia4dde47fcc0f3436dcaa71a5160c0a59fe7ed53a
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agoRevert "net, lib: kill arch_fast_hash library bits"
Rohit Vaswani [Wed, 17 Feb 2016 21:55:51 +0000 (13:55 -0800)]
Revert "net, lib: kill arch_fast_hash library bits"

This reverts commit 0cb6c969ed9de43687abdfc63714b6fe4385d2fc.

8 years agodefconfig: msm: enable PCIe bus driver in defconfig for 4.4 kernel
Tony Truong [Tue, 9 Feb 2016 01:57:58 +0000 (17:57 -0800)]
defconfig: msm: enable PCIe bus driver in defconfig for 4.4 kernel

Enable defconfig for PCIe bus driver on 4.4 kernel.

Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: support PCIe bus driver on msm-4.4
Tony Truong [Mon, 1 Feb 2016 21:51:48 +0000 (13:51 -0800)]
msm: pcie: support PCIe bus driver on msm-4.4

Update PCIe bus driver to be compatible with 4.4 kernel.

Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: fix compilation erros if debugfs is disabled
Tony Truong [Tue, 16 Feb 2016 22:13:16 +0000 (14:13 -0800)]
msm: pcie: fix compilation erros if debugfs is disabled

This change fixes the compilation erros seen when DEBUG_FS is disabled.

Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add QSERDES PHY support for mdmcalifornium
Tony Truong [Wed, 30 Sep 2015 20:19:43 +0000 (13:19 -0700)]
msm: pcie: add QSERDES PHY support for mdmcalifornium

The current PHY sequence is not fully compatible with the
QSERDES PHY found on mdmcalifornium. Thus, add the new
sequence and other changes to support PCIe QSERDES PHY
on mdmcalifornium.

Change-Id: I5a5d0b115651a159612e17debf0d25d6f88dbee8
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add ARM32 support for mdmcalifornium
Tony Truong [Tue, 15 Sep 2015 01:08:35 +0000 (18:08 -0700)]
msm: pcie: add ARM32 support for mdmcalifornium

Currently, PCIe bus driver on mdmcalifornium does not
have support for ARM32. Thus, add the necessary changes
to support ARM32 for PCIe on mdmcalifornium.

Change-Id: I6c72debd9ea65b7abb70ce4d5568c972ba786c11
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add support to handle aggregated interrupts
Tony Truong [Fri, 14 Aug 2015 02:21:14 +0000 (19:21 -0700)]
msm: pcie: add support to handle aggregated interrupts

Not all targets will have a dedicated line for each PCIe
interrupt. On these targets, some PCIe interrupts will be
aggregated into one line. Thus, add support to handle
aggregated interrupts.

Change-Id: I4f5be73718d4a4ae8a3de142579f24a7113fe086
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: update PCIe PHY for MSM8996v3/v4 based on si learning
Tony Truong [Thu, 17 Sep 2015 00:28:14 +0000 (17:28 -0700)]
msm: pcie: update PCIe PHY for MSM8996v3/v4 based on si learning

Based on si learning, new PCIe PHY settings improve the overall
stability of PCIe PHY on MSM8996 v3 and on v4. Thus, update the
PCIe PHY sequence for MSM8996 v3 and v4.

Change-Id: Ia1ab0af4c4dcf483d3b3dc05b7b13003de788f40
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add locks to protect PCIe common PHY init and deinit
Tony Truong [Wed, 9 Sep 2015 22:08:43 +0000 (15:08 -0700)]
msm: pcie: add locks to protect PCIe common PHY init and deinit

The counter for the number of active root complexes
determines when PCIe common PHY should be powered on/off.
To avoid conflicts and a stale counter, add locks to protect
the access to PCIe common PHY.

Change-Id: I18ec54e52e804eb132f9c5c0270455dbc9187151
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: change PCIe WAKE support to be optional
Tony Truong [Tue, 18 Aug 2015 21:20:13 +0000 (14:20 -0700)]
msm: pcie: change PCIe WAKE support to be optional

Not all endpoints require PCIe WAKE support.
Therefore make PCIe WAKE GPIO optional.

Change-Id: Ifc5a84204cde42881a127b4715727c290ee24450
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: update debugfs messages with new IPC label
Tony Truong [Fri, 24 Jul 2015 00:44:08 +0000 (17:44 -0700)]
msm: pcie: update debugfs messages with new IPC label

In addition to having outputs to kernel log, PCIe
debugfs messages should also be captured in IPC logging.
Therefore, add a new IPC logging label and update the
existing calls to do so.

Change-Id: I2ab6a6549575c4e2de2f1ef0756328f4b6f6a178
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add support to distingush between PCIe PHY ver
Tony Truong [Mon, 3 Aug 2015 19:36:46 +0000 (12:36 -0700)]
msm: pcie: add support to distingush between PCIe PHY ver

PCIe bus driver can now use devicetree to help distingush
which PCIe QMP PHY version is being used. This will allow
PCIe bus driver to choose the correct PCIe PHY sequence.

Change-Id: I74c67431b75292bb1db3e4b97d89d69de9b6f11b
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: remove PCIe CX rail vote when releasing resources
Tony Truong [Mon, 27 Jul 2015 18:18:02 +0000 (11:18 -0700)]
msm: pcie: remove PCIe CX rail vote when releasing resources

Current PMIC API call to disable CX rail does not remove
PCIe power vote. Add another API call to successfully
remove vote when releasing this resource.

Change-Id: I5203203e10e8e690745768c241e92d298b87cc4b
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add delay after power down write
Tony Truong [Tue, 23 Jun 2015 01:11:19 +0000 (18:11 -0700)]
msm: pcie: add delay after power down write

To improve PCIe PHY stability, add a delay between
the write of power down and sw reset register on
MSM8996.

Change-Id: If09390bff59e0922cb891c7bac823c11361fca83
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: slow down PCIe PHY RX clock for SVS mode
Tony Truong [Mon, 13 Jul 2015 21:46:13 +0000 (14:46 -0700)]
msm: pcie: slow down PCIe PHY RX clock for SVS mode

In order for PCIe to reliabily work in SVS mode,
the PCIe PHY RX clock needs to be slowed.

Change-Id: Ic6edf487011ef4ac71d486210b1f6176e2142551
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: increase the wakeup delay time for aux clock
Tony Truong [Fri, 10 Jul 2015 18:06:09 +0000 (11:06 -0700)]
msm: pcie: increase the wakeup delay time for aux clock

Increase the wakeup delay time for PCIe aux clock on MSM8996
to improve PCIe stability when waking up.

Change-Id: I2909e80a2c79b4f17ca39c39d899de08b67d4120
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add support for RC to vote for CX rails
Tony Truong [Fri, 10 Jul 2015 21:17:57 +0000 (14:17 -0700)]
msm: pcie: add support for RC to vote for CX rails

Each PCIe client requires different CX power levels
to maintain functionality. This change gives each
PCIe root complex the ability to vote for CX power
levels.

Change-Id: If027c79220253a60837c3d52202fb5ec4cc3451e
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: update PCIe QMP PHY sequence on MSM8996
Tony Truong [Thu, 11 Jun 2015 01:18:12 +0000 (18:18 -0700)]
msm: pcie: update PCIe QMP PHY sequence on MSM8996

New QMP PHY sequence for 1MHz aux clk for PCIe
on MSM8996. Therefore, update the PCIe PHY
sequence.

Change-Id: I2b3746cc9d6ab6b491fa7404ae54fefbf36df905
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: remove unnecessary cleanup code for Synopsys MSI
Tony Truong [Thu, 14 May 2015 20:07:35 +0000 (13:07 -0700)]
msm: pcie: remove unnecessary cleanup code for Synopsys MSI

There are unnecessary cleanup code which alters the descriptor
of a Synposys MSI IRQ and this causes the IRQ to be unusable
afterwards. Remove the unnecessary cleanup code for Synopsys
MSI so that the IRQ will remain functional.

Change-Id: I87221f9a59d014df21af251277866c511c5375eb
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add PCIe support for 3.18 kernel
Tony Truong [Thu, 16 Apr 2015 19:01:51 +0000 (12:01 -0700)]
msm: pcie: add PCIe support for 3.18 kernel

Add PCIe support for 3.18 kernel. Added enumeration,
interrupts, and hardware configurations support for
PCIe.

Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: increase the Ipeaks for PCIe LDOs
Tony Truong [Thu, 28 May 2015 21:24:41 +0000 (14:24 -0700)]
msm: pcie: increase the Ipeaks for PCIe LDOs

Increase the Ipeak request for each PCIe LDO based
on updated settings.

Change-Id: Ie3af6462dac68252b339595e350e393079a89bb9
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add SMMU support to calculate SID for PCIe EP
Tony Truong [Mon, 5 Jan 2015 20:58:58 +0000 (12:58 -0800)]
msm: pcie: add SMMU support to calculate SID for PCIe EP

SMMU requires PCIe to provide a SID for each of its endpoint
so that the endpoint can successful transaction on the bus.
This change adds the support for PCIe bus driver to calculate
a SID for its endpoint and give it to the SMMU driver.

Change-Id: I52099bbfed0a38c75b0277b0f58f45f6e6559695
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: correct exit code for invalid Root Complex indexes
Tony Truong [Fri, 8 May 2015 23:39:49 +0000 (16:39 -0700)]
msm: pcie: correct exit code for invalid Root Complex indexes

In the case where the Root Complex fails to retrive a valid
index, the exit code fails to handle this correctly. This
change corrects the way the exit code handles invalid root
complex indexes.

Change-Id: Ie832fec1be2b05dea05b8917348a1c08cdc1d681
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add support to enable additional GPIO for endpoint
Tony Truong [Thu, 30 Apr 2015 02:22:00 +0000 (19:22 -0700)]
msm: pcie: add support to enable additional GPIO for endpoint

Some EP requires additional GPIO to be enabled for link training.
Add the support in PCIe Bus Driver to manage this GPIO.

Change-Id: I837edae478779fdaf3e94c70a0a031f9d0580a77
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agoDocumentation: devicetree: add iommus entry for PCIe
Tony Truong [Mon, 27 Apr 2015 20:12:55 +0000 (13:12 -0700)]
Documentation: devicetree: add iommus entry for PCIe

PCIe on some targets require the iommus device tree entry.
Therefore, add this device tree entry to the PCIe
documentation.

Change-Id: Iec6c4cfcd5e51d6aa1259bb826fe60d131072170
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: update PCIe PHY sequence on MSM8996
Tony Truong [Thu, 23 Apr 2015 01:36:18 +0000 (18:36 -0700)]
msm: pcie: update PCIe PHY sequence on MSM8996

There are new PCIe PHY settings that have been updated
to improve performance and stablilty. Therefore, update
the PCIe PHY sequence on MSM8996.

Change-Id: If321471c51ff6a91595b68bd2cae08c8c043d6bb
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add entry and exit detail logging for PCIe
Tony Truong [Wed, 8 Apr 2015 01:05:30 +0000 (18:05 -0700)]
msm: pcie: add entry and exit detail logging for PCIe

To support more accurate benchmarks, add entry and exit logs
for PCIe functions.

Change-Id: I49f27263722adfaa8ae3973f242faa6a589d3358
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: correct the offset of a PCIe AXI register
Tony Truong [Mon, 9 Mar 2015 20:48:04 +0000 (13:48 -0700)]
msm: pcie: correct the offset of a PCIe AXI register

Correct the offset of a PCIe AXI register.

Change-Id: I429c3e42cc8bb6cc7e23b5e461e51ec10435a89d
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add PCIe MSI support on 3.14 kernel
Tony Truong [Thu, 9 Apr 2015 00:26:05 +0000 (17:26 -0700)]
msm: pcie: add PCIe MSI support on 3.14 kernel

To support PCIe MSI on 3.14 kernel, the client's host
driver must use the QGIC IRQ number to request/enable
the interrupt while the client's firmware must use
the SPI number to trigger the interrupt. Therefore,
add this logic in PCIe bus driver to support MSI
interrupts on 3.14 kernel.

Change-Id: I165022281c9e795be8c5e2e4a4faa34d4c004a45
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: correct PCIe PHY dump status register read
Tony Truong [Thu, 26 Mar 2015 20:31:00 +0000 (13:31 -0700)]
msm: pcie: correct PCIe PHY dump status register read

After writing to a PCIe PHY debug register, the wrong
PCIe PHY status register is being read back. This change
corrects the PCIe PHY status register that is read back.

Change-Id: If360aa6f9b4530e4c07acfcc1af684c6d7ecc234
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add PCIe support for thulium
Tony Truong [Fri, 19 Sep 2014 22:00:41 +0000 (15:00 -0700)]
msm: pcie: add PCIe support for thulium

Add PCIe support for thulium. Added enumeration,
interrupts, and hardware configurations support for
PCIe.

Change-Id: I48b2fc8a51303a6aea7b1b2a97c4de25f19ded4c
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: sanity check when calculating EP CAP offset
Tony Truong [Fri, 27 Feb 2015 23:18:31 +0000 (15:18 -0800)]
msm: pcie: sanity check when calculating EP CAP offset

When searching for the endpoint's capabilities register,
check that the value from the register read is valid.

Change-Id: Ia64de3c75618ca0a51aa4588ac97f2fcb26d8829
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: correct the shadow save for RC L1 register
Tony Truong [Fri, 27 Feb 2015 01:01:51 +0000 (17:01 -0800)]
msm: pcie: correct the shadow save for RC L1 register

When reading shadow registers, the wrong value is being
recovered for root complex L1 register. Currently,
the value being recovered is a shadow of the endpoint's
L1 register. This change will recover the correct shadow
value for RC L1 register.

Change-Id: I82b1810ef8761de90b350743cdd9b24a74efb62f
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: remove duplicate call to get aux clk from dt
Tony Truong [Thu, 19 Feb 2015 00:01:49 +0000 (16:01 -0800)]
msm: pcie: remove duplicate call to get aux clk from dt

There is an extra identical call made to check if aux clk
is supported base from PCIe device tree node. There is no
need to do this check twice; therefore, remove the duplicate
call.

Change-Id: If705e98e637287969d68ea2241e62447aa505eb0
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: only look for EP CAP reg for certain testcases
Tony Truong [Wed, 18 Feb 2015 23:45:32 +0000 (15:45 -0800)]
msm: pcie: only look for EP CAP reg for certain testcases

Not all the testcases for debugfs needs the calculated offset
of an endpoint's capability register. Therefore, only calculate
the offset of an endpoint's capanility register if that testcase
needs it.

Change-Id: Iffddcea682d8c9344f51a04b57f60ba906b01dc6
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add support to enable common clock for RC
Tony Truong [Wed, 18 Feb 2015 23:41:05 +0000 (15:41 -0800)]
msm: pcie: add support to enable common clock for RC

When the clients want to enable common clock for the
endpoint, also enable it for the root complex.

Change-Id: I55d5a69be0746a745b073051452d45a38d0a4e65
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add PCIe PHY support for FSM9010
Tony Truong [Thu, 22 Jan 2015 01:45:15 +0000 (17:45 -0800)]
msm: pcie: add PCIe PHY support for FSM9010

FSM9010 requires a different PHY sequence. Therefore,
this change adds the PCIe PHY support for FSM9010.

Change-Id: Ic98860d3ac1f7b644b76064032f399f070fc9b47
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add support to enable clk power management for EP
Tony Truong [Thu, 29 Jan 2015 02:20:25 +0000 (18:20 -0800)]
msm: pcie: add support to enable clk power management for EP

Add support to enable the clock power management for the
endpoint.

Change-Id: I02bebfeb5d32eb8e1f75ee5feb4c4fff956ece66
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add support to enable common clk config for EP
Tony Truong [Thu, 29 Jan 2015 01:08:04 +0000 (17:08 -0800)]
msm: pcie: add support to enable common clk config for EP

Add support to enable the common clock configuration for the
endpoint.

Change-Id: I9f6c33eb6cfa032837a07e437f349a7c1a60704c
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: calculate EP's capability register offsets
Tony Truong [Thu, 29 Jan 2015 00:04:53 +0000 (16:04 -0800)]
msm: pcie: calculate EP's capability register offsets

The start address of the capability register varies
depending on the endpoint. This change calculates the
endpoint's capability register offset instead of using
a fixed one.

Change-Id: I28a97d316aee8c34afe313838b91fcc06af0847f
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add PM support for multiple endpoints on a bridge
Tony Truong [Wed, 21 Jan 2015 23:27:21 +0000 (15:27 -0800)]
msm: pcie: add PM support for multiple endpoints on a bridge

In the case of multiple endpoints connected to a bridge,
PM logic is not present. Therefore, this change adds
PM support for when there are multiple endpoints on a bridge.

Change-Id: I5a1876db85d0d161ae537a09a508a93b5099aa56
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agomsm: pcie: add PCIe bus driver snapshot
Tony Truong [Thu, 2 Oct 2014 00:35:56 +0000 (17:35 -0700)]
msm: pcie: add PCIe bus driver snapshot

This PCIe bus driver snapshot is taken as of msm-3.10 commit:
 803998b (Merge "ASoC: wcd: don't set autozeroing for conga")

This change adds the PCIe bus driver and its dependecies from
msm-3.10 to msm-3.14. All the files are as is from msm-3.10.
No additional changes were made.

Change-Id: Ia1a2d0eea0cc87c16357c95bfcc4df72e910cd34
Signed-off-by: Tony Truong <truong@codeaurora.org>
8 years agoEnable CONFIG_RTC_DRV_QPNP
Mao Jinlong [Wed, 17 Feb 2016 09:07:11 +0000 (17:07 +0800)]
Enable CONFIG_RTC_DRV_QPNP

Enable CONFIG_RTC_DRV_QPNP as power_on_alarm_init is added by
change : I781389c658fb00ba7f0ce089d706c10f202a7dc6

Change-Id: I48bc69e2215e45e0c5c7bc8aa2c489fca995c201
Signed-off-by: Mao Jinlong <c_jmao@codeaurora.org>
8 years agortc: alarm: Add power-on alarm feature
Mao Jinlong [Wed, 17 Feb 2016 07:21:49 +0000 (15:21 +0800)]
rtc: alarm: Add power-on alarm feature

Android does not support powering-up the phone through alarm.
Set rtc alarm in timerfd to power-up the phone after alarm
expiration.

Change-Id: I781389c658fb00ba7f0ce089d706c10f202a7dc6
Signed-off-by: Mao Jinlong <c_jmao@codeaurora.org>
8 years agoalarmtimer: add rtc irq support for alarm
Mao Jinlong [Wed, 17 Feb 2016 07:19:08 +0000 (15:19 +0800)]
alarmtimer: add rtc irq support for alarm

Add the rtc irq support for alarmtimer to wakeup the
alarm during system suspend.

Change-Id: I41b774ed4e788359321e1c6a564551cc9cd40c8e
Signed-off-by: Xiaocheng Li <lix@codeaurora.org>
8 years agodefconfig: arm64: msm: Enable sensors SSC driver
Satya Durga Srinivasu Prabhala [Tue, 16 Feb 2016 20:17:49 +0000 (12:17 -0800)]
defconfig: arm64: msm: Enable sensors SSC driver

Enable sensors SSC driver.

Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>