Commit graph

563539 commits

Author SHA1 Message Date
Liam Mark
71edb92d82 mm, oom: make dump_tasks public
Allow other functions to dump the list of tasks.
Useful for when debugging memory leaks.

Change-Id: I76c33a118a9765b4c2276e8c76de36399c78dbf6
Signed-off-by: Liam Mark <lmark@codeaurora.org>
2016-03-22 11:03:30 -07:00
Laura Abbott
1fe8bfe88a ksm: Add showmem notifier
KSM is yet another framework which may obfuscate some memory
problems. Use the showmem notifier to show how KSM is being
used to give some insight into potential issues or non-issues.

Change-Id: If82405dc33f212d085e6847f7c511fd4d0a32a10
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2016-03-22 11:03:28 -07:00
David Keitel
c5eff6c321 mm: slub: Panic instead of restoring corrupted bytes
Resiliency of slub was added for production systems in an
attempt to restore corruptions and allow production environments
to continue to run.

In debug setups, this may no be desirable. Thus rather than
attempting to restore corrupted bytes in poisoned zones, panic
to attempt to catch more context of what was going on in the
system at the time.

Add the CONFIG_SLUB_DEBUG_PANIC_ON defconfig option to allow
debug builds to turn on this panic option.

Change-Id: I01763e8eea40a4544e9b7e48c4e4d40840b6c82d
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2016-03-22 11:03:27 -07:00
Chintan Pandya
9ec1d6c8e5 ksm: Provide support to use deferred timers for scanner thread
KSM thread to scan pages is getting schedule on definite timeout.
That wakes up CPU from idle state and hence may affect the power
consumption. Provide an optional support to use deferred timer
which suites low-power use-cases.

To enable deferred timers,
$ echo 1 > /sys/kernel/mm/ksm/deferred_timer

Change-Id: I07fe199f97fe1f72f9a9e1b0b757a3ac533719e8
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
2016-03-22 11:03:27 -07:00
Liam Mark
585690954e mm: vmscan: support equal reclaim for anon and file pages
When performing memory reclaim support treating anonymous and
file backed pages equally.

Swapping anonymous pages out to memory can be efficient enough
to justify treating anonymous and file backed pages equally.

CRs-Fixed: 648984
Change-Id: I6315b8557020d1e27a34225bb9cefbef1fb43266
Signed-off-by: Liam Mark <lmark@codeaurora.org>
2016-03-22 11:03:26 -07:00
Olav Haugan
80370b5f59 mm: vmscan: Move pages that fail swapout to LRU active list
Move pages that fail swapout to the LRU active list to reduce
pressure on swap device when swapping out is already failing.
This helps when using a pseudo swap device such as zram which
starts failing when memory is low.

Change-Id: Ib136cd0a744378aa93d837a24b9143ee818c80b3
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2016-03-22 11:03:25 -07:00
Rohit Vaswani
f4fbcaf9f7 arm64: Add support for KERNEL_TEXT_RDONLY
When using FORCE_PAGES to allocate the kernel memory into pages,
provide an option to mark the the kernel text section as read only.
Since the kernel text pages are always mapped in the kernel, anyone
can write to the page if they have the address.
Enable this option to mark the kernel text pages as read only to
trigger a fault if any code attempts to write to a page that is
part of the kernel text section.

Change-Id: I2a9e105a3340686b4314bb10cc2a6c7bfa19ce8e
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
2016-03-22 11:03:24 -07:00
Laura Abbott
a7470fb452 mm: Remove __init annotations from free_bootmem_late
free_bootmem_late is currently set up to only be used in init
functions. Some clients need to use this function past initcalls.
The functions themselves have no restrictions on being used later
minus the __init annotations so remove the annotation.

Change-Id: I7c7e15cf2780a8843ebb4610da5b633c9abb0b3d
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[abhimany@codeaurora.org: resolve minor conflict
and remove __init from nobootmem.c]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2016-03-22 11:03:23 -07:00
Abhimanyu Kapur
753315050c ARM64: mm: init: bring back poison_init_mem
Strict RWX requires poison_init_mem, bring it back
from the dead.

Change-Id: I09b88a12a47c8694e2ba178caad4415981f4f7e3
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2016-03-22 11:03:22 -07:00
Rohit Vaswani
638f367e04 arm64: mm: Do not create 1GB mappings if FORCE_PAGES is enabled
With CONFIG_FORCE_PAGES enabled, we break down the section mappings
into 4K page mappings. For 1GB mappings, remapping the pages into 4K
chunks becomes unnecessarily complicated. Skip creating the 1GB mapping
if we know it's going to be separated into 4K mappings.

Change-Id: I991768210ed6e1c1e19faf0d5d851d550e51a8c6
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
(cherry picked from commit 2528a04cba82ce3d655dabf78bc49c5b64c89647)
2016-03-22 11:03:21 -07:00
Laura Abbott
8f13b60413 mm: Mark free pages as read only
Drivers have a tendency to scribble on everything, including free
pages. Make life easier by marking free pages as read only when
on the buddy list and re-marking as read/write when allocating.

Change-Id: I978ed2921394919917307b9c99217fdc22f82c59
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit 752f5aecb0511c4d661dce2538c723675c1e6449)
2016-03-22 11:03:20 -07:00
Neeti Desai
ab7a339160 arm64: Add support for FREE_PAGES_RDONLY
Add config option to trigger page a fault if any
code attempts to write to a page on the buddy list

Change-Id: Ic5ab791c4117606519c7b9eb4c2876f246d23320
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
2016-03-22 11:03:20 -07:00
Neeti Desai
6992ec5181 arm64: Allow remapping lowmem as 4K pages
For certain debug features the lowmem needs to be
mapped as pages instead of sections. Add config
option to allow remapping of lowmem as 4K pages

Change-Id: I50179311facd91b97ecde720da38ec7e47512e95
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
2016-03-22 11:03:19 -07:00
Laura Abbott
52c49cdc5e common: DMA-mapping: Add strongly ordered memory attribute
Strongly ordered memory is occasionally needed for some DMA
allocations for specialized use cases. Add the corresponding
DMA attribute.

Change-Id: Idd9e756c242ef57d6fa6700e51cc38d0863b760d
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2016-03-22 11:03:18 -07:00
Laura Abbott
8d90eb7058 arm64: Support early fixup for CMA
Although it isn't architecturally required, CMA regions may need
to have attributes changed at runtime. Remap the CMA regions as
pages to allow this to happen.

Change-Id: I7dd7fa150ce69fdf05f8bf6f76a5ae26dd67ff1b
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[lmark@codeaurora.org: resolve merge conflicts]
Signed-off-by: Liam Mark <lmark@codeaurora.org>
2016-03-22 11:03:17 -07:00
Laura Abbott
22312706be arm64: add support for NO_KERNEL_MAPPING and STRONGLY_ORDERED
arm64 needs support for both DMA_ATTR_NO_KERNEL_MAPPING and
DMA_ATTR_STRONGLY_ORDERD. Add support for both of them.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[imaund@codeaurora.org: Resolved context conflicts]
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2016-03-22 11:03:16 -07:00
Laura Abbott
623c8d1953 dma-mapping: Add dma_remap functions
After getting an allocation from dma_alloc_coherent, there
may be cases where it is neccessary to remap the handle
into the CPU's address space (e.g. no CPU side mapping was
requested at allocation time but now one is needed). Add
APIs to bring a handle into the CPU address space again.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[imaund@codeaurora.org: resolved context conflicts and added support
  for remap 'no_warn' argument]
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2016-03-22 11:03:15 -07:00
Laura Abbott
416cca9db2 mm: Add notifier framework for showing memory
There are many drivers in the kernel which can hold on
to lots of memory. It can be useful to dump out all those
drivers at key points in the kernel. Introduct a notifier
framework for dumping this information. When the notifiers
are called, drivers can dump out the state of any memory
they may be using.

Change-Id: Ifb2946964bf5d072552dd56d8d6dfdd794af6d84
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2016-03-22 11:03:15 -07:00
Stepan Moskovchenko
f41560721c arm64: Add options to disable I/D caches
Add the ability to individually disable the Instruction and
Data caches on ARM64 CPUs, by means of the SCTLR[I] and
SCTLR[C] bits. This may be useful for performance
profiling, as well as for troubleshooting potential cache
problems.

Change-Id: Ibd7fc796ddf6984c7f05dcd844432164e28bb021
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
[abhimany: resolve trivial merge conflicts]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2016-03-22 11:03:14 -07:00
Stephen Boyd
75defbf367 memblock: Add memblock_overlaps_memory()
Add a new function, memblock_overlaps_memory(), to check if a
region overlaps with a memory bank. This will be used by
peripheral loader code to detect when kernel memory would be
overwritten.

Change-Id: I851f8f416a0f36e85c0e19536b5209f7d4bd431c
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit cc2753448d9f2adf48295f935a7eee36023ba8d3)
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
2016-03-22 11:03:13 -07:00
Hemant Kumar
912a11b8c0 usb: gadget: f_gsi: Add support for configFS
This change adds APIs to allocate and instanciate
multi instance gsi function driver using configFS.
Add an entry in kconfig to select diag driver for
configFS. This change fixes all compilation errors
caused by moving gsi driver from android.c to compile
independently.

Change-Id: I0ddb2ca155fd29c6d58fb561cc197f8efee3495a
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:03:12 -07:00
Hemant Kumar
94594f5b23 usb: gadget: f_gsi: Use rndis params structure
rndis APIs are modified to pass rndis params structure
instead of config index to load the rndis device parameters.
Hence update the API calls in gsi driver.

Change-Id: I1492752b315f57866ca39c6fe0021c4adce97c58
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:03:11 -07:00
Devdutt Patnaik
9d20d8b427 usb: f_gsi: Configure fixed GSI endpoints and related EP OPs
GSI endpoints are now fixed and need to be requested by name.
As the specific GSI endpoints or ops do not change,
it is not required to be updated on every connect/disconnect
of the cable. This will also fix suspend/disconnect race
conditions. Since GSI endpoints are fixed, gadget restart is
no longer required upon composition switch.

CRs-Fixed: 946385

Change-Id: I36de64ea95470cb19eb3f084b518618a2fe9f0df
Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
2016-03-22 11:03:10 -07:00
Devdutt Patnaik
d88f34ba6a usb: gadget: Support endpoint allocation by ep name
Implement support for allocating an EP based on name.
This allows a function driver to request an EP using an
ep name string. This is useful to request GSI specific
EPs.

CRs-Fixed: 946385

Change-Id: Id38e6e1e3c2d82f440c0507d24f18f808dc3e4dc
Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
2016-03-22 11:03:09 -07:00
Hemant Kumar
ffe172b610 usb: gadget: f_gsi: Add support for super speed function suspend
Register gsi function suspend callback with composite device to
handle super speed function suspend and resume. Also, move
function suspend option masks to composite device layer.

Change-Id: Ie316973d855612ddc5440934344d18b04d49c567
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:03:08 -07:00
Hemant Kumar
7bc7efae3f usb: gadget: Add snapshot of GSI function driver
Adds a generic function driver that will handle all functions
that support h/w acceleration to IPA over GSI.

This snapshot is taken as of msm-3.18 commit 30b0c37abcd9cf0
(Merge "msm: vidc: add support to set low latency property to
 venus")

Change-Id: I4f78a4a36727fec24b1c5481acd6d3122eeb9150
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:03:08 -07:00
Hemant Kumar
f8197f0801 USB: Debug: Add centralized debug buffer for USB drivers
Add a centralized debug buffer which can log events from all USB
drivers in gadget directory. This will help in debugging issue
from first instance rather than enabling dynamic debug log and
reproducing again.

Change-Id: Id0285d30bf640a63d904f1dd02dcd061f1819359
Signed-off-by: Tarun Gupta <tarung@codeaurora.org>
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:03:07 -07:00
Hemant Kumar
972f9346a1 usb: dwc3: Add support for GSI operations to gadget framework
Targets supporting h/w accelerated path over GSI require
GSI specific configuration of USB controller.

Add support to enable h/w accelerated path to IPA.
Include operations to configure USB endpoints as
GSI capable, allocate TRBs that are associated with
GSI capable endpoints, perform operations on these
endpoints, and enable the GSI wrapper in DWC3 controller.
This allows a function driver to use GSI based h/w
accelerated data path.

Change-Id: I62688c70a04b1fdab3e522e0af759ebab69d92d7
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:03:06 -07:00
Hemant Kumar
b4fc5ee2ec usb: gadget: rndis: Add new rndis parameters
Add pkt_alignment_factor rndis parameter. This
parameter along with max_pkt_per_xfer allow rndis
function driver to aggregate more than one IP packets
per transfer. This is done by calling newly added API
rndis_set_pkt_alignment_factor().

Change-Id: Ic9c543c388f872452e708a3a26be4ae82b54c082
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:03:05 -07:00
Hemant Kumar
a86fe70b61 usb: gadget: Add support for rndis flow control callback
Allow registration for data flow control call back from
rndis functions supporting different transport i.e.
BAM2BAM_IPA, GSI_IPA.

Change-Id: I09df5f7f81e9d9ed0cfd5e54d481db87727bbc75
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:03:04 -07:00
David Dai
c34d39a511 soc: qcom: msm_bus: relocate msm bus into soc/qcom
Change-Id: I80780a6f8d80143c697847abf82579c8e8194090
Signed-off-by: David Dai <daidavid1@codeaurora.org>
2016-03-22 11:03:03 -07:00
Hemant Kumar
32787a91ff usb: gadget: f_diag: Add support for configFS
This change adds APIs to allocate and instanciate
multi instance diag function driver using configFS.
Add an entry in kconfig to select diag driver for
configFS.

Change-Id: I428631dc63643eddb075a09d0e46e1a6b1117f0e
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:03:02 -07:00
Jack Pham
4d50aa3264 usb: gadget: Move diag dload handling to f_diag driver
Upon Diag function bind, the DLOAD memory region should be
updated with the USB PID and serial number in order to support
a persistent connection with the PC if the device reboots into
download mode.

This functionality need not be handled in the android.c driver.
The only reason it is there is to be able to locate the IO address
which is specified in device tree. Since this can be done from
the Diag function driver directly, move the handling there.

The address itself can be specified under the "qcom,msm-imem"
parent with its own "qcom,msm-imem-diag-dload" compatible string.
For now, allow falling back to retrieving the address from the
"android_usb" for backwards compatibility until the device tree
files are updated.

Change-Id: I0d6d1dac0f12b7890220d857227ae45c9258c1f2
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2016-03-22 11:03:01 -07:00
Hemant Kumar
2e6b9bea06 usb: gadget: Add snapshot of DIAG function driver
Add function driver to support Qualcomm diagnostics port over USB.

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

Change-Id: I51aaa8f6a2e05fc252ea810244ddfc99ca2741cc
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:03:01 -07:00
Hemant Kumar
c03ffc4254 Revert "kref: Remove kref_put_spinlock_irqsave()"
This reverts commit 3a66d7dca1.

Diag function driver calls kref_put_spinlock_irqsave in
diag_write_complete API. Hence revert the change.
2016-03-22 11:03:00 -07:00
Jack Pham
47bb2a3600 usb: gadget: Add remote_wakeup to struct usb_gadget
This variable keeps track of when remote_wakeup feature
has been enabled by the host. It is needed for certain
function drivers to perform alternate methods during
suspend/resume.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
2016-03-22 11:02:59 -07:00
Azhar Shaikh
a99d4a5017 usb: gadget: Disable L1 LPM capability
Disable USB L1 LPM functionality on MSM platforms by setting the
USB version as 0x200 for all High Speed Devices.
Add a module param, which when enabled will set the USB version as
0x210. Module param can be enabled as

echo Y > /sys/module/libcomposite/parameters/enable_l1_for_hs

Change-Id: I781a237b44e542c6089af36b7ce0a0665d3cd440
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
2016-03-22 11:02:58 -07:00
Shimrit Malichi
37648e8eb6 usb: gadget: Add link power management support
Link Power Management (a.k.a. L1) is similar to the existing usb bus
suspend/resume/remote-wakeup, but has transitional latencies of tens
of microseconds between power states (instead of three to greater than
20 millisecond latencies of the USB 2.0 suspend/resume).

Change-Id: I8ae493534702e658c24f384a6b705b08e9ea9d05
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
Signed-off-by: Tarun Gupta <tarung@codeaurora.org>
2016-03-22 11:02:57 -07:00
Mayank Rana
f67850e9f0 usb: gadget: Draw 900mA current when enumerating in super speed mode
Currently 500mA is used as max allowable current to draw with USB SDP
case in both super speed and high speed mode. In super speed mode it
is allowed to draw 900mA current. Hence update allowable current to
draw based on USB connection speed. This change doesn't consider any
configuration based allowable max current.

Change-Id: Iae9ecf586135b0a2064e7d5e6e8fa3d8e7e4fb70
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2016-03-22 11:02:56 -07:00
Mayank Rana
2c9b669728 usb: gadget: composite: Protect cdev in composite_suspend()
With USB cable disconnect case, there is race happening when
composite_suspend() is being pre-empted just after getting
reference to cdev structure (suspend flow) and cdev->config
set to NULL as part of reset_config() (disconnect flow). This
results into composite_suspend() using bad value with cdev->config
which is resulting in some cases multiple time calling f->suspend().
Fix this issue by protecting cdev in composite_suspend() API.

CRs-Fixed: 916718
Change-Id: Id0b2a254f64621fcbc19c0556265e9b7b32f1382
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2016-03-22 11:02:55 -07:00
Hemant Kumar
28ddcdd099 usb: gadget: Fix bug is queuing req upon Function Suspend
In case of Super speed function suspend without bus suspend,
if function driver queues a request, usb_gadget_func_wakeup()
directly issues Function Wakeup command to controller and returns
success. As a result request is queued to endpoint before receiving
function resume from host. This causes ep queue to fail when it is
done upon function resume as request is already queued. If function
driver tries to queue any request further this results into request
packet drop as ep queue returns error -EBUSY. Hence do not queue
request in function wake up context, instead wait for function
resume to queue the request.

CRs-Fixed: 848622
Change-Id: I00aea59fb2cbe59190dadb4c838534cc9e4ffcf3
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2016-03-22 11:02:54 -07:00
Mayank Rana
f8f56d6a1d gadget: composite: Fix crash seen when SS descriptor is not available
In some cases, composite device may have multiple interfaces and one of
interface may not support USB super speed functionality. When host is
trying to enumerate this composite device into super speed mode by
sending SET_CONFIG(1), it results into crash due to ss descriptors are
not available for particular interface. Hence add check against ss
descriptors and fail SET_CONFIG(1). This results into some of host try
to re-enumerate USB composite device with only interface which support
super speed mode.

Change-Id: Ib909f3d451e247c0415863689711e66b15fa2fa5
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2016-03-22 11:02:53 -07:00
Vijayavardhan Vennapusa
bdf0a2e431 USB: f_mass_storage: Send GADGET_DELAYED_STATUS for MSC RESET command
When Host sends MSC RESET command to the device, device is expected
to clear HALT condition on the bulk IN endpoint as part of handling it,
before sending status phase to the Host. Since handling of MSC RESET is
done by sending signal to fsg_thread, it could take time for handling it.
It could lead to sending bulk IN endpoint as halted, when host asks for
endpoint status as status phase is sent for MSC RESET command immediately
after it is received. Due to this, MSC compliance tests fail. Hence send
delayed status in case of MSC RESET and send status phase after it is
handled and cleared halt condition.

CRs-Fixed: 547929
Change-Id: If80d0ffb2d012724b899772b1b45dff8092bd8d5
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2016-03-22 11:02:52 -07:00
Mayank Rana
92e284a5d5 Revert "usb: gadget: composite: enable BESL support"
Commit a6615937bc ("usb: gadget: composite: enable BESL support")
enables LPM L1 support and advertises this capability to host. It
has been observed that when host is supporting LPM L1 functionality
and triggering it, device controller goes into L1 state but software
is not able to get controller out of L1 state using Link Recovery
functionality which results into USB enumeration issue with host.
Hence to fix this issue disable LPM L1 support from device side.

CRs-Fixed: 856808
Change-Id: I119423363a19be469782d016ae13155697d39afe
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2016-03-22 11:02:51 -07:00
Hemant Kumar
e9c2362e33 usb: gadget: Invalidate interface id upon adding function to config
Commit e9df68ade ("usb: gadget: f_mbim: Queue notification request
upon function resume") added variable to store interface id in
usb_interface_id(). This interface id is used to send function wake
device notification. Functions having control interface and data
interface calls usb_interface_id() twice causing invalid interface
index stored in the variable. This is causing remote wakeup failure.
Fix this issue by initializing variable to -EINVAL and set it to
interface index only when it is invalidated.

CRs-Fixed: 810737
Change-Id: I41bce0a71ce0b8e92f3736d4e292132ce16de021
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
2016-03-22 11:02:50 -07:00
ChandanaKishori Chiluveru
d025d9d530 usb: gadget: Ignore the second set_config from the host
Some USB hosts may send SET_CONFIGURATION with same value twice.
The current code implementation of android_work() issues disconnect
event to userspace if SetConfiguration with non-zero value is sent
twice. The Userspace application may disconnect USB and it causes
fail to connect to the USB host.

Fix this by ignoring the second time SET_CONFIGURATION request
from the host only for the same configuration value twice.

CRs-Fixed: 661220
Change-Id: Iec8dd7824fa9f371ea147784cf9137aa88a7128e
Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>
2016-03-22 11:02:49 -07:00
Vijayavardhan Vennapusa
15d49a1051 USB: composite: Hold spinlock before calling usb_func_wakeup_int() API
There is a chance that composite_resume might race with android_disable
if composition switch happens and at the same time, reset interrupt is
triggered. In this case, it could lead to accessing invalid address as
composite_resume() not calling usb_func_wakeup_int() without holding
spinlock. Hence modfiy usb_func_wakeup_int() such that caller of this
function should call it with spinlock holding to fix the issue.

CRs-Fixed: 799332
Change-Id: I97ef374923504977ac8fc32954dd7de834a01041
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
2016-03-22 11:02:49 -07:00
Hemant Kumar
7010bdba62 usb: gadget: f_mbim: Queue notification request upon function resume
In super speed mode if userspace issues a write after usb bus suspend
usb_func_ep_queue() schedules wakeup to resume the function. After that
it queues the request which fails with -ENOTSUPP. As a result no
notification request queued to hw and write request gets delayed to be
sent until another write request comes and queues notification request
after function resume. This causes mismatch to the mbim request response.
Fix this by queuing the notification request upon function resume if
notify count is greater than zero. Also, drop control packet after bus
suspend if remote wakeup is not supported or if ep enqueue returns error
other than -EAGAIN.

CRs-Fixed: 789467
Change-Id: I446de1eb169b4ccb8f4db5f003b622d7b9c0b22b
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
2016-03-22 11:02:48 -07:00
Mayank Rana
7c99b9d4d4 dwc3: gadget: Replace polling mechnism to go into U0 state
Moving into U0 state is being confirmed by polling for 100ms after
performing remote wakeup from device. In some of cases where host is
taking more time to respond, remote wakeup is failing. Also USB
specification does not define any limit for the host response time.
Hence this change replaces polling mechnism by using LINK status
change event notification with core and increase host response time
from 100ms to 3 seconds. It also makes sure that composite_resume()
is being called after remote wakeup is completed succesfully.

It removes some of flag used to avoid race between bus suspend/resume
and fuction suspend/resume as those are serialize and not required
anymore.

CRs-Fixed: 712681
Change-Id: I71285daf117282c738e139e9a05ead6ef16dd202
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2016-03-22 11:02:47 -07:00
Pavankumar Kondeti
691d89ad03 usb: composite: don't print the invalid function wakeup failure messages
The function level suspend/resume/wakeup are supported in super speed
mode only. The usb_func_wakeup() is called for every function during
resume irrespective of the operating speed. This function returns
-ENOTSUPP when the gadget is not operating in super speed. Don't print
the error message in this case. Otherwise an error message is printed
for each function during high/full speed device resume.

CRs-Fixed: 750230
Change-Id: I6f600fe7fa9a037b83909265229acdc668329d6a
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2016-03-22 11:02:46 -07:00