Commit Graph

330 Commits

Author SHA1 Message Date
Stepan Moskovchenko 92223f51b7 msm: Add support for MSM8930AB
Update cpu_is call sites and users of the 8930 CPU macro to
to include support for MSM8930AB where appropriate.

Change-Id: I9d82a2f245e57bed65c857c46e11b3ee9a57c0a9
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2013-09-04 15:29:38 -07:00
Shalabh Jain 7e6d45b813 diag: fix partial smd read
DIAG from peripheral processors sends data to Linux
using SMD channels. Sometimes data can be bigger than
the size that SMD can accommodate. This results in partial
packet. This change adds capability to read the entire
packet.

Change-Id: I5588115998ad290ab62113eea92c6b2d06931773
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
2013-09-04 15:29:24 -07:00
Stepan Moskovchenko 2bd4f120d4 msm: Refactor cpu_is macros into SoC classes
Refactor common combinations of cpu_is macros into logical
SoC class macros to reduce the maintenance burden of
implementing support for additional product variants.

Change-Id: I6472eb70fa43e1217ff3ebb3643288196b9864b5
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2013-09-04 15:29:10 -07:00
Shalabh Jain 08b808e838 diag: Add logs & events streaming support for DCI
Diag driver is adding a new feature to stream logs & events to a
user space application on Linux processor. This will eliminate
need to connect QXDM to receive diag traffic.
This is known as Diag Consumer Interface (DCI).

Change-Id: I7983bb7d9b8a0429ebbee290868c8bd0e562953f
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
2013-09-04 15:28:13 -07:00
Shalabh Jain 5ef50badba diag: Edit order of initialization
DIAG driver intializes several work structures. Changing the
order of some initialization functions to make sure structures
are initialized before being used.

Change-Id: I4cc329ff116c548e6fed7277305e69804e21174e
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
2013-09-04 15:24:55 -07:00
Dixon Peterson d9615e4b15 diag: Reorganize code to provide improved functional access
The diag kernel code has some large files that are
becoming unwieldly. Separate out existing debugfs and mask
related code into their own respective files to allow easier
functional access and reduce file size.

Change-Id: Ifde0963a3682f787dc892fb136d9d7d7ae1b7c01
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
2013-09-04 15:23:46 -07:00
Jay Chokshi 694705dc3d msm: Add support for APQ8064AB variant
Update the call sites of cpu_is_apq8064() to include an
additional check for the APQ8064AB target where
appropriate.

Change-Id: I40cfefeb0579766773aa74785a83eafa5946eb9e
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
2013-09-04 15:23:42 -07:00
Dixon Peterson ff47776840 diag: Fix check for reissue of smd control channel read
If there are no messages of type DIAG_CTRL_MSG_REG in the
data being processed on the smd control channel, then the
channel is not rechecked after processing is completed to
see if the channel has more data to be read.  Add check
to ensure the channel is checked for more data regardless
of the types of messages being processed.

CRs-Fixed: 405424
Change-Id: I5580aaa29db973e1ef02b5db81feb4da4b3b09b8
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
2013-09-04 15:23:15 -07:00
Ashay Jaiswal 630e8e142a diag: Rename QDSP to LPASS
QDSP can be used as modem and does not always mean LPASS. This variable
is used for LPASS functionality, thus renaming it to LPASS.

Change-Id: Id4ca0ff57deff5605836d3e215496138287308d5
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
2013-09-04 15:21:08 -07:00
Shalabh Jain 85d706740f diag: Add status field in response packet
DIAG driver responds to "diasble logging" command. The
response should have a status field, which was missing
until now. This change adds the missing field.

Change-Id: Idbea6662b9761374a596dd28421a2ae2fac41133
CRs-Fixed: 384181
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
2013-09-04 15:20:26 -07:00
Jack Pham 14222b818a diag: hsic: Fix improper opening/closing of diag_bridge
diag_bridge_open/close should not be called multiple times, as it
would incorrectly increase/decrease the internal reference counter.
This could respectively lead to either a stale device structure when
HSIC is disconnected, or a NULL pointer when HSIC is reconnected.

Fix this by adding a check in the bridge open routine to disallow
further calls if the bridge is already open, and similarly in close
to no-op if the bridge isn't open. Also add a mutex to the diagfwd
driver to serialize access to the various state variables such as
hsic_device_enabled and hsic_device_opened and to prevent near-
simultaneous calls to diag_bridge_open. In particular, the platform
device probe (or remove) and the callback for cable connect
(disconnect) could potentially execute concurrently; only one should
"win" calling diag_bridge_open (or close) successfully.

CRs-fixed: 395637
Change-Id: I5674285065cd63f89bf657cad770f04d53efb247
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2013-09-04 15:19:48 -07:00
Ashay Jaiswal 7d068a6d3a diag: Separate packet stream for local and remote processors.
diag driver adds token identifier for diag output stream which
is used by diag user-space library to separate the packet stream
for local and remote proc.
For input stream diag driver uses the token (added by user space
library) to identify mask packets for local and remote proc.

CRs-Fixed: 368306
CRs-Fixed: 368301
Change-Id: I3f4dfbd35b42218a168fbee0d385075ce9ab8f49
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
2013-09-04 15:19:30 -07:00
Dixon Peterson 6f55d53cce diag: Rate limit usb write error messages for hsic data
When writing hsic data on the usb (usb_diag_write) the device
can get into the state where an error is returned each time.
If this happens, then the device is flooded with these messages.
Prevent the flooding with messages by rate limiting the error
message.

Change-Id: I0cbec8680197e2f678b336f9b9d4ed49b4c2a91a
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
2013-09-04 15:18:57 -07:00
Dixon Peterson af4b127525 diag: fix hsic concurrency issue when in MEMORY_DEVICE_MODE
When the logging mode changes to MEMORY_DEVICE_MODE, an array
is used to house the pointers to the data read from the hsic
until the data can be copied to user space. Since the storing
and copying actions access this array in different threads,
access to this array can result in concurrent access by these
threads. Note that the storing access to the array happens in
interrupt context and the copying access happens in process
context.  Use spin_locks to protect agains this concurrency
issue.

Also, there is unnecessary queuing of the hsic read work function
on the work queue. Add checks to remove this unnecessary queuing.

Change-Id: I2835435200bca4086d34c0dfb6e88da473dfff1f
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
2013-09-04 15:17:53 -07:00
Shalabh Jain 96680d3791 diag: Add missing "get log mask" command
DIAG service responds to "get log mask" command sent by tools.
This was typically responded to by modem. On modem less devices,
this command still needs response. Adding support on Linux processor
for this command.

CRs-Fixed: 388740
Change-Id: Id94645ae21117e9952b852855401eadd060279ee
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
2013-09-04 15:14:27 -07:00
Jack Pham b4add8dbdd usb: diag_bridge: call bridge callbacks even for -EPROTO
The diagfwd_hsic driver acts as a client of the bridge and must
have its read/write callbacks called so it can properly free its
memory buffers. In the case of the HSIC device being disconnected,
the URB status is -EPROTO but the callback was withheld, which
led to lost buffers when the HSIC device is disconnected. Fix this
by always calling the callbacks, while continuing to treat -EPROTO
as a special case by returning -ENODEV on subsequent reads and
writes. Also fix a major but tiny gotcha in diagfwd's read function
in which the 'err' variable is additionally declared and used in a
local scope but is read outside it.

CRs-fixed: 394401
Change-Id: I2d4f7a2cf1caa5565d4131890fa39181aee8e4a2
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2013-09-04 15:14:24 -07:00
Shalabh Jain 34b10dfa49 adiag: Add new entry in message mask table
DIAG driver maintains a table of F3 masks. This table
has to be in sync with modem mask information. Modem
updates are not synchronized with Linux code updates.
Hence, sometimes modem and Linux go out of sync. This
results in missing F3 messages.

Adding this entry will resolve the dependency of manual
syncing and will make mask updates dynamic.

CRs-Fixed: 388505
Change-Id: I23fbe7171bb33cc0723d1b0cb069b41d62ba4231
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
2013-09-04 15:13:50 -07:00
Dixon Peterson 5d3f1f0c8c diag: Increase HSIC throughput by implementing multiple simultaneous reads
The HSIC implementation has been found to be too slow causing
the dropping of logs. The HSIC implementation is using a one-in-one-out
read buffer strategy. This strategy coupled with the high latency of
callbacks is leading to poor throughput, and thus the dropping of
logs. Modify the implementation to queue up multiple simultaneous
read requests on the HSIC. Manage these read buffers using a memory
pool.

Change-Id: I7cf334f54ebc41d0e222732e4cf68e158f015c67
CRs-Fixed: 373328
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
2013-09-04 15:13:09 -07:00
Ashay Jaiswal 2165ce75dd diag: Add support for QSC restart
Add cleanup of SMUX port once disconnect event is
received by diagfwd driver.

CRs-Fixed: 376401
Change-Id: I5ef07c8ccbfcc4ad6c5e41b3d985bdea434ab9ce
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
2013-09-04 15:11:50 -07:00
Dixon Peterson 70d0a7efd0 diag: Fix problem with stopping of logging data
On-Device Logging at very high logging rates can cause
a race condition where the buffers reading in data from
the smd channel are filled with data and are not having
their data logged to userspace.  Detect this condition
and restart the logging process.

CRs-Fixed: 382128
Change-Id: I3bb4cfae1bd72d2575c32e800973fac558beae7c
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
2013-09-04 15:07:17 -07:00
Dixon Peterson 73c8334e50 diag: Add support for sockets
diag does not support logging to sockets. Add support for
new socket logging mode to support sockets.

Change-Id: I1134859825f9e075ee911c94376a239d748e311f
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
2013-09-04 15:06:42 -07:00
Shalabh Jain da27a7195e diag: Move registration cleanup function to work queue
The peripheral registrations are stored in a table
on apps processor. During SSR, these need to be deleted
and fresh ones are recorded after SSR completes. Currently
this clean up function is called from interrupt context.

This cleanup function works on a shared table, which is
protected by mutexes. Using this mutex in interrupt function
causes bug with spinlocks and generates warnings. Moving this
cleanup to work queue resolves the issue.

However, there might be race condition with this move. A new
registration might come in, while the clean up is still going on
OR yet to begin. Adding a bit mask which tracks the peripheral
undergoing SSR. if new registration is received from this processor
before clean up is completed, the registration packet is dropped.
Also, an error message is printed in kernel to notify of the drop.

Change-Id: I95e143220a3960d4e9459bb9874bab2911be0937
CRs-Fixed: 371866
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
2013-09-04 15:04:16 -07:00
Stepan Moskovchenko 8a2500501d msm: Add preliminary support for MSM8960AB
Update the call sites of cpu_is_msm8960() to include an
additional check for the MSM8960AB target where
appropriate.

Change-Id: I54b1b9dccde2f21ada27bc64df02c2cb313ff1d1
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2013-09-04 15:01:20 -07:00
Shalabh Jain 1b8b3c4329 diag: Add missing SSID range
OEMs use SSID in a specific range. Recently DIAG changed the mask
update algorithm and this range was missed as its not used internally.
This change adds it back.

CRs-Fixed: 359379
Change-Id: Ib7249f157e4e37294b6da6580fcf19995afeef8f
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
2013-09-04 15:00:54 -07:00
Stepan Moskovchenko fdd8907720 msm: Add support for MSM8930AA
Update the call sites of cpu_is_msm8930() to include checks
for the MSM8930AA() variant. Relevant drivers will be
updated for more driver-specific specific MSM8930AA checks
at a later time.

Change-Id: Iff1af7a5454ec56c40390682ce2b4b6d1d325c91
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2013-09-04 15:00:29 -07:00
Abhimanyu Kapur 3985b8ede1 msm: 8974: rename copper to 8974
The official name for copper is MSM8974.
Switch to it.

Change-Id: Ifb241232111139912477bf7b5f2e9cf5d38d0f9e
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2013-09-04 14:58:47 -07:00
Shalabh Jain fd7da92109 diag: Add notification for DCI
Until now, DIAG user space clients were unaware of smd
channel state in kernel. This change will add a notification
mechanism for DCI clients. This will notify the client if any
DCI smd channel comes up.

Change-Id: I043ab15505b40a23ba0e6ac6488ddfa8d80ae4a7
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
2013-09-04 14:56:31 -07:00
Shalabh Jain 2906ecf526 diag: Fix pointer for correct parsing
Mistakenly incorrect pointer was incremented.

Change-Id: I8b8aac33831628df278e5b794ce9975232f23775
CRs-Fixed: 363226
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
2013-09-04 14:56:16 -07:00
Jack Pham c11dd5dee6 usb: diag_bridge: Fix error handling during disconnect
usb_autopm_get_interface() returns an error if runtime PM is disabled,
yet this should not impede the ability to submit URBs. This can happen
just as the device is removed but the interface driver's disconnect()
routine has not been called. Thus any client wishing to call read or
write may errorneously continue to call and might eventually flood the
console with excessive printks which could cause a watchdog timeout. So
treat -EAGAIN and -EACCES as okay and only bail on other error values.

Also, rate-limit the printks associated with reading/writing on the
bridge to further avoid the possibility of excessive logging during
similar corner cases.

Finally, use -ENODEV as an indicator that read/write should halt. This
will handle the case when an URB fails to submit late in the device
disconnect stage, and the client should not attempt any more submissions.

CRs-fixed: 370694
Change-Id: Ia5f4a4bd7ed620eedd2cd00c117066b8c7eb4f8c
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2013-09-04 14:54:35 -07:00
Stephen Boyd e5249a3033 char: Add DIAG driver
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 14:47:04 -07:00